@wg-npm/survey-response 0.3.4166 → 0.3.4371
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.
|
@@ -1235,6 +1235,7 @@ var script$2 = Vue.extend({
|
|
|
1235
1235
|
Col,
|
|
1236
1236
|
Card,
|
|
1237
1237
|
Icon,
|
|
1238
|
+
Tooltip,
|
|
1238
1239
|
STAR: Star,
|
|
1239
1240
|
EXPR: Expr,
|
|
1240
1241
|
},
|
|
@@ -1268,21 +1269,19 @@ var script$2 = Vue.extend({
|
|
|
1268
1269
|
const __vue_script__$2 = script$2;
|
|
1269
1270
|
|
|
1270
1271
|
/* template */
|
|
1271
|
-
var __vue_render__$2 = 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:"evaluation-item",attrs:{"xs":24,"sm":_vm.$rootComponent.layout === 'vertical' ? 24 : 6,"xl":_vm.$rootComponent.layout === 'vertical' ? 24 : 6,"md":_vm.$rootComponent.layout === 'vertical' ? 24 : 6,"lg":_vm.$rootComponent.layout === 'vertical' ? 24 : 6}},[_c('Card',{class:_vm.cardClasses(item.id),attrs:{"dis-hover":""}},[_c('div',{staticClass:"card-title",attrs:{"slot":"title"},slot:"title"},[_c('Icon',{staticClass:"icon",attrs:{"type":_vm.iconType(item.id),"size":36}})],1),_vm._v(" "),_c('div',{staticClass:"card-content"},[_c('
|
|
1272
|
+
var __vue_render__$2 = 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:"evaluation-item",attrs:{"xs":24,"sm":_vm.$rootComponent.layout === 'vertical' ? 24 : 6,"xl":_vm.$rootComponent.layout === 'vertical' ? 24 : 6,"md":_vm.$rootComponent.layout === 'vertical' ? 24 : 6,"lg":_vm.$rootComponent.layout === 'vertical' ? 24 : 6}},[_c('Card',{class:_vm.cardClasses(item.id),attrs:{"dis-hover":""}},[_c('div',{staticClass:"card-title",attrs:{"slot":"title"},slot:"title"},[_c('Icon',{staticClass:"icon",attrs:{"type":_vm.iconType(item.id),"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.i18nText(item.text)))]),_vm._v(" "),_c('p',{staticClass:"text"},[_vm._v(_vm._s(_vm.i18nText(item.text)))])]),_vm._v(" "),_c(_vm.question.options.evaluationType,{tag:"component",attrs:{"item":item}})],1)])],1)}),1):_vm._e()],1)};
|
|
1272
1273
|
var __vue_staticRenderFns__$2 = [];
|
|
1273
1274
|
|
|
1274
1275
|
/* style */
|
|
1275
|
-
const __vue_inject_styles__$2 =
|
|
1276
|
-
if (!inject) return
|
|
1277
|
-
inject("data-v-71844af4_0", { source: ".card-text[data-v-71844af4]{width:100%}", map: undefined, media: undefined });
|
|
1278
|
-
|
|
1279
|
-
};
|
|
1276
|
+
const __vue_inject_styles__$2 = undefined;
|
|
1280
1277
|
/* scoped */
|
|
1281
|
-
const __vue_scope_id__$2 =
|
|
1278
|
+
const __vue_scope_id__$2 = undefined;
|
|
1282
1279
|
/* module identifier */
|
|
1283
1280
|
const __vue_module_identifier__$2 = undefined;
|
|
1284
1281
|
/* functional template */
|
|
1285
1282
|
const __vue_is_functional_template__$2 = false;
|
|
1283
|
+
/* style inject */
|
|
1284
|
+
|
|
1286
1285
|
/* style inject SSR */
|
|
1287
1286
|
|
|
1288
1287
|
/* style inject shadow dom */
|
|
@@ -1297,7 +1296,7 @@ var __vue_staticRenderFns__$2 = [];
|
|
|
1297
1296
|
__vue_is_functional_template__$2,
|
|
1298
1297
|
__vue_module_identifier__$2,
|
|
1299
1298
|
false,
|
|
1300
|
-
|
|
1299
|
+
undefined,
|
|
1301
1300
|
undefined,
|
|
1302
1301
|
undefined
|
|
1303
1302
|
);
|
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.4371",
|
|
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.4371",
|
|
16
|
+
"@wg-npm/survey-service-api": "0.3.4371",
|
|
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.4371",
|
|
38
|
+
"@wg-npm/survey-service-api": "0.3.4371",
|
|
39
39
|
"acorn": "^7.3.1",
|
|
40
40
|
"axios": "^0.19.2",
|
|
41
41
|
"babelrc-rollup": "^3.0.0",
|
|
@@ -21,9 +21,10 @@
|
|
|
21
21
|
<Icon class="icon" :type="iconType(item.id)" :size="36" />
|
|
22
22
|
</div>
|
|
23
23
|
<div class="card-content">
|
|
24
|
-
<
|
|
25
|
-
<p
|
|
26
|
-
|
|
24
|
+
<Tooltip max-width="200">
|
|
25
|
+
<p slot="content">{{ i18nText(item.text) }}</p>
|
|
26
|
+
<p class="text">{{ i18nText(item.text) }}</p>
|
|
27
|
+
</Tooltip>
|
|
27
28
|
<component
|
|
28
29
|
:is="question.options.evaluationType"
|
|
29
30
|
:item="item"
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
|
|
38
39
|
<script lang="ts">
|
|
39
40
|
import Vue from "vue";
|
|
40
|
-
import { Col, Row, Card, Icon } from "view-design";
|
|
41
|
+
import { Col, Row, Card, Icon, Tooltip } from "view-design";
|
|
41
42
|
import LocaleMixin from "../../../mixins/locale-mixin";
|
|
42
43
|
import { QuestionEvaluationModel } from "@wg-npm/survey-core";
|
|
43
44
|
import Star from "./evaluation/star.vue";
|
|
@@ -50,6 +51,7 @@ export default Vue.extend({
|
|
|
50
51
|
Col,
|
|
51
52
|
Card,
|
|
52
53
|
Icon,
|
|
54
|
+
Tooltip,
|
|
53
55
|
STAR: Star,
|
|
54
56
|
EXPR: Expr,
|
|
55
57
|
},
|
|
@@ -79,9 +81,3 @@ export default Vue.extend({
|
|
|
79
81
|
},
|
|
80
82
|
});
|
|
81
83
|
</script>
|
|
82
|
-
|
|
83
|
-
<style lang="less" scoped>
|
|
84
|
-
.card-text {
|
|
85
|
-
width: 100%;
|
|
86
|
-
}
|
|
87
|
-
</style>
|
|
@@ -96,10 +96,20 @@
|
|
|
96
96
|
.card-content {
|
|
97
97
|
text-align: center;
|
|
98
98
|
|
|
99
|
+
.ivu-tooltip {
|
|
100
|
+
display: unset;
|
|
101
|
+
}
|
|
102
|
+
.ivu-tooltip-rel{
|
|
103
|
+
display: unset;
|
|
104
|
+
}
|
|
105
|
+
|
|
99
106
|
p.text {
|
|
100
107
|
font-weight: 500;
|
|
101
108
|
font-size: 18px;
|
|
102
109
|
padding: 10px;
|
|
110
|
+
white-space: nowrap;/*把文本强制显示在一行*/
|
|
111
|
+
overflow: hidden;/*隐藏超出部分的文字*/
|
|
112
|
+
text-overflow: ellipsis;/*超出显示省略号*/
|
|
103
113
|
}
|
|
104
114
|
|
|
105
115
|
.desc {
|
package/src/ellipsis-tooltip.ts
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import Vue from "vue";
|
|
2
|
-
|
|
3
|
-
const GLOBAL_TOOLTIP_ID = "ellipsis-directive-tooltip-" + Math.random();
|
|
4
|
-
const singleTipBox = function (maxWidth) {
|
|
5
|
-
let tipBox = document.getElementById(GLOBAL_TOOLTIP_ID);
|
|
6
|
-
if (!tipBox) {
|
|
7
|
-
tipBox = document.createElement("div");
|
|
8
|
-
tipBox.id = GLOBAL_TOOLTIP_ID;
|
|
9
|
-
tipBox.style.display = "none";
|
|
10
|
-
tipBox.style.position = "fixed";
|
|
11
|
-
tipBox.style.maxWidth = maxWidth + "px";
|
|
12
|
-
tipBox.style.padding = "8px 12px";
|
|
13
|
-
tipBox.style.backgroundColor = "rgba(70,76,91,.9)";
|
|
14
|
-
tipBox.style.borderRadius = "4px";
|
|
15
|
-
tipBox.style.boxShadow = "0 1px 6px rgba(0,0,0,.2)";
|
|
16
|
-
tipBox.style.color = "#fff";
|
|
17
|
-
tipBox.style.zIndex = "1200";
|
|
18
|
-
tipBox.style.wordWrap = "break-word";
|
|
19
|
-
tipBox.style.wordBreak = "break-all";
|
|
20
|
-
document.body.appendChild(tipBox);
|
|
21
|
-
|
|
22
|
-
tipBox.addEventListener("mouseover", (event) => {
|
|
23
|
-
// @ts-ignore
|
|
24
|
-
tipBox.style.display = "block";
|
|
25
|
-
});
|
|
26
|
-
tipBox.addEventListener("mouseout", (event) => {
|
|
27
|
-
// @ts-ignore
|
|
28
|
-
tipBox.style.display = "none";
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
return tipBox;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const createArrow = function () {
|
|
35
|
-
const arrow = document.createElement("div");
|
|
36
|
-
arrow.style.position = "absolute";
|
|
37
|
-
arrow.style.width = "0";
|
|
38
|
-
arrow.style.height = "0";
|
|
39
|
-
arrow.style.borderColor = "transparent";
|
|
40
|
-
arrow.style.borderStyle = "solid";
|
|
41
|
-
return arrow;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const setArrowStyle = function (event: MouseEvent, arrowEle, tipBox) {
|
|
45
|
-
if (event.clientY > tipBox.offsetTop) {
|
|
46
|
-
arrowEle.style.bottom = "-5px";
|
|
47
|
-
arrowEle.style.top = "auto";
|
|
48
|
-
arrowEle.style.borderWidth = "5px 5px 0";
|
|
49
|
-
arrowEle.style.borderTopColor = "rgba(70,76,91,.9)";
|
|
50
|
-
} else {
|
|
51
|
-
arrowEle.style.top = "-5px";
|
|
52
|
-
arrowEle.style.bottom = "auto";
|
|
53
|
-
arrowEle.style.borderWidth = "0 5px 5px";
|
|
54
|
-
arrowEle.style.borderBottomColor = "rgba(70,76,91,.9)";
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (event.clientX > tipBox.offsetLeft + 10) {
|
|
58
|
-
tipBox.style.display = "flex";
|
|
59
|
-
tipBox.style.justifyContent = "flex-end";
|
|
60
|
-
} else {
|
|
61
|
-
tipBox.style.display = "flex";
|
|
62
|
-
tipBox.style.justifyContent = "flex-start";
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const calcTextWidth = function (el) {
|
|
67
|
-
el.style.whiteSpace = "nowrap";
|
|
68
|
-
el.style.display = "inline-block";
|
|
69
|
-
const textWidth = el.offsetWidth;
|
|
70
|
-
el.style.display = "none";
|
|
71
|
-
return textWidth;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const calcParentWidth = function (el) {
|
|
75
|
-
el.style.display = "block";
|
|
76
|
-
return el.parentElement.offsetWidth;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const calcTipTop = function (el, tipBox) {
|
|
80
|
-
let tipTop = el.getBoundingClientRect().top + el.offsetHeight;
|
|
81
|
-
const tipBottom = tipTop + tipBox.offsetHeight;
|
|
82
|
-
if (window.innerHeight - tipBottom < 1) {
|
|
83
|
-
tipTop = tipTop - tipBox.offsetHeight - el.offsetHeight;
|
|
84
|
-
}
|
|
85
|
-
return tipTop + "px";
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const calcTopLeft = function (event, tipBox) {
|
|
89
|
-
let tipLeft = event.clientX - 10;
|
|
90
|
-
const tipRight = tipLeft + tipBox.offsetWidth;
|
|
91
|
-
if (window.innerWidth - tipRight < 1) {
|
|
92
|
-
tipLeft = tipLeft - tipBox.offsetWidth;
|
|
93
|
-
}
|
|
94
|
-
return tipLeft + "px";
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const ellipsis = function (el, defaultLine) {
|
|
98
|
-
const line = defaultLine || 1;
|
|
99
|
-
el.style.display = "-webkit-box";
|
|
100
|
-
el.style.webkitLineClamp = line;
|
|
101
|
-
el.style.webkitBoxOrient = "vertical";
|
|
102
|
-
el.style.textOverflow = "ellipsis";
|
|
103
|
-
el.style.overflow = "hidden";
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const show = function (tipBox) {
|
|
107
|
-
tipBox.style.display = "block";
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const hidden = function (tipBox) {
|
|
111
|
-
tipBox.style.display = "none";
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const contentText = function (tipBox, content) {
|
|
115
|
-
tipBox.innerText = content;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const ellipsisTip = function (el: HTMLElement, binding) {
|
|
119
|
-
const line = (binding.value && binding.value.defaultLine) || 1;
|
|
120
|
-
const textWidth = calcTextWidth(el);
|
|
121
|
-
const parentWidth = calcParentWidth(el);
|
|
122
|
-
el.style.whiteSpace = "normal";
|
|
123
|
-
if (textWidth > parentWidth * line) {
|
|
124
|
-
ellipsis(el, line);
|
|
125
|
-
const tipBox = singleTipBox(500);
|
|
126
|
-
const arrowEle = createArrow();
|
|
127
|
-
|
|
128
|
-
el.addEventListener("mousemove", (event) => {
|
|
129
|
-
contentText(
|
|
130
|
-
tipBox,
|
|
131
|
-
(binding.value && binding.value.content) || el.innerText
|
|
132
|
-
);
|
|
133
|
-
tipBox.appendChild(arrowEle);
|
|
134
|
-
show(tipBox);
|
|
135
|
-
el.style.cursor = "pointer";
|
|
136
|
-
tipBox.style.top = calcTipTop(el, tipBox);
|
|
137
|
-
tipBox.style.left = calcTopLeft(event, tipBox);
|
|
138
|
-
setArrowStyle(event, arrowEle, tipBox);
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
el.addEventListener("mouseout", (event) => {
|
|
142
|
-
hidden(tipBox);
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
Vue.directive("ellipsis-tip", {
|
|
148
|
-
bind: function (el, binding, vnode) {
|
|
149
|
-
window.addEventListener("resize", () => ellipsisTip(el, binding));
|
|
150
|
-
},
|
|
151
|
-
inserted: function (el, binding, vnode) {
|
|
152
|
-
ellipsisTip(el, binding);
|
|
153
|
-
},
|
|
154
|
-
componentUpdated(el, binding) {
|
|
155
|
-
ellipsisTip(el, binding);
|
|
156
|
-
},
|
|
157
|
-
unbind(el, binding) {
|
|
158
|
-
window.removeEventListener("resize", () => ellipsisTip(el, binding));
|
|
159
|
-
},
|
|
160
|
-
});
|