ngx-materialize
Version:
An Angular wrap around Materialize library
1,382 lines (1,339 loc) • 520 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('tslib'), require('@angular/common'), require('@angular/forms'), require('rxjs'), require('rxjs/operators'), require('@angular/animations')) :
typeof define === 'function' && define.amd ? define('ngx-materialize', ['exports', '@angular/core', 'tslib', '@angular/common', '@angular/forms', 'rxjs', 'rxjs/operators', '@angular/animations'], factory) :
(factory((global['ngx-materialize'] = {}),global.ng.core,global.tslib,global.ng.common,global.ng.forms,null,global.Rx.Observable.prototype,global.ng.animations));
}(this, (function (exports,core,tslib_1,common,forms,rxjs,operators,animations) { 'use strict';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzBadgeComponent = (function () {
function MzBadgeComponent() {
}
MzBadgeComponent.decorators = [
{ type: core.Component, args: [{
selector: 'mz-badge',
template: "<span #badge\n class=\"badge {{ badgeClass }}\"\n [class.new]=\"new || !!badgeClass\"\n [attr.data-badge-caption]=\"caption\">\n {{ value }}\n</span>\n",
styles: [""],
},] },
];
/** @nocollapse */
MzBadgeComponent.propDecorators = {
"badgeClass": [{ type: core.Input },],
"caption": [{ type: core.Input },],
"new": [{ type: core.Input },],
"value": [{ type: core.Input },],
};
return MzBadgeComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzBadgeModule = (function () {
function MzBadgeModule() {
}
MzBadgeModule.decorators = [
{ type: core.NgModule, args: [{
declarations: [MzBadgeComponent],
exports: [MzBadgeComponent],
},] },
];
return MzBadgeModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @abstract
*/
var /**
* @abstract
*/ Handlers = (function () {
function Handlers() {
}
return Handlers;
}());
var HandlePropChanges = (function () {
function HandlePropChanges() {
}
/**
* @param {?} changes
* @return {?}
*/
HandlePropChanges.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
if (this.handlers) {
this.executePropHandlers(changes);
}
};
/**
* @param {?=} props
* @return {?}
*/
HandlePropChanges.prototype.executePropHandlers = /**
* @param {?=} props
* @return {?}
*/
function (props) {
var _this = this;
if (props === void 0) {
props = this.handlers;
}
Object.keys(props).forEach(function (prop) {
if (_this.handlers[prop]) {
var /** @type {?} */ previousValue = ((props[prop])).previousValue;
_this.handlers[prop](previousValue);
}
});
};
return HandlePropChanges;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzInjectionService = (function () {
function MzInjectionService(applicationRef, componentFactoryResolver, injector) {
this.applicationRef = applicationRef;
this.componentFactoryResolver = componentFactoryResolver;
this.injector = injector;
}
/**
* Appends a component to an adjacent location.
*/
/**
* Appends a component to an adjacent location.
* @template T
* @param {?} componentClass
* @param {?=} options
* @param {?=} location
* @return {?}
*/
MzInjectionService.prototype.appendComponent = /**
* Appends a component to an adjacent location.
* @template T
* @param {?} componentClass
* @param {?=} options
* @param {?=} location
* @return {?}
*/
function (componentClass, options, location) {
var _this = this;
if (options === void 0) {
options = {};
}
if (location === void 0) {
location = this.getContainerElement();
}
// instantiate component to load
var /** @type {?} */ componentFactory = this.componentFactoryResolver.resolveComponentFactory(componentClass);
var /** @type {?} */ componentRef = componentFactory.create(this.injector);
// project the options passed to the component instance
this.projectComponentInputs(componentRef, options);
// attach view for dirty checking
this.applicationRef.attachView(componentRef.hostView);
// detach view when component is destroyed
componentRef.onDestroy(function () {
_this.applicationRef.detachView(componentRef.hostView);
});
// append component to location in the DOM where we want it to be rendered
var /** @type {?} */ componentRootNode = this.getComponentRootNode(componentRef);
location.appendChild(componentRootNode);
return componentRef;
};
/**
* Overrides the default container element.
*/
/**
* Overrides the default container element.
* @param {?} container
* @return {?}
*/
MzInjectionService.prototype.setRootViewContainer = /**
* Overrides the default container element.
* @param {?} container
* @return {?}
*/
function (container) {
this.container = container;
};
/**
* Gets the html element for a component ref.
* @param {?} componentRef
* @return {?}
*/
MzInjectionService.prototype.getComponentRootNode = /**
* Gets the html element for a component ref.
* @param {?} componentRef
* @return {?}
*/
function (componentRef) {
return /** @type {?} */ (((componentRef.hostView)).rootNodes[0]);
};
/**
* Gets the container element.
* @return {?}
*/
MzInjectionService.prototype.getContainerElement = /**
* Gets the container element.
* @return {?}
*/
function () {
return this.container || document.body;
};
/**
* Projects the inputs onto the component.
* @template T
* @param {?} component
* @param {?} options
* @return {?}
*/
MzInjectionService.prototype.projectComponentInputs = /**
* Projects the inputs onto the component.
* @template T
* @param {?} component
* @param {?} options
* @return {?}
*/
function (component, options) {
if (options) {
var /** @type {?} */ props = Object.getOwnPropertyNames(options);
try {
for (var props_1 = tslib_1.__values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {
var prop = props_1_1.value;
component.instance[prop] = options[prop];
}
}
catch (e_1_1) {
e_1 = { error: e_1_1 };
}
finally {
try {
if (props_1_1 && !props_1_1.done && (_a = props_1.return))
_a.call(props_1);
}
finally {
if (e_1)
throw e_1.error;
}
}
}
return component;
var e_1, _a;
};
MzInjectionService.decorators = [
{ type: core.Injectable },
];
/** @nocollapse */
MzInjectionService.ctorParameters = function () {
return [
{ type: core.ApplicationRef, },
{ type: core.ComponentFactoryResolver, },
{ type: core.Injector, },
];
};
return MzInjectionService;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzInjectionModule = (function () {
function MzInjectionModule() {
}
MzInjectionModule.decorators = [
{ type: core.NgModule, args: [{
providers: [MzInjectionService],
},] },
];
return MzInjectionModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @abstract
*/
var MzRemoveComponentHost = (function () {
function MzRemoveComponentHost(elementRef) {
this.elementRef = elementRef;
this.childrenElement = [];
}
/**
* @return {?}
*/
MzRemoveComponentHost.prototype.ngAfterViewInit = /**
* @return {?}
*/
function () {
var /** @type {?} */ hostElement = this.elementRef.nativeElement;
this.parentElement = hostElement.parentElement;
// move child out of the host element
while (hostElement.firstChild) {
this.childrenElement.push(this.parentElement.insertBefore(hostElement.firstChild, hostElement));
}
};
/**
* @return {?}
*/
MzRemoveComponentHost.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
var _this = this;
// remove moved out element
this.childrenElement.forEach(function (childElement) { return _this.parentElement.removeChild(childElement); });
};
/** @nocollapse */
MzRemoveComponentHost.ctorParameters = function () {
return [
{ type: core.ElementRef, decorators: [{ type: core.Inject, args: [core.ElementRef,] },] },
];
};
return MzRemoveComponentHost;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzButtonDirective = (function (_super) {
tslib_1.__extends(MzButtonDirective, _super);
function MzButtonDirective(elementRef, renderer) {
var _this = _super.call(this) || this;
_this.elementRef = elementRef;
_this.renderer = renderer;
return _this;
}
/**
* @return {?}
*/
MzButtonDirective.prototype.ngOnInit = /**
* @return {?}
*/
function () {
this.initHandlers();
this.initMaterialize();
_super.prototype.executePropHandlers.call(this);
};
/**
* @return {?}
*/
MzButtonDirective.prototype.initHandlers = /**
* @return {?}
*/
function () {
var _this = this;
this.handlers = {
disabled: function () { return _this.handleDisabled(); },
flat: function () { return _this.handleFlat(); },
float: function () { return _this.handleFloat(); },
large: function () { return _this.handleLarge(); },
noWaves: function () { return _this.handleNoWaves(); },
};
};
/**
* @return {?}
*/
MzButtonDirective.prototype.initMaterialize = /**
* @return {?}
*/
function () {
this.renderer.setElementClass(this.elementRef.nativeElement, 'btn', true);
};
/**
* @return {?}
*/
MzButtonDirective.prototype.handleDisabled = /**
* @return {?}
*/
function () {
this.renderer.setElementClass(this.elementRef.nativeElement, 'disabled', this.disabled);
};
/**
* @return {?}
*/
MzButtonDirective.prototype.handleFlat = /**
* @return {?}
*/
function () {
this.renderer.setElementClass(this.elementRef.nativeElement, 'btn', !this.flat);
this.renderer.setElementClass(this.elementRef.nativeElement, 'btn-flat', this.flat);
};
/**
* @return {?}
*/
MzButtonDirective.prototype.handleFloat = /**
* @return {?}
*/
function () {
this.renderer.setElementClass(this.elementRef.nativeElement, 'btn-floating', this.float);
};
/**
* @return {?}
*/
MzButtonDirective.prototype.handleLarge = /**
* @return {?}
*/
function () {
this.renderer.setElementClass(this.elementRef.nativeElement, 'btn-large', this.large);
};
/**
* @return {?}
*/
MzButtonDirective.prototype.handleNoWaves = /**
* @return {?}
*/
function () {
this.renderer.setElementClass(this.elementRef.nativeElement, 'waves-effect', !this.noWaves);
if (!this.flat) {
this.renderer.setElementClass(this.elementRef.nativeElement, 'waves-light', !this.noWaves);
}
};
MzButtonDirective.decorators = [
{ type: core.Directive, args: [{
selector: "\n a[mz-button],\n a[mzButton],\n button[mz-button],\n button[mzButton]",
},] },
];
/** @nocollapse */
MzButtonDirective.ctorParameters = function () {
return [
{ type: core.ElementRef, },
{ type: core.Renderer, },
];
};
MzButtonDirective.propDecorators = {
"disabled": [{ type: core.Input },],
"flat": [{ type: core.Input },],
"float": [{ type: core.Input },],
"large": [{ type: core.Input },],
"noWaves": [{ type: core.Input },],
};
return MzButtonDirective;
}(HandlePropChanges));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzButtonModule = (function () {
function MzButtonModule() {
}
MzButtonModule.decorators = [
{ type: core.NgModule, args: [{
declarations: [MzButtonDirective],
exports: [MzButtonDirective],
},] },
];
return MzButtonModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzHalfwayFabDirective = (function () {
function MzHalfwayFabDirective() {
}
MzHalfwayFabDirective.decorators = [
{ type: core.Directive, args: [{
selector: "\n a[mz-halfway-fab],\n a[mzHalfwayFab],\n button[mz-halfway-fab],\n button[mzHalfwayFab]",
},] },
];
/** @nocollapse */
MzHalfwayFabDirective.propDecorators = {
"true": [{ type: core.HostBinding, args: ['class.halfway-fab',] },],
};
return MzHalfwayFabDirective;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzHalfwayFabModule = (function () {
function MzHalfwayFabModule() {
}
MzHalfwayFabModule.decorators = [
{ type: core.NgModule, args: [{
imports: [common.CommonModule],
declarations: [
MzHalfwayFabDirective,
],
exports: [
MzHalfwayFabDirective,
],
},] },
];
return MzHalfwayFabModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzCardComponent = (function () {
function MzCardComponent(changeDetectorRef) {
this.changeDetectorRef = changeDetectorRef;
this.hasCardAction = true;
this.hasCardImage = true;
this.hasCardImageTitle = true;
this.hasCardTitle = true;
}
/**
* @return {?}
*/
MzCardComponent.prototype.ngAfterViewInit = /**
* @return {?}
*/
function () {
this.hasCardTitle = this.hasTitleTagAndNotEmpty();
this.hasCardAction = this.hasActionTagAndNotEmpty();
this.hasCardImage = this.hasImageTagAndNotEmpty();
this.hasCardImageTitle = this.hasImageTitleTagAndNotEmpty();
this.changeDetectorRef.detectChanges();
};
/**
* @return {?}
*/
MzCardComponent.prototype.hasActionTagAndNotEmpty = /**
* @return {?}
*/
function () {
var /** @type {?} */ cardActionElement = this.cardAction.nativeElement.querySelector('mz-card-action');
return this.isElementDisplayed(cardActionElement);
};
/**
* @return {?}
*/
MzCardComponent.prototype.hasImageTagAndNotEmpty = /**
* @return {?}
*/
function () {
var /** @type {?} */ cardImagelement = this.cardImage.nativeElement.querySelector('mz-card-image');
return this.isElementDisplayed(cardImagelement);
};
/**
* @return {?}
*/
MzCardComponent.prototype.hasImageTitleTagAndNotEmpty = /**
* @return {?}
*/
function () {
var /** @type {?} */ cardImageTitleElement = this.cardImage.nativeElement.querySelector('mz-card-image-title');
return this.isElementDisplayed(cardImageTitleElement);
};
/**
* @return {?}
*/
MzCardComponent.prototype.hasTitleTagAndNotEmpty = /**
* @return {?}
*/
function () {
var /** @type {?} */ cardTitleElement = this.cardTitle ? this.cardTitle.nativeElement.querySelector('mz-card-title') : null;
return this.isElementDisplayed(cardTitleElement);
};
/**
* @param {?} element
* @return {?}
*/
MzCardComponent.prototype.isElementDisplayed = /**
* @param {?} element
* @return {?}
*/
function (element) {
return element && element.innerHTML.trim() !== '';
};
MzCardComponent.decorators = [
{ type: core.Component, args: [{
selector: 'mz-card',
template: "<div #cardImage class=\"card-image\" *ngIf=\"hasCardImage\">\n <ng-content select=\"mz-card-image\"></ng-content>\n <div class=\"card-title\" *ngIf=\"hasCardImageTitle\">\n <ng-content select=\"mz-card-image-title\"></ng-content>\n </div>\n</div>\n\n<div [class.card-stacked]=\"horizontal\">\n <div class=\"card-content\">\n <div #cardTitle class=\"card-title\" *ngIf=\"hasCardTitle\">\n <ng-content select=\"mz-card-title\"></ng-content>\n </div>\n\n <ng-content select=\"mz-card-content\"></ng-content>\n </div>\n\n <div #cardAction class=\"card-action\" *ngIf=\"hasCardAction\">\n <ng-content select=\"mz-card-action\"></ng-content>\n </div>\n</div>",
styles: [":host{display:block}"],
},] },
];
/** @nocollapse */
MzCardComponent.ctorParameters = function () {
return [
{ type: core.ChangeDetectorRef, },
];
};
MzCardComponent.propDecorators = {
"true": [{ type: core.HostBinding, args: ['class.card',] },],
"horizontal": [{ type: core.HostBinding, args: ['class.horizontal',] }, { type: core.Input },],
"hoverable": [{ type: core.HostBinding, args: ['class.hoverable',] }, { type: core.Input },],
"cardAction": [{ type: core.ViewChild, args: ['cardAction',] },],
"cardImage": [{ type: core.ViewChild, args: ['cardImage',] },],
"cardTitle": [{ type: core.ViewChild, args: ['cardTitle',] },],
};
return MzCardComponent;
}());
var MzCardImageDirective = (function () {
function MzCardImageDirective() {
}
MzCardImageDirective.decorators = [
{ type: core.Directive, args: [{ selector: 'mz-card-image' },] },
];
return MzCardImageDirective;
}());
var MzCardImageTitleDirective = (function () {
function MzCardImageTitleDirective() {
}
MzCardImageTitleDirective.decorators = [
{ type: core.Directive, args: [{ selector: 'mz-card-image-title' },] },
];
return MzCardImageTitleDirective;
}());
var MzCardTitleDirective = (function () {
function MzCardTitleDirective() {
}
MzCardTitleDirective.decorators = [
{ type: core.Directive, args: [{ selector: 'mz-card-title' },] },
];
return MzCardTitleDirective;
}());
var MzCardContentDirective = (function () {
function MzCardContentDirective() {
}
MzCardContentDirective.decorators = [
{ type: core.Directive, args: [{ selector: 'mz-card-content' },] },
];
return MzCardContentDirective;
}());
var MzCardActionDirective = (function () {
function MzCardActionDirective() {
}
MzCardActionDirective.decorators = [
{ type: core.Directive, args: [{ selector: 'mz-card-action' },] },
];
return MzCardActionDirective;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzCardModule = (function () {
function MzCardModule() {
}
MzCardModule.decorators = [
{ type: core.NgModule, args: [{
imports: [
common.CommonModule,
MzHalfwayFabModule,
],
declarations: [
MzCardActionDirective,
MzCardComponent,
MzCardContentDirective,
MzCardImageDirective,
MzCardImageTitleDirective,
MzCardTitleDirective,
],
exports: [
MzCardActionDirective,
MzCardComponent,
MzCardContentDirective,
MzCardImageDirective,
MzCardImageTitleDirective,
MzCardTitleDirective,
],
},] },
];
return MzCardModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzCheckboxContainerComponent = (function () {
function MzCheckboxContainerComponent() {
}
MzCheckboxContainerComponent.decorators = [
{ type: core.Component, args: [{
selector: 'mz-checkbox-container',
template: "<p class=\"checkbox-field\">\n <ng-content></ng-content>\n</p>",
styles: [""],
},] },
];
return MzCheckboxContainerComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzCheckboxDirective = (function (_super) {
tslib_1.__extends(MzCheckboxDirective, _super);
function MzCheckboxDirective(elementRef, renderer) {
var _this = _super.call(this) || this;
_this.elementRef = elementRef;
_this.renderer = renderer;
return _this;
}
/**
* @return {?}
*/
MzCheckboxDirective.prototype.ngOnInit = /**
* @return {?}
*/
function () {
this.initHandlers();
this.initElements();
this.handleProperties();
};
/**
* @return {?}
*/
MzCheckboxDirective.prototype.initHandlers = /**
* @return {?}
*/
function () {
var _this = this;
this.handlers = {
filledIn: function () { return _this.handleFilledIn(); },
label: function () { return _this.handleLabel(); },
};
};
/**
* @return {?}
*/
MzCheckboxDirective.prototype.initElements = /**
* @return {?}
*/
function () {
this.checkboxElement = $(this.elementRef.nativeElement);
this.checkboxContainerElement = $(this.elementRef.nativeElement).parent('.checkbox-field');
this.labelElement = this.createLabelElement();
};
/**
* @return {?}
*/
MzCheckboxDirective.prototype.createLabelElement = /**
* @return {?}
*/
function () {
var /** @type {?} */ labelElement = document.createElement('label');
labelElement.setAttribute('for', this.id);
this.renderer.invokeElementMethod(this.checkboxElement, 'after', [labelElement]);
return $(labelElement);
};
/**
* @return {?}
*/
MzCheckboxDirective.prototype.handleProperties = /**
* @return {?}
*/
function () {
if (this.checkboxContainerElement.length === 0) {
console.error('Input with mz-checkbox directive must be placed inside a [mz-checkbox-container] tag', this.checkboxElement);
return;
}
_super.prototype.executePropHandlers.call(this);
};
/**
* @return {?}
*/
MzCheckboxDirective.prototype.handleLabel = /**
* @return {?}
*/
function () {
this.renderer.invokeElementMethod(this.labelElement, 'text', [this.label]);
};
/**
* @return {?}
*/
MzCheckboxDirective.prototype.handleFilledIn = /**
* @return {?}
*/
function () {
this.renderer.setElementClass(this.checkboxElement[0], 'filled-in', this.filledIn);
};
MzCheckboxDirective.decorators = [
{ type: core.Directive, args: [{
selector: 'input[mzCheckbox], input[mz-checkbox]',
},] },
];
/** @nocollapse */
MzCheckboxDirective.ctorParameters = function () {
return [
{ type: core.ElementRef, },
{ type: core.Renderer, },
];
};
MzCheckboxDirective.propDecorators = {
"id": [{ type: core.HostBinding }, { type: core.Input },],
"filledIn": [{ type: core.Input },],
"label": [{ type: core.Input },],
};
return MzCheckboxDirective;
}(HandlePropChanges));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzCheckboxModule = (function () {
function MzCheckboxModule() {
}
MzCheckboxModule.decorators = [
{ type: core.NgModule, args: [{
declarations: [
MzCheckboxDirective,
MzCheckboxContainerComponent,
],
exports: [
MzCheckboxDirective,
MzCheckboxContainerComponent,
],
},] },
];
return MzCheckboxModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzChipInputComponent = (function () {
function MzChipInputComponent(elementRef, zone) {
this.elementRef = elementRef;
this.zone = zone;
this.add = new core.EventEmitter();
this.delete = new core.EventEmitter();
this.select = new core.EventEmitter();
this.onChangeCallback = function (data) { };
}
Object.defineProperty(MzChipInputComponent.prototype, "value", {
get: /**
* @return {?}
*/ function () {
return /** @type {?} */ (this.chipInputElement.material_chip('data'));
},
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
MzChipInputComponent.prototype.ngOnInit = /**
* @return {?}
*/
function () {
this.initElements();
this.initMaterializeChip();
};
/**
* @return {?}
*/
MzChipInputComponent.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this.chipInputElement.off('chip.add');
this.chipInputElement.off('chip.delete');
this.chipInputElement.off('chip.select');
};
/**
* @return {?}
*/
MzChipInputComponent.prototype.initElements = /**
* @return {?}
*/
function () {
this.chipInputElement = $(this.elementRef.nativeElement);
};
/**
* @param {?=} value
* @return {?}
*/
MzChipInputComponent.prototype.initMaterializeChip = /**
* @param {?=} value
* @return {?}
*/
function (value) {
var _this = this;
// fix issue autocomplete is not a function
// https://github.com/Dogfalo/materialize/issues/4401
this.zone.runOutsideAngular(function () {
setTimeout(function () {
_this.chipInputElement.material_chip({
autocompleteOptions: _this.autocompleteOptions,
data: value || _this.value,
placeholder: _this.placeholder,
secondaryPlaceholder: _this.secondaryPlaceholder,
});
});
});
this.chipInputElement.on('chip.add', function (event, chip) {
_this.onChangeCallback(_this.value);
_this.add.emit(chip);
});
this.chipInputElement.on('chip.delete', function (event, chip) {
_this.onChangeCallback(_this.value);
_this.delete.emit(chip);
});
this.chipInputElement.on('chip.select', function (event, chip) {
_this.select.emit(chip);
});
};
//#region ControlValueAccessor
/**
* @param {?} fn
* @return {?}
*/
MzChipInputComponent.prototype.registerOnChange = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
this.onChangeCallback = fn;
};
/**
* @param {?} fn
* @return {?}
*/
MzChipInputComponent.prototype.registerOnTouched = /**
* @param {?} fn
* @return {?}
*/
function (fn) { };
/**
* @param {?} isDisabled
* @return {?}
*/
MzChipInputComponent.prototype.setDisabledState = /**
* @param {?} isDisabled
* @return {?}
*/
function (isDisabled) { };
/**
* @param {?} value
* @return {?}
*/
MzChipInputComponent.prototype.writeValue = /**
* @param {?} value
* @return {?}
*/
function (value) {
if (value && value !== this.value) {
this.initMaterializeChip(value);
}
};
MzChipInputComponent.decorators = [
{ type: core.Component, args: [{
selector: 'mz-chip-input',
template: "",
styles: [":host{display:block}"],
providers: [
{
provide: forms.NG_VALUE_ACCESSOR,
useExisting: core.forwardRef(function () { return MzChipInputComponent; }),
multi: true,
},
],
},] },
];
/** @nocollapse */
MzChipInputComponent.ctorParameters = function () {
return [
{ type: core.ElementRef, },
{ type: core.NgZone, },
];
};
MzChipInputComponent.propDecorators = {
"autocompleteOptions": [{ type: core.Input },],
"placeholder": [{ type: core.Input },],
"secondaryPlaceholder": [{ type: core.Input },],
"add": [{ type: core.Output },],
"delete": [{ type: core.Output },],
"select": [{ type: core.Output },],
};
return MzChipInputComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzChipComponent = (function () {
function MzChipComponent(elementRef) {
this.elementRef = elementRef;
this.chipClass = true;
this.close = false;
this.delete = new core.EventEmitter();
}
Object.defineProperty(MzChipComponent.prototype, "chipElement", {
get: /**
* @return {?}
*/ function () {
return /** @type {?} */ (this.elementRef.nativeElement);
},
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
MzChipComponent.prototype.onDelete = /**
* @return {?}
*/
function () {
var /** @type {?} */ value = '';
for (var /** @type {?} */ i = 0; i < this.chipElement.childNodes.length; i++) {
if (this.chipElement.childNodes.item(i).nodeType === Node.TEXT_NODE) {
value += this.chipElement.childNodes.item(i).nodeValue;
}
}
this.delete.emit(value.trim());
};
MzChipComponent.decorators = [
{ type: core.Component, args: [{
selector: 'mz-chip',
template: "<ng-content></ng-content>\n<i class=\"close material-icons\" (click)=\"onDelete()\" *ngIf=\"close\">close</i>",
styles: [""],
},] },
];
/** @nocollapse */
MzChipComponent.ctorParameters = function () {
return [
{ type: core.ElementRef, },
];
};
MzChipComponent.propDecorators = {
"chipClass": [{ type: core.HostBinding, args: ['class.chip',] },],
"close": [{ type: core.Input },],
"delete": [{ type: core.Output },],
};
return MzChipComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzChipModule = (function () {
function MzChipModule() {
}
MzChipModule.decorators = [
{ type: core.NgModule, args: [{
imports: [
common.CommonModule,
],
declarations: [
MzChipComponent,
MzChipInputComponent,
],
exports: [
MzChipComponent,
MzChipInputComponent,
],
},] },
];
return MzChipModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzCollapsibleItemComponent = (function (_super) {
tslib_1.__extends(MzCollapsibleItemComponent, _super);
function MzCollapsibleItemComponent() {
return _super !== null && _super.apply(this, arguments) || this;
}
MzCollapsibleItemComponent.decorators = [
{ type: core.Component, args: [{
selector: 'mz-collapsible-item',
template: "<li>\n <div class=\"collapsible-header\"\n [class.active]=\"active\"\n >\n <ng-content select=\"mz-collapsible-item-header\"></ng-content>\n </div>\n <div class=\"collapsible-body\">\n <ng-content select=\"mz-collapsible-item-body\"></ng-content>\n </div>\n</li>",
styles: [""],
},] },
];
/** @nocollapse */
MzCollapsibleItemComponent.propDecorators = {
"active": [{ type: core.Input },],
};
return MzCollapsibleItemComponent;
}(MzRemoveComponentHost));
var MzCollapsibleItemBodyDirective = (function () {
function MzCollapsibleItemBodyDirective() {
}
MzCollapsibleItemBodyDirective.decorators = [
{ type: core.Directive, args: [{ selector: 'mz-collapsible-item-body' },] },
];
return MzCollapsibleItemBodyDirective;
}());
var MzCollapsibleItemHeaderDirective = (function () {
function MzCollapsibleItemHeaderDirective() {
}
MzCollapsibleItemHeaderDirective.decorators = [
{ type: core.Directive, args: [{ selector: 'mz-collapsible-item-header' },] },
];
return MzCollapsibleItemHeaderDirective;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzCollapsibleComponent = (function () {
function MzCollapsibleComponent(renderer) {
this.renderer = renderer;
}
/**
* @return {?}
*/
MzCollapsibleComponent.prototype.ngAfterViewInit = /**
* @return {?}
*/
function () {
this.handleDataCollapsible();
this.initCollapsible();
};
/**
* @return {?}
*/
MzCollapsibleComponent.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
$(this.collapsible.nativeElement).collapsible('destroy');
};
/**
* @param {?} collapsibleItemIndex
* @return {?}
*/
MzCollapsibleComponent.prototype.close = /**
* @param {?} collapsibleItemIndex
* @return {?}
*/
function (collapsibleItemIndex) {
$(this.collapsible.nativeElement).collapsible('close', collapsibleItemIndex);
};
/**
* @return {?}
*/
MzCollapsibleComponent.prototype.initCollapsible = /**
* @return {?}
*/
function () {
var /** @type {?} */ options = {
accordion: false,
onClose: this.onClose,
onOpen: this.onOpen,
};
$(this.collapsible.nativeElement).collapsible(options);
};
/**
* @return {?}
*/
MzCollapsibleComponent.prototype.handleDataCollapsible = /**
* @return {?}
*/
function () {
if (this.mode) {
this.renderer.setElementAttribute(this.collapsible.nativeElement, 'data-collapsible', this.mode);
}
};
/**
* @param {?} collapsibleItemIndex
* @return {?}
*/
MzCollapsibleComponent.prototype.open = /**
* @param {?} collapsibleItemIndex
* @return {?}
*/
function (collapsibleItemIndex) {
$(this.collapsible.nativeElement).collapsible('open', collapsibleItemIndex);
};
MzCollapsibleComponent.decorators = [
{ type: core.Component, args: [{
selector: 'mz-collapsible',
template: "<ul #collapsible\n class=\"collapsible\"\n [class.popout]=\"popout\"\n [hidden]=\"items.length === 0\"\n>\n <ng-content></ng-content>\n</ul>",
styles: ["/deep/ .collapsible-header{clear:both}/deep/ .collapsible-body{clear:both}"],
},] },
];
/** @nocollapse */
MzCollapsibleComponent.ctorParameters = function () {
return [
{ type: core.Renderer, },
];
};
MzCollapsibleComponent.propDecorators = {
"mode": [{ type: core.Input },],
"onClose": [{ type: core.Input },],
"onOpen": [{ type: core.Input },],
"popout": [{ type: core.Input },],
"collapsible": [{ type: core.ViewChild, args: ['collapsible',] },],
"items": [{ type: core.ContentChildren, args: [MzCollapsibleItemComponent,] },],
};
return MzCollapsibleComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzCollapsibleModule = (function () {
function MzCollapsibleModule() {
}
MzCollapsibleModule.decorators = [
{ type: core.NgModule, args: [{
declarations: [
MzCollapsibleComponent,
MzCollapsibleItemBodyDirective,
MzCollapsibleItemComponent,
MzCollapsibleItemHeaderDirective,
],
exports: [
MzCollapsibleComponent,
MzCollapsibleItemBodyDirective,
MzCollapsibleItemComponent,
MzCollapsibleItemHeaderDirective,
],
},] },
];
return MzCollapsibleModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzAvatarDirective = (function () {
function MzAvatarDirective() {
}
MzAvatarDirective.decorators = [
{ type: core.Directive, args: [{
selector: '[mzAvatar], [mz-avatar]',
},] },
];
/** @nocollapse */
MzAvatarDirective.propDecorators = {
"true": [{ type: core.HostBinding, args: ['class.circle',] },],
};
return MzAvatarDirective;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzCollectionHeaderComponent = (function () {
function MzCollectionHeaderComponent() {
}
MzCollectionHeaderComponent.decorators = [
{ type: core.Component, args: [{
selector: 'mz-collection-header',
template: "<div class=\"collection-header\">\n <ng-content></ng-content>\n</div>",
styles: [""],
},] },
];
return MzCollectionHeaderComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzCollectionItemComponent = (function () {
function MzCollectionItemComponent() {
}
MzCollectionItemComponent.decorators = [
{ type: core.Component, args: [{
selector: 'mz-collection-item',
template: "<ng-content></ng-content>",
styles: [":host{display:block}"],
},] },
];
/** @nocollapse */
MzCollectionItemComponent.propDecorators = {
"true": [{ type: core.HostBinding, args: ['class.collection-item',] },],
"avatar": [{ type: core.HostBinding, args: ['class.avatar',] }, { type: core.Input },],
"dismissable": [{ type: core.HostBinding, args: ['class.dismissable',] }, { type: core.Input },],
};
return MzCollectionItemComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzCollectionLinkDirective = (function () {
function MzCollectionLinkDirective() {
}
MzCollectionLinkDirective.decorators = [
{ type: core.Directive, args: [{
selector: '[mzCollectionLink], [mz-collection-link]',
},] },
];
/** @nocollapse */
MzCollectionLinkDirective.propDecorators = {
"active": [{ type: core.HostBinding, args: ['class.active',] }, { type: core.Input },],
"true": [{ type: core.HostBinding, args: ['class.collection-item',] },],
};
return MzCollectionLinkDirective;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var MzCollectionComponent = (function () {
function MzCollectionComponent(elementRef, renderer) {
this.elementRef = elementRef;
thi