@wg-npm/survey-response 0.3.14 → 0.3.3791

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.
@@ -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,28 +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
- let 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);
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
- if (this.isMobile) {
256
+ const globalLayout = _.lowerCase(_.get(this.options, "layout", undefined));
257
+ if (this.isMobile || "vertical" == globalLayout) {
253
258
  return "";
254
259
  }
255
- let globalOptions = _.lowerCase(_.get(this.options, "layout", undefined));
256
- let questionOptions = _.lowerCase(_.get(this.question.options, "layout", "horizontal"));
257
- let layout = globalOptions || questionOptions;
258
- return `question-choice-${layout}`;
260
+ const questionLayout = _.lowerCase(_.get(this.question.options, "layout", "horizontal"));
261
+ return `question-choice-${questionLayout}`;
259
262
  }
260
263
  }
261
264
  });
262
265
 
263
266
  var script$c = Vue.extend({
264
- name: 'multi-selection',
267
+ name: "multi-selection",
268
+ inject: ["$rootComponent"],
265
269
  mixins: [OptionLayoutMixin],
266
270
  components: {
267
271
  FormItem,
@@ -298,7 +302,8 @@ var script$c = Vue.extend({
298
302
  });
299
303
  this.answer.score = score;
300
304
  if (this.question.options.starEnabled) {
301
- this.answer.star = minStarCount >= this.question.options.starMinCount ? 1 : 0;
305
+ this.answer.star =
306
+ minStarCount >= this.question.options.starMinCount ? 1 : 0;
302
307
  }
303
308
  }
304
309
  }
@@ -308,7 +313,12 @@ var script$c = Vue.extend({
308
313
  const __vue_script__$c = script$c;
309
314
 
310
315
  /* template */
311
- 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":{ required: _vm.question.options.required, type: 'array', min: 1, message: _vm.t('survey_response.question.question_required') }}},[_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":4,"md":4,"lg":4}},[_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)};
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)};
312
322
  var __vue_staticRenderFns__$c = [];
313
323
 
314
324
  /* style */
@@ -340,6 +350,8 @@ var __vue_staticRenderFns__$c = [];
340
350
  undefined
341
351
  );
342
352
 
