@wg-npm/survey-creator 0.3.7738 → 0.3.7746

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.
@@ -3203,26 +3203,35 @@ var script$d = Vue.extend({
3203
3203
  },
3204
3204
  methods: {
3205
3205
  createInitScoresOption() {
3206
+ let otherRange = _.map(this.otherConditions, (item) => {
3207
+ return {
3208
+ min: _.get(item, "payload.minScore", 0),
3209
+ max: _.get(item, "payload.maxScore", 0),
3210
+ };
3211
+ });
3206
3212
  this.leftScores = _.map(_.range(1, this.totalScore + 1, 1), function (num) {
3213
+ let disabled = _.some(otherRange, function (o) {
3214
+ return num >= o.min && num <= o.max;
3215
+ });
3207
3216
  return {
3208
3217
  value: num,
3209
3218
  label: num,
3210
- disabled: false
3219
+ disabled: disabled
3211
3220
  };
3212
3221
  });
3213
3222
  this.rightScores = _.map(_.range(1, this.totalScore + 1, 1), function (num) {
3223
+ let disabled = _.some(otherRange, function (o) {
3224
+ return num >= o.min && num <= o.max;
3225
+ });
3214
3226
  return {
3215
3227
  value: num,
3216
3228
  label: num,
3217
- disabled: false
3229
+ disabled: disabled
3218
3230
  };
3219
3231
  });
3220
3232
  },
3221
3233
  resetScoreOptions(options, type) {
3222
3234
  debugger;
3223
- if (this.otherConditions.length == 0) {
3224
- return;
3225
- }
3226
3235
  let otherRange = _.map(this.otherConditions, (item) => {
3227
3236
  return {
3228
3237
  min: _.get(item, "payload.minScore", 0),
@@ -3231,17 +3240,12 @@ var script$d = Vue.extend({
3231
3240
  });
3232
3241
  let currentValue = this.value;
3233
3242
  let currentTotalScore = this.totalScore;
3234
- _.map(options, function (o) {
3235
- let disabled = _.some(otherRange, function (or) {
3243
+ _.forEach(options, function (o) {
3244
+ o.disabled = _.some(otherRange, function (or) {
3236
3245
  let condition_a = o >= or.min && o <= or.max;
3237
3246
  let condition_b = type == "left" ? o.value >= _.get(currentValue, "minScore", 0) : o.value <= _.get(currentValue, "maxScore", currentTotalScore);
3238
3247
  return condition_a && condition_b;
3239
3248
  });
3240
- return {
3241
- value: o.value,
3242
- label: o.label,
3243
- disabled: disabled
3244
- };
3245
3249
  });
3246
3250
  },
3247
3251
  },
@@ -3256,7 +3260,7 @@ var __vue_render__$d = function () {var _vm=this;var _h=_vm.$createElement;var _
3256
3260
  type: 'number',
3257
3261
  trigger: 'change',
3258
3262
  message: _vm.t('survey_creator.question.scoreRequiredTip'),
3259
- }}},[_c('Select',{attrs:{"placeholder":_vm.t('survey_creator.question.selectScore')},on:{"on-change":function($event){return _vm.resetScoreOptions(_vm.leftScores,'left')}},model:{value:(_vm.value.minScore),callback:function ($$v) {_vm.$set(_vm.value, "minScore", $$v);},expression:"value.minScore"}},_vm._l((_vm.leftScores),function(score){return _c('Option',{key:score.value,attrs:{"value":score.value,"disabled":score.disabled}},[_vm._v("\n "+_vm._s(score)+"\n ")])}),1)],1)],1),_vm._v(" "),_c('Col',{attrs:{"span":3}},[_c('FormItem',{attrs:{"prop":("evaluationItems[" + _vm.itemIndex + "].conditions[" + _vm.index + "].payload.leftOperator"),"rules":{
3263
+ }}},[_c('Select',{attrs:{"placeholder":_vm.t('survey_creator.question.selectScore')},on:{"on-open-change":function($event){return _vm.resetScoreOptions(_vm.leftScores,'left')}},model:{value:(_vm.value.minScore),callback:function ($$v) {_vm.$set(_vm.value, "minScore", $$v);},expression:"value.minScore"}},_vm._l((_vm.leftScores),function(score){return _c('Option',{key:score.value,attrs:{"value":score.value,"disabled":score.disabled}},[_vm._v("\n "+_vm._s(score.value)+"\n ")])}),1)],1)],1),_vm._v(" "),_c('Col',{attrs:{"span":3}},[_c('FormItem',{attrs:{"prop":("evaluationItems[" + _vm.itemIndex + "].conditions[" + _vm.index + "].payload.leftOperator"),"rules":{
3260
3264
  required: true,
3261
3265
  trigger: 'change',
3262
3266
  message: _vm.t('survey_creator.question.notEmpty'),
@@ -3269,17 +3273,17 @@ var __vue_render__$d = function () {var _vm=this;var _h=_vm.$createElement;var _
3269
3273
  type: 'number',
3270
3274
  trigger: 'change',
3271
3275
  message: _vm.t('survey_creator.question.scoreRequiredTip'),
3272
- }}},[_c('Select',{attrs:{"placeholder":_vm.t('survey_creator.question.selectScore')},on:{"on-change":function($event){return _vm.resetScoreOptions(_vm.rightScores,'right')}},model:{value:(_vm.value.maxScore),callback:function ($$v) {_vm.$set(_vm.value, "maxScore", $$v);},expression:"value.maxScore"}},_vm._l((_vm.rightScores),function(score){return _c('Option',{key:score.value,attrs:{"value":score.value,"disabled":score.disabled}},[_vm._v("\n "+_vm._s(score)+"\n ")])}),1)],1)],1)],1)};
3276
+ }}},[_c('Select',{attrs:{"placeholder":_vm.t('survey_creator.question.selectScore')},on:{"on-open-change":function($event){return _vm.resetScoreOptions(_vm.rightScores,'right')}},model:{value:(_vm.value.maxScore),callback:function ($$v) {_vm.$set(_vm.value, "maxScore", $$v);},expression:"value.maxScore"}},_vm._l((_vm.rightScores),function(score){return _c('Option',{key:score.value,attrs:{"value":score.value,"disabled":score.disabled}},[_vm._v("\n "+_vm._s(score.value)+"\n ")])}),1)],1)],1)],1)};
3273
3277
  var __vue_staticRenderFns__$d = [];
