@wg-npm/survey-response 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.
@@ -254,7 +254,7 @@ var OptionLayoutMixin = Vue.extend({
254
254
  computed: {
255
255
  optionLayout() {
256
256
  const globalLayout = _.lowerCase(_.get(this.options, "layout", undefined));
257
- if (this.isMobile || "vertical" == globalLayout) {
257
+ if (this.isMobile() || "vertical" == globalLayout) {
258
258
  return "";
259
259
  }
260
260
  const questionLayout = _.lowerCase(_.get(this.question.options, "layout", "horizontal"));
@@ -1218,6 +1218,7 @@ var script$2 = Vue.extend({
1218
1218
  Col,
1219
1219
  Card,
1220
1220
  Icon,
1221
+ Tooltip,
1221
1222
  STAR: Star,
1222
1223
  EXPR: Expr
1223
1224
  },
@@ -1251,21 +1252,19 @@ var script$2 = Vue.extend({
1251
1252
  const __vue_script__$2 = script$2;
1252
1253
 
1253
1254
  /* template */
1254
- 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('div',{staticClass:"card-text"},[_c('p',{directives:[{name:"ellipsis-tip",rawName:"v-ellipsis-tip"}],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)};
1255
+ 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)};
1255
1256
  var __vue_staticRenderFns__$2 = [];
1256
1257
 
1257
1258
  /* style */
1258
- const __vue_inject_styles__$2 = function (inject) {
1259
- if (!inject) return
1260
- inject("data-v-3cf97b80_0", { source: ".card-text[data-v-3cf97b80]{width:100%}", map: undefined, media: undefined });
1261
-
1262
- };
1259
+ const __vue_inject_styles__$2 = undefined;
1263
1260
  /* scoped */
1264
- const __vue_scope_id__$2 = "data-v-3cf97b80";
1261
+ const __vue_scope_id__$2 = undefined;
1265
1262
  /* module identifier */
1266
1263
  const __vue_module_identifier__$2 = undefined;
1267
1264
  /* functional template */
1268
1265
  const __vue_is_functional_template__$2 = false;
1266
+ /* style inject */
1267
+
1269
1268
  /* style inject SSR */
1270
1269
 
1271
1270
  /* style inject shadow dom */
@@ -1280,7 +1279,7 @@ var __vue_staticRenderFns__$2 = [];
1280
1279
  __vue_is_functional_template__$2,
1281
1280
  __vue_module_identifier__$2,
1282
1281
  false,
1283
- createInjector,
1282
+ undefined,
1284
1283
  undefined,
1285
1284
  undefined
1286
1285
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wg-npm/survey-response",
3
- "version": "0.3.47",
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.47",
16
- "@wg-npm/survey-service-api": "0.3.47",
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
  "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.47",
38
- "@wg-npm/survey-service-api": "0.3.47",
37
+ "@wg-npm/survey-core": "0.3.4899.release",
38
+ "@wg-npm/survey-service-api": "0.3.4899.release",
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
- <div class="card-text">
25
- <p class="text" v-ellipsis-tip>{{ i18nText(item.text) }}</p>
26
- </div>
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>
@@ -16,7 +16,7 @@ export default Vue.extend({
16
16
  _.get(this.options, "layout", undefined)
17
17
  );
18
18
 
19
- if (this.isMobile || "vertical" == globalLayout) {
19
+ if (this.isMobile() || "vertical" == globalLayout) {
20
20
  return "";
21
21
  }
22
22
  const questionLayout = _.lowerCase(
@@ -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 {
@@ -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
- });