survey-creator-core 1.9.92 → 1.9.93

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.92
2
+ * SurveyJS Creator v1.9.93
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.92
2
+ * SurveyJS Creator v1.9.93
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "survey-creator-core",
3
- "version": "1.9.92",
3
+ "version": "1.9.93",
4
4
  "description": "Use SurveyJS Creator to create or edit JSON for SurveyJS Form Library.",
5
5
  "keywords": [
6
6
  "Survey",
@@ -29,7 +29,7 @@
29
29
  "ace-builds": "^1.4.12"
30
30
  },
31
31
  "dependencies": {
32
- "survey-core": "1.9.92"
32
+ "survey-core": "1.9.93"
33
33
  },
34
34
  "devDependencies": {}
35
35
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * SurveyJS Creator v1.9.92
2
+ * SurveyJS Creator v1.9.93
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
@@ -225,7 +225,7 @@
225
225
 
226
226
 
227
227
  /*# sourceMappingURL=fonts.fontless.css.map*//*!
228
- * SurveyJS Creator v1.9.92
228
+ * SurveyJS Creator v1.9.93
229
229
  * (c) 2015-2023 Devsoft Baltic OÜ - http://surveyjs.io/
230
230
  * Github: https://github.com/surveyjs/survey-creator
231
231
  * License: https://surveyjs.io/Licenses#SurveyCreator
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * SurveyJS Creator v1.9.92
2
+ * SurveyJS Creator v1.9.93
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.92
2
+ * SurveyJS Creator v1.9.93
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.92
2
+ * SurveyJS Creator v1.9.93
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.92
2
+ * SurveyJS Creator v1.9.93
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.92
2
+ * SurveyJS Creator v1.9.93
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
@@ -209,6 +209,8 @@ var SurveyElementAdornerBase = /** @class */ (function (_super) {
209
209
  this.updateActionsProperties();
210
210
  };
211
211
  SurveyElementAdornerBase.prototype.updateActionsProperties = function () {
212
+ if (this.isDisposed)
213
+ return;
212
214
  this.updateElementAllowOptions(this.creator.getElementAllowOperations(this.surveyElement), this.isOperationsAllow());
213
215
  };
214
216
  SurveyElementAdornerBase.prototype.updateElementAllowOptions = function (options, operationsAllow) {
@@ -9989,9 +9991,9 @@ survey_core__WEBPACK_IMPORTED_MODULE_0__["ComponentCollection"].Instance.add({
9989
9991
  descriptionLocation: "hidden",
9990
9992
  choices: [
9991
9993
  { value: "400", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_1__["getLocString"])("theme.fontWeightRegular") },
9992
- { value: "500", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_1__["getLocString"])("theme.fontWeightHeavy") },
9993
- { value: "600", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_1__["getLocString"])("theme.fontWeightSemiBold") },
9994
- { value: "700", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_1__["getLocString"])("theme.fontWeightBold") },
9994
+ { value: "500", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_1__["getLocString"])("theme.fontWeightSemiBold") },
9995
+ { value: "600", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_1__["getLocString"])("theme.fontWeightBold") },
9996
+ { value: "700", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_1__["getLocString"])("theme.fontWeightHeavy") },
9995
9997
  ],
9996
9998
  defaultValue: "400"
9997
9999
  },
