@wg-npm/survey-response 0.5.138 → 0.5.140

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.
@@ -1595,6 +1595,9 @@ var script$3 = Vue.extend({
1595
1595
  _.forEach(this.value.answer, (a) => (a.score = 0));
1596
1596
  }
1597
1597
  },
1598
+ answer(n) {
1599
+ this.value = n;
1600
+ },
1598
1601
  },
1599
1602
  });
1600
1603
 
@@ -1683,7 +1686,7 @@ var script$2 = Vue.extend({
1683
1686
  type: Boolean,
1684
1687
  },
1685
1688
  isMoreSurvey: {
1686
- type: Boolean
1689
+ type: Boolean,
1687
1690
  },
1688
1691
  },
1689
1692
  methods: {
@@ -1804,6 +1807,10 @@ var SurveyResponseMixin = Vue.extend({
1804
1807
  }
1805
1808
  return question.type == "MULTI_SELECTION" ? [] : null;
1806
1809
  },
1810
+ saveSortNum() {
1811
+ const sortArr = this.sortQuestions.map((item) => item.id);
1812
+ return { cacheSortQuestionId: sortArr };
1813
+ },
1807
1814
  handleSelected(selected) {
1808
1815
  if (selected) {
1809
1816
  const currentSingleQuestion = this.sortQuestions.find((item) => item.id === selected.questionId);
@@ -1885,7 +1892,11 @@ var SurveyResponseMixin = Vue.extend({
1885
1892
  return !_.isEmpty(backgroundAnswer?.answer ?? null);
1886
1893
  },
1887
1894
  validate() {
1888
- return null;
1895
+ let result;
1896
+ this.$refs["responseForm"].validate((valid) => {
1897
+ result = valid;
1898
+ });
1899
+ return result;
1889
1900
  },
1890
1901
  getMaxScore(question) {
1891
1902
  if (question.type === "single_selection") {
@@ -1960,13 +1971,6 @@ var script$1 = Vue.extend({
1960
1971
  },
1961
1972
  },
1962
1973
  methods: {
1963
- validate() {
1964
- let result;
1965
- this.$refs["responseForm"].validate((valid) => {
1966
- result = valid;
1967
- });
1968
- return result;
1969
- },
1970
1974
  updateAnswerByQuestion(question, resetData) {
1971
1975
  this.$set(this.response.answers, question.originalIndex, resetData);
1972
1976
  },
@@ -2067,6 +2071,9 @@ var script = Vue.extend({
2067
2071
  type: Array,
2068
2072
  required: true,
2069
2073
  },
2074
+ options: {
2075
+ type: Object,
2076
+ },
2070
2077
  response: {
2071
2078
  type: Object,
2072
2079
  required: true,
@@ -2106,13 +2113,6 @@ var script = Vue.extend({
2106
2113
  },
2107
2114
  },
2108
2115
  methods: {
2109
- validate() {
2110
- let result;
2111
- this.$refs["responseForm"].validate((valid) => {
2112
- result = valid;
2113
- });
2114
- return result;
2115
- },
2116
2116
  updateAnswerByQuestion(question, resetData) {
2117
2117
  let surveyId = _.find(this.sortQuestions, (q) => q.id === question.id)?.surveyId;
2118
2118
  let surveyIndex = _.findIndex(this.surveys, (s) => s.id === surveyId);
@@ -2186,7 +2186,7 @@ const __vue_script__ = script;
2186
2186
  /* template */
2187
2187
  var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (!_vm.emptyQuestions)?_c('div',{staticClass:"survey-response-wrapper"},[_c('Form',{ref:"responseForm",attrs:{"model":_vm.responseSurveyAnswers,"disabled":_vm.readonly}},_vm._l((_vm.surveys),function(survey,surveyIndex){return _c('div',{key:surveyIndex},_vm._l((_vm.getFilterSortQuestions(survey.id)),function(question,index){return _c('div',{key:index,staticClass:"question"},[_c('question-title',{attrs:{"question":question,"custom-question":_vm.getCustomQuestion(question.id),"index":index}}),_vm._v(" "),_c('question-body',{attrs:{"question":_vm.calculateQuestion(question, question.originalIndex),"answer":_vm.responseSurveyAnswers.moreSurveyAnswers[surveyIndex].answers[
2188
2188
  question.originalIndex
2189
- ],"index":question.originalIndex,"survey-index":surveyIndex,"is-more-survey":true,"options":survey.options,"readonly":_vm.readonly},on:{"singleQuestion":_vm.handleSelected}})],1)}),0)}),0)],1):_c('empty-question')};
2189
+ ],"index":question.originalIndex,"survey-index":surveyIndex,"is-more-survey":true,"options":_vm.options,"readonly":_vm.readonly},on:{"singleQuestion":_vm.handleSelected}})],1)}),0)}),0)],1):_c('empty-question')};
2190
2190
  var __vue_staticRenderFns__ = [];
