UNPKG

@kre-form/survey

Version:

1,224 lines (1,212 loc) 329 kB
import { CommonModule, registerLocaleData } from '@angular/common'; import { HttpModule } from '@angular/http'; import { TranslateModule } from '@ngx-translate/core'; import { OverlayModule } from '@angular/cdk/overlay'; import { NzModalService, NgZorroAntdModule, NZ_I18N, zh_CN, NZ_ICONS } from 'ng-zorro-antd'; import { MenuFoldOutline, MenuUnfoldOutline, FormOutline, DashboardOutline, MinusSquareFill, MinusSquareOutline, MinusSquareTwoTone, MinusOutline, InboxOutline } from '@ant-design/icons-angular/icons'; import zh from '@angular/common/locales/zh'; import { __extends, __spread } from 'tslib'; import { NzModalService as NzModalService$1 } from 'ng-zorro-antd/modal'; import { NzMessageService } from 'ng-zorro-antd/message'; import { HttpClient, HttpParams, HttpClientModule } from '@angular/common/http'; import { throwError } from 'rxjs'; import { tap, catchError } from 'rxjs/operators'; import { FieldType, Guid, FieldWrapper, FieldArrayType, clone, KreFormCommonService, KreFormModule } from '@kre-form/core'; import { get, cloneDeep } from 'lodash'; import { moveItemInArray, transferArrayItem, DragDropModule } from '@angular/cdk/drag-drop'; import { FormGroup, NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms'; import { Injectable, EventEmitter, Component, Input, ViewContainerRef, ViewChild, ChangeDetectorRef, ComponentFactoryResolver, Output, forwardRef, NgZone, ElementRef, Directive, Pipe, ɵɵdefineInjectable, ɵɵinject, NgModule } from '@angular/core'; import { DomSanitizer } from '@angular/platform-browser'; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KreFormAntService = /** @class */ (function () { function KreFormAntService() { this.btnEvent = new EventEmitter(); this.fieldEvent = new EventEmitter(); this.questionEvent = new EventEmitter(); this.optionEvent = new EventEmitter(); this.dragDropEvent = new EventEmitter(); this.workList = []; } /** * @param {?} sign * @param {?} field * @return {?} */ KreFormAntService.prototype.fieldOperational = /** * @param {?} sign * @param {?} field * @return {?} */ function (sign, field) { this.fieldEvent.emit({ sign: sign, field: field }); }; /** * @param {?} type * @param {?} field * @return {?} */ KreFormAntService.prototype.groupOperational = /** * @param {?} type * @param {?} field * @return {?} */ function (type, field) { this.btnEvent.emit({ type: type, field: field }); }; /** * @param {?} sign * @param {?} field * @return {?} */ KreFormAntService.prototype.questionOperational = /** * @param {?} sign * @param {?} field * @return {?} */ function (sign, field) { this.questionEvent.emit({ sign: sign, field: field }); }; /** * @param {?} sign * @param {?} option * @param {?} field * @return {?} */ KreFormAntService.prototype.optionOperational = /** * @param {?} sign * @param {?} option * @param {?} field * @return {?} */ function (sign, option, field) { this.optionEvent.emit({ sign: sign, option: option, field: field }); }; /** * @param {?} previousData * @param {?} previousIndex * @param {?} currentIndex * @return {?} */ KreFormAntService.prototype.dragDropOperational = /** * @param {?} previousData * @param {?} previousIndex * @param {?} currentIndex * @return {?} */ function (previousData, previousIndex, currentIndex) { this.dragDropEvent.emit({ previousData: previousData, previousIndex: previousIndex, currentIndex: currentIndex }); }; KreFormAntService.decorators = [ { type: Injectable } ]; /** @nocollapse */ KreFormAntService.ctorParameters = function () { return []; }; return KreFormAntService; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KreSurveyRadioGroup = /** @class */ (function (_super) { __extends(KreSurveyRadioGroup, _super); function KreSurveyRadioGroup(dyService) { var _this = _super.call(this) || this; _this.guid = Guid.create()["value"]; _this.service = dyService; return _this; } /** * @param {?} event * @return {?} */ KreSurveyRadioGroup.prototype.dropOption = /** * @param {?} event * @return {?} */ function (event) { }; //设置逻辑 //设置逻辑 /** * @return {?} */ KreSurveyRadioGroup.prototype.logicQuestion = //设置逻辑 /** * @return {?} */ function () { this.service.questionOperational("logic", this.field); }; //拷贝题目 //拷贝题目 /** * @return {?} */ KreSurveyRadioGroup.prototype.copyQuestion = //拷贝题目 /** * @return {?} */ function () { this.service.questionOperational("copy", this.field); }; //删除题目 //删除题目 /** * @return {?} */ KreSurveyRadioGroup.prototype.delQuestion = //删除题目 /** * @return {?} */ function () { this.service.questionOperational("delete", this.field); }; //点击题目 //点击题目 /** * @return {?} */ KreSurveyRadioGroup.prototype.activeQuestion = //点击题目 /** * @return {?} */ function () { if (!this.active) { this.service.questionOperational("active", this.field); } }; //添加选项 //添加选项 /** * @return {?} */ KreSurveyRadioGroup.prototype.addOption = //添加选项 /** * @return {?} */ function () { this.service.optionOperational("add", "", this.field); }; //批量添加 //批量添加 /** * @return {?} */ KreSurveyRadioGroup.prototype.addOptions = //批量添加 /** * @return {?} */ function () { this.service.optionOperational("adds", "", this.field); }; //删除选项 //删除选项 /** * @param {?} option * @return {?} */ KreSurveyRadioGroup.prototype.deleteOption = //删除选项 /** * @param {?} option * @return {?} */ function (option) { this.service.optionOperational("delete", option, this.field); }; KreSurveyRadioGroup.decorators = [ { type: Component, args: [{ selector: "kresurvey-radiogroup", template: "\n <ng-container *ngIf=\"formStatus !== 0\">\n \n </ng-container>\n\n <ng-container *ngIf=\"formStatus === 0\">\n \n </ng-container>\n " }] } ]; /** @nocollapse */ KreSurveyRadioGroup.ctorParameters = function () { return [ { type: KreFormAntService } ]; }; return KreSurveyRadioGroup; }(FieldType)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KreSurveyDragDrop = /** @class */ (function (_super) { __extends(KreSurveyDragDrop, _super); function KreSurveyDragDrop(dyService) { var _this = _super.call(this) || this; _this.service = dyService; return _this; } Object.defineProperty(KreSurveyDragDrop.prototype, "insertQuestionIndex", { get: /** * @return {?} */ function () { /** @type {?} */ var result = -1; if (this.to.index) { result = this.to.index; } return result; }, enumerable: true, configurable: true }); /** * @param {?} event * @return {?} */ KreSurveyDragDrop.prototype.drop = /** * @param {?} event * @return {?} */ function (event) { if (event.previousContainer === event.container) { moveItemInArray(event.container.data, event.previousIndex, event.currentIndex); } else { this.service.dragDropOperational(event.previousContainer.data, event.previousIndex, event.currentIndex); } }; /** * @param {?} sign * @return {?} */ KreSurveyDragDrop.prototype.fieldOperational = /** * @param {?} sign * @return {?} */ function (sign) { this.service.fieldOperational(sign, this.field); }; //设置逻辑 //设置逻辑 /** * @param {?} field * @return {?} */ KreSurveyDragDrop.prototype.logicQuestion = //设置逻辑 /** * @param {?} field * @return {?} */ function (field) { this.service.questionOperational("logic", field); }; //拷贝题目 //拷贝题目 /** * @param {?} field * @return {?} */ KreSurveyDragDrop.prototype.copyQuestion = //拷贝题目 /** * @param {?} field * @return {?} */ function (field) { this.service.questionOperational("copy", field); }; //删除题目 //删除题目 /** * @param {?} field * @return {?} */ KreSurveyDragDrop.prototype.delQuestion = //删除题目 /** * @param {?} field * @return {?} */ function (field) { this.service.questionOperational("delete", field); }; //点击题目 //点击题目 /** * @param {?} field * @return {?} */ KreSurveyDragDrop.prototype.activeQuestion = //点击题目 /** * @param {?} field * @return {?} */ function (field) { if (!this.field.active) { this.service.questionOperational("active", field); } }; KreSurveyDragDrop.decorators = [ { type: Component, args: [{ selector: "kresurvey-drag-drop", template: "\n <div\n class=\"formly-drag-drop\"\n (cdkDropListDropped)=\"drop($event)\"\n cdkDropList\n [cdkDropListData]=\"field.fieldGroup\"\n >\n <div class=\"formly-drag-drop\">\n <ng-container *ngFor=\"let field of field.fieldGroup; let index = index\">\n <div\n (click)=\"activeQuestion(field)\"\n *ngIf=\"field.active == true\"\n class=\"formly-drag-drop_wrap active\"\n >\n <div class=\"field-operate\">\n <span\n (click)=\"logicQuestion(field)\"\n nzTooltipTitle=\"\u903B\u8F91\u8BBE\u7F6E\"\n nzTooltipPlacement=\"top\"\n nz-tooltip\n >\u8BBE\u7F6E</span\n >\n <span\n (click)=\"copyQuestion(field)\"\n nzTooltipTitle=\"\u590D\u5236\u9898\u76EE\"\n nzTooltipPlacement=\"top\"\n nz-tooltip\n >\u590D\u5236</span\n >\n <span\n (click)=\"delQuestion(field)\"\n nzTooltipTitle=\"\u5220\u9664\u9898\u76EE\"\n nzTooltipPlacement=\"top\"\n nz-tooltip\n >\u5220\u9664</span\n >\n </div>\n <div class=\"field-content\">\n <kreform-field\n [field]=\"field\"\n [rowNumber]=\"index + 1\"\n ></kreform-field>\n </div>\n </div>\n\n <div\n (click)=\"activeQuestion(field)\"\n *ngIf=\"field.active != true\"\n class=\"formly-drag-drop_wrap\"\n cdkDrag\n >\n <div class=\"field-content\">\n <kreform-field\n [field]=\"field\"\n [rowNumber]=\"index + 1\"\n ></kreform-field>\n </div>\n </div>\n </ng-container>\n </div>\n\n <ng-container\n *ngIf=\"field.fieldGroup == null || field.fieldGroup.length == 0\"\n >\n <div class=\"formly_empty\">\n <div\n class=\"formly-drag-drop\"\n (cdkDropListDropped)=\"drop($event)\"\n cdkDropList\n [cdkDropListData]=\"field.fieldGroup\"\n >\n \u8BF7\u628A\u9898\u578B\u62D6\u5165\u6B64\u533A\u57DF\n </div>\n </div>\n </ng-container>\n </div>\n " }] } ]; /** @nocollapse */ KreSurveyDragDrop.ctorParameters = function () { return [ { type: KreFormAntService } ]; }; return KreSurveyDragDrop; }(FieldType)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KreSurveyRadio = /** @class */ (function (_super) { __extends(KreSurveyRadio, _super); function KreSurveyRadio(dyService) { var _this = _super.call(this) || this; _this.guid = Guid.create()["value"]; _this.service = dyService; return _this; } //添加选项 //添加选项 /** * @return {?} */ KreSurveyRadio.prototype.addOption = //添加选项 /** * @return {?} */ function () { this.service.optionOperational("add", "", this.field); }; //批量添加 //批量添加 /** * @return {?} */ KreSurveyRadio.prototype.addOptions = //批量添加 /** * @return {?} */ function () { this.service.optionOperational("adds", "", this.field); }; //删除选项 //删除选项 /** * @param {?} option * @return {?} */ KreSurveyRadio.prototype.deleteOption = //删除选项 /** * @param {?} option * @return {?} */ function (option) { this.service.optionOperational("delete", option, this.field); }; /** * @param {?} event * @return {?} */ KreSurveyRadio.prototype.drop = /** * @param {?} event * @return {?} */ function (event) { if (event.previousContainer === event.container) { moveItemInArray(event.container.data, event.previousIndex, event.currentIndex); } }; KreSurveyRadio.decorators = [ { type: Component, args: [{ selector: "kresurvey-radio", template: " \n <ng-container *ngIf=\"formStatus !== 0\"> \n <div class=\"question-wrap_title\">\n <div class=\"required\">\n <span *ngIf=\"to.required\">*</span>\n </div>\n <inline-editor [(ngModel)]=\"to.label\" [active]=\"active\"\n ></inline-editor>\n </div>\n <div class=\"question-wrap_content\" (cdkDropListDropped)=\"drop($event)\" cdkDropList [cdkDropListData]=\"to.options\">\n <div class=\"option_wrap basic_radio\" *ngFor=\"let item of to.options\" cdkDrag>\n <div class=\"option\">\n <label nz-radio nzDisabled=\"true\"></label> \n <inline-editor [(ngModel)]=\"item.label\" [active]=\"active\"></inline-editor> \n </div>\n <div class=\"operate\" (click)=\"deleteOption(item)\" *ngIf=\"active==true\">\n <i class=\"icon-KT-Close\"></i>\n </div>\n </div>\n </div> \n <div class=\"question-wrap_operate\">\n <span (click)=\"addOption()\">\u6DFB\u52A0\u5355\u4E2A\u9009\u9879</span> \n <span (click)=\"addOptions()\">\u6279\u91CF\u6DFB\u52A0\u9009\u9879</span>\n </div> \n </ng-container>\n\n <ng-container *ngIf=\"formStatus === 0\">\n <nz-radio-group\n [nzName]=\"'radiogroup-' + guid\"\n [formControl]=\"formControl\"\n [kreFormAttributes]=\"field\"\n [class.is-invalid]=\"showError\"\n >\n <ng-container *ngFor=\"let item of to.options\">\n <label nz-radio [nzValue]=\"item.value\">{{ item.label }}</label>\n </ng-container>\n </nz-radio-group>\n </ng-container>\n " }] } ]; /** @nocollapse */ KreSurveyRadio.ctorParameters = function () { return [ { type: KreFormAntService } ]; }; return KreSurveyRadio; }(FieldType)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KreSurveyCheckBox = /** @class */ (function (_super) { __extends(KreSurveyCheckBox, _super); function KreSurveyCheckBox(dyService) { var _this = _super.call(this) || this; _this.guid = Guid.create()["value"]; _this.service = dyService; return _this; } //添加选项 //添加选项 /** * @return {?} */ KreSurveyCheckBox.prototype.addOption = //添加选项 /** * @return {?} */ function () { this.service.optionOperational("add", "", this.field); }; //批量添加 //批量添加 /** * @return {?} */ KreSurveyCheckBox.prototype.addOptions = //批量添加 /** * @return {?} */ function () { this.service.optionOperational("adds", "", this.field); }; //删除选项 //删除选项 /** * @param {?} option * @return {?} */ KreSurveyCheckBox.prototype.deleteOption = //删除选项 /** * @param {?} option * @return {?} */ function (option) { this.service.optionOperational("delete", option, this.field); }; /** * @param {?} values * @return {?} */ KreSurveyCheckBox.prototype.onChange = /** * @param {?} values * @return {?} */ function (values) { var _this = this; if (values != undefined && values != null && values.length > 0) { values.forEach((/** * @param {?} value * @return {?} */ function (value) { if (_this.to.options !== undefined && _this.to.options !== null) { _this.to.options.forEach((/** * @param {?} option * @return {?} */ function (option) { if (option["value"] === value) ; })); } })); } this.formControl.patchValue(values); this.formControl.markAsTouched(); }; /** * @param {?} option * @return {?} */ KreSurveyCheckBox.prototype.getCheckStatus = /** * @param {?} option * @return {?} */ function (option) { this.formControl.value; }; /** * @param {?} values * @param {?} option * @return {?} */ KreSurveyCheckBox.prototype.getControlChecked = /** * @param {?} values * @param {?} option * @return {?} */ function (values, option) { /** @type {?} */ var result = false; if (option && values) { result = values.some((/** * @param {?} value * @return {?} */ function (value) { return value == option.value; })); } return result; }; /** * @param {?} event * @return {?} */ KreSurveyCheckBox.prototype.drop = /** * @param {?} event * @return {?} */ function (event) { if (event.previousContainer === event.container) { moveItemInArray(event.container.data, event.previousIndex, event.currentIndex); } }; KreSurveyCheckBox.decorators = [ { type: Component, args: [{ selector: "kresurvey-checkbox", template: "\n <ng-container *ngIf=\"formStatus !== 0\"> \n <div class=\"question-wrap_title\">\n <div class=\"required\">\n <span *ngIf=\"to.required\">*</span>\n </div>\n <inline-editor [(ngModel)]=\"to.label\" [active]=\"active\"></inline-editor> \n </div>\n <div class=\"question-wrap_content\" (cdkDropListDropped)=\"drop($event)\" cdkDropList [cdkDropListData]=\"to.options\">\n <div class=\"option_wrap basic_checkbox\" *ngFor=\"let item of to.options\" cdkDrag>\n <div class=\"option\">\n <label nz-checkbox nzDisabled=\"true\"></label> \n <inline-editor [(ngModel)]=\"item.label\" [active]=\"active\"></inline-editor> \n </div>\n <div class=\"operate\" (click)=\"deleteOption(item)\" *ngIf=\"active==true\">\n <i class=\"icon-KT-Close\"></i>\n </div> \n </div>\n </div> \n <div class=\"question-wrap_operate\">\n <span (click)=\"addOption()\">\u6DFB\u52A0\u5355\u4E2A\u9009\u9879</span> \n <span (click)=\"addOptions()\">\u6279\u91CF\u6DFB\u52A0\u9009\u9879</span>\n </div> \n </ng-container>\n\n <ng-container *ngIf=\"formStatus === 0\">\n <nz-checkbox-wrapper\n style=\"width: 100%;\"\n (nzOnChange)=\"onChange($event)\"\n [class.is-invalid]=\"showError\"\n >\n <ng-container *ngFor=\"let option of to.options; let i = index\">\n <label\n nz-checkbox\n [nzValue]=\"option.value\"\n [ngModel]=\"getControlChecked(formControl.value, option)\"\n [kreFormAttributes]=\"field\"\n >{{ option.label }}</label>\n </ng-container>\n </nz-checkbox-wrapper> \n </ng-container>\n " }] } ]; /** @nocollapse */ KreSurveyCheckBox.ctorParameters = function () { return [ { type: KreFormAntService } ]; }; return KreSurveyCheckBox; }(FieldType)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KreSurveyDropdown = /** @class */ (function (_super) { __extends(KreSurveyDropdown, _super); function KreSurveyDropdown(dyService) { var _this = _super.call(this) || this; _this.guid = Guid.create()["value"]; _this.service = dyService; return _this; } //添加选项 //添加选项 /** * @return {?} */ KreSurveyDropdown.prototype.addOption = //添加选项 /** * @return {?} */ function () { this.service.optionOperational("add", "", this.field); }; //批量添加 //批量添加 /** * @return {?} */ KreSurveyDropdown.prototype.addOptions = //批量添加 /** * @return {?} */ function () { this.service.optionOperational("adds", "", this.field); }; //删除选项 //删除选项 /** * @param {?} option * @return {?} */ KreSurveyDropdown.prototype.deleteOption = //删除选项 /** * @param {?} option * @return {?} */ function (option) { this.service.optionOperational("delete", option, this.field); }; /** * @param {?} event * @return {?} */ KreSurveyDropdown.prototype.drop = /** * @param {?} event * @return {?} */ function (event) { if (event.previousContainer === event.container) { moveItemInArray(event.container.data, event.previousIndex, event.currentIndex); } }; KreSurveyDropdown.decorators = [ { type: Component, args: [{ selector: "kresurvey-dropdown", template: " \n <ng-container *ngIf=\"formStatus !== 0\"> \n <div class=\"question-wrap_title\">\n <div class=\"required\">\n <span *ngIf=\"to.required\">*</span>\n </div>\n <inline-editor [(ngModel)]=\"to.label\" [active]=\"active\"></inline-editor> \n </div>\n <div class=\"question-wrap_content\" (cdkDropListDropped)=\"drop($event)\" cdkDropList [cdkDropListData]=\"to.options\">\n <div class=\"option_wrap basic_dropdown\" *ngFor=\"let item of to.options\" cdkDrag>\n <div class=\"option\">\n <span class=\"handle\"></span>\n <inline-editor [(ngModel)]=\"item.label\"></inline-editor> \n </div>\n <div class=\"operate\" (click)=\"deleteOption(item)\">\n <i class=\"icon-KT-Close\"></i>\n </div>\n </div>\n </div> \n <div class=\"question-wrap_operate\">\n <span (click)=\"addOption()\">\u6DFB\u52A0\u5355\u4E2A\u9009\u9879</span> \n <span (click)=\"addOptions()\">\u6279\u91CF\u6DFB\u52A0\u9009\u9879</span>\n </div> \n </ng-container> \n\n <ng-container *ngIf=\"formStatus === 0\">\n <nz-select \n nzAllowClear \n [formControl]=\"formControl\"\n [kreFormAttributes]=\"field\"\n [class.is-invalid]=\"showError\"\n nzPlaceHolder=\"\u8BF7\u9009\u62E9\" \n >\n <ng-container *ngFor=\"let item of to.options\">\n <nz-option\n [nzLabel]=\"item.label\"\n [nzValue]=\"item.value\"\n ></nz-option>\n </ng-container>\n </nz-select>\n </ng-container>\n " }] } ]; /** @nocollapse */ KreSurveyDropdown.ctorParameters = function () { return [ { type: KreFormAntService } ]; }; return KreSurveyDropdown; }(FieldType)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KreDialogService = /** @class */ (function () { function KreDialogService(modalService) { this.modalService = modalService; } /** * @param {?} size * @return {?} */ KreDialogService.prototype.switchSize = /** * @param {?} size * @return {?} */ function (size) { /** @type {?} */ var obj = { width: 700, height: 500 }; switch (size) { case "small": obj.width = 530; obj.height = 400; break; case "medium": obj.width = 700; obj.height = 500; break; case "large": obj.width = 950; obj.height = 600; break; default: obj.width = 700; obj.height = 500; break; } return obj; }; /** * @param {?} modalOptions * @param {?} params * @param {?} callback * @return {?} */ KreDialogService.prototype.CreateModelDialog = /** * @param {?} modalOptions * @param {?} params * @param {?} callback * @return {?} */ function (modalOptions, params, callback) { /** @type {?} */ var width = this.switchSize(modalOptions.size).width; /** @type {?} */ var height = this.switchSize(modalOptions.size).height; /** @type {?} */ var modal = this.modalService.create({ nzTitle: modalOptions.nzTitle ? modalOptions.nzTitle : "提示", nzWidth: width + "px", nzClosable: true, nzMaskClosable: false, nzWrapClassName: modalOptions["vertical"] ? "vertical-center-modal" : "", nzBodyStyle: { padding: "0", height: !modalOptions["hideBtn"] ? height - 107 + "px" : height - 54 + "px" }, nzContent: modalOptions.nzContent, nzFooter: !modalOptions["hideBtn"] ? [ { show: true, label: "取消", type: "default", onClick: (/** * @param {?} componentInstance * @return {?} */ function (componentInstance) { modal.destroy(); }) }, { show: modalOptions["showResetBtn"], label: "重置", type: "default", onClick: (/** * @param {?} componentInstance * @return {?} */ function (componentInstance) { return callback(componentInstance, modal); }) }, { show: true, label: modalOptions["primaryLabel"] ? modalOptions["primaryLabel"] : "确定", type: "primary", onClick: (/** * @param {?} componentInstance * @return {?} */ function (componentInstance) { return callback(componentInstance, modal); }) } ] : null, nzOnOk: (/** * @param {?} data * @return {?} */ function (data) { }), nzOnCancel: (/** * @param {?} data * @return {?} */ function (data) { }), nzComponentParams: params }); modal.afterClose.subscribe((/** * @param {?} result * @return {?} */ function (result) { if (result) { callback(result); } })); }; KreDialogService.decorators = [ { type: Injectable, args: [{ providedIn: "root" },] } ]; /** @nocollapse */ KreDialogService.ctorParameters = function () { return [ { type: NzModalService } ]; }; /** @nocollapse */ KreDialogService.ngInjectableDef = ɵɵdefineInjectable({ factory: function KreDialogService_Factory() { return new KreDialogService(ɵɵinject(NzModalService$1)); }, token: KreDialogService, providedIn: "root" }); return KreDialogService; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KreSurveyEditCascader = /** @class */ (function () { function KreSurveyEditCascader() { this.cascaderData = []; this.row1 = { cascader: 1, current: "", showadd: true, data: [] }; this.row2 = { cascader: 2, current: "", showadd: false, data: [] }; this.row3 = { cascader: 3, current: "", showadd: false, data: [] }; this.row4 = { cascader: 4, current: "", showadd: false, data: [] }; } Object.defineProperty(KreSurveyEditCascader.prototype, "fieldConfig", { set: /** * @param {?} value * @return {?} */ function (value) { if (value != undefined && value != null && value.templateOptions != undefined && value.templateOptions != null && value.templateOptions.options != undefined && value.templateOptions.options != null) { if (Array.isArray(value.templateOptions.options)) { this.cascaderData = cloneDeep(value.templateOptions.options); } else { this.cascaderData = []; } } this.row1.data = this.cascaderData; }, enumerable: true, configurable: true }); Object.defineProperty(KreSurveyEditCascader.prototype, "data", { get: /** * @return {?} */ function () { return this.cascaderData; }, set: /** * @param {?} value * @return {?} */ function (value) { }, enumerable: true, configurable: true }); /** * @return {?} */ KreSurveyEditCascader.prototype.ngOnInit = /** * @return {?} */ function () { }; /** * @param {?} changes * @return {?} */ KreSurveyEditCascader.prototype.ngOnChanges = /** * @param {?} changes * @return {?} */ function (changes) { }; /** * @param {?} item * @param {?} type * @return {?} */ KreSurveyEditCascader.prototype.cascaderItem = /** * @param {?} item * @param {?} type * @return {?} */ function (item, type) { /** @type {?} */ var showadd = true; switch (type) { case 1: this.row1.current = item.value; this.row2.cascader = 2; this.row2.showadd = showadd; this.row2.data = item.children ? item.children : []; this.row3.current = ""; this.row3.showadd = false; this.row3.data = []; this.row4.current = ""; this.row4.showadd = false; this.row4.data = []; break; case 2: this.row2.current = item.value; this.row3.cascader = 3; this.row3.showadd = showadd; this.row3.data = item.children ? item.children : []; this.row4.current = ""; this.row4.showadd = false; this.row4.data = []; break; case 3: this.row3.current = item.value; this.row4.cascader = 4; this.row4.showadd = showadd; this.row4.data = item.children ? item.children : []; break; case 4: this.row4.current = item.value; break; } }; /** * @param {?} e * @return {?} */ KreSurveyEditCascader.prototype.addOption = /** * @param {?} e * @return {?} */ function (e) { }; /** * @param {?} e * @param {?} type * @return {?} */ KreSurveyEditCascader.prototype.delOption = /** * @param {?} e * @param {?} type * @return {?} */ function (e, type) { if (e) { switch (type) { case 1: this.row1.data.forEach((/** * @param {?} item * @param {?} index * @param {?} obj * @return {?} */ function (item, index, obj) { if (e.value == item.value) { obj.splice(index, 1); } })); this.row2 = []; this.row3 = []; this.row4 = []; break; case 2: this.row2.data.forEach((/** * @param {?} item * @param {?} index * @param {?} obj * @return {?} */ function (item, index, obj) { if (e.value == item.value) { obj.splice(index, 1); } })); this.row3 = []; this.row4 = []; break; case 3: this.row3.data.forEach((/** * @param {?} item * @param {?} index * @param {?} obj * @return {?} */ function (item, index, obj) { if (e.value == item.value) { obj.splice(index, 1); } })); this.row4 = []; break; case 4: this.row4.data.forEach((/** * @param {?} item * @param {?} index * @param {?} obj * @return {?} */ function (item, index, obj) { if (e.value == item.value) { obj.splice(index, 1); } })); break; } } }; KreSurveyEditCascader.decorators = [ { type: Component, args: [{ selector: "kresurvey-editcascader", template: "<div class=\"cascader_col\">\r\n <kresurvey-editcascader-item title=\"\u4E00\u7EA7\u9009\u9879\" [(row)]=\"row1\" (itemEvent)=\"cascaderItem($event,1)\" (addOptionEvent)=\"addOption(1)\" (delOptionEvent)=\"delOption($event,1)\">\r\n </kresurvey-editcascader-item>\r\n</div>\r\n<div class=\"cascader_col\">\r\n <kresurvey-editcascader-item title=\"\u4E8C\u7EA7\u9009\u9879\" [(row)]=\"row2\" (itemEvent)=\"cascaderItem($event,2)\" (addOptionEvent)=\"addOption(2)\" (delOptionEvent)=\"delOption($event,2)\">\r\n </kresurvey-editcascader-item>\r\n</div>\r\n<div class=\"cascader_col\">\r\n <kresurvey-editcascader-item title=\"\u4E09\u7EA7\u9009\u9879\" [(row)]=\"row3\" (itemEvent)=\"cascaderItem($event,3)\" (addOptionEvent)=\"addOption(3)\" (delOptionEvent)=\"delOption($event,3)\">\r\n </kresurvey-editcascader-item>\r\n</div>\r\n<div class=\"cascader_col\">\r\n <kresurvey-editcascader-item title=\"\u56DB\u7EA7\u9009\u9879\" [(row)]=\"row4\" (itemEvent)=\"cascaderItem($event,4)\" (addOptionEvent)=\"addOption(4)\" (delOptionEvent)=\"delOption($event,4)\">\r\n </kresurvey-editcascader-item>\r\n</div>", styles: [":host ::ng-deep{width:100%;height:100%;display:flex;background-color:#fff;padding:20px 0 0 10px}:host ::ng-deep .cascader_col{flex:1;padding:0 0 0 20px;border-right:1px solid #dde5ed}:host ::ng-deep .cascader_col:nth-last-child(1){flex:1;border-right:0}:host ::ng-deep kresurvey-editcascader-item .wrap_active{border-color:#2672ff;background:#e7efff;box-shadow:0 2px 4px 0 rgba(38,114,255,.2)}:host ::ng-deep kresurvey-editcascader-item .wrap_active .cascader_col_wrap_delete{display:block}:host ::ng-deep kresurvey-editcascader-item .cascader_col_title{padding:0 0 12px;font-size:14px;line-height:1;color:#707070;text-align:left}:host ::ng-deep kresurvey-editcascader-item .cascader_col_item{padding:0 20px 0 0}:host ::ng-deep kresurvey-editcascader-item .cascader_col_wrap{display:flex;border:1px solid #dde5ed;position:relative;margin:0 0 10px;cursor:pointer;padding:0 0 0 10px}:host ::ng-deep kresurvey-editcascader-item .cascader_col_wrap_order{float:left;height:34px;line-height:34px;font-size:12px;color:#aaa;text-align:center}:host ::ng-deep kresurvey-editcascader-item .cascader_col_wrap_input{flex:1;float:left;padding:5px;text-align:left;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host ::ng-deep kresurvey-editcascader-item .cascader_col_wrap_input input{border:0;height:24px;line-height:24px;width:100%;font-size:12px;color:#aaa;outline:0;border:none;background:0 0}:host ::ng-deep kresurvey-editcascader-item .cascader_col_wrap_limit{float:left;top:0;right:0;height:34px;padding:0 6px 0 0;line-height:34px;font-size:12px;color:#2672ff;text-align:left}:host ::ng-deep kresurvey-editcascader-item .cascader_col_wrap_delete{position:absolute;right:-5px;top:-10px;display:none}:host ::ng-deep kresurvey-editcascader-item .cascader_col_wrap_delete span{background:red;border-radius:50%;display:inline-block;height:14px;width:14px;cursor:pointer}:host ::ng-deep kresurvey-editcascader-item .cascader_col_wrap_delete span i{color:#fff;font-size:2px;height:2px;width:6px;position:absolute;margin:3px 2px 0}:host ::ng-deep kresurvey-editcascader-item .cascader_col_add{font-size:12px;cursor:pointer}:host ::ng-deep .kresurvey-scrollbar{scrollbar-color:transparent;overflow-y:overlay}:host ::ng-deep .kresurvey-scrollbar::-webkit-scrollbar{width:6px;height:6px}:host ::ng-deep .kresurvey-scrollbar::-webkit-scrollbar-track{box-shadow:inset 0 0 6px transparent}:host ::ng-deep .kresurvey-scrollbar::-webkit-scrollbar-thumb{background-color:#999;outline:#333 solid 1px;border-radius:6px}"] }] } ]; /** @nocollapse */ KreSurveyEditCascader.ctorParameters = function () { return []; }; KreSurveyEditCascader.propDecorators = { fieldConfig: [{ type: Input }], data: [{ type: Input }] }; return KreSurveyEditCascader; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KreSurveyCascader = /** @class */ (function (_super) { __extends(KreSurveyCascader, _super); function KreSurveyCascader(dyService, modal, kreDialogService) { var _this = _super.call(this) || this; _this.modal = modal; _this.kreDialogService = kreDialogService; _this.guid = Guid.create()["value"]; _this.values = null; _this.service = dyService; return _this; } //添加选项 //添加选项 /** * @return {?} */ KreSurveyCascader.prototype.addOption = //添加选项 /** * @return {?} */ function () { var _this = this; /** @type {?} */ var para = { fieldConfig: this.field }; this.kreDialogService.CreateModelDialog({ nzTitle: "选项编辑", size: "large", nzContent: KreSurveyEditCascader }, para, (/** * @param {?} instance * @param {?} modal * @return {?} */ function (instance, modal) { /** @type {?} */ var optionlist = instance.cascaderData; _this.to.options = optionlist; modal.destroy(); })); }; KreSurveyCascader.decorators = [ { type: Component, args: [{ selector: "kresurvey-cascader", template: " \n <ng-container *ngIf=\"formStatus !== 0\"> \n <div class=\"question-wrap_title\">\n <div class=\"required\">\n <span *ngIf=\"to.required\">*</span>\n </div>\n <inline-editor [(ngModel)]=\"to.label\" [active]=\"active\"></inline-editor> \n </div>\n <div class=\"question-wrap_content\">\n <div class=\"option_wrap select_cascader\">\n <nz-cascader [nzOptions]=\"to.options\" [nzShowSearch]=\"true\" [nzDisabled]=\"true\">\n </nz-cascader>\n </div>\n </div> \n <div class=\"question-wrap_operate\">\n <span (click)=\"addOption()\">\u7F16\u8F91\u9009\u9879</span> \n </div> \n </ng-container>\n\n\n <ng-container *ngIf=\"formStatus === 0\">\n <nz-cascader nzChangeOnSelect [nzOptions]=\"to.options\" nzPlaceHolder=\"\u8BF7\u9009\u62E9\"\n [formControl]=\"formControl\"\n [kreFormAttributes]=\"field\">\n </nz-cascader>\n \n </ng-container>\n " }] } ]; /** @nocollapse */ KreSurveyCascader.ctorParameters = function () { return [ { type: KreFormAntService }, { type: NzModalService$1 }, { type: KreDialogService } ]; }; return KreSurveyCascader; }(FieldType)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KreSurveyScaler = /** @class */ (function (_super) { __extends(KreSurveyScaler, _super); function KreSurveyScaler(dyService) { var _this = _super.call(this) || this; _this.guid = Guid.create()["value"]; _this.service = dyService; return _this; } Object.defineProperty(KreSurveyScaler.prototype, "scalerData", { get: /** * @return {?} */ function () { /** @type {?} */ var result = []; if (this.to != undefined && this.to != null && this.to.beginNumber != undefined && this.to.beginNumber != null && this.to.max != undefined && this.to.max != null) { /** @type {?} */ var begin = this.to.beginNumber; for (var i = 0; i < this.to.max; i++) { result.push({ value: begin, label: begin, }); begin = begin + 1; } } return result; }, enumerable: true, configurable: true }); KreSurveyScaler.decorators = [ { type: Component, args: [{ selector: "kresurvey-scaler", template: "" }] } ]; /** @nocollapse */ KreSurveyScaler.ctorParameters = function () { return [ { type: KreFormAntService } ]; }; return KreSurveyScaler; }(FieldType)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KreSurveyScore = /** @class */ (function (_super) { __extends(KreSurveyScore, _super); function KreSurveyScore(dyService) { var _this = _super.call(this) || this; _this.guid = Guid.create()["value"]; _this.service = dyService; return _this; } //添加选项 //添加选项 /** * @return {?} */ KreSurveyScore.prototype.addOption = //添加选项 /** * @return {?} */ function () { this.service.optionOperational("add", "", this.field); }; //批量添加 //批量添加 /** * @return {?} */ KreSurveyScore.prototype.addOptions = //批量添加 /** * @return {?} */ function () { this.service.optionOperational("adds", "", this.field); }; KreSurveyScore.decorators = [ { type: Component, args: [{ selector: "kresurvey-score", template: "\n \n <ng-container *ngIf=\"formStatus !== 0\"> \n <div class=\"question-wrap_title\">\n <div class=\"required\">\n <span *ngIf=\"to.required\">*</span>\n </div>\n <inline-editor [(ngModel)]=\"to.label\" [active]=\"active\"></inline-editor> \n </div>\n <div class=\"question-wrap_content\">\n <div class=\"option_wrap basic_score\">\n \n <nz-rate *ngIf=\"to.type=='start'\" nzAllowHalf [nzCount]=\"to.setting.max\"></nz-rate>\n <nz-rate *ngIf=\"to.type=='heart'\" nzAllowHalf [nzCharacter]=\"characterIconHeart\" [nzCount]=\"to.setting.max\"></nz-rate>\n <nz-rate *ngIf=\"to.type=='good'\" nzAllowHalf [nzCharacter]=\"characterIconGood\" [nzCount]=\"to.setting.max\"></nz-rate>\n <nz-rate *ngIf=\"to.type=='other'\" nzAllowHalf [nzCharacter]=\"characterIconOther\" [nzCount]=\"to.setting.max\"></nz-rate> \n <ng-template #characterIconHeart> \n \u5FC3 \n </ng-template>\n <ng-template #characterIconGood>\n \u8D5E \n </ng-template>\n <ng-template #characterIconOther>\n {{to.setting.label}} \n </ng-template> \n </div>\n </div> \n </ng-container>\n\n <ng-container *ngIf=\"formStatus === 0\">\n <nz-rate *ngIf=\"to.type=='start'\" nzAllowHalf [nzCount]=\"to.setting.max\"\n [formControl]=\"formControl\"\n [kreFormAttributes]=\"field\">\n </nz-rate>\n <nz-rate *ngIf=\"to.type=='heart'\" nzAllowHalf [nzCharacter]=\"characterIconHeart\" [nzCount]=\"to.setting.max\"\n [formControl]=\"formControl\"\n [kreFormAttributes]=\"field\">\n </nz-rate>\n <nz-rate *ngIf=\"to.type=='good'\" nzAllowHalf [nzCharacter]=\"characterIconGood\" [nzCount]=\"to.setting.max\"\n [formControl]=\"formControl\"\n [kreFormAttributes]=\"field\">\n </nz-rate>\n <nz-rate *ngIf=\"to.type=='other'\" nzAllowHalf [nzCharacter]=\"characterIconOther\" [nzCount]=\"to.setting.max\"\n [formControl]=\"formControl\"\n [kreFormAttributes]=\"field\">\n </nz-rate> \n <ng-template #characterIconHeart> \n \u5FC3 \n </ng-template>\n <ng-template #characterIconGood>\n \u8D5E \n </ng-template>\n <ng-template #characterIconOther>\n {{to.setting.label}} \n </ng-template> \n </ng-container>\n " }] } ];