@wg-npm/survey-response 0.3.22839 → 0.3.22840

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.
@@ -1,6 +1,6 @@
1
1
  import Vue from 'vue';
2
2
  import _ from 'lodash';
3
- import { Row, Icon, FormItem, CheckboxGroup, Checkbox, Col, Input, RadioGroup, Radio, Tooltip, Card, Slider, Form } from 'view-design';
3
+ import { Row, Icon, FormItem, CheckboxGroup, Checkbox, Col, Input, RadioGroup, Radio, Tooltip, Card, Slider, InputNumber, Form } from 'view-design';
4
4
  import deepmerge from 'deepmerge';
5
5
  import { translate } from '@wg-npm/survey-core';
6
6
 
@@ -1473,6 +1473,7 @@ var script$2 = Vue.extend({
1473
1473
  Row,
1474
1474
  Slider,
1475
1475
  FormItem,
1476
+ InputNumber,
1476
1477
  },
1477
1478
  props: {
1478
1479
  question: {
@@ -1533,29 +1534,6 @@ var script$2 = Vue.extend({
1533
1534
  _.forEach(this.value.answer, (a) => (a.score = 0));
1534
1535
  }
1535
1536
  },
1536
- "value.answer": function (answer, oldAnswer) {
1537
- let answerMap = _.keyBy(answer, "question_id");
1538
- let oldAnswerMap = _.keyBy(oldAnswer, "question_id");
1539
- _.forEach(this.value.answer, (a) => {
1540
- let score = _.get(answerMap, a.question_id, 0);
1541
- let oldScore = _.get(oldAnswerMap, a.question_id, 0);
1542
- if (score != oldScore) {
1543
- a.score = a.score.toFixed(this.question.options.decimalPlaces);
1544
- a.answer = 1;
1545
- }
1546
- });
1547
- if (!_.isEmpty(this.value.answer)) {
1548
- let totalScore = 0;
1549
- _.forEach(this.value.answer, (a) => {
1550
- totalScore += a.score;
1551
- });
1552
- this.value.score = totalScore;
1553
- }
1554
- },
1555
- "value.score": function () {
1556
- this.value.answer = 1;
1557
- this.value.score = this.value.score.toFixed(this.question.options.decimalPlaces);
1558
- },
1559
1537
  },
1560
1538
  });
1561
1539
 
