ngx-modialog
Version:
Modal / Dialog for Angular
205 lines (204 loc) • 7.4 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
import { Component, ViewEncapsulation } from '@angular/core';
import { DialogRef } from 'ngx-modialog';
/**
* @record
*/
export function BSMessageModalButtonHandler() { }
function BSMessageModalButtonHandler_tsickle_Closure_declarations() {
/* TODO: handle strange member:
(cmp: ModalComponent<MessageModalPreset>, $event: MouseEvent): void;
*/
}
/**
* Interface for button definition
* @record
*/
export function BSMessageModalButtonConfig() { }
function BSMessageModalButtonConfig_tsickle_Closure_declarations() {
/** @type {?} */
BSMessageModalButtonConfig.prototype.cssClass;
/** @type {?} */
BSMessageModalButtonConfig.prototype.caption;
/** @type {?} */
BSMessageModalButtonConfig.prototype.onClick;
}
var BSMessageModalTitle = /** @class */ (function () {
/**
* @param {?} dialog
*/
function BSMessageModalTitle(dialog) {
this.dialog = dialog;
this.context = dialog.context;
}
Object.defineProperty(BSMessageModalTitle.prototype, "titleHtml", {
/**
* @return {?}
*/
get: function () {
return this.context.titleHtml ? 1 : 0;
},
enumerable: true,
configurable: true
});
return BSMessageModalTitle;
}());
export { BSMessageModalTitle };
BSMessageModalTitle.decorators = [
{ type: Component, args: [{
selector: 'modal-title',
encapsulation: ViewEncapsulation.None,
template: "<div [ngClass]=\"context.headerClass\" [ngSwitch]=\"titleHtml\">\n <button *ngIf=\"context.showClose\" type=\"button\" class=\"close\"\n aria-label=\"Close\" (click)=\"dialog.dismiss()\">\n <span aria-hidden=\"true\">\u00D7</span>\n </button>\n <div *ngSwitchCase=\"1\" [innerHtml]=\"context.titleHtml\"></div>\n <h3 *ngSwitchDefault class=\"modal-title\">{{context.title}}</h3>\n </div>"
},] },
];
/** @nocollapse */
BSMessageModalTitle.ctorParameters = function () { return [
{ type: DialogRef, },
]; };
function BSMessageModalTitle_tsickle_Closure_declarations() {
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
BSMessageModalTitle.decorators;
/**
* @nocollapse
* @type {function(): !Array<(null|{type: ?, decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>)})>}
*/
BSMessageModalTitle.ctorParameters;
/** @type {?} */
BSMessageModalTitle.prototype.context;
/** @type {?} */
BSMessageModalTitle.prototype.dialog;
}
var BSMessageModalBody = /** @class */ (function () {
/**
* @param {?} dialog
*/
function BSMessageModalBody(dialog) {
this.dialog = dialog;
this.context = /** @type {?} */ (dialog.context);
}
return BSMessageModalBody;
}());
export { BSMessageModalBody };
BSMessageModalBody.decorators = [
{ type: Component, args: [{
selector: 'modal-body',
encapsulation: ViewEncapsulation.None,
styles: [".form-group {\n margin-top: 10px;\n }"],
template: "<div [ngClass]=\"context.bodyClass\">\n <div [innerHtml]=\"context.message\"></div>\n <div *ngIf=\"context.showInput\" class=\"form-group\">\n <input autofocus #input\n name=\"bootstrap\"\n type=\"text\"\n class=\"form-control\"\n [value]=\"context.defaultValue\"\n (change)=\"context.defaultValue = input.value\"\n placeholder=\"{{context.placeholder}}\">\n </div>\n </div>\n"
},] },
];
/** @nocollapse */
BSMessageModalBody.ctorParameters = function () { return [
{ type: DialogRef, },
]; };
function BSMessageModalBody_tsickle_Closure_declarations() {
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
BSMessageModalBody.decorators;
/**
* @nocollapse
* @type {function(): !Array<(null|{type: ?, decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>)})>}
*/
BSMessageModalBody.ctorParameters;
/** @type {?} */
BSMessageModalBody.prototype.context;
/** @type {?} */
BSMessageModalBody.prototype.dialog;
}
/**
* Represents the modal footer for storing buttons.
*/
var BSModalFooter = /** @class */ (function () {
/**
* @param {?} dialog
*/
function BSModalFooter(dialog) {
this.dialog = dialog;
}
/**
* @param {?} btn
* @param {?} $event
* @return {?}
*/
BSModalFooter.prototype.onClick = function (btn, $event) {
$event.stopPropagation();
btn.onClick(this, $event);
};
return BSModalFooter;
}());
export { BSModalFooter };
BSModalFooter.decorators = [
{ type: Component, args: [{
selector: 'modal-footer',
encapsulation: ViewEncapsulation.None,
template: "<div [ngClass]=\"dialog.context.footerClass\">\n <button *ngFor=\"let btn of dialog.context.buttons;\"\n [ngClass]=\"btn.cssClass\"\n (click)=\"onClick(btn, $event)\">{{btn.caption}}</button>\n</div>"
},] },
];
/** @nocollapse */
BSModalFooter.ctorParameters = function () { return [
{ type: DialogRef, },
]; };
function BSModalFooter_tsickle_Closure_declarations() {
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
BSModalFooter.decorators;
/**
* @nocollapse
* @type {function(): !Array<(null|{type: ?, decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>)})>}
*/
BSModalFooter.ctorParameters;
/** @type {?} */
BSModalFooter.prototype.dialog;
}
/**
* A Component representing a generic bootstrap modal content element.
*
* By configuring a MessageModalContext instance you can:
*
* Header:
* - Set header container class (default: modal-header)
* - Set title text (enclosed in H3 element)
* - Set title html (overrides text)
*
* Body:
* - Set body container class. (default: modal-body)
* - Set body container HTML.
*
* Footer:
* - Set footer class. (default: modal-footer)
* - Set button configuration (from 0 to n)
*/
var BSMessageModal = /** @class */ (function () {
/**
* @param {?} dialog
*/
function BSMessageModal(dialog) {
this.dialog = dialog;
}
return BSMessageModal;
}());
export { BSMessageModal };
BSMessageModal.decorators = [
{ type: Component, args: [{
selector: 'modal-content',
encapsulation: ViewEncapsulation.None,
template: "<modal-title></modal-title><modal-body></modal-body><modal-footer></modal-footer>"
},] },
];
/** @nocollapse */
BSMessageModal.ctorParameters = function () { return [
{ type: DialogRef, },
]; };
function BSMessageModal_tsickle_Closure_declarations() {
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
BSMessageModal.decorators;
/**
* @nocollapse
* @type {function(): !Array<(null|{type: ?, decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>)})>}
*/
BSMessageModal.ctorParameters;
/** @type {?} */
BSMessageModal.prototype.dialog;
}
//# sourceMappingURL=message-modal.component.js.map