survey-creator-core 1.9.85 → 1.9.87

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.85
2
+ * SurveyJS Creator v1.9.87
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
@@ -2042,9 +2042,24 @@ var QuestionRatingAdornerViewModel = /** @class */ (function (_super) {
2042
2042
  };
2043
2043
  Object.defineProperty(QuestionRatingAdornerViewModel.prototype, "allowAdd", {
2044
2044
  get: function () {
2045
- if (this.creator.readOnly)
2046
- return false;
2047
- return QuestionRatingAdornerViewModel.allowAddForElement(this.element, this.creator.maximumRateValues);
2045
+ return !this.creator.readOnly;
2046
+ },
2047
+ enumerable: false,
2048
+ configurable: true
2049
+ });
2050
+ Object.defineProperty(QuestionRatingAdornerViewModel.prototype, "enableAdd", {
2051
+ get: function () {
2052
+ return this.allowAdd && QuestionRatingAdornerViewModel.allowAddForElement(this.element, this.creator.maximumRateValues);
2053
+ },
2054
+ enumerable: false,
2055
+ configurable: true
2056
+ });
2057
+ Object.defineProperty(QuestionRatingAdornerViewModel.prototype, "addClassNames", {
2058
+ get: function () {
2059
+ return new survey_core__WEBPACK_IMPORTED_MODULE_1__["CssClassBuilder"]()
2060
+ .append("svc-item-value-controls__button")
2061
+ .append("svc-item-value-controls__button--disabled", !this.enableAdd)
2062
+ .append("svc-item-value-controls__add").toString();
2048
2063
  },
2049
2064
  enumerable: false,
2050
2065
  configurable: true
@@ -2054,9 +2069,24 @@ var QuestionRatingAdornerViewModel = /** @class */ (function (_super) {
2054
2069
  };
2055
2070
  Object.defineProperty(QuestionRatingAdornerViewModel.prototype, "allowRemove", {
2056
2071
  get: function () {
2057
- if (this.creator.readOnly)
2058
- return false;
2059
- return QuestionRatingAdornerViewModel.allowRemoveForElement(this.element);
2072
+ return !this.creator.readOnly;
2073
+ },
2074
+ enumerable: false,
2075
+ configurable: true
2076
+ });
2077
+ Object.defineProperty(QuestionRatingAdornerViewModel.prototype, "enableRemove", {
2078
+ get: function () {
2079
+ return this.allowRemove && QuestionRatingAdornerViewModel.allowRemoveForElement(this.element);
2080
+ },
2081
+ enumerable: false,
2082
+ configurable: true
2083
+ });
2084
+ Object.defineProperty(QuestionRatingAdornerViewModel.prototype, "removeClassNames", {
2085
+ get: function () {
2086
+ return new survey_core__WEBPACK_IMPORTED_MODULE_1__["CssClassBuilder"]()
2087
+ .append("svc-item-value-controls__button")
2088
+ .append("svc-item-value-controls__button--disabled", !this.enableRemove)
2089
+ .append("svc-item-value-controls__remove").toString();
2060
2090
  },
2061
2091
  enumerable: false,
2062
2092
  configurable: true
@@ -2328,23 +2358,26 @@ var QuestionAdornerViewModel = /** @class */ (function (_super) {
2328
2358
  };
2329
2359
  QuestionAdornerViewModel.prototype.createConvertInputType = function () {
2330
2360
  var _this = this;
2331
- if (this.surveyElement.getType() !== "text")
2332
- return null;
2333
- var prop = survey_core__WEBPACK_IMPORTED_MODULE_1__["Serializer"].findProperty("text", "inputType");
2361
+ var prop = null;
2362
+ if (this.surveyElement.getType() === "text")
2363
+ prop = survey_core__WEBPACK_IMPORTED_MODULE_1__["Serializer"].findProperty("text", "inputType");
2364
+ if (this.surveyElement.getType() === "rating")
2365
+ prop = survey_core__WEBPACK_IMPORTED_MODULE_1__["Serializer"].findProperty("rating", "rateDisplayMode");
2334
2366
  if (!prop || !Object(_utils_utils__WEBPACK_IMPORTED_MODULE_4__["isPropertyVisible"])(this.surveyElement, prop.name))
2335
2367
  return null;
2336
- var inputType = this.surveyElement.inputType;
2368
+ var propName = prop.name;
2369
+ var questionSubType = this.surveyElement.getPropertyValue(propName);
2337
2370
  var items = prop.getChoices(this.surveyElement, function (chs) { });
2338
2371
  var availableTypes = [];
2339
2372
  items.forEach(function (item) {
2340
2373
  availableTypes.push({ id: item, title: _editorLocalization__WEBPACK_IMPORTED_MODULE_2__["editorLocalization"].getPropertyValueInEditor(prop.name, item) });
2341
2374
  });
2342
- var newAction = this.createDropdownModel("convertInputType", availableTypes, true, 1, inputType, function (item) {
2343
- _this.surveyElement.inputType = item.id;
2375
+ var newAction = this.createDropdownModel("convertInputType", availableTypes, true, 1, questionSubType, function (item) {
2376
+ _this.surveyElement.setPropertyValue(propName, item.id);
2344
2377
  newAction.title = item.title;
2345
2378
  });
2346
- this.surveyElement.registerFunctionOnPropertyValueChanged("inputType", function () {
2347
- var item = _this.getSelectedItem(availableTypes, _this.surveyElement.inputType);
2379
+ this.surveyElement.registerFunctionOnPropertyValueChanged(propName, function () {
2380
+ var item = _this.getSelectedItem(availableTypes, _this.surveyElement.getPropertyValue(propName));
2348
2381
  if (!item)
2349
2382
  return;
2350
2383
  var popup = newAction.popupModel;
@@ -4109,6 +4142,7 @@ var TabDesignerPlugin = /** @class */ (function () {
4109
4142
  TabDesignerPlugin.prototype.activate = function () {
4110
4143
  this.model = new _designer__WEBPACK_IMPORTED_MODULE_4__["TabDesignerViewModel"](this.creator);
4111
4144
  this.creator.sidebar.activeTab = this.propertyGridTab.id;
4145
+ this.creator.focusElement(undefined, true);
4112
4146
  };
4113
4147
  TabDesignerPlugin.prototype.deactivate = function () {
4114
4148
  this.model = undefined;
@@ -15133,7 +15167,13 @@ var settings = {
15133
15167
  showAddQuestionButton: true
15134
15168
  },
15135
15169
  logic: {
15136
- defaultOperator: "equal",
15170
+ get defaultOperator() { return settings.logic.defaultOperators.default; },
15171
+ set defaultOperator(val) { settings.logic.defaultOperators.default = val; },
15172
+ defaultOperators: {
15173
+ default: "equal",
15174
+ checkbox: "allof",
15175
+ tagbox: "allof"
15176
+ },
15137
15177
  visibleActions: [],
15138
15178
  logicItemTitleMaxChars: 50,
15139
15179
  openBracket: "{",
@@ -15205,7 +15245,7 @@ var settings = {
15205
15245
  image: {
15206
15246
  imageLink: "https://surveyjs.io/Content/Images/examples/image-picker/lion.jpg",
15207
15247
  imageFit: "cover",
15208
- imageHeight: "100%",
15248
+ imageHeight: "auto",
15209
15249
  imageWidth: "100%"
15210
15250
  }
15211
15251
  }
@@ -15346,12 +15386,12 @@ var QuestionColorModel = /** @class */ (function (_super) {
15346
15386
  newValue += "0";
15347
15387
  }
15348
15388
  }
15349
- return newValue.toUpperCase();
15389
+ return newValue;
15350
15390
  };
15351
15391
  QuestionColorModel.prototype.setNewValue = function (newValue) {
15352
- this._renderedValue = "";
15392
+ this.resetRenderedValue();
15353
15393
  _super.prototype.setNewValue.call(this, this.getCorrectedValue(newValue));
15354
- this._renderedValue = this.value;
15394
+ this.updateRenderedValue();
15355
15395
  };
15356
15396
  QuestionColorModel.prototype.onBeforeInput = function (event) {
15357
15397
  if (!!event.data && !/[\d\w#]/.test(event.data)) {
@@ -15364,10 +15404,16 @@ var QuestionColorModel = /** @class */ (function (_super) {
15364
15404
  QuestionColorModel.prototype.getType = function () {
15365
15405
  return "color";
15366
15406
  };
15407
+ QuestionColorModel.prototype.resetRenderedValue = function () {
15408
+ this._renderedValue = undefined;
15409
+ };
15410
+ QuestionColorModel.prototype.updateRenderedValue = function () {
15411
+ this._renderedValue = this.value;
15412
+ };
15367
15413
  Object.defineProperty(QuestionColorModel.prototype, "renderedValue", {
15368
15414
  get: function () {
15369
15415
  var _a, _b;
15370
- return (_b = (_a = this._renderedValue) !== null && _a !== void 0 ? _a : this.value) !== null && _b !== void 0 ? _b : "#000000";
15416
+ return ((_b = (_a = this._renderedValue) !== null && _a !== void 0 ? _a : this.value) !== null && _b !== void 0 ? _b : "#000000").toUpperCase();
15371
15417
  },
15372
15418
  enumerable: false,
15373
15419
  configurable: true
@@ -15382,6 +15428,10 @@ var QuestionColorModel = /** @class */ (function (_super) {
15382
15428
  enumerable: false,
15383
15429
  configurable: true
15384
15430
  });
15431
+ QuestionColorModel.prototype.onSurveyValueChanged = function (newValue) {
15432
+ _super.prototype.onSurveyValueChanged.call(this, newValue);
15433
+ this.updateRenderedValue();
15434
+ };
15385
15435
  Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
15386
15436
  Object(survey_core__WEBPACK_IMPORTED_MODULE_1__["property"])()
15387
15437
  ], QuestionColorModel.prototype, "unit", void 0);
@@ -16573,7 +16623,7 @@ __webpack_require__.r(__webpack_exports__);
16573
16623
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(/*! survey-core */ "survey-core");
16574
16624
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_64___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_64__);
16575
16625
  var Version;
16576
- Version = "" + "1.9.85";
16626
+ Version = "" + "1.9.87";
16577
16627
 
16578
16628
 
16579
16629
 
@@ -16654,7 +16704,7 @@ __webpack_require__(/*! ../utils/design.scss */ "./src/utils/design.scss");
16654
16704
  __webpack_require__(/*! ../utils/layout.scss */ "./src/utils/layout.scss");
16655
16705
 
16656
16706
  survey_core__WEBPACK_IMPORTED_MODULE_64__["settings"].supportCreatorV2 = true;
16657
- Object(survey_core__WEBPACK_IMPORTED_MODULE_64__["checkLibraryVersion"])("" + "1.9.85", "survey-creator-core");
16707
+ Object(survey_core__WEBPACK_IMPORTED_MODULE_64__["checkLibraryVersion"])("" + "1.9.87", "survey-creator-core");
16658
16708
 
16659
16709
 
16660
16710
  /***/ }),
@@ -18714,27 +18764,27 @@ var enStrings = {
18714
18764
  // Question types
18715
18765
  qt: {
18716
18766
  default: "Default",
18717
- checkbox: "Checkbox",
18718
- comment: "Comment",
18767
+ checkbox: "Checkboxes",
18768
+ comment: "Long Text",
18719
18769
  imagepicker: "Image Picker",
18720
18770
  ranking: "Ranking",
18721
18771
  image: "Image",
18722
18772
  dropdown: "Dropdown",
18723
- tagbox: "Tag Box",
18724
- file: "File",
18773
+ tagbox: "Multi-Select Dropdown",
18774
+ file: "File Upload",
18725
18775
  html: "HTML",
18726
- matrix: "Single-Choice Matrix",
18727
- matrixdropdown: "Multiple-Choice Matrix",
18776
+ matrix: "Single-Select Matrix",
18777
+ matrixdropdown: "Multi-Select Matrix",
18728
18778
  matrixdynamic: "Dynamic Matrix",
18729
- multipletext: "Multiple Text",
18779
+ multipletext: "Multiple Textboxes",
18730
18780
  panel: "Panel",
18731
18781
  paneldynamic: "Dynamic Panel",
18732
- radiogroup: "Radiogroup",
18733
- rating: "Rating",
18734
- text: "Single Input",
18735
- boolean: "Boolean",
18782
+ radiogroup: "Radio Button Group",
18783
+ rating: "Rating Scale",
18784
+ text: "Single-Line Input",
18785
+ boolean: "Yes/No (Boolean)",
18736
18786
  expression: "Expression (read-only)",
18737
- signaturepad: "Signature Pad",
18787
+ signaturepad: "Signature",
18738
18788
  buttongroup: "Button Group"
18739
18789
  },
18740
18790
  // Strings in SurveyJS Creator
@@ -20855,7 +20905,7 @@ __webpack_require__.r(__webpack_exports__);
20855
20905
  var ConditionEditorItem = /** @class */ (function () {
20856
20906
  function ConditionEditorItem() {
20857
20907
  this.conjunction = "and";
20858
- this.operator = _creator_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].logic.defaultOperator;
20908
+ this.operator = _creator_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].logic.defaultOperators.default;
20859
20909
  }
20860
20910
  return ConditionEditorItem;
20861
20911
  }());
@@ -21456,7 +21506,8 @@ var ConditionEditor = /** @class */ (function (_super) {
21456
21506
  questionOperator.choices = this.getOperators();
21457
21507
  questionOperator.value = item.operator;
21458
21508
  questionOperator.onOpened.add(function (_, opt) {
21459
- var json = _this.getQuestionConditionJson(panel.getQuestionByName("questionName").value, _this.defaultOperator);
21509
+ var questionName = panel.getQuestionByName("questionName").value;
21510
+ var json = _this.getQuestionConditionJson(questionName);
21460
21511
  var qType = !!json ? json.type : null;
21461
21512
  opt.choices.forEach(function (choice, index) {
21462
21513
  var isOperatorEnabled = ConditionEditor.isOperatorEnabled(qType, _creator_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].operators[choice.value]);
@@ -21731,6 +21782,9 @@ var ConditionEditor = /** @class */ (function (_super) {
21731
21782
  var question = this.getConditionQuestion(questionName);
21732
21783
  if (!question)
21733
21784
  return null;
21785
+ if (!operator) {
21786
+ operator = this.getDefaultOperatorByQuestion(question);
21787
+ }
21734
21788
  if (questionName.indexOf(question.getValueName()) == 0) {
21735
21789
  path = questionName.substring(question.getValueName().length);
21736
21790
  }
@@ -21745,9 +21799,6 @@ var ConditionEditor = /** @class */ (function (_super) {
21745
21799
  path = path.substring(1);
21746
21800
  }
21747
21801
  var json = question && question.getConditionJson ? question.getConditionJson(operator, path) : null;
21748
- // if (!!json && json.type == "radiogroup") {
21749
- // json.type = "dropdown";
21750
- // }
21751
21802
  if (!!json && json.type == "expression") {
21752
21803
  json.type = "text";
21753
21804
  }
@@ -21762,7 +21813,7 @@ var ConditionEditor = /** @class */ (function (_super) {
21762
21813
  var questionName = panel.getQuestionByName("questionName");
21763
21814
  if (!questionName)
21764
21815
  return;
21765
- var json = this.getQuestionConditionJson(questionName.value, this.defaultOperator);
21816
+ var json = this.getQuestionConditionJson(questionName.value);
21766
21817
  var qType = !!json ? json.type : null;
21767
21818
  var questionOperator = panel.getQuestionByName("operator");
21768
21819
  if (!questionOperator)
@@ -21803,10 +21854,21 @@ var ConditionEditor = /** @class */ (function (_super) {
21803
21854
  }
21804
21855
  };
21805
21856
  Object.defineProperty(ConditionEditor.prototype, "defaultOperator", {
21806
- get: function () { return _creator_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].logic.defaultOperator; },
21857
+ get: function () { return _creator_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].logic.defaultOperators.default; },
21807
21858
  enumerable: false,
21808
21859
  configurable: true
21809
21860
  });
21861
+ ConditionEditor.prototype.getDefaultOperatorByQuestionName = function (questionName) {
21862
+ return this.getDefaultOperatorByQuestion(this.getConditionQuestion(questionName));
21863
+ };
21864
+ ConditionEditor.prototype.getDefaultOperatorByQuestion = function (question) {
21865
+ if (!!question) {
21866
+ var defOps = _creator_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].logic.defaultOperators;
21867
+ if (!!defOps[question.getType()])
21868
+ return defOps[question.getType()];
21869
+ }
21870
+ return this.defaultOperator;
21871
+ };
21810
21872
  ConditionEditor.prototype.getFirstEnabledOperator = function (choices) {
21811
21873
  for (var i = 0; i < choices.length; i++) {
21812
21874
  if (choices[i].isEnabled) {
@@ -21823,7 +21885,7 @@ var ConditionEditor = /** @class */ (function (_super) {
21823
21885
  this.context = this.getContextFromPanels();
21824
21886
  this.rebuildQuestionValue(panel);
21825
21887
  if (!this.isSettingPanelValues) {
21826
- panel.getQuestionByName("operator").value = this.defaultOperator;
21888
+ panel.getQuestionByName("operator").value = this.getDefaultOperatorByQuestionName(panel.getQuestionByName("questionName").value);
21827
21889
  }
21828
21890
  }
21829
21891
  if (name == "operator") {
@@ -24307,7 +24369,7 @@ var PropertyGridEditorMatrixRateValues = /** @class */ (function (_super) {
24307
24369
  var _this = this;
24308
24370
  _super.prototype.onCreated.call(this, obj, question, prop);
24309
24371
  var matrixQuestion = question;
24310
- this.updateAllowAddRemove(matrixQuestion, obj);
24372
+ this.updateAllowAddRemove(matrixQuestion, ((obj instanceof survey_core__WEBPACK_IMPORTED_MODULE_1__["MatrixDropdownColumn"]) ? obj.templateQuestion : obj));
24311
24373
  obj.onPropertyChanged.add(function (sender, options) {
24312
24374
  if (options.name == "rateCount" || options.name == "rateDisplayMode") {
24313
24375
  _this.updateAllowAddRemove(matrixQuestion, obj);
@@ -26487,6 +26549,7 @@ var QuestionConverter = /** @class */ (function () {
26487
26549
  QuestionConverter.updateJSONForRating(json, convertToClass, defaultJSON);
26488
26550
  QuestionConverter.updateJSONForMatrices(json, convertToClass, convertFromClass);
26489
26551
  QuestionConverter.updateJSONForPanels(json, convertToClass, convertFromClass);
26552
+ QuestionConverter.updateJSONForBarrating(json, convertToClass);
26490
26553
  };
26491
26554
  QuestionConverter.updateJSONFromQuestionDefaultSettings = function (json, convertToClass, defaultJSON) {
26492
26555
  var questionDefaultSettings = _toolbox__WEBPACK_IMPORTED_MODULE_2__["QuestionToolbox"].getQuestionDefaultSettings(convertToClass);
@@ -26535,6 +26598,11 @@ var QuestionConverter = /** @class */ (function () {
26535
26598
  json.choices = json.rateValues;
26536
26599
  }
26537
26600
  };
26601
+ QuestionConverter.updateJSONForBarrating = function (json, convertToClass) {
26602
+ if (convertToClass === "barrating") {
26603
+ json.choices = [1, 2, 3, 4, 5];
26604
+ }
26605
+ };
26538
26606
  QuestionConverter.updateJSONForPanels = function (json, convertToClass, convertFromClass) {
26539
26607
  if (survey_core__WEBPACK_IMPORTED_MODULE_0__["Serializer"].isDescendantOf(convertToClass, "paneldynamic") &&
26540
26608
  survey_core__WEBPACK_IMPORTED_MODULE_0__["Serializer"].isDescendantOf(convertFromClass, "panel") &&
@@ -26989,7 +27057,7 @@ var SurveyHelper = /** @class */ (function () {
26989
27057
  text += "\n";
26990
27058
  text += item.value;
26991
27059
  if (item.pureText)
26992
- text += "|" + item.pureText;
27060
+ text += survey_core__WEBPACK_IMPORTED_MODULE_0__["ItemValue"].Separator + item.pureText;
26993
27061
  });
26994
27062
  return text;
26995
27063
  };