@kre-form/survey
Version:
1,556 lines (1,516 loc) • 270 kB
JavaScript
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 { 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, NgModule, ɵɵdefineInjectable, ɵɵinject } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class KreFormAntService {
constructor() {
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 {?}
*/
fieldOperational(sign, field) {
this.fieldEvent.emit({
sign: sign,
field: field
});
}
/**
* @param {?} type
* @param {?} field
* @return {?}
*/
groupOperational(type, field) {
this.btnEvent.emit({
type: type,
field: field
});
}
/**
* @param {?} sign
* @param {?} field
* @return {?}
*/
questionOperational(sign, field) {
this.questionEvent.emit({
sign: sign,
field: field
});
}
/**
* @param {?} sign
* @param {?} option
* @param {?} field
* @return {?}
*/
optionOperational(sign, option, field) {
this.optionEvent.emit({
sign: sign,
option: option,
field: field
});
}
/**
* @param {?} previousData
* @param {?} previousIndex
* @param {?} currentIndex
* @return {?}
*/
dragDropOperational(previousData, previousIndex, currentIndex) {
this.dragDropEvent.emit({
previousData: previousData,
previousIndex: previousIndex,
currentIndex: currentIndex
});
}
}
KreFormAntService.decorators = [
{ type: Injectable }
];
/** @nocollapse */
KreFormAntService.ctorParameters = () => [];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class KreSurveyRadioGroup extends FieldType {
/**
* @param {?} dyService
*/
constructor(dyService) {
super();
this.guid = Guid.create()["value"];
this.service = dyService;
}
/**
* @param {?} event
* @return {?}
*/
dropOption(event) {
}
//设置逻辑
/**
* @return {?}
*/
logicQuestion() {
this.service.questionOperational("logic", this.field);
}
//拷贝题目
/**
* @return {?}
*/
copyQuestion() {
this.service.questionOperational("copy", this.field);
}
//删除题目
/**
* @return {?}
*/
delQuestion() {
this.service.questionOperational("delete", this.field);
}
//点击题目
/**
* @return {?}
*/
activeQuestion() {
if (!this.active) {
this.service.questionOperational("active", this.field);
}
}
//添加选项
/**
* @return {?}
*/
addOption() {
this.service.optionOperational("add", "", this.field);
}
//批量添加
/**
* @return {?}
*/
addOptions() {
this.service.optionOperational("adds", "", this.field);
}
//删除选项
/**
* @param {?} option
* @return {?}
*/
deleteOption(option) {
this.service.optionOperational("delete", option, this.field);
}
}
KreSurveyRadioGroup.decorators = [
{ type: Component, args: [{
selector: "kresurvey-radiogroup",
template: `
<ng-container *ngIf="formStatus !== 0">
</ng-container>
<ng-container *ngIf="formStatus === 0">
</ng-container>
`
}] }
];
/** @nocollapse */
KreSurveyRadioGroup.ctorParameters = () => [
{ type: KreFormAntService }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class KreSurveyDragDrop extends FieldType {
/**
* @param {?} dyService
*/
constructor(dyService) {
super();
this.service = dyService;
}
/**
* @return {?}
*/
get insertQuestionIndex() {
/** @type {?} */
let result = -1;
if (this.to.index) {
result = this.to.index;
}
return result;
}
/**
* @param {?} event
* @return {?}
*/
drop(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 {?}
*/
fieldOperational(sign) {
this.service.fieldOperational(sign, this.field);
}
//设置逻辑
/**
* @param {?} field
* @return {?}
*/
logicQuestion(field) {
this.service.questionOperational("logic", field);
}
//拷贝题目
/**
* @param {?} field
* @return {?}
*/
copyQuestion(field) {
this.service.questionOperational("copy", field);
}
//删除题目
/**
* @param {?} field
* @return {?}
*/
delQuestion(field) {
this.service.questionOperational("delete", field);
}
//点击题目
/**
* @param {?} field
* @return {?}
*/
activeQuestion(field) {
if (!this.field.active) {
this.service.questionOperational("active", field);
}
}
}
KreSurveyDragDrop.decorators = [
{ type: Component, args: [{
selector: "kresurvey-drag-drop",
template: `
<div
class="formly-drag-drop"
(cdkDropListDropped)="drop($event)"
cdkDropList
[cdkDropListData]="field.fieldGroup"
>
<div class="formly-drag-drop">
<ng-container *ngFor="let field of field.fieldGroup; let index = index">
<div
(click)="activeQuestion(field)"
*ngIf="field.active == true"
class="formly-drag-drop_wrap active"
>
<div class="field-operate">
<span
(click)="logicQuestion(field)"
nzTooltipTitle="逻辑设置"
nzTooltipPlacement="top"
nz-tooltip
>设置</span
>
<span
(click)="copyQuestion(field)"
nzTooltipTitle="复制题目"
nzTooltipPlacement="top"
nz-tooltip
>复制</span
>
<span
(click)="delQuestion(field)"
nzTooltipTitle="删除题目"
nzTooltipPlacement="top"
nz-tooltip
>删除</span
>
</div>
<div class="field-content">
<kreform-field
[field]="field"
[rowNumber]="index + 1"
></kreform-field>
</div>
</div>
<div
(click)="activeQuestion(field)"
*ngIf="field.active != true"
class="formly-drag-drop_wrap"
cdkDrag
>
<div class="field-content">
<kreform-field
[field]="field"
[rowNumber]="index + 1"
></kreform-field>
</div>
</div>
</ng-container>
</div>
<ng-container
*ngIf="field.fieldGroup == null || field.fieldGroup.length == 0"
>
<div class="formly_empty">
<div
class="formly-drag-drop"
(cdkDropListDropped)="drop($event)"
cdkDropList
[cdkDropListData]="field.fieldGroup"
>
请把题型拖入此区域
</div>
</div>
</ng-container>
</div>
`
}] }
];
/** @nocollapse */
KreSurveyDragDrop.ctorParameters = () => [
{ type: KreFormAntService }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class KreSurveyRadio extends FieldType {
/**
* @param {?} dyService
*/
constructor(dyService) {
super();
this.guid = Guid.create()["value"];
this.service = dyService;
}
//添加选项
/**
* @return {?}
*/
addOption() {
this.service.optionOperational("add", "", this.field);
}
//批量添加
/**
* @return {?}
*/
addOptions() {
this.service.optionOperational("adds", "", this.field);
}
//删除选项
/**
* @param {?} option
* @return {?}
*/
deleteOption(option) {
this.service.optionOperational("delete", option, this.field);
}
/**
* @param {?} event
* @return {?}
*/
drop(event) {
if (event.previousContainer === event.container) {
moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
}
}
}
KreSurveyRadio.decorators = [
{ type: Component, args: [{
selector: "kresurvey-radio",
template: `
<ng-container *ngIf="formStatus !== 0">
<div class="question-wrap_title">
<div class="required">
<span *ngIf="to.required">*</span>
</div>
<inline-editor [(ngModel)]="to.label" [active]="active"
></inline-editor>
</div>
<div class="question-wrap_content" (cdkDropListDropped)="drop($event)" cdkDropList [cdkDropListData]="to.options">
<div class="option_wrap basic_radio" *ngFor="let item of to.options" cdkDrag>
<div class="option">
<label nz-radio nzDisabled="true"></label>
<inline-editor [(ngModel)]="item.label" [active]="active"></inline-editor>
</div>
<div class="operate" (click)="deleteOption(item)" *ngIf="active==true">
<i class="icon-KT-Close"></i>
</div>
</div>
</div>
<div class="question-wrap_operate">
<span (click)="addOption()">添加单个选项</span>
<span (click)="addOptions()">批量添加选项</span>
</div>
</ng-container>
<ng-container *ngIf="formStatus === 0">
<nz-radio-group
[nzName]="'radiogroup-' + guid"
[formControl]="formControl"
[kreFormAttributes]="field"
[class.is-invalid]="showError"
>
<ng-container *ngFor="let item of to.options">
<label nz-radio [nzValue]="item.value">{{ item.label }}</label>
</ng-container>
</nz-radio-group>
</ng-container>
`
}] }
];
/** @nocollapse */
KreSurveyRadio.ctorParameters = () => [
{ type: KreFormAntService }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class KreSurveyCheckBox extends FieldType {
/**
* @param {?} dyService
*/
constructor(dyService) {
super();
this.guid = Guid.create()["value"];
this.service = dyService;
}
//添加选项
/**
* @return {?}
*/
addOption() {
this.service.optionOperational("add", "", this.field);
}
//批量添加
/**
* @return {?}
*/
addOptions() {
this.service.optionOperational("adds", "", this.field);
}
//删除选项
/**
* @param {?} option
* @return {?}
*/
deleteOption(option) {
this.service.optionOperational("delete", option, this.field);
}
/**
* @param {?} values
* @return {?}
*/
onChange(values) {
if (values != undefined && values != null && values.length > 0) {
values.forEach((/**
* @param {?} value
* @return {?}
*/
value => {
if (this.to.options !== undefined && this.to.options !== null) {
this.to.options.forEach((/**
* @param {?} option
* @return {?}
*/
(option) => {
if (option["value"] === value) ;
}));
}
}));
}
this.formControl.patchValue(values);
this.formControl.markAsTouched();
}
/**
* @param {?} option
* @return {?}
*/
getCheckStatus(option) {
this.formControl.value;
}
/**
* @param {?} values
* @param {?} option
* @return {?}
*/
getControlChecked(values, option) {
/** @type {?} */
let result = false;
if (option && values) {
result = values.some((/**
* @param {?} value
* @return {?}
*/
(value) => {
return value == option.value;
}));
}
return result;
}
/**
* @param {?} event
* @return {?}
*/
drop(event) {
if (event.previousContainer === event.container) {
moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
}
}
}
KreSurveyCheckBox.decorators = [
{ type: Component, args: [{
selector: "kresurvey-checkbox",
template: `
<ng-container *ngIf="formStatus !== 0">
<div class="question-wrap_title">
<div class="required">
<span *ngIf="to.required">*</span>
</div>
<inline-editor [(ngModel)]="to.label" [active]="active"></inline-editor>
</div>
<div class="question-wrap_content" (cdkDropListDropped)="drop($event)" cdkDropList [cdkDropListData]="to.options">
<div class="option_wrap basic_checkbox" *ngFor="let item of to.options" cdkDrag>
<div class="option">
<label nz-checkbox nzDisabled="true"></label>
<inline-editor [(ngModel)]="item.label" [active]="active"></inline-editor>
</div>
<div class="operate" (click)="deleteOption(item)" *ngIf="active==true">
<i class="icon-KT-Close"></i>
</div>
</div>
</div>
<div class="question-wrap_operate">
<span (click)="addOption()">添加单个选项</span>
<span (click)="addOptions()">批量添加选项</span>
</div>
</ng-container>
<ng-container *ngIf="formStatus === 0">
<nz-checkbox-wrapper
style="width: 100%;"
(nzOnChange)="onChange($event)"
[class.is-invalid]="showError"
>
<ng-container *ngFor="let option of to.options; let i = index">
<label
nz-checkbox
[nzValue]="option.value"
[ngModel]="getControlChecked(formControl.value, option)"
[kreFormAttributes]="field"
>{{ option.label }}</label>
</ng-container>
</nz-checkbox-wrapper>
</ng-container>
`
}] }
];
/** @nocollapse */
KreSurveyCheckBox.ctorParameters = () => [
{ type: KreFormAntService }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class KreSurveyDropdown extends FieldType {
/**
* @param {?} dyService
*/
constructor(dyService) {
super();
this.guid = Guid.create()["value"];
this.service = dyService;
}
//添加选项
/**
* @return {?}
*/
addOption() {
this.service.optionOperational("add", "", this.field);
}
//批量添加
/**
* @return {?}
*/
addOptions() {
this.service.optionOperational("adds", "", this.field);
}
//删除选项
/**
* @param {?} option
* @return {?}
*/
deleteOption(option) {
this.service.optionOperational("delete", option, this.field);
}
/**
* @param {?} event
* @return {?}
*/
drop(event) {
if (event.previousContainer === event.container) {
moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
}
}
}
KreSurveyDropdown.decorators = [
{ type: Component, args: [{
selector: "kresurvey-dropdown",
template: `
<ng-container *ngIf="formStatus !== 0">
<div class="question-wrap_title">
<div class="required">
<span *ngIf="to.required">*</span>
</div>
<inline-editor [(ngModel)]="to.label" [active]="active"></inline-editor>
</div>
<div class="question-wrap_content" (cdkDropListDropped)="drop($event)" cdkDropList [cdkDropListData]="to.options">
<div class="option_wrap basic_dropdown" *ngFor="let item of to.options" cdkDrag>
<div class="option">
<span class="handle"></span>
<inline-editor [(ngModel)]="item.label"></inline-editor>
</div>
<div class="operate" (click)="deleteOption(item)">
<i class="icon-KT-Close"></i>
</div>
</div>
</div>
<div class="question-wrap_operate">
<span (click)="addOption()">添加单个选项</span>
<span (click)="addOptions()">批量添加选项</span>
</div>
</ng-container>
<ng-container *ngIf="formStatus === 0">
<nz-select
nzAllowClear
[formControl]="formControl"
[kreFormAttributes]="field"
[class.is-invalid]="showError"
nzPlaceHolder="请选择"
>
<ng-container *ngFor="let item of to.options">
<nz-option
[nzLabel]="item.label"
[nzValue]="item.value"
></nz-option>
</ng-container>
</nz-select>
</ng-container>
`
}] }
];
/** @nocollapse */
KreSurveyDropdown.ctorParameters = () => [
{ type: KreFormAntService }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class KreDialogService {
/**
* @param {?} modalService
*/
constructor(modalService) {
this.modalService = modalService;
}
/**
* @param {?} size
* @return {?}
*/
switchSize(size) {
/** @type {?} */
const 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 {?}
*/
CreateModelDialog(modalOptions, params, callback) {
/** @type {?} */
const width = this.switchSize(modalOptions.size).width;
/** @type {?} */
const height = this.switchSize(modalOptions.size).height;
/** @type {?} */
const 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 {?}
*/
componentInstance => {
modal.destroy();
})
},
{
show: modalOptions["showResetBtn"],
label: "重置",
type: "default",
onClick: (/**
* @param {?} componentInstance
* @return {?}
*/
componentInstance => callback(componentInstance, modal))
},
{
show: true,
label: modalOptions["primaryLabel"]
? modalOptions["primaryLabel"]
: "确定",
type: "primary",
onClick: (/**
* @param {?} componentInstance
* @return {?}
*/
componentInstance => callback(componentInstance, modal))
}
]
: null,
nzOnOk: (/**
* @param {?} data
* @return {?}
*/
data => { }),
nzOnCancel: (/**
* @param {?} data
* @return {?}
*/
data => { }),
nzComponentParams: params
});
modal.afterClose.subscribe((/**
* @param {?} result
* @return {?}
*/
(result) => {
if (result) {
callback(result);
}
}));
}
}
KreDialogService.decorators = [
{ type: Injectable, args: [{
providedIn: "root"
},] }
];
/** @nocollapse */
KreDialogService.ctorParameters = () => [
{ type: NzModalService }
];
/** @nocollapse */ KreDialogService.ngInjectableDef = ɵɵdefineInjectable({ factory: function KreDialogService_Factory() { return new KreDialogService(ɵɵinject(NzModalService$1)); }, token: KreDialogService, providedIn: "root" });
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class KreSurveyEditCascader {
constructor() {
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: []
};
}
/**
* @param {?} value
* @return {?}
*/
set fieldConfig(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;
}
;
/**
* @param {?} value
* @return {?}
*/
set data(value) {
}
/**
* @return {?}
*/
get data() {
return this.cascaderData;
}
/**
* @return {?}
*/
ngOnInit() {
}
/**
* @param {?} changes
* @return {?}
*/
ngOnChanges(changes) {
}
/**
* @param {?} item
* @param {?} type
* @return {?}
*/
cascaderItem(item, type) {
/** @type {?} */
let 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 {?}
*/
addOption(e) {
}
/**
* @param {?} e
* @param {?} type
* @return {?}
*/
delOption(e, type) {
if (e) {
switch (type) {
case 1:
this.row1.data.forEach((/**
* @param {?} item
* @param {?} index
* @param {?} obj
* @return {?}
*/
(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 {?}
*/
(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 {?}
*/
(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 {?}
*/
(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 = () => [];
KreSurveyEditCascader.propDecorators = {
fieldConfig: [{ type: Input }],
data: [{ type: Input }]
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class KreSurveyCascader extends FieldType {
/**
* @param {?} dyService
* @param {?} modal
* @param {?} kreDialogService
*/
constructor(dyService, modal, kreDialogService) {
super();
this.modal = modal;
this.kreDialogService = kreDialogService;
this.guid = Guid.create()["value"];
this.values = null;
this.service = dyService;
}
//添加选项
/**
* @return {?}
*/
addOption() {
/** @type {?} */
let para = {
fieldConfig: this.field
};
this.kreDialogService.CreateModelDialog({
nzTitle: "选项编辑",
size: "large",
nzContent: KreSurveyEditCascader
}, para, (/**
* @param {?} instance
* @param {?} modal
* @return {?}
*/
(instance, modal) => {
/** @type {?} */
let optionlist = instance.cascaderData;
this.to.options = optionlist;
modal.destroy();
}));
}
}
KreSurveyCascader.decorators = [
{ type: Component, args: [{
selector: "kresurvey-cascader",
template: `
<ng-container *ngIf="formStatus !== 0">
<div class="question-wrap_title">
<div class="required">
<span *ngIf="to.required">*</span>
</div>
<inline-editor [(ngModel)]="to.label" [active]="active"></inline-editor>
</div>
<div class="question-wrap_content">
<div class="option_wrap select_cascader">
<nz-cascader [nzOptions]="to.options" [nzShowSearch]="true" [nzDisabled]="true">
</nz-cascader>
</div>
</div>
<div class="question-wrap_operate">
<span (click)="addOption()">编辑选项</span>
</div>
</ng-container>
<ng-container *ngIf="formStatus === 0">
<nz-cascader nzChangeOnSelect [nzOptions]="to.options" nzPlaceHolder="请选择"
[formControl]="formControl"
[kreFormAttributes]="field">
</nz-cascader>
</ng-container>
`
}] }
];
/** @nocollapse */
KreSurveyCascader.ctorParameters = () => [
{ type: KreFormAntService },
{ type: NzModalService$1 },
{ type: KreDialogService }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class KreSurveyScaler extends FieldType {
/**
* @param {?} dyService
*/
constructor(dyService) {
super();
this.guid = Guid.create()["value"];
this.service = dyService;
}
/**
* @return {?}
*/
get scalerData() {
/** @type {?} */
let 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 {?} */
let begin = this.to.beginNumber;
for (let i = 0; i < this.to.max; i++) {
result.push({
value: begin,
label: begin,
});
begin = begin + 1;
}
}
return result;
}
}
KreSurveyScaler.decorators = [
{ type: Component, args: [{
selector: "kresurvey-scaler",
template: ``
}] }
];
/** @nocollapse */
KreSurveyScaler.ctorParameters = () => [
{ type: KreFormAntService }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class KreSurveyScore extends FieldType {
/**
* @param {?} dyService
*/
constructor(dyService) {
super();
this.guid = Guid.create()["value"];
this.service = dyService;
}
//添加选项
/**
* @return {?}
*/
addOption() {
this.service.optionOperational("add", "", this.field);
}
//批量添加
/**
* @return {?}
*/
addOptions() {
this.service.optionOperational("adds", "", this.field);
}
}
KreSurveyScore.decorators = [
{ type: Component, args: [{
selector: "kresurvey-score",
template: `
<ng-container *ngIf="formStatus !== 0">
<div class="question-wrap_title">
<div class="required">
<span *ngIf="to.required">*</span>
</div>
<inline-editor [(ngModel)]="to.label" [active]="active"></inline-editor>
</div>
<div class="question-wrap_content">
<div class="option_wrap basic_score">
<nz-rate *ngIf="to.type=='start'" nzAllowHalf [nzCount]="to.setting.max"></nz-rate>
<nz-rate *ngIf="to.type=='heart'" nzAllowHalf [nzCharacter]="characterIconHeart" [nzCount]="to.setting.max"></nz-rate>
<nz-rate *ngIf="to.type=='good'" nzAllowHalf [nzCharacter]="characterIconGood" [nzCount]="to.setting.max"></nz-rate>
<nz-rate *ngIf="to.type=='other'" nzAllowHalf [nzCharacter]="characterIconOther" [nzCount]="to.setting.max"></nz-rate>
<ng-template #characterIconHeart>
心
</ng-template>
<ng-template #characterIconGood>
赞
</ng-template>
<ng-template #characterIconOther>
{{to.setting.label}}
</ng-template>
</div>
</div>
</ng-container>
<ng-container *ngIf="formStatus === 0">
<nz-rate *ngIf="to.type=='start'" nzAllowHalf [nzCount]="to.setting.max"
[formControl]="formControl"
[kreFormAttributes]="field">
</nz-rate>
<nz-rate *ngIf="to.type=='heart'" nzAllowHalf [nzCharacter]="characterIconHeart" [nzCount]="to.setting.max"
[formControl]="formControl"
[kreFormAttributes]="field">
</nz-rate>
<nz-rate *ngIf="to.type=='good'" nzAllowHalf [nzCharacter]="characterIconGood" [nzCount]="to.setting.max"
[formControl]="formControl"
[kreFormAttributes]="field">
</nz-rate>
<nz-rate *ngIf="to.type=='other'" nzAllowHalf [nzCharacter]="characterIconOther" [nzCount]="to.setting.max"
[formControl]="formControl"
[kreFormAttributes]="field">
</nz-rate>
<ng-template #characterIconHeart>
心
</ng-template>
<ng-template #characterIconGood>
赞
</ng-template>
<ng-template #characterIconOther>
{{to.setting.label}}
</ng-template>
</ng-container>
`
}] }
];
/** @nocollapse */
KreSurveyScore.ctorParameters = () => [
{ type: KreFormAntService }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class KreSurveyLine extends FieldType {
/**
* @param {?} dyService
*/
constructor(dyService) {
super();
this.guid = Guid.create()["value"];
this.service = dyService;
}
}
KreSurveyLine.decorators = [
{ type: Component, args: [{
selector: "kresurvey-line",
template: `
<ng-container *ngIf="formStatus !== 0">
<div class="question-wrap_content">
<div class="option_wrap basic_line" >
<div class="line"></div>
</div>
</div>
</ng-container>
<ng-container *ngIf="formStatus === 0">
<div class="line"></div>
</ng-container>
`
}] }
];
/** @nocollapse */
KreSurveyLine.ctorParameters = () => [
{ type: KreFormAntService }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class KreSurveyRemark extends FieldType {
/**
* @param {?} dyService
*/
constructor(dyService) {
super();
this.guid = Guid.create()["value"];
this.service = dyService;
}
}
KreSurveyRemark.decorators = [
{ type: Component, args: [{
selector: "kresurvey-remark",
template: `
<ng-container *ngIf="formStatus !== 0">
<div class="question-wrap_content">
<div class="option_wrap basic_remark" >
<inline-editor [(ngModel)]="to.label" [active]="active"></inline-editor>
</div>
</div>
</ng-container>
<ng-container *ngIf="formStatus === 0">
</ng-container>
`
}] }
];
/** @nocollapse */
KreSurveyRemark.ctorParameters = () => [
{ type: KreFormAntService }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class KreSurveyInput extends FieldType {
/**
* @param {?} dyService
*/
constructor(dyService) {
super();
this.guid = Guid.create()["value"];
this.service = dyService;
}
}
KreSurveyInput.decorators = [
{ type: Component, args: [{
selector: "kresurvey-input",
template: `
<ng-container *ngIf="formStatus !== 0">
<div class="question-wrap_title">
<div class="required">
<span *ngIf="to.required">*</span>
</div>
<inline-editor [(ngModel)]="to.label" [active]="active"></inline-editor>
</div>
<div class="question-wrap_content">
<div class="option_wrap basic_input" >
<ng-container *ngIf="to.setting.size=='small'">
<input nz-input placeholder="" [disabled]="true" />
</ng-container>
<ng-container *ngIf="to.setting.size=='default'">
<textarea rows="2" nz-input [disabled]="true" ></textarea>
</ng-container>
<ng-container *ngIf="to.setting.size=='large'">
<textarea rows="4" nz-input [disabled]="true" ></textarea>
</ng-container>
</div>
</div>
</ng-container>
<ng-container *ngIf="formStatus === 0">
<ng-container *ngIf="to.setting.size=='small'">
<input nz-input
[formControl]="formControl"
[kreFormAttributes]="field"
[class.is-invalid]="showError" />
</ng-container>
<ng-container *ngIf="to.setting.size=='default'">
<textarea rows="2" nz-input
[formControl]="formControl"
[kreFormAttributes]="field"
[class.is-invalid]="showError" ></textarea>
</ng-container>
<ng-container *ngIf="to.setting.size=='large'">
<textarea rows="4" nz-input
[formControl]="formControl"
[kreFormAttributes]="field"
[class.is-invalid]="showError"></textarea>
</ng-container>
</ng-container>
`
}] }
];
/** @nocollapse */
KreSurveyInput.ctorParameters = () => [
{ type: KreFormAntService }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class KreSurveyDate extends FieldType {
/**
* @param {?} dyService
*/
constructor(dyService) {
super();
this.guid = Guid.create()["value"];
this.service = dyService;
}
/**
* @return {?}
*/
get format() {
/** @type {?} */
let result = "yyyy-MM-dd";
if (this.to["format"] != undefined && this.to["format"] != null && this.to["format"] != "") {
result = this.to["format"];
}
return result;
}
}
KreSurveyDate.decorators = [
{ type: Component, args: [{
selector: "kresurvey-date",
template: `
<ng-container *ngIf="formStatus !== 0">
<div class="question-wrap_title">
<div class="required">
<span *ngIf="to.required">*</span>
</div>
<inline-editor [(ngModel)]="to.label"></inline-editor>
</div>
<div class="question-wrap_content">
<div class="option_wrap date" >
<nz-date-picker nzDisabled></nz-date-picker>
</div>
</div>
</ng-container>
<ng-container *ngIf="formStatus === 0">
<nz-date-picker
nzShowTime
[nzFormat]="format"
[formControl]="formControl"
[kreFormAttributes]="field"
[class.is-invalid]="showError"
></nz-date-picker>
</ng-container>
`
}] }
];
/** @nocollapse */
KreSurveyDate.ctorParameters = () => [
{ type: KreFormAntService }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class KreSurveyTime extends FieldType {
/**
* @param {?} dyService
*/
constructor(dyService) {
super();
this.guid = Guid.create()["value"];
this.service = dyService;
}
}
KreSurveyTime.decorators = [
{ type: Component, args: [{
selector: "kresurvey-time",
template: `
<ng-container *ngIf="formStatus !== 0">
<div class="question-wrap_title">
<div class="required">
<span *ngIf="to.required">*</span>
</div>
<inline-editor [(ngModel)]="to.label"></inline-editor>
</div>
<div class="question-wrap_content">
<div class="option_wrap time" >
<nz-time-picker nzFormat="HH:mm" [nzDisabled]="true"></nz-time-picker>
</div>
</div>
</ng-container>
<ng-container *ngIf="formStatus === 0">
<nz-time-picker nzFormat="HH:mm"
[formControl]="formControl"
[kreFormAttributes]="field"
[class.is-invalid]="showError">
</nz-time-picker>
</ng-container>
`
}] }
];
/** @nocollapse */
KreSurveyTime.ctorParameters = () => [
{ type: KreFormAntService }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class KreSurveyNPS extends FieldType {
/**
* @param {?} dyService
*/
constructor(dyService) {
super();
this.guid = Guid.create()["value"];
this.service = dyService;
}
//添加选项
/**
* @return {?}
*/
addOption() {
this.service.optionOperational("add", "", this.field);
}
//批量添加
/**
* @return {?}
*/
addOptions() {
this.service.optionOperational("adds", "", this.field);
}
//删除选项
/**
* @param {?} option
* @return {?}
*/
deleteOption(option) {
this.service.optionOperational("delete", option, this.field);
}
}
KreSurveyNPS.decorators = [
{ type: Component, args: [{
selector: "kresurvey-nps",
template: `
<ng-container *ngIf="formStatus !== 0">
<div class="question-wrap_title">
<div class="required">
<span *ngIf="to.requ