3274
3278
 
3275
3279
  /* style */
3276
3280
  const __vue_inject_styles__$d = function (inject) {
3277
3281
  if (!inject) return
3278
- inject("data-v-29fedcdf_0", { source: ".label[data-v-29fedcdf]{text-align:right;margin-bottom:24px}[data-v-29fedcdf] .operator .ivu-select-selected-value{height:28px;line-height:28px}", map: undefined, media: undefined });
3282
+ inject("data-v-7ca5dfd2_0", { source: ".label[data-v-7ca5dfd2]{text-align:right;margin-bottom:24px}[data-v-7ca5dfd2] .operator .ivu-select-selected-value{height:28px;line-height:28px}", map: undefined, media: undefined });
3279
3283
 
3280
3284
  };
3281
3285
  /* scoped */
3282
- const __vue_scope_id__$d = "data-v-29fedcdf";
3286
+ const __vue_scope_id__$d = "data-v-7ca5dfd2";
3283
3287
  /* module identifier */
3284
3288
  const __vue_module_identifier__$d = undefined;
3285
3289
  /* functional template */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wg-npm/survey-creator",
3
- "version": "0.3.7738",
3
+ "version": "0.3.7746",
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.7738",
16
- "@wg-npm/survey-service-api": "0.3.7738",
15
+ "@wg-npm/survey-core": "0.3.7746",
16
+ "@wg-npm/survey-service-api": "0.3.7746",
17
17
  "axios": "^0.19.2",
18
18
  "camelcase": "^6.0.0",
19
19
  "deepmerge": "^4.2.2",
@@ -38,8 +38,8 @@
38
38
  "@typescript-eslint/eslint-plugin": "^3.6.0",
39
39
  "@typescript-eslint/parser": "^3.6.0",
