@wg-npm/survey-response 0.3.22650 → 0.3.22657

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.
@@ -298,12 +298,18 @@ var script$c = Vue.extend({
298
298
  },
299
299
  },
300
300
  data() {
301
- return { value: this.answer };
301
+ return {
302
+ value: this.answer,
303
+ isReadOnly: false,
304
+ };
302
305
  },
303
306
  watch: {
304
307
  answer(n) {
305
308
  this.value = n;
306
309
  },
310
+ question(q) {
311
+ this.isReadOnly = !!_.find(this.question.choices, (choice) => choice.readonly);
312
+ },
307
313
  },
308
314
  methods: {
309
315
  setCheckboxStatus() {
@@ -318,12 +324,7 @@ var script$c = Vue.extend({
318
324
  }
319
325
  });
320
326
  _.each(notExclusiveChoices, (choice) => {
321
- if (_.includes(this.value.answer, exclusiveChoiceId)) {
322
- choice.readonly = true;
323
- }
324
- else {
325
- choice.readonly = false;
326
- }
327
+ choice.readonly = _.includes(this.value.answer, exclusiveChoiceId);
327
328
  });
328
329
  },
329
330
  selChange(val) {
@@ -359,7 +360,7 @@ const __vue_script__$c = script$c;
359
360
 
360
361
  /* template */
361
362
  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":{
362
- required: _vm.question.options.required,
363
+ required: _vm.question.options.required && !_vm.isReadOnly,
363
364
  type: 'array',
364
365
  min: 1,
365
366
  message: _vm.t('survey_response.question.question_required'),
@@ -519,6 +520,7 @@ var script$a = Vue.extend({
519
520
  return {
520
521
  value: this.answer,
521
522
  choiceClasses: this.buildChoiceClasses(),
523
+ isReadOnly: false,
522
524
  };
523
525
  },
524
526
  watch: {
@@ -528,6 +530,9 @@ var script$a = Vue.extend({
528
530
  answer(n) {
529
531
  this.value = n;
530
532
  },
533
+ question(q) {
534
+ this.isReadOnly = !!_.find(this.question.choices, (choice) => choice.readonly);
535
+ },
531
536
  },
532
537
  methods: {
533
538
  selChange(id) {
@@ -572,7 +577,7 @@ const __vue_script__$a = script$a;
572
577
 
573
578
  /* template */
574
579
  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":{
575
- required: _vm.question.options.required,
580
+ required: _vm.question.options.required && !_vm.isReadOnly,
576
581
  message: _vm.t('survey_response.question.question_required'),
577
582
  }}},[_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},[_c('Radio',{key:choice.id,attrs:{"disabled":_vm.question.options.readonly || choice.readonly,"label":choice.id},nativeOn:{"click":function($event){return _vm.toggleAnswer(choice.id, choice.readonly)}}},[(_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)};
578
583
  var __vue_staticRenderFns__$a = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wg-npm/survey-response",
3
- "version": "0.3.22650",
3
+ "version": "0.3.22657",
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.22650",
16
- "@wg-npm/survey-service-api": "0.3.22650",
15
+ "@wg-npm/survey-core": "0.3.22657",
16
+ "@wg-npm/survey-service-api": "0.3.22657",
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.22650",
38
- "@wg-npm/survey-service-api": "0.3.22650",
37
+ "@wg-npm/survey-core": "0.3.22657",
38
+ "@wg-npm/survey-service-api": "0.3.22657",
39
39
  "acorn": "^7.3.1",
40
40
  "axios": "^0.19.2",
41
41
  "babelrc-rollup": "^3.0.0",
@@ -2,7 +2,7 @@
2
2
  <FormItem
3
3
  :prop="`answers[${index}].answer`"
4
4
  :rules="{
5
- required: question.options.required,
5
+ required: question.options.required && !isReadOnly,
6
6
  type: 'array',
7
7
  min: 1,
8
8
  message: t('survey_response.question.question_required'),
@@ -56,12 +56,19 @@ export default Vue.extend({
56
56
  },
57
57
  },
58
58
  data() {
59
- return { value: this.answer };
59
+ return {
60
+ value: this.answer,
61
+ isReadOnly: false,
62
+ };
60
63
  },
61
64
  watch: {
62
65
  answer(n) {
63
66
  this.value = n;
64
67
  },
68
+ question(q) {
69
+ // @ts-ignore
70
+ this.isReadOnly = !!_.find(this.question.choices, (choice) => choice.readonly);
71
+ },
65
72
  },
66
73
  methods: {
67
74
  setCheckboxStatus() {
@@ -79,11 +86,7 @@ export default Vue.extend({
79
86
  // @ts-ignore
80
87
  _.each(notExclusiveChoices, (choice) => {
81
88
  // @ts-ignore
82
- if (_.includes(this.value.answer, exclusiveChoiceId)) {
83
- choice.readonly = true;
84
- } else {
85
- choice.readonly = false;
86
- }
89
+ choice.readonly = _.includes(this.value.answer, exclusiveChoiceId);
87
90
  });
88
91
  },
89
92
  selChange(val) {
@@ -2,7 +2,7 @@
2
2
  <FormItem
3
3
  :prop="`answers[${index}].answer`"
4
4
  :rules="{
5
- required: question.options.required,
5
+ required: question.options.required && !isReadOnly,
6
6
  message: t('survey_response.question.question_required'),
7
7
  }"
8
8
  >
@@ -69,6 +69,7 @@ export default Vue.extend({
69
69
  value: this.answer,
70
70
  // @ts-ignore
71
71
  choiceClasses: this.buildChoiceClasses(),
72
+ isReadOnly: false,
72
73
  };
73
74
  },
74
75
  watch: {
@@ -77,6 +78,10 @@ export default Vue.extend({
77
78
  },
78
79
  answer(n) {
79
80
  this.value = n;
81
+ },
82
+ question(q) {
83
+ // @ts-ignore
84
+ this.isReadOnly = !!_.find(this.question.choices, (choice) => choice.readonly);
80
85
  },
81
86
  },
82
87
  methods: {