survey-creator-core 1.9.86 → 1.9.88

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.86
2
+ * SurveyJS Creator v1.9.88
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
@@ -1896,6 +1896,8 @@ __webpack_require__.r(__webpack_exports__);
1896
1896
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "survey-core");
1897
1897
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_1__);
1898
1898
  /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question */ "./src/components/question.ts");
1899
+ /* harmony import */ var _editorLocalization__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../editorLocalization */ "./src/editorLocalization.ts");
1900
+
1899
1901
 
1900
1902
 
1901
1903
 
@@ -1905,8 +1907,25 @@ var QuestionImageAdornerViewModel = /** @class */ (function (_super) {
1905
1907
  function QuestionImageAdornerViewModel(creator, surveyElement, templateData, questionRoot) {
1906
1908
  var _this = _super.call(this, creator, surveyElement, templateData) || this;
1907
1909
  _this.questionRoot = questionRoot;
1910
+ _this.isEmptyImageLink = !_this.question.imageLink;
1911
+ _this.surveyElement.registerFunctionOnPropertyValueChanged("imageLink", function () { _this.imageLinkValueChangedHandler(); }, "imageLinkValueChanged");
1912
+ _this.initFilePresentationModel();
1908
1913
  return _this;
1909
1914
  }
1915
+ QuestionImageAdornerViewModel.prototype.initFilePresentationModel = function () {
1916
+ var _this = this;
1917
+ this.filePresentationModel = survey_core__WEBPACK_IMPORTED_MODULE_1__["Serializer"].createClass("file", { name: this.question.name });
1918
+ this.filePresentationModel.setSurveyImpl(this.question.getSurvey());
1919
+ this.filePresentationModel.forceIsInputReadOnly = false;
1920
+ this.filePresentationModel.dragAreaPlaceholder = this.placeholderText;
1921
+ this.filePresentationModel.chooseButtonCaption = this.chooseImageText;
1922
+ this.filePresentationModel.acceptedTypes = "image/*";
1923
+ this.filePresentationModel.onPropertyValueChangedCallback = function (name, oldValue, newValue, sender, arrayChanges) {
1924
+ if (name === "value" && newValue.length > 0) {
1925
+ _this.question.imageLink = newValue[0].content;
1926
+ }
1927
+ };
1928
+ };
1910
1929
  QuestionImageAdornerViewModel.prototype.chooseFile = function (model) {
1911
1930
  var fileInput = model.questionRoot.getElementsByClassName("svc-choose-file-input")[0];
1912
1931
  model.creator.chooseFiles(fileInput, function (files) {
@@ -1917,9 +1936,45 @@ var QuestionImageAdornerViewModel = /** @class */ (function (_super) {
1917
1936
  });
1918
1937
  });
1919
1938
  };
1939
+ QuestionImageAdornerViewModel.prototype.imageLinkValueChangedHandler = function () {
1940
+ this.isEmptyImageLink = !this.question.imageLink;
1941
+ this.filePresentationModel.value = null;
1942
+ this.filePresentationModel.visible = !this.question.imageLink;
1943
+ };
1944
+ Object.defineProperty(QuestionImageAdornerViewModel.prototype, "isEmptyElement", {
1945
+ get: function () {
1946
+ return this.isEmptyImageLink;
1947
+ },
1948
+ enumerable: false,
1949
+ configurable: true
1950
+ });
1951
+ Object.defineProperty(QuestionImageAdornerViewModel.prototype, "question", {
1952
+ get: function () {
1953
+ return this.surveyElement;
1954
+ },
1955
+ enumerable: false,
1956
+ configurable: true
1957
+ });
1958
+ Object.defineProperty(QuestionImageAdornerViewModel.prototype, "placeholderText", {
1959
+ get: function () {
1960
+ return Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("ed.imagePlaceHolder");
1961
+ },
1962
+ enumerable: false,
1963
+ configurable: true
1964
+ });
1965
+ Object.defineProperty(QuestionImageAdornerViewModel.prototype, "chooseImageText", {
1966
+ get: function () {
1967
+ return Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("ed.imageChooseImage");
1968
+ },
1969
+ enumerable: false,
1970
+ configurable: true
1971
+ });
1920
1972
  Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
1921
1973
  Object(survey_core__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: false })
1922
1974
  ], QuestionImageAdornerViewModel.prototype, "isUploading", void 0);
1975
+ Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
1976
+ Object(survey_core__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: false })
1977
+ ], QuestionImageAdornerViewModel.prototype, "isEmptyImageLink", void 0);
1923
1978
  return QuestionImageAdornerViewModel;
1924
1979
  }(_question__WEBPACK_IMPORTED_MODULE_2__["QuestionAdornerViewModel"]));
1925
1980
 
