survey-creator-core 1.9.109 → 1.9.111

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.109
2
+ * SurveyJS Creator v1.9.111
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
@@ -130,7 +130,7 @@ License: MIT
130
130
  /***/ (function(module, exports, __webpack_require__) {
131
131
 
132
132
  /*!
133
- * surveyjs - Survey JavaScript library v1.9.109
133
+ * surveyjs - Survey JavaScript library v1.9.111
134
134
  * Copyright (c) 2015-2023 Devsoft Baltic OÜ - http://surveyjs.io/
135
135
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
136
136
  */
@@ -5536,6 +5536,9 @@ var ItemValueWrapperViewModel = /** @class */ (function (_super) {
5536
5536
  };
5537
5537
  Object.defineProperty(ItemValueWrapperViewModel.prototype, "allowRemove", {
5538
5538
  get: function () {
5539
+ var minChoices = this.creator.minimumChoicesCount;
5540
+ if (minChoices > 0 && minChoices >= this.question.choices.length)
5541
+ return false;
5539
5542
  var isNew = !this.question.isItemInList(this.item);
5540
5543
  return !this.creator.readOnly && this.canTouchItems && (this.allowItemOperations.allowDelete) && !isNew;
5541
5544
  },
@@ -7033,9 +7036,7 @@ var QuestionAdornerViewModel = /** @class */ (function (_super) {
7033
7036
  _this.dragDropHelper.startDragSurveyElement(event, element, isElementSelected);
7034
7037
  return true;
7035
7038
  };
7036
- _this.questionTypeSelectorModel = _this.creator.getQuestionTypeSelectorModel(function (type) {
7037
- _this.currentAddQuestionType = type;
7038
- }, _this.surveyElement instanceof survey_core__WEBPACK_IMPORTED_MODULE_1__["PanelModelBase"] ? _this.surveyElement : null);
7039
+ _this.questionTypeSelectorModel = _this.creator.getQuestionTypeSelectorModel(function (type) { _this.currentAddQuestionType = type; }, _this.surveyElement);
7039
7040
  _this.actionContainer.sizeMode = "small";
7040
7041
  if (surveyElement.isQuestion &&
7041
7042
  !!surveyElement["setCanShowOptionItemCallback"]) {
@@ -7238,7 +7239,10 @@ var QuestionAdornerViewModel = /** @class */ (function (_super) {
7238
7239
  };
7239
7240
  QuestionAdornerViewModel.prototype.getConvertToTypesActions = function () {
7240
7241
  var _this = this;
7241
- var convertClasses = _questionconverter__WEBPACK_IMPORTED_MODULE_3__["QuestionConverter"].getConvertToClasses(this.currentType, this.creator.toolbox.itemNames, true);
7242
+ var availableItems = this.creator.getAvailableToolboxItems(this.element, false);
7243
+ var itemNames = [];
7244
+ availableItems.forEach(function (item) { return itemNames.push(item.typeName); });
7245
+ var convertClasses = _questionconverter__WEBPACK_IMPORTED_MODULE_3__["QuestionConverter"].getConvertToClasses(this.currentType, itemNames, true);
7242
7246
  var res = [];
7243
7247
  var lastItem = null;
7244
7248
  convertClasses.forEach(function (className) {
@@ -7337,10 +7341,10 @@ var QuestionAdornerViewModel = /** @class */ (function (_super) {
7337
7341
  id: "isrequired",
7338
7342
  ariaChecked: new survey_core__WEBPACK_IMPORTED_MODULE_1__["ComputedUpdater"](function () { return _this.isRequired; }),
7339
7343
  ariaRole: "checkbox",
7340
- css: new survey_core__WEBPACK_IMPORTED_MODULE_1__["ComputedUpdater"](function () { return _this.isRequired ? "sv-action-bar-item--secondary" : ""; }),
7344
+ css: "sv-action-bar-item--secondary",
7341
7345
  title: this.creator.getLocString("pe.isRequired"),
7342
7346
  visibleIndex: 20,
7343
- iconName: new survey_core__WEBPACK_IMPORTED_MODULE_1__["ComputedUpdater"](function () { return _this.isRequired ? "icon-switch-active_16x16" : "icon-switch-inactive_16x16"; }),
7347
+ iconName: "icon-required",
7344
7348
  iconSize: 16,
7345
7349
  action: function () {
7346
7350
  if (_this.creator.isCanModifyProperty(_this.surveyElement, "isRequired")) {
@@ -7348,11 +7352,10 @@ var QuestionAdornerViewModel = /** @class */ (function (_super) {
7348
7352
  }
7349
7353
  }
7350
7354
  });
7351
- this.surveyElement.registerFunctionOnPropertyValueChanged("isRequired", function (value) {
7352
- requiredAction.iconName = value ? "icon-switch-active_16x16" : "icon-switch-inactive_16x16";
7353
- requiredAction.css = value ? "sv-action-bar-item--secondary" : "";
7354
- requiredAction.innerItem.iconName = requiredAction.iconName;
7355
- }, "isRequiredAdorner");
7355
+ requiredAction.innerCss = new survey_core__WEBPACK_IMPORTED_MODULE_1__["ComputedUpdater"](function () { return new survey_core__WEBPACK_IMPORTED_MODULE_1__["CssClassBuilder"]().append("svc-required-action").append("svc-required-action--active", _this.isRequired).toString(); });
7356
+ requiredAction.innerItem.title = new survey_core__WEBPACK_IMPORTED_MODULE_1__["ComputedUpdater"](function () {
7357
+ return _this.isRequired ? _this.creator.getLocString("pe.removeRequiredMark") : _this.creator.getLocString("pe.markRequired");
7358
+ });
7356
7359
  return requiredAction;
7357
7360
  };
7358
7361
  QuestionAdornerViewModel.prototype.buildActions = function (items) {
@@ -9047,9 +9050,6 @@ var TabDesignerPlugin = /** @class */ (function () {
9047
9050
  });
9048
9051
  this.toolboxTab = this.creator.sidebar.addTab("toolbox", "svc-toolbox", creator);
9049
9052
  this.creator.onPropertyChanged.add(function (sender, options) {
9050
- if (options.name === "isMobileView") {
9051
- _this.updatePropertyGridTabCaption();
9052
- }
9053
9053
  if (options.name === "toolboxLocation") {
9054
9054
  if (_this.toolboxTab.visible && options.newVal !== "sidebar") {
9055
9055
  _this.propertyGridTab.visible = true;
@@ -9057,13 +9057,9 @@ var TabDesignerPlugin = /** @class */ (function () {
9057
9057
  _this.toolboxTab.visible = options.newVal === "sidebar";
9058
9058
  }
9059
9059
  });
9060
- this.propertyGrid.onPropertyChanged.add(function (sender, options) {
9061
- if (options.name === "selectedElementName") {
9062
- _this.updatePropertyGridTabCaption();
9063
- }
9064
- });
9065
9060
  this.createActions().forEach(function (action) { return creator.toolbar.actions.push(action); });
9066
9061
  creator.registerShortcut("delete", {
9062
+ affectedTab: "designer",
9067
9063
  hotKey: {
9068
9064
  keyCode: 46,
9069
9065
  },
@@ -9091,9 +9087,6 @@ var TabDesignerPlugin = /** @class */ (function () {
9091
9087
  var _this = this;
9092
9088
  return new survey_core__WEBPACK_IMPORTED_MODULE_1__["ComputedUpdater"](function () { return _this.creator.activeTab === "designer"; });
9093
9089
  };
9094
- TabDesignerPlugin.prototype.updatePropertyGridTabCaption = function () {
9095
- this.propertyGridTab.caption = this.creator.isMobileView ? this.propertyGrid.selectedElementName : "";
9096
- };
9097
9090
  TabDesignerPlugin.prototype.activate = function () {
9098
9091
  this.model = new _designer__WEBPACK_IMPORTED_MODULE_4__["TabDesignerViewModel"](this.creator);
9099
9092
  this.creator.sidebar.activeTab = this.propertyGridTab.id;
@@ -9142,6 +9135,9 @@ var TabDesignerPlugin = /** @class */ (function () {
9142
9135
  }),
9143
9136
  action: function () {
9144
9137
  _this.selectSurvey();
9138
+ if (!_this.creator.isMobileView) {
9139
+ _this.creator.propertyGrid.getAllQuestions()[0].focus();
9140
+ }
9145
9141
  },
9146
9142
  active: this.isSettingsActive,
9147
9143
  pressed: this.isSettingsActive,
@@ -12001,6 +11997,7 @@ var logicCss = {
12001
11997
  },
12002
11998
  list: {
12003
11999
  root: "sv-list__container sl-list",
12000
+ itemBody: "sv-list__item-body sl-list__item-body"
12004
12001
  },
12005
12002
  embeddedsurvey: {
12006
12003
  mainRoot: "sl-embedded-survey"
@@ -12393,6 +12390,11 @@ var SurveyLogicTypes = /** @class */ (function () {
12393
12390
  baseClass: "question",
12394
12391
  propertyName: "requiredIf",
12395
12392
  },
12393
+ {
12394
+ name: "question_resetValue",
12395
+ baseClass: "question",
12396
+ propertyName: "resetValueIf",
12397
+ },
12396
12398
  {
12397
12399
  name: "column_visibility",
12398
12400
  baseClass: "matrixdropdowncolumn",
@@ -12408,6 +12410,11 @@ var SurveyLogicTypes = /** @class */ (function () {
12408
12410
  baseClass: "matrixdropdowncolumn",
12409
12411
  propertyName: "requiredIf",
12410
12412
  },
12413
+ {
12414
+ name: "column_resetValue",
12415
+ baseClass: "matrixdropdowncolumn",
12416
+ propertyName: "resetValueIf",
12417
+ },
12411
12418
  {
12412
12419
  name: "expression_expression",
12413
12420
  baseClass: "expression",
@@ -13187,6 +13194,8 @@ __webpack_require__(/*! ./logic.scss */ "./src/components/tabs/logic.scss");
13187
13194
  function initLogicOperator(question) {
13188
13195
  question.popupModel.isFocusedContent = true;
13189
13196
  question.popupModel.setWidthByTarget = false;
13197
+ question.popupModel.positionMode = "flex";
13198
+ question.popupModel.showPointer = true;
13190
13199
  question.dropdownListModel["listModel"].searchEnabled = question.searchEnabled;
13191
13200
  }
13192
13201
  var LogicEvent = /** @class */ (function (_super) {
@@ -14044,6 +14053,12 @@ var TestSurveyTabViewModel = /** @class */ (function (_super) {
14044
14053
  newSurvey.setCss(theme, false);
14045
14054
  }
14046
14055
  newSurvey.fitToContainer = true;
14056
+ newSurvey.addLayoutElement({
14057
+ id: "complete-customization",
14058
+ container: "completePage",
14059
+ component: "svc-complete-page",
14060
+ data: this
14061
+ });
14047
14062
  this.simulator.survey = newSurvey;
14048
14063
  if (this.onSurveyCreatedCallback)
14049
14064
  this.onSurveyCreatedCallback(this.survey);
@@ -14364,7 +14379,9 @@ __webpack_require__.r(__webpack_exports__);
14364
14379
  /* harmony import */ var _creator_settings__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../creator-settings */ "./src/creator-settings.ts");
14365
14380
  /* harmony import */ var _theme_custom_questions_font_settings__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./theme-custom-questions/font-settings */ "./src/components/tabs/theme-custom-questions/font-settings.ts");
14366
14381
  /* harmony import */ var _theme_custom_questions_element_settings__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./theme-custom-questions/element-settings */ "./src/components/tabs/theme-custom-questions/element-settings.ts");
14367
- /* harmony import */ var _themes__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./themes */ "./src/components/tabs/themes.ts");
14382
+ /* harmony import */ var _plugins_undo_redo_undo_redo_manager__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../plugins/undo-redo/undo-redo-manager */ "./src/plugins/undo-redo/undo-redo-manager.ts");
14383
+ /* harmony import */ var _themes__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./themes */ "./src/components/tabs/themes.ts");
14384
+
14368
14385
 
14369
14386
 
14370
14387
 
@@ -14388,7 +14405,8 @@ var ThemeBuilder = /** @class */ (function (_super) {
14388
14405
  _this.themeCssVariablesChanges = {};
14389
14406
  _this.colorCalculator = new _utils_utils__WEBPACK_IMPORTED_MODULE_6__["ColorCalculator"]();
14390
14407
  _this.blockChanges = false;
14391
- _this._availableThemes = _themes__WEBPACK_IMPORTED_MODULE_10__["PredefinedThemes"];
14408
+ _this._availableThemes = _themes__WEBPACK_IMPORTED_MODULE_11__["PredefinedThemes"];
14409
+ _this.prevQuestionValues = {};
14392
14410
  _this.onThemeSelected = new survey_core__WEBPACK_IMPORTED_MODULE_2__["EventBase"]();
14393
14411
  _this.onThemeModified = new survey_core__WEBPACK_IMPORTED_MODULE_2__["EventBase"]();
14394
14412
  _this.onCanModifyTheme = new survey_core__WEBPACK_IMPORTED_MODULE_2__["EventBase"]();
@@ -14396,6 +14414,7 @@ var ThemeBuilder = /** @class */ (function (_super) {
14396
14414
  _this.simulator = new _simulator__WEBPACK_IMPORTED_MODULE_1__["SurveySimulatorModel"]();
14397
14415
  _this.themeEditorSurveyValue = _this.createThemeEditorSurvey();
14398
14416
  _this.loadTheme(_this.surveyProvider.theme);
14417
+ _this.undoRedoManager = new _plugins_undo_redo_undo_redo_manager__WEBPACK_IMPORTED_MODULE_10__["UndoRedoManager"]();
14399
14418
  return _this;
14400
14419
  }
14401
14420
  Object.defineProperty(ThemeBuilder.prototype, "themeCssCustomizations", {
@@ -14461,6 +14480,13 @@ var ThemeBuilder = /** @class */ (function (_super) {
14461
14480
  enumerable: false,
14462
14481
  configurable: true
14463
14482
  });
14483
+ Object.defineProperty(ThemeBuilder.prototype, "currentThemeCssVariables", {
14484
+ get: function () {
14485
+ return this.currentTheme.cssVariables || {};
14486
+ },
14487
+ enumerable: false,
14488
+ configurable: true
14489
+ });
14464
14490
  ThemeBuilder.prototype.loadTheme = function (theme) {
14465
14491
  this.blockThemeChangedNotifications += 1;
14466
14492
  try {
@@ -14473,7 +14499,7 @@ var ThemeBuilder = /** @class */ (function (_super) {
14473
14499
  this.backgroundImageFit = theme.backgroundImageFit || this.backgroundImageFit;
14474
14500
  this.backgroundImageAttachment = theme.backgroundImageAttachment || this.backgroundImageAttachment;
14475
14501
  var effectiveThemeCssVariables = {};
14476
- Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["assign"])(effectiveThemeCssVariables, _themes__WEBPACK_IMPORTED_MODULE_10__["Themes"]["default-light"].cssVariables || {}, this.findSuitableTheme(this.themeName).cssVariables || {});
14502
+ Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["assign"])(effectiveThemeCssVariables, _themes__WEBPACK_IMPORTED_MODULE_11__["Themes"]["default-light"].cssVariables || {}, this.findSuitableTheme(this.themeName).cssVariables || {});
14477
14503
  Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["assign"])(effectiveThemeCssVariables, theme.cssVariables || {}, this.themeCssVariablesChanges);
14478
14504
  var effectiveTheme = {};
14479
14505
  Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["assign"])(effectiveTheme, theme, { cssVariables: effectiveThemeCssVariables });
@@ -14507,6 +14533,12 @@ var ThemeBuilder = /** @class */ (function (_super) {
14507
14533
  var newSurvey = this.surveyProvider.createSurvey(json || {}, "theme", this);
14508
14534
  newSurvey.setCss(theme, false);
14509
14535
  newSurvey.fitToContainer = true;
14536
+ newSurvey.addLayoutElement({
14537
+ id: "complete-customization",
14538
+ container: "completePage",
14539
+ component: "svc-complete-page",
14540
+ data: this
14541
+ });
14510
14542
  this.simulator.survey = newSurvey;
14511
14543
  this.updateSimulatorTheme();
14512
14544
  if (this.onSurveyCreatedCallback)
@@ -14552,16 +14584,18 @@ var ThemeBuilder = /** @class */ (function (_super) {
14552
14584
  this.updateSimulatorSurvey(json, currTheme);
14553
14585
  };
14554
14586
  ThemeBuilder.prototype.initialize = function (json, options) {
14555
- this.blockThemeChangedNotifications += 1;
14587
+ this.blockChanges = true;
14556
14588
  try {
14557
14589
  this.setJSON(json, this.startThemeClasses);
14558
14590
  this.updatePageList();
14591
+ this.updatePropertyGridEditors(this.themeEditorSurvey);
14592
+ this.updatePropertyGridEditorsAvailability();
14559
14593
  if (options.showPagesInTestSurveyTab !== undefined) {
14560
14594
  this.showPagesInTestSurveyTab = options.showPagesInTestSurveyTab;
14561
14595
  }
14562
14596
  }
14563
14597
  finally {
14564
- this.blockThemeChangedNotifications -= 1;
14598
+ this.blockChanges = false;
14565
14599
  }
14566
14600
  };
14567
14601
  ThemeBuilder.prototype.updatePageItem = function (page) {
@@ -14609,6 +14643,7 @@ var ThemeBuilder = /** @class */ (function (_super) {
14609
14643
  ThemeBuilder.prototype.testAgain = function () {
14610
14644
  this.setJSON(this.json, this.simulator.survey.css);
14611
14645
  this.updatePageList();
14646
+ this.updatePropertyGridEditors(this.themeEditorSurvey);
14612
14647
  this.show();
14613
14648
  };
14614
14649
  Object.defineProperty(ThemeBuilder.prototype, "availableThemes", {
@@ -14639,6 +14674,12 @@ var ThemeBuilder = /** @class */ (function (_super) {
14639
14674
  }
14640
14675
  return null;
14641
14676
  };
14677
+ ThemeBuilder.prototype.getPredefinedColorsItemValues = function () {
14678
+ var _this = this;
14679
+ return Object.keys(_themes__WEBPACK_IMPORTED_MODULE_11__["PredefinedColors"][this.themePalette]).map(function (colorName) {
14680
+ return new survey_core__WEBPACK_IMPORTED_MODULE_2__["ItemValue"](_themes__WEBPACK_IMPORTED_MODULE_11__["PredefinedColors"][_this.themePalette][colorName], Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.colors." + colorName));
14681
+ });
14682
+ };
14642
14683
  ThemeBuilder.prototype.initializeColorCalculator = function () {
14643
14684
  if (!this.currentTheme.cssVariables["--sjs-primary-backcolor"] ||
14644
14685
  !this.currentTheme.cssVariables["--sjs-primary-backcolor-light"] ||
@@ -14647,6 +14688,106 @@ var ThemeBuilder = /** @class */ (function (_super) {
14647
14688
  }
14648
14689
  this.colorCalculator.initialize(this.currentTheme.cssVariables["--sjs-primary-backcolor"], this.currentTheme.cssVariables["--sjs-primary-backcolor-light"], this.currentTheme.cssVariables["--sjs-primary-backcolor-dark"]);
14649
14690
  };
14691
+ ThemeBuilder.prototype.generalPropertiesChanged = function (options) {
14692
+ var _a;
14693
+ if (["themeName", "themeMode", "themePalette"].indexOf(options.name) !== -1) {
14694
+ if (options.name === "themeName") {
14695
+ this.loadTheme(this.findSuitableTheme(options.value) || (_a = {}, _a[options.name] = options.value, _a));
14696
+ }
14697
+ if (options.name === "themeMode") {
14698
+ this.loadTheme({ isPanelless: options.value === "lightweight" });
14699
+ }
14700
+ if (options.name === "themePalette") {
14701
+ this.loadTheme({ colorPalette: options.value });
14702
+ }
14703
+ this.updateSimulatorTheme();
14704
+ this.raiseThemeChanged();
14705
+ this.onThemeSelected.fire(this, { theme: this.currentTheme });
14706
+ this.surveyProvider.isThemePristine = Object.keys(this.themeCssVariablesChanges).length === 0;
14707
+ return true;
14708
+ }
14709
+ if (["backgroundImage", "backgroundImageFit", "backgroundImageAttachment", "backgroundOpacity"].indexOf(options.name) !== -1) {
14710
+ this[options.name] = options.value;
14711
+ this.raiseThemeChanged();
14712
+ this.raiseThemeModified(options);
14713
+ return true;
14714
+ }
14715
+ return false;
14716
+ };
14717
+ ThemeBuilder.prototype.headerViewContainerPropertiesChanged = function (options) {
14718
+ var headerSettings = options.value[0];
14719
+ this.survey.titleView = headerSettings["headerView"];
14720
+ this.surveyProvider.survey.titleView = headerSettings["headerView"];
14721
+ if (headerSettings["headerView"] === "title") {
14722
+ this.survey.logoPosition = headerSettings["logoPosition"];
14723
+ this.surveyProvider.survey.logoPosition = headerSettings["logoPosition"];
14724
+ }
14725
+ else {
14726
+ this.currentTheme.cover = this.getCoverJson(headerSettings);
14727
+ this.setCoverCssVariables(headerSettings);
14728
+ }
14729
+ this.updateSimulatorTheme();
14730
+ this.raiseThemeChanged();
14731
+ this.raiseThemeModified(options);
14732
+ };
14733
+ ThemeBuilder.prototype.cssVariablePropertiesChanged = function (options) {
14734
+ var _a, _b;
14735
+ if (options.name.indexOf("--") === 0) {
14736
+ this.setThemeCssVariablesChanges(options.name, options.value, options.question);
14737
+ }
14738
+ if (options.name == "commonScale") {
14739
+ this.survey.triggerResponsiveness(true);
14740
+ this.setThemeCssVariablesChanges("--sjs-base-unit", (options.value * 8 / 100) + "px", options.question);
14741
+ }
14742
+ if (options.name == "commonFontSize") {
14743
+ this.setThemeCssVariablesChanges("--sjs-font-size", (options.value * 16 / 100) + "px", options.question);
14744
+ }
14745
+ if (options.name == "cornerRadius") {
14746
+ this.setThemeCssVariablesChanges("--sjs-corner-radius", options.value + "px", options.question);
14747
+ }
14748
+ if (options.name === "questionBackgroundTransparency" || options.name === "editorPanel") {
14749
+ var baseColor = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["parseColor"])(this.themeEditorSurvey.getValue("--sjs-general-backcolor-dim-light")).color;
14750
+ var questionBackgroundTransparencyValue = this.themeEditorSurvey.getValue("questionBackgroundTransparency");
14751
+ this.setThemeCssVariablesChanges("--sjs-editor-background", Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["ingectAlpha"])(baseColor, questionBackgroundTransparencyValue / 100), options.question);
14752
+ }
14753
+ if (options.name === "panelBackgroundTransparency" || options.name === "questionPanel") {
14754
+ var baseColor = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["parseColor"])(this.themeEditorSurvey.getValue("--sjs-general-backcolor")).color;
14755
+ var panelBackgroundTransparencyValue = this.themeEditorSurvey.getValue("panelBackgroundTransparency");
14756
+ this.setThemeCssVariablesChanges("--sjs-question-background", Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["ingectAlpha"])(baseColor, panelBackgroundTransparencyValue / 100), options.question);
14757
+ }
14758
+ if (((_a = options.question) === null || _a === void 0 ? void 0 : _a.getType()) === "fontsettings") {
14759
+ Object(_theme_custom_questions_font_settings__WEBPACK_IMPORTED_MODULE_8__["fontsettingsToCssVariable"])(options.question, this.themeCssVariablesChanges);
14760
+ this.raiseThemeChanged();
14761
+ this.raiseThemeModified(options);
14762
+ }
14763
+ if (((_b = options.question) === null || _b === void 0 ? void 0 : _b.getType()) === "elementsettings") {
14764
+ Object(_theme_custom_questions_element_settings__WEBPACK_IMPORTED_MODULE_9__["elementSettingsToCssVariable"])(options.question, this.themeCssVariablesChanges);
14765
+ this.raiseThemeChanged();
14766
+ this.raiseThemeModified(options);
14767
+ }
14768
+ };
14769
+ ThemeBuilder.prototype.updateDependentQuestionValues = function (options) {
14770
+ if (options.name === "generalBackcolorDimColor") {
14771
+ this.themeEditorSurvey.setValue("--sjs-general-backcolor-dim", options.value);
14772
+ }
14773
+ if (options.name === "--sjs-general-backcolor-dim") {
14774
+ this.themeEditorSurvey.getQuestionByName("generalBackcolorDimColor").value = options.value;
14775
+ }
14776
+ if (options.name === "generalPrimaryColor") {
14777
+ this.themeEditorSurvey.setValue("--sjs-primary-backcolor", options.value);
14778
+ }
14779
+ if (options.name === "--sjs-primary-backcolor") {
14780
+ this.colorCalculator.calculateColors(options.value);
14781
+ this.themeEditorSurvey.setValue("--sjs-primary-backcolor-light", this.colorCalculator.colorSettings.newColorLight);
14782
+ this.themeEditorSurvey.setValue("--sjs-primary-backcolor-dark", this.colorCalculator.colorSettings.newColorDark);
14783
+ this.themeEditorSurvey.getQuestionByName("generalPrimaryColor").value = options.value;
14784
+ }
14785
+ };
14786
+ ThemeBuilder.prototype.setThemeCssVariablesChanges = function (variableName, value, question) {
14787
+ this.themeCssVariablesChanges[variableName] = value;
14788
+ this.raiseThemeChanged();
14789
+ this.raiseThemeModified({ name: variableName, value: value, question: question });
14790
+ };
14650
14791
  ThemeBuilder.prototype.createThemeEditorSurvey = function () {
14651
14792
  var _this = this;
14652
14793
  var json = this.getThemeEditorSurveyJSON();
@@ -14657,78 +14798,38 @@ var ThemeBuilder = /** @class */ (function (_super) {
14657
14798
  themeBuilderCss.root += " spg-theme-builder-root";
14658
14799
  themeEditorSurvey.css = themeBuilderCss;
14659
14800
  themeEditorSurvey.enterKeyAction = "loseFocus";
14660
- themeEditorSurvey.onValueChanged.add(function (sender, options) {
14661
- var _a;
14662
- var _b, _c;
14801
+ themeEditorSurvey.onValueChanging.add(function (sender, options) {
14663
14802
  if (_this.blockChanges)
14664
14803
  return;
14665
- if (["themeName", "themeMode", "themePalette"].indexOf(options.name) !== -1) {
14666
- if (options.name === "themeName") {
14667
- _this.loadTheme(_this.findSuitableTheme(options.value) || (_a = {}, _a[options.name] = options.value, _a));
14668
- }
14669
- if (options.name === "themeMode") {
14670
- _this.loadTheme({ isPanelless: options.value === "lightweight" });
14671
- }
14672
- if (options.name === "themePalette") {
14673
- _this.loadTheme({ colorPalette: options.value });
14674
- }
14675
- _this.updateSimulatorTheme();
14676
- _this.raiseThemeChanged();
14677
- _this.onThemeSelected.fire(_this, { theme: _this.currentTheme });
14678
- _this.surveyProvider.isThemePristine = Object.keys(_this.themeCssVariablesChanges).length === 0;
14679
- return;
14680
- }
14681
- if (["backgroundImage", "backgroundImageFit", "backgroundImageAttachment"].indexOf(options.name) !== -1) {
14682
- _this[options.name] = options.value;
14683
- _this.raiseThemeChanged();
14684
- _this.raiseThemeModified(options);
14804
+ _this.prevQuestionValues[options.name] = options.oldValue;
14805
+ });
14806
+ themeEditorSurvey.onValueChanged.add(function (sender, options) {
14807
+ if (_this.blockChanges)
14685
14808
  return;
14809
+ if (_this.blockThemeChangedNotifications == 0) {
14810
+ _this.undoRedoManager.startTransaction(options.name + " changed");
14686
14811
  }
14687
- if (options.name === "backgroundOpacity") {
14688
- _this.currentTheme.backgroundOpacity = options.value / 100;
14689
- _this.survey.backgroundOpacity = options.value / 100;
14690
- _this.raiseThemeChanged();
14691
- _this.raiseThemeModified(options);
14812
+ _this.undoRedoManager.onPropertyValueChanged("value", _this.prevQuestionValues[options.name], options.value, options.question, undefined);
14813
+ if (_this.generalPropertiesChanged(options)) {
14814
+ if (_this.blockThemeChangedNotifications == 0) {
14815
+ _this.undoRedoManager.stopTransaction();
14816
+ }
14692
14817
  return;
14693
14818
  }
14694
- if (options.name.indexOf("--") === 0) {
14695
- _this.themeCssVariablesChanges[options.name] = options.value;
14696
- _this.raiseThemeChanged();
14819
+ if (options.name === "headerViewContainer") {
14820
+ _this.headerViewContainerPropertiesChanged(options);
14697
14821
  }
14822
+ _this.cssVariablePropertiesChanged(options);
14698
14823
  _this.blockThemeChangedNotifications += 1;
14699
- if (options.name == "commonScale") {
14700
- _this.survey.triggerResponsiveness(true);
14701
- }
14702
- if (options.name === "--sjs-primary-backcolor") {
14703
- _this.colorCalculator.calculateColors(options.value);
14704
- _this.themeCssVariablesChanges["--sjs-primary-backcolor"] = options.value;
14705
- _this.themeCssVariablesChanges["--sjs-primary-backcolor-light"] = _this.colorCalculator.colorSettings.newColorLight;
14706
- _this.themeCssVariablesChanges["--sjs-primary-backcolor-dark"] = _this.colorCalculator.colorSettings.newColorDark;
14707
- _this.themeEditorSurvey.setValue("--sjs-primary-backcolor-light", _this.colorCalculator.colorSettings.newColorLight);
14708
- _this.themeEditorSurvey.setValue("--sjs-primary-backcolor-dark", _this.colorCalculator.colorSettings.newColorDark);
14709
- }
14710
- if (options.name === "questionBackgroundTransparency" || options.name === "editorPanel") {
14711
- var baseColor = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["parseColor"])(themeEditorSurvey.getValue("--sjs-general-backcolor-dim-light")).color;
14712
- var questionBackgroundTransparencyValue = themeEditorSurvey.getValue("questionBackgroundTransparency");
14713
- _this.themeCssVariablesChanges["--sjs-editor-background"] = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["ingectAlpha"])(baseColor, questionBackgroundTransparencyValue / 100);
14714
- }
14715
- if (options.name === "panelBackgroundTransparency" || options.name === "questionPanel") {
14716
- var baseColor = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["parseColor"])(themeEditorSurvey.getValue("--sjs-general-backcolor")).color;
14717
- var panelBackgroundTransparencyValue = themeEditorSurvey.getValue("panelBackgroundTransparency");
14718
- _this.themeCssVariablesChanges["--sjs-question-background"] = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["ingectAlpha"])(baseColor, panelBackgroundTransparencyValue / 100);
14719
- }
14720
- if (((_b = options.question) === null || _b === void 0 ? void 0 : _b.getType()) === "fontsettings") {
14721
- Object(_theme_custom_questions_font_settings__WEBPACK_IMPORTED_MODULE_8__["fontsettingsToCssVariable"])(options.question, _this.themeCssVariablesChanges);
14722
- }
14723
- if (((_c = options.question) === null || _c === void 0 ? void 0 : _c.getType()) === "elementsettings") {
14724
- Object(_theme_custom_questions_element_settings__WEBPACK_IMPORTED_MODULE_9__["elementSettingsToCssVariable"])(options.question, _this.themeCssVariablesChanges);
14725
- }
14824
+ _this.updateDependentQuestionValues(options);
14726
14825
  var newCssVariables = {};
14727
14826
  Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["assign"])(newCssVariables, _this.currentTheme.cssVariables, _this.themeCssVariablesChanges);
14728
14827
  _this.currentTheme.cssVariables = newCssVariables;
14729
- _this.blockThemeChangedNotifications -= 1;
14730
14828
  _this.updateSimulatorTheme();
14731
- _this.raiseThemeModified(options);
14829
+ _this.blockThemeChangedNotifications -= 1;
14830
+ if (!!_this.undoRedoManager && _this.blockThemeChangedNotifications == 0) {
14831
+ _this.undoRedoManager.stopTransaction();
14832
+ }
14732
14833
  });
14733
14834
  themeEditorSurvey.onUploadFiles.add(function (_, options) {
14734
14835
  var callback = function (status, data) { return options.callback(status, [{ content: data, file: options.files[0] }]); };
@@ -14741,12 +14842,12 @@ var ThemeBuilder = /** @class */ (function (_super) {
14741
14842
  return themeEditorSurvey;
14742
14843
  };
14743
14844
  ThemeBuilder.prototype.findSuitableTheme = function (themeName) {
14744
- var probeThemeFullName = Object(_themes__WEBPACK_IMPORTED_MODULE_10__["getThemeFullName"])({ themeName: themeName, colorPalette: this.themePalette, isPanelless: this.themeMode === "lightweight" });
14745
- var suitableTheme = _themes__WEBPACK_IMPORTED_MODULE_10__["Themes"][probeThemeFullName];
14845
+ var probeThemeFullName = Object(_themes__WEBPACK_IMPORTED_MODULE_11__["getThemeFullName"])({ themeName: themeName, colorPalette: this.themePalette, isPanelless: this.themeMode === "lightweight" });
14846
+ var suitableTheme = _themes__WEBPACK_IMPORTED_MODULE_11__["Themes"][probeThemeFullName];
14746
14847
  if (!!suitableTheme) {
14747
14848
  return suitableTheme;
14748
14849
  }
14749
- var appropriateThemeNames = Object.keys(_themes__WEBPACK_IMPORTED_MODULE_10__["Themes"]).filter(function (fullName) { return fullName.indexOf(themeName) === 0; });
14850
+ var appropriateThemeNames = Object.keys(_themes__WEBPACK_IMPORTED_MODULE_11__["Themes"]).filter(function (fullName) { return fullName.indexOf(themeName) === 0; });
14750
14851
  for (var _i = 0, appropriateThemeNames_1 = appropriateThemeNames; _i < appropriateThemeNames_1.length; _i++) {
14751
14852
  var fullThemeName = appropriateThemeNames_1[_i];
14752
14853
  if (fullThemeName.indexOf(themeName + "-" + this.themePalette) === 0) {
@@ -14756,7 +14857,30 @@ var ThemeBuilder = /** @class */ (function (_super) {
14756
14857
  probeThemeFullName = themeName + "-" + this.themePalette + (this.themeMode === "lightweight" ? "-panelless" : "");
14757
14858
  }
14758
14859
  }
14759
- return _themes__WEBPACK_IMPORTED_MODULE_10__["Themes"][probeThemeFullName] || _themes__WEBPACK_IMPORTED_MODULE_10__["Themes"][appropriateThemeNames[0]];
14860
+ return _themes__WEBPACK_IMPORTED_MODULE_11__["Themes"][probeThemeFullName] || _themes__WEBPACK_IMPORTED_MODULE_11__["Themes"][appropriateThemeNames[0]];
14861
+ };
14862
+ ThemeBuilder.prototype.getCoverJson = function (headerSettings) {
14863
+ var result = {};
14864
+ survey_core__WEBPACK_IMPORTED_MODULE_2__["Serializer"].getProperties("cover").map(function (pr) { return pr.name; })
14865
+ .filter(function (key) { return headerSettings[key] !== undefined && headerSettings[key] !== null; })
14866
+ .forEach(function (key) {
14867
+ result[key] = headerSettings[key];
14868
+ });
14869
+ result["backgroundImageOpacity"] = headerSettings["backgroundImageOpacity"] / 100;
14870
+ return result;
14871
+ };
14872
+ ThemeBuilder.prototype.setCoverCssVariables = function (headerSettings) {
14873
+ var coverBackgroundColorValue = "trasparent";
14874
+ if (headerSettings["backgroundColorSwitch"] === "accentColor") {
14875
+ coverBackgroundColorValue = this.currentTheme.cssVariables["--sjs-primary-backcolor"];
14876
+ }
14877
+ else if (headerSettings["backgroundColorSwitch"] === "custom") {
14878
+ coverBackgroundColorValue = headerSettings.backgroundColor;
14879
+ }
14880
+ this.themeCssVariablesChanges["--sjs-cover-backcolor"] = coverBackgroundColorValue;
14881
+ if (!!headerSettings["titleForecolor"]) {
14882
+ this.themeCssVariablesChanges["--sjs-cover-title-forecolor"] = headerSettings.titleForecolor;
14883
+ }
14760
14884
  };
14761
14885
  ThemeBuilder.prototype.loadThemeIntoPropertyGrid = function () {
14762
14886
  this.blockChanges = true;
@@ -14767,27 +14891,79 @@ var ThemeBuilder = /** @class */ (function (_super) {
14767
14891
  this.themeEditorSurvey.setValue("themeMode", this.themeMode);
14768
14892
  this.themeEditorSurvey.setValue("themePalette", this.themePalette);
14769
14893
  this.updatePropertyGridEditors(this.themeEditorSurvey);
14770
- this.updatePropertyGridEditorsAvailability(this.themeEditorSurvey);
14894
+ this.updatePropertyGridEditorsAvailability();
14771
14895
  }
14772
14896
  finally {
14773
14897
  this.blockChanges = false;
14774
14898
  }
14775
14899
  };
14776
- ThemeBuilder.prototype.updatePropertyGridEditorsAvailability = function (themeEditorSurvey) {
14777
- var isCustomTheme = _themes__WEBPACK_IMPORTED_MODULE_10__["PredefinedThemes"].indexOf(this.themeName) === -1;
14778
- themeEditorSurvey.getQuestionByName("themeMode").readOnly = isCustomTheme;
14779
- themeEditorSurvey.getQuestionByName("themePalette").readOnly = isCustomTheme;
14900
+ ThemeBuilder.prototype.getBackgroundColorSwitchByValue = function (backgroundColor) {
14901
+ if (!backgroundColor)
14902
+ return "none";
14903
+ if (backgroundColor === this.currentTheme.cssVariables["--sjs-primary-backcolor"])
14904
+ return "accentColor";
14905
+ return "custom";
14906
+ };
14907
+ ThemeBuilder.prototype.updateHeaderViewContainerEditors = function (themeCssVariables) {
14908
+ var _this = this;
14909
+ var headerViewContainerQuestion = this.themeEditorSurvey.getQuestionByName("headerViewContainer");
14910
+ headerViewContainerQuestion.visible = _creator_settings__WEBPACK_IMPORTED_MODULE_7__["settings"].theme.allowEditHeaderSettings;
14911
+ var panel = headerViewContainerQuestion.panels[0];
14912
+ panel.getQuestionByName("backgroundColor").choices = this.getPredefinedColorsItemValues();
14913
+ if (!!this.survey) {
14914
+ panel.getQuestionByName("headerView").value = this.survey.titleView;
14915
+ panel.getQuestionByName("logoPosition").value = this.survey.logoPosition;
14916
+ panel.getQuestionByName("logoPositionX").readOnly = !this.survey.logo;
14917
+ panel.getQuestionByName("logoPositionY").readOnly = !this.survey.logo;
14918
+ panel.getQuestionByName("logoPosition").readOnly = !this.survey.logo;
14919
+ panel.getQuestionByName("titlePositionX").readOnly = !this.survey.title;
14920
+ panel.getQuestionByName("titlePositionY").readOnly = !this.survey.title;
14921
+ panel.getQuestionByName("descriptionPositionX").readOnly = !this.survey.description;
14922
+ panel.getQuestionByName("descriptionPositionY").readOnly = !this.survey.description;
14923
+ }
14924
+ if (!!this.currentTheme.cover) {
14925
+ Object.keys(this.currentTheme.cover).forEach(function (key) {
14926
+ var question = panel.getQuestionByName(key);
14927
+ if (!!question && key === "backgroundImageOpacity") {
14928
+ question.value = _this.currentTheme.cover[key] * 100;
14929
+ }
14930
+ else if (question) {
14931
+ question.value = _this.currentTheme.cover[key];
14932
+ }
14933
+ });
14934
+ var titleForecolorQuestion = panel.getQuestionByName("titleForecolor");
14935
+ var titleForecolorValue = themeCssVariables["--sjs-cover-title-forecolor"] || themeCssVariables["--sjs-general-dim-forecolor"];
14936
+ if (!!titleForecolorQuestion && !!titleForecolorValue) {
14937
+ titleForecolorQuestion.value = titleForecolorValue;
14938
+ }
14939
+ var backgroundColorQuestion = panel.getQuestionByName("backgroundColor");
14940
+ var backgroundColorValue = themeCssVariables["--sjs-cover-backcolor"];
14941
+ if (!!backgroundColorQuestion && !!backgroundColorValue) {
14942
+ backgroundColorQuestion.value = backgroundColorValue;
14943
+ panel.getQuestionByName("backgroundColorSwitch").value = this.getBackgroundColorSwitchByValue(backgroundColorValue);
14944
+ }
14945
+ }
14946
+ };
14947
+ ThemeBuilder.prototype.updatePropertyGridEditorsAvailability = function () {
14948
+ var isCustomTheme = _themes__WEBPACK_IMPORTED_MODULE_11__["PredefinedThemes"].indexOf(this.themeName) === -1;
14949
+ this.themeEditorSurvey.getQuestionByName("themeMode").readOnly = isCustomTheme;
14950
+ this.themeEditorSurvey.getQuestionByName("themePalette").readOnly = isCustomTheme;
14780
14951
  var canModify = !this.surveyProvider.readOnly;
14781
14952
  var options = {
14782
14953
  theme: this.currentTheme,
14783
14954
  canModify: canModify
14784
14955
  };
14785
14956
  this.onCanModifyTheme.fire(this, options);
14786
- themeEditorSurvey.getAllQuestions().forEach(function (q) {
14957
+ this.themeEditorSurvey.getAllQuestions().forEach(function (q) {
14787
14958
  if (["themeName", "themePalette", "themeMode"].indexOf(q.name) === -1) {
14788
14959
  q.readOnly = !options.canModify;
14789
14960
  }
14790
14961
  });
14962
+ if (!!this.survey) {
14963
+ this.themeEditorSurvey.getQuestionByName("surveyTitle").readOnly = !this.survey.hasTitle;
14964
+ this.themeEditorSurvey.getQuestionByName("pageTitle").readOnly = !this.survey.pages.some(function (p) { return !!p.title; });
14965
+ this.themeEditorSurvey.getQuestionByName("pageDescription").readOnly = !this.survey.pages.some(function (p) { return !!p.description; });
14966
+ }
14791
14967
  };
14792
14968
  ThemeBuilder.prototype.updatePropertyGridEditors = function (themeEditorSurvey) {
14793
14969
  var _this = this;
@@ -14796,6 +14972,9 @@ var ThemeBuilder = /** @class */ (function (_super) {
14796
14972
  themeEditorSurvey.getQuestionByName("backgroundImage").value = this.backgroundImage;
14797
14973
  themeEditorSurvey.getQuestionByName("backgroundImageFit").value = this.backgroundImageFit;
14798
14974
  themeEditorSurvey.getQuestionByName("backgroundImageAttachment").value = this.backgroundImageAttachment;
14975
+ themeEditorSurvey.getQuestionByName("generalPrimaryColor").value = themeEditorSurvey.getQuestionByName("--sjs-primary-backcolor").value;
14976
+ themeEditorSurvey.getQuestionByName("generalBackcolorDimColor").value = themeEditorSurvey.getQuestionByName("--sjs-general-backcolor-dim").value;
14977
+ this.updateHeaderViewContainerEditors(newCssVariables);
14799
14978
  Object(_theme_custom_questions_element_settings__WEBPACK_IMPORTED_MODULE_9__["elementSettingsFromCssVariable"])(themeEditorSurvey.getQuestionByName("questionPanel"), newCssVariables, newCssVariables["--sjs-general-backcolor"], newCssVariables["--sjs-general-backcolor-dark"]);
14800
14979
  Object(_theme_custom_questions_element_settings__WEBPACK_IMPORTED_MODULE_9__["elementSettingsFromCssVariable"])(themeEditorSurvey.getQuestionByName("editorPanel"), newCssVariables, newCssVariables["--sjs-general-backcolor-dim-light"], newCssVariables["--sjs-general-backcolor-dim-dark"]);
14801
14980
  Object(_theme_custom_questions_font_settings__WEBPACK_IMPORTED_MODULE_8__["fontsettingsFromCssVariable"])(themeEditorSurvey.getQuestionByName("surveyTitle"), newCssVariables);
@@ -14815,7 +14994,7 @@ var ThemeBuilder = /** @class */ (function (_super) {
14815
14994
  }
14816
14995
  themeEditorSurvey.getAllQuestions().forEach(function (question) {
14817
14996
  if (["color", "colorsettings"].indexOf(question.getType()) !== -1) {
14818
- question.choices = Object.keys(_themes__WEBPACK_IMPORTED_MODULE_10__["PredefinedColors"][_this.themePalette]).map(function (colorName) { return new survey_core__WEBPACK_IMPORTED_MODULE_2__["ItemValue"](_themes__WEBPACK_IMPORTED_MODULE_10__["PredefinedColors"][_this.themePalette][colorName], Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.colors." + colorName)); });
14997
+ question.choices = _this.getPredefinedColorsItemValues();
14819
14998
  }
14820
14999
  });
14821
15000
  };
@@ -14881,13 +15060,13 @@ var ThemeBuilder = /** @class */ (function (_super) {
14881
15060
  elements: [
14882
15061
  {
14883
15062
  type: "color",
14884
- name: "--sjs-primary-backcolor",
15063
+ name: "generalPrimaryColor",
14885
15064
  title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.primaryColor"),
14886
15065
  descriptionLocation: "hidden",
14887
15066
  },
14888
15067
  {
14889
15068
  type: "color",
14890
- name: "--sjs-general-backcolor-dim",
15069
+ name: "generalBackcolorDimColor",
14891
15070
  title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.backgroundDimColor"),
14892
15071
  descriptionLocation: "hidden",
14893
15072
  },
@@ -14988,12 +15167,6 @@ var ThemeBuilder = /** @class */ (function (_super) {
14988
15167
  min: 0,
14989
15168
  step: 5
14990
15169
  },
14991
- {
14992
- type: "expression",
14993
- name: "--sjs-font-size",
14994
- expression: "{commonFontSize}*16/100+\"px\"",
14995
- visible: false
14996
- },
14997
15170
  ]
14998
15171
  }, {
14999
15172
  type: "panel",
@@ -15008,12 +15181,6 @@ var ThemeBuilder = /** @class */ (function (_super) {
15008
15181
  min: 0,
15009
15182
  step: 5
15010
15183
  },
15011
- {
15012
- type: "expression",
15013
- name: "--sjs-base-unit",
15014
- expression: "{commonScale}*8/100+\"px\"",
15015
- visible: false
15016
- },
15017
15184
  {
15018
15185
  type: "spinedit",
15019
15186
  name: "cornerRadius",
@@ -15023,12 +15190,187 @@ var ThemeBuilder = /** @class */ (function (_super) {
15023
15190
  defaultValue: 4,
15024
15191
  min: 0
15025
15192
  },
15193
+ ]
15194
+ }
15195
+ ]
15196
+ }, {
15197
+ type: "panel",
15198
+ state: "collapsed",
15199
+ title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.groupHeader"),
15200
+ elements: [
15201
+ {
15202
+ type: "panel",
15203
+ elements: [
15026
15204
  {
15027
- type: "expression",
15028
- name: "--sjs-corner-radius",
15029
- expression: "{cornerRadius}+\"px\"",
15030
- visible: false
15031
- },
15205
+ "type": "paneldynamic",
15206
+ "name": "headerViewContainer",
15207
+ "titleLocation": "hidden",
15208
+ "allowAddPanel": false,
15209
+ "allowRemovePanel": false,
15210
+ "panelCount": 1,
15211
+ "defaultValue": [
15212
+ {
15213
+ "headerView": "title",
15214
+ "logoPosition": "right",
15215
+ "areaWidth": "survey",
15216
+ "backgroundColorSwitch": "none",
15217
+ "backgroundImageFit": "cover",
15218
+ "backgroundImageOpacity": 100,
15219
+ "overlap": false,
15220
+ "logoPositionX": "right",
15221
+ "logoPositionY": "top",
15222
+ "titlePositionX": "left",
15223
+ "titlePositionY": "bottom",
15224
+ "descriptionPositionX": "left",
15225
+ "descriptionPositionY": "bottom",
15226
+ "textWidth": 512,
15227
+ "height": 256
15228
+ }
15229
+ ],
15230
+ "templateElements": [
15231
+ {
15232
+ type: "panel",
15233
+ questionTitleLocation: "top",
15234
+ elements: [
15235
+ {
15236
+ type: "buttongroup",
15237
+ name: "headerView",
15238
+ title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.headerView"),
15239
+ choices: [
15240
+ { value: "title", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.headerViewTitle") },
15241
+ { value: "cover", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.headerViewCover") }
15242
+ ]
15243
+ },
15244
+ {
15245
+ type: "buttongroup",
15246
+ name: "logoPosition",
15247
+ title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.logoPosition"),
15248
+ visibleIf: "{panel.headerView} = 'title'",
15249
+ choices: [
15250
+ { value: "left", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.horizontalAlignmentLeft") },
15251
+ { value: "right", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.horizontalAlignmentRight") }
15252
+ ],
15253
+ },
15254
+ {
15255
+ type: "spinedit",
15256
+ name: "height",
15257
+ title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("p.height"),
15258
+ descriptionLocation: "hidden",
15259
+ visibleIf: "{panel.headerView} = 'cover'",
15260
+ unit: "px",
15261
+ min: 0
15262
+ },
15263
+ {
15264
+ type: "buttongroup",
15265
+ name: "areaWidth",
15266
+ title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.coverAreaWidth"),
15267
+ choices: [
15268
+ { value: "survey", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.coverAreaWidthSurvey") },
15269
+ { value: "container", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.coverAreaWidthContainer") }
15270
+ ],
15271
+ visibleIf: "{panel.headerView} = 'cover'",
15272
+ },
15273
+ {
15274
+ type: "spinedit",
15275
+ name: "textWidth",
15276
+ title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.coverTextWidth"),
15277
+ descriptionLocation: "hidden",
15278
+ visibleIf: "{panel.headerView} = 'cover'",
15279
+ unit: "px",
15280
+ min: 0
15281
+ }
15282
+ ]
15283
+ }, {
15284
+ type: "panel",
15285
+ questionTitleLocation: "top",
15286
+ visibleIf: "{panel.headerView} = 'cover'",
15287
+ elements: [
15288
+ {
15289
+ type: "buttongroup",
15290
+ name: "backgroundColorSwitch",
15291
+ title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.coverBackgroundColorSwitch"),
15292
+ choices: [
15293
+ { value: "none", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.coverBackgroundColorNone") },
15294
+ { value: "accentColor", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.coverBackgroundColorAccentColor") },
15295
+ { value: "custom", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.coverBackgroundColorCustom") },
15296
+ ],
15297
+ },
15298
+ {
15299
+ type: "color",
15300
+ name: "backgroundColor",
15301
+ enableIf: "{panel.backgroundColorSwitch} = 'custom'",
15302
+ titleLocation: "hidden",
15303
+ descriptionLocation: "hidden",
15304
+ },
15305
+ {
15306
+ type: "panel",
15307
+ title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.backgroundImage"),
15308
+ elements: [
15309
+ {
15310
+ type: "fileedit",
15311
+ storeDataAsText: false,
15312
+ name: "backgroundImage",
15313
+ titleLocation: "hidden",
15314
+ maxSize: this.surveyProvider.onUploadFile.isEmpty ? 65536 : undefined,
15315
+ acceptedTypes: "image/*",
15316
+ placeholder: "Browse..."
15317
+ },
15318
+ {
15319
+ type: "buttongroup",
15320
+ name: "backgroundImageFit",
15321
+ enableIf: "{panel.backgroundImage} notempty",
15322
+ titleLocation: "hidden",
15323
+ choices: [
15324
+ { value: "cover", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.backgroundImageFitCover") },
15325
+ { value: "fill", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.backgroundImageFitFill") },
15326
+ { value: "contain", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.backgroundImageFitContain") },
15327
+ { value: "tile", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.backgroundImageFitTile") },
15328
+ ],
15329
+ },
15330
+ {
15331
+ type: "spinedit",
15332
+ name: "backgroundImageOpacity",
15333
+ enableIf: "{panel.backgroundImage} notempty",
15334
+ titleLocation: "left",
15335
+ title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.backgroundOpacity"),
15336
+ descriptionLocation: "hidden",
15337
+ unit: "%",
15338
+ min: 0,
15339
+ max: 100,
15340
+ step: 5
15341
+ },
15342
+ ]
15343
+ },
15344
+ {
15345
+ type: "color",
15346
+ name: "titleForecolor",
15347
+ title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.coverTitleForecolor"),
15348
+ descriptionLocation: "hidden",
15349
+ },
15350
+ {
15351
+ type: "boolean",
15352
+ name: "overlap",
15353
+ renderAs: "checkbox",
15354
+ title: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.coverOverlap"),
15355
+ titleLocation: "hidden",
15356
+ descriptionLocation: "hidden",
15357
+ }
15358
+ ]
15359
+ }, {
15360
+ type: "panel",
15361
+ questionTitleLocation: "top",
15362
+ visibleIf: "{panel.headerView} = 'cover'",
15363
+ elements: [
15364
+ this.getHorizontalAlignment("logoPositionX", Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.logoPosition"), "right"),
15365
+ this.getVerticalAlignment("logoPositionY", "top"),
15366
+ this.getHorizontalAlignment("titlePositionX", Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.coverTitlePosition"), "left"),
15367
+ this.getVerticalAlignment("titlePositionY", "bottom"),
15368
+ this.getHorizontalAlignment("descriptionPositionX", Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.coverDescriptionPosition"), "left"),
15369
+ this.getVerticalAlignment("descriptionPositionY", "bottom"),
15370
+ ]
15371
+ }
15372
+ ]
15373
+ }
15032
15374
  ]
15033
15375
  }
15034
15376
  ]
@@ -15107,7 +15449,6 @@ var ThemeBuilder = /** @class */ (function (_super) {
15107
15449
  descriptionLocation: "hidden",
15108
15450
  defaultValue: {
15109
15451
  family: _creator_settings__WEBPACK_IMPORTED_MODULE_7__["settings"].theme.fontFamily,
15110
- color: "rgba(22, 22, 22, 1)",
15111
15452
  weight: "700",
15112
15453
  size: 32
15113
15454
  }
@@ -15118,7 +15459,7 @@ var ThemeBuilder = /** @class */ (function (_super) {
15118
15459
  descriptionLocation: "hidden",
15119
15460
  defaultValue: {
15120
15461
  family: _creator_settings__WEBPACK_IMPORTED_MODULE_7__["settings"].theme.fontFamily,
15121
- color: "rgba(22, 22, 22, 1)",
15462
+ color: "rgba(0, 0, 0, 0.91)",
15122
15463
  weight: "700",
15123
15464
  size: 24
15124
15465
  }
@@ -15129,7 +15470,7 @@ var ThemeBuilder = /** @class */ (function (_super) {
15129
15470
  descriptionLocation: "hidden",
15130
15471
  defaultValue: {
15131
15472
  family: _creator_settings__WEBPACK_IMPORTED_MODULE_7__["settings"].theme.fontFamily,
15132
- color: "rgba(22, 22, 22, 1)",
15473
+ color: "rgba(0, 0, 0, 0.45)",
15133
15474
  weight: "400",
15134
15475
  size: 16
15135
15476
  }
@@ -15146,6 +15487,7 @@ var ThemeBuilder = /** @class */ (function (_super) {
15146
15487
  defaultValue: {
15147
15488
  backcolor: "rgba(255, 255, 255, 1)",
15148
15489
  hovercolor: "rgba(248, 248, 248, 1)",
15490
+ cornerRadius: "4px",
15149
15491
  corner: 4
15150
15492
  }
15151
15493
  },
@@ -15177,7 +15519,7 @@ var ThemeBuilder = /** @class */ (function (_super) {
15177
15519
  descriptionLocation: "hidden",
15178
15520
  defaultValue: {
15179
15521
  family: _creator_settings__WEBPACK_IMPORTED_MODULE_7__["settings"].theme.fontFamily,
15180
- color: "rgba(22, 22, 22, 1)",
15522
+ color: "rgba(0, 0, 0, 0.91)",
15181
15523
  weight: "600",
15182
15524
  size: 16,
15183
15525
  }
@@ -15188,7 +15530,7 @@ var ThemeBuilder = /** @class */ (function (_super) {
15188
15530
  descriptionLocation: "hidden",
15189
15531
  defaultValue: {
15190
15532
  family: _creator_settings__WEBPACK_IMPORTED_MODULE_7__["settings"].theme.fontFamily,
15191
- color: "rgba(22, 22, 22, 1)",
15533
+ color: "rgba(0, 0, 0, 0.45)",
15192
15534
  weight: "400",
15193
15535
  size: 16
15194
15536
  }
@@ -15205,6 +15547,7 @@ var ThemeBuilder = /** @class */ (function (_super) {
15205
15547
  defaultValue: {
15206
15548
  backcolor: "rgba(255, 255, 255, 1)",
15207
15549
  hovercolor: "rgba(248, 248, 248, 1)",
15550
+ cornerRadius: "4px",
15208
15551
  corner: 4
15209
15552
  }
15210
15553
  },
@@ -15235,7 +15578,7 @@ var ThemeBuilder = /** @class */ (function (_super) {
15235
15578
  descriptionLocation: "hidden",
15236
15579
  defaultValue: {
15237
15580
  family: _creator_settings__WEBPACK_IMPORTED_MODULE_7__["settings"].theme.fontFamily,
15238
- color: "rgba(22, 22, 22, 1)",
15581
+ color: "rgba(0, 0, 0, 0.91)",
15239
15582
  weight: "400",
15240
15583
  size: 16
15241
15584
  }
@@ -15271,6 +15614,32 @@ var ThemeBuilder = /** @class */ (function (_super) {
15271
15614
  };
15272
15615
  return themeEditorSurveyJSON;
15273
15616
  };
15617
+ ThemeBuilder.prototype.getHorizontalAlignment = function (questionName, title, defaultValue) {
15618
+ return {
15619
+ type: "buttongroup",
15620
+ name: questionName,
15621
+ title: title,
15622
+ choices: [
15623
+ { value: "left", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.horizontalAlignmentLeft") },
15624
+ { value: "center", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.horizontalAlignmentCenter") },
15625
+ { value: "right", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.horizontalAlignmentRight") },
15626
+ ],
15627
+ defaultValue: defaultValue
15628
+ };
15629
+ };
15630
+ ThemeBuilder.prototype.getVerticalAlignment = function (questionName, defaultValue) {
15631
+ return {
15632
+ type: "buttongroup",
15633
+ name: questionName,
15634
+ titleLocation: "hidden",
15635
+ choices: [
15636
+ { value: "top", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.verticalAlignmentTop") },
15637
+ { value: "middle", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.verticalAlignmentMiddle") },
15638
+ { value: "bottom", text: Object(_editorLocalization__WEBPACK_IMPORTED_MODULE_3__["getLocString"])("theme.verticalAlignmentBottom") },
15639
+ ],
15640
+ defaultValue: defaultValue
15641
+ };
15642
+ };
15274
15643
  ThemeBuilder.prototype.dispose = function () {
15275
15644
  var _a;
15276
15645
  (_a = this.themeEditorSurveyValue) === null || _a === void 0 ? void 0 : _a.dispose();
@@ -15354,6 +15723,16 @@ var ThemeBuilder = /** @class */ (function (_super) {
15354
15723
  }
15355
15724
  })
15356
15725
  ], ThemeBuilder.prototype, "backgroundImageAttachment", void 0);
15726
+ Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
15727
+ Object(survey_core__WEBPACK_IMPORTED_MODULE_2__["property"])({
15728
+ onSet: function (newValue, _target) {
15729
+ if (!!_target.survey) {
15730
+ _target.survey.backgroundOpacity = newValue / 100;
15731
+ }
15732
+ _target.currentTheme["backgroundOpacity"] = newValue / 100;
15733
+ }
15734
+ })
15735
+ ], ThemeBuilder.prototype, "backgroundOpacity", void 0);
15357
15736
  Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
15358
15737
  Object(survey_core__WEBPACK_IMPORTED_MODULE_2__["property"])({ defaultValue: "default" })
15359
15738
  ], ThemeBuilder.prototype, "themeName", void 0);
@@ -15622,7 +16001,13 @@ function elementSettingsToCssVariable(question, themeCssVariables) {
15622
16001
  Object.keys(question.value).forEach(function (key) {
15623
16002
  if (key === "corner")
15624
16003
  return;
15625
- themeCssVariables["--sjs-" + question.name.toLocaleLowerCase() + "-" + key] = question.value[key];
16004
+ var propertyName = "--sjs-" + question.name.toLocaleLowerCase() + "-" + key;
16005
+ if (question.value[key] !== question.defaultValue[key]) {
16006
+ themeCssVariables[propertyName] = question.value[key];
16007
+ }
16008
+ else {
16009
+ delete themeCssVariables[propertyName];
16010
+ }
15626
16011
  });
15627
16012
  }
15628
16013
  function elementSettingsFromCssVariable(question, themeCssVariables, defaultBackcolorVariable, defaultHovercolorVariable) {
@@ -15744,7 +16129,13 @@ function fontsettingsToCssVariable(question, themeCssVariables) {
15744
16129
  Object.keys(question.value).forEach(function (key) {
15745
16130
  var _a;
15746
16131
  var innerQ = question.contentPanel.getQuestionByName(key);
15747
- themeCssVariables["--sjs-font-" + question.name.toLocaleLowerCase() + "-" + key] = question.value[key] + (((_a = innerQ.unit) === null || _a === void 0 ? void 0 : _a.toString()) || "");
16132
+ var propertyName = "--sjs-font-" + question.name.toLocaleLowerCase() + "-" + key;
16133
+ if (question.value[key] !== question.defaultValue[key]) {
16134
+ themeCssVariables[propertyName] = question.value[key] + (((_a = innerQ.unit) === null || _a === void 0 ? void 0 : _a.toString()) || "");
16135
+ }
16136
+ else {
16137
+ delete themeCssVariables[propertyName];
16138
+ }
15748
16139
  });
15749
16140
  }
15750
16141
  function fontsettingsFromCssVariable(question, themeCssVariables, defaultColorVariable, defaultPlaceholderColorVariable) {
@@ -15793,6 +16184,7 @@ __webpack_require__.r(__webpack_exports__);
15793
16184
 
15794
16185
  var ThemeTabPlugin = /** @class */ (function () {
15795
16186
  function ThemeTabPlugin(creator) {
16187
+ var _this = this;
15796
16188
  this.creator = creator;
15797
16189
  this.simulatorTheme = survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyCss"][survey_core__WEBPACK_IMPORTED_MODULE_0__["defaultV2ThemeName"]];
15798
16190
  this._availableThemes = _themes__WEBPACK_IMPORTED_MODULE_4__["PredefinedThemes"];
@@ -15819,6 +16211,30 @@ var ThemeTabPlugin = /** @class */ (function () {
15819
16211
  this.createActions().forEach(function (action) { return creator.toolbar.actions.push(action); });
15820
16212
  this.sidebarTab = this.creator.sidebar.addTab("theme");
15821
16213
  this.sidebarTab.caption = _editorLocalization__WEBPACK_IMPORTED_MODULE_1__["editorLocalization"].getString("ed.themePropertyGridTitle");
16214
+ creator.registerShortcut("undo_theme", {
16215
+ name: "undo",
16216
+ affectedTab: "theme",
16217
+ hotKey: {
16218
+ ctrlKey: true,
16219
+ keyCode: 90,
16220
+ },
16221
+ macOsHotkey: {
16222
+ keyCode: 90,
16223
+ },
16224
+ execute: function () { return _this.undo(); }
16225
+ });
16226
+ creator.registerShortcut("redo_theme", {
16227
+ name: "redo",
16228
+ affectedTab: "theme",
16229
+ hotKey: {
16230
+ ctrlKey: true,
16231
+ keyCode: 89,
16232
+ },
16233
+ macOsHotkey: {
16234
+ keyCode: 89,
16235
+ },
16236
+ execute: function () { return _this.redo(); }
16237
+ });
15822
16238
  }
15823
16239
  ThemeTabPlugin.prototype.activate = function () {
15824
16240
  this.model = new _theme_builder__WEBPACK_IMPORTED_MODULE_2__["ThemeBuilder"](this.creator, this.simulatorTheme);
@@ -15842,6 +16258,10 @@ var ThemeTabPlugin = /** @class */ (function () {
15842
16258
  this.model.testAgainAction = this.testAgainAction;
15843
16259
  this.model.availableThemes = this.availableThemes;
15844
16260
  this.model.initialize(this.creator.JSON, options);
16261
+ this.updateUndeRedoActions();
16262
+ this.model.undoRedoManager.canUndoRedoCallback = function () {
16263
+ _this.updateUndeRedoActions();
16264
+ };
15845
16265
  this.model.show();
15846
16266
  this.model.onPropertyChanged.add(function (sender, options) {
15847
16267
  if (options.name === "isRunning") {
@@ -15906,6 +16326,24 @@ var ThemeTabPlugin = /** @class */ (function () {
15906
16326
  _this.model.testAgain();
15907
16327
  }
15908
16328
  });
16329
+ this.undoAction = new survey_core__WEBPACK_IMPORTED_MODULE_0__["Action"]({
16330
+ id: "action-undo-theme",
16331
+ iconName: "icon-undo",
16332
+ locTitleName: "ed.undo",
16333
+ showTitle: false,
16334
+ visible: new survey_core__WEBPACK_IMPORTED_MODULE_0__["ComputedUpdater"](function () { return _this.creator.activeTab === "theme"; }),
16335
+ action: function () { return _this.undo(); }
16336
+ });
16337
+ this.redoAction = new survey_core__WEBPACK_IMPORTED_MODULE_0__["Action"]({
16338
+ id: "action-redo-theme",
16339
+ iconName: "icon-redo",
16340
+ locTitleName: "ed.redo",
16341
+ showTitle: false,
16342
+ visible: new survey_core__WEBPACK_IMPORTED_MODULE_0__["ComputedUpdater"](function () { return _this.creator.activeTab === "theme"; }),
16343
+ action: function () { return _this.redo(); }
16344
+ });
16345
+ items.push(this.undoAction);
16346
+ items.push(this.redoAction);
15909
16347
  this.resetTheme = new survey_core__WEBPACK_IMPORTED_MODULE_0__["Action"]({
15910
16348
  id: "resetTheme",
15911
16349
  iconName: "icon-reset",
@@ -15978,7 +16416,33 @@ var ThemeTabPlugin = /** @class */ (function () {
15978
16416
  items.push(this.exportAction);
15979
16417
  return items;
15980
16418
  };
16419
+ ThemeTabPlugin.prototype.undo = function () {
16420
+ var _undoRedoManager = this.model && this.model.undoRedoManager;
16421
+ if (!_undoRedoManager)
16422
+ return;
16423
+ _undoRedoManager.suspend();
16424
+ if (_undoRedoManager.canUndo()) {
16425
+ _undoRedoManager.undo();
16426
+ }
16427
+ _undoRedoManager.resume();
16428
+ };
16429
+ ThemeTabPlugin.prototype.redo = function () {
16430
+ var _undoRedoManager = this.model && this.model.undoRedoManager;
16431
+ if (!_undoRedoManager)
16432
+ return;
16433
+ _undoRedoManager.suspend();
16434
+ if (_undoRedoManager.canRedo()) {
16435
+ _undoRedoManager.redo();
16436
+ }
16437
+ _undoRedoManager.resume();
16438
+ };
16439
+ ThemeTabPlugin.prototype.updateUndeRedoActions = function () {
16440
+ var _undoRedoManager = this.model.undoRedoManager;
16441
+ this.undoAction.enabled = _undoRedoManager.canUndo();
16442
+ this.redoAction.enabled = _undoRedoManager.canRedo();
16443
+ };
15981
16444
  ThemeTabPlugin.prototype.addFooterActions = function () {
16445
+ this.creator.footerToolbar.actions.push(this.testAgainAction);
15982
16446
  this.creator.footerToolbar.actions.push(this.resetTheme);
15983
16447
  };
15984
16448
  Object.defineProperty(ThemeTabPlugin.prototype, "availableThemes", {
@@ -16256,42 +16720,11 @@ var TabTranslationPlugin = /** @class */ (function () {
16256
16720
  }
16257
16721
  });
16258
16722
  items.push(this.mergeLocaleWithDefaultAction);
16259
- this.importCsvAction = new survey_core__WEBPACK_IMPORTED_MODULE_0__["Action"]({
16260
- id: "svc-translation-import",
16261
- iconName: "icon-load",
16262
- locTitleName: "ed.translationImportFromSCVButton",
16263
- locTooltipName: "ed.translationImportFromSCVButton",
16264
- visible: false,
16265
- mode: "small",
16266
- component: "sv-action-bar-item",
16267
- needSeparator: true,
16268
- action: function () {
16269
- if (!document)
16270
- return;
16271
- if (!_this.inputFileElement) {
16272
- _this.inputFileElement = document.createElement("input");
16273
- _this.inputFileElement.type = "file";
16274
- _this.inputFileElement.style.display = "none";
16275
- _this.inputFileElement.onchange = function () {
16276
- _this.model.importFromCSVFileUI(_this.inputFileElement);
16277
- };
16278
- }
16279
- _this.inputFileElement.click();
16280
- }
16281
- });
16723
+ this.importCsvAction = Object(_translation__WEBPACK_IMPORTED_MODULE_2__["createImportCSVAction"])(function () { _this.model.importFromCSVFileDOM(); }, true);
16724
+ this.importCsvAction.visible = false;
16282
16725
  items.push(this.importCsvAction);
16283
- this.exportCsvAction = new survey_core__WEBPACK_IMPORTED_MODULE_0__["Action"]({
16284
- id: "svc-translation-export",
16285
- iconName: "icon-download",
16286
- locTitleName: "ed.translationExportToSCVButton",
16287
- locTooltipName: "ed.translationExportToSCVButton",
16288
- visible: false,
16289
- mode: "small",
16290
- component: "sv-action-bar-item",
16291
- action: function () {
16292
- _this.model.exportToCSVFileUI();
16293
- }
16294
- });
16726
+ this.exportCsvAction = Object(_translation__WEBPACK_IMPORTED_MODULE_2__["createExportCSVAction"])(function () { _this.model.exportToCSVFileUI(); });
16727
+ this.exportCsvAction.visible = false;
16295
16728
  items.push(this.exportCsvAction);
16296
16729
  return items;
16297
16730
  };
@@ -16386,6 +16819,7 @@ var translationCss = {
16386
16819
  logoImage: "st-logo__image",
16387
16820
  headerText: "st-header__text",
16388
16821
  navigationButton: "",
16822
+ bodyNavigationButton: "st-navigation-btn",
16389
16823
  completedPage: "st-completedpage",
16390
16824
  navigation: {
16391
16825
  complete: "st-btn st-footer__complete-btn",
@@ -16695,7 +17129,7 @@ var translationCss = {
16695
17129
  /*!********************************************!*\
16696
17130
  !*** ./src/components/tabs/translation.ts ***!
16697
17131
  \********************************************/
16698
- /*! exports provided: TranslationItemBase, TranslationItemString, TranslationItem, TranslationGroup, Translation */
17132
+ /*! exports provided: TranslationItemBase, TranslationItemString, TranslationItem, TranslationGroup, Translation, TranslationEditor, createImportCSVAction, createExportCSVAction */
16699
17133
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
16700
17134
 
16701
17135
  "use strict";
@@ -16705,6 +17139,9 @@ __webpack_require__.r(__webpack_exports__);
16705
17139
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TranslationItem", function() { return TranslationItem; });
16706
17140
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TranslationGroup", function() { return TranslationGroup; });
16707
17141
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Translation", function() { return Translation; });
17142
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TranslationEditor", function() { return TranslationEditor; });
17143
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createImportCSVAction", function() { return createImportCSVAction; });
17144
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createExportCSVAction", function() { return createExportCSVAction; });
16708
17145
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./src/entries/helpers.ts");
16709
17146
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "survey-core");
16710
17147
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_1__);
@@ -16775,6 +17212,7 @@ var TranslationItemBase = /** @class */ (function (_super) {
16775
17212
  this.fireOnObjCreating();
16776
17213
  };
16777
17214
  TranslationItemBase.prototype.deleteLocaleStrings = function (locale) { };
17215
+ TranslationItemBase.prototype.applyEditLocale = function (locale) { };
16778
17216
  TranslationItemBase.prototype.fireOnObjCreating = function (obj) {
16779
17217
  if (obj === void 0) { obj = null; }
16780
17218
  if (this.translation) {
@@ -16797,7 +17235,7 @@ var TranslationItemString = /** @class */ (function (_super) {
16797
17235
  }
16798
17236
  TranslationItemString.prototype.onPropertyValueChanged = function (name, oldValue, newValue) {
16799
17237
  _super.prototype.onPropertyValueChanged.call(this, name, oldValue, newValue);
16800
- if (name === "text") {
17238
+ if (!this.isReadOnly && name === "text") {
16801
17239
  this.locString.setLocaleText(this.locale, newValue);
16802
17240
  }
16803
17241
  };
@@ -16876,9 +17314,17 @@ var TranslationItem = /** @class */ (function (_super) {
16876
17314
  !!this.translation.tranlationChangedCallback &&
16877
17315
  this.translation.tranlationChangedCallback(loc, this.name, newValue, this.context);
16878
17316
  };
17317
+ TranslationItem.prototype.applyEditLocale = function (locale) {
17318
+ var itemStr = this.values(locale);
17319
+ if (!!itemStr && !!itemStr.text) {
17320
+ this.setLocText(locale, itemStr.text);
17321
+ }
17322
+ };
16879
17323
  TranslationItem.prototype.values = function (loc) {
17324
+ var _a;
16880
17325
  if (!this.hashValues[loc]) {
16881
17326
  var val = new TranslationItemString(this.locString, loc);
17327
+ val.isReadOnly = !!((_a = this.translation) === null || _a === void 0 ? void 0 : _a.getEditLocale());
16882
17328
  if (!loc) {
16883
17329
  val.placeholder = this.defaultValue;
16884
17330
  }
@@ -16899,7 +17345,22 @@ var TranslationItem = /** @class */ (function (_super) {
16899
17345
  }
16900
17346
  };
16901
17347
  TranslationItem.prototype.toJSON = function () {
17348
+ var _this = this;
16902
17349
  var json = this.locString.getJson();
17350
+ var keys = Object.keys(this.hashValues);
17351
+ if (keys.length > 0) {
17352
+ keys.forEach(function (loc) {
17353
+ var text = _this.hashValues[loc].text;
17354
+ if (!!text) {
17355
+ if (!json)
17356
+ json = {};
17357
+ if (typeof json === "string") {
17358
+ json = { default: json };
17359
+ }
17360
+ json[loc] = text;
17361
+ }
17362
+ });
17363
+ }
16903
17364
  json = this.correctJSON(json);
16904
17365
  if (!json || typeof json === "string")
16905
17366
  return { default: json };
@@ -16930,8 +17391,16 @@ var TranslationItem = /** @class */ (function (_super) {
16930
17391
  TranslationItem.prototype.deleteLocaleStrings = function (locale) {
16931
17392
  this.setLocText(locale, undefined);
16932
17393
  };
17394
+ TranslationItem.prototype.getDefaultLocaleText = function () {
17395
+ var res = this.locString.getLocaleText("");
17396
+ if (!res) {
17397
+ res = this.getPlaceholder("");
17398
+ }
17399
+ return res;
17400
+ };
16933
17401
  TranslationItem.prototype.getPlaceholder = function (locale) {
16934
- var placeholderText = _editorLocalization__WEBPACK_IMPORTED_MODULE_3__["editorLocalization"].getString("ed.translationPlaceHolder", locale);
17402
+ var textLocale = !!locale && locale !== "default" ? locale : survey_core__WEBPACK_IMPORTED_MODULE_1__["surveyLocalization"].defaultLocale;
17403
+ var placeholderText = _editorLocalization__WEBPACK_IMPORTED_MODULE_3__["editorLocalization"].getString("ed.translationPlaceHolder", textLocale);
16935
17404
  if (this.context instanceof survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyModel"]) {
16936
17405
  return survey_core__WEBPACK_IMPORTED_MODULE_1__["surveyLocalization"].getString(this.name, locale) || placeholderText;
16937
17406
  }
@@ -17155,6 +17624,9 @@ var TranslationGroup = /** @class */ (function (_super) {
17155
17624
  TranslationGroup.prototype.deleteLocaleStrings = function (locale) {
17156
17625
  this.items.forEach(function (item) { return item.deleteLocaleStrings(locale); });
17157
17626
  };
17627
+ TranslationGroup.prototype.applyEditLocale = function (locale) {
17628
+ this.items.forEach(function (item) { return item.applyEditLocale(locale); });
17629
+ };
17158
17630
  TranslationGroup.prototype.fillItems = function () {
17159
17631
  if (this.isItemValueArray(this.obj)) {
17160
17632
  this.createItemValuesLocale();
@@ -17230,12 +17702,16 @@ var TranslationGroup = /** @class */ (function (_super) {
17230
17702
  return true;
17231
17703
  };
17232
17704
  TranslationGroup.prototype.createTranslationItem = function (obj, property) {
17705
+ var _a;
17233
17706
  var defaultValue = this.getDefaultValue(obj, property);
17234
17707
  var locStr = obj[property.serializationProperty];
17235
17708
  if (!locStr)
17236
17709
  return null;
17237
17710
  if (!this.showAllStrings && !defaultValue && locStr.isEmpty)
17238
17711
  return null;
17712
+ var editLocale = (_a = this.translation) === null || _a === void 0 ? void 0 : _a.getEditLocale();
17713
+ if (!!editLocale && !!locStr.getLocaleText(editLocale))
17714
+ return null;
17239
17715
  if (!this.canShowProperty(property, locStr.isEmpty))
17240
17716
  return null;
17241
17717
  return new TranslationItem(property.name, locStr, defaultValue, this.translation, obj, property);
@@ -17283,9 +17759,14 @@ var TranslationGroup = /** @class */ (function (_super) {
17283
17759
  }
17284
17760
  };
17285
17761
  TranslationGroup.prototype.createItemValuesLocale = function () {
17762
+ var _a;
17763
+ var editMode = (_a = this.translation) === null || _a === void 0 ? void 0 : _a.getEditLocale();
17286
17764
  for (var i = 0; i < this.obj.length; i++) {
17287
17765
  var val = this.obj[i];
17288
17766
  var canAdd = this.showAllStrings || !val.locText.isEmpty || isNaN(val.value);
17767
+ if (!!editMode && val.locText.getLocaleText(editMode)) {
17768
+ canAdd = false;
17769
+ }
17289
17770
  if (!canAdd)
17290
17771
  continue;
17291
17772
  var item = new TranslationItem(val.value, val.locText, val.value, this.translation, val);
@@ -17345,6 +17826,21 @@ var Translation = /** @class */ (function (_super) {
17345
17826
  Translation.prototype.getType = function () {
17346
17827
  return "translation";
17347
17828
  };
17829
+ Translation.prototype.getEditLocale = function () { return this.editLocale; };
17830
+ Translation.prototype.setEditMode = function (locale) {
17831
+ this.editLocale = locale;
17832
+ this.addLocale(locale);
17833
+ };
17834
+ Object.defineProperty(Translation.prototype, "isEditMode", {
17835
+ get: function () { return !!this.editLocale; },
17836
+ enumerable: false,
17837
+ configurable: true
17838
+ });
17839
+ Translation.prototype.applyEditLocale = function () {
17840
+ if (!this.isEditMode || !this.root)
17841
+ return;
17842
+ this.root.applyEditLocale(this.editLocale);
17843
+ };
17348
17844
  Translation.prototype.makeObservable = function (onBaseObjCreating) {
17349
17845
  this.onBaseObjCreatingCallback = onBaseObjCreating;
17350
17846
  this.fireOnObjCreating(this);
@@ -17409,6 +17905,17 @@ var Translation = /** @class */ (function (_super) {
17409
17905
  });
17410
17906
  res.onGetMatrixRowActions.add(function (sender, options) {
17411
17907
  Object(_utils_actions__WEBPACK_IMPORTED_MODULE_9__["updateMatrixRemoveAction"])(options.question, options.actions, options.row);
17908
+ if (_this.options.getHasMachineTranslation() && Object(_utils_actions__WEBPACK_IMPORTED_MODULE_9__["findAction"])(options.actions, "remove-row")) {
17909
+ var q = options.question;
17910
+ var rowIndex = q.visibleRows.indexOf(options.row);
17911
+ var locale_1 = q.value[rowIndex].name;
17912
+ options.actions.splice(0, 0, new survey_core__WEBPACK_IMPORTED_MODULE_1__["Action"]({
17913
+ iconName: "icon-language",
17914
+ locTooltipName: "ed.translateUsigAI",
17915
+ location: "end",
17916
+ action: function () { return _this.showTranslationEditor(locale_1); }
17917
+ }));
17918
+ }
17412
17919
  Object(_utils_actions__WEBPACK_IMPORTED_MODULE_9__["updateMatixActionsClasses"])(options.actions);
17413
17920
  });
17414
17921
  return res;
@@ -17462,6 +17969,20 @@ var Translation = /** @class */ (function (_super) {
17462
17969
  }
17463
17970
  return [usedLocales, locales];
17464
17971
  };
17972
+ Translation.prototype.importFromCSVFileDOM = function () {
17973
+ var _this = this;
17974
+ if (!document)
17975
+ return;
17976
+ if (!this.inputFileElement) {
17977
+ this.inputFileElement = document.createElement("input");
17978
+ this.inputFileElement.type = "file";
17979
+ this.inputFileElement.style.display = "none";
17980
+ this.inputFileElement.onchange = function () {
17981
+ _this.importFromCSVFileUI(_this.inputFileElement);
17982
+ };
17983
+ }
17984
+ this.inputFileElement.click();
17985
+ };
17465
17986
  Translation.prototype.updateSettingsSurveyLocales = function () {
17466
17987
  var _a = this.getSurveyLocales(), choices = _a[0], locales = _a[1];
17467
17988
  var selectedLocales = [];
@@ -17534,6 +18055,11 @@ var Translation = /** @class */ (function (_super) {
17534
18055
  });
17535
18056
  }
17536
18057
  });
18058
+ survey.onUpdatePanelCssClasses.add(function (sender, options) {
18059
+ if (options.panel["__translationHasIndent"]) {
18060
+ options.cssClasses.panel.content += " st-panel-indent";
18061
+ }
18062
+ });
17537
18063
  survey.currentPage = survey.pages[0];
17538
18064
  return survey;
17539
18065
  };
@@ -17580,14 +18106,15 @@ var Translation = /** @class */ (function (_super) {
17580
18106
  panel.addElement(pnl);
17581
18107
  pnl.title = item.text;
17582
18108
  if (item.hasIndent) {
17583
- pnl.cssClasses.panel.content += " st-panel-indent";
18109
+ pnl["__translationHasIndent"] = true;
17584
18110
  }
17585
18111
  this.addTranslationGroupIntoStringsSurvey(pnl, item);
17586
18112
  }
17587
18113
  };
17588
18114
  Translation.prototype.addLocaleColumns = function (matrix) {
17589
18115
  var locs = this.getSelectedLocales();
17590
- matrix.addColumn("default", this.getLocaleName(""));
18116
+ var defaultColumn = matrix.addColumn("default", this.getLocaleName(""));
18117
+ defaultColumn.readOnly = this.isEditMode;
17591
18118
  for (var i = 0; i < locs.length; i++) {
17592
18119
  matrix.addColumn(locs[i], this.getLocaleName(locs[i]));
17593
18120
  }
@@ -17600,6 +18127,12 @@ var Translation = /** @class */ (function (_super) {
17600
18127
  }
17601
18128
  return res;
17602
18129
  };
18130
+ Translation.prototype.updateStringsSurveyData = function () {
18131
+ var survey = this.stringsSurvey;
18132
+ if (survey) {
18133
+ survey.data = this.getStringsSurveyData(survey);
18134
+ }
18135
+ };
17603
18136
  Translation.prototype.getStringsQuestionData = function (matrix) {
17604
18137
  var res = {};
17605
18138
  for (var i = 0; i < matrix.rows.length; i++) {
@@ -17911,6 +18444,17 @@ var Translation = /** @class */ (function (_super) {
17911
18444
  this.setSelectedLocales([]);
17912
18445
  this.reset();
17913
18446
  };
18447
+ Translation.prototype.createTranslationEditor = function (locale) {
18448
+ var _this = this;
18449
+ var res = new TranslationEditor(this.survey, locale, this.options);
18450
+ res.onApply = function () {
18451
+ _this.reset();
18452
+ };
18453
+ return res;
18454
+ };
18455
+ Translation.prototype.showTranslationEditor = function (locale) {
18456
+ this.createTranslationEditor(locale).showDialog();
18457
+ };
17914
18458
  Translation.prototype.translateItemAfterRender = function (item, el, locale) {
17915
18459
  if (!this.translateItemAfterRenderCallback)
17916
18460
  return;
@@ -18019,6 +18563,156 @@ var Translation = /** @class */ (function (_super) {
18019
18563
  return Translation;
18020
18564
  }(survey_core__WEBPACK_IMPORTED_MODULE_1__["Base"]));
18021
18565
 
18566
+ var TranslationEditor = /** @class */ (function () {
18567
+ function TranslationEditor(survey, locale, options) {
18568
+ this.survey = survey;
18569
+ this.locale = locale;
18570
+ this.options = options;
18571
+ this.translationValue = new Translation(this.survey, options, true);
18572
+ this.translation.setEditMode(locale);
18573
+ this.translation.reset();
18574
+ this.setupNavigationButtons();
18575
+ }
18576
+ Object.defineProperty(TranslationEditor.prototype, "translation", {
18577
+ get: function () { return this.translationValue; },
18578
+ enumerable: false,
18579
+ configurable: true
18580
+ });
18581
+ TranslationEditor.prototype.showDialog = function () {
18582
+ var _this = this;
18583
+ var dialogTitle = _editorLocalization__WEBPACK_IMPORTED_MODULE_3__["editorLocalization"].getString("ed.translationDialogTitle") + " (" + this.translation.getLocaleName(this.locale) + ")";
18584
+ if (this.translation.stringsSurvey.getAllQuestions(true).length === 0) {
18585
+ var locStr = new survey_core__WEBPACK_IMPORTED_MODULE_1__["LocalizableString"](this.translation.stringsSurvey);
18586
+ locStr.text = _editorLocalization__WEBPACK_IMPORTED_MODULE_3__["editorLocalization"].getString("ed.translationNoStrings");
18587
+ var popup = survey_core__WEBPACK_IMPORTED_MODULE_1__["settings"].showDialog({
18588
+ componentName: "sv-string-viewer",
18589
+ data: { locStr: locStr, locString: locStr, model: locStr },
18590
+ onApply: function () { return true; },
18591
+ title: dialogTitle,
18592
+ displayMode: "popup"
18593
+ }, this.options.rootElement);
18594
+ var actions = popup.footerToolbar.actions;
18595
+ actions.splice(1, actions.length - 1);
18596
+ actions[0].title = "OK";
18597
+ return;
18598
+ }
18599
+ var popupModel = survey_core__WEBPACK_IMPORTED_MODULE_1__["settings"].showDialog({
18600
+ componentName: "survey",
18601
+ data: {
18602
+ survey: this.translation.stringsSurvey,
18603
+ model: this.translation.stringsSurvey
18604
+ },
18605
+ onApply: function () {
18606
+ _this.apply();
18607
+ return true;
18608
+ },
18609
+ onCancel: function () {
18610
+ _this.dispose();
18611
+ },
18612
+ cssClass: "sv-property-editor st-translation-dialog",
18613
+ title: dialogTitle,
18614
+ displayMode: this.options.isMobileView ? "overlay" : "popup"
18615
+ }, this.options.rootElement);
18616
+ popupModel.locale = _editorLocalization__WEBPACK_IMPORTED_MODULE_3__["editorLocalization"].currentLocale;
18617
+ };
18618
+ TranslationEditor.prototype.doMachineTranslation = function () {
18619
+ var _this = this;
18620
+ var fromLocale = this.translation.defaultLocale;
18621
+ if (!fromLocale)
18622
+ fromLocale = "en";
18623
+ var items = this.createStringsToTranslate();
18624
+ var strings = [];
18625
+ items.forEach(function (item) {
18626
+ strings.push(item.getDefaultLocaleText());
18627
+ });
18628
+ var callback = function (translatedStrings) {
18629
+ if (!Array.isArray(translatedStrings))
18630
+ return;
18631
+ for (var i = 0; i < Math.min(items.length, translatedStrings.length); i++) {
18632
+ items[i].values(_this.locale).text = translatedStrings[i];
18633
+ }
18634
+ _this.translation.updateStringsSurveyData();
18635
+ };
18636
+ this.options.doMachineTranslation(fromLocale, this.locale, strings, callback);
18637
+ };
18638
+ TranslationEditor.prototype.apply = function () {
18639
+ this.translation.applyEditLocale();
18640
+ if (this.onApply) {
18641
+ this.onApply();
18642
+ }
18643
+ this.dispose();
18644
+ };
18645
+ TranslationEditor.prototype.cancel = function () {
18646
+ this.dispose();
18647
+ };
18648
+ TranslationEditor.prototype.dispose = function () {
18649
+ this.translationValue.dispose();
18650
+ };
18651
+ TranslationEditor.prototype.setupNavigationButtons = function () {
18652
+ var _this = this;
18653
+ var survey = this.translation.stringsSurvey;
18654
+ var actions = survey.navigationBar.actions;
18655
+ actions.splice(0, actions.length);
18656
+ if (this.options.getHasMachineTranslation()) {
18657
+ survey.addNavigationItem(new survey_core__WEBPACK_IMPORTED_MODULE_1__["Action"]({
18658
+ id: "svc-translation-machine",
18659
+ iconName: "icon-language",
18660
+ css: "svc-translation-machine",
18661
+ locTitleName: "ed.translateUsigAI",
18662
+ component: "sv-action-bar-item",
18663
+ action: function () { _this.doMachineTranslation(); }
18664
+ }));
18665
+ }
18666
+ survey.addNavigationItem(createImportCSVAction(function () { _this.translation.importFromCSVFileDOM(); }, false, true));
18667
+ survey.addNavigationItem(createExportCSVAction(function () { _this.translation.exportToCSVFileUI(); }, true));
18668
+ survey.showNavigationButtons = "top";
18669
+ };
18670
+ TranslationEditor.prototype.createStringsToTranslate = function () {
18671
+ var res = new Array();
18672
+ this.addStringsToTranlate(this.translation.root, res);
18673
+ return res;
18674
+ };
18675
+ TranslationEditor.prototype.addStringsToTranlate = function (group, items) {
18676
+ var _this = this;
18677
+ group.items.forEach(function (item) {
18678
+ if (item.isGroup) {
18679
+ _this.addStringsToTranlate(item, items);
18680
+ }
18681
+ else {
18682
+ if (!!item.getDefaultLocaleText()) {
18683
+ items.push(item);
18684
+ }
18685
+ }
18686
+ });
18687
+ };
18688
+ return TranslationEditor;
18689
+ }());
18690
+
18691
+ function createImportCSVAction(action, needSeparator, isInEditor) {
18692
+ if (isInEditor === void 0) { isInEditor = false; }
18693
+ return new survey_core__WEBPACK_IMPORTED_MODULE_1__["Action"]({
18694
+ id: "svc-translation-import",
18695
+ iconName: "icon-load",
18696
+ locTitleName: "ed.translationImportFromSCVButton",
18697
+ locTooltipName: "ed.translationImportFromSCVButton",
18698
+ mode: isInEditor ? "large" : "small",
18699
+ component: "sv-action-bar-item",
18700
+ needSeparator: needSeparator,
18701
+ action: action
18702
+ });
18703
+ }
18704
+ function createExportCSVAction(action, isInEditor) {
18705
+ if (isInEditor === void 0) { isInEditor = false; }
18706
+ return new survey_core__WEBPACK_IMPORTED_MODULE_1__["Action"]({
18707
+ id: "svc-translation-export",
18708
+ iconName: "icon-download",
18709
+ locTitleName: "ed.translationExportToSCVButton",
18710
+ locTooltipName: "ed.translationExportToSCVButton",
18711
+ mode: isInEditor ? "large" : "small",
18712
+ component: "sv-action-bar-item",
18713
+ action: action
18714
+ });
18715
+ }
18022
18716
 
18023
18717
 
18024
18718
  /***/ }),
@@ -18788,6 +19482,27 @@ var CreatorBase = /** @class */ (function (_super) {
18788
19482
  * - `options.text` - A text string to be exported. The string is taken from the current locale. Redefine this property if you want to export a different string.
18789
19483
  */
18790
19484
  _this.onTranslationExportItem = new CreatorEvent();
19485
+ /**
19486
+ * An event that allows you to integrate a machine translation service, such as Google Translate or Microsoft Translator, into Survey Creator.
19487
+ *
19488
+ * Within the event handler, you need to pass translation strings and locale information to the translation service API. The service should return an array of translated strings that you need to pass to the `options.callback` function. If the translation failed, pass an empty array or call this function without arguments.
19489
+ *
19490
+ * Parameters:
19491
+ *
19492
+ * - `sender`: `CreatorBase`\
19493
+ * A Survey Creator instance that raised the event.
19494
+ * - `options.fromLocale`: `string`\
19495
+ * A locale from which you want to translate strings. Contains a locale identifier (`"en"`, `"de"`, etc.).
19496
+ * - `options.toLocale`: `string`\
19497
+ * A locale to which you want to translate strings. Contains a locale identifier (`"en"`, `"de"`, etc.).
19498
+ * - `options.strings`: `Array<string>`\
19499
+ * Strings to translate.
19500
+ * - `options.callback: (strings: Array<string>)`: `Function`\
19501
+ * A callback function that accepts translated strings. If the translation failed, pass an empty array or call this function without arguments.
19502
+ *
19503
+ * > Survey Creator does not include a machine translation service out of the box. Our component only provides a UI for calling the service API.
19504
+ */
19505
+ _this.onMachineTranslate = new CreatorEvent();
18791
19506
  /**
18792
19507
  * An event that is raised before a string translation is changed. Use this event to override a new translation value.
18793
19508
  *
@@ -18876,6 +19591,12 @@ var CreatorBase = /** @class */ (function (_super) {
18876
19591
  * Default value: 0 (unlimited, taken from `settings.propertyGrid.maximumChoicesCount`)
18877
19592
  */
18878
19593
  _this.maximumChoicesCount = _creator_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].propertyGrid.maximumChoicesCount;
19594
+ /**
19595
+ * Limits the minimum number of choices in [Checkbox](https://surveyjs.io/Documentation/Library?id=questioncheckboxmodel), [Dropdown](https://surveyjs.io/Documentation/Library?id=questiondropdownmodel), and [Radiogroup](https://surveyjs.io/Documentation/Library?id=questionradiogroupmodel) questions. Set this property if users should not delete choices below the specified limit.
19596
+ *
19597
+ * Default value: 0 (unlimited, taken from `settings.propertyGrid.minimumChoicesCount`)
19598
+ */
19599
+ _this.minimumChoicesCount = _creator_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].propertyGrid.minimumChoicesCount;
18879
19600
  /**
18880
19601
  * Limits the number of rows that users can add to [Matrix](https://surveyjs.io/Documentation/Library?id=questionmatrixmodel) and [Matrix Dropdown](https://surveyjs.io/Documentation/Library?id=questionmatrixdropdownmodel) questions.
18881
19602
  *
@@ -18883,11 +19604,17 @@ var CreatorBase = /** @class */ (function (_super) {
18883
19604
  */
18884
19605
  _this.maximumRowsCount = _creator_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].propertyGrid.maximumRowsCount;
18885
19606
  /**
18886
- * Limits the number of rate value that users can add to [Rating](https://surveyjs.io/Documentation/Library?id=questionratingmodel) questions.
19607
+ * Limits the number of rate values that users can add to [Rating](https://surveyjs.io/Documentation/Library?id=questionratingmodel) questions.
18887
19608
  *
18888
19609
  * Default value: 0 (unlimited, taken from `settings.propertyGrid.maximumRateValues`)
18889
19610
  */
18890
19611
  _this.maximumRateValues = _creator_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].propertyGrid.maximumRateValues;
19612
+ /**
19613
+ * Limits the number of nested panels within a [Panel](/form-library/documentation/api-reference/panel-model) element.
19614
+ *
19615
+ * Default value: -1 (unlimited)
19616
+ */
19617
+ _this.maxNestedPanels = -1;
18891
19618
  /**
18892
19619
  * Obsolete. Use the [`showPagesInPreviewTab`](https://surveyjs.io/Documentation/Survey-Creator?id=surveycreator#showPagesInPreviewTab) property instead.
18893
19620
  */
@@ -19038,11 +19765,11 @@ var CreatorBase = /** @class */ (function (_super) {
19038
19765
  shown: "svc-notifier--shown"
19039
19766
  });
19040
19767
  _this.onKeyDownHandler = function (event) {
19041
- var shortcut;
19042
- var hotKey;
19043
- Object.keys(_this.shortcuts || {}).forEach(function (key) {
19044
- shortcut = _this.shortcuts[key];
19045
- hotKey = event.metaKey ? shortcut.macOsHotkey : shortcut.hotKey;
19768
+ var availableShortcuts = Object.keys(_this.shortcuts || {})
19769
+ .map(function (key) { return _this.shortcuts[key]; })
19770
+ .filter(function (shortcut) { return !shortcut.affectedTab || shortcut.affectedTab === _this.activeTab; });
19771
+ availableShortcuts.forEach(function (shortcut) {
19772
+ var hotKey = event.metaKey ? shortcut.macOsHotkey : shortcut.hotKey;
19046
19773
  if (!hotKey)
19047
19774
  return;
19048
19775
  if (!!hotKey.ctrlKey !== !!event.ctrlKey)
@@ -19975,6 +20702,7 @@ var CreatorBase = /** @class */ (function (_super) {
19975
20702
  this.dragDropSurveyElements = new _survey_elements__WEBPACK_IMPORTED_MODULE_24__["DragDropSurveyElements"](null, this);
19976
20703
  var isDraggedFromToolbox = false;
19977
20704
  this.dragDropSurveyElements.onDragStart.add(function (sender, options) {
20705
+ _this.dragDropSurveyElements.maxNestedPanels = _this.maxNestedPanels;
19978
20706
  isDraggedFromToolbox = !sender.draggedElement.parent;
19979
20707
  _this.onDragStart.fire(sender, options);
19980
20708
  _this.startUndoRedoTransaction("drag drop");
@@ -21246,6 +21974,17 @@ var CreatorBase = /** @class */ (function (_super) {
21246
21974
  this.onTranslationExportItem.fire(this, options);
21247
21975
  return options.text;
21248
21976
  };
21977
+ CreatorBase.prototype.getHasMachineTranslation = function () {
21978
+ return !this.onMachineTranslate.isEmpty;
21979
+ };
21980
+ CreatorBase.prototype.doMachineTranslation = function (fromLocale, toLocale, strings, callback) {
21981
+ if (!this.getHasMachineTranslation()) {
21982
+ callback(undefined);
21983
+ }
21984
+ else {
21985
+ this.onMachineTranslate.fire(this, { fromLocale: fromLocale, toLocale: toLocale, strings: strings, callback: callback });
21986
+ }
21987
+ };
21249
21988
  CreatorBase.prototype.doAutoSave = function (saveFunc) {
21250
21989
  var _this = this;
21251
21990
  if (saveFunc === void 0) { saveFunc = function () { return _this.doSave(); }; }
@@ -21366,10 +22105,26 @@ var CreatorBase = /** @class */ (function (_super) {
21366
22105
  enumerable: false,
21367
22106
  configurable: true
21368
22107
  });
21369
- CreatorBase.prototype.getQuestionTypeSelectorModel = function (beforeAdd, panel) {
22108
+ CreatorBase.prototype.getAvailableToolboxItems = function (element, isAddNew) {
22109
+ if (isAddNew === void 0) { isAddNew = true; }
22110
+ var res = [].concat(this.toolbox.items);
22111
+ if (!element || this.maxNestedPanels < 0)
22112
+ return res;
22113
+ if (!isAddNew && element.isPanel)
22114
+ return res;
22115
+ if (this.maxNestedPanels < _survey_helper__WEBPACK_IMPORTED_MODULE_9__["SurveyHelper"].getElementDeepLength(element)) {
22116
+ for (var i = res.length - 1; i >= 0; i--) {
22117
+ if (res[i].isPanel) {
22118
+ res.splice(i, 1);
22119
+ }
22120
+ }
22121
+ }
22122
+ return res;
22123
+ };
22124
+ CreatorBase.prototype.getQuestionTypeSelectorModel = function (beforeAdd, element) {
21370
22125
  var _this = this;
21371
- if (panel === void 0) { panel = null; }
21372
- var availableTypes = this.toolbox.items.map(function (item) {
22126
+ var panel = !!element && element.isPanel ? element : null;
22127
+ var availableTypes = this.getAvailableToolboxItems(element).map(function (item) {
21373
22128
  return _this.createIActionBarItemByClass(item.name, item.title, item.iconName, item.needSeparator);
21374
22129
  });
21375
22130
  var listModel = new survey_core__WEBPACK_IMPORTED_MODULE_1__["ListModel"](availableTypes, function (item) {
@@ -22010,7 +22765,8 @@ var settings = {
22010
22765
  },
22011
22766
  theme: {
22012
22767
  exportFileName: "survey_theme.json",
22013
- fontFamily: "Open Sans"
22768
+ fontFamily: "Open Sans",
22769
+ allowEditHeaderSettings: false,
22014
22770
  },
22015
22771
  operators: {
22016
22772
  empty: [],
@@ -22067,6 +22823,7 @@ var settings = {
22067
22823
  maxCharsInButtonGroup: 25,
22068
22824
  showNavigationButtons: false,
22069
22825
  maximumColumnsCount: 0,
22826
+ minimumChoicesCount: 0,
22070
22827
  maximumChoicesCount: 0,
22071
22828
  maximumRowsCount: 0,
22072
22829
  maximumRateValues: 0,
@@ -22157,9 +22914,12 @@ var EmptySurveyCreatorOptions = /** @class */ (function () {
22157
22914
  this.isMobileView = false;
22158
22915
  this.allowEditExpressionsInTextEditor = true;
22159
22916
  this.maximumColumnsCount = settings.propertyGrid.maximumColumnsCount;
22917
+ this.minimumChoicesCount = settings.propertyGrid.minimumChoicesCount;
22160
22918
  this.maximumChoicesCount = settings.propertyGrid.maximumChoicesCount;
22161
22919
  this.maximumRowsCount = settings.propertyGrid.maximumRowsCount;
22162
22920
  this.maximumRateValues = settings.propertyGrid.maximumRateValues;
22921
+ this.machineTranslationValue = false;
22922
+ this.maxNestedPanels = -1;
22163
22923
  }
22164
22924
  EmptySurveyCreatorOptions.prototype.getProcessedTranslationItemText = function (locale, locString, newText, obj) {
22165
22925
  return newText;
@@ -22207,6 +22967,8 @@ var EmptySurveyCreatorOptions = /** @class */ (function () {
22207
22967
  EmptySurveyCreatorOptions.prototype.onLogicGetTitleCallback = function (expression, displayExpression, text, logicItem) { return text; };
22208
22968
  EmptySurveyCreatorOptions.prototype.getTranslationExportedText = function (obj, name, locString, locale, text) { return text; };
22209
22969
  EmptySurveyCreatorOptions.prototype.uploadFiles = function (files, question, uploadingCallback) { };
22970
+ EmptySurveyCreatorOptions.prototype.getHasMachineTranslation = function () { return this.machineTranslationValue; };
22971
+ EmptySurveyCreatorOptions.prototype.doMachineTranslation = function (fromLocale, toLocale, strings, callback) { };
22210
22972
  return EmptySurveyCreatorOptions;
22211
22973
  }());
22212
22974
 
@@ -23348,7 +24110,7 @@ var __spreadArray = function (to, from) {
23348
24110
  /*!******************************!*\
23349
24111
  !*** ./src/entries/index.ts ***!
23350
24112
  \******************************/
23351
- /*! exports provided: Version, enStrings, editorLocalization, defaultStrings, localization, QuestionConvertMode, settings, EmptySurveyCreatorOptions, CreatorAction, TabbedMenuItem, TabbedMenuContainer, ToolbarActionContainer, CreatorEvent, CreatorBase, SurveyCreatorModel, StylesManager, initializeDesignTimeSurveyModel, editableStringRendererName, getElementWrapperComponentName, getQuestionContentWrapperComponentName, getElementWrapperComponentData, getItemValueWrapperComponentName, getItemValueWrapperComponentData, isStringEditable, isTextInput, registerAdorner, removeAdorners, CreatorResponsivityManager, AceJsonEditorModel, TabJsonEditorAcePlugin, JsonEditorBaseModel, TabJsonEditorBasePlugin, TextareaJsonEditorModel, TabJsonEditorTextareaPlugin, TestSurveyTabViewModel, TabTestPlugin, createColor, createBoxShadow, parseBoxShadow, DefaultFonts, fontsettingsToCssVariable, fontsettingsFromCssVariable, elementSettingsToCssVariable, elementSettingsFromCssVariable, Themes, PredefinedThemes, getThemeFullName, PredefinedColors, ThemeBuilder, ThemeTabPlugin, initLogicOperator, LogicEvent, SurveyLogic, TranslationItemBase, TranslationItemString, TranslationItem, TranslationGroup, Translation, translationCss, TabTranslationPlugin, initialSettingsAllowShowEmptyTitleInDesignMode, TabDesignerViewModel, TabDesignerPlugin, SurveyLogicUI, TabLogicPlugin, logicCss, ToolboxToolViewModel, PageNavigatorViewModel, PageAdorner, RowViewModel, QuestionAdornerViewModel, QuestionDropdownAdornerViewModel, QuestionImageAdornerViewModel, QuestionRatingAdornerViewModel, ItemValueWrapperViewModel, ImageItemValueWrapperViewModel, MatrixCellWrapperEditSurvey, MatrixCellWrapperViewModel, SurveySimulatorModel, DEFAULT_MONITOR_DPI, simulatorDevices, SurveyResultsItemModel, SurveyResultsModel, LogoImageViewModel, StringItemsNavigatorBase, StringEditorConnector, StringEditorViewModelBase, QuestionEmbeddedSurveyModel, QuestionLinkValueModel, EditorLocalization, getLocString, SurveyJSON5, QuestionSpinEditorModel, QuestionColorModel, QuestionFileEditorModel, ResetValueAdorner, QuestionTextWithResetModel, QuestionCommentWithResetModel, setSurveyJSONForPropertyGrid, PropertyEditorSetupValue, PropertyGridEditorCollection, PropertyGridTitleActionsCreator, PropertyJSONGenerator, PropertyGridModel, PropertyGridEditor, PropertyGridEditorBoolean, PropertyGridEditorStringBase, PropertyGridEditorString, PropertyGridLinkEditor, PropertyGridColorEditor, PropertyGridEditorNumber, PropertyGridEditorImageSize, PropertyGridEditorText, PropertyGridEditorHtml, PropertyGridEditorColor, PropertyGridEditorStringArray, PropertyGridEditorDropdown, PropertyGridEditorSet, PropertyGridEditorPage, PropertyGridEditorQuestion, PropertyGridEditorQuestionSelectBase, PropertyGridEditorQuestionCarryForward, PropertyGridEditorQuestionValue, PropertyGridEditorExpression, PropertyGridEditorCondition, PropertyGridEditorMatrix, PropertyGridEditorMatrixItemValues, PropertyGridEditorMatrixRateValues, PropertyGridEditorMatrixColumns, PropertyGridEditorMatrixPages, PropertyGridEditorMatrixCalculatedValues, PropertyGridEditorMatrixHtmlConditions, PropertyGridEditorMatrixUrlConditions, PropertyGridEditorMatrixMutlipleTextItems, PropertyGridEditorMatrixMultipleTypes, PropertyGridEditorMatrixValidators, PropertyGridEditorMatrixTriggers, PropertyGridEditorBindings, PropertyGridViewModel, ObjectSelectorItem, ObjectSelector, ObjectSelectorModel, PropertyGridEditorQuestionRestfull, PropertyGridValueEditorBase, PropertyGridCellsEditor, PropertyGridValueEditor, PropertyGridRowValueEditor, PropertyGridPanelValueEditor, PropertyGridTriggerValueEditor, PropertyGridTriggerValueInLogicEditor, propertyGridCss, QuestionConverter, svgBundle, SurveyTextWorkerError, SurveyTextWorkerParserError, SurveyTextWorkerJsonError, SurveyTextWorker, JsonDuplicateNameError, QuestionToolboxCategory, QuestionToolboxItem, QuestionToolbox, SidebarModel, SidebarTabModel, getNextItemValue, getNextItemText, getNextValue, findParentNode, focusFirstControl, getFirstNonTextElement, getNodesFromKoComponentInfo, propertyExists, isPropertyVisible, toggleHovered, clearNewLines, select, copyObject, copyCssClasses, assignDefaultV2Classes, wrapTextByCurlyBraces, capitalize, notShortCircuitAnd, imageMimeTypes, getAcceptedTypesByContentMode, getQuestionFromObj, ingectAlpha, convertRgbaToString, parseRgbaFromString, parseColor, HSBToRGB, RGBToHSB, assign, ColorCalculator, SurveyQuestionEditorDefinition, ObjType, SurveyHelper, ResizeManager, UndoRedoPlugin, undoRedoTransaction, ignoreUndoRedo, UndoRedoManager, Transaction, UndoRedoAction, UndoRedoArrayAction, PagesController */
24113
+ /*! exports provided: Version, enStrings, editorLocalization, defaultStrings, localization, QuestionConvertMode, settings, EmptySurveyCreatorOptions, CreatorAction, TabbedMenuItem, TabbedMenuContainer, ToolbarActionContainer, CreatorEvent, CreatorBase, SurveyCreatorModel, StylesManager, initializeDesignTimeSurveyModel, editableStringRendererName, getElementWrapperComponentName, getQuestionContentWrapperComponentName, getElementWrapperComponentData, getItemValueWrapperComponentName, getItemValueWrapperComponentData, isStringEditable, isTextInput, registerAdorner, removeAdorners, CreatorResponsivityManager, AceJsonEditorModel, TabJsonEditorAcePlugin, JsonEditorBaseModel, TabJsonEditorBasePlugin, TextareaJsonEditorModel, TabJsonEditorTextareaPlugin, TestSurveyTabViewModel, TabTestPlugin, createColor, createBoxShadow, parseBoxShadow, DefaultFonts, fontsettingsToCssVariable, fontsettingsFromCssVariable, elementSettingsToCssVariable, elementSettingsFromCssVariable, Themes, PredefinedThemes, getThemeFullName, PredefinedColors, ThemeBuilder, ThemeTabPlugin, initLogicOperator, LogicEvent, SurveyLogic, TranslationItemBase, TranslationItemString, TranslationItem, TranslationGroup, Translation, TranslationEditor, createImportCSVAction, createExportCSVAction, translationCss, TabTranslationPlugin, initialSettingsAllowShowEmptyTitleInDesignMode, TabDesignerViewModel, TabDesignerPlugin, SurveyLogicUI, TabLogicPlugin, logicCss, ToolboxToolViewModel, PageNavigatorViewModel, PageAdorner, RowViewModel, QuestionAdornerViewModel, QuestionDropdownAdornerViewModel, QuestionImageAdornerViewModel, QuestionRatingAdornerViewModel, ItemValueWrapperViewModel, ImageItemValueWrapperViewModel, MatrixCellWrapperEditSurvey, MatrixCellWrapperViewModel, SurveySimulatorModel, DEFAULT_MONITOR_DPI, simulatorDevices, SurveyResultsItemModel, SurveyResultsModel, LogoImageViewModel, StringItemsNavigatorBase, StringEditorConnector, StringEditorViewModelBase, QuestionEmbeddedSurveyModel, QuestionLinkValueModel, EditorLocalization, getLocString, SurveyJSON5, QuestionSpinEditorModel, QuestionColorModel, QuestionFileEditorModel, ResetValueAdorner, QuestionTextWithResetModel, QuestionCommentWithResetModel, setSurveyJSONForPropertyGrid, PropertyEditorSetupValue, PropertyGridEditorCollection, PropertyGridTitleActionsCreator, PropertyJSONGenerator, PropertyGridModel, PropertyGridEditor, PropertyGridEditorBoolean, PropertyGridEditorStringBase, PropertyGridEditorString, PropertyGridLinkEditor, PropertyGridColorEditor, PropertyGridEditorNumber, PropertyGridEditorImageSize, PropertyGridEditorText, PropertyGridEditorHtml, PropertyGridEditorColor, PropertyGridEditorStringArray, PropertyGridEditorDropdown, PropertyGridEditorSet, PropertyGridEditorPage, PropertyGridEditorQuestion, PropertyGridEditorQuestionSelectBase, PropertyGridEditorQuestionCarryForward, PropertyGridEditorQuestionValue, PropertyGridEditorExpression, PropertyGridEditorCondition, PropertyGridEditorMatrix, PropertyGridEditorMatrixItemValues, PropertyGridEditorMatrixRateValues, PropertyGridEditorMatrixColumns, PropertyGridEditorMatrixPages, PropertyGridEditorMatrixCalculatedValues, PropertyGridEditorMatrixHtmlConditions, PropertyGridEditorMatrixUrlConditions, PropertyGridEditorMatrixMutlipleTextItems, PropertyGridEditorMatrixMultipleTypes, PropertyGridEditorMatrixValidators, PropertyGridEditorMatrixTriggers, PropertyGridEditorBindings, PropertyGridViewModel, ObjectSelectorItem, ObjectSelector, ObjectSelectorModel, PropertyGridEditorQuestionRestfull, PropertyGridValueEditorBase, PropertyGridCellsEditor, PropertyGridValueEditor, PropertyGridRowValueEditor, PropertyGridPanelValueEditor, PropertyGridTriggerValueEditor, PropertyGridTriggerValueInLogicEditor, propertyGridCss, QuestionConverter, svgBundle, SurveyTextWorkerError, SurveyTextWorkerParserError, SurveyTextWorkerJsonError, SurveyTextWorker, JsonDuplicateNameError, QuestionToolboxCategory, QuestionToolboxItem, QuestionToolbox, SidebarModel, SidebarTabModel, getNextItemValue, getNextItemText, getNextValue, findParentNode, focusFirstControl, getFirstNonTextElement, getNodesFromKoComponentInfo, propertyExists, isPropertyVisible, toggleHovered, clearNewLines, select, copyObject, copyCssClasses, assignDefaultV2Classes, wrapTextByCurlyBraces, capitalize, notShortCircuitAnd, imageMimeTypes, getAcceptedTypesByContentMode, getQuestionFromObj, ingectAlpha, convertRgbaToString, parseRgbaFromString, parseColor, HSBToRGB, RGBToHSB, assign, ColorCalculator, SurveyQuestionEditorDefinition, ObjType, SurveyHelper, ResizeManager, UndoRedoPlugin, undoRedoTransaction, ignoreUndoRedo, UndoRedoManager, Transaction, UndoRedoAction, UndoRedoArrayAction, PagesController */
23352
24114
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
23353
24115
 
23354
24116
  "use strict";
@@ -23487,6 +24249,12 @@ __webpack_require__.r(__webpack_exports__);
23487
24249
 
23488
24250
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Translation", function() { return _components_tabs_translation__WEBPACK_IMPORTED_MODULE_18__["Translation"]; });
23489
24251
 
24252
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TranslationEditor", function() { return _components_tabs_translation__WEBPACK_IMPORTED_MODULE_18__["TranslationEditor"]; });
24253
+
24254
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createImportCSVAction", function() { return _components_tabs_translation__WEBPACK_IMPORTED_MODULE_18__["createImportCSVAction"]; });
24255
+
24256
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createExportCSVAction", function() { return _components_tabs_translation__WEBPACK_IMPORTED_MODULE_18__["createExportCSVAction"]; });
24257
+
23490
24258
  /* harmony import */ var _components_tabs_translation_theme__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../components/tabs/translation-theme */ "./src/components/tabs/translation-theme.ts");
23491
24259
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "translationCss", function() { return _components_tabs_translation_theme__WEBPACK_IMPORTED_MODULE_19__["translationCss"]; });
23492
24260
 
@@ -23834,7 +24602,7 @@ __webpack_require__.r(__webpack_exports__);
23834
24602
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_71__ = __webpack_require__(/*! survey-core */ "survey-core");
23835
24603
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_71___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_71__);
23836
24604
  var Version;
23837
- Version = "" + "1.9.109";
24605
+ Version = "" + "1.9.111";
23838
24606
  //should be loaded before other styles for easier override
23839
24607
  __webpack_require__(/*! ../utils/context-button.scss */ "./src/utils/context-button.scss");
23840
24608
 
@@ -23924,7 +24692,7 @@ __webpack_require__(/*! ../utils/design.scss */ "./src/utils/design.scss");
23924
24692
  __webpack_require__(/*! ../utils/layout.scss */ "./src/utils/layout.scss");
23925
24693
 
23926
24694
  survey_core__WEBPACK_IMPORTED_MODULE_71__["settings"].supportCreatorV2 = true;
23927
- Object(survey_core__WEBPACK_IMPORTED_MODULE_71__["checkLibraryVersion"])("" + "1.9.109", "survey-creator-core");
24695
+ Object(survey_core__WEBPACK_IMPORTED_MODULE_71__["checkLibraryVersion"])("" + "1.9.111", "survey-creator-core");
23928
24696
 
23929
24697
 
23930
24698
  /***/ }),
@@ -24237,6 +25005,7 @@ var map = {
24237
25005
  "./rating.svg": "./src/images/rating.svg",
24238
25006
  "./redo.svg": "./src/images/redo.svg",
24239
25007
  "./remove_16x16.svg": "./src/images/remove_16x16.svg",
25008
+ "./required.svg": "./src/images/required.svg",
24240
25009
  "./reset.svg": "./src/images/reset.svg",
24241
25010
  "./save.svg": "./src/images/save.svg",
24242
25011
  "./select-page.svg": "./src/images/select-page.svg",
@@ -25112,6 +25881,17 @@ module.exports = "<svg viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\
25112
25881
 
25113
25882
  /***/ }),
25114
25883
 
25884
+ /***/ "./src/images/required.svg":
25885
+ /*!*********************************!*\
25886
+ !*** ./src/images/required.svg ***!
25887
+ \*********************************/
25888
+ /*! no static exports found */
25889
+ /***/ (function(module, exports) {
25890
+
25891
+ module.exports = "<svg viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\"><g clip-path=\"url(#clip0_1564_16728)\"><path d=\"M2.77 14.1393L6.09 9.03927L0 9.18927L0.06 6.51927L6.15 6.88927L2.96 1.68927L5.29 0.379272L8.02 5.81927L10.96 0.489272L13.23 1.84927L9.91 6.94927L16 6.79927L15.94 9.46927L9.85 9.09927L13.04 14.2993L10.71 15.6093L7.98 10.1693L5.04 15.4993L2.77 14.1393Z\"></path></g><defs><clipPath id=\"clip0_1564_16728\"><rect width=\"16\" height=\"16\" fill=\"white\"></rect></clipPath></defs></svg>"
25892
+
25893
+ /***/ }),
25894
+
25115
25895
  /***/ "./src/images/reset.svg":
25116
25896
  /*!******************************!*\
25117
25897
  !*** ./src/images/reset.svg ***!
@@ -26161,6 +26941,8 @@ var enStrings = {
26161
26941
  translationNoStrings: "No strings to translate. Please, change the filter.",
26162
26942
  translationExportToSCVButton: "Export to CSV",
26163
26943
  translationImportFromSCVButton: "Import from CSV",
26944
+ translateUsigAI: "Auto-translate All",
26945
+ translationDialogTitle: "Untranslated strings",
26164
26946
  translationMergeLocaleWithDefault: "Merge {0} with default locale",
26165
26947
  translationPlaceHolder: "Translation...",
26166
26948
  themeExportButton: "Export",
@@ -26191,9 +26973,11 @@ var enStrings = {
26191
26973
  question_visibilityName: "Show (hide) question",
26192
26974
  question_enableName: "Enable (disable) question",
26193
26975
  question_requireName: "Make question required",
26976
+ question_resetValue: "Reset question value",
26194
26977
  column_visibilityName: "Show (hide) column",
26195
26978
  column_enableName: "Enable (disable) column",
26196
26979
  column_requireName: "Make column required",
26980
+ column_resetValue: "Reset column value",
26197
26981
  trigger_completeName: "Complete survey",
26198
26982
  trigger_setvalueName: "Set answer",
26199
26983
  trigger_copyvalueName: "Copy answer",
@@ -26288,6 +27072,7 @@ var enStrings = {
26288
27072
  fastEntry: "Manual Entry",
26289
27073
  fastEntryNonUniqueError: "Value '{0}' is not unique",
26290
27074
  fastEntryChoicesCountError: "Please limit the number of items from {0} to {1}",
27075
+ fastEntryChoicesMinCountError: "Please enter at least {0} items",
26291
27076
  fastEntryPlaceholder: "You can set data in the following format:\nvalue1|text\nvalue2",
26292
27077
  formEntry: "Form Entry",
26293
27078
  testService: "Test the service",
@@ -26352,6 +27137,8 @@ var enStrings = {
26352
27137
  choicesOrder: "Choices sort order",
26353
27138
  visible: "Visible",
26354
27139
  isRequired: "Required",
27140
+ markRequired: "Mark as required",
27141
+ removeRequiredMark: "Remove the required mark",
26355
27142
  isAllRowRequired: "Require answer for all rows",
26356
27143
  requiredErrorText: "\"Required\" error message",
26357
27144
  startWithNewLine: "Display the question on a new line",
@@ -26433,8 +27220,12 @@ var enStrings = {
26433
27220
  imageHeight: "Image height (in CSS-accepted values)",
26434
27221
  imageWidth: "Image width (in CSS-accepted values)"
26435
27222
  },
27223
+ survey: {
27224
+ title: "Title"
27225
+ },
26436
27226
  page: {
26437
- maxTimeToFinish: "Time limit to finish the page (in seconds)"
27227
+ title: "Title",
27228
+ maxTimeToFinish: "Time limit to finish the page (in seconds)",
26438
27229
  },
26439
27230
  question: {
26440
27231
  page: "Parent page"
@@ -26670,6 +27461,9 @@ var enStrings = {
26670
27461
  pv: {
26671
27462
  "true": "true",
26672
27463
  "false": "false",
27464
+ "file": "Local files",
27465
+ "camera": "Camera",
27466
+ "file-camera": "Local files or camera",
26673
27467
  inherit: "Inherit",
26674
27468
  show: "Visible",
26675
27469
  hide: "Hidden",
@@ -26932,6 +27726,7 @@ var enStrings = {
26932
27726
  descriptionLocation: "Description location",
26933
27727
  defaultValueExpression: "Default value expression",
26934
27728
  requiredIf: "Required if",
27729
+ resetValueIf: "Reset value if",
26935
27730
  validators: "Validators",
26936
27731
  bindings: "Bindings",
26937
27732
  renderAs: "Render as",
@@ -27008,6 +27803,7 @@ var enStrings = {
27008
27803
  "--base-unit": "Base unit",
27009
27804
  groupGeneral: "General",
27010
27805
  groupAdvanced: "Advanced",
27806
+ groupHeader: "Header",
27011
27807
  themeName: "Theme",
27012
27808
  themeMode: "Question appearance",
27013
27809
  themeModePanels: "Default",
@@ -27018,11 +27814,15 @@ var enStrings = {
27018
27814
  primaryDefaultColor: "Default",
27019
27815
  primaryDarkColor: "Hover",
27020
27816
  primaryLightColor: "Selected",
27817
+ coverTitleForecolor: "Title forecolor",
27818
+ coverOverlap: "Overlap",
27021
27819
  backgroundDimColor: "Background color",
27022
27820
  backgroundImage: "Background image",
27023
27821
  backgroundImageFitAuto: "Auto",
27024
27822
  backgroundImageFitCover: "Cover",
27025
27823
  backgroundImageFitContain: "Contain",
27824
+ backgroundImageFitFill: "Fill",
27825
+ backgroundImageFitTile: "Tile",
27026
27826
  backgroundOpacity: "Opacity",
27027
27827
  backgroundImageAttachmentFixed: "Fixed",
27028
27828
  backgroundImageAttachmentScroll: "Scroll",
@@ -27067,6 +27867,26 @@ var enStrings = {
27067
27867
  boxShadowInner: "Inner",
27068
27868
  questionShadow: "Shadow effects",
27069
27869
  editorShadow: "Input element shadow effects",
27870
+ headerView: "View",
27871
+ headerViewTitle: "Title",
27872
+ headerViewCover: "Cover",
27873
+ coverAreaWidth: "Content area width",
27874
+ coverAreaWidthSurvey: "Same as survey",
27875
+ coverAreaWidthContainer: "Fit to page",
27876
+ coverTextWidth: "Text width",
27877
+ coverBackgroundColorSwitch: "Background color",
27878
+ coverBackgroundColorNone: "None",
27879
+ coverBackgroundColorAccentColor: "Accent color",
27880
+ coverBackgroundColorCustom: "Custom",
27881
+ horizontalAlignmentLeft: "Left",
27882
+ horizontalAlignmentCenter: "Center",
27883
+ horizontalAlignmentRight: "Right",
27884
+ verticalAlignmentTop: "Top",
27885
+ verticalAlignmentMiddle: "Middle",
27886
+ verticalAlignmentBottom: "Bottom",
27887
+ logoPosition: "Logo Position",
27888
+ coverTitlePosition: "Title Position",
27889
+ coverDescriptionPosition: "Description Position",
27070
27890
  names: {
27071
27891
  "default": "Default",
27072
27892
  "sharp": "Sharp",
@@ -27215,6 +28035,7 @@ var UndoRedoPlugin = /** @class */ (function () {
27215
28035
  this.model = new _undo_redo_controller__WEBPACK_IMPORTED_MODULE_0__["UndoRedoController"](creator);
27216
28036
  this.model.createActions().forEach(function (action) { return creator.toolbar.actions.push(action); });
27217
28037
  creator.registerShortcut("undo", {
28038
+ affectedTab: "designer",
27218
28039
  hotKey: {
27219
28040
  ctrlKey: true,
27220
28041
  keyCode: 90,
@@ -27225,6 +28046,7 @@ var UndoRedoPlugin = /** @class */ (function () {
27225
28046
  execute: function () { return _this.model.undo(); }
27226
28047
  });
27227
28048
  creator.registerShortcut("redo", {
28049
+ affectedTab: "designer",
27228
28050
  hotKey: {
27229
28051
  ctrlKey: true,
27230
28052
  keyCode: 89,
@@ -29655,6 +30477,15 @@ var FastEntryEditorBase = /** @class */ (function (_super) {
29655
30477
  _this.editSurvey.getQuestionByName("question").placeholder =
29656
30478
  _editorLocalization__WEBPACK_IMPORTED_MODULE_3__["editorLocalization"].getString("pe.fastEntryPlaceholder");
29657
30479
  _this.editSurvey.onValidateQuestion.add(function (sender, options) {
30480
+ var minChoiceCount = _this.options.minimumChoicesCount;
30481
+ if (minChoiceCount > 0) {
30482
+ var choicesCount = _this.getChoicesCount();
30483
+ if (minChoiceCount > choicesCount) {
30484
+ options.error = _editorLocalization__WEBPACK_IMPORTED_MODULE_3__["editorLocalization"]
30485
+ .getString("pe.fastEntryChoicesMinCountError")["format"](minChoiceCount);
30486
+ }
30487
+ return;
30488
+ }
29658
30489
  var maxChoicesCount = _this.options.maximumChoicesCount;
29659
30490
  if (maxChoicesCount > 0) {
29660
30491
  var choicesCount = _this.getChoicesCount();
@@ -31892,7 +32723,11 @@ var PropertyGridEditorMatrix = /** @class */ (function (_super) {
31892
32723
  if (this.getShowDetailPanelOnAdding()) {
31893
32724
  res.detailPanelShowOnAdding = true;
31894
32725
  }
32726
+ var minRowCount = this.getMinimumRowCount(obj, prop, options);
31895
32727
  var maxRowCount = this.getMaximumRowCount(obj, prop, options);
32728
+ if (minRowCount > 0) {
32729
+ res.minRowCount = minRowCount;
32730
+ }
31896
32731
  if (maxRowCount > 0) {
31897
32732
  res.maxRowCount = maxRowCount;
31898
32733
  }
@@ -31906,6 +32741,9 @@ var PropertyGridEditorMatrix = /** @class */ (function (_super) {
31906
32741
  }
31907
32742
  return _editorLocalization__WEBPACK_IMPORTED_MODULE_2__["editorLocalization"].getString(locName);
31908
32743
  };
32744
+ PropertyGridEditorMatrix.prototype.getMinimumRowCount = function (obj, prop, options) {
32745
+ return -1;
32746
+ };
31909
32747
  PropertyGridEditorMatrix.prototype.getMaximumRowCount = function (obj, prop, options) {
31910
32748
  return -1;
31911
32749
  };
@@ -32011,6 +32849,11 @@ var PropertyGridEditorMatrixItemValues = /** @class */ (function (_super) {
32011
32849
  res.showHeader = res.columns > 3;
32012
32850
  return res;
32013
32851
  };
32852
+ PropertyGridEditorMatrixItemValues.prototype.getMinimumRowCount = function (obj, prop, options) {
32853
+ if (prop.name === "choices")
32854
+ return options.minimumChoicesCount;
32855
+ return _super.prototype.getMaximumRowCount.call(this, obj, prop, options);
32856
+ };
32014
32857
  PropertyGridEditorMatrixItemValues.prototype.getMaximumRowCount = function (obj, prop, options) {
32015
32858
  if (prop.name === "choices")
32016
32859
  return options.maximumChoicesCount;
@@ -32746,6 +33589,7 @@ var PropertyGridViewModel = /** @class */ (function (_super) {
32746
33589
  title: this.selectedElementName,
32747
33590
  css: "sv-action--object-selector sv-action-bar-item--secondary",
32748
33591
  component: "sv-action-bar-item-dropdown",
33592
+ disableHide: true,
32749
33593
  action: function () {
32750
33594
  _this.selectorPopupModel.displayMode = _this.creator.isMobileView ? "overlay" : "popup";
32751
33595
  selectorModel.show(_this.selectionController.creator.survey, _this.propertyGridModel.obj, function (obj) {
@@ -33216,6 +34060,7 @@ var SurveyQuestionEditorDefinition = /** @class */ (function () {
33216
34060
  { name: "requiredIf", tab: "logic" },
33217
34061
  { name: "bindings", tab: "logic" },
33218
34062
  { name: "defaultValueExpression", tab: "logic" },
34063
+ { name: "resetValueIf", tab: "logic" },
33219
34064
  { name: "page", tab: "layout" },
33220
34065
  { name: "startWithNewLine", tab: "layout" },
33221
34066
  { name: "hideNumber", tab: "layout" },
@@ -33255,6 +34100,7 @@ var SurveyQuestionEditorDefinition = /** @class */ (function () {
33255
34100
  },
33256
34101
  file: {
33257
34102
  properties: [
34103
+ "sourceType",
33258
34104
  "allowMultiple",
33259
34105
  "allowImagesPreview",
33260
34106
  "acceptedTypes",
@@ -33528,6 +34374,7 @@ var SurveyQuestionEditorDefinition = /** @class */ (function () {
33528
34374
  { name: "enableIf", tab: "logic" },
33529
34375
  { name: "requiredIf", tab: "logic" },
33530
34376
  { name: "defaultValueExpression", tab: "logic" },
34377
+ { name: "resetValueIf", tab: "logic" },
33531
34378
  { name: "totalType", tab: "totals" },
33532
34379
  { name: "totalDisplayStyle", tab: "totals" },
33533
34380
  { name: "totalCurrency", tab: "totals" },
@@ -34583,6 +35430,8 @@ __webpack_require__.r(__webpack_exports__);
34583
35430
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "survey-core");
34584
35431
  /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_1__);
34585
35432
  /* harmony import */ var _creator_settings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./creator-settings */ "./src/creator-settings.ts");
35433
+ /* harmony import */ var _survey_helper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./survey-helper */ "./src/survey-helper.ts");
35434
+
34586
35435
 
34587
35436
 
34588
35437
 
@@ -34634,6 +35483,7 @@ var DragDropSurveyElements = /** @class */ (function (_super) {
34634
35483
  // protected ghostSurveyElement: IElement = null;
34635
35484
  _this.dragOverIndicatorElement = null;
34636
35485
  _this.isDraggedElementSelected = false;
35486
+ _this.maxNestedPanels = -1;
34637
35487
  _this.doBanDropHere = function () {
34638
35488
  _this.removeDragOverMarker(_this.dragOverIndicatorElement);
34639
35489
  _this.removeDragOverMarker(_this.dropTarget);
@@ -34864,6 +35714,13 @@ var DragDropSurveyElements = /** @class */ (function (_super) {
34864
35714
  if (this.draggedElement.getType() === "paneldynamic" && dropTarget === this.draggedElement.template) {
34865
35715
  return false;
34866
35716
  }
35717
+ if (this.maxNestedPanels >= 0 && this.draggedElement.isPanel) {
35718
+ var len = _survey_helper__WEBPACK_IMPORTED_MODULE_3__["SurveyHelper"].getElementDeepLength(dropTarget);
35719
+ if (this.isEdge && dropTarget.isPanel)
35720
+ len--;
35721
+ if (this.maxNestedPanels < len)
35722
+ return false;
35723
+ }
34867
35724
  if (DragDropSurveyElements.restrictDragQuestionBetweenPages &&
34868
35725
  this.shouldRestricDragQuestionBetweenPages(dropTarget)) {
34869
35726
  return false;
@@ -35425,6 +36282,15 @@ var SurveyHelper = /** @class */ (function () {
35425
36282
  }
35426
36283
  return false;
35427
36284
  };
36285
+ SurveyHelper.getElementDeepLength = function (element) {
36286
+ var res = 0;
36287
+ while (!!element) {
36288
+ if (element.isPanel)
36289
+ res++;
36290
+ element = element.parent;
36291
+ }
36292
+ return res;
36293
+ };
35428
36294
  return SurveyHelper;
35429
36295
  }());
35430
36296
 
@@ -35897,6 +36763,23 @@ var QuestionToolboxItem = /** @class */ (function (_super) {
35897
36763
  QuestionToolboxItem.prototype.toJSON = function () {
35898
36764
  return this.item;
35899
36765
  };
36766
+ Object.defineProperty(QuestionToolboxItem.prototype, "typeName", {
36767
+ get: function () {
36768
+ if (!!this.json && !!this.json.type)
36769
+ return this.json.type;
36770
+ return this.name;
36771
+ },
36772
+ enumerable: false,
36773
+ configurable: true
36774
+ });
36775
+ Object.defineProperty(QuestionToolboxItem.prototype, "isPanel", {
36776
+ get: function () {
36777
+ var type = this.typeName;
36778
+ return !!type && survey_core__WEBPACK_IMPORTED_MODULE_1__["Serializer"].isDescendantOf(type, "panelbase");
36779
+ },
36780
+ enumerable: false,
36781
+ configurable: true
36782
+ });
35900
36783
  return QuestionToolboxItem;
35901
36784
  }(survey_core__WEBPACK_IMPORTED_MODULE_1__["Action"]));
35902
36785
 
@@ -36042,7 +36925,7 @@ var QuestionToolbox = /** @class */ (function (_super) {
36042
36925
  get: function () {
36043
36926
  var res = [];
36044
36927
  for (var i = 0; i < this.items.length; i++) {
36045
- res.push(this.items[i].name);
36928
+ res.push(this.items[i].typeName);
36046
36929
  }
36047
36930
  return res;
36048
36931
  },