@wg-npm/survey-creator 0.5.135 → 0.5.136

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.
@@ -915,11 +915,6 @@ var script$K = Vue.extend({
915
915
  required: false,
916
916
  default: true,
917
917
  },
918
- translate: {
919
- type: Boolean,
920
- required: false,
921
- default: true,
922
- },
923
918
  preview: {
924
919
  type: Boolean,
925
920
  required: false,
@@ -1334,6 +1329,24 @@ var script$G = Vue.extend({
1334
1329
  },
1335
1330
  },
1336
1331
  computed: {
1332
+ customQuestion() {
1333
+ let input_titles = [];
1334
+ _.each(this.formatTitle(this.question), (t, index) => {
1335
+ if (t === "" ||
1336
+ this.showInput(index, this.formatTitle(this.question))) {
1337
+ let title = {
1338
+ title: "",
1339
+ index: index,
1340
+ };
1341
+ input_titles.push(title);
1342
+ }
1343
+ });
1344
+ return {
1345
+ id: this.question.id,
1346
+ surveyId: this.survey.id,
1347
+ filledTitle: input_titles,
1348
+ };
1349
+ },
1337
1350
  enabledJump() {
1338
1351
  return (_.get(this.question, "type") === "SINGLE_SELECTION" &&
1339
1352
  _.get(this.$rootComponent, "surveyExtendOptions.enabledJump"));
@@ -1352,6 +1365,20 @@ var script$G = Vue.extend({
1352
1365
  onJump() {
1353
1366
  this.$rootComponent.onQuestionJump(this.question.id);
1354
1367
  },
1368
+ formatTitle(question) {
1369
+ let title = this.translate(question.header.text, true);
1370
+ if (!_.get(question, "options.richTextEnabled", false)) {
1371
+ return [title];
1372
+ }
1373
+ return title.split(/_{5,}/g);
1374
+ },
1375
+ showInput(index, formatTitle) {
1376
+ if (index === formatTitle.length - 2 &&
1377
+ formatTitle[formatTitle.length - 1] === "") {
1378
+ return false;
1379
+ }
1380
+ return index < formatTitle.length - 1;
1381
+ },
1355
1382
  },
1356
1383
  });
1357
1384
 
@@ -1359,7 +1386,7 @@ var script$G = Vue.extend({
1359
1386
  const __vue_script__$G = script$G;
1360
1387
 
1361
1388
  /* template */
1362
- var __vue_render__$G = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"question"},[_c('Row',{attrs:{"type":"flex","justify":"space-between","align":"middle"}},[_c('Col',[_c('question-title',{attrs:{"question":_vm.question,"max-score":true}})],1),_vm._v(" "),_c('Col',[_c('edit-question-toolbar',{attrs:{"enabled-jump":_vm.enabledJump,"question":_vm.question,"survey":_vm.survey},on:{"on-edit":_vm.onEdit,"on-copy":_vm.onCopy,"on-delete":_vm.onDelete,"on-jump":_vm.onJump}})],1)],1),_vm._v(" "),_vm._t("default")],2)};
1389
+ var __vue_render__$G = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"question"},[_c('Row',{attrs:{"type":"flex","justify":"space-between","align":"middle"}},[_c('Col',[_c('question-title',{attrs:{"question":_vm.question,"custom-question":_vm.customQuestion,"max-score":true}})],1),_vm._v(" "),_c('Col',[_c('edit-question-toolbar',{attrs:{"enabled-jump":_vm.enabledJump,"question":_vm.question,"survey":_vm.survey},on:{"on-edit":_vm.onEdit,"on-copy":_vm.onCopy,"on-delete":_vm.onDelete,"on-jump":_vm.onJump}})],1)],1),_vm._v(" "),_vm._t("default")],2)};
1363
1390
  var __vue_staticRenderFns__$G = [];
1364
1391
 
1365
1392
  /* style */