@@ -2208,7 +2263,10 @@ var QuestionAdornerViewModel = /** @class */ (function (_super) {
2208
2263
  return this.surveyElement.isQuestion && !this.surveyElement.startWithNewLine ? " svc-question__adorner--start-with-new-line" : "";
2209
2264
  };
2210
2265
  QuestionAdornerViewModel.prototype.css = function () {
2211
- var result = typeof this.surveyElement.getType === "function" ? ("svc-question__content--" + this.surveyElement.getType()) : "";
2266
+ if (!this.surveyElement.isInteractiveDesignElement)
2267
+ return "";
2268
+ var result = "svc-question__content";
2269
+ result += typeof this.surveyElement.getType === "function" ? (" svc-question__content--" + this.surveyElement.getType()) : "";
2212
2270
  if (this.creator.isElementSelected(this.surveyElement)) {
2213
2271
  result += " svc-question__content--selected";
2214
2272
  }
@@ -16623,7 +16681,7 @@ __webpack_require__.r(__webpack_exports__);
16623
16681
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(/*! survey-core */ "survey-core");
16624
16682
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_64___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_64__);
16625
16683
  var Version;
16626
- Version = "" + "1.9.86";
16684
+ Version = "" + "1.9.88";
16627
16685
 
16628
16686
 
16629
16687
 
@@ -16704,7 +16762,7 @@ __webpack_require__(/*! ../utils/design.scss */ "./src/utils/design.scss");
16704
16762
  __webpack_require__(/*! ../utils/layout.scss */ "./src/utils/layout.scss");
16705
16763
 
16706
16764
  survey_core__WEBPACK_IMPORTED_MODULE_64__["settings"].supportCreatorV2 = true;
16707
- Object(survey_core__WEBPACK_IMPORTED_MODULE_64__["checkLibraryVersion"])("" + "1.9.86", "survey-creator-core");
16765
+ Object(survey_core__WEBPACK_IMPORTED_MODULE_64__["checkLibraryVersion"])("" + "1.9.88", "survey-creator-core");
16708
16766
 
16709
16767
 
16710
16768
  /***/ }),
@@ -18886,6 +18944,8 @@ var enStrings = {
18886
18944
  htmlPlaceHolder: "HTML content will be here.",
18887
18945
  panelPlaceHolder: "Drop a question from the toolbox here.",
18888
18946
  surveyPlaceHolder: "The survey is empty. Drag an element from the toolbox or click the button below.",
18947
+ imagePlaceHolder: "Drop an image here or click the button below to load the image.",
18948
+ imageChooseImage: "Choose Image",
18889
18949
  addNewTypeQuestion: "Add {0}",
18890
18950
  chooseLogoPlaceholder: "[LOGO]",
18891
18951
  auto: "auto",
@@ -19513,7 +19573,11 @@ var enStrings = {
19513
19573
  buttons: "Buttons",
19514
19574
  dropdown: "Dropdown"
19515
19575
  },
19516
- rateColorMode: { default: "Default" }
19576
+ rateColorMode: { default: "Default" },
19577
+ autoGenerate: {
19578
+ "true": "Generate",
19579
+ "false": "Enter manually"
19580
+ }
19517
19581
  },
19518
19582
  // Operators
