@wg-npm/survey-creator 0.5.161 → 0.5.164

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wg-npm/survey-creator",
3
- "version": "0.5.161",
3
+ "version": "0.5.164",
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.164",
16
+ "@wg-npm/survey-service-api": "0.5.164",
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.161",
42
- "@wg-npm/survey-service-api": "0.5.161",
41
+ "@wg-npm/survey-core": "0.5.164",
42
+ "@wg-npm/survey-service-api": "0.5.164",
43
43
  "acorn": "^7.3.1",
44
44
  "axios": "^0.19.2",
45
45
  "babelrc-rollup": "^3.0.0",
@@ -0,0 +1,55 @@
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
+
7
+ export default Vue.component("question-title-dynamic", {
8
+ components: { Input },
9
+ props: {
10
+ splitedTitles: {
11
+ type: Array,
12
+ required: true,
13
+ },
14
+ customFilledTitle: {
15
+ type: Array,
16
+ required: false,
17
+ },
18
+ },
19
+ render(createElement: CreateElement) {
20
+
21
+ let childArr: Array<any> = [];
22
+ const self = this;
23
+
24
+ console.log(typeof Input);
25
+
26
+ _.forEach(this.splitedTitles, (title: string, index: number) => {
27
+
28
+ if(CUSTOM_INPUT_REG.test(title)) {
29
+ let corespondTitle = _.find(self.customFilledTitle, (title) => {
30
+ return title.index === index;
31
+ });
32
+ childArr.push(createElement(Input, {
33
+ domProps: {
34
+ value: corespondTitle.title
35
+ },
36
+ on: {
37
+ input: function (value) {
38
+ corespondTitle.title = value;
39
+ }
40
+ }
41
+ }));
42
+ } else {
43
+ childArr.push(title);
44
+ }
45
+ });
46
+ return createElement("div", { class: "content pl-sm"}, childArr);
47
+ }
48
+ });
49
+ </script>
50
+
51
+ <style scoped lang="less">
52
+ /deep/ .ivu-input-wrapper {
53
+ width: auto;
54
+ }
55
+ </style>
@@ -4,35 +4,7 @@
4
4
  <span class="number pl-sm" v-if="question.header.number"
5
5
  >{{ question.header.number }}.</span
6
6
  >
7
-
8
- <div
9
- class="flex pl-sm"
10
- v-for="(title, index) in getTitle(question)"
11
- :key="index"
12
- >
13
- <span v-if="title !== ''" class="content">{{ title }}</span>
14
- <div
15
- v-for="customTitle in customFilledTitle"
16
- :key="index + customTitle.index"
17
- >
18
- <Input
19
- v-if="title === '' && index === customTitle.index"
20
- v-model.trim="customTitle.title"
21
- />
22
-
23
- <div v-else>
24
- <Input
25
- class="pl-sm"
26
- v-if="
27
- getShowInput(index, getTitle(question)) &&
28
- index === customTitle.index
29
- "
30
- v-model.trim="customTitle.title"
31
- />
32
- </div>
33
- </div>
34
- </div>
35
-
7
+ <question-title-dynamic v-if="question" :splitedTitles="getTitle(question)" :customFilledTitle="customFilledTitle"></question-title-dynamic>
36
8
  <span class="options-explain pl-sm title-score-related" v-if="haveMaxScore"
37
9
  >({{
38
10
  t(`survey_creator.question.max_score`, $rootComponent.currentLanguage)
@@ -90,15 +62,15 @@ import {
90
62
  BaseQuestionModel,
91
63
  formatTitle,
92
64
  QuestionType,
93
- showInput,
94
65
  } from "@wg-npm/survey-core";
95
66
  import { Icon, Input } from "view-design";
96
67
  import LocaleMixin from "../../mixins/locale-mixin";
68
+ import QuestionTitleDynamic from "./question-title-dynamic.vue";
97
69
  import _ from "lodash";
98
70
 
99
71
  export default Vue.extend({
100
72
  name: "question-title",
101
- components: { Icon, Input },
73
+ components: { Icon, Input, QuestionTitleDynamic },
102
74
  mixins: [LocaleMixin],
103
75
  inject: ["$rootComponent"],
104
76
  props: {
@@ -140,12 +112,9 @@ export default Vue.extend({
140
112
  },
141
113
  },
142
114
  methods: {
143
- getShowInput(index, formatTitle) {
144
- return showInput(index, formatTitle);
145
- },
146
115
  getTitle(question) {
147
116
  return formatTitle(question, Vue.$surveyLanguage);
148
- },
117
+ }
149
118
  },
150
119
  });
151
120
  </script>
@@ -32,8 +32,8 @@ import {
32
32
  BaseQuestionModel,
33
33
  QuestionType,
34
34
  SurveyModel,
35
- showInput,
36
35
  formatTitle,
36
+ CUSTOM_INPUT_REG,
37
37
  } from "@wg-npm/survey-core";
38
38
  import QuestionTitle from "../common/question-title.vue";
39
39
  import EditQuestionToolbar from "./editor-question-toolbar.vue";
@@ -58,10 +58,7 @@ export default Vue.extend({
58
58
  customQuestion() {
59
59
  let input_titles: any = [];
60
60
  _.each(formatTitle(this.question, Vue.$surveyLanguage), (t, index) => {
61
- if (
62
- t === "" ||
63
- showInput(index, formatTitle(this.question, Vue.$surveyLanguage))
64
- ) {
61
+ if (CUSTOM_INPUT_REG.test(t)) {
65
62
  let title = {
66
63
  title: "",
67
64
  index: index,
@@ -33,10 +33,9 @@ import Toolbar from "./toolbar/toolbar.vue";
33
33
  import SurveyInternalPreviewer from "./previewer/survey-internal-previewer.vue";
34
34
  import LocaleMixin from "../mixins/locale-mixin";
35
35
  import {
36
- BaseQuestionModel,
37
36
  SurveyModel,
38
37
  formatTitle,
39
- showInput,
38
+ CUSTOM_INPUT_REG,
40
39
  } from "@wg-npm/survey-core";
41
40
  import { SurveyPreviewerOptions } from "../../types/survey-previewer";
42
41
 
@@ -104,7 +103,7 @@ export default Vue.extend({
104
103
  let input_titles: any = [];
105
104
  let formatTitleStr = formatTitle(q, Vue.$surveyLanguage);
106
105
  _.each(formatTitleStr, (t, index) => {
107
- if (t === "" || showInput(index, formatTitleStr)) {
106
+ if (CUSTOM_INPUT_REG.test(t)) {
108
107
  let title = {
109
108
  title: "",
110
109
  index: index,