@wg-npm/survey-response 0.5.161 → 0.5.165

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.
@@ -1,10 +1,10 @@
1
1
  import Vue from 'vue';
2
2
  import _ from 'lodash';
3
- import { Row, Icon, FormItem, CheckboxGroup, Checkbox, Col, Input, RadioGroup, Radio, Tooltip, Card, Slider, InputNumber, Form } from 'view-design';
4
- import { showInput, formatTitle, translate } from '@wg-npm/survey-core';
3
+ import { Row, Input, Icon, FormItem, CheckboxGroup, Checkbox, Col, RadioGroup, Radio, Tooltip, Card, Slider, InputNumber, Form } from 'view-design';
4
+ import { CUSTOM_INPUT_REG, formatTitle, translate } from '@wg-npm/survey-core';
5
5
  import deepmerge from 'deepmerge';
6
6
 
7
- var script$h = Vue.extend({
7
+ var script$i = Vue.extend({
8
8
  name: "empty-question",
9
9
  components: {
10
10
  Row,
@@ -142,42 +142,42 @@ function addStyle(id, css) {
142
142
  }
143
143
 
144
144
  /* script */
145
- const __vue_script__$h = script$h;
145
+ const __vue_script__$i = script$i;
146
146
  var __vue_render__$h = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"fill-width mb20 no-data"},[_c('Row',[_c('img',{staticClass:"empty_box-copy",attrs:{"src":__$_require_images_empty_box_copy_svg__}})]),_vm._v(" "),_c('Row',[_c('span',{staticClass:"no-data-span"},[_vm._v(_vm._s(_vm.$t("survey_response.question.noQuestion")))])])],1)};
147
147
  var __vue_staticRenderFns__$h = [];
148
148
 
149
149
  /* style */
150
- const __vue_inject_styles__$h = function (inject) {
150
+ const __vue_inject_styles__$i = function (inject) {
151
151
  if (!inject) return
152
152
  inject("data-v-9b95ccca_0", { source: ".fill-width[data-v-9b95ccca]{width:100%;text-align:center}.no-data span[data-v-9b95ccca]{text-align:center;color:rgba(0,0,0,.65)}.no-data .no-data-span[data-v-9b95ccca]{font-size:24px}", map: undefined, media: undefined });
153
153
 
154
154
  };
155
155
  /* scoped */
156
- const __vue_scope_id__$h = "data-v-9b95ccca";
156
+ const __vue_scope_id__$i = "data-v-9b95ccca";
157
157
  /* module identifier */
158
- const __vue_module_identifier__$h = undefined;
158
+ const __vue_module_identifier__$i = undefined;
159
159
  /* functional template */
160
- const __vue_is_functional_template__$h = false;
160
+ const __vue_is_functional_template__$i = false;
161
161
  /* style inject SSR */
162
162
 
163
163
  /* style inject shadow dom */
164
164
 
165
165
 
166
166
 
167
- const __vue_component__$h = /*#__PURE__*/normalizeComponent(
167
+ const __vue_component__$i = /*#__PURE__*/normalizeComponent(
168
168
  { render: __vue_render__$h, staticRenderFns: __vue_staticRenderFns__$h },
169
- __vue_inject_styles__$h,
170
- __vue_script__$h,
171
- __vue_scope_id__$h,
172
- __vue_is_functional_template__$h,
173
- __vue_module_identifier__$h,
169
+ __vue_inject_styles__$i,
170
+ __vue_script__$i,
171
+ __vue_scope_id__$i,
172
+ __vue_is_functional_template__$i,
173
+ __vue_module_identifier__$i,
174
174
  false,
175
175
  createInjector,
176
176
  undefined,
177
177
  undefined
178
178
  );
179
179
 
180
- var EmptyQuestion = __vue_component__$h;
180
+ var EmptyQuestion = __vue_component__$i;
181
181
 
182
182
  var OptionLayoutMixin = Vue.extend({
183
183
  props: {
@@ -202,6 +202,84 @@ var OptionLayoutMixin = Vue.extend({
202
202
  },
203
203
  });
204
204
 
205
+ var script$h = Vue.component("question-title-dynamic", {
206
+ components: { Input },
207
+ props: {
208
+ splitedTitles: {
209
+ type: Array,
210
+ required: true,
211
+ },
212
+ customFilledTitle: {
213
+ type: Array,
214
+ required: false,
215
+ },
216
+ },
217
+ render(createElement) {
218
+ let childArr = [];
219
+ const self = this;
220
+ console.log(typeof Input);
221
+ _.forEach(this.splitedTitles, (title, index) => {
222
+ if (CUSTOM_INPUT_REG.test(title)) {
223
+ let corespondTitle = _.find(self.customFilledTitle, (title) => {
224
+ return title.index === index;
225
+ });
226
+ childArr.push(createElement(Input, {
227
+ domProps: {
228
+ value: corespondTitle.title
229
+ },
230
+ on: {
231
+ input: function (value) {
232
+ corespondTitle.title = value;
233
+ }
234
+ }
235
+ }));
236
+ }
237
+ else {
238
+ childArr.push(title);
239
+ }
240
+ });
241
+ return createElement("div", { class: "content pl-sm" }, childArr);
242
+ }
243
+ });
244
+
245
+ /* script */
246
+ const __vue_script__$h = script$h;
247
+
248
+ /* template */
249
+
250
+ /* style */
251
+ const __vue_inject_styles__$h = function (inject) {
252
+ if (!inject) return
253
+ inject("data-v-000dd3ab_0", { source: "[data-v-000dd3ab] .ivu-input-wrapper{width:auto}", map: undefined, media: undefined });
254
+
255
+ };
256
+ /* scoped */
257
+ const __vue_scope_id__$h = "data-v-000dd3ab";
258
+ /* module identifier */
259
+ const __vue_module_identifier__$h = undefined;
260
+ /* functional template */
261
+ const __vue_is_functional_template__$h = undefined;
262
+ /* style inject SSR */
263
+
264
+ /* style inject shadow dom */
265
+
266
+
267
+
268
+ const __vue_component__$h = /*#__PURE__*/normalizeComponent(
269
+ {},
270
+ __vue_inject_styles__$h,
271
+ __vue_script__$h,
272
+ __vue_scope_id__$h,
273
+ __vue_is_functional_template__$h,
274
+ __vue_module_identifier__$h,
275
+ false,
276
+ createInjector,
277
+ undefined,
278
+ undefined
279
+ );
280
+
281
+ var QuestionTitleDynamic = __vue_component__$h;
282
+
205
283
  var QuestionMixin = Vue.extend({
206
284
  props: {
207
285
  index: Number,
@@ -224,25 +302,25 @@ var QuestionMixin = Vue.extend({
224
302
 
225
303
  var script$g = Vue.extend({
226
304
  name: "question-title",
305
+ components: { Icon, QuestionTitleDynamic },
227
306
  mixins: [OptionLayoutMixin, QuestionMixin],
228
- components: { Icon },
229
307
  inject: ["$rootComponent"],
230
308
  props: {
231
309
  index: {
232
310
  type: Number,
233
- default: 0
311
+ default: 0,
234
312
  },
235
313
  question: {
236
314
  type: Object,
237
- required: true
315
+ required: true,
238
316
  },
239
317
  language: {
240
- type: String
318
+ type: String,
241
319
  },
242
320
  customQuestion: {
243
321
  type: Object,
244
- required: false
245
- }
322
+ required: false,
323
+ },
246
324
  },
247
325
  computed: {
248
326
  customFilledTitle() {
@@ -253,26 +331,20 @@ var script$g = Vue.extend({
253
331
  },
254
332
  isSingleSelection() {
255
333
  return this.question.type == "SINGLE_SELECTION";
256
- }
334
+ },
257
335
  },
258
336
  methods: {
259
- getShowInput(index, formatTitle) {
260
- return showInput(index, formatTitle);
261
- },
262
337
  getTitle(question) {
263
338
  return formatTitle(question, this.$rootComponent.currentLanguage);
264
- }
265
- }
339
+ },
340
+ },
266
341
  });
267
342
 
268
343
  /* script */
269
344
  const __vue_script__$g = script$g;
270
345
 
271
346
  /* template */
272
- var __vue_render__$g = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"question-title",style:({'display':(_vm.isMobile()?'inline-block':'')})},[(_vm.question.type !== 'text_title')?_c('span',{staticClass:"pr-sm",style:({'display':(_vm.isMobile()?'inline-block':'')})},[(_vm.question.options.required)?_c('label',{staticClass:"require-label"},[_vm._v("*")]):_vm._e(),_vm._v(" "),(_vm.question.header.number)?_c('label',{staticClass:"number"},[_vm._v(_vm._s(_vm.question.header.number)+".")]):_vm._e()]):_vm._e(),_vm._v(" "),_vm._l((_vm.getTitle(_vm.question)),function(title,index){return _c('div',{key:index,staticClass:"flex",style:({'display':(_vm.isMobile()?'inline-block':'')})},[(title !== '')?_c('span',{staticClass:"content"},[_vm._v(_vm._s(title))]):_vm._e(),_vm._v(" "),_vm._l((_vm.customFilledTitle),function(customTitle){return _c('div',{key:index + customTitle.index},[(title === '' && index === customTitle.index)?_c('span',{staticClass:"content"},[_vm._v(_vm._s(customTitle.title))]):_c('div',[(
273
- _vm.getShowInput(index, _vm.getTitle(_vm.question)) &&
274
- index === customTitle.index
275
- )?_c('span',{staticClass:"content"},[_vm._v(_vm._s(customTitle.title))]):_vm._e()])])})],2)}),_vm._v(" "),(_vm.haveStar)?_c('span',{staticClass:"options-explain",style:({'display':(_vm.isMobile()?'block':'')})},[(_vm.isSingleSelection)?_c('span',[_vm._v("\n ("+_vm._s(_vm.t(
347
+ var __vue_render__$g = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"question-title"},[(_vm.question.type !== 'text_title')?_c('span',{staticClass:"pr-sm"},[(_vm.question.options.required)?_c('label',{staticClass:"require-label"},[_vm._v("*")]):_vm._e(),_vm._v(" "),(_vm.question.header.number)?_c('label',{staticClass:"number"},[_vm._v(_vm._s(_vm.question.header.number)+".")]):_vm._e()]):_vm._e(),_vm._v(" "),(_vm.question)?_c('question-title-dynamic',{attrs:{"splitedTitles":_vm.getTitle(_vm.question),"customFilledTitle":_vm.customFilledTitle}}):_vm._e(),_vm._v(" "),(_vm.haveStar)?_c('span',{staticClass:"options-explain",style:({'display':(_vm.isMobile()?'block':'')})},[(_vm.isSingleSelection)?_c('span',[_vm._v("\n ("+_vm._s(_vm.t(
276
348
  "survey_creator.question.star_single",
277
349
  _vm.$rootComponent.currentLanguage
278
350
  ))+"\n "),_c('span',[_c('Icon',{attrs:{"type":"md-star","color":"orange","size":16}})],1),_vm._v(")\n ")]):_c('span',[_vm._v("\n (\n "+_vm._s(_vm.t(
@@ -284,17 +356,17 @@ var __vue_render__$g = function () {var _vm=this;var _h=_vm.$createElement;var _
284
356
  ))+"\n "+_vm._s(_vm.question.options.starMinCount)+"\n "+_vm._s(_vm.t(
285
357
  "survey_creator.question.star_multi_suffix",
286
358
  _vm.$rootComponent.currentLanguage
287
- ))+"\n )\n ")],1)]):_vm._e()],2)};
359
+ ))+"\n )\n ")],1)]):_vm._e()],1)};
288
360
  var __vue_staticRenderFns__$g = [];
289
361
 
290
362
  /* style */
291
363
  const __vue_inject_styles__$g = function (inject) {
292
364
  if (!inject) return
293
- inject("data-v-67dae2e1_0", { source: ".flex[data-v-67dae2e1]{display:flex;align-items:center;white-space:nowrap}.pr-sm[data-v-67dae2e1]{padding-right:4px}", map: undefined, media: undefined });
365
+ inject("data-v-4b2b8b7e_0", { source: ".flex[data-v-4b2b8b7e]{display:flex;align-items:center;white-space:nowrap}.pr-sm[data-v-4b2b8b7e]{padding-right:4px}", map: undefined, media: undefined });
294
366
 
295
367
  };
296
368
  /* scoped */
297
- const __vue_scope_id__$g = "data-v-67dae2e1";
369
+ const __vue_scope_id__$g = "data-v-4b2b8b7e";
298
370
  /* module identifier */
299
371
  const __vue_module_identifier__$g = undefined;
300
372
  /* functional template */
@@ -1133,113 +1205,96 @@ var __vue_staticRenderFns__$9 = [];
1133
1205
 
1134
1206
  var Star = __vue_component__$9;
1135
1207
 
1136
- class ExprEvaluationQuestion {
1137
- questions;
1138
- scope;
1139
- questionMap;
1140
-
1141
- constructor(questions, scope) {
1142
- this.questions = questions;
1143
- this.scope = _.sortBy(scope);
1144
-
1145
- this.questionMap = this.buildQuestionMap();
1146
- }
1147
-
1148
- calculateNumbers() {
1149
- const checkedQuestions = this.checkedQuestion();
1150
- const checkedNumberElements = new Array();
1151
- this.recurs(checkedQuestions, checkedNumberElements);
1152
-
1153
- return checkedNumberElements;
1154
- }
1155
-
1156
- buildQuestionMap() {
1157
- const questionMap = {};
1158
- _.forEach(this.questions, (question) => {
1159
- questionMap[question.id] = question;
1160
- if (question.type == "MATRIX") {
1161
- _.forEach(_.get(question, "subQuestions", []), (subQuestion) => {
1162
- questionMap[subQuestion.id] = subQuestion;
1163
- });
1164
- }
1165
- });
1166
- return questionMap;
1167
- }
1168
-
1169
- checkedQuestion() {
1170
- const questions = new Array();
1171
- _.forEach(this.questions, (question) => {
1172
- if (_.get(question, "type") == "MATRIX") {
1173
- const markedQuestions = new Array();
1174
- _.forEach(_.get(question, "subQuestions", []), (subQuestion) => {
1175
- if (_.includes(this.scope, subQuestion.id)) {
1176
- const newSubQuestion = _.cloneDeep(subQuestion);
1177
- _.set(newSubQuestion, "type", "MATRIX");
1178
- _.set(newSubQuestion, "parentId", _.get(question, "id"));
1179
- markedQuestions.push(newSubQuestion);
1180
- }
1181
- });
1182
- if (!_.isEmpty(markedQuestions)) {
1183
- questions.push(markedQuestions);
1184
- }
1185
- } else if (_.includes(this.scope, question.id)) {
1186
- questions.push(question);
1187
- }
1188
- });
1189
- return questions;
1190
- }
1191
-
1192
- recurs(elements, numbers) {
1193
- for (let i = 0; i < elements.length; i++) {
1194
- const element = elements[i];
1195
- if (_.isArray(element)) {
1196
- numbers.push(new Array());
1197
- this.recurs(element, numbers[numbers.length - 1]);
1198
- } else {
1199
- const temp = new Array();
1200
- temp.push(this.getFullNumber(element));
1201
- if (i == elements.length - 1) {
1202
- numbers.push(temp);
1203
- continue;
1204
- }
1205
- for (let j = i + 1; ; j++) {
1206
- if (
1207
- j == elements.length ||
1208
- !this.isContinuous(elements[j - 1], elements[j])
1209
- ) {
1210
- numbers.push(temp);
1211
- i = j - 1;
1212
- break;
1213
- }
1214
- if (_.size(temp) > 1) {
1215
- temp.pop();
1216
- }
1217
- temp.push(this.getFullNumber(elements[j]));
1218
- }
1219
- }
1220
- }
1221
- }
1222
-
1223
- isContinuous(front, hind) {
1224
- return (
1225
- !_.isArray(hind) && this.getNumber(hind) - this.getNumber(front) == 1
1226
- );
1227
- }
1228
-
1229
- getFullNumber(question) {
1230
- if (question.type == "MATRIX") {
1231
- return (
1232
- this.questionMap[question.parentId].header.number +
1233
- "." +
1234
- this.getNumber(question)
1235
- );
1236
- }
1237
- return this.getNumber(question).toString();
1238
- }
1239
-
1240
- getNumber(question) {
1241
- return question.type == "MATRIX" ? question.number : question.header.number;
1242
- }
1208
+ class ExprEvaluationQuestion {
1209
+ constructor(questions, scope) {
1210
+ this.questions = questions;
1211
+ this.scope = _.sortBy(scope);
1212
+ this.questionMap = this.buildQuestionMap();
1213
+ }
1214
+ calculateNumbers() {
1215
+ const checkedQuestions = this.checkedQuestion();
1216
+ const checkedNumberElements = new Array();
1217
+ this.recurs(checkedQuestions, checkedNumberElements);
1218
+ return checkedNumberElements;
1219
+ }
1220
+ buildQuestionMap() {
1221
+ const questionMap = {};
1222
+ _.forEach(this.questions, (question) => {
1223
+ questionMap[question.id] = question;
1224
+ if (question.type == "MATRIX") {
1225
+ _.forEach(_.get(question, "subQuestions", []), (subQuestion) => {
1226
+ questionMap[subQuestion.id] = subQuestion;
1227
+ });
1228
+ }
1229
+ });
1230
+ return questionMap;
1231
+ }
1232
+ checkedQuestion() {
1233
+ const questions = new Array();
1234
+ _.forEach(this.questions, (question) => {
1235
+ if (_.get(question, "type") == "MATRIX") {
1236
+ const markedQuestions = new Array();
1237
+ _.forEach(_.get(question, "subQuestions", []), (subQuestion) => {
1238
+ if (_.includes(this.scope, subQuestion.id)) {
1239
+ const newSubQuestion = _.cloneDeep(subQuestion);
1240
+ _.set(newSubQuestion, "type", "MATRIX");
1241
+ _.set(newSubQuestion, "parentId", _.get(question, "id"));
1242
+ markedQuestions.push(newSubQuestion);
1243
+ }
1244
+ });
1245
+ if (!_.isEmpty(markedQuestions)) {
1246
+ questions.push(markedQuestions);
1247
+ }
1248
+ }
1249
+ else if (_.includes(this.scope, question.id)) {
1250
+ questions.push(question);
1251
+ }
1252
+ });
1253
+ return questions;
1254
+ }
1255
+ recurs(elements, numbers) {
1256
+ for (let i = 0; i < elements.length; i++) {
1257
+ const element = elements[i];
1258
+ if (_.isArray(element)) {
1259
+ numbers.push(new Array());
1260
+ this.recurs(element, numbers[numbers.length - 1]);
1261
+ }
1262
+ else {
1263
+ const temp = new Array();
1264
+ temp.push(this.getFullNumber(element));
1265
+ if (i == elements.length - 1) {
1266
+ numbers.push(temp);
1267
+ continue;
1268
+ }
1269
+ for (let j = i + 1;; j++) {
1270
+ if (j == elements.length ||
1271
+ !this.isContinuous(elements[j - 1], elements[j])) {
1272
+ numbers.push(temp);
1273
+ i = j - 1;
1274
+ break;
1275
+ }
1276
+ if (_.size(temp) > 1) {
1277
+ temp.pop();
1278
+ }
1279
+ temp.push(this.getFullNumber(elements[j]));
1280
+ }
1281
+ }
1282
+ }
1283
+ }
1284
+ isContinuous(front, hind) {
1285
+ return (!_.isArray(hind) && this.getNumber(hind) - this.getNumber(front) == 1);
1286
+ }
1287
+ getFullNumber(question) {
1288
+ if (question.type == "MATRIX") {
1289
+ return (this.questionMap[question.parentId].header.number +
1290
+ "." +
1291
+ this.getNumber(question));
1292
+ }
1293
+ return this.getNumber(question).toString();
1294
+ }
1295
+ getNumber(question) {
1296
+ return question.type == "MATRIX" ? question.number : question.header.number;
1297
+ }
1243
1298
  }
1244
1299
 
1245
1300
  const SPLIT_LENGTH = 50;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wg-npm/survey-response",
3
- "version": "0.5.161",
3
+ "version": "0.5.165",
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.5.161",
16
- "@wg-npm/survey-service-api": "0.5.161",
15
+ "@wg-npm/survey-core": "0.5.165",
16
+ "@wg-npm/survey-service-api": "0.5.165",
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.5.161",
38
- "@wg-npm/survey-service-api": "0.5.161",
37
+ "@wg-npm/survey-core": "0.5.165",
38
+ "@wg-npm/survey-service-api": "0.5.165",
39
39
  "acorn": "^7.3.1",
40
40
  "axios": "^0.19.2",
41
41
  "babelrc-rollup": "^3.0.0",
@@ -0,0 +1,56 @@
1
+ <script lang="ts">
2
+ import Vue, { CreateElement } from "vue";
3
+ import { Input } from "view-design";
4
+ import _ from "lodash";
5
+ import { CUSTOM_INPUT_REG } from "@wg-npm/survey-core";
6
+ import {Component} from "vue/types/options";
7
+
8
+ export default Vue.component("question-title-dynamic", {
9
+ components: { Input },
10
+ props: {
11
+ splitedTitles: {
12
+ type: Array,
13
+ required: true,
14
+ },
15
+ customFilledTitle: {
16
+ type: Array,
17
+ required: false,
18
+ },
19
+ },
20
+ render(createElement: CreateElement) {
21
+
22
+ let childArr: Array<any> = [];
23
+ const self = this;
24
+
25
+ console.log(typeof Input);
26
+
27
+ _.forEach(this.splitedTitles, (title: string, index: number) => {
28
+
29
+ if(CUSTOM_INPUT_REG.test(title)) {
30
+ let corespondTitle = _.find(self.customFilledTitle, (title) => {
31
+ return title.index === index;
32
+ });
33
+ childArr.push(createElement(Input as Component, {
34
+ domProps: {
35
+ value: corespondTitle.title
36
+ },
37
+ on: {
38
+ input: function (value) {
39
+ corespondTitle.title = value;
40
+ }
41
+ }
42
+ }));
43
+ } else {
44
+ childArr.push(title);
45
+ }
46
+ });
47
+ return createElement("div", { class: "content pl-sm"}, childArr);
48
+ }
49
+ });
50
+ </script>
51
+
52
+ <style scoped lang="less">
53
+ /deep/ .ivu-input-wrapper {
54
+ width: auto;
55
+ }
56
+ </style>
@@ -1,37 +1,12 @@
1
1
  <template>
2
- <div class="question-title" :style="{'display':(isMobile()?'inline-block':'')}">
3
- <span v-if="question.type !== 'text_title'" class="pr-sm" :style="{'display':(isMobile()?'inline-block':'')}">
2
+ <div class="question-title">
3
+ <span v-if="question.type !== 'text_title'" class="pr-sm">
4
4
  <label v-if="question.options.required" class="require-label">*</label>
5
5
  <label v-if="question.header.number" class="number"
6
- >{{ question.header.number }}.</label
6
+ >{{ question.header.number }}.</label
7
7
  >
8
8
  </span>
9
-
10
- <div class="flex" v-for="(title, index) in getTitle(question)" :key="index" :style="{'display':(isMobile()?'inline-block':'')}">
11
- <span v-if="title !== ''" class="content">{{ title }}</span>
12
- <div
13
- v-for="customTitle in customFilledTitle"
14
- :key="index + customTitle.index"
15
- >
16
- <span
17
- class="content"
18
- v-if="title === '' && index === customTitle.index"
19
- >{{ customTitle.title }}</span
20
- >
21
-
22
- <div v-else>
23
- <span
24
- class="content"
25
- v-if="
26
- getShowInput(index, getTitle(question)) &&
27
- index === customTitle.index
28
- "
29
- >{{ customTitle.title }}</span
30
- >
31
- </div>
32
- </div>
33
- </div>
34
-
9
+ <question-title-dynamic v-if="question" :splitedTitles="getTitle(question)" :customFilledTitle="customFilledTitle"></question-title-dynamic>
35
10
  <span class="options-explain" v-if="haveStar" :style="{'display':(isMobile()?'block':'')}">
36
11
  <span v-if="isSingleSelection">
37
12
  ({{
@@ -70,69 +45,64 @@
70
45
  </div>
71
46
  </template>
72
47
  <script lang="ts">
73
- import Vue from "vue";
74
- import OptionLayoutMixin from "../../mixins/option-layout-mixin";
75
- import { Icon } from "view-design";
76
- import {
77
- BaseQuestionModel,
78
- formatTitle,
79
- QuestionType,
80
- showInput
81
- } from "@wg-npm/survey-core";
82
- import QuestionMixin from "../../mixins/question-mixin";
48
+ import Vue from "vue";
49
+ import { Icon } from "view-design";
50
+ import {
51
+ formatTitle,
52
+ QuestionType,
53
+ } from "@wg-npm/survey-core";
54
+ import OptionLayoutMixin from "../../mixins/option-layout-mixin";
55
+ import QuestionTitleDynamic from "./question-title-dynamic.vue";
56
+ import QuestionMixin from "../../mixins/question-mixin";
83
57
 
84
- export default Vue.extend({
85
- name: "question-title",
86
- mixins: [OptionLayoutMixin, QuestionMixin],
87
- components: { Icon },
88
- inject: ["$rootComponent"],
89
- props: {
90
- index: {
91
- type: Number,
92
- default: 0
93
- },
94
- question: {
95
- type: Object,
96
- required: true
97
- },
98
- language: {
99
- type: String
100
- },
101
- customQuestion: {
102
- type: Object,
103
- required: false
104
- }
58
+ export default Vue.extend({
59
+ name: "question-title",
60
+ components: { Icon, QuestionTitleDynamic },
61
+ mixins: [OptionLayoutMixin, QuestionMixin],
62
+ inject: ["$rootComponent"],
63
+ props: {
64
+ index: {
65
+ type: Number,
66
+ default: 0,
67
+ },
68
+ question: {
69
+ type: Object,
70
+ required: true,
71
+ },
72
+ language: {
73
+ type: String,
105
74
  },
106
- computed: {
107
- customFilledTitle() {
108
- return this.customQuestion?.filledTitle;
109
- },
110
- haveStar() {
111
- return this.question?.options?.starEnabled ?? false;
112
- },
113
- isSingleSelection() {
114
- return this.question.type == QuestionType.SINGLE_SELECTION;
115
- }
75
+ customQuestion: {
76
+ type: Object,
77
+ required: false,
116
78
  },
117
- methods: {
118
- getShowInput(index, formatTitle) {
119
- return showInput(index, formatTitle);
120
- },
121
- getTitle(question) {
122
- return formatTitle(question, this.$rootComponent.currentLanguage);
123
- }
124
- }
125
- });
79
+ },
80
+ computed: {
81
+ customFilledTitle() {
82
+ return this.customQuestion?.filledTitle;
83
+ },
84
+ haveStar() {
85
+ return this.question?.options?.starEnabled ?? false;
86
+ },
87
+ isSingleSelection() {
88
+ return this.question.type == QuestionType.SINGLE_SELECTION;
89
+ },
90
+ },
91
+ methods: {
92
+ getTitle(question) {
93
+ return formatTitle(question, this.$rootComponent.currentLanguage);
94
+ },
95
+ },
96
+ });
126
97
  </script>
127
98
 
128
99
  <style lang="less" scoped>
129
- .flex {
130
- display: flex;
131
- align-items: center;
132
- white-space: nowrap;
133
- }
134
-
135
- .pr-sm {
136
- padding-right: 4px;
137
- }
100
+ .flex {
101
+ display: flex;
102
+ align-items: center;
103
+ white-space: nowrap;
104
+ }
105
+ .pr-sm {
106
+ padding-right: 4px;
107
+ }
138
108
  </style>