UNPKG

@cause-911/devextreme

Version:

Run `npm install @cause-911/devextreme --save` to add this library to your project

1,109 lines (1,098 loc) 38.1 kB
import { __extends, __values } from 'tslib'; import { Component, ElementRef, NgZone, PlatformRef, Input, ViewChild, Output, EventEmitter, ɵɵdefineInjectable, Injectable, NgModule } from '@angular/core'; import { NestedOptionHost, DxTemplateHost, WatcherHelper, IterableDifferHelper, DxDataGridComponent, DxDateBoxComponent, DxTextAreaComponent, DxDataGridModule, DxDateBoxModule, DxPopupModule, DxTabPanelModule, DxTextBoxModule, DxTextAreaModule, DxValidatorModule } from 'devextreme-angular'; import { TransferState } from '@angular/platform-browser'; import { Location, LocationStrategy, PathLocationStrategy, CommonModule } from '@angular/common'; import { CoreService, TranslateService, CauseCoreModule } from '@cause-911/core'; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var CauseDataGridComponent = /** @class */ (function (_super) { __extends(CauseDataGridComponent, _super); function CauseDataGridComponent(element, ngZone, templateHost, watcherHelper, idh, optionHost, transferState, platform, location, locationStrategy) { var _this = _super.call(this, element, ngZone, templateHost, watcherHelper, idh, optionHost, transferState, platform) || this; _this.location = location; _this.locationStrategy = locationStrategy; _this.allowPrint = true; _this.hoverStateEnabled = true; _this.rowAlternationEnabled = true; _this.showBorders = true; _this.export = { allowExportSelectedData: false, enabled: true, fileName: 'export', }; _this.filterRow = { visible: true, }; _this.pager = { showPageSizeSelector: true, showNavigationButtons: true, showInfo: true, visible: true, }; _this.isEditing = false; optionHost.setHost(_this); locationStrategy.onPopState((/** * @return {?} */ function () { if (_this.isEditing) { _this.isEditing = false; _this.instance.cancelEditData(); } })); return _this; } /** * @return {?} */ CauseDataGridComponent.prototype.ngOnInit = /** * @return {?} */ function () { var _this = this; _super.prototype.ngOnInit.call(this); this.onToolbarPreparing.subscribe((/** * @param {?} e * @return {?} */ function (e) { return _this.toolbarPreparing(e); })); this.onInitialized.subscribe((/** * @param {?} e * @return {?} */ function (e) { return _this.initialized(e); })); }; /** * @private * @param {?} e * @return {?} */ CauseDataGridComponent.prototype.toolbarPreparing = /** * @private * @param {?} e * @return {?} */ function (e) { var _this = this; /** @type {?} */ var toolbarItems = e.toolbarOptions.items; if (this.allowPrint) { toolbarItems.push({ widget: 'dxButton', location: 'after', options: { icon: 'print', onClick: (/** * @param {?} ev * @return {?} */ function (ev) { _this.print(e.element); }), } }); } }; /** * @private * @param {?} e * @return {?} */ CauseDataGridComponent.prototype.initialized = /** * @private * @param {?} e * @return {?} */ function (e) { var _this = this; /** @type {?} */ var options = e.component.option('editing'); options.popup.onShowing = (/** * @param {?} ev * @return {?} */ function (ev) { _this.location.go(_this.location.path() + '#editing'); _this.isEditing = true; }); options.popup.onHiding = (/** * @param {?} ev * @return {?} */ function (ev) { if (_this.isEditing) { _this.location.back(); } _this.isEditing = false; }); }; /** * @private * @param {?} element * @return {?} */ CauseDataGridComponent.prototype.print = /** * @private * @param {?} element * @return {?} */ function (element) { element.classList.add('only-div-to-print'); window.print(); setTimeout((/** * @return {?} */ function () { element.classList.remove('only-div-to-print'); }), 1000); }; CauseDataGridComponent.decorators = [ { type: Component, args: [{ selector: 'cause-dx-data-grid', template: "<ng-content></ng-content>", providers: [NestedOptionHost, Location, { provide: LocationStrategy, useClass: PathLocationStrategy }], styles: [""] }] } ]; /** @nocollapse */ CauseDataGridComponent.ctorParameters = function () { return [ { type: ElementRef }, { type: NgZone }, { type: DxTemplateHost }, { type: WatcherHelper }, { type: IterableDifferHelper }, { type: NestedOptionHost }, { type: TransferState }, { type: PlatformRef }, { type: Location }, { type: LocationStrategy } ]; }; CauseDataGridComponent.propDecorators = { allowPrint: [{ type: Input }] }; return CauseDataGridComponent; }(DxDataGridComponent)); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var CauseDateBoxComponent = /** @class */ (function (_super) { __extends(CauseDateBoxComponent, _super); function CauseDateBoxComponent(element, ngZone, templateHost, watcherHelper, idh, optionHost, transferState, platform) { var _this = _super.call(this, element, ngZone, templateHost, watcherHelper, idh, optionHost, transferState, platform) || this; _this.type = 'datetime'; _this.displayFormat = 'dd/MM/yyyy HH:mm'; _this.openOnFieldClick = true; return _this; } /** * @return {?} */ CauseDateBoxComponent.prototype.ngOnInit = /** * @return {?} */ function () { _super.prototype.ngOnInit.call(this); }; CauseDateBoxComponent.decorators = [ { type: Component, args: [{ selector: 'cause-dx-date-box', template: "", styles: [""] }] } ]; /** @nocollapse */ CauseDateBoxComponent.ctorParameters = function () { return [ { type: ElementRef }, { type: NgZone }, { type: DxTemplateHost }, { type: WatcherHelper }, { type: IterableDifferHelper }, { type: NestedOptionHost }, { type: TransferState }, { type: PlatformRef } ]; }; return CauseDateBoxComponent; }(DxDateBoxComponent)); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var CauseTextAreaLimitedComponent = /** @class */ (function () { function CauseTextAreaLimitedComponent() { this.value = ''; this.maxChar = 225; this.format = 'text'; this.valueChanged = new EventEmitter(); this.gsm7bitChars = '@£$¥èéùìòÇ\\nØø\\rÅåΔ_ΦΓΛΩΠΨΣΘΞÆæßÉ !\\"#¤%&\'()*+,-./0123456789:;<=>?¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑܧ¿abcdefghijklmnopqrstuvwxyzäöñüà'; this.gsm7bitCharsExt = '\\^{}\\\\\\[~\\]|€'; this.gsm7bitRegExp = RegExp('^[' + this.gsm7bitChars + ']*$'); this.gsm7bitExtRegExp = RegExp('^[' + this.gsm7bitChars + this.gsm7bitCharsExt + ']*$'); this.gsm7bitExtOnlyRegExp = RegExp('^[' + this.gsm7bitCharsExt + ']*$'); this.messageLength = { GSM7: 160, GSM7ext: 160, UTF16: 70 }; this.multiMessageLength = { GSM7: 153, GSM7ext: 153, UTF16: 67 }; } /** * @return {?} */ CauseTextAreaLimitedComponent.prototype.ngOnInit = /** * @return {?} */ function () { if (this.format === 'sms') { this.maxChar = 0; } }; /** * @param {?} e * @return {?} */ CauseTextAreaLimitedComponent.prototype.changed = /** * @param {?} e * @return {?} */ function (e) { this.value = e.value; this.valueChanged.emit(e); }; /** * @return {?} */ CauseTextAreaLimitedComponent.prototype.getNumberOfSms = /** * @return {?} */ function () { if (!this.value) { return 0; } /** @type {?} */ var length = this.countSmsChars(this.value); /** @type {?} */ var charset = this.getCharset(this.value); /** @type {?} */ var perMessage = (length > this.messageLength[charset] ? this.multiMessageLength[charset] : this.messageLength[charset]); return Math.ceil(length / perMessage); }; /** * @return {?} */ CauseTextAreaLimitedComponent.prototype.getNumberOfChar = /** * @return {?} */ function () { return (this.value ? this.value.length : 0) + "/" + this.maxChar; }; /** * @private * @param {?} text * @return {?} */ CauseTextAreaLimitedComponent.prototype.countSmsChars = /** * @private * @param {?} text * @return {?} */ function (text) { /** @type {?} */ var length = text.length; /** @type {?} */ var charset = this.getCharset(text); if (charset === 'GSM7ext') { length += this.countGsm7bitExt(text); } return length; }; /** * @private * @param {?} text * @return {?} */ CauseTextAreaLimitedComponent.prototype.countGsm7bitExt = /** * @private * @param {?} text * @return {?} */ function (text) { var _this = this; /** @type {?} */ var char2; /** @type {?} */ var chars = (/** * @return {?} */ function () { /** @type {?} */ var _i; /** @type {?} */ var _len; /** @type {?} */ var _results; _results = []; for (_i = 0, _len = text.length; _i < _len; _i++) { char2 = text[_i]; if (char2.match(_this.gsm7bitExtOnlyRegExp) != null) { _results.push(char2); } } return _results; }); return chars.length; }; /** * @private * @param {?} text * @return {?} */ CauseTextAreaLimitedComponent.prototype.getCharset = /** * @private * @param {?} text * @return {?} */ function (text) { switch (false) { case text.match(this.gsm7bitRegExp) == null: return 'GSM7'; case text.match(this.gsm7bitExtRegExp) == null: return 'GSM7ext'; default: return 'UTF16'; } }; CauseTextAreaLimitedComponent.decorators = [ { type: Component, args: [{ selector: 'cause-dx-text-area-limited', template: "<dx-text-area\n [(value)]=\"value\"\n [maxLength]=\"maxChar\"\n minHeight=\"50\"\n valueChangeEvent=\"keyup\"\n [autoResizeEnabled]=\"true\"\n (onValueChanged)=\"changed($event)\">\n</dx-text-area>\n<div class=\"limit\">\n <span *ngIf=\"format === 'sms'\">{{'devextreme.numberOfSms' | translate}} : {{getNumberOfSms()}}</span>\n <span *ngIf=\"format === 'text'\">{{'devextreme.numberOfChar' | translate}} : {{getNumberOfChar()}}</span>\n</div>\n", styles: [".limit{color:#999;font-size:.8em;text-align:right}"] }] } ]; /** @nocollapse */ CauseTextAreaLimitedComponent.ctorParameters = function () { return []; }; CauseTextAreaLimitedComponent.propDecorators = { textarea: [{ type: ViewChild, args: [DxTextAreaComponent, { static: false },] }], value: [{ type: Input }], maxChar: [{ type: Input }], format: [{ type: Input }], valueChanged: [{ type: Output }] }; return CauseTextAreaLimitedComponent; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var CauseTextBoxMultipleLangueComponent = /** @class */ (function () { function CauseTextBoxMultipleLangueComponent(coreService, translate) { this.translate = translate; this.valueChange = new EventEmitter(); this.isValid = true; this.isValidLang = {}; this.tabs = []; this.selectedIndex = 0; this.values = []; this.validation = { isRequired: false }; this.config = coreService.getConfig(); } Object.defineProperty(CauseTextBoxMultipleLangueComponent.prototype, "isRequired", { get: /** * @return {?} */ function () { return this.validation.isRequired; }, set: /** * @param {?} value * @return {?} */ function (value) { this.validation.isRequired = value; this.validate(); }, enumerable: true, configurable: true }); Object.defineProperty(CauseTextBoxMultipleLangueComponent.prototype, "value", { get: /** * @return {?} */ function () { return this.values; }, set: /** * @param {?} value * @return {?} */ function (value) { var e_1, _a; if (typeof (value) === 'string' || typeof (value) === 'undefined') { try { for (var _b = __values(this.config.languages), _c = _b.next(); !_c.done; _c = _b.next()) { var i = _c.value; /** @type {?} */ var valueLang = {}; valueLang['languageCode'] = i; valueLang[this.localizationField] = value || ''; this.values.push(valueLang); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } } else if (typeof (value) === 'object') { this.values = value; } }, enumerable: true, configurable: true }); /** * @return {?} */ CauseTextBoxMultipleLangueComponent.prototype.ngOnInit = /** * @return {?} */ function () { var _this = this; this.translate.get(this.config.languages).subscribe((/** * @param {?} labels * @return {?} */ function (labels) { for (var i in labels) { if (labels[i]) { _this.isValidLang[i] = true; _this.tabs.push({ languageCode: i, text: labels[i], }); } } })); }; /** * @param {?} languageCode * @return {?} */ CauseTextBoxMultipleLangueComponent.prototype.getLocalizationIndex = /** * @param {?} languageCode * @return {?} */ function (languageCode) { /** @type {?} */ var index = this.values.findIndex((/** * @param {?} l * @return {?} */ function (l) { return l.languageCode === languageCode; })); if (index === -1) { /** @type {?} */ var value = {}; value['languageCode'] = languageCode; value[this.localizationField] = ''; this.values.push(value); return this.values.length - 1; } return index; }; /** * @return {?} */ CauseTextBoxMultipleLangueComponent.prototype.validate = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var isValid = true; this.config.languages.forEach((/** * @param {?} lang * @return {?} */ function (lang) { /** @type {?} */ var index = _this.values.findIndex((/** * @param {?} l * @return {?} */ function (l) { return l.languageCode === lang; })); if (_this.validation.isRequired && (index === -1 || !_this.values[index][_this.localizationField])) { isValid = false; _this.isValidLang[lang] = false; } else { _this.isValidLang[lang] = true; } })); this.isValid = isValid; }; /** * @param {?} e * @return {?} */ CauseTextBoxMultipleLangueComponent.prototype.onTagChanged = /** * @param {?} e * @return {?} */ function (e) { this.validate(); }; /** * @return {?} */ CauseTextBoxMultipleLangueComponent.prototype.onValueChanged = /** * @return {?} */ function () { this.validate(); this.valueChange.emit(this.values); }; CauseTextBoxMultipleLangueComponent.decorators = [ { type: Component, args: [{ selector: 'cause-dx-text-box-multiple-langue', template: "<dx-tab-panel\n [dataSource]=\"tabs\"\n [selectedIndex]=\"selectedIndex\"\n (onSelectionChanged)=\"onTagChanged($event)\">\n <div *dxTemplate=\"let lang of 'title'\">\n <span [class]=\"isValidLang[lang.languageCode] ? '' : 'text-error'\">{{lang.text}}</span>\n <span *ngIf=\"!isValidLang[lang.languageCode]\" class=\"icon-error\">\n <i class=\"dx-icon-info\"></i>\n </span>\n </div>\n <div *dxTemplate=\"let lang of 'item'\">\n <div *ngIf=\"localizationField\">\n <dx-text-box\n [placeholder]=\"lang.text\"\n [(value)]=\"value[getLocalizationIndex(lang.languageCode)][localizationField]\"\n valueChangeEvent=\"keyup\"\n (onValueChanged)=\"onValueChanged()\">\n </dx-text-box>\n </div>\n <div *ngIf=\"!localizationField\">\n <dx-text-box\n [placeholder]=\"lang.text\"\n [(value)]=\"value[lang.languageCode]\"\n valueChangeEvent=\"keyup\"\n (onValueChanged)=\"onValueChanged()\">\n </dx-text-box>\n </div>\n </div>\n</dx-tab-panel>\n", styles: [".text-error{color:#d9534f}.icon-error{color:#fff;border-radius:50%;margin-left:.5em;background-color:#d9534f}"] }] } ]; /** @nocollapse */ CauseTextBoxMultipleLangueComponent.ctorParameters = function () { return [ { type: CoreService }, { type: TranslateService } ]; }; CauseTextBoxMultipleLangueComponent.propDecorators = { valueChange: [{ type: Output }], localizationField: [{ type: Input }], isRequired: [{ type: Input, args: ['isRequired',] }], value: [{ type: Input, args: ['value',] }] }; return CauseTextBoxMultipleLangueComponent; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var DevextremeService = /** @class */ (function () { function DevextremeService() { } DevextremeService.decorators = [ { type: Injectable, args: [{ providedIn: 'root' },] } ]; /** @nocollapse */ DevextremeService.ctorParameters = function () { return []; }; /** @nocollapse */ DevextremeService.ngInjectableDef = ɵɵdefineInjectable({ factory: function DevextremeService_Factory() { return new DevextremeService(); }, token: DevextremeService, providedIn: "root" }); return DevextremeService; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var DevextremeComponent = /** @class */ (function () { function DevextremeComponent() { } /** * @return {?} */ DevextremeComponent.prototype.ngOnInit = /** * @return {?} */ function () { }; DevextremeComponent.decorators = [ { type: Component, args: [{ selector: 'cause-devextreme', template: "<div>{{'core.noGenericComponentOnThisLibrary' | translate}}</div>" }] } ]; /** @nocollapse */ DevextremeComponent.ctorParameters = function () { return []; }; return DevextremeComponent; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var CausePopupConfirmComponent = /** @class */ (function () { function CausePopupConfirmComponent(zone, translate) { var _a; this.zone = zone; this.translate = translate; this.title = ''; this.text = ''; this.showTitle = false; this.visibleChange = new EventEmitter(); this.ok = new EventEmitter(); this.cancel = new EventEmitter(); this.done = new EventEmitter(); this.barItems = (_a = {}, _a['ok'] = { widget: 'dxButton', location: 'center', visible: true, options: { text: '' }, toolbar: 'bottom', parent: this, onClick: CausePopupConfirmComponent.onOkClick }, _a['cancel'] = { widget: 'dxButton', location: 'center', visible: true, options: { text: '' }, toolbar: 'bottom', parent: this, onClick: CausePopupConfirmComponent.onCancelClick }, _a['close'] = { widget: 'dxButton', location: 'center', visible: true, options: { text: '' }, toolbar: 'bottom', parent: this, onClick: CausePopupConfirmComponent.onCancelClick }, _a['save'] = { widget: 'dxButton', location: 'center', visible: true, options: { text: '' }, toolbar: 'bottom', parent: this, onClick: CausePopupConfirmComponent.onOkClick }, _a['yes'] = { widget: 'dxButton', location: 'center', visible: true, options: { text: '' }, toolbar: 'bottom', parent: this, onClick: CausePopupConfirmComponent.onOkClick }, _a['no'] = { widget: 'dxButton', location: 'center', visible: true, options: { text: '' }, toolbar: 'bottom', parent: this, onClick: CausePopupConfirmComponent.onCancelClick }, _a); this.botomToolbarItems = [this.barItems.ok]; this.translationKeyParent = 'devextreme.popupconfirm'; this.translationKeys = ['buttonsave', 'buttonok', 'buttoncancel', 'buttonyes', 'buttonno', 'buttonclose']; this.types = { ok: 'ok', cancel: 'cancel', close: 'close', yesno: 'yesno', okcancel: 'okcancel', okclose: 'okclose', savecancel: 'savecancel' }; } Object.defineProperty(CausePopupConfirmComponent.prototype, "type", { set: /** * @param {?} name * @return {?} */ function (name) { switch (name) { case this.types.cancel: this.botomToolbarItems = [this.barItems.cancel]; break; case this.types.close: this.botomToolbarItems = [this.barItems.close]; break; case this.types.yesno: this.botomToolbarItems = [this.barItems.yes, this.barItems.no]; break; case this.types.okcancel: this.botomToolbarItems = [this.barItems.ok, this.barItems.cancel]; break; case this.types.okclose: this.botomToolbarItems = [this.barItems.ok, this.barItems.close]; break; case this.types.savecancel: this.botomToolbarItems = [this.barItems.save, this.barItems.cancel]; break; default: this.botomToolbarItems = [this.barItems.ok]; break; } }, enumerable: true, configurable: true }); /** * @param {?} e * @return {?} */ CausePopupConfirmComponent.onOkClick = /** * @param {?} e * @return {?} */ function (e) { e.itemData.parent.ok.emit(); e.itemData.parent.done.emit(true); }; /** * @param {?} e * @return {?} */ CausePopupConfirmComponent.onCancelClick = /** * @param {?} e * @return {?} */ function (e) { e.itemData.parent.cancel.emit(); e.itemData.parent.done.emit(false); }; /** * @return {?} */ CausePopupConfirmComponent.prototype.ngOnInit = /** * @return {?} */ function () { this.getTranslations(); }; /** * @return {?} */ CausePopupConfirmComponent.prototype.getTranslations = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var keys = this.translationKeys.map((/** * @param {?} key * @return {?} */ function (key) { return [_this.translationKeyParent, key].join('.'); })); this.translate.get(keys).subscribe((/** * @param {?} translations * @return {?} */ function (translations) { _this.initBarText(translations); })); }; /** * @return {?} */ CausePopupConfirmComponent.prototype.onVisibleChange = /** * @return {?} */ function () { this.visibleChange.emit(this.visible); }; /** * @param {?} translations * @return {?} */ CausePopupConfirmComponent.prototype.initBarText = /** * @param {?} translations * @return {?} */ function (translations) { this.barItems.ok.options.text = translations[[this.translationKeyParent, 'buttonok'].join('.')]; this.barItems.cancel.options.text = translations[[this.translationKeyParent, 'buttoncancel'].join('.')]; this.barItems.save.options.text = translations[[this.translationKeyParent, 'buttonsave'].join('.')]; this.barItems.yes.options.text = translations[[this.translationKeyParent, 'buttonyes'].join('.')]; this.barItems.no.options.text = translations[[this.translationKeyParent, 'buttonno'].join('.')]; this.barItems.close.options.text = translations[[this.translationKeyParent, 'buttonclose'].join('.')]; }; /** * @return {?} */ CausePopupConfirmComponent.prototype.popupHidden = /** * @return {?} */ function () { this.visible = false; this.onVisibleChange(); }; CausePopupConfirmComponent.decorators = [ { type: Component, args: [{ selector: 'cause-popup-confirm', template: "<div>\n <dx-popup\n class=\"popup\"\n [showTitle]=\"showTitle\"\n [title]=\"title\"\n height=\"auto\"\n width=\"auto\"\n [dragEnabled]=\"false\"\n [showCloseButton]=\"true\"\n [closeOnOutsideClick]=\"false\"\n [(visible)]=\"visible\"\n [toolbarItems]=\"botomToolbarItems\"\n (onHidden)=\"popupHidden()\">\n <div>{{text}}</div>\n <ng-content></ng-content>\n </dx-popup>\n</div>\n", styles: [""] }] } ]; /** @nocollapse */ CausePopupConfirmComponent.ctorParameters = function () { return [ { type: NgZone }, { type: TranslateService } ]; }; CausePopupConfirmComponent.propDecorators = { title: [{ type: Input }], text: [{ type: Input }], showTitle: [{ type: Input }], type: [{ type: Input }], visible: [{ type: Input }], visibleChange: [{ type: Output }], ok: [{ type: Output }], cancel: [{ type: Output }], done: [{ type: Output }] }; return CausePopupConfirmComponent; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var CausePopupEditComponent = /** @class */ (function () { function CausePopupEditComponent(zone, translate) { var _a; this.zone = zone; this.translate = translate; this.title = ''; this.visibleChange = new EventEmitter(); this.popupShown = new EventEmitter(); this.save = new EventEmitter(); this.barItems = (_a = {}, _a['ok'] = { widget: 'dxButton', location: 'after', visible: true, options: { text: '' }, toolbar: 'bottom', parent: this, onClick: CausePopupEditComponent.onSaveClick }, _a['save'] = { widget: 'dxButton', location: 'after', visible: true, options: { text: '' }, toolbar: 'bottom', parent: this, onClick: CausePopupEditComponent.onSaveClick }, _a['cancel'] = { widget: 'dxButton', location: 'after', visible: true, options: { text: '' }, toolbar: 'bottom', parent: this, onClick: CausePopupEditComponent.onCancelClick }, _a); this.botomToolbarItems = [this.barItems['save'], this.barItems['cancel']]; this.translationKeyParent = 'devextreme.popupedit'; this.translationKeys = ['buttonsave', 'buttonok', 'buttoncancel']; this.types = { savecancel: 'savecancel', okcancel: 'okcancel' }; } Object.defineProperty(CausePopupEditComponent.prototype, "type", { set: /** * @param {?} name * @return {?} */ function (name) { switch (name) { case this.types.okcancel: this.botomToolbarItems = [this.barItems.ok, this.barItems.cancel]; break; default: this.botomToolbarItems = [this.barItems.save, this.barItems.cancel]; break; } }, enumerable: true, configurable: true }); /** * @param {?} e * @return {?} */ CausePopupEditComponent.onSaveClick = /** * @param {?} e * @return {?} */ function (e) { e.itemData.parent.save.emit(); }; /** * @param {?} e * @return {?} */ CausePopupEditComponent.onCancelClick = /** * @param {?} e * @return {?} */ function (e) { e.itemData.parent.visible = false; e.itemData.parent.onVisibleChange(); }; /** * @return {?} */ CausePopupEditComponent.prototype.ngOnInit = /** * @return {?} */ function () { this.getTranslations(); }; /** * @return {?} */ CausePopupEditComponent.prototype.getTranslations = /** * @return {?} */ function () { var _this = this; /** @type {?} */ var keys = this.translationKeys.map((/** * @param {?} key * @return {?} */ function (key) { return [_this.translationKeyParent, key].join('.'); })); this.translate.get(keys).subscribe((/** * @param {?} translations * @return {?} */ function (translations) { _this.initBarText(translations); })); }; /** * @return {?} */ CausePopupEditComponent.prototype.onVisibleChange = /** * @return {?} */ function () { this.visibleChange.emit(this.visible); }; /** * @param {?} translations * @return {?} */ CausePopupEditComponent.prototype.initBarText = /** * @param {?} translations * @return {?} */ function (translations) { this.barItems.save.options.text = translations[[this.translationKeyParent, 'buttonsave'].join('.')]; this.barItems.ok.options.text = translations[[this.translationKeyParent, 'buttonok'].join('.')]; this.barItems.cancel.options.text = translations[[this.translationKeyParent, 'buttoncancel'].join('.')]; }; /** * @return {?} */ CausePopupEditComponent.prototype.popupHidden = /** * @return {?} */ function () { this.visible = false; this.onVisibleChange(); }; /** * @param {?} e * @return {?} */ CausePopupEditComponent.prototype.onShown = /** * @param {?} e * @return {?} */ function (e) { this.popupShown.emit(e); }; CausePopupEditComponent.decorators = [ { type: Component, args: [{ selector: 'cause-popup-edit', template: "<div>\n <dx-popup\n class=\"popup\"\n [showTitle]=\"true\"\n [title]=\"title\"\n [dragEnabled]=\"false\"\n [showCloseButton]=\"true\"\n [closeOnOutsideClick]=\"false\"\n [(visible)]=\"visible\"\n [toolbarItems]=\"botomToolbarItems\"\n (onHidden)=\"popupHidden()\"\n (onShown)=\"onShown($event)\"\n >\n <ng-content></ng-content>\n </dx-popup>\n</div>\n", styles: [""] }] } ]; /** @nocollapse */ CausePopupEditComponent.ctorParameters = function () { return [ { type: NgZone }, { type: TranslateService } ]; }; CausePopupEditComponent.propDecorators = { title: [{ type: Input }], type: [{ type: Input }], visible: [{ type: Input }], visibleChange: [{ type: Output }], popupShown: [{ type: Output }], save: [{ type: Output }] }; return CausePopupEditComponent; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var CauseDxModule = /** @class */ (function () { function CauseDxModule() { } CauseDxModule.decorators = [ { type: NgModule, args: [{ declarations: [ DevextremeComponent, CauseDataGridComponent, CauseDateBoxComponent, CausePopupConfirmComponent, CausePopupEditComponent, CauseDataGridComponent, CauseTextAreaLimitedComponent, CauseTextBoxMultipleLangueComponent, ], exports: [ DevextremeComponent, CauseDataGridComponent, CauseDateBoxComponent, CausePopupConfirmComponent, CausePopupEditComponent, CauseTextAreaLimitedComponent, CauseTextBoxMultipleLangueComponent, DxDataGridModule, ], imports: [ CommonModule, CauseCoreModule, DxDateBoxModule, DxDataGridModule, DxPopupModule, DxTabPanelModule, DxTextBoxModule, DxTextAreaModule, DxValidatorModule, ], providers: [ DxTemplateHost, WatcherHelper, IterableDifferHelper, NestedOptionHost, ], },] } ]; return CauseDxModule; }()); export { CauseDataGridComponent, CauseDateBoxComponent, CauseDxModule, CauseTextAreaLimitedComponent, CauseTextBoxMultipleLangueComponent, DevextremeComponent, DevextremeService, CausePopupConfirmComponent as ɵa, CausePopupEditComponent as ɵb }; //# sourceMappingURL=cause-911-devextreme.js.map