@wg-npm/survey-response 0.3.22839 → 0.3.22843
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: {
|
|
@@ -1486,7 +1487,7 @@ var script$2 = Vue.extend({
|
|
|
1486
1487
|
},
|
|
1487
1488
|
},
|
|
1488
1489
|
data() {
|
|
1489
|
-
return { value: this.answer
|
|
1490
|
+
return { value: this.answer };
|
|
1490
1491
|
},
|
|
1491
1492
|
created() {
|
|
1492
1493
|
let subAnswers = {};
|
|
@@ -1506,15 +1507,8 @@ var script$2 = Vue.extend({
|
|
|
1506
1507
|
};
|
|
1507
1508
|
this.value.answer.push(_answer);
|
|
1508
1509
|
});
|
|
1509
|
-
_.each(this.value.answer, (a) => {
|
|
1510
|
-
_.set(this.answers, a.questionId, a.score);
|
|
1511
|
-
});
|
|
1512
|
-
},
|
|
1513
|
-
methods: {
|
|
1514
|
-
getScore(subQuestion) {
|
|
1515
|
-
return _.get(this.answers, subQuestion.id, this.question.options.minRange);
|
|
1516
|
-
},
|
|
1517
1510
|
},
|
|
1511
|
+
methods: {},
|
|
1518
1512
|
computed: {
|
|
1519
1513
|
showQuestionScoreSlider() {
|
|
1520
1514
|
return !(this.question.subQuestions && this.question.subQuestions.length > 0);
|
|
@@ -1533,28 +1527,8 @@ var script$2 = Vue.extend({
|
|
|
1533
1527
|
_.forEach(this.value.answer, (a) => (a.score = 0));
|
|
1534
1528
|
}
|
|
1535
1529
|
},
|
|
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
1530
|
"value.score": function () {
|
|
1556
|
-
|
|
1557
|
-
this.value.score = this.value.score.toFixed(this.question.options.decimalPlaces);
|
|
1531
|
+
console.log();
|
|
1558
1532
|
},
|
|
1559
1533
|
},
|
|
1560
1534
|
});
|
|
@@ -1563,19 +1537,22 @@ var script$2 = Vue.extend({
|
|
|
1563
1537
|
const __vue_script__$2 = script$2;
|
|
1564
1538
|
|
|
1565
1539
|
/* 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.
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1540
|
+
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"},attrs:{"prop":("answers[" + _vm.index + "].score"),"rules":[
|
|
1541
|
+
{
|
|
1542
|
+
required: _vm.question.options.required && !_vm.question.options.disabled,
|
|
1543
|
+
message: _vm.t('survey_response.question.question_required'),
|
|
1544
|
+
} ]}},[_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,"min":_vm.question.options.minRange,"max":_vm.question.options.maxRange},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:{"
|
|
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":
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
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"},attrs:{"prop":("answers[" + _vm.index + "].answer[" + subIndex + "].score"),"rules":[
|
|
1549
|
+
{
|
|
1550
|
+
required:
|
|
1551
|
+
_vm.question.options.required && !_vm.question.options.disabled,
|
|
1552
|
+
message: _vm.t('survey_response.question.question_required'),
|
|
1553
|
+
} ]}},[_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,"min":_vm.question.options.minRange,"max":_vm.question.options.maxRange},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
1554
|
("survey_creator.question.scoring.extreme_value_labels." + (_vm.question.options.extremeValueLabel) + ".minValue")
|
|
1578
|
-
))+"\n ")]),_vm._v(" "),_c('span',{staticStyle:{"
|
|
1555
|
+
))+"\n ")]),_vm._v(" "),_c('span',{staticStyle:{"float":"right","align-items":"flex-end","margin-right":"88px"}},[_vm._v("\n "+_vm._s(_vm.t(
|
|
1579
1556
|
("survey_creator.question.scoring.extreme_value_labels." + (_vm.question.options.extremeValueLabel) + ".maxValue")
|
|
1580
1557
|
))+"\n ")])])],1)])],1)})],2)};
|
|
1581
1558
|
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.
|
|
3
|
+
"version": "0.3.22843",
|
|
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.22843",
|
|
16
|
+
"@wg-npm/survey-service-api": "0.3.22843",
|
|
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.22843",
|
|
38
|
+
"@wg-npm/survey-service-api": "0.3.22843",
|
|
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": "
|
|
75
|
+
"gitHead": "5067ecd19674caff8177815ef24e97397d72c46c",
|
|
76
76
|
"rollup": {
|
|
77
77
|
"external": [
|
|
78
78
|
"vue",
|
|
@@ -4,40 +4,42 @@
|
|
|
4
4
|
<Row v-show="showQuestionScoreSlider">
|
|
5
5
|
<div style="margin-right: 134px; margin-bottom: 18px">
|
|
6
6
|
<FormItem
|
|
7
|
-
|
|
8
|
-
:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
style="display: flex"
|
|
8
|
+
:prop="`answers[${index}].score`"
|
|
9
|
+
:rules="[
|
|
10
|
+
{
|
|
11
|
+
required: question.options.required && !question.options.disabled,
|
|
12
|
+
message: t('survey_response.question.question_required'),
|
|
13
|
+
},
|
|
14
|
+
]"
|
|
13
15
|
>
|
|
14
16
|
<Slider
|
|
15
|
-
style="
|
|
16
|
-
width: 562px;
|
|
17
|
-
margin-left: 66px;
|
|
18
|
-
margin-right: 134px;
|
|
19
|
-
margin-top: 16px;
|
|
20
|
-
"
|
|
17
|
+
style="float: left; width: 562px; margin-right: 16px"
|
|
21
18
|
v-model="value.score"
|
|
22
19
|
:min="question.options.minRange"
|
|
23
20
|
:max="question.options.maxRange"
|
|
24
21
|
:step="sliderStep"
|
|
25
|
-
show-input
|
|
26
22
|
show-tips="always"
|
|
27
23
|
:disabled="question.options.readonly || question.options.disabled"
|
|
28
24
|
></Slider>
|
|
25
|
+
<InputNumber
|
|
26
|
+
style="float: left"
|
|
27
|
+
v-model="value.score"
|
|
28
|
+
:precision="question.options.decimalPlaces"
|
|
29
|
+
:min="question.options.minRange"
|
|
30
|
+
:max="question.options.maxRange"
|
|
31
|
+
>
|
|
32
|
+
</InputNumber>
|
|
29
33
|
</FormItem>
|
|
30
34
|
<div v-show="extremeValueLabelSelected">
|
|
31
|
-
<span style="
|
|
35
|
+
<span style="float: left; margin-left: 36px">
|
|
32
36
|
{{
|
|
33
37
|
t(
|
|
34
38
|
`survey_creator.question.scoring.extreme_value_labels.${question.options.extremeValueLabel}.minValue`
|
|
35
39
|
)
|
|
36
40
|
}}
|
|
37
41
|
</span>
|
|
38
|
-
<span
|
|
39
|
-
style="margin-right: 230px; float: right; align-items: flex-end"
|
|
40
|
-
>
|
|
42
|
+
<span style="float: right; align-items: flex-end; margin-right: 88px">
|
|
41
43
|
{{
|
|
42
44
|
t(
|
|
43
45
|
`survey_creator.question.scoring.extreme_value_labels.${question.options.extremeValueLabel}.maxValue`
|
|
@@ -60,33 +62,38 @@
|
|
|
60
62
|
<Row>
|
|
61
63
|
<div style="margin-right: 134px; margin-bottom: 18px">
|
|
62
64
|
<FormItem
|
|
63
|
-
|
|
64
|
-
:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
style="display: flex"
|
|
66
|
+
:prop="`answers[${index}].answer[${subIndex}].score`"
|
|
67
|
+
:rules="[
|
|
68
|
+
{
|
|
69
|
+
required:
|
|
70
|
+
question.options.required && !question.options.disabled,
|
|
71
|
+
message: t('survey_response.question.question_required'),
|
|
72
|
+
},
|
|
73
|
+
]"
|
|
69
74
|
>
|
|
70
75
|
<Slider
|
|
71
|
-
style="
|
|
72
|
-
width: 562px;
|
|
73
|
-
margin-left: 66px;
|
|
74
|
-
margin-right: 134px;
|
|
75
|
-
margin-top: 16px;
|
|
76
|
-
"
|
|
76
|
+
style="float: left; width: 562px; margin-right: 16px"
|
|
77
77
|
v-model="value.answer[subIndex].score"
|
|
78
78
|
:min="question.options.minRange"
|
|
79
79
|
:max="question.options.maxRange"
|
|
80
80
|
:step="sliderStep"
|
|
81
|
-
show-input
|
|
82
81
|
show-tips="always"
|
|
83
82
|
:disabled="
|
|
84
83
|
subQuestion.options.readonly || question.options.disabled
|
|
85
84
|
"
|
|
86
85
|
></Slider>
|
|
86
|
+
<InputNumber
|
|
87
|
+
style="float: left"
|
|
88
|
+
v-model="value.answer[subIndex].score"
|
|
89
|
+
:precision="question.options.decimalPlaces"
|
|
90
|
+
:min="question.options.minRange"
|
|
91
|
+
:max="question.options.maxRange"
|
|
92
|
+
>
|
|
93
|
+
</InputNumber>
|
|
87
94
|
</FormItem>
|
|
88
95
|
<div v-show="extremeValueLabelSelected">
|
|
89
|
-
<span style="
|
|
96
|
+
<span style="float: left; margin-left: 36px">
|
|
90
97
|
{{
|
|
91
98
|
t(
|
|
92
99
|
`survey_creator.question.scoring.extreme_value_labels.${question.options.extremeValueLabel}.minValue`
|
|
@@ -94,7 +101,7 @@
|
|
|
94
101
|
}}
|
|
95
102
|
</span>
|
|
96
103
|
<span
|
|
97
|
-
style="
|
|
104
|
+
style="float: right; align-items: flex-end; margin-right: 88px"
|
|
98
105
|
>
|
|
99
106
|
{{
|
|
100
107
|
t(
|
|
@@ -112,7 +119,7 @@
|
|
|
112
119
|
<script lang="ts">
|
|
113
120
|
import Vue from "vue";
|
|
114
121
|
import OptionLayoutMixin from "../../../mixins/option-layout-mixin";
|
|
115
|
-
import { Row, Slider, FormItem } from "view-design";
|
|
122
|
+
import { Row, Slider, FormItem, InputNumber } from "view-design";
|
|
116
123
|
import _ from "lodash";
|
|
117
124
|
|
|
118
125
|
export default Vue.extend({
|
|
@@ -124,6 +131,7 @@ export default Vue.extend({
|
|
|
124
131
|
Row,
|
|
125
132
|
Slider,
|
|
126
133
|
FormItem,
|
|
134
|
+
InputNumber,
|
|
127
135
|
},
|
|
128
136
|
props: {
|
|
129
137
|
question: {
|
|
@@ -137,7 +145,7 @@ export default Vue.extend({
|
|
|
137
145
|
},
|
|
138
146
|
},
|
|
139
147
|
data() {
|
|
140
|
-
return { value: this.answer
|
|
148
|
+
return { value: this.answer };
|
|
141
149
|
},
|
|
142
150
|
created() {
|
|
143
151
|
let subAnswers = {};
|
|
@@ -161,19 +169,19 @@ export default Vue.extend({
|
|
|
161
169
|
// @ts-ignore
|
|
162
170
|
this.value.answer.push(_answer);
|
|
163
171
|
});
|
|
164
|
-
|
|
165
|
-
_.each(this.value.answer, (a) => {
|
|
166
|
-
|
|
167
|
-
});
|
|
172
|
+
//
|
|
173
|
+
// _.each(this.value.answer, (a) => {
|
|
174
|
+
// _.set(this.answers, a.questionId, a.score);
|
|
175
|
+
// });
|
|
168
176
|
},
|
|
169
177
|
methods: {
|
|
170
|
-
getScore(subQuestion) {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
},
|
|
178
|
+
// getScore(subQuestion) {
|
|
179
|
+
// return _.get(
|
|
180
|
+
// this.answers,
|
|
181
|
+
// subQuestion.id,
|
|
182
|
+
// this.question.options.minRange
|
|
183
|
+
// );
|
|
184
|
+
// },
|
|
177
185
|
},
|
|
178
186
|
computed: {
|
|
179
187
|
showQuestionScoreSlider() {
|
|
@@ -195,32 +203,8 @@ export default Vue.extend({
|
|
|
195
203
|
_.forEach(this.value.answer, (a) => (a.score = 0));
|
|
196
204
|
}
|
|
197
205
|
},
|
|
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
206
|
"value.score": function () {
|
|
220
|
-
|
|
221
|
-
this.value.score = this.value.score.toFixed(
|
|
222
|
-
this.question.options.decimalPlaces
|
|
223
|
-
);
|
|
207
|
+
console.log();
|
|
224
208
|
},
|
|
225
209
|
},
|
|
226
210
|
});
|