@@ -1563,19 +1541,13 @@ var script$2 = Vue.extend({
1563
1541
  const __vue_script__$2 = script$2;
1564
1542
 
1565
1543
  /* template */
1566
- var __vue_render__$2 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('Row',{directives:[{name:"show",rawName:"v-show",value:(_vm.showQuestionScoreSlider),expression:"showQuestionScoreSlider"}]},[_c('div',{staticStyle:{"margin-right":"134px","margin-bottom":"18px"}},[_c('FormItem',{attrs:{"prop":_vm.value.answer,"rules":{
1567
- required: _vm.question.options.required,
1568
- message: _vm.t('survey_response.question.question_required'),
1569
- },"label":_vm.t('survey_creator.page.question')}},[_c('Slider',{staticStyle:{"width":"562px","margin-left":"66px","margin-right":"134px","margin-top":"16px"},attrs:{"min":_vm.question.options.minRange,"max":_vm.question.options.maxRange,"step":_vm.sliderStep,"show-input":"","show-tips":"always","disabled":_vm.question.options.readonly || _vm.question.options.disabled},model:{value:(_vm.value.score),callback:function ($$v) {_vm.$set(_vm.value, "score", $$v);},expression:"value.score"}})],1),_vm._v(" "),_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.extremeValueLabelSelected),expression:"extremeValueLabelSelected"}]},[_c('span',{staticStyle:{"margin-left":"66px","float":"left"}},[_vm._v("\n "+_vm._s(_vm.t(
1544
+ var __vue_render__$2 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('Row',{directives:[{name:"show",rawName:"v-show",value:(_vm.showQuestionScoreSlider),expression:"showQuestionScoreSlider"}]},[_c('div',{staticStyle:{"margin-right":"134px","margin-bottom":"18px"}},[_c('FormItem',{staticStyle:{"display":"flex"}},[_c('Slider',{staticStyle:{"float":"left","width":"562px","margin-right":"16px"},attrs:{"min":_vm.question.options.minRange,"max":_vm.question.options.maxRange,"step":_vm.sliderStep,"show-tips":"always","disabled":_vm.question.options.readonly || _vm.question.options.disabled},model:{value:(_vm.value.score),callback:function ($$v) {_vm.$set(_vm.value, "score", $$v);},expression:"value.score"}}),_vm._v(" "),_c('InputNumber',{staticStyle:{"float":"left"},attrs:{"precision":_vm.question.options.decimalPlaces},model:{value:(_vm.value.score),callback:function ($$v) {_vm.$set(_vm.value, "score", $$v);},expression:"value.score"}})],1),_vm._v(" "),_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.extremeValueLabelSelected),expression:"extremeValueLabelSelected"}]},[_c('span',{staticStyle:{"float":"left","margin-left":"36px"}},[_vm._v("\n "+_vm._s(_vm.t(
1570
1545
  ("survey_creator.question.scoring.extreme_value_labels." + (_vm.question.options.extremeValueLabel) + ".minValue")
1571
- ))+"\n ")]),_vm._v(" "),_c('span',{staticStyle:{"margin-right":"230px","float":"right","align-items":"flex-end"}},[_vm._v("\n "+_vm._s(_vm.t(
1546
+ ))+"\n ")]),_vm._v(" "),_c('span',{staticStyle:{"float":"right","align-items":"flex-end","margin-right":"88px"}},[_vm._v("\n "+_vm._s(_vm.t(
1572
1547
  ("survey_creator.question.scoring.extreme_value_labels." + (_vm.question.options.extremeValueLabel) + ".maxValue")
1573
- ))+"\n ")])])],1)]),_vm._v(" "),_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('Row',[_c('div',{staticStyle:{"margin-right":"134px","margin-bottom":"18px"}},[_c('FormItem',{attrs:{"prop":'value.answer.' + subIndex + '.answer',"rules":{
1574
- required: _vm.question.options.required,
1575
- message: _vm.t('survey_response.question.question_required'),
1576
- },"label":_vm.t('survey_creator.page.question')}},[_c('Slider',{staticStyle:{"width":"562px","margin-left":"66px","margin-right":"134px","margin-top":"16px"},attrs:{"min":_vm.question.options.minRange,"max":_vm.question.options.maxRange,"step":_vm.sliderStep,"show-input":"","show-tips":"always","disabled":subQuestion.options.readonly || _vm.question.options.disabled},model:{value:(_vm.value.answer[subIndex].score),callback:function ($$v) {_vm.$set(_vm.value.answer[subIndex], "score", $$v);},expression:"value.answer[subIndex].score"}})],1),_vm._v(" "),_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.extremeValueLabelSelected),expression:"extremeValueLabelSelected"}]},[_c('span',{staticStyle:{"margin-left":"66px","float":"left"}},[_vm._v("\n "+_vm._s(_vm.t(
1548
+ ))+"\n ")])])],1)]),_vm._v(" "),_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('Row',[_c('div',{staticStyle:{"margin-right":"134px","margin-bottom":"18px"}},[_c('FormItem',{staticStyle:{"display":"flex"}},[_c('Slider',{staticStyle:{"float":"left","width":"562px","margin-right":"16px"},attrs:{"min":_vm.question.options.minRange,"max":_vm.question.options.maxRange,"step":_vm.sliderStep,"show-tips":"always","disabled":subQuestion.options.readonly || _vm.question.options.disabled},model:{value:(_vm.value.answer[subIndex].score),callback:function ($$v) {_vm.$set(_vm.value.answer[subIndex], "score", $$v);},expression:"value.answer[subIndex].score"}}),_vm._v(" "),_c('InputNumber',{staticStyle:{"float":"left"},attrs:{"precision":_vm.question.options.decimalPlaces},model:{value:(_vm.value.answer[subIndex].score),callback:function ($$v) {_vm.$set(_vm.value.answer[subIndex], "score", $$v);},expression:"value.answer[subIndex].score"}})],1),_vm._v(" "),_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.extremeValueLabelSelected),expression:"extremeValueLabelSelected"}]},[_c('span',{staticStyle:{"float":"left","margin-left":"36px"}},[_vm._v("\n "+_vm._s(_vm.t(
1577
1549
  ("survey_creator.question.scoring.extreme_value_labels." + (_vm.question.options.extremeValueLabel) + ".minValue")
1578
- ))+"\n ")]),_vm._v(" "),_c('span',{staticStyle:{"margin-right":"230px","float":"right","align-items":"flex-end"}},[_vm._v("\n "+_vm._s(_vm.t(
1550
+ ))+"\n ")]),_vm._v(" "),_c('span',{staticStyle:{"float":"right","align-items":"flex-end","margin-right":"88px"}},[_vm._v("\n "+_vm._s(_vm.t(
1579
1551
  ("survey_creator.question.scoring.extreme_value_labels." + (_vm.question.options.extremeValueLabel) + ".maxValue")
1580
1552
  ))+"\n ")])])],1)])],1)})],2)};
