UNPKG

moh-common-lib

Version:

A library of Angular components, services, and styles for B.C. Government Ministry of Health (MoH).

83 lines 7.36 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ import { Component, Input, Output, EventEmitter, forwardRef } from '@angular/core'; import { ControlContainer, NgForm } from '@angular/forms'; /** * FormSubmitBar is similar to FormActionBar, but it is meant to be used with * (ngSubmit) on the form. Make sure to enclose FormSubmitBar inside of the form * in question. */ var FormSubmitBarComponent = /** @class */ (function () { function FormSubmitBarComponent() { this.submitLabel = 'Continue'; this.canContinue = true; this.isLoading = false; this.defaultColor = true; this.btnClick = new EventEmitter(); /** * Is the component nested inside a form, and not properly full-width in a * page layout? We add negative margins to space out. * * Currently tihs only works for the 'blank' layout type for the page * framework, but would be easy to extend by adding more negative classes as * need be. */ this.increaseWidth = false; } /** * @return {?} */ FormSubmitBarComponent.prototype.ngOnInit = /** * @return {?} */ function () { }; FormSubmitBarComponent.decorators = [ { type: Component, args: [{ selector: 'common-form-submit-bar', template: "<div class=\"form-action-bar form-bar\" [ngClass]=\"{disabled: !canContinue, 'mx-lg-n5 mx-md-n3 mb-n3 mt-3': increaseWidth}\">\r\n <button class=\"btn btn-lg {{defaultColor ? 'btn-primary' : 'btn-secondary' }} submit\"\r\n [ngClass]=\"{disabled: !canContinue || isLoading}\"\r\n type='submit'>\r\n <ng-container *ngIf=\"!isLoading; else loadingSpinner\"> {{submitLabel}} </ng-container>\r\n \r\n </button>\r\n </div>\r\n \r\n <ng-template #loadingSpinner>\r\n <i class=\"fa fa-spinner fa-pulse fa-fw\"></i>\r\n </ng-template>", viewProviders: [{ provide: ControlContainer, useExisting: forwardRef((/** * @return {?} */ function () { return NgForm; })) }], styles: [".form-action-bar{display:flex;justify-content:flex-end;padding:1em;background-color:#cdd9e4;transition:background-color .3s;position:-webkit-sticky;position:sticky;bottom:0;z-index:10;left:5rem;right:5rem}.form-action-bar.disabled{background-color:#d5d9dd}@media (max-width:991.98px){.form-action-bar{left:2.5rem;right:2.5rem}}.submit{min-width:240px}@media (max-width:767.98px){.form-action-bar{left:0;right:0}.submit{min-width:100%}}.btn{white-space:normal!important;word-wrap:break-word}"] }] } ]; /** @nocollapse */ FormSubmitBarComponent.ctorParameters = function () { return []; }; FormSubmitBarComponent.propDecorators = { submitLabel: [{ type: Input }], canContinue: [{ type: Input }], isLoading: [{ type: Input }], defaultColor: [{ type: Input }], btnClick: [{ type: Output }], increaseWidth: [{ type: Input }] }; return FormSubmitBarComponent; }()); export { FormSubmitBarComponent }; if (false) { /** @type {?} */ FormSubmitBarComponent.prototype.submitLabel; /** @type {?} */ FormSubmitBarComponent.prototype.canContinue; /** @type {?} */ FormSubmitBarComponent.prototype.isLoading; /** @type {?} */ FormSubmitBarComponent.prototype.defaultColor; /** @type {?} */ FormSubmitBarComponent.prototype.btnClick; /** * Is the component nested inside a form, and not properly full-width in a * page layout? We add negative margins to space out. * * Currently tihs only works for the 'blank' layout type for the page * framework, but would be easy to extend by adding more negative classes as * need be. * @type {?} */ FormSubmitBarComponent.prototype.increaseWidth; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9ybS1zdWJtaXQtYmFyLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL21vaC1jb21tb24tbGliLyIsInNvdXJjZXMiOlsibGliL2NvbXBvbmVudHMvZm9ybS1zdWJtaXQtYmFyL2Zvcm0tc3VibWl0LWJhci5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQVUsS0FBSyxFQUFFLE1BQU0sRUFBRSxZQUFZLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQzNGLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQzs7Ozs7O0FBUT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