@@ -10054,8 +10056,8 @@ var TabThemePlugin = /** @class */ (function () {
10054
10056
  creator.addPluginTab("theme", this, "ed.themeSurvey");
10055
10057
  this.simulatorTheme = survey_core__WEBPACK_IMPORTED_MODULE_1__["surveyCss"][survey_core__WEBPACK_IMPORTED_MODULE_1__["defaultV2ThemeName"]];
10056
10058
  this.createActions().forEach(function (action) { return creator.toolbar.actions.push(action); });
10057
- this.sidebarTab = this.creator.sidebar.addTab("preview");
10058
- this.sidebarTab.caption = _editorLocalization__WEBPACK_IMPORTED_MODULE_2__["editorLocalization"].getString("ed.previewPropertyGridTitle");
10059
+ this.sidebarTab = this.creator.sidebar.addTab("theme");
10060
+ this.sidebarTab.caption = _editorLocalization__WEBPACK_IMPORTED_MODULE_2__["editorLocalization"].getString("ed.themePropertyGridTitle");
10059
10061
  }
10060
10062
  TabThemePlugin.prototype.getSimulatorDevicesTitle = function () {
10061
10063
  if (!this.model)
@@ -10088,6 +10090,7 @@ var TabThemePlugin = /** @class */ (function () {
10088
10090
  this.sidebarTab.model = this.model.themeEditorSurvey;
10089
10091
  this.sidebarTab.componentName = "survey-widget";
10090
10092
  this.creator.sidebar.activeTab = this.sidebarTab.id;
10093
+ this.resetTheme.visible = true;
10091
10094
  this.importAction.visible = true;
10092
10095
  this.exportAction.visible = true;
10093
10096
  };
@@ -10119,6 +10122,7 @@ var TabThemePlugin = /** @class */ (function () {
10119
10122
  }
10120
10123
  this.sidebarTab.visible = false;
10121
10124
  this.testAgainAction.visible = false;
10125
+ this.resetTheme.visible = false;
10122
10126
  this.importAction.visible = false;
10123
10127
  this.exportAction.visible = false;
10124
10128
  this.invisibleToggleAction && (this.invisibleToggleAction.visible = false);
@@ -10209,6 +10213,18 @@ var TabThemePlugin = /** @class */ (function () {
10209
10213
  iconName: "icon-arrow-right_16x16",
10210
10214
  visible: false
10211
10215
  });
10216
+ this.resetTheme = new survey_core__WEBPACK_IMPORTED_MODULE_1__["Action"]({
10217
+ id: "resetTheme",
10218
+ iconName: "icon-reset",
10219
+ mode: "small",
10220
+ visible: new survey_core__WEBPACK_IMPORTED_MODULE_1__["ComputedUpdater"](function () {
10221
+ return (_this.creator.activeTab === "theme");
10222
+ }),
10223
+ action: function () {
10224
+ _this.model.applySelectedTheme();
10225
+ }
10226
+ });
10227
+ items.push(this.resetTheme);
10212
10228
  this.importAction = new survey_core__WEBPACK_IMPORTED_MODULE_1__["Action"]({
10213
10229
  id: "svc-theme-import",
10214
10230
  iconName: "icon-load",
@@ -10389,6 +10405,20 @@ var ThemeSurveyTabViewModel = /** @class */ (function (_super) {
10389
10405
  enumerable: false,
10390
10406
  configurable: true
10391
10407
  });
10408
+ ThemeSurveyTabViewModel.prototype.applySelectedTheme = function (saveChanges) {
10409
+ if (saveChanges === void 0) { saveChanges = false; }
10410
+ var newTheme = {};
10411
+ Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["assign"])(newTheme, Themes[this.getFullThemeName("default")], Themes[this.getFullThemeName()]);
10412
+ if (this.survey["isCompact"]) {
10413
+ Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["assign"])(newTheme, Themes[this.getFullThemeName() + "-lw"]);
10414
+ }
10415
+ if (saveChanges) {
10416
+ Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["assign"])(newTheme, this.themeChanges);
10417
+ }
10418
+ this.themeEditorSurvey.mergeData(newTheme);
10419
+ this.surveyProvider.theme.cssVariables = newTheme;
10420
+ this.setThemeToSurvey();
10421
+ };
10392
10422
  ThemeSurveyTabViewModel.prototype.loadTheme = function (theme) {
10393
10423
  this.themeName = theme["themeName"];
10394
10424
  this.themePalette = theme["themePalette"];
@@ -10678,14 +10708,7 @@ var ThemeSurveyTabViewModel = /** @class */ (function (_super) {
10678
10708
  _this.surveyProvider.theme["themeName"] = _this.themeName;
10679
10709
  _this.surveyProvider.theme["themePalette"] = _this.themePalette;
10680
10710
  }
10681
- var newTheme_1 = {};
10682
- Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["assign"])(newTheme_1, Themes[_this.getFullThemeName("default")], Themes[_this.getFullThemeName()]);
10683
- if (_this.survey["isCompact"]) {
10684
- Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["assign"])(newTheme_1, Themes[_this.getFullThemeName() + "-lw"]);
10685
- }
10686
- themeEditorSurvey.mergeData(newTheme_1);
10687
- _this.surveyProvider.theme.cssVariables = newTheme_1;
10688
- _this.setThemeToSurvey();
10711
+ _this.applySelectedTheme(options.name === "themeMode");
10689
10712
  return;
10690
10713
  }
10691
10714
  if (["backgroundImage", "backgroundImageFit"].indexOf(options.name) !== -1) {
@@ -13771,6 +13794,8 @@ var CreatorBase = /** @class */ (function (_super) {
13771
13794
  * - `sender` - the survey creator object that fires the event
13772
13795
  * - `options.files` - the Javascript File objects array
13773
13796
  * - `options.callback(status, imageLink)` - called on upload complete
13797
+ *
13798
+ * [View Demo](https://surveyjs.io/survey-creator/examples/file-upload/ (linkStyle))
13774
13799
  * @see uploadFiles
13775
13800
  */
13776
13801
  _this.onUploadFile = new CreatorEvent();
@@ -15210,6 +15235,9 @@ var CreatorBase = /** @class */ (function (_super) {
15210
15235
  survey["needRenderIcons"] = false;
15211
15236
  if (reason != "designer" && reason != "test") {
15212
15237
  survey.locale = _editorLocalization__WEBPACK_IMPORTED_MODULE_3__["editorLocalization"].currentLocale;
15238
+ if (!json["clearInvisibleValues"]) {
15239
+ survey.clearInvisibleValues = "onComplete";
15240
+ }
15213
15241
  }
15214
15242
  this.onSurveyInstanceCreated.fire(this, { survey: survey, reason: reason });
15215
15243
  return survey;
@@ -18466,7 +18494,7 @@ __webpack_require__.r(__webpack_exports__);
18466
18494
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_70__ = __webpack_require__(/*! survey-core */ "survey-core");
18467
18495
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_70___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_70__);
18468
18496
  var Version;
18469
- Version = "" + "1.9.92";
18497
+ Version = "" + "1.9.93";
18470
18498
  //should be loaded before other styles for easier override
18471
18499
  __webpack_require__(/*! ../utils/context-button.scss */ "./src/utils/context-button.scss");
18472
18500
 
@@ -18555,7 +18583,7 @@ __webpack_require__(/*! ../utils/design.scss */ "./src/utils/design.scss");
18555
18583
  __webpack_require__(/*! ../utils/layout.scss */ "./src/utils/layout.scss");
18556
18584
 
18557
18585
  survey_core__WEBPACK_IMPORTED_MODULE_70__["settings"].supportCreatorV2 = true;
18558
- Object(survey_core__WEBPACK_IMPORTED_MODULE_70__["checkLibraryVersion"])("" + "1.9.92", "survey-creator-core");
18586
+ Object(survey_core__WEBPACK_IMPORTED_MODULE_70__["checkLibraryVersion"])("" + "1.9.93", "survey-creator-core");
18559
18587
 
18560
18588
 
18561
18589
  /***/ }),
@@ -18865,6 +18893,7 @@ var map = {
18865
18893
  "./rating.svg": "./src/images/rating.svg",
18866
18894
  "./redo.svg": "./src/images/redo.svg",
18867
18895
  "./remove_16x16.svg": "./src/images/remove_16x16.svg",
18896
+ "./reset.svg": "./src/images/reset.svg",
18868
18897
  "./save.svg": "./src/images/save.svg",
18869
18898
  "./select-page.svg": "./src/images/select-page.svg",
18870
18899
  "./settings.svg": "./src/images/settings.svg",
@@ -19706,6 +19735,17 @@ module.exports = "<svg viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\
19706
19735
 
19707
19736
  /***/ }),
19708
19737
 
19738
+ /***/ "./src/images/reset.svg":
19739
+ /*!******************************!*\
19740
+ !*** ./src/images/reset.svg ***!
19741
+ \******************************/
19742
+ /*! no static exports found */
19743
+ /***/ (function(module, exports) {
19744
+
19745
+ module.exports = "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M12.01 2.993C11.8 2.993 11.59 3.023 11.37 3.043L12.71 1.703L11.3 0.292999L7.59 4.003L11.3 7.713L12.71 6.303L11.46 5.053C11.64 5.043 11.82 5.013 12 5.013C15.86 5.013 19 8.153 19 12.013C19 15.873 15.86 19.013 12 19.013C8.14 19.013 5 15.873 5 12.013C5 11.463 4.55 11.013 4 11.013C3.45 11.013 3 11.463 3 12.013C3 16.973 7.04 21.013 12 21.013C16.96 21.013 21 16.973 21 12.013C21 7.053 16.97 2.993 12.01 2.993Z\"></path></svg>"
19746
+
19747
+ /***/ }),
19748
+
19709
19749
  /***/ "./src/images/save.svg":
19710
19750
  /*!*****************************!*\
19711
19751
  !*** ./src/images/save.svg ***!
@@ -20732,7 +20772,7 @@ var enStrings = {
20732
20772
  propertyEditorError: "Error",
20733
20773
  saveError: "Error! Editor content is not saved.",
20734
20774
  translationPropertyGridTitle: "Language Settings",
20735
- previewPropertyGridTitle: "Theme Settings",
20775
+ themePropertyGridTitle: "Theme Settings",
20736
20776
  translationLanguages: "Languages",
20737
20777
  translationAddLanguage: "Select language to translate",
20738
20778
  translationShowAllStrings: "All Strings",
@@ -21909,13 +21949,19 @@ var UndoRedoController = /** @class */ (function (_super) {
21909
21949
  };
21910
21950
  }
21911
21951
  this.undoRedoManager = new _undo_redo_manager__WEBPACK_IMPORTED_MODULE_3__["UndoRedoManager"]();
21912
- this.undoRedoManager.changesFinishedCallback = function (changes) {
21913
- _this.creator.notifySurveyPropertyChanged({
21914
- name: changes.propertyName,
21915
- target: changes.object,
21916
- oldValue: changes.oldValue,
21917
- newValue: changes.newValue
21918
- });
21952
+ this.undoRedoManager.changesFinishedCallback = function (actions, isUndo) {
21953
+ for (var i = actions.length - 1; i >= 0; i--) {
21954
+ var action = actions[i];
21955
+ if (!!action) {
21956
+ var changes = action.getChanges(isUndo);
21957
+ _this.creator.notifySurveyPropertyChanged({
21958
+ name: changes.propertyName,
21959
+ target: changes.object,
21960
+ oldValue: changes.oldValue,
21961
+ newValue: changes.newValue
21962
+ });
21963
+ }
21964
+ }
21919
21965
  };
21920
21966
  this.undoRedoManager.canUndoRedoCallback = function () {
21921
21967
  _this.updateUndeRedoActions();
@@ -22101,9 +22147,10 @@ var UndoRedoManager = /** @class */ (function () {
22101
22147
  };
22102
22148
  UndoRedoManager.prototype.notifyChangesFinished = function (transaction, isUndo) {
22103
22149
  if (isUndo === void 0) { isUndo = false; }
22104
- if (transaction.actions.length > 0 && transaction.actions[0]) {
22150
+ if (transaction.actions.length > 0) {
22105
22151
  !!this.changesFinishedCallback &&
22106
- this.changesFinishedCallback(transaction.actions[0].getChanges(isUndo));
22152
+ this.changesFinishedCallback(transaction.actions, isUndo);
22153
+ // this.changesFinishedCallback(transaction.actions[0].getChanges(isUndo));
22107
22154
  }
22108
22155
  };
22109
22156
  UndoRedoManager.prototype.canUndoRedoCallback = function () { };
@@ -23756,15 +23803,33 @@ var ConditionEditor = /** @class */ (function (_super) {
23756
23803
  path = path.substring(1);
23757
23804
  }
23758
23805
  var json = question && question.getConditionJson ? question.getConditionJson(operator, path) : null;
23759
- if (!!json && json.type == "expression") {
23806
+ if (!json)
23807
+ return null;
23808
+ if (!!json.choicesFromQuestion) {
23809
+ this.updateChoicesFromQuestion(json);
23810
+ }
23811
+ if (json.type == "expression") {
23760
23812
  json.type = "text";
23761
23813
  }
23762
- if (!!json && operator == "anyof") {
23814
+ if (operator == "anyof") {
23763
23815
  if (!ConditionEditor.isClassContains(json.type, ["checkbox"], [])) {
23764
23816
  json.type = "checkbox";
23765
23817
  }
23766
23818
  }
23767
- return !!json ? json : null;
23819
+ return json;
23820
+ };
23821
+ ConditionEditor.prototype.updateChoicesFromQuestion = function (json) {
23822
+ var question = this.getConditionQuestion(json.choicesFromQuestion);
23823
+ if (!question)
23824
+ return;
23825
+ delete json.choicesFromQuestion;
23826
+ var questionJSON = question.toJSON();
23827
+ if (!!questionJSON.choices) {
23828
+ json.choices = questionJSON.choices;
23829
+ }
23830
+ if (!!questionJSON.choicesByUrl) {
23831
+ json.choicesByUrl = questionJSON.choicesByUrl;
23832
+ }
23768
23833
  };
23769
23834
  ConditionEditor.prototype.updateOperatorEnables = function (panel) {
23770
23835
  var questionName = panel.getQuestionByName("questionName");
@@ -24857,6 +24922,10 @@ var PropertyJSONGenerator = /** @class */ (function () {
24857
24922
  json.isRequired = prop.isRequired;
24858
24923
  json.requiredErrorText = _editorLocalization__WEBPACK_IMPORTED_MODULE_2__["editorLocalization"].getString("pe.propertyIsEmpty");
24859
24924
  json.title = this.getQuestionTitle(prop, title);
24925
+ if (["page", "panelbase"].indexOf(prop.className) && json.name === "name") {
24926
+ json.isRequired = true;
24927
+ json.requiredErrorText = _editorLocalization__WEBPACK_IMPORTED_MODULE_2__["editorLocalization"].getString("pe.propertyIsEmpty");
24928
+ }
24860
24929
  var propDescr = (_a = _question_editor_definition__WEBPACK_IMPORTED_MODULE_8__["SurveyQuestionEditorDefinition"].definition[this.obj.getType()]) === null || _a === void 0 ? void 0 : _a.properties.filter(function (property) { return property["name"] === prop.name; })[0];
24861
24930
  if (typeof propDescr === "object" && propDescr.placeholder) {
24862
24931
  json.placeholder = _editorLocalization__WEBPACK_IMPORTED_MODULE_2__["editorLocalization"].getString("pe." + propDescr.placeholder);
@@ -28617,6 +28686,7 @@ var QuestionConverter = /** @class */ (function () {
28617
28686
  }
28618
28687
  QuestionConverter.updateJSON(json, convertToClass, obj.getType(), defaultJSON);
28619
28688
  newQuestion.fromJSON(json);
28689
+ QuestionConverter.removeValidators(newQuestion);
28620
28690
  var panel = obj.parent;
28621
28691
  var index = panel.elements.indexOf(obj);
28622
28692
  panel.isConverting = true;
@@ -28699,6 +28769,18 @@ var QuestionConverter = /** @class */ (function () {
28699
28769
  delete json.templateElements;
28700
28770
  }
28701
28771
  };
28772
+ QuestionConverter.removeValidators = function (question) {
28773
+ var validators = question.validators;
28774
+ if (!Array.isArray(validators) || validators.length === 0)
28775
+ return;
28776
+ var supported = question.getSupportedValidators();
28777
+ for (var i = validators.length - 1; i >= 0; i--) {
28778
+ var valType = validators[i].getType().replace("validator", "");
28779
+ if (supported.indexOf(valType) < 0) {
28780
+ validators.splice(i, 1);
28781
+ }
28782
+ }
28783
+ };
28702
28784
  QuestionConverter.convertInfo = {};
28703
28785
  return QuestionConverter;
28704
28786
  }());