353
+ var MultiSelection = __vue_component__$c;
354
+
343
355
  var script$b = Vue.extend({
344
356
  name: "short-answer",
345
357
  components: {
@@ -412,8 +424,10 @@ var __vue_staticRenderFns__$b = [];
412
424
  undefined
413
425
  );
414
426
 
427
+ var ShortAnswer = __vue_component__$b;
428
+
415
429
  var script$a = Vue.extend({
416
- name: 'single-selection',
430
+ name: "single-selection",
417
431
  components: {
418
432
  FormItem,
419
433
  RadioGroup,
@@ -423,7 +437,7 @@ var script$a = Vue.extend({
423
437
  Icon
424
438
  },
425
439
  mixins: [OptionLayoutMixin],
426
- inject: ["responseStatus"],
440
+ inject: ["responseStatus", "$rootComponent"],
427
441
  props: {
428
442
  question: {
429
443
  type: Object,
@@ -484,7 +498,10 @@ var script$a = Vue.extend({
484
498
  const __vue_script__$a = script$a;
485
499
 
486
500
  /* template */
487
- 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":{ required: _vm.question.options.required, message: _vm.t('survey_response.question.question_required') }}},[_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":6,"md":6,"lg":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)};
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)};
488
505
  var __vue_staticRenderFns__$a = [];
489
506
 
490
507
  /* style */
@@ -516,10 +533,12 @@ var __vue_staticRenderFns__$a = [];
516
533
  undefined
517
534
  );
518
535
 
536
+ var SingleSelection = __vue_component__$a;
537
+
519
538
  var script$9 = Vue.extend({
520
- name: 'matrix',
539
+ name: "matrix",
521
540
  mixins: [OptionLayoutMixin],
522
- inject: ["responseStatus"],
541
+ inject: ["responseStatus", "$rootComponent"],
523
542
  components: {
524
543
  FormItem,
525
544
  RadioGroup,
@@ -546,7 +565,7 @@ var script$9 = Vue.extend({
546
565
  _.each(this.value.answer, data => {
547
566
  _.set(subAnswers, data.questionId, data);
548
567
  });
549
- _.set(this.value, 'answer', []);
568
+ _.set(this.value, "answer", []);
550
569
  _.each(this.question.subQuestions, question => {
551
570
  let _answer = _.get(subAnswers, question.id);
552
571
  _answer = _answer
@@ -555,7 +574,7 @@ var script$9 = Vue.extend({
555
574
  answer: null,
556
575
  question_id: question.id,
557
576
  score: 0,
558
- question_type: 'SINGLE_SELECTION'
577
+ question_type: "SINGLE_SELECTION"
559
578
  };
560
579
  this.value.answer.push(_answer);
561
580
  });
@@ -576,7 +595,9 @@ var script$9 = Vue.extend({
576
595
  toggleAnswer(subValue, subIndex) {
577
596
  if (this.responseStatus == this.$consts.STATUS_DRAFT) {
578
597
  let subAnswer = this.value.answer[subIndex].answer;
579
- this.value.answer[subIndex].answer = _.isEmpty(subAnswer) ? subValue : subAnswer;
598
+ this.value.answer[subIndex].answer = _.isEmpty(subAnswer)
599
+ ? subValue
600
+ : subAnswer;
580
601
  }
581
602
  }
582
603
  }
@@ -586,7 +607,10 @@ var script$9 = Vue.extend({
586
607
  const __vue_script__$9 = script$9;
587
608
 
588
609
  /* template */
589
- 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(" "+_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":{ required: _vm.question.options.required, message: _vm.t('survey_response.question.question_required') }}},[_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":4,"md":4,"lg":4}},[_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)};
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)};
590
614
  var __vue_staticRenderFns__$9 = [];
591
615
 
592
616
  /* style */
@@ -618,6 +642,8 @@ var __vue_staticRenderFns__$9 = [];
618
642
  undefined
619
643
  );
620
644
 
645
+ var Matrix = __vue_component__$9;
646
+
621
647
  var script$8 = Vue.extend({});
622
648
 
623
649
  /* script */
@@ -656,6 +682,8 @@ var __vue_staticRenderFns__$8 = [];
656
682
  undefined
657
683
  );
658
684
 
685
+ var TextTitle = __vue_component__$8;
686
+
659
687
  var script$7 = Vue.extend({
660
688
  name: "fill-blank",
661
689
  components: {
@@ -728,6 +756,8 @@ var __vue_staticRenderFns__$7 = [];
728
756
  undefined
729
757
  );
730
758
 
759
+ var FillBlank = __vue_component__$7;
760
+
731
761
  var defaultLang = {
732
762
  survey_response: {
733
763
  locale: 'zh-CN',
@@ -863,6 +893,8 @@ var __vue_staticRenderFns__$6 = [];
863
893
  undefined
864
894
  );
865
895
 
896
+ var Star = __vue_component__$6;
897
+
866
898
  class ExprEvaluationQuestion {
867
899
  questions;
868
900
  scope;
@@ -1077,6 +1109,8 @@ var __vue_staticRenderFns__$5 = [];
1077
1109
  undefined
1078
1110
  );
1079
1111
 
1112
+ var If = __vue_component__$5;
1113
+
1080
1114
  var script$4 = Vue.extend({
1081
1115
  name: "expr-else",
1082
1116
  mixins: [LocaleMixin],
@@ -1123,6 +1157,8 @@ var __vue_staticRenderFns__$4 = [];
1123
1157
  undefined
1124
1158
  );
1125
1159
 
1160
+ var Else = __vue_component__$4;
1161
+
1126
1162
  var script$3 = Vue.extend({
1127
1163
  name: "expr",
1128
1164
  props: {
@@ -1132,8 +1168,8 @@ var script$3 = Vue.extend({
1132
1168
  }
1133
1169
  },
1134
1170
  components: {
1135
- IF: __vue_component__$5,
1136
- ELSE: __vue_component__$4
1171
+ IF: If,
1172
+ ELSE: Else
1137
1173
  }
1138
1174
  });
1139
1175
 
@@ -1173,51 +1209,63 @@ var __vue_staticRenderFns__$3 = [];
1173
1209
  undefined
1174
1210
  );
1175
1211
 
1212
+ var Expr = __vue_component__$3;
1213
+
1176
1214
  var script$2 = Vue.extend({
1177
1215
  name: "Evaluation",
1178
1216
  components: {
1179
- Row, Col, Card, Icon,
1180
- STAR: __vue_component__$6,
1181
- EXPR: __vue_component__$3,
1217
+ Row,
1218
+ Col,
1219
+ Card,
1220
+ Icon,
1221
+ STAR: Star,
1222
+ EXPR: Expr,
1182
1223
  },
1183
1224
  mixins: [LocaleMixin],
1225
+ inject: ["$rootComponent"],
1184
1226
  props: {
1185
1227
  question: {
1186
1228
  type: Object,
1187
- required: true
1229
+ required: true,
1188
1230
  },
1189
1231
  answer: {
1190
1232
  type: Object,
1191
- required: true
1192
- }
1233
+ required: true,
1234
+ },
1193
1235
  },
1194
1236
  methods: {
1195
1237
  iconType(id) {
1196
- return this.answer.answer == id ? "ios-checkmark-circle" : "ios-checkmark-circle-outline";
1238
+ return this.answer.answer == id
1239
+ ? "ios-checkmark-circle"
1240
+ : "ios-checkmark-circle-outline";
1197
1241
  },
1198
1242
  cardClasses(id) {
1199
- return this.answer.answer == id ? "evaluation-cards evaluation-cards-current" : "evaluation-cards";
1200
- }
1201
- }
1243
+ return this.answer.answer == id
1244
+ ? "evaluation-cards evaluation-cards-current"
1245
+ : "evaluation-cards";
1246
+ },
1247
+ },
1202
1248
  });
1203
1249
 
1204
1250
  /* script */
1205
1251
  const __vue_script__$2 = script$2;
1206
1252
 
1207
1253
  /* template */
1208
- 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":4,"md":4,"lg":4}},[_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('p',{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)};
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)};
1209
1255
  var __vue_staticRenderFns__$2 = [];
1210
1256
 
1211
1257
  /* style */
1212
- const __vue_inject_styles__$2 = undefined;
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
+ };
1213
1263
  /* scoped */
1214
- const __vue_scope_id__$2 = undefined;
1264
+ const __vue_scope_id__$2 = "data-v-71844af4";
1215
1265
  /* module identifier */
1216
1266
  const __vue_module_identifier__$2 = undefined;
1217
1267
  /* functional template */
1218
1268
  const __vue_is_functional_template__$2 = false;
1219
- /* style inject */
1220
-
1221
1269
  /* style inject SSR */
1222
1270
 
1223
1271
  /* style inject shadow dom */
@@ -1232,20 +1280,22 @@ var __vue_staticRenderFns__$2 = [];
1232
1280
  __vue_is_functional_template__$2,
1233
1281
  __vue_module_identifier__$2,
1234
1282
  false,
1235
- undefined,
1283
+ createInjector,
1236
1284
  undefined,
1237
1285
  undefined
1238
1286
  );
1239
1287
 
1288
+ var Evaluation = __vue_component__$2;
1289
+
1240
1290
  var script$1 = Vue.extend({
1241
1291
  components: {
1242
- MULTI_SELECTION: __vue_component__$c,
1243
- SHORT_ANSWER: __vue_component__$b,
1244
- FILL_BLANK: __vue_component__$7,
1245
- TEXT_TITLE: __vue_component__$8,
1246
- SINGLE_SELECTION: __vue_component__$a,
1247
- MATRIX: __vue_component__$9,
1248
- EVALUATION: __vue_component__$2
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
1249
1299
  },
1250
1300
  name: "question-body",
1251
1301
  props: {
@@ -1303,17 +1353,21 @@ var __vue_staticRenderFns__$1 = [];
1303
1353
  undefined
1304
1354
  );
1305
1355
 
1356
+ var QuestionBody = __vue_component__$1;
1357
+
1306
1358
  var script = Vue.extend({
1307
- name: 'SurveyResponse',
1359
+ name: "SurveyResponse",
1308
1360
  components: {
1309
- QuestionTitle: __vue_component__$d,
1310
- QuestionBody: __vue_component__$1,
1311
- EmptyQuestion: __vue_component__$e,
1361
+ QuestionTitle,
1362
+ QuestionBody,
1363
+ EmptyQuestion,
1312
1364
  Form
1313
1365
  },
1314
1366
  provide() {
1315
1367
  return {
1316
- responseStar: this.response.status != this.$consts.STATUS_DRAFT ? this.response.star : null,
1368
+ responseStar: this.response.status != this.$consts.STATUS_DRAFT
1369
+ ? this.response.star
1370
+ : null,
1317
1371
  survey: this.survey,
1318
1372
  responseStatus: this.response.status,
1319
1373
  $rootComponent: this
@@ -1333,7 +1387,7 @@ var script = Vue.extend({
1333
1387
  },
1334
1388
  size: {
1335
1389
  type: String,
1336
- default: 'default'
1390
+ default: "default"
1337
1391
  }
1338
1392
  },
1339
1393
  data() {
@@ -1350,6 +1404,10 @@ var script = Vue.extend({
1350
1404
  },
1351
1405
  readonly() {
1352
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";
1353
1411
  }
1354
1412
  },
1355
1413
  methods: {
@@ -1364,12 +1422,14 @@ var script = Vue.extend({
1364
1422
  question.type == "FILL_BLANK" ||
1365
1423
  question.type == "SHORT_ANSWER" ||
1366
1424
  question.type == "MULTI_SELECTION") {
1367
- _.set(question.options, 'readonly', this.haveAnswered(backgroundAnswer));
1425
+ _.set(question.options, "readonly", this.haveAnswered(backgroundAnswer));
1368
1426
  }
1369
1427
  if (question.type == "MATRIX") {
1370
1428
  _.forEach(question.subQuestions, (subQuestion, subIndex) => {
1371
1429
  let backgroundSubAnswer = _.get(backgroundAnswer, `answer[${subIndex}]`, null);
1372
- _.set(subQuestion, "options", { 'readonly': this.haveAnswered(backgroundSubAnswer) });
1430
+ _.set(subQuestion, "options", {
1431
+ readonly: this.haveAnswered(backgroundSubAnswer)
1432
+ });
1373
1433
  });
1374
1434
  }
1375
1435
  },
@@ -1380,13 +1440,13 @@ var script = Vue.extend({
1380
1440
  _.each(this.response.answers, data => {
1381
1441
  _.set(this.answers, data.questionId, data);
1382
1442
  });
1383
- _.set(this.response, 'answers', []);
1443
+ _.set(this.response, "answers", []);
1384
1444
  _.each(this.survey.questions, question => {
1385
1445
  let answer = _.get(this.answers, question.id);
1386
1446
  answer = answer
1387
1447
  ? answer
1388
1448
  : {
1389
- answer: question.type == 'MULTI_SELECTION' ? [] : null,
1449
+ answer: question.type == "MULTI_SELECTION" ? [] : null,
1390
1450
  question_id: question.id,
1391
1451
  question_type: question.type,
1392
1452
  score: null,
@@ -1403,7 +1463,7 @@ var script = Vue.extend({
1403
1463
  return result;
1404
1464
  },
1405
1465
  getMaxScore(question) {
1406
- if (question.type === 'single_selection') {
1466
+ if (question.type === "single_selection") {
1407
1467
  var score = _.maxBy(question.choices, answer_option => answer_option.options.score || 0).options.score;
1408
1468
  if (!score) {
1409
1469
  return 0;
@@ -1453,6 +1513,8 @@ var __vue_staticRenderFns__ = [];
1453
1513
  undefined
1454
1514
  );
1455
1515
 
1516
+ var SurveyResponse = __vue_component__;
1517
+
1456
1518
  class Constants {
1457
1519
  constructor() {
1458
1520
  this.STATUS_ENABLED = "ENABLED";
@@ -1470,9 +1532,8 @@ class SurveyResponsePlugin {
1470
1532
  locale.use(options.locale);
1471
1533
  locale.i18n(options.i18n);
1472
1534
  Vue.mixin(LocaleMixin);
1473
- vue.component("survey-response", __vue_component__);
1535
+ vue.component("survey-response", SurveyResponse);
1474
1536
  }
1475
1537
  }
1476
1538
 
1477
- export default SurveyResponsePlugin;
1478
- 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.14",
3
+ "version": "0.3.3791",
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.14",
16
- "@wg-npm/survey-service-api": "0.3.14",
15
+ "@wg-npm/survey-core": "0.3.3791",
16
+ "@wg-npm/survey-service-api": "0.3.3791",
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.14",
38
- "@wg-npm/survey-service-api": "0.3.14",
37
+ "@wg-npm/survey-core": "0.3.3791",
38
+ "@wg-npm/survey-service-api": "0.3.3791",
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 type="flex" justify="start" :gutter="24" v-if="question.evaluationItems.length > 0">
4
- <Col :xs="24" :sm="4" :md="4" :lg="4" class="evaluation-item" v-for="item in question.evaluationItems"
5
- :key="item.id">
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
- <p class="text">{{ i18nText(item.text) }}</p>
12
- <component :is="question.options.evaluationType" :item="item"></component>
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, Col, Card, Icon,
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 ? "ios-checkmark-circle" : "ios-checkmark-circle-outline"
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 ? "evaluation-cards evaluation-cards-current" : "evaluation-cards"
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>