2191
2191
 
2192
2192
  /* style */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wg-npm/survey-response",
3
- "version": "0.5.138",
3
+ "version": "0.5.140",
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.5.138",
16
- "@wg-npm/survey-service-api": "0.5.138",
15
+ "@wg-npm/survey-core": "0.5.140",
16
+ "@wg-npm/survey-service-api": "0.5.140",
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.5.138",
38
- "@wg-npm/survey-service-api": "0.5.138",
37
+ "@wg-npm/survey-core": "0.5.140",
38
+ "@wg-npm/survey-service-api": "0.5.140",
39
39
  "acorn": "^7.3.1",
40
40
  "axios": "^0.19.2",
41
41
  "babelrc-rollup": "^3.0.0",
@@ -27,7 +27,7 @@
27
27
  :index="question.originalIndex"
28
28
  :survey-index="surveyIndex"
29
29
  :is-more-survey="true"
30
- :options="survey.options"
30
+ :options="options"
31
31
  :readonly="readonly"
32
32
  @singleQuestion="handleSelected"
33
33
  >
@@ -71,6 +71,9 @@ export default Vue.extend({
71
71
  type: Array,
72
72
  required: true,
73
73
  },
74
+ options: {
75
+ type: Object,
76
+ },
74
77
  response: {
75
78
  type: Object,
76
79
  required: true,
@@ -110,13 +113,6 @@ export default Vue.extend({
110
113
  },
111
114
  },
112
115
  methods: {
113
- validate() {
114
- let result;
115
- this.$refs["responseForm"].validate((valid) => {
116
- result = valid;
117
- });
118
- return result;
119
- },
120
116
  updateAnswerByQuestion(question, resetData) {
121
117
  let surveyId = _.find(
122
118
  this.sortQuestions,
@@ -53,7 +53,7 @@ export default Vue.extend({
53
53
  type: Boolean,
54
54
  },
55
55
  isMoreSurvey: {
56
- type: Boolean
56
+ type: Boolean,
57
57
  },
58
58
  },
59
59
  methods: {
@@ -211,6 +211,9 @@ export default Vue.extend({
211
211
  _.forEach(this.value.answer, (a) => (a.score = 0));
212
212
  }
213
213
  },
214
+ answer(n) {
215
+ this.value = n;
216
+ },
214
217
  },
215
218
  });
216
219
  </script>
@@ -95,13 +95,6 @@ export default Vue.extend({
95
95
  },
96
96
  },
97
97
  methods: {
98
- validate() {
99
- let result;
100
- this.$refs["responseForm"].validate((valid) => {
101
- result = valid;
102
- });
103
- return result;
104
- },
105
98
  updateAnswerByQuestion(question, resetData) {
106
99
  this.$set(this.response.answers, question.originalIndex, resetData);
107
100
  },
@@ -79,6 +79,10 @@ export default Vue.extend({
79
79
  }
80
80
  return question.type == "MULTI_SELECTION" ? [] : null;
81
81
  },
82
+ saveSortNum() {
83
+ const sortArr = this.sortQuestions.map((item) => item.id);
84
+ return { cacheSortQuestionId: sortArr };
85
+ },
82
86
  handleSelected(selected) {
83
87
  if (selected) {
84
88
  const currentSingleQuestion = this.sortQuestions.find(
@@ -209,7 +213,11 @@ export default Vue.extend({
209
213
  return !_.isEmpty(backgroundAnswer?.answer ?? null);
210
214
  },
211
215
  validate() {
212
- return null;
216
+ let result;
217
+ this.$refs["responseForm"].validate((valid) => {
218
+ result = valid;
219
+ });
220
+ return result;
213
221
  },
214
222
  getMaxScore(question) {
215
223
  if (question.type === "single_selection") {