md2
Version:
Angular2 based Material Design components, directives and services are Accordion, Autocomplete, Chips(Tags), Collapse, Colorpicker, Data Table, Datepicker, Dialog(Modal), Menu, Multiselect, Select, Tabs, Tags(Chips), Toast and Tooltip.
46 lines • 1.91 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/** Mixin to augment a directive with a `color` property. */
export function mixinColor(base, defaultColor) {
return (function (_super) {
__extends(class_1, _super);
function class_1() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var _this = _super.apply(this, args) || this;
_this._color = null;
// Set the default color that can be specified from the mixin.
_this.color = defaultColor;
return _this;
}
Object.defineProperty(class_1.prototype, "color", {
get: function () { return this._color; },
set: function (value) {
var colorPalette = value || defaultColor;
if (colorPalette !== this._color) {
if (this._color) {
this._renderer.removeClass(this._elementRef.nativeElement, "mat-" + this._color);
}
if (colorPalette) {
this._renderer.addClass(this._elementRef.nativeElement, "mat-" + colorPalette);
}
this._color = colorPalette;
}
},
enumerable: true,
configurable: true
});
return class_1;
}(base));
}
//# sourceMappingURL=color.js.map