@@ -5979,7 +6006,7 @@ var script = Vue.extend({
5979
6006
  const __vue_script__ = script;
5980
6007
 
5981
6008
  /* template */
5982
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.currentSurvey)?_c('div',{staticClass:"survey-preview-wrapper"},[_c('Row',{attrs:{"type":"flex","justify":"space-between","align":"middle"}},[_c('Col',[(_vm.options.back)?_c('Button',{attrs:{"icon":"ios-arrow-back"},on:{"click":_vm.onBack}},[_vm._v("\n "+_vm._s(_vm.t("survey_creator.common.back"))+"\n ")]):_vm._e()],1),_vm._v(" "),_c('Col',[_c('toolbar',{attrs:{"survey":_vm.currentSurvey,"create-question":false,"translate":true,"preview":false,"change-language":_vm.options.changeLanguage}})],1)],1),_vm._v(" "),_c('div',{staticClass:"survey-editor-wrapper"},[_c('survey-internal-previewer',{attrs:{"survey":_vm.currentSurvey,"init-question-ids":_vm.initQuestionIds,"survey-custom-questions":_vm.currentSurveyCustom.questions},on:{"selected-question-ids":_vm.selectedQuestionIds}})],1)],1):_vm._e()};
6009
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.currentSurvey)?_c('div',{staticClass:"survey-preview-wrapper"},[_c('Row',{attrs:{"type":"flex","justify":"space-between","align":"middle"}},[_c('Col',[(_vm.options.back)?_c('Button',{attrs:{"icon":"ios-arrow-back"},on:{"click":_vm.onBack}},[_vm._v("\n "+_vm._s(_vm.t("survey_creator.common.back"))+"\n ")]):_vm._e()],1),_vm._v(" "),_c('Col',[_c('toolbar',{attrs:{"survey":_vm.currentSurvey,"create-question":false,"preview":false,"change-language":_vm.options.changeLanguage}})],1)],1),_vm._v(" "),_c('div',{staticClass:"survey-editor-wrapper"},[_c('survey-internal-previewer',{attrs:{"survey":_vm.currentSurvey,"init-question-ids":_vm.initQuestionIds,"survey-custom-questions":_vm.currentSurveyCustom.questions},on:{"selected-question-ids":_vm.selectedQuestionIds}})],1)],1):_vm._e()};
5983
6010
  var __vue_staticRenderFns__ = [];
5984
6011
 
5985
6012
  /* style */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wg-npm/survey-creator",
3
- "version": "0.5.135",
3
+ "version": "0.5.136",
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.135",
16
- "@wg-npm/survey-service-api": "0.5.135",
15
+ "@wg-npm/survey-core": "0.5.136",
16
+ "@wg-npm/survey-service-api": "0.5.136",
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.5.135",
42
- "@wg-npm/survey-service-api": "0.5.135",
41
+ "@wg-npm/survey-core": "0.5.136",
42
+ "@wg-npm/survey-service-api": "0.5.136",
43
43
  "acorn": "^7.3.1",
44
44
  "axios": "^0.19.2",
45
45
  "babelrc-rollup": "^3.0.0",
@@ -2,7 +2,11 @@
2
2
  <div class="question">
3
3
  <Row type="flex" justify="space-between" align="middle">
4
4
  <Col>
5
- <question-title :question="question" :max-score="true" />
5
+ <question-title
6
+ :question="question"
7
+ :custom-question="customQuestion"
8
+ :max-score="true"
9
+ />
6
10
  </Col>
7
11
  <Col>
8
12
  <edit-question-toolbar
@@ -49,6 +53,27 @@ export default Vue.extend({
49
53
  },
50
54
  },
51
55
  computed: {
56
+ customQuestion() {
57
+ let input_titles: any = [];
58
+ _.each(this.formatTitle(this.question), (t, index) => {
59
+ if (
60
+ t === "" ||
61
+ this.showInput(index, this.formatTitle(this.question))
62
+ ) {
63
+ let title = {
64
+ title: "",
65
+ index: index,
66
+ };
67
+ input_titles.push(title);
68
+ }
69
+ });
70
+
71
+ return {
72
+ id: this.question.id,
73
+ surveyId: this.survey.id,
74
+ filledTitle: input_titles,
75
+ };
76
+ },
52
77
  enabledJump() {
53
78
  return (
54
79
  // @ts-ignore
@@ -71,6 +96,22 @@ export default Vue.extend({
71
96
  onJump() {
72
97
  this.$rootComponent.onQuestionJump(this.question.id);
73
98
  },
99
+ formatTitle(question) {
100
+ let title = this.translate(question.header.text, true);
101
+ if (!_.get(question, "options.richTextEnabled", false)) {
102
+ return [title];
103
+ }
104
+ return title.split(/_{5,}/g);
105
+ },
106
+ showInput(index, formatTitle) {
107
+ if (
108
+ index === formatTitle.length - 2 &&
109
+ formatTitle[formatTitle.length - 1] === ""
110
+ ) {
111
+ return false;
112
+ }
113
+ return index < formatTitle.length - 1;
114
+ },
74
115
  },
75
116
  });
76
117
  </script>
@@ -10,7 +10,6 @@
10
10
  <toolbar
11
11
  :survey="currentSurvey"
12
12
  :create-question="false"
13
- :translate="true"
14
13
  :preview="false"
15
14
  :change-language="options.changeLanguage"
16
15
  ></toolbar>
@@ -42,11 +42,6 @@ export default Vue.extend({
42
42
  required: false,
43
43
  default: true,
44
44
  },
45
- translate: {
46
- type: Boolean,
47
- required: false,
48
- default: true,
49
- },
50
45
  preview: {
51
46
  type: Boolean,
52
47
  required: false,
@@ -82,6 +82,8 @@
82
82
 
83
83
  .question-title {
84
84
  padding: 16px 0;
85
+ display: flex;
86
+ align-items: center;
85
87
 
86
88
  .star {
87
89
  color: red;