@wg-npm/survey-response 0.3.3810 → 0.3.4062
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.
|
@@ -1013,14 +1013,14 @@ var script$5 = Vue.extend({
|
|
|
1013
1013
|
data() {
|
|
1014
1014
|
return {
|
|
1015
1015
|
desc: "",
|
|
1016
|
-
descTitle: ""
|
|
1016
|
+
descTitle: "",
|
|
1017
1017
|
};
|
|
1018
1018
|
},
|
|
1019
1019
|
props: {
|
|
1020
1020
|
conditions: {
|
|
1021
1021
|
type: Array,
|
|
1022
|
-
required: true
|
|
1023
|
-
}
|
|
1022
|
+
required: true,
|
|
1023
|
+
},
|
|
1024
1024
|
},
|
|
1025
1025
|
created() {
|
|
1026
1026
|
this.initialDesc();
|
|
@@ -1028,13 +1028,18 @@ var script$5 = Vue.extend({
|
|
|
1028
1028
|
computed: {
|
|
1029
1029
|
questions() {
|
|
1030
1030
|
return _.clone(this.survey.questions);
|
|
1031
|
-
}
|
|
1031
|
+
},
|
|
1032
1032
|
},
|
|
1033
1033
|
methods: {
|
|
1034
1034
|
getDesc(condition) {
|
|
1035
1035
|
let payload = condition.payload;
|
|
1036
1036
|
if (condition.type == "SCORE") {
|
|
1037
|
-
return this.t("survey_creator.question.evaluation.condition.score_template", [
|
|
1037
|
+
return this.t("survey_creator.question.evaluation.condition.score_template", [
|
|
1038
|
+
payload.minScore,
|
|
1039
|
+
payload.leftOperator,
|
|
1040
|
+
payload.rightOperator,
|
|
1041
|
+
payload.maxScore,
|
|
1042
|
+
]);
|
|
1038
1043
|
}
|
|
1039
1044
|
else {
|
|
1040
1045
|
let numbers = new ExprEvaluationQuestion(this.questions, payload.scope).calculateNumbers();
|
|
@@ -1068,20 +1073,21 @@ var script$5 = Vue.extend({
|
|
|
1068
1073
|
return chinese ? chinese.length : 0;
|
|
1069
1074
|
},
|
|
1070
1075
|
initialDesc() {
|
|
1071
|
-
let desc =
|
|
1076
|
+
let desc = "";
|
|
1072
1077
|
let ds = _.map(this.conditions, (c) => {
|
|
1073
1078
|
return this.getDesc(c);
|
|
1074
1079
|
});
|
|
1075
|
-
desc = _.join(ds,
|
|
1080
|
+
desc = _.join(ds, "</br>");
|
|
1076
1081
|
this.desc = desc;
|
|
1077
1082
|
let strLength = desc.length;
|
|
1078
1083
|
let cLength = this.getChineseLength(desc.substring(0, SPLIT_LENGTH));
|
|
1079
1084
|
if (strLength > SPLIT_LENGTH) {
|
|
1080
|
-
this.desc =
|
|
1085
|
+
this.desc =
|
|
1086
|
+
desc.substring(0, SPLIT_LENGTH - _.ceil(cLength / 2)) + "...";
|
|
1081
1087
|
}
|
|
1082
1088
|
this.descTitle = desc;
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1089
|
+
},
|
|
1090
|
+
},
|
|
1085
1091
|
});
|
|
1086
1092
|
|
|
1087
1093
|
/* script */
|
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.4062",
|
|
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.4062",
|
|
16
|
+
"@wg-npm/survey-service-api": "0.3.4062",
|
|
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.4062",
|
|
38
|
+
"@wg-npm/survey-service-api": "0.3.4062",
|
|
39
39
|
"acorn": "^7.3.1",
|
|
40
40
|
"axios": "^0.19.2",
|
|
41
41
|
"babelrc-rollup": "^3.0.0",
|
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Tooltip max-width="200">
|
|
3
3
|
<span v-html="this.descTitle" slot="content"></span>
|
|
4
|
-
<span v-html="this.desc" class="desc">
|
|
5
|
-
</span>
|
|
4
|
+
<span v-html="this.desc" class="desc"> </span>
|
|
6
5
|
</Tooltip>
|
|
7
6
|
</template>
|
|
8
7
|
|
|
9
8
|
<script lang="ts">
|
|
10
9
|
const SPLIT_LENGTH = 50;
|
|
11
10
|
import Vue from "vue";
|
|
12
|
-
import {Tooltip} from "view-design";
|
|
13
|
-
import {ExprConditionType} from "@wg-npm/survey-core/src/models";
|
|
11
|
+
import { Tooltip } from "view-design";
|
|
12
|
+
import { ExprConditionType } from "@wg-npm/survey-core/src/models";
|
|
14
13
|
import LocaleMixin from "../../../../mixins/locale-mixin";
|
|
15
14
|
import _ from "lodash";
|
|
16
|
-
import {ExprEvaluationQuestion} from "@wg-npm/survey-core/src/expr-evaluation-question";
|
|
15
|
+
import { ExprEvaluationQuestion } from "@wg-npm/survey-core/src/expr-evaluation-question";
|
|
17
16
|
|
|
18
17
|
export default Vue.extend({
|
|
19
18
|
name: "expr-if",
|
|
20
|
-
components: {Tooltip},
|
|
19
|
+
components: { Tooltip },
|
|
21
20
|
mixins: [LocaleMixin],
|
|
22
21
|
inject: ["survey"],
|
|
23
22
|
data() {
|
|
24
23
|
return {
|
|
25
24
|
desc: "",
|
|
26
|
-
descTitle: ""
|
|
27
|
-
}
|
|
25
|
+
descTitle: "",
|
|
26
|
+
};
|
|
28
27
|
},
|
|
29
28
|
props: {
|
|
30
29
|
conditions: {
|
|
31
30
|
type: Array,
|
|
32
|
-
required: true
|
|
33
|
-
}
|
|
31
|
+
required: true,
|
|
32
|
+
},
|
|
34
33
|
},
|
|
35
34
|
created() {
|
|
36
35
|
this.initialDesc();
|
|
@@ -38,7 +37,7 @@ export default Vue.extend({
|
|
|
38
37
|
computed: {
|
|
39
38
|
questions() {
|
|
40
39
|
return _.clone(this.survey.questions);
|
|
41
|
-
}
|
|
40
|
+
},
|
|
42
41
|
},
|
|
43
42
|
methods: {
|
|
44
43
|
getDesc(condition) {
|
|
@@ -46,7 +45,12 @@ export default Vue.extend({
|
|
|
46
45
|
if (condition.type == ExprConditionType.SCORE) {
|
|
47
46
|
return this.t(
|
|
48
47
|
"survey_creator.question.evaluation.condition.score_template",
|
|
49
|
-
[
|
|
48
|
+
[
|
|
49
|
+
payload.minScore,
|
|
50
|
+
payload.leftOperator,
|
|
51
|
+
payload.rightOperator,
|
|
52
|
+
payload.maxScore,
|
|
53
|
+
]
|
|
50
54
|
);
|
|
51
55
|
} else {
|
|
52
56
|
let numbers = new ExprEvaluationQuestion(
|
|
@@ -94,19 +98,20 @@ export default Vue.extend({
|
|
|
94
98
|
return chinese ? chinese.length : 0;
|
|
95
99
|
},
|
|
96
100
|
initialDesc() {
|
|
97
|
-
let desc =
|
|
101
|
+
let desc = "";
|
|
98
102
|
let ds = _.map(this.conditions, (c) => {
|
|
99
103
|
return this.getDesc(c);
|
|
100
104
|
});
|
|
101
|
-
desc = _.join(ds,
|
|
105
|
+
desc = _.join(ds, "</br>");
|
|
102
106
|
this.desc = desc;
|
|
103
107
|
let strLength = desc.length;
|
|
104
|
-
let cLength = this.getChineseLength(desc.substring(0, SPLIT_LENGTH))
|
|
108
|
+
let cLength = this.getChineseLength(desc.substring(0, SPLIT_LENGTH));
|
|
105
109
|
if (strLength > SPLIT_LENGTH) {
|
|
106
|
-
this.desc =
|
|
110
|
+
this.desc =
|
|
111
|
+
desc.substring(0, SPLIT_LENGTH - _.ceil(cLength / 2)) + "...";
|
|
107
112
|
}
|
|
108
113
|
this.descTitle = desc;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
114
|
+
},
|
|
115
|
+
},
|
|
111
116
|
});
|
|
112
117
|
</script>
|