@kre-form/survey
Version:
1,098 lines (1,086 loc) • 378 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/http'), require('@ngx-translate/core'), require('@angular/cdk/overlay'), require('ng-zorro-antd'), require('@ant-design/icons-angular/icons'), require('@angular/common/locales/zh'), require('ng-zorro-antd/modal'), require('ng-zorro-antd/message'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('@kre-form/core'), require('lodash'), require('@angular/cdk/drag-drop'), require('@angular/forms'), require('@angular/core'), require('@angular/platform-browser')) :
typeof define === 'function' && define.amd ? define('@kre-form/survey', ['exports', '@angular/common', '@angular/http', '@ngx-translate/core', '@angular/cdk/overlay', 'ng-zorro-antd', '@ant-design/icons-angular/icons', '@angular/common/locales/zh', 'ng-zorro-antd/modal', 'ng-zorro-antd/message', '@angular/common/http', 'rxjs', 'rxjs/operators', '@kre-form/core', 'lodash', '@angular/cdk/drag-drop', '@angular/forms', '@angular/core', '@angular/platform-browser'], factory) :
(factory((global['kre-form'] = global['kre-form'] || {}, global['kre-form'].survey = {}),global.ng.common,global.ng.http,global.core,global.ng.cdk.overlay,global.ngZorroAntd,global.icons,global.ng.common.locales.zh,global.i1,global.message,global.ng.common.http,global.rxjs,global.rxjs.operators,global.core$1,global._,global.ng.cdk['drag-drop'],global.ng.forms,global.ng.core,global.ng.platformBrowser));
}(this, (function (exports,common,http,core,overlay,ngZorroAntd,icons,zh,i1,message,i1$1,rxjs,operators,core$1,_,dragDrop,forms,i0,platformBrowser) { 'use strict';
zh = zh && zh.hasOwnProperty('default') ? zh['default'] : zh;
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b)
if (b.hasOwnProperty(p))
d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m)
return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
ar.push(r.value);
}
catch (error) {
e = { error: error };
}
finally {
try {
if (r && !r.done && (m = i["return"]))
m.call(i);
}
finally {
if (e)
throw e.error;
}
}
return ar;
}
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var KreFormAntService = /** @class */ (function () {
function KreFormAntService() {
this.btnEvent = new i0.EventEmitter();
this.fieldEvent = new i0.EventEmitter();
this.questionEvent = new i0.EventEmitter();
this.optionEvent = new i0.EventEmitter();
this.dragDropEvent = new i0.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: i0.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 = core$1.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: i0.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;
}(core$1.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) {
dragDrop.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: i0.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;
}(core$1.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 = core$1.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) {
dragDrop.moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
}
};
KreSurveyRadio.decorators = [
{ type: i0.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;
}(core$1.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 = core$1.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) {
dragDrop.moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
}
};
KreSurveyCheckBox.decorators = [
{ type: i0.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;
}(core$1.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 = core$1.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) {
dragDrop.moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
}
};
KreSurveyDropdown.decorators = [
{ type: i0.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;
}(core$1.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: i0.Injectable, args: [{
providedIn: "root"
},] }
];
/** @nocollapse */
KreDialogService.ctorParameters = function () {
return [
{ type: ngZorroAntd.NzModalService }
];
};
/** @nocollapse */ KreDialogService.ngInjectableDef = i0.ɵɵdefineInjectable({ factory: function KreDialogService_Factory() { return new KreDialogService(i0.ɵɵinject(i1.NzModalService)); }, 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: i0.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 []; }