@wg-npm/survey-response 0.3.13 → 0.3.377-8.develop
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/survey-response.esm.js +118 -54
- package/package.json +5 -5
- package/src/components/question/type/evaluation.vue +48 -16
- package/src/components/question/type/matrix.vue +48 -20
- package/src/components/question/type/multi-selection.vue +84 -62
- package/src/components/question/type/single-selection.vue +113 -92
- package/src/components/survey-response.vue +172 -139
- package/src/ellipsis-tooltip.ts +160 -0
- package/src/mixins/option-layout-mixin.ts +22 -15
|
@@ -177,6 +177,8 @@ var __vue_staticRenderFns__$e = [];
|
|
|
177
177
|
undefined
|
|
178
178
|
);
|
|
179
179
|
|
|
180
|
+
var EmptyQuestion = __vue_component__$e;
|
|
181
|
+
|
|
180
182
|
var script$d = Vue.extend({
|
|
181
183
|
name: "question-title",
|
|
182
184
|
components: { Icon },
|
|
@@ -240,25 +242,30 @@ var __vue_staticRenderFns__$d = [];
|
|
|
240
242
|
undefined
|
|
241
243
|
);
|
|
242
244
|
|
|
245
|
+
var QuestionTitle = __vue_component__$d;
|
|
246
|
+
|
|
243
247
|
var OptionLayoutMixin = Vue.extend({
|
|
244
248
|
methods: {
|
|
245
249
|
isMobile() {
|
|
246
|
-
|
|
250
|
+
const flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
|
|
247
251
|
return flag;
|
|
248
252
|
}
|
|
249
253
|
},
|
|
250
254
|
computed: {
|
|
251
255
|
optionLayout() {
|
|
252
|
-
|
|
256
|
+
const globalLayout = _.lowerCase(_.get(this.options, "layout", undefined));
|
|
257
|
+
if (this.isMobile || "vertical" == globalLayout) {
|
|
253
258
|
return "";
|
|
254
259
|
}
|
|
255
|
-
|
|
260
|
+
const questionLayout = _.lowerCase(_.get(this.question.options, "layout", "horizontal"));
|
|
261
|
+
return `question-choice-${questionLayout}`;
|
|
256
262
|
}
|
|
257
263
|
}
|
|
258
264
|
});
|
|
259
265
|
|
|
260
266
|
var script$c = Vue.extend({
|
|
261
|
-
name:
|
|
267
|
+
name: "multi-selection",
|
|
268
|
+
inject: ["$rootComponent"],
|
|
262
269
|
mixins: [OptionLayoutMixin],
|
|
263
270
|
components: {
|
|
264
271
|
FormItem,
|
|
@@ -295,7 +302,8 @@ var script$c = Vue.extend({
|
|
|
295
302
|
});
|
|
296
303
|
this.answer.score = score;
|
|
297
304
|
if (this.question.options.starEnabled) {
|
|
298
|
-
this.answer.star =
|
|
305
|
+
this.answer.star =
|
|
306
|
+
minStarCount >= this.question.options.starMinCount ? 1 : 0;
|
|
299
307
|
}
|
|
300
308
|
}
|
|
301
309
|
}
|
|
@@ -305,7 +313,12 @@ var script$c = Vue.extend({
|
|
|
305
313
|
const __vue_script__$c = script$c;
|
|
306
314
|
|
|
307
315
|
/* template */
|
|
308
|
-
var __vue_render__$c = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('FormItem',{attrs:{"prop":("answers[" + _vm.index + "].answer"),"rules":{
|
|
316
|
+
var __vue_render__$c = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('FormItem',{attrs:{"prop":("answers[" + _vm.index + "].answer"),"rules":{
|
|
317
|
+
required: _vm.question.options.required,
|
|
318
|
+
type: 'array',
|
|
319
|
+
min: 1,
|
|
320
|
+
message: _vm.t('survey_response.question.question_required')
|
|
321
|
+
}}},[_c('CheckboxGroup',{on:{"on-change":_vm.selChange},model:{value:(_vm.value.answer),callback:function ($$v) {_vm.$set(_vm.value, "answer", $$v);},expression:"value.answer"}},[_c('Row',{attrs:{"type":"flex","justify":"start","gutter":60}},_vm._l((_vm.question.choices),function(choice){return _c('Col',{key:choice.id,class:_vm.optionLayout,attrs:{"xs":24,"sm":_vm.$rootComponent.layout === 'vertical' ? 24 : 6,"xl":_vm.$rootComponent.layout === 'vertical' ? 24 : 6,"md":_vm.$rootComponent.layout === 'vertical' ? 24 : 6,"lg":_vm.$rootComponent.layout === 'vertical' ? 24 : 6}},[_c('Checkbox',{key:choice.id,attrs:{"label":choice.id,"disabled":_vm.question.options.readonly}},[_c('span',[_vm._v(_vm._s(_vm.i18nText(choice.text)))])])],1)}),1)],1)],1)};
|
|
309
322
|
var __vue_staticRenderFns__$c = [];
|
|
310
323
|
|
|
311
324
|
/* style */
|
|
@@ -337,6 +350,8 @@ var __vue_staticRenderFns__$c = [];
|
|
|
337
350
|
undefined
|
|
338
351
|
);
|
|
339
352
|
|
|
353
|
+
var MultiSelection = __vue_component__$c;
|
|
354
|
+
|
|
340
355
|
var script$b = Vue.extend({
|
|
341
356
|
name: "short-answer",
|
|
342
357
|
components: {
|
|
@@ -409,8 +424,10 @@ var __vue_staticRenderFns__$b = [];
|
|
|
409
424
|
undefined
|
|
410
425
|
);
|
|
411
426
|
|
|
427
|
+
var ShortAnswer = __vue_component__$b;
|
|
428
|
+
|
|
412
429
|
var script$a = Vue.extend({
|
|
413
|
-
name:
|
|
430
|
+
name: "single-selection",
|
|
414
431
|
components: {
|
|
415
432
|
FormItem,
|
|
416
433
|
RadioGroup,
|
|
@@ -420,7 +437,7 @@ var script$a = Vue.extend({
|
|
|
420
437
|
Icon
|
|
421
438
|
},
|
|
422
439
|
mixins: [OptionLayoutMixin],
|
|
423
|
-
inject: ["responseStatus"],
|
|
440
|
+
inject: ["responseStatus", "$rootComponent"],
|
|
424
441
|
props: {
|
|
425
442
|
question: {
|
|
426
443
|
type: Object,
|
|
@@ -481,7 +498,10 @@ var script$a = Vue.extend({
|
|
|
481
498
|
const __vue_script__$a = script$a;
|
|
482
499
|
|
|
483
500
|
/* template */
|
|
484
|
-
var __vue_render__$a = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('FormItem',{attrs:{"prop":("answers[" + _vm.index + "].answer"),"rules":{
|
|
501
|
+
var __vue_render__$a = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('FormItem',{attrs:{"prop":("answers[" + _vm.index + "].answer"),"rules":{
|
|
502
|
+
required: _vm.question.options.required,
|
|
503
|
+
message: _vm.t('survey_response.question.question_required')
|
|
504
|
+
}}},[_c('RadioGroup',{staticClass:"question-choice",on:{"on-change":_vm.selChange},model:{value:(_vm.value.answer),callback:function ($$v) {_vm.$set(_vm.value, "answer", $$v);},expression:"value.answer"}},[_c('Row',{attrs:{"type":"flex","justify":"start","gutter":60}},_vm._l((_vm.question.choices),function(choice){return _c('Col',{key:choice.id,class:_vm.optionLayout,attrs:{"xs":24,"sm":_vm.$rootComponent.layout === 'vertical' ? 24 : 6,"xl":_vm.$rootComponent.layout === 'vertical' ? 24 : 6,"md":_vm.$rootComponent.layout === 'vertical' ? 24 : 6,"lg":_vm.$rootComponent.layout === 'vertical' ? 24 : 6}},[_c('Radio',{key:choice.id,attrs:{"disabled":_vm.question.options.readonly,"label":choice.id},nativeOn:{"click":function($event){return _vm.toggleAnswer(choice.id)}}},[(_vm.haveStar(choice))?_c('span',[_c('Icon',{attrs:{"type":"md-star","color":"orange","size":16}})],1):_vm._e(),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.i18nText(choice.text)))])])],1)}),1)],1)],1)};
|
|
485
505
|
var __vue_staticRenderFns__$a = [];
|
|
486
506
|
|
|
487
507
|
/* style */
|
|
@@ -513,10 +533,12 @@ var __vue_staticRenderFns__$a = [];
|
|
|
513
533
|
undefined
|
|
514
534
|
);
|
|
515
535
|
|
|
536
|
+
var SingleSelection = __vue_component__$a;
|
|
537
|
+
|
|
516
538
|
var script$9 = Vue.extend({
|
|
517
|
-
name:
|
|
539
|
+
name: "matrix",
|
|
518
540
|
mixins: [OptionLayoutMixin],
|
|
519
|
-
inject: ["responseStatus"],
|
|
541
|
+
inject: ["responseStatus", "$rootComponent"],
|
|
520
542
|
components: {
|
|
521
543
|
FormItem,
|
|
522
544
|
RadioGroup,
|
|
@@ -543,7 +565,7 @@ var script$9 = Vue.extend({
|
|
|
543
565
|
_.each(this.value.answer, data => {
|
|
544
566
|
_.set(subAnswers, data.questionId, data);
|
|
545
567
|
});
|
|
546
|
-
_.set(this.value,
|
|
568
|
+
_.set(this.value, "answer", []);
|
|
547
569
|
_.each(this.question.subQuestions, question => {
|
|
548
570
|
let _answer = _.get(subAnswers, question.id);
|
|
549
571
|
_answer = _answer
|
|
@@ -552,7 +574,7 @@ var script$9 = Vue.extend({
|
|
|
552
574
|
answer: null,
|
|
553
575
|
question_id: question.id,
|
|
554
576
|
score: 0,
|
|
555
|
-
question_type:
|
|
577
|
+
question_type: "SINGLE_SELECTION"
|
|
556
578
|
};
|
|
557
579
|
this.value.answer.push(_answer);
|
|
558
580
|
});
|
|
@@ -573,7 +595,9 @@ var script$9 = Vue.extend({
|
|
|
573
595
|
toggleAnswer(subValue, subIndex) {
|
|
574
596
|
if (this.responseStatus == this.$consts.STATUS_DRAFT) {
|
|
575
597
|
let subAnswer = this.value.answer[subIndex].answer;
|
|
576
|
-
this.value.answer[subIndex].answer = _.isEmpty(subAnswer)
|
|
598
|
+
this.value.answer[subIndex].answer = _.isEmpty(subAnswer)
|
|
599
|
+
? subValue
|
|
600
|
+
: subAnswer;
|
|
577
601
|
}
|
|
578
602
|
}
|
|
579
603
|
}
|
|
@@ -583,7 +607,10 @@ var script$9 = Vue.extend({
|
|
|
583
607
|
const __vue_script__$9 = script$9;
|
|
584
608
|
|
|
585
609
|
/* template */
|
|
586
|
-
var __vue_render__$9 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',_vm._l((_vm.question.subQuestions),function(subQuestion,subIndex){return _c('div',{key:subIndex,staticClass:"sub-question"},[_c('span',{staticClass:"number"},[_vm._v("
|
|
610
|
+
var __vue_render__$9 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',_vm._l((_vm.question.subQuestions),function(subQuestion,subIndex){return _c('div',{key:subIndex,staticClass:"sub-question"},[_c('span',{staticClass:"number"},[_vm._v("\n "+_vm._s(_vm.question.header.number)+"-"+_vm._s(subQuestion.number)+".")]),_vm._v(" "),_c('span',{staticClass:"title"},[_vm._v(" "+_vm._s(_vm.i18nText(subQuestion.text))+" ")]),_vm._v(" "),_c('FormItem',{attrs:{"prop":("answers[" + _vm.index + "].answer[" + subIndex + "].answer"),"rules":{
|
|
611
|
+
required: _vm.question.options.required,
|
|
612
|
+
message: _vm.t('survey_response.question.question_required')
|
|
613
|
+
}}},[_c('RadioGroup',{on:{"on-change":_vm.selChange},model:{value:(_vm.value.answer[subIndex].answer),callback:function ($$v) {_vm.$set(_vm.value.answer[subIndex], "answer", $$v);},expression:"value.answer[subIndex].answer"}},[_c('Row',{attrs:{"type":"flex","justify":"start","gutter":60}},_vm._l((_vm.question.choices),function(choice){return _c('Col',{key:choice.id,class:_vm.optionLayout,attrs:{"xs":24,"sm":_vm.$rootComponent.layout === 'vertical' ? 24 : 6,"xl":_vm.$rootComponent.layout === 'vertical' ? 24 : 6,"md":_vm.$rootComponent.layout === 'vertical' ? 24 : 6,"lg":_vm.$rootComponent.layout === 'vertical' ? 24 : 6}},[_c('Radio',{key:choice.id,attrs:{"label":choice.id,"disabled":subQuestion.options.readonly},nativeOn:{"click":function($event){return _vm.toggleAnswer(choice.id, subIndex)}}},[_c('span',[_vm._v(_vm._s(_vm.i18nText(choice.text)))])])],1)}),1)],1)],1)],1)}),0)};
|
|
587
614
|
var __vue_staticRenderFns__$9 = [];
|
|
588
615
|
|
|
589
616
|
/* style */
|
|
@@ -615,6 +642,8 @@ var __vue_staticRenderFns__$9 = [];
|
|
|
615
642
|
undefined
|
|
616
643
|
);
|
|
617
644
|
|
|
645
|
+
var Matrix = __vue_component__$9;
|
|
646
|
+
|
|
618
647
|
var script$8 = Vue.extend({});
|
|
619
648
|
|
|
620
649
|
/* script */
|
|
@@ -653,6 +682,8 @@ var __vue_staticRenderFns__$8 = [];
|
|
|
653
682
|
undefined
|
|
654
683
|
);
|
|
655
684
|
|
|
685
|
+
var TextTitle = __vue_component__$8;
|
|
686
|
+
|
|
656
687
|
var script$7 = Vue.extend({
|
|
657
688
|
name: "fill-blank",
|
|
658
689
|
components: {
|
|
@@ -725,6 +756,8 @@ var __vue_staticRenderFns__$7 = [];
|
|
|
725
756
|
undefined
|
|
726
757
|
);
|
|
727
758
|
|
|
759
|
+
var FillBlank = __vue_component__$7;
|
|
760
|
+
|
|
728
761
|
var defaultLang = {
|
|
729
762
|
survey_response: {
|
|
730
763
|
locale: 'zh-CN',
|
|
@@ -860,6 +893,8 @@ var __vue_staticRenderFns__$6 = [];
|
|
|
860
893
|
undefined
|
|
861
894
|
);
|
|
862
895
|
|
|
896
|
+
var Star = __vue_component__$6;
|
|
897
|
+
|
|
863
898
|
class ExprEvaluationQuestion {
|
|
864
899
|
questions;
|
|
865
900
|
scope;
|
|
@@ -1074,6 +1109,8 @@ var __vue_staticRenderFns__$5 = [];
|
|
|
1074
1109
|
undefined
|
|
1075
1110
|
);
|
|
1076
1111
|
|
|
1112
|
+
var If = __vue_component__$5;
|
|
1113
|
+
|
|
1077
1114
|
var script$4 = Vue.extend({
|
|
1078
1115
|
name: "expr-else",
|
|
1079
1116
|
mixins: [LocaleMixin],
|
|
@@ -1120,6 +1157,8 @@ var __vue_staticRenderFns__$4 = [];
|
|
|
1120
1157
|
undefined
|
|
1121
1158
|
);
|
|
1122
1159
|
|
|
1160
|
+
var Else = __vue_component__$4;
|
|
1161
|
+
|
|
1123
1162
|
var script$3 = Vue.extend({
|
|
1124
1163
|
name: "expr",
|
|
1125
1164
|
props: {
|
|
@@ -1129,8 +1168,8 @@ var script$3 = Vue.extend({
|
|
|
1129
1168
|
}
|
|
1130
1169
|
},
|
|
1131
1170
|
components: {
|
|
1132
|
-
IF:
|
|
1133
|
-
ELSE:
|
|
1171
|
+
IF: If,
|
|
1172
|
+
ELSE: Else
|
|
1134
1173
|
}
|
|
1135
1174
|
});
|
|
1136
1175
|
|
|
@@ -1170,51 +1209,63 @@ var __vue_staticRenderFns__$3 = [];
|
|
|
1170
1209
|
undefined
|
|
1171
1210
|
);
|
|
1172
1211
|
|
|
1212
|
+
var Expr = __vue_component__$3;
|
|
1213
|
+
|
|
1173
1214
|
var script$2 = Vue.extend({
|
|
1174
1215
|
name: "Evaluation",
|
|
1175
1216
|
components: {
|
|
1176
|
-
Row,
|
|
1177
|
-
|
|
1178
|
-
|
|
1217
|
+
Row,
|
|
1218
|
+
Col,
|
|
1219
|
+
Card,
|
|
1220
|
+
Icon,
|
|
1221
|
+
STAR: Star,
|
|
1222
|
+
EXPR: Expr,
|
|
1179
1223
|
},
|
|
1180
1224
|
mixins: [LocaleMixin],
|
|
1225
|
+
inject: ["$rootComponent"],
|
|
1181
1226
|
props: {
|
|
1182
1227
|
question: {
|
|
1183
1228
|
type: Object,
|
|
1184
|
-
required: true
|
|
1229
|
+
required: true,
|
|
1185
1230
|
},
|
|
1186
1231
|
answer: {
|
|
1187
1232
|
type: Object,
|
|
1188
|
-
required: true
|
|
1189
|
-
}
|
|
1233
|
+
required: true,
|
|
1234
|
+
},
|
|
1190
1235
|
},
|
|
1191
1236
|
methods: {
|
|
1192
1237
|
iconType(id) {
|
|
1193
|
-
return this.answer.answer == id
|
|
1238
|
+
return this.answer.answer == id
|
|
1239
|
+
? "ios-checkmark-circle"
|
|
1240
|
+
: "ios-checkmark-circle-outline";
|
|
1194
1241
|
},
|
|
1195
1242
|
cardClasses(id) {
|
|
1196
|
-
return this.answer.answer == id
|
|
1197
|
-
|
|
1198
|
-
|
|
1243
|
+
return this.answer.answer == id
|
|
1244
|
+
? "evaluation-cards evaluation-cards-current"
|
|
1245
|
+
: "evaluation-cards";
|
|
1246
|
+
},
|
|
1247
|
+
},
|
|
1199
1248
|
});
|
|
1200
1249
|
|
|
1201
1250
|
/* script */
|
|
1202
1251
|
const __vue_script__$2 = script$2;
|
|
1203
1252
|
|
|
1204
1253
|
/* template */
|
|
1205
|
-
var __vue_render__$2 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[(_vm.question.evaluationItems.length > 0)?_c('Row',{attrs:{"type":"flex","justify":"start","gutter":24}},_vm._l((_vm.question.evaluationItems),function(item){return _c('Col',{key:item.id,staticClass:"evaluation-item",attrs:{"xs":24,"sm":
|
|
1254
|
+
var __vue_render__$2 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[(_vm.question.evaluationItems.length > 0)?_c('Row',{attrs:{"type":"flex","justify":"start","gutter":24}},_vm._l((_vm.question.evaluationItems),function(item){return _c('Col',{key:item.id,staticClass:"evaluation-item",attrs:{"xs":24,"sm":_vm.$rootComponent.layout === 'vertical' ? 24 : 6,"xl":_vm.$rootComponent.layout === 'vertical' ? 24 : 6,"md":_vm.$rootComponent.layout === 'vertical' ? 24 : 6,"lg":_vm.$rootComponent.layout === 'vertical' ? 24 : 6}},[_c('Card',{class:_vm.cardClasses(item.id),attrs:{"dis-hover":""}},[_c('div',{staticClass:"card-title",attrs:{"slot":"title"},slot:"title"},[_c('Icon',{staticClass:"icon",attrs:{"type":_vm.iconType(item.id),"size":36}})],1),_vm._v(" "),_c('div',{staticClass:"card-content"},[_c('div',{staticClass:"card-text"},[_c('p',{directives:[{name:"ellipsis-tip",rawName:"v-ellipsis-tip"}],staticClass:"text"},[_vm._v(_vm._s(_vm.i18nText(item.text)))])]),_vm._v(" "),_c(_vm.question.options.evaluationType,{tag:"component",attrs:{"item":item}})],1)])],1)}),1):_vm._e()],1)};
|
|
1206
1255
|
var __vue_staticRenderFns__$2 = [];
|
|
1207
1256
|
|
|
1208
1257
|
/* style */
|
|
1209
|
-
const __vue_inject_styles__$2 =
|
|
1258
|
+
const __vue_inject_styles__$2 = function (inject) {
|
|
1259
|
+
if (!inject) return
|
|
1260
|
+
inject("data-v-71844af4_0", { source: ".card-text[data-v-71844af4]{width:100%}", map: undefined, media: undefined });
|
|
1261
|
+
|
|
1262
|
+
};
|
|
1210
1263
|
/* scoped */
|
|
1211
|
-
const __vue_scope_id__$2 =
|
|
1264
|
+
const __vue_scope_id__$2 = "data-v-71844af4";
|
|
1212
1265
|
/* module identifier */
|
|
1213
1266
|
const __vue_module_identifier__$2 = undefined;
|
|
1214
1267
|
/* functional template */
|
|
1215
1268
|
const __vue_is_functional_template__$2 = false;
|
|
1216
|
-
/* style inject */
|
|
1217
|
-
|
|
1218
1269
|
/* style inject SSR */
|
|
1219
1270
|
|
|
1220
1271
|
/* style inject shadow dom */
|
|
@@ -1229,20 +1280,22 @@ var __vue_staticRenderFns__$2 = [];
|
|
|
1229
1280
|
__vue_is_functional_template__$2,
|
|
1230
1281
|
__vue_module_identifier__$2,
|
|
1231
1282
|
false,
|
|
1232
|
-
|
|
1283
|
+
createInjector,
|
|
1233
1284
|
undefined,
|
|
1234
1285
|
undefined
|
|
1235
1286
|
);
|
|
1236
1287
|
|
|
1288
|
+
var Evaluation = __vue_component__$2;
|
|
1289
|
+
|
|
1237
1290
|
var script$1 = Vue.extend({
|
|
1238
1291
|
components: {
|
|
1239
|
-
MULTI_SELECTION:
|
|
1240
|
-
SHORT_ANSWER:
|
|
1241
|
-
FILL_BLANK:
|
|
1242
|
-
TEXT_TITLE:
|
|
1243
|
-
SINGLE_SELECTION:
|
|
1244
|
-
MATRIX:
|
|
1245
|
-
EVALUATION:
|
|
1292
|
+
MULTI_SELECTION: MultiSelection,
|
|
1293
|
+
SHORT_ANSWER: ShortAnswer,
|
|
1294
|
+
FILL_BLANK: FillBlank,
|
|
1295
|
+
TEXT_TITLE: TextTitle,
|
|
1296
|
+
SINGLE_SELECTION: SingleSelection,
|
|
1297
|
+
MATRIX: Matrix,
|
|
1298
|
+
EVALUATION: Evaluation
|
|
1246
1299
|
},
|
|
1247
1300
|
name: "question-body",
|
|
1248
1301
|
props: {
|
|
@@ -1300,17 +1353,21 @@ var __vue_staticRenderFns__$1 = [];
|
|
|
1300
1353
|
undefined
|
|
1301
1354
|
);
|
|
1302
1355
|
|
|
1356
|
+
var QuestionBody = __vue_component__$1;
|
|
1357
|
+
|
|
1303
1358
|
var script = Vue.extend({
|
|
1304
|
-
name:
|
|
1359
|
+
name: "SurveyResponse",
|
|
1305
1360
|
components: {
|
|
1306
|
-
QuestionTitle
|
|
1307
|
-
QuestionBody
|
|
1308
|
-
EmptyQuestion
|
|
1361
|
+
QuestionTitle,
|
|
1362
|
+
QuestionBody,
|
|
1363
|
+
EmptyQuestion,
|
|
1309
1364
|
Form
|
|
1310
1365
|
},
|
|
1311
1366
|
provide() {
|
|
1312
1367
|
return {
|
|
1313
|
-
responseStar: this.response.status != this.$consts.STATUS_DRAFT
|
|
1368
|
+
responseStar: this.response.status != this.$consts.STATUS_DRAFT
|
|
1369
|
+
? this.response.star
|
|
1370
|
+
: null,
|
|
1314
1371
|
survey: this.survey,
|
|
1315
1372
|
responseStatus: this.response.status,
|
|
1316
1373
|
$rootComponent: this
|
|
@@ -1330,7 +1387,7 @@ var script = Vue.extend({
|
|
|
1330
1387
|
},
|
|
1331
1388
|
size: {
|
|
1332
1389
|
type: String,
|
|
1333
|
-
default:
|
|
1390
|
+
default: "default"
|
|
1334
1391
|
}
|
|
1335
1392
|
},
|
|
1336
1393
|
data() {
|
|
@@ -1347,6 +1404,10 @@ var script = Vue.extend({
|
|
|
1347
1404
|
},
|
|
1348
1405
|
readonly() {
|
|
1349
1406
|
return this.response.status != this.$consts.STATUS_DRAFT;
|
|
1407
|
+
},
|
|
1408
|
+
layout() {
|
|
1409
|
+
const globalLayout = _.lowerCase(_.get(this.options, "layout", undefined));
|
|
1410
|
+
return globalLayout || "horizontal";
|
|
1350
1411
|
}
|
|
1351
1412
|
},
|
|
1352
1413
|
methods: {
|
|
@@ -1361,12 +1422,14 @@ var script = Vue.extend({
|
|
|
1361
1422
|
question.type == "FILL_BLANK" ||
|
|
1362
1423
|
question.type == "SHORT_ANSWER" ||
|
|
1363
1424
|
question.type == "MULTI_SELECTION") {
|
|
1364
|
-
_.set(question.options,
|
|
1425
|
+
_.set(question.options, "readonly", this.haveAnswered(backgroundAnswer));
|
|
1365
1426
|
}
|
|
1366
1427
|
if (question.type == "MATRIX") {
|
|
1367
1428
|
_.forEach(question.subQuestions, (subQuestion, subIndex) => {
|
|
1368
1429
|
let backgroundSubAnswer = _.get(backgroundAnswer, `answer[${subIndex}]`, null);
|
|
1369
|
-
_.set(subQuestion, "options", {
|
|
1430
|
+
_.set(subQuestion, "options", {
|
|
1431
|
+
readonly: this.haveAnswered(backgroundSubAnswer)
|
|
1432
|
+
});
|
|
1370
1433
|
});
|
|
1371
1434
|
}
|
|
1372
1435
|
},
|
|
@@ -1377,13 +1440,13 @@ var script = Vue.extend({
|
|
|
1377
1440
|
_.each(this.response.answers, data => {
|
|
1378
1441
|
_.set(this.answers, data.questionId, data);
|
|
1379
1442
|
});
|
|
1380
|
-
_.set(this.response,
|
|
1443
|
+
_.set(this.response, "answers", []);
|
|
1381
1444
|
_.each(this.survey.questions, question => {
|
|
1382
1445
|
let answer = _.get(this.answers, question.id);
|
|
1383
1446
|
answer = answer
|
|
1384
1447
|
? answer
|
|
1385
1448
|
: {
|
|
1386
|
-
answer: question.type ==
|
|
1449
|
+
answer: question.type == "MULTI_SELECTION" ? [] : null,
|
|
1387
1450
|
question_id: question.id,
|
|
1388
1451
|
question_type: question.type,
|
|
1389
1452
|
score: null,
|
|
@@ -1400,7 +1463,7 @@ var script = Vue.extend({
|
|
|
1400
1463
|
return result;
|
|
1401
1464
|
},
|
|
1402
1465
|
getMaxScore(question) {
|
|
1403
|
-
if (question.type ===
|
|
1466
|
+
if (question.type === "single_selection") {
|
|
1404
1467
|
var score = _.maxBy(question.choices, answer_option => answer_option.options.score || 0).options.score;
|
|
1405
1468
|
if (!score) {
|
|
1406
1469
|
return 0;
|
|
@@ -1450,6 +1513,8 @@ var __vue_staticRenderFns__ = [];
|
|
|
1450
1513
|
undefined
|
|
1451
1514
|
);
|
|
1452
1515
|
|
|
1516
|
+
var SurveyResponse = __vue_component__;
|
|
1517
|
+
|
|
1453
1518
|
class Constants {
|
|
1454
1519
|
constructor() {
|
|
1455
1520
|
this.STATUS_ENABLED = "ENABLED";
|
|
@@ -1467,9 +1532,8 @@ class SurveyResponsePlugin {
|
|
|
1467
1532
|
locale.use(options.locale);
|
|
1468
1533
|
locale.i18n(options.i18n);
|
|
1469
1534
|
Vue.mixin(LocaleMixin);
|
|
1470
|
-
vue.component("survey-response",
|
|
1535
|
+
vue.component("survey-response", SurveyResponse);
|
|
1471
1536
|
}
|
|
1472
1537
|
}
|
|
1473
1538
|
|
|
1474
|
-
export default
|
|
1475
|
-
export { __vue_component__ as SurveyResponse, SurveyResponseOptions, locale };
|
|
1539
|
+
export { SurveyResponse, SurveyResponseOptions, SurveyResponsePlugin as default, locale };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wg-npm/survey-response",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3778.develop",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"lint-fix": "eslint \"**/*.ts\" \"**/*.vue\" --fix --no-error-on-unmatched-pattern"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@wg-npm/survey-core": "0.3.
|
|
16
|
-
"@wg-npm/survey-service-api": "0.3.
|
|
15
|
+
"@wg-npm/survey-core": "0.3.3778.develop",
|
|
16
|
+
"@wg-npm/survey-service-api": "0.3.3778.develop",
|
|
17
17
|
"axios": "^0.19.2",
|
|
18
18
|
"deepmerge": "^4.2.2",
|
|
19
19
|
"lodash": "^4.17.15",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"@typescript-eslint/parser": "^3.6.0",
|
|
35
35
|
"@vue/eslint-config-prettier": "^6.0.0",
|
|
36
36
|
"@vue/eslint-config-typescript": "^5.0.2",
|
|
37
|
-
"@wg-npm/survey-core": "0.3.
|
|
38
|
-
"@wg-npm/survey-service-api": "0.3.
|
|
37
|
+
"@wg-npm/survey-core": "0.3.3778.develop",
|
|
38
|
+
"@wg-npm/survey-service-api": "0.3.3778.develop",
|
|
39
39
|
"acorn": "^7.3.1",
|
|
40
40
|
"axios": "^0.19.2",
|
|
41
41
|
"babelrc-rollup": "^3.0.0",
|
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<Row
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
<Row
|
|
4
|
+
type="flex"
|
|
5
|
+
justify="start"
|
|
6
|
+
:gutter="24"
|
|
7
|
+
v-if="question.evaluationItems.length > 0"
|
|
8
|
+
>
|
|
9
|
+
<Col
|
|
10
|
+
:xs="24"
|
|
11
|
+
:sm="$rootComponent.layout === 'vertical' ? 24 : 6"
|
|
12
|
+
:xl="$rootComponent.layout === 'vertical' ? 24 : 6"
|
|
13
|
+
:md="$rootComponent.layout === 'vertical' ? 24 : 6"
|
|
14
|
+
:lg="$rootComponent.layout === 'vertical' ? 24 : 6"
|
|
15
|
+
class="evaluation-item"
|
|
16
|
+
v-for="item in question.evaluationItems"
|
|
17
|
+
:key="item.id"
|
|
18
|
+
>
|
|
6
19
|
<Card :class="cardClasses(item.id)" dis-hover>
|
|
7
20
|
<div slot="title" class="card-title">
|
|
8
|
-
<Icon class="icon" :type="iconType(item.id)" :size="36"/>
|
|
21
|
+
<Icon class="icon" :type="iconType(item.id)" :size="36" />
|
|
9
22
|
</div>
|
|
10
23
|
<div class="card-content">
|
|
11
|
-
<
|
|
12
|
-
|
|
24
|
+
<div class="card-text">
|
|
25
|
+
<p class="text" v-ellipsis-tip>{{ i18nText(item.text) }}</p>
|
|
26
|
+
</div>
|
|
27
|
+
<component
|
|
28
|
+
:is="question.options.evaluationType"
|
|
29
|
+
:item="item"
|
|
30
|
+
></component>
|
|
13
31
|
</div>
|
|
14
32
|
</Card>
|
|
15
33
|
</Col>
|
|
@@ -19,37 +37,51 @@
|
|
|
19
37
|
|
|
20
38
|
<script lang="ts">
|
|
21
39
|
import Vue from "vue";
|
|
22
|
-
import {Col, Row, Card, Icon} from "view-design";
|
|
40
|
+
import { Col, Row, Card, Icon } from "view-design";
|
|
23
41
|
import LocaleMixin from "../../../mixins/locale-mixin";
|
|
24
|
-
import {QuestionEvaluationModel} from "@wg-npm/survey-core";
|
|
42
|
+
import { QuestionEvaluationModel } from "@wg-npm/survey-core";
|
|
25
43
|
import Star from "./evaluation/star.vue";
|
|
26
44
|
import Expr from "./evaluation/expr.vue";
|
|
27
45
|
|
|
28
46
|
export default Vue.extend({
|
|
29
47
|
name: "Evaluation",
|
|
30
48
|
components: {
|
|
31
|
-
Row,
|
|
49
|
+
Row,
|
|
50
|
+
Col,
|
|
51
|
+
Card,
|
|
52
|
+
Icon,
|
|
32
53
|
STAR: Star,
|
|
33
54
|
EXPR: Expr,
|
|
34
55
|
},
|
|
35
56
|
mixins: [LocaleMixin],
|
|
57
|
+
inject: ["$rootComponent"],
|
|
36
58
|
props: {
|
|
37
59
|
question: {
|
|
38
60
|
type: Object as () => QuestionEvaluationModel,
|
|
39
|
-
required: true
|
|
61
|
+
required: true,
|
|
40
62
|
},
|
|
41
63
|
answer: {
|
|
42
64
|
type: Object,
|
|
43
|
-
required: true
|
|
44
|
-
}
|
|
65
|
+
required: true,
|
|
66
|
+
},
|
|
45
67
|
},
|
|
46
68
|
methods: {
|
|
47
69
|
iconType(id) {
|
|
48
|
-
return this.answer.answer == id
|
|
70
|
+
return this.answer.answer == id
|
|
71
|
+
? "ios-checkmark-circle"
|
|
72
|
+
: "ios-checkmark-circle-outline";
|
|
49
73
|
},
|
|
50
74
|
cardClasses(id) {
|
|
51
|
-
return this.answer.answer == id
|
|
52
|
-
|
|
53
|
-
|
|
75
|
+
return this.answer.answer == id
|
|
76
|
+
? "evaluation-cards evaluation-cards-current"
|
|
77
|
+
: "evaluation-cards";
|
|
78
|
+
},
|
|
79
|
+
},
|
|
54
80
|
});
|
|
55
81
|
</script>
|
|
82
|
+
|
|
83
|
+
<style lang="less" scoped>
|
|
84
|
+
.card-text {
|
|
85
|
+
width: 100%;
|
|
86
|
+
}
|
|
87
|
+
</style>
|