40
40
  "@vue/eslint-config-prettier": "^6.0.0",
41
- "@wg-npm/survey-core": "0.3.7738",
42
- "@wg-npm/survey-service-api": "0.3.7738",
41
+ "@wg-npm/survey-core": "0.3.7746",
42
+ "@wg-npm/survey-service-api": "0.3.7746",
43
43
  "acorn": "^7.3.1",
44
44
  "axios": "^0.19.2",
45
45
  "babelrc-rollup": "^3.0.0",
@@ -18,7 +18,7 @@
18
18
  <Select
19
19
  v-model="value.minScore"
20
20
  :placeholder="t('survey_creator.question.selectScore')"
21
- @on-change="resetScoreOptions(leftScores,'left')"
21
+ @on-open-change="resetScoreOptions(leftScores,'left')"
22
22
  >
23
23
  <Option
24
24
  v-for="score in leftScores"
@@ -26,7 +26,7 @@
26
26
  :key="score.value"
27
27
  :disabled="score.disabled"
28
28
  >
29
- {{ score }}
29
+ {{ score.value }}
30
30
  </Option>
31
31
  </Select>
32
32
  </FormItem>
@@ -99,7 +99,7 @@
99
99
  <Select
100
100
  v-model="value.maxScore"
101
101
  :placeholder="t('survey_creator.question.selectScore')"
102
- @on-change="resetScoreOptions(rightScores,'right')"
102
+ @on-open-change="resetScoreOptions(rightScores,'right')"
103
103
  >
104
104
  <Option
105
105
  v-for="score in rightScores"
@@ -107,7 +107,7 @@
107
107
  :key="score.value"
108
108
  :disabled="score.disabled"
109
109
  >
110
- {{ score }}
110
+ {{ score.value }}
111
111
  </Option>
112
112
  </Select>
113
113
  </FormItem>
@@ -174,26 +174,36 @@
174
174
  },
175
175
  methods: {
176
176
  createInitScoresOption() {
177
+ let otherRange = _.map(this.otherConditions, (item) => {
178
+ return {
179
+ min: _.get(item, "payload.minScore", 0),
180
+ max: _.get(item, "payload.maxScore", 0),
181
+ };
182
+ });
183
+
177
184
  this.leftScores = _.map(_.range(1, this.totalScore + 1, 1), function (num) {
185
+ let disabled = _.some(otherRange, function (o) {
186
+ return num >= o.min && num <= o.max;
187
+ })
178
188
  return {
179
189
  value: num,
180
190
  label: num,
181
- disabled: false
191
+ disabled: disabled
182
192
  }
183
193
  })
184
194
  this.rightScores = _.map(_.range(1, this.totalScore + 1, 1), function (num) {
195
+ let disabled = _.some(otherRange, function (o) {
196
+ return num >= o.min && num <= o.max;
197
+ })
185
198
  return {
186
199
  value: num,
187
200
  label: num,
188
- disabled: false
201
+ disabled: disabled
189
202
  }
190
203
  })
191
204
  },
192
205
  resetScoreOptions(options, type) {
193
206
  debugger
194
- if (this.otherConditions.length == 0) {
195
- return
196
- }
197
207
  let otherRange = _.map(this.otherConditions, (item) => {
198
208
  return {
199
209
  min: _.get(item, "payload.minScore", 0),
@@ -204,17 +214,12 @@
204
214
  let currentValue = this.value;
205
215
  let currentTotalScore = this.totalScore;
206
216
 
207
- _.map(options, function (o) {
208
- let disabled = _.some(otherRange, function (or) {
217
+ _.forEach(options, function (o) {
218
+ o.disabled = _.some(otherRange, function (or) {
209
219
  let condition_a = o >= or.min && o <= or.max;
210
220
  let condition_b = type == "left" ? o.value >= _.get(currentValue, "minScore", 0) : o.value <= _.get(currentValue, "maxScore", currentTotalScore)
211
221
  return condition_a && condition_b;
212
222
  })
213
- return {
214
- value: o.value,
215
- label: o.label,
216
- disabled: disabled
217
- }
218
223
  })
219
224
  },
220
225
  },