@wg-npm/survey-creator 0.3.47 → 0.3.489-9.release
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.
- package/dist/survey-creator.esm.js +30 -26
- package/package.json +5 -5
- package/src/components/common/question/evaluation.vue +6 -3
- package/src/components/editor/forms/evaluation-form.vue +4 -1
- package/src/components/editor/forms/fill-blank-form.vue +6 -0
- package/src/components/editor/forms/matrix-form.vue +6 -0
- package/src/components/editor/forms/multi-selection-form.vue +4 -0
- package/src/components/editor/forms/short-answer-form.vue +7 -1
- package/src/components/editor/forms/single-selection-form.vue +4 -0
- package/src/styles/components/survey-creator.less +9 -0
- package/src/styles/components/survey-preview.less +10 -0
|
@@ -287,7 +287,7 @@ class QuestionFactory {
|
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
createQuestion(questionType) {
|
|
290
|
-
|
|
290
|
+
const creator = this.creatorHash[questionType];
|
|
291
291
|
return creator(this.locale);
|
|
292
292
|
}
|
|
293
293
|
|
|
@@ -372,7 +372,7 @@ class BaseQuestionModel {
|
|
|
372
372
|
} else if (question.type == "MULTI_SELECTION") {
|
|
373
373
|
return _.sumBy(question.choices, item => parseFloat(_.get(item, "options.score") || 0));
|
|
374
374
|
} else if (question.type == "MATRIX") {
|
|
375
|
-
|
|
375
|
+
const score = _.max(_.map(question.choices, choice => parseFloat(_.get(choice, "options.score", 0) || 0)));
|
|
376
376
|
|
|
377
377
|
return score * question.subQuestions.length;
|
|
378
378
|
}
|
|
@@ -396,7 +396,7 @@ class BaseQuestionModel {
|
|
|
396
396
|
|
|
397
397
|
static calculationAllQuestionCount(questions) {
|
|
398
398
|
let count = 0;
|
|
399
|
-
|
|
399
|
+
const exclude = ["TEXT_TITLE"];
|
|
400
400
|
|
|
401
401
|
_.forEach(questions, question => {
|
|
402
402
|
if (!_.includes(exclude, question.type)) {
|
|
@@ -486,7 +486,7 @@ class QuestionMatrixModel extends BaseQuestionModel {
|
|
|
486
486
|
}
|
|
487
487
|
|
|
488
488
|
static getNumber(preNumber, question) {
|
|
489
|
-
|
|
489
|
+
const number = preNumber + 1;
|
|
490
490
|
|
|
491
491
|
_.forEach(question.subQuestions, (sq, index) => {
|
|
492
492
|
sq.number = index + 1;
|
|
@@ -504,17 +504,17 @@ const EN_US = _.camelCase("en-US");
|
|
|
504
504
|
const ZH_TW = _.camelCase("zh-TW");
|
|
505
505
|
|
|
506
506
|
function getValue(obj, locale) {
|
|
507
|
-
|
|
507
|
+
const value = _.get(obj, _.camelCase(locale), "");
|
|
508
508
|
|
|
509
509
|
if (!_.isEmpty(value)) {
|
|
510
510
|
return value;
|
|
511
511
|
}
|
|
512
512
|
|
|
513
|
-
return _.get(obj, locale,
|
|
513
|
+
return _.get(obj, locale, "");
|
|
514
514
|
}
|
|
515
515
|
|
|
516
516
|
function translate(obj, locale, prettyMath = false) {
|
|
517
|
-
|
|
517
|
+
const value = getValue(obj, locale);
|
|
518
518
|
|
|
519
519
|
if (!_.isEmpty(value) || !prettyMath) {
|
|
520
520
|
return value;
|
|
@@ -1976,7 +1976,7 @@ var __vue_staticRenderFns__$q = [];
|
|
|
1976
1976
|
var script$p = Vue.extend({
|
|
1977
1977
|
name: "Evaluation",
|
|
1978
1978
|
components: {
|
|
1979
|
-
Row, Col, Checkbox, CheckboxGroup, Card, Icon,
|
|
1979
|
+
Row, Col, Checkbox, CheckboxGroup, Card, Icon, Tooltip,
|
|
1980
1980
|
STAR: Star$1,
|
|
1981
1981
|
EXPR: Expr$1,
|
|
1982
1982
|
},
|
|
@@ -1993,7 +1993,7 @@ var script$p = Vue.extend({
|
|
|
1993
1993
|
const __vue_script__$p = script$p;
|
|
1994
1994
|
|
|
1995
1995
|
/* template */
|
|
1996
|
-
var __vue_render__$p = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[(_vm.question.evaluationItems.length > 0)?_c('Row',{attrs:{"type":"flex","justify":"start","gutter":24}},_vm._l((_vm.question.evaluationItems),function(item){return _c('Col',{key:item.id,staticClass:"col-padding"},[_c('Card',{staticClass:"evaluation-cards-default",attrs:{"dis-hover":""}},[_c('div',{staticClass:"card-title",attrs:{"slot":"title"},slot:"title"},[_c('Icon',{staticClass:"icon",attrs:{"type":"ios-checkmark-circle-outline","size":36}})],1),_vm._v(" "),_c('div',{staticClass:"card-content"},[_c('p',{staticClass:"text"},[_vm._v(_vm._s(_vm._f("translate")(item.text,true)))]),_vm._v(" "),_c(_vm.question.options.evaluationType,{tag:"component",attrs:{"item":item}})],1)])],1)}),1):_vm._e()],1)};
|
|
1996
|
+
var __vue_render__$p = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[(_vm.question.evaluationItems.length > 0)?_c('Row',{attrs:{"type":"flex","justify":"start","gutter":24}},_vm._l((_vm.question.evaluationItems),function(item){return _c('Col',{key:item.id,staticClass:"col-padding"},[_c('Card',{staticClass:"evaluation-cards-default",attrs:{"dis-hover":""}},[_c('div',{staticClass:"card-title",attrs:{"slot":"title"},slot:"title"},[_c('Icon',{staticClass:"icon",attrs:{"type":"ios-checkmark-circle-outline","size":36}})],1),_vm._v(" "),_c('div',{staticClass:"card-content"},[_c('Tooltip',{attrs:{"max-width":"200"}},[_c('p',{attrs:{"slot":"content"},slot:"content"},[_vm._v(_vm._s(_vm._f("translate")(item.text,true)))]),_vm._v(" "),_c('p',{staticClass:"text"},[_vm._v(_vm._s(_vm._f("translate")(item.text,true)))])]),_vm._v(" "),_c(_vm.question.options.evaluationType,{tag:"component",attrs:{"item":item}})],1)])],1)}),1):_vm._e()],1)};
|
|
1997
1997
|
var __vue_staticRenderFns__$p = [];
|
|
1998
1998
|
|
|
1999
1999
|
/* style */
|
|
@@ -2323,11 +2323,11 @@ var __vue_staticRenderFns__$l = [];
|
|
|
2323
2323
|
/* style */
|
|
2324
2324
|
const __vue_inject_styles__$l = function (inject) {
|
|
2325
2325
|
if (!inject) return
|
|
2326
|
-
inject("data-v-
|
|
2326
|
+
inject("data-v-2daf3a59_0", { source: ".question-options[data-v-2daf3a59]{padding-bottom:10px;padding-left:80px}[data-v-2daf3a59] .ivu-form-item{width:100%}", map: undefined, media: undefined });
|
|
2327
2327
|
|
|
2328
2328
|
};
|
|
2329
2329
|
/* scoped */
|
|
2330
|
-
const __vue_scope_id__$l = "data-v-
|
|
2330
|
+
const __vue_scope_id__$l = "data-v-2daf3a59";
|
|
2331
2331
|
/* module identifier */
|
|
2332
2332
|
const __vue_module_identifier__$l = undefined;
|
|
2333
2333
|
/* functional template */
|
|
@@ -2435,11 +2435,11 @@ var __vue_staticRenderFns__$k = [];
|
|
|
2435
2435
|
/* style */
|
|
2436
2436
|
const __vue_inject_styles__$k = function (inject) {
|
|
2437
2437
|
if (!inject) return
|
|
2438
|
-
inject("data-v-
|
|
2438
|
+
inject("data-v-7e7a6272_0", { source: ".question-options[data-v-7e7a6272]{padding-bottom:10px;padding-left:80px}[data-v-7e7a6272] .ivu-form-item{width:100%}", map: undefined, media: undefined });
|
|
2439
2439
|
|
|
2440
2440
|
};
|
|
2441
2441
|
/* scoped */
|
|
2442
|
-
const __vue_scope_id__$k = "data-v-
|
|
2442
|
+
const __vue_scope_id__$k = "data-v-7e7a6272";
|
|
2443
2443
|
/* module identifier */
|
|
2444
2444
|
const __vue_module_identifier__$k = undefined;
|
|
2445
2445
|
/* functional template */
|
|
@@ -2482,20 +2482,22 @@ var script$j = Vue.extend({
|
|
|
2482
2482
|
const __vue_script__$j = script$j;
|
|
2483
2483
|
|
|
2484
2484
|
/* template */
|
|
2485
|
-
var __vue_render__$j = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('Form',{ref:"questionForm",attrs:{"model":_vm.editQuestion,"label-colon":false}},[_c('Form-item',{attrs:{"prop":'header.text.' + _vm.primaryLanguage,"rules":{required: true,
|
|
2485
|
+
var __vue_render__$j = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('Form',{ref:"questionForm",attrs:{"model":_vm.editQuestion,"label-colon":false}},[_c('Form-item',{attrs:{"prop":'header.text.' + _vm.primaryLanguage,"rules":{required: true,
|
|
2486
2486
|
message: _vm.t('survey_creator.question.titleRequiredTip')}}},[_c('label',{attrs:{"slot":"label"},slot:"label"},[_c('span'),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.t('survey_creator.page.question')))])]),_vm._v(" "),_c('Checkbox',{model:{value:(_vm.editQuestion.options.required),callback:function ($$v) {_vm.$set(_vm.editQuestion.options, "required", $$v);},expression:"editQuestion.options.required"}},[_vm._v(_vm._s(_vm.t('survey_creator.question.questionRequired')))]),_vm._v(" "),_c('Input',{attrs:{"placeholder":_vm.t('survey_creator.question.titleRequiredTip')},model:{value:(_vm.editQuestion.header.text[_vm.primaryLanguage]),callback:function ($$v) {_vm.$set(_vm.editQuestion.header.text, _vm.primaryLanguage, (typeof $$v === 'string'? $$v.trim(): $$v));},expression:"editQuestion.header.text[primaryLanguage]"}})],1)],1)};
|
|
2487
2487
|
var __vue_staticRenderFns__$j = [];
|
|
2488
2488
|
|
|
2489
2489
|
/* style */
|
|
2490
|
-
const __vue_inject_styles__$j =
|
|
2490
|
+
const __vue_inject_styles__$j = function (inject) {
|
|
2491
|
+
if (!inject) return
|
|
2492
|
+
inject("data-v-3a642ae8_0", { source: "[data-v-3a642ae8] .ivu-form-item{width:100%}", map: undefined, media: undefined });
|
|
2493
|
+
|
|
2494
|
+
};
|
|
2491
2495
|
/* scoped */
|
|
2492
|
-
const __vue_scope_id__$j =
|
|
2496
|
+
const __vue_scope_id__$j = "data-v-3a642ae8";
|
|
2493
2497
|
/* module identifier */
|
|
2494
2498
|
const __vue_module_identifier__$j = undefined;
|
|
2495
2499
|
/* functional template */
|
|
2496
2500
|
const __vue_is_functional_template__$j = false;
|
|
2497
|
-
/* style inject */
|
|
2498
|
-
|
|
2499
2501
|
/* style inject SSR */
|
|
2500
2502
|
|
|
2501
2503
|
/* style inject shadow dom */
|
|
@@ -2510,7 +2512,7 @@ var __vue_staticRenderFns__$j = [];
|
|
|
2510
2512
|
__vue_is_functional_template__$j,
|
|
2511
2513
|
__vue_module_identifier__$j,
|
|
2512
2514
|
false,
|
|
2513
|
-
|
|
2515
|
+
createInjector,
|
|
2514
2516
|
undefined,
|
|
2515
2517
|
undefined
|
|
2516
2518
|
);
|
|
@@ -2618,15 +2620,17 @@ var __vue_render__$i = function () {var _vm=this;var _h=_vm.$createElement;var _
|
|
|
2618
2620
|
var __vue_staticRenderFns__$i = [];
|
|
2619
2621
|
|
|
2620
2622
|
/* style */
|
|
2621
|
-
const __vue_inject_styles__$i =
|
|
2623
|
+
const __vue_inject_styles__$i = function (inject) {
|
|
2624
|
+
if (!inject) return
|
|
2625
|
+
inject("data-v-35ed96ec_0", { source: "[data-v-35ed96ec] .ivu-form-item{width:100%}", map: undefined, media: undefined });
|
|
2626
|
+
|
|
2627
|
+
};
|
|
2622
2628
|
/* scoped */
|
|
2623
|
-
const __vue_scope_id__$i =
|
|
2629
|
+
const __vue_scope_id__$i = "data-v-35ed96ec";
|
|
2624
2630
|
/* module identifier */
|
|
2625
2631
|
const __vue_module_identifier__$i = undefined;
|
|
2626
2632
|
/* functional template */
|
|
2627
2633
|
const __vue_is_functional_template__$i = false;
|
|
2628
|
-
/* style inject */
|
|
2629
|
-
|
|
2630
2634
|
/* style inject SSR */
|
|
2631
2635
|
|
|
2632
2636
|
/* style inject shadow dom */
|
|
@@ -2641,7 +2645,7 @@ var __vue_staticRenderFns__$i = [];
|
|
|
2641
2645
|
__vue_is_functional_template__$i,
|
|
2642
2646
|
__vue_module_identifier__$i,
|
|
2643
2647
|
false,
|
|
2644
|
-
|
|
2648
|
+
createInjector,
|
|
2645
2649
|
undefined,
|
|
2646
2650
|
undefined
|
|
2647
2651
|
);
|
|
@@ -3484,11 +3488,11 @@ var __vue_staticRenderFns__$8 = [];
|
|
|
3484
3488
|
/* style */
|
|
3485
3489
|
const __vue_inject_styles__$8 = function (inject) {
|
|
3486
3490
|
if (!inject) return
|
|
3487
|
-
inject("data-v-
|
|
3491
|
+
inject("data-v-758574b8_0", { source: "[data-v-758574b8] .ivu-table-cell-slot .ivu-form-item{margin-bottom:4px;margin-top:0}[data-v-758574b8] .ivu-table-cell-slot .ivu-form-item-error{margin-bottom:24px;margin-top:0}[data-v-758574b8] .ivu-form-item{width:100%}", map: undefined, media: undefined });
|
|
3488
3492
|
|
|
3489
3493
|
};
|
|
3490
3494
|
/* scoped */
|
|
3491
|
-
const __vue_scope_id__$8 = "data-v-
|
|
3495
|
+
const __vue_scope_id__$8 = "data-v-758574b8";
|
|
3492
3496
|
/* module identifier */
|
|
3493
3497
|
const __vue_module_identifier__$8 = undefined;
|
|
3494
3498
|
/* functional template */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wg-npm/survey-creator",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4899.release",
|
|
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.4899.release",
|
|
16
|
+
"@wg-npm/survey-service-api": "0.3.4899.release",
|
|
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.
|
|
42
|
-
"@wg-npm/survey-service-api": "0.3.
|
|
41
|
+
"@wg-npm/survey-core": "0.3.4899.release",
|
|
42
|
+
"@wg-npm/survey-service-api": "0.3.4899.release",
|
|
43
43
|
"acorn": "^7.3.1",
|
|
44
44
|
"axios": "^0.19.2",
|
|
45
45
|
"babelrc-rollup": "^3.0.0",
|
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
<Icon class="icon" type="ios-checkmark-circle-outline" :size="36"/>
|
|
8
8
|
</div>
|
|
9
9
|
<div class="card-content">
|
|
10
|
-
<
|
|
10
|
+
<Tooltip max-width="200">
|
|
11
|
+
<p slot="content">{{ item.text | translate(true) }}</p>
|
|
12
|
+
<p class="text">{{ item.text | translate(true) }}</p>
|
|
13
|
+
</Tooltip>
|
|
11
14
|
<component :is="question.options.evaluationType" :item="item"></component>
|
|
12
15
|
</div>
|
|
13
16
|
</Card>
|
|
@@ -18,7 +21,7 @@
|
|
|
18
21
|
|
|
19
22
|
<script lang="ts">
|
|
20
23
|
import Vue from "vue";
|
|
21
|
-
import {Checkbox, Col, Row, CheckboxGroup, Card, Icon} from "view-design";
|
|
24
|
+
import {Checkbox, Col, Row, CheckboxGroup, Card, Icon, Tooltip} from "view-design";
|
|
22
25
|
import LocaleMixin from "../../../mixins/locale-mixin";
|
|
23
26
|
import {QuestionEvaluationModel, QuestionType} from "@wg-npm/survey-core";
|
|
24
27
|
import Star from "./evaluation/star.vue";
|
|
@@ -28,7 +31,7 @@
|
|
|
28
31
|
export default Vue.extend({
|
|
29
32
|
name: "Evaluation",
|
|
30
33
|
components: {
|
|
31
|
-
Row, Col, Checkbox, CheckboxGroup, Card, Icon,
|
|
34
|
+
Row, Col, Checkbox, CheckboxGroup, Card, Icon, Tooltip,
|
|
32
35
|
STAR: Star,
|
|
33
36
|
EXPR: Expr,
|
|
34
37
|
},
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<Form ref="questionForm" :model="editQuestion" :label-colon="false">
|
|
3
3
|
<Form-item
|
|
4
4
|
:prop="'header.text.' + primaryLanguage"
|
|
5
|
-
:rules="{required: true,
|
|
5
|
+
:rules="{required: true,
|
|
6
6
|
message: t('survey_creator.question.titleRequiredTip')}"
|
|
7
7
|
>
|
|
8
8
|
<label slot="label">
|
|
@@ -37,3 +37,9 @@
|
|
|
37
37
|
mixins: [questionFormMixin]
|
|
38
38
|
});
|
|
39
39
|
</script>
|
|
40
|
+
|
|
41
|
+
<style scoped lang="less">
|
|
42
|
+
/deep/ .ivu-form-item {
|
|
43
|
+
width: 100%;
|
|
44
|
+
}
|
|
45
|
+
</style>
|
|
@@ -189,11 +189,20 @@
|
|
|
189
189
|
|
|
190
190
|
.card-content {
|
|
191
191
|
text-align: center;
|
|
192
|
+
.ivu-tooltip {
|
|
193
|
+
display: unset;
|
|
194
|
+
}
|
|
195
|
+
.ivu-tooltip-rel{
|
|
196
|
+
display: unset;
|
|
197
|
+
}
|
|
192
198
|
|
|
193
199
|
.text {
|
|
194
200
|
font-weight: 500;
|
|
195
201
|
font-size: 18px;
|
|
196
202
|
padding: 10px;
|
|
203
|
+
white-space: nowrap;/*把文本强制显示在一行*/
|
|
204
|
+
overflow: hidden;/*隐藏超出部分的文字*/
|
|
205
|
+
text-overflow: ellipsis;/*超出显示省略号*/
|
|
197
206
|
}
|
|
198
207
|
}
|
|
199
208
|
}
|
|
@@ -132,10 +132,20 @@
|
|
|
132
132
|
.card-content {
|
|
133
133
|
text-align: center;
|
|
134
134
|
|
|
135
|
+
.ivu-tooltip {
|
|
136
|
+
display: unset;
|
|
137
|
+
}
|
|
138
|
+
.ivu-tooltip-rel{
|
|
139
|
+
display: unset;
|
|
140
|
+
}
|
|
141
|
+
|
|
135
142
|
.text {
|
|
136
143
|
font-weight: 500;
|
|
137
144
|
font-size: 18px;
|
|
138
145
|
padding: 10px;
|
|
146
|
+
white-space: nowrap;/*把文本强制显示在一行*/
|
|
147
|
+
overflow: hidden;/*隐藏超出部分的文字*/
|
|
148
|
+
text-overflow: ellipsis;/*超出显示省略号*/
|
|
139
149
|
}
|
|
140
150
|
}
|
|
141
151
|
}
|