survey-creator-core 1.9.95 → 1.9.96

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,5 +1,5 @@
1
1
  /*!
2
- * SurveyJS Creator v1.9.95
2
+ * SurveyJS Creator v1.9.96
3
3
  * (c) 2015-2023 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * Github: https://github.com/surveyjs/survey-creator
5
5
  * License: https://surveyjs.io/Licenses#SurveyCreator
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * SurveyJS Creator v1.9.95
2
+ * SurveyJS Creator v1.9.96
3
3
  * (c) 2015-2023 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * Github: https://github.com/surveyjs/survey-creator
5
5
  * License: https://surveyjs.io/Licenses#SurveyCreator
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * SurveyJS Creator v1.9.95
2
+ * SurveyJS Creator v1.9.96
3
3
  * (c) 2015-2023 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * Github: https://github.com/surveyjs/survey-creator
5
5
  * License: https://surveyjs.io/Licenses#SurveyCreator
@@ -1133,6 +1133,7 @@ __webpack_require__(/*! ./matrix-cell.scss */ "./src/components/matrix-cell.scss
1133
1133
  var MatrixCellWrapperEditSurvey = /** @class */ (function () {
1134
1134
  function MatrixCellWrapperEditSurvey(creator, cellQuestion) {
1135
1135
  this.cellQuestion = cellQuestion;
1136
+ this.creator = creator;
1136
1137
  var questionJSON = cellQuestion.toJSON();
1137
1138
  questionJSON.type = cellQuestion.getType();
1138
1139
  this.surveyValue = creator.createSurvey({ questions: [questionJSON] }, "modal-question-editor");
@@ -1163,8 +1164,11 @@ var MatrixCellWrapperEditSurvey = /** @class */ (function () {
1163
1164
  if (!!prevCellType) {
1164
1165
  questionJSON.cellType = prevCellType;
1165
1166
  }
1167
+ if (survey_core__WEBPACK_IMPORTED_MODULE_1__["Helpers"].isTwoValueEquals(questionJSON, columnJSON))
1168
+ return;
1166
1169
  column.fromJSON(questionJSON);
1167
1170
  matrix.onColumnCellTypeChanged(column);
1171
+ this.creator.setModified({ type: "MATRIX_CELL_EDITOR", column: column });
1168
1172
  };
1169
1173
  return MatrixCellWrapperEditSurvey;
1170
1174
  }());
@@ -9483,6 +9487,7 @@ var TestSurveyTabViewModel = /** @class */ (function (_super) {
9483
9487
  configurable: true
9484
9488
  });
9485
9489
  TestSurveyTabViewModel.prototype.updateSimulatorSurvey = function (json, theme) {
9490
+ var _this = this;
9486
9491
  var newSurvey = this.surveyProvider.createSurvey(json || {}, "test");
9487
9492
  if (this.surveyProvider.showThemeTab) {
9488
9493
  newSurvey.applyTheme(this.surveyProvider.theme);
@@ -9523,6 +9528,16 @@ var TestSurveyTabViewModel = /** @class */ (function (_super) {
9523
9528
  this.survey.onPageVisibleChanged.add(function (sender, options) {
9524
9529
  self.updatePageItem(options.page);
9525
9530
  });
9531
+ this.survey.onPopupVisibleChanged.add(function (_, options) {
9532
+ if (options.visible) {
9533
+ _this.onScrollCallback = function () {
9534
+ options.popup.toggleVisibility();
9535
+ };
9536
+ }
9537
+ else {
9538
+ _this.onScrollCallback = undefined;
9539
+ }
9540
+ });
9526
9541
  };
9527
9542
  TestSurveyTabViewModel.prototype.setJSON = function (json, currTheme) {
9528
9543
  this.json = json;
@@ -9704,6 +9719,11 @@ var TestSurveyTabViewModel = /** @class */ (function (_super) {
9704
9719
  this.nextPageAction.css = isNextEnabled ? "sv-action-bar-item--secondary" : "";
9705
9720
  this.nextPageAction.enabled = isNextEnabled;
9706
9721
  };
9722
+ TestSurveyTabViewModel.prototype.onScroll = function () {
9723
+ if (this.onScrollCallback)
9724
+ this.onScrollCallback();
9725
+ return true;
9726
+ };
9707
9727
  Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
9708
9728
  Object(survey_core__WEBPACK_IMPORTED_MODULE_2__["property"])({
9709
9729
  defaultValue: false,
@@ -9898,12 +9918,40 @@ survey_core__WEBPACK_IMPORTED_MODULE_0__["ComponentCollection"].Instance.add({
9898
9918
  titleLocation: "left"
9899
9919
  }
9900
9920
  ],
9921
+ onInit: function () {
9922
+ survey_core__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addProperty("colorsettings", {
9923
+ name: "choices:itemvalue[]"
9924
+ });
9925
+ },
9926
+ onLoaded: function (question) {
9927
+ syncPropertiesFromCompositeToColor(question, "titleLocation", question.titleLocation);
9928
+ syncPropertiesFromCompositeToColor(question, "choices", question.choices);
9929
+ },
9930
+ onPropertyChanged: function (question, propertyName, newValue) {
9931
+ syncPropertiesFromCompositeToColor(question, propertyName, newValue);
9932
+ },
9901
9933
  onCreated: function (question) {
9902
9934
  question.valueFromDataCallback = function (newValue) { return typeof newValue == "string" ? Object(_utils_utils__WEBPACK_IMPORTED_MODULE_2__["parseColor"])(newValue) : newValue; };
9903
9935
  question.valueToDataCallback = function (newValue) { return !!newValue ? (typeof newValue == "string" ? newValue : createColor(newValue)) : ""; };
9904
9936
  question.contentPanel.questions.forEach(function (q) { return q.allowRootStyle = false; });
9905
9937
  }
9906
9938
  });
9939
+ function syncPropertiesFromCompositeToColor(question, propertyName, newValue) {
9940
+ var colorQuestion = question.contentPanel.questions[0];
9941
+ if (propertyName == "titleLocation") {
9942
+ if (newValue == "left") {
9943
+ question.titleLocation = "hidden";
9944
+ colorQuestion.title = question.title;
9945
+ colorQuestion.titleLocation = newValue;
9946
+ }
9947
+ else {
9948
+ colorQuestion.titleLocation = "hidden";
9949
+ }
9950
+ }
9951
+ if (propertyName == "choices") {
9952
+ colorQuestion.choices = newValue;
9953
+ }
9954
+ }
9907
9955
  function createColor(value) {
9908
9956
  return Object(_utils_utils__WEBPACK_IMPORTED_MODULE_2__["ingectAlpha"])(value.color, value.opacity / 100);
9909
9957
  }
@@ -9987,6 +10035,7 @@ __webpack_require__.r(__webpack_exports__);
9987
10035
 
9988
10036
 
9989
10037
  var DefaultFonts = [
10038
+ "Open Sans",
9990
10039
  "Arial, sans-serif",
9991
10040
  "Brush Script MT, cursive",
9992
10041
  "Courier New, monospace",
@@ -10248,7 +10297,7 @@ var TabThemePlugin = /** @class */ (function () {
10248
10297
  return (_this.creator.activeTab === "theme");
10249
10298
  }),
10250
10299
  action: function () {
10251
- _this.model.applySelectedTheme();
10300
+ _this.model.resetTheme();
10252
10301
  }
10253
10302
  });
10254
10303
  items.push(this.resetTheme);
@@ -10458,16 +10507,13 @@ var ThemeSurveyTabViewModel = /** @class */ (function (_super) {
10458
10507
  enumerable: false,
10459
10508
  configurable: true
10460
10509
  });
10461
- ThemeSurveyTabViewModel.prototype.applySelectedTheme = function (saveChanges) {
10462
- if (saveChanges === void 0) { saveChanges = false; }
10510
+ ThemeSurveyTabViewModel.prototype.applySelectedTheme = function () {
10463
10511
  var newTheme = {};
10464
10512
  Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["assign"])(newTheme, Themes[this.getFullThemeName("default")], Themes[this.getFullThemeName()]);
10465
10513
  if (this.survey["isCompact"]) {
10466
10514
  Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["assign"])(newTheme, Themes[this.getFullThemeName() + "-lw"]);
10467
10515
  }
10468
- if (saveChanges) {
10469
- Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["assign"])(newTheme, this.themeChanges);
10470
- }
10516
+ Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["assign"])(newTheme, this.themeChanges);
10471
10517
  this.currentTheme.cssVariables = newTheme;
10472
10518
  this.loadThemeIntoPropertyGrid(this.themeEditorSurvey);
10473
10519
  this.setThemeToSurvey();
@@ -10612,6 +10658,10 @@ var ThemeSurveyTabViewModel = /** @class */ (function (_super) {
10612
10658
  }
10613
10659
  this.pageListItems = pages;
10614
10660
  };
10661
+ ThemeSurveyTabViewModel.prototype.resetTheme = function () {
10662
+ this.themeChanges = {};
10663
+ this.applySelectedTheme();
10664
+ };
10615
10665
  ThemeSurveyTabViewModel.prototype.show = function () {
10616
10666
  this.showInvisibleElements = false;
10617
10667
  this.activePage = this.survey.activePage;
@@ -10769,12 +10819,13 @@ var ThemeSurveyTabViewModel = /** @class */ (function (_super) {
10769
10819
  if (options.name === "themeMode") {
10770
10820
  _this.survey["isCompact"] = options.value === "lightweight";
10771
10821
  _this.currentTheme.isCompact = options.value === "lightweight";
10822
+ _this.applySelectedTheme();
10772
10823
  }
10773
10824
  else {
10774
10825
  _this.currentTheme["themeName"] = _this.themeName;
10775
10826
  _this.currentTheme["themePalette"] = _this.themePalette;
10827
+ _this.resetTheme();
10776
10828
  }
10777
- _this.applySelectedTheme(options.name === "themeMode");
10778
10829
  return;
10779
10830
  }
10780
10831
  if (["backgroundImage", "backgroundImageFit"].indexOf(options.name) !== -1) {
@@ -10858,7 +10909,7 @@ var ThemeSurveyTabViewModel = /** @class */ (function (_super) {
10858
10909
  themeEditorSurvey.getQuestionByName("questionTitle").contentPanel.getQuestionByName("color").value = newCssVariables["--sjs-general-forecolor"];
10859
10910
  themeEditorSurvey.getQuestionByName("questionDescription").contentPanel.getQuestionByName("color").value = newCssVariables["--sjs-general-forecolor-light"];
10860
10911
  themeEditorSurvey.getAllQuestions().forEach(function (question) {
10861
- if (["color"].indexOf(question.getType()) !== -1) {
10912
+ if (["color", "colorsettings"].indexOf(question.getType()) !== -1) {
10862
10913
  question.choices = Object.keys(PredefinedColors[_this.themePalette]).map(function (colorName) { return new survey_core__WEBPACK_IMPORTED_MODULE_2__["ItemValue"](PredefinedColors[_this.themePalette][colorName], Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.colors." + colorName)); });
10863
10914
  }
10864
10915
  });
@@ -10926,14 +10977,12 @@ var ThemeSurveyTabViewModel = /** @class */ (function (_super) {
10926
10977
  name: "--sjs-primary-backcolor",
10927
10978
  title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.primaryColor"),
10928
10979
  descriptionLocation: "hidden",
10929
- defaultValue: "rgba(25, 179, 148, 1)"
10930
10980
  },
10931
10981
  {
10932
10982
  type: "color",
10933
10983
  name: "--sjs-general-backcolor-dim",
10934
10984
  title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.backgroundDimColor"),
10935
10985
  descriptionLocation: "hidden",
10936
- defaultValue: "rgba(243, 243, 243, 1)"
10937
10986
  },
10938
10987
  {
10939
10988
  type: "panel",
@@ -11074,7 +11123,6 @@ var ThemeSurveyTabViewModel = /** @class */ (function (_super) {
11074
11123
  name: "--sjs-general-backcolor-dim",
11075
11124
  title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.backgroundDimColor"),
11076
11125
  descriptionLocation: "hidden",
11077
- defaultValue: "rgba(243, 243, 243, 1)"
11078
11126
  }, {
11079
11127
  type: "panel",
11080
11128
  title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.accentBackground"),
@@ -11085,7 +11133,6 @@ var ThemeSurveyTabViewModel = /** @class */ (function (_super) {
11085
11133
  title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.primaryDefaultColor"),
11086
11134
  titleLocation: "left",
11087
11135
  descriptionLocation: "hidden",
11088
- defaultValue: "rgba(25, 179, 148, 1)"
11089
11136
  },
11090
11137
  {
11091
11138
  type: "color",
@@ -11093,7 +11140,6 @@ var ThemeSurveyTabViewModel = /** @class */ (function (_super) {
11093
11140
  title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.primaryDarkColor"),
11094
11141
  titleLocation: "left",
11095
11142
  descriptionLocation: "hidden",
11096
- defaultValue: "rgba(20, 164, 139, 1)"
11097
11143
  },
11098
11144
  {
11099
11145
  type: "color",
@@ -11101,7 +11147,6 @@ var ThemeSurveyTabViewModel = /** @class */ (function (_super) {
11101
11147
  title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.primaryLightColor"),
11102
11148
  titleLocation: "left",
11103
11149
  descriptionLocation: "hidden",
11104
- defaultValue: "rgba(232, 247, 244, 1)"
11105
11150
  }
11106
11151
  ]
11107
11152
  }, {
@@ -11114,7 +11159,6 @@ var ThemeSurveyTabViewModel = /** @class */ (function (_super) {
11114
11159
  title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.primaryForecolor"),
11115
11160
  titleLocation: "left",
11116
11161
  descriptionLocation: "hidden",
11117
- defaultValue: "rgba(255, 255, 255, 1)"
11118
11162
  },
11119
11163
  {
11120
11164
  type: "color",
@@ -11122,7 +11166,6 @@ var ThemeSurveyTabViewModel = /** @class */ (function (_super) {
11122
11166
  title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.primaryForecolorLight"),
11123
11167
  titleLocation: "left",
11124
11168
  descriptionLocation: "hidden",
11125
- defaultValue: "rgba(255, 255, 255, 1)"
11126
11169
  }
11127
11170
  ]
11128
11171
  }
@@ -11270,7 +11313,6 @@ var ThemeSurveyTabViewModel = /** @class */ (function (_super) {
11270
11313
  title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.borderDefault"),
11271
11314
  titleLocation: "left",
11272
11315
  descriptionLocation: "hidden",
11273
- defaultValue: "rgba(214, 214, 214, 1)"
11274
11316
  },
11275
11317
  {
11276
11318
  type: "color",
@@ -11278,7 +11320,6 @@ var ThemeSurveyTabViewModel = /** @class */ (function (_super) {
11278
11320
  title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.borderLight"),
11279
11321
  titleLocation: "left",
11280
11322
  descriptionLocation: "hidden",
11281
- defaultValue: "rgba(232, 232, 232, 1)"
11282
11323
  }
11283
11324
  ]
11284
11325
  }]
@@ -17248,6 +17289,8 @@ var QuestionColorModel = /** @class */ (function (_super) {
17248
17289
  return _this;
17249
17290
  }
17250
17291
  QuestionColorModel.prototype.getCorrectedValue = function (newValue) {
17292
+ if (newValue == undefined || newValue == null)
17293
+ return newValue;
17251
17294
  newValue = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_2__["parseColor"])(newValue !== null && newValue !== void 0 ? newValue : "").color;
17252
17295
  newValue = (newValue.match(/#(\d|\w){1,6}/) || [DEFAULT_COLOR])[0];
17253
17296
  if (newValue.length === 4) {
@@ -17344,9 +17387,7 @@ var QuestionColorModel = /** @class */ (function (_super) {
17344
17387
  });
17345
17388
  QuestionColorModel.prototype.createDropdownAction = function () {
17346
17389
  var _this = this;
17347
- var action = Object(survey_core__WEBPACK_IMPORTED_MODULE_1__["createDropdownActionModelAdvanced"])({
17348
- iconName: this.cssClasses.colorDropdownIcon
17349
- }, {
17390
+ var action = Object(survey_core__WEBPACK_IMPORTED_MODULE_1__["createDropdownActionModelAdvanced"])({}, {
17350
17391
  onSelectionChanged: function (item) {
17351
17392
  _this.value = item.value;
17352
17393
  },
@@ -17358,15 +17399,23 @@ var QuestionColorModel = /** @class */ (function (_super) {
17358
17399
  });
17359
17400
  var popupModel = action.popupModel;
17360
17401
  var listModel = popupModel.contentComponentData.model;
17361
- listModel.cssClasses = {
17362
- itemBody: listModel.cssClasses.itemBody + " " + this.cssClasses.colorItem
17363
- };
17364
17402
  popupModel.setWidthByTarget = true;
17365
17403
  popupModel.positionMode = "fixed";
17366
17404
  listModel.isItemSelected = function (itemValue) { return itemValue.value == _this.value; };
17367
- action.cssClasses = { item: this.cssClasses.colorDropdown };
17368
17405
  return action;
17369
17406
  };
17407
+ QuestionColorModel.prototype.calcCssClasses = function (css) {
17408
+ var classes = _super.prototype.calcCssClasses.call(this, css);
17409
+ var dropdownAction = this.dropdownAction;
17410
+ dropdownAction.cssClasses = { item: classes.colorDropdown };
17411
+ dropdownAction.iconName = classes.colorDropdownIcon;
17412
+ var listModel = dropdownAction.popupModel.contentComponentData.model;
17413
+ listModel.cssClasses = {};
17414
+ listModel.cssClasses = {
17415
+ itemBody: listModel.cssClasses.itemBody + " " + classes.colorItem
17416
+ };
17417
+ return classes;
17418
+ };
17370
17419
  QuestionColorModel.prototype.updateChoices = function () {
17371
17420
  this.dropdownAction.popupModel.contentComponentData.model.setItems(this.choices);
17372
17421
  };
@@ -17584,6 +17633,8 @@ var QuestionSpinEditorModel = /** @class */ (function (_super) {
17584
17633
  configurable: true
17585
17634
  });
17586
17635
  QuestionSpinEditorModel.prototype.correctValue = function (newValue) {
17636
+ if (newValue == undefined || newValue == null)
17637
+ return newValue;
17587
17638
  var renderedMax = Number(this.renderedMax);
17588
17639
  var renderedMin = Number(this.renderedMin);
17589
17640
  newValue = typeof newValue === "string" ? parseFloat(newValue) : newValue;
@@ -18617,7 +18668,7 @@ __webpack_require__.r(__webpack_exports__);
18617
18668
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_70__ = __webpack_require__(/*! survey-core */ "survey-core");
18618
18669
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_70___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_70__);
18619
18670
  var Version;
18620
- Version = "" + "1.9.95";
18671
+ Version = "" + "1.9.96";
18621
18672
  //should be loaded before other styles for easier override
18622
18673
  __webpack_require__(/*! ../utils/context-button.scss */ "./src/utils/context-button.scss");
18623
18674
 
@@ -18706,7 +18757,7 @@ __webpack_require__(/*! ../utils/design.scss */ "./src/utils/design.scss");
18706
18757
  __webpack_require__(/*! ../utils/layout.scss */ "./src/utils/layout.scss");
18707
18758
 
18708
18759
  survey_core__WEBPACK_IMPORTED_MODULE_70__["settings"].supportCreatorV2 = true;
18709
- Object(survey_core__WEBPACK_IMPORTED_MODULE_70__["checkLibraryVersion"])("" + "1.9.95", "survey-creator-core");
18760
+ Object(survey_core__WEBPACK_IMPORTED_MODULE_70__["checkLibraryVersion"])("" + "1.9.96", "survey-creator-core");
18710
18761
 
18711
18762
 
18712
18763
  /***/ }),
@@ -22244,7 +22295,7 @@ var UndoRedoManager = /** @class */ (function () {
22244
22295
  transaction.addAction(action);
22245
22296
  };
22246
22297
  UndoRedoManager.prototype.isCorrectProperty = function (sender, propertyName) {
22247
- var prop = survey_core__WEBPACK_IMPORTED_MODULE_0__["Serializer"].findProperty(sender.getType(), propertyName);
22298
+ var prop = survey_core__WEBPACK_IMPORTED_MODULE_0__["Serializer"].getOriginalProperty(sender, propertyName);
22248
22299
  return !!prop && prop.isSerializable;
22249
22300
  };
22250
22301
  UndoRedoManager.prototype.tryMergeTransaction = function (sender, propertyName, newValue) {
@@ -22432,7 +22483,7 @@ var UndoRedoAction = /** @class */ (function () {
22432
22483
  UndoRedoAction.prototype.tryMerge = function (sender, propertyName, newValue) {
22433
22484
  if (sender !== this._sender || propertyName !== this._propertyName || newValue == this._oldValue)
22434
22485
  return false;
22435
- var prop = survey_core__WEBPACK_IMPORTED_MODULE_0__["Serializer"].findProperty(sender.getType(), propertyName);
22486
+ var prop = survey_core__WEBPACK_IMPORTED_MODULE_0__["Serializer"].getOriginalProperty(sender, propertyName);
22436
22487
  if (!prop || (prop.type !== "string" && prop.type !== "text"))
22437
22488
  return false;
22438
22489
  if (new Date().getTime() - this.tickCount > UndoRedoAction.maximumMergeTime)