19519
19583
  op: {
@@ -20269,6 +20333,7 @@ var UndoRedoAction = /** @class */ (function () {
20269
20333
  this._oldValue = _oldValue;
20270
20334
  this._newValue = _newValue;
20271
20335
  this._sender = _sender;
20336
+ this.tickCount = new Date().getTime();
20272
20337
  }
20273
20338
  UndoRedoAction.prototype.apply = function () {
20274
20339
  this._sender[this._propertyName] = this._newValue;
@@ -20291,9 +20356,12 @@ var UndoRedoAction = /** @class */ (function () {
20291
20356
  var prop = survey_core__WEBPACK_IMPORTED_MODULE_0__["Serializer"].findProperty(sender.getType(), propertyName);
20292
20357
  if (!prop || (prop.type !== "string" && prop.type !== "text"))
20293
20358
  return false;
20359
+ if (new Date().getTime() - this.tickCount > UndoRedoAction.maximumMergeTime)
20360
+ return false;
20294
20361
  this._newValue = newValue;
20295
20362
  return true;
20296
20363
  };
20364
+ UndoRedoAction.maximumMergeTime = 1000;
20297
20365
  return UndoRedoAction;
20298
20366
  }());
20299
20367
 
@@ -23074,6 +23142,9 @@ var PropertyGridModel = /** @class */ (function () {
23074
23142
  _this.currentlySelectedPanel = options.question.parent;
23075
23143
  });
23076
23144
  this.survey.getAllQuestions().map(function (q) { return q.allowRootStyle = false; });
23145
+ this.survey.onQuestionCreated.add(function (_, opt) {
23146
+ opt.question.allowRootStyle = false;
23147
+ });
23077
23148
  this.options.onPropertyGridSurveyCreatedCallback(this.obj, this.survey);
23078
23149
  };
23079
23150
  Object.defineProperty(PropertyGridModel.prototype, "options", {
@@ -24369,7 +24440,7 @@ var PropertyGridEditorMatrixRateValues = /** @class */ (function (_super) {
24369
24440
  var _this = this;
24370
24441
  _super.prototype.onCreated.call(this, obj, question, prop);
24371
24442
  var matrixQuestion = question;
24372
- this.updateAllowAddRemove(matrixQuestion, obj);
24443
+ this.updateAllowAddRemove(matrixQuestion, ((obj instanceof survey_core__WEBPACK_IMPORTED_MODULE_1__["MatrixDropdownColumn"]) ? obj.templateQuestion : obj));
24373
24444
  obj.onPropertyChanged.add(function (sender, options) {
24374
24445
  if (options.name == "rateCount" || options.name == "rateDisplayMode") {
24375
24446
  _this.updateAllowAddRemove(matrixQuestion, obj);
@@ -25882,11 +25953,17 @@ var SurveyQuestionEditorDefinition = /** @class */ (function () {
25882
25953
  "matrixdropdowncolumn@rating": {
25883
25954
  properties: [
25884
25955
  "rateValues",
25956
+ { name: "rateType", tab: "rateValues" },
25957
+ { name: "rateCount", tab: "rateValues" },
25958
+ { name: "rateColorMode", tab: "rateValues" },
25959
+ { name: "scaleColorMode", tab: "rateValues" },
25960
+ { name: "autoGenerate", tab: "rateValues" },
25885
25961
  { name: "rateMin", tab: "rateValues" },
25886
25962
  { name: "rateMax", tab: "rateValues" },
25887
25963
  { name: "rateStep", tab: "rateValues" },
25888
25964
  { name: "minRateDescription", tab: "rateValues" },
25889
- { name: "maxRateDescription", tab: "rateValues" }
25965
+ { name: "maxRateDescription", tab: "rateValues" },
25966
+ { name: "displayRateDescriptionsAsExtremeItems", tab: "rateValues" },
25890
25967
  ],
25891
25968
  tabs: [{ name: "rateValues", index: 5 }]
25892
25969
  },
@@ -26549,6 +26626,7 @@ var QuestionConverter = /** @class */ (function () {
26549
26626
  QuestionConverter.updateJSONForRating(json, convertToClass, defaultJSON);
26550
26627
  QuestionConverter.updateJSONForMatrices(json, convertToClass, convertFromClass);
26551
26628
  QuestionConverter.updateJSONForPanels(json, convertToClass, convertFromClass);
26629
+ QuestionConverter.updateJSONForBarrating(json, convertToClass);
26552
26630
  };
26553
26631
  QuestionConverter.updateJSONFromQuestionDefaultSettings = function (json, convertToClass, defaultJSON) {
26554
26632
  var questionDefaultSettings = _toolbox__WEBPACK_IMPORTED_MODULE_2__["QuestionToolbox"].getQuestionDefaultSettings(convertToClass);
@@ -26597,6 +26675,11 @@ var QuestionConverter = /** @class */ (function () {
26597
26675
  json.choices = json.rateValues;
26598
26676
  }
26599
26677
  };
26678
+ QuestionConverter.updateJSONForBarrating = function (json, convertToClass) {
26679
+ if (convertToClass === "barrating") {
26680
+ json.choices = [1, 2, 3, 4, 5];
26681
+ }
26682
+ };
26600
26683
  QuestionConverter.updateJSONForPanels = function (json, convertToClass, convertFromClass) {
26601
26684
  if (survey_core__WEBPACK_IMPORTED_MODULE_0__["Serializer"].isDescendantOf(convertToClass, "paneldynamic") &&
26602
26685
  survey_core__WEBPACK_IMPORTED_MODULE_0__["Serializer"].isDescendantOf(convertFromClass, "panel") &&
@@ -28034,6 +28117,10 @@ var QuestionToolbox = /** @class */ (function (_super) {
28034
28117
  }
28035
28118
  return json;
28036
28119
  };
28120
+ QuestionToolbox.prototype.isHiddenCustomWidget = function (name) {
28121
+ var widget = survey_core__WEBPACK_IMPORTED_MODULE_1__["CustomWidgetCollection"].Instance.getCustomWidgetByName(name);
28122
+ return !!widget && !widget.showInToolbox;
28123
+ };
28037
28124
  QuestionToolbox.prototype.getQuestionTypes = function (supportedQuestions) {
28038
28125
  var allTypes = survey_core__WEBPACK_IMPORTED_MODULE_1__["ElementFactory"].Instance.getAllTypes();
28039
28126
  if (!supportedQuestions || supportedQuestions.length == 0)
@@ -28048,7 +28135,8 @@ var QuestionToolbox = /** @class */ (function (_super) {
28048
28135
  var name = supportedQuestions[i];
28049
28136
  if (questions.indexOf(name) < 0 &&
28050
28137
  QuestionToolbox.hiddenTypes.indexOf(name) < 0 &&
28051
- allTypes.indexOf(name) > -1)
28138
+ allTypes.indexOf(name) > -1 &&
28139
+ !this.isHiddenCustomWidget(name))
28052
28140
  questions.push(name);
28053
28141
  }
28054
28142
  return questions;