1581
1553
  var __vue_staticRenderFns__$2 = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wg-npm/survey-response",
3
- "version": "0.3.22839",
3
+ "version": "0.3.22840",
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.22839",
16
- "@wg-npm/survey-service-api": "0.3.22839",
15
+ "@wg-npm/survey-core": "0.3.22840",
16
+ "@wg-npm/survey-service-api": "0.3.22840",
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.22839",
38
- "@wg-npm/survey-service-api": "0.3.22839",
37
+ "@wg-npm/survey-core": "0.3.22840",
38
+ "@wg-npm/survey-service-api": "0.3.22840",
39
39
  "acorn": "^7.3.1",
40
40
  "axios": "^0.19.2",
41
41
  "babelrc-rollup": "^3.0.0",
@@ -72,7 +72,7 @@
72
72
  "publishConfig": {
73
73
  "access": "public"
74
74
  },
75
- "gitHead": "986a822fbabaaeade82265e4eba7952e545032f3",
75
+ "gitHead": "152587db1f9b482513e7591ad479972c5a582fe4",
76
76
  "rollup": {
77
77
  "external": [
78
78
  "vue",
@@ -3,41 +3,32 @@
3
3
  <!-- question slider -->
4
4
  <Row v-show="showQuestionScoreSlider">
5
5
  <div style="margin-right: 134px; margin-bottom: 18px">
6
- <FormItem
7
- :prop="value.answer"
8
- :rules="{
9
- required: question.options.required,
10
- message: t('survey_response.question.question_required'),
11
- }"
12
- :label="t('survey_creator.page.question')"
13
- >
6
+ <FormItem style="display: flex">
14
7
  <Slider
15
- style="
16
- width: 562px;
17
- margin-left: 66px;
18
- margin-right: 134px;
19
- margin-top: 16px;
20
- "
8
+ style="float: left; width: 562px; margin-right: 16px"
21
9
  v-model="value.score"
22
10
  :min="question.options.minRange"
23
11
  :max="question.options.maxRange"
24
12
  :step="sliderStep"
25
- show-input
26
13
  show-tips="always"
27
14
  :disabled="question.options.readonly || question.options.disabled"
28
15
  ></Slider>
16
+ <InputNumber
17
+ style="float: left"
18
+ v-model="value.score"
19
+ :precision="question.options.decimalPlaces"
20
+ >
21
+ </InputNumber>
29
22
  </FormItem>
30
23
  <div v-show="extremeValueLabelSelected">
31
- <span style="margin-left: 66px; float: left">
24
+ <span style="float: left; margin-left: 36px">
32
25
  {{
33
26
  t(
34
27
  `survey_creator.question.scoring.extreme_value_labels.${question.options.extremeValueLabel}.minValue`
35
28
  )
36
29
  }}
37
30
  </span>
38
- <span
39
- style="margin-right: 230px; float: right; align-items: flex-end"
40
- >
31
+ <span style="float: right; align-items: flex-end; margin-right: 88px">
41
32
  {{
42
33
  t(
43
34
  `survey_creator.question.scoring.extreme_value_labels.${question.options.extremeValueLabel}.maxValue`
@@ -59,34 +50,27 @@
59
50
  <!-- sub question slider -->
60
51
  <Row>
61
52
  <div style="margin-right: 134px; margin-bottom: 18px">
62
- <FormItem
63
- :prop="'value.answer.' + subIndex + '.answer'"
64
- :rules="{
65
- required: question.options.required,
66
- message: t('survey_response.question.question_required'),
67
- }"
68
- :label="t('survey_creator.page.question')"
69
- >
53
+ <FormItem style="display: flex">
70
54
  <Slider
71
- style="
72
- width: 562px;
73
- margin-left: 66px;
74
- margin-right: 134px;
75
- margin-top: 16px;
76
- "
55
+ style="float: left; width: 562px; margin-right: 16px"
77
56
  v-model="value.answer[subIndex].score"
78
57
  :min="question.options.minRange"
79
58
  :max="question.options.maxRange"
80
59
  :step="sliderStep"
81
- show-input
82
60
  show-tips="always"
83
61
  :disabled="
84
62
  subQuestion.options.readonly || question.options.disabled
85
63
  "
86
64
  ></Slider>
65
+ <InputNumber
66
+ style="float: left"
67
+ v-model="value.answer[subIndex].score"
68
+ :precision="question.options.decimalPlaces"
69
+ >
70
+ </InputNumber>
87
71
  </FormItem>
88
72
  <div v-show="extremeValueLabelSelected">
89
- <span style="margin-left: 66px; float: left">
73
+ <span style="float: left; margin-left: 36px">
90
74
  {{
91
75
  t(
92
76
  `survey_creator.question.scoring.extreme_value_labels.${question.options.extremeValueLabel}.minValue`
@@ -94,7 +78,7 @@
94
78
  }}
95
79
  </span>
96
80
  <span
97
- style="margin-right: 230px; float: right; align-items: flex-end"
81
+ style="float: right; align-items: flex-end; margin-right: 88px"
98
82
  >
99
83
  {{
100
84
  t(
@@ -112,7 +96,7 @@
112
96
  <script lang="ts">
113
97
  import Vue from "vue";
114
98
  import OptionLayoutMixin from "../../../mixins/option-layout-mixin";
115
- import { Row, Slider, FormItem } from "view-design";
99
+ import { Row, Slider, FormItem, InputNumber } from "view-design";
116
100
  import _ from "lodash";
117
101
 
118
102
  export default Vue.extend({
@@ -124,6 +108,7 @@ export default Vue.extend({
124
108
  Row,
125
109
  Slider,
126
110
  FormItem,
111
+ InputNumber,
127
112
  },
128
113
  props: {
129
114
  question: {
@@ -195,33 +180,6 @@ export default Vue.extend({
195
180
  _.forEach(this.value.answer, (a) => (a.score = 0));
196
181
  }
197
182
  },
198
- "value.answer": function (answer, oldAnswer) {
199
- let answerMap = _.keyBy(answer, "question_id");
200
- let oldAnswerMap = _.keyBy(oldAnswer, "question_id");
201
- // format number as decimal places
202
- // set answer to true
203
- _.forEach(this.value.answer, (a) => {
204
- let score = _.get(answerMap, a.question_id, 0);
205
- let oldScore = _.get(oldAnswerMap, a.question_id, 0);
206
- if (score != oldScore) {
207
- a.score = a.score.toFixed(this.question.options.decimalPlaces);
208
- a.answer = 1;
209
- }
210
- });
211
- if (!_.isEmpty(this.value.answer)) {
212
- let totalScore = 0;
213
- _.forEach(this.value.answer, (a) => {
214
- totalScore += a.score;
215
- });
216
- this.value.score = totalScore;
217
- }
218
- },
219
- "value.score": function () {
220
- this.value.answer = 1;
221
- this.value.score = this.value.score.toFixed(
222
- this.question.options.decimalPlaces
223
- );
224
- },
225
183
  },
226
184
  });
227
185
  </script>