@wg-npm/survey-creator 0.5.170 → 0.5.172

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.
@@ -429,6 +429,9 @@ class SubQuestionModel {
429
429
  this.text = defaultText(locale);
430
430
  this.number = null;
431
431
  }
432
+ static createSubPrefixId() {
433
+ return `SubQ-${_.now()}-`;
434
+ }
432
435
  }
433
436
  class BaseQuestionModel {
434
437
  constructor(type, locale) {
@@ -5920,6 +5923,12 @@ var script$1 = Vue.extend({
5920
5923
  createQuestionFrom(survey, fromQuestion) {
5921
5924
  let newQuestion = _.cloneDeep(fromQuestion);
5922
5925
  newQuestion.id = BaseQuestionModel.createQuestionId();
5926
+ if (fromQuestion.type === "MATRIX") {
5927
+ const subPrefix = SubQuestionModel.createSubPrefixId();
5928
+ newQuestion.subQuestions.forEach((element, index) => {
5929
+ newQuestion.subQuestions[index].id = subPrefix + index.toString();
5930
+ });
5931
+ }
5923
5932
  return newQuestion;
5924
5933
  },
5925
5934
  validateData() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wg-npm/survey-creator",
3
- "version": "0.5.170",
3
+ "version": "0.5.172",
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.170",
16
- "@wg-npm/survey-service-api": "0.5.170",
15
+ "@wg-npm/survey-core": "0.5.172",
16
+ "@wg-npm/survey-service-api": "0.5.172",
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.170",
42
- "@wg-npm/survey-service-api": "0.5.170",
41
+ "@wg-npm/survey-core": "0.5.172",
42
+ "@wg-npm/survey-service-api": "0.5.172",
43
43
  "acorn": "^7.3.1",
44
44
  "axios": "^0.19.2",
45
45
  "babelrc-rollup": "^3.0.0",
@@ -105,6 +105,8 @@
105
105
  import SurveyTranslatorMixin from "../mixins/survey-translator-mixin";
106
106
  import {
107
107
  BaseQuestionModel,
108
+ SubQuestionModel,
109
+ QuestionMatrixModel,
108
110
  QuestionFactory,
109
111
  QuestionType,
110
112
  SurveyLayout,
@@ -410,6 +412,12 @@
410
412
  createQuestionFrom(survey, fromQuestion) {
411
413
  let newQuestion: BaseQuestionModel = _.cloneDeep(fromQuestion);
412
414
  newQuestion.id = BaseQuestionModel.createQuestionId();
415
+ if (fromQuestion.type === QuestionType.MATRIX) {
416
+ const subPrefix = SubQuestionModel.createSubPrefixId();
417
+ (newQuestion as QuestionMatrixModel).subQuestions.forEach((element, index) => {
418
+ (newQuestion as QuestionMatrixModel).subQuestions[index].id = subPrefix + index.toString();
419
+ });
420
+ }
413
421
  return newQuestion;
414
422
  },
415
423
  validateData() {