survey-creator-core 2.0.0 → 2.0.1

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.
Files changed (159) hide show
  1. package/fesm/i18n/arabic.js +1 -1
  2. package/fesm/i18n/bulgarian.js +1 -1
  3. package/fesm/i18n/burmese.js +1 -1
  4. package/fesm/i18n/croatian.js +1 -1
  5. package/fesm/i18n/czech.js +1 -1
  6. package/fesm/i18n/danish.js +1 -1
  7. package/fesm/i18n/dutch.js +1 -1
  8. package/fesm/i18n/english.js +1 -1
  9. package/fesm/i18n/finnish.js +1 -1
  10. package/fesm/i18n/french.js +1 -1
  11. package/fesm/i18n/german.js +1 -1
  12. package/fesm/i18n/hebrew.js +1 -1
  13. package/fesm/i18n/hungarian.js +1 -1
  14. package/fesm/i18n/index.js +1 -1
  15. package/fesm/i18n/indonesian.js +1 -1
  16. package/fesm/i18n/italian.js +1 -1
  17. package/fesm/i18n/japanese.js +1 -1
  18. package/fesm/i18n/korean.js +1 -1
  19. package/fesm/i18n/malay.js +1 -1
  20. package/fesm/i18n/mongolian.js +1 -1
  21. package/fesm/i18n/norwegian.js +1 -1
  22. package/fesm/i18n/persian.js +1 -1
  23. package/fesm/i18n/polish.js +1 -1
  24. package/fesm/i18n/portuguese.js +1 -1
  25. package/fesm/i18n/romanian.js +1 -1
  26. package/fesm/i18n/russian.js +1 -1
  27. package/fesm/i18n/simplified-chinese.js +1 -1
  28. package/fesm/i18n/slovak.js +1 -1
  29. package/fesm/i18n/slovenian.js +1 -1
  30. package/fesm/i18n/spanish.js +1 -1
  31. package/fesm/i18n/swedish.js +1 -1
  32. package/fesm/i18n/tajik.js +1 -1
  33. package/fesm/i18n/thai.js +1 -1
  34. package/fesm/i18n/traditional-chinese.js +1 -1
  35. package/fesm/i18n/turkish.js +1 -1
  36. package/fesm/survey-creator-core.i18n.js +1 -1
  37. package/fesm/survey-creator-core.js +1252 -1210
  38. package/fesm/survey-creator-core.js.map +1 -1
  39. package/fesm/themes/index.js +34 -1
  40. package/fesm/themes/index.js.map +1 -1
  41. package/fonts.fontless.css +1 -1
  42. package/fonts.fontless.min.css +1 -1
  43. package/i18n/arabic.js +1 -1
  44. package/i18n/arabic.min.js.LICENSE.txt +1 -1
  45. package/i18n/bulgarian.js +1 -1
  46. package/i18n/bulgarian.min.js.LICENSE.txt +1 -1
  47. package/i18n/burmese.js +1 -1
  48. package/i18n/burmese.min.js.LICENSE.txt +1 -1
  49. package/i18n/croatian.js +1 -1
  50. package/i18n/croatian.min.js.LICENSE.txt +1 -1
  51. package/i18n/czech.js +1 -1
  52. package/i18n/czech.min.js.LICENSE.txt +1 -1
  53. package/i18n/danish.js +1 -1
  54. package/i18n/danish.min.js.LICENSE.txt +1 -1
  55. package/i18n/dutch.js +1 -1
  56. package/i18n/dutch.min.js.LICENSE.txt +1 -1
  57. package/i18n/english.js +1 -1
  58. package/i18n/english.min.js.LICENSE.txt +1 -1
  59. package/i18n/finnish.js +1 -1
  60. package/i18n/finnish.min.js.LICENSE.txt +1 -1
  61. package/i18n/french.js +1 -1
  62. package/i18n/french.min.js.LICENSE.txt +1 -1
  63. package/i18n/german.js +1 -1
  64. package/i18n/german.min.js.LICENSE.txt +1 -1
  65. package/i18n/hebrew.js +1 -1
  66. package/i18n/hebrew.min.js.LICENSE.txt +1 -1
  67. package/i18n/hungarian.js +1 -1
  68. package/i18n/hungarian.min.js.LICENSE.txt +1 -1
  69. package/i18n/index.js +1 -1
  70. package/i18n/index.min.js.LICENSE.txt +1 -1
  71. package/i18n/indonesian.js +1 -1
  72. package/i18n/indonesian.min.js.LICENSE.txt +1 -1
  73. package/i18n/italian.js +1 -1
  74. package/i18n/italian.min.js.LICENSE.txt +1 -1
  75. package/i18n/japanese.js +1 -1
  76. package/i18n/japanese.min.js.LICENSE.txt +1 -1
  77. package/i18n/korean.js +1 -1
  78. package/i18n/korean.min.js.LICENSE.txt +1 -1
  79. package/i18n/malay.js +1 -1
  80. package/i18n/malay.min.js.LICENSE.txt +1 -1
  81. package/i18n/mongolian.js +1 -1
  82. package/i18n/mongolian.min.js.LICENSE.txt +1 -1
  83. package/i18n/norwegian.js +1 -1
  84. package/i18n/norwegian.min.js.LICENSE.txt +1 -1
  85. package/i18n/persian.js +1 -1
  86. package/i18n/persian.min.js.LICENSE.txt +1 -1
  87. package/i18n/polish.js +1 -1
  88. package/i18n/polish.min.js.LICENSE.txt +1 -1
  89. package/i18n/portuguese.js +1 -1
  90. package/i18n/portuguese.min.js.LICENSE.txt +1 -1
  91. package/i18n/romanian.js +1 -1
  92. package/i18n/romanian.min.js.LICENSE.txt +1 -1
  93. package/i18n/russian.js +1 -1
  94. package/i18n/russian.min.js.LICENSE.txt +1 -1
  95. package/i18n/simplified-chinese.js +1 -1
  96. package/i18n/simplified-chinese.min.js.LICENSE.txt +1 -1
  97. package/i18n/slovak.js +1 -1
  98. package/i18n/slovak.min.js.LICENSE.txt +1 -1
  99. package/i18n/slovenian.js +1 -1
  100. package/i18n/slovenian.min.js.LICENSE.txt +1 -1
  101. package/i18n/spanish.js +1 -1
  102. package/i18n/spanish.min.js.LICENSE.txt +1 -1
  103. package/i18n/swedish.js +1 -1
  104. package/i18n/swedish.min.js.LICENSE.txt +1 -1
  105. package/i18n/tajik.js +1 -1
  106. package/i18n/tajik.min.js.LICENSE.txt +1 -1
  107. package/i18n/thai.js +1 -1
  108. package/i18n/thai.min.js.LICENSE.txt +1 -1
  109. package/i18n/traditional-chinese.js +1 -1
  110. package/i18n/traditional-chinese.min.js.LICENSE.txt +1 -1
  111. package/i18n/turkish.js +1 -1
  112. package/i18n/turkish.min.js.LICENSE.txt +1 -1
  113. package/package.json +2 -2
  114. package/survey-creator-core.css +259 -245
  115. package/survey-creator-core.fontless.css +258 -244
  116. package/survey-creator-core.fontless.css.map +1 -1
  117. package/survey-creator-core.fontless.min.css +22 -22
  118. package/survey-creator-core.i18n.js +1 -1
  119. package/survey-creator-core.i18n.min.js.LICENSE.txt +1 -1
  120. package/survey-creator-core.js +5648 -5570
  121. package/survey-creator-core.js.map +1 -1
  122. package/survey-creator-core.min.css +23 -23
  123. package/survey-creator-core.min.js +1 -1
  124. package/survey-creator-core.min.js.LICENSE.txt +1 -1
  125. package/themes/default-contrast.js +1 -1
  126. package/themes/default-contrast.min.js.LICENSE.txt +1 -1
  127. package/themes/default-dark.js +1 -1
  128. package/themes/default-dark.min.js.LICENSE.txt +1 -1
  129. package/themes/index.d.ts +33 -0
  130. package/themes/index.js +34 -1
  131. package/themes/index.js.map +1 -1
  132. package/themes/index.min.js +1 -1
  133. package/themes/index.min.js.LICENSE.txt +1 -1
  134. package/themes/sc2020.d.ts +33 -0
  135. package/themes/sc2020.js +34 -1
  136. package/themes/sc2020.js.map +1 -1
  137. package/themes/sc2020.min.js +1 -1
  138. package/themes/sc2020.min.js.LICENSE.txt +1 -1
  139. package/typings/components/action-container-view-model.d.ts +1 -85
  140. package/typings/components/page.d.ts +3 -7
  141. package/typings/components/question.d.ts +3 -4
  142. package/typings/components/row.d.ts +3 -3
  143. package/typings/components/scroll.d.ts +0 -1
  144. package/typings/components/string-editor.d.ts +3 -0
  145. package/typings/components/survey-element-adorner-base.d.ts +88 -0
  146. package/typings/components/tabs/designer-state-manager.d.ts +3 -1
  147. package/typings/components/tabs/logic-theme.d.ts +1 -13
  148. package/typings/creator-base.d.ts +23 -5
  149. package/typings/creator-events-api.d.ts +7 -0
  150. package/typings/creator-options.d.ts +6 -0
  151. package/typings/drag-drop-enums.d.ts +14 -0
  152. package/typings/{survey-elements.d.ts → dragdrop-survey-elements.d.ts} +14 -8
  153. package/typings/editorLocalization.d.ts +1 -0
  154. package/typings/entries/index.d.ts +2 -2
  155. package/typings/expand-collapse-manager.d.ts +1 -1
  156. package/typings/property-grid/index.d.ts +0 -1
  157. package/typings/property-grid/matrices.d.ts +0 -1
  158. package/typings/survey-helper.d.ts +1 -1
  159. package/typings/utils/creator-utils.d.ts +0 -2
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * SurveyJS Creator v2.0.0
2
+ * SurveyJS Creator v2.0.1
3
3
  * (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * Github: https://github.com/surveyjs/survey-creator
5
5
  * License: https://surveyjs.io/Licenses#SurveyCreator
6
6
  */
7
7
 
8
8
  import * as Survey from 'survey-core';
9
- import { surveyLocalization, Serializer, SurveyModel, Helpers, QuestionFactory, CustomWidgetCollection, defaultCss, settings as settings$1, MatrixDropdownColumn, ItemValue, JsonError, property, Base, Action, ComputedUpdater, ActionContainer, propertyArray, AdaptiveActionContainer, AnimationBoolean, CssClassBuilder, DragOrClickHelper, ElementFactory, ComponentCollection, JsonObject, ListModel, EventBase, createDropdownActionModel, surveyCss, defaultThemeName, ConditionsParser, SurveyTrigger, QuestionMatrixDropdownModelBase, QuestionPanelDynamicModel, ConditionRunner, ExpressionRunner, FunctionFactory, QuestionButtonGroupModel, QuestionTextBase, DragDropCore, PageModel, DragTypeOverMeEnum, getIconNameFromProxy, prepareElementForVerticalAnimation, cleanHtmlElementAfterAnimation, LocalizableString, QuestionCommentModel, createPopupModelWithListModel, defaultActionBarCss, createDropdownActionModelAdvanced, PopupModel, getActionDropdownButtonTarget, AnimationGroup, activateLazyRenderingChecks, CharacterCounter, QuestionImagePickerModel, QuestionMultipleTextModel, QuestionMatrixDropdownModel, QuestionMatrixDynamicModel, QuestionMatrixModel, QuestionSelectBase, MultipleTextItemModel, addIconsToThemeSet, SvgRegistry, hasLicense, slk, Notifier, SvgThemeSets, IsTouch, SurveyElement, Question, PanelModel, DragDropChoices, chooseFiles, classesToSelector, PanelModelBase, QuestionHtmlModel, QuestionNonValue, QuestionTextModel, QuestionFileModel, QuestionRatingModel, renamedIcons, JsonObjectProperty, checkLibraryVersion } from 'survey-core';
9
+ import { surveyLocalization, Serializer, SurveyModel, Helpers, QuestionFactory, CustomWidgetCollection, defaultCss, settings as settings$1, MatrixDropdownColumn, ItemValue, JsonError, property, Base, Action, ComputedUpdater, ActionContainer, propertyArray, AdaptiveActionContainer, AnimationBoolean, CssClassBuilder, DragOrClickHelper, ElementFactory, ComponentCollection, JsonObject, ListModel, EventBase, createDropdownActionModel, surveyCss, defaultThemeName, ConditionsParser, SurveyTrigger, QuestionMatrixDropdownModelBase, QuestionPanelDynamicModel, ConditionRunner, ExpressionRunner, FunctionFactory, QuestionButtonGroupModel, QuestionTextBase, LocalizableString, PageModel, QuestionCommentModel, createPopupModelWithListModel, defaultActionBarCss, createDropdownActionModelAdvanced, PopupModel, getActionDropdownButtonTarget, prepareElementForVerticalAnimation, cleanHtmlElementAfterAnimation, DragDropCore, getIconNameFromProxy, AnimationGroup, activateLazyRenderingChecks, CharacterCounter, QuestionImagePickerModel, QuestionMultipleTextModel, QuestionMatrixDropdownModel, QuestionMatrixDynamicModel, QuestionMatrixModel, QuestionSelectBase, MultipleTextItemModel, addIconsToThemeSet, SvgRegistry, hasLicense, slk, Notifier, SvgThemeSets, IsTouch, SurveyElement, Question, PanelModel, DragDropChoices, chooseFiles, classesToSelector, PanelModelBase, QuestionHtmlModel, QuestionNonValue, QuestionTextModel, QuestionFileModel, QuestionRatingModel, renamedIcons, JsonObjectProperty, checkLibraryVersion } from 'survey-core';
10
10
 
11
11
  // Uncomment the line below if you create a custom dictionary
12
12
  // import { editorLocalization } from "survey-creator-core";
@@ -2293,6 +2293,9 @@ surveyLocalization.onGetExternalString = (name, locale) => {
2293
2293
  function getLocString(strName, locale = null) {
2294
2294
  return editorLocalization.getString(strName, locale);
2295
2295
  }
2296
+ function getLocaleStrings(loc) {
2297
+ return editorLocalization.getLocaleStrings(loc);
2298
+ }
2296
2299
  var defaultStrings = enStrings;
2297
2300
  function setupLocale(localeConfig) {
2298
2301
  editorLocalization.setupLocale(localeConfig.localeCode, localeConfig.strings);
@@ -3584,22 +3587,6 @@ function getNextValue(prefix, values, isText) {
3584
3587
  }
3585
3588
  return isText ? "" : prefix + 1;
3586
3589
  }
3587
- function propertyExists(obj, propertyName) {
3588
- let result = true;
3589
- if (!!obj && typeof obj.getType === "function") {
3590
- const property = Serializer.findProperty(obj.getType(), propertyName);
3591
- result = !!property;
3592
- }
3593
- return result;
3594
- }
3595
- function isPropertyVisible(obj, propertyName) {
3596
- let result = true;
3597
- if (!!obj && typeof obj.getType === "function") {
3598
- const property = Serializer.findProperty(obj.getType(), propertyName);
3599
- result = !property || property.visible;
3600
- }
3601
- return result;
3602
- }
3603
3590
  function getQuestionFromObj(obj) {
3604
3591
  return (obj instanceof MatrixDropdownColumn) ? obj.templateQuestion : obj;
3605
3592
  }
@@ -3762,23 +3749,12 @@ class SurveyHelper {
3762
3749
  }
3763
3750
  return result;
3764
3751
  }
3765
- static isPropertyVisible(obj, property, options = null, showMode = null, parentObj = null, parentProperty = null) {
3766
- if (!property || !property.visible)
3767
- return false;
3768
- if (!!showMode && !!property.showMode && showMode !== property.showMode)
3752
+ static isPropertyVisible(obj, prop, options = null, showMode = null, parentObj = null, parentProperty = null) {
3753
+ if (!prop || !prop.visible)
3769
3754
  return false;
3770
- if (!!property.isVisible &&
3771
- !!obj.getLayoutType &&
3772
- !property["isVisible"](obj.getLayoutType(), null))
3773
- return false;
3774
- var canShow = !!options
3775
- ? (object, property) => {
3776
- return options.onCanShowPropertyCallback(object, property, showMode, parentObj, parentProperty);
3777
- }
3778
- : null;
3779
- if (!!canShow && !canShow(obj, property))
3755
+ if (!!showMode && !!prop.showMode && showMode !== prop.showMode && prop.locationInTable !== "both")
3780
3756
  return false;
3781
- return true;
3757
+ return !options || options.onCanShowPropertyCallback(obj, prop, showMode, parentObj, parentProperty);
3782
3758
  }
3783
3759
  static isNeedScrollIntoView(el, scrollIfElementBiggerThanContainer = false) {
3784
3760
  if (!el || !el.scrollIntoView)
@@ -13188,7 +13164,7 @@ class SurveyQuestionProperties {
13188
13164
  const isColumn = this.isColumnObj;
13189
13165
  for (var i = 0; i < this.properties.length; i++) {
13190
13166
  const prop = this.properties[i];
13191
- if (this.isJSONPropertyVisible(prop) && !usedProperties[prop.name] && (!isFormMode || prop.showMode === "form" || isColumn && prop.availableInMatrixColumn)) {
13167
+ if (this.isJSONPropertyVisible(prop) && !usedProperties[prop.name] && (!isFormMode || prop.locationInTable === "both" || prop.showMode === "form" || isColumn && prop.availableInMatrixColumn)) {
13192
13168
  res.push(prop);
13193
13169
  }
13194
13170
  }
@@ -13737,8 +13713,8 @@ class PropertyJSONGenerator {
13737
13713
  this.options.onPropertyEditorCreatedCallback(this.obj, prop, q);
13738
13714
  }
13739
13715
  }
13740
- getVisibilityOnEvent(prop, showMode = "") {
13741
- return this.options.onCanShowPropertyCallback(this.obj, prop, showMode, this.parentObj, this.parentProperty);
13716
+ getVisibilityOnEvent(prop) {
13717
+ return this.options.onCanShowPropertyCallback(this.obj, prop, undefined, this.parentObj, this.parentProperty);
13742
13718
  }
13743
13719
  isPropertyReadOnly(prop) {
13744
13720
  return PropertyJSONGenerator.isPropertyReadOnly(prop, this.options, this.obj, this.parentObj, this.parentProperty);
@@ -13856,10 +13832,8 @@ class PropertyJSONGenerator {
13856
13832
  return res;
13857
13833
  }
13858
13834
  createQuestionJSON(obj, prop, title, isColumn = false, context) {
13859
- var isVisible = this.isPropertyVisible(prop, isColumn ? "list" : "");
13860
- if (!isVisible && isColumn)
13861
- return null;
13862
- var json = PropertyGridEditorCollection.getJSON(obj, prop, this.options, context, this.propertyGridDefinition);
13835
+ //if(isColumn && !SurveyHelper.isPropertyVisible(this.obj, prop, undefined, isColumn ? "list" : "")) return null;
13836
+ const json = PropertyGridEditorCollection.getJSON(obj, prop, this.options, context, this.propertyGridDefinition);
13863
13837
  if (!json)
13864
13838
  return null;
13865
13839
  json.name = prop.name;
@@ -13912,11 +13886,6 @@ class PropertyJSONGenerator {
13912
13886
  }
13913
13887
  return json;
13914
13888
  }
13915
- isPropertyVisible(prop, showMode) {
13916
- if (!prop.visible)
13917
- return false;
13918
- return !showMode || !prop.showMode || showMode == prop.showMode;
13919
- }
13920
13889
  getPanelTitle(name, title) {
13921
13890
  if (!!title)
13922
13891
  return title;
@@ -14513,9 +14482,6 @@ class PropertyGridEditor {
14513
14482
  const surveyPropertyEditor = editor.createPropertyEditorSetup(obj, property, question, options);
14514
14483
  if (!surveyPropertyEditor)
14515
14484
  return null;
14516
- if (property.type !== "condition") {
14517
- surveyPropertyEditor.editSurvey.css = defaultCss;
14518
- }
14519
14485
  if (question.isReadOnly) {
14520
14486
  surveyPropertyEditor.editSurvey.mode = "display";
14521
14487
  }
@@ -15570,483 +15536,6 @@ __decorate([
15570
15536
  property({ defaultValue: "icon" })
15571
15537
  ], MenuButton.prototype, "contentType", void 0);
15572
15538
 
15573
- function calculateIsEdge(dropTargetNode, clientY) {
15574
- const rect = dropTargetNode.getBoundingClientRect();
15575
- return clientY - rect.top <= DragDropSurveyElements.edgeHeight || rect.bottom - clientY <= DragDropSurveyElements.edgeHeight;
15576
- }
15577
- function calculateIsSide(dropTargetNode, clientX) {
15578
- const rect = dropTargetNode.getBoundingClientRect();
15579
- return clientX - rect.left <= DragDropSurveyElements.edgeHeight || rect.right - clientX <= DragDropSurveyElements.edgeHeight;
15580
- }
15581
- function calculateDragOverLocation(clientX, clientY, rect, direction = null) {
15582
- const tg = rect.height / rect.width;
15583
- const dx = clientX - rect.x;
15584
- const dy = clientY - rect.y;
15585
- if (direction == "top-bottom") {
15586
- if (dy >= rect.height / 2) {
15587
- return DragTypeOverMeEnum.Bottom;
15588
- }
15589
- else {
15590
- return DragTypeOverMeEnum.Top;
15591
- }
15592
- }
15593
- if (direction == "left-right") {
15594
- if (dx >= rect.width / 2) {
15595
- return DragTypeOverMeEnum.Right;
15596
- }
15597
- else {
15598
- return DragTypeOverMeEnum.Left;
15599
- }
15600
- }
15601
- if (dy >= tg * dx) {
15602
- if (dy >= -tg * dx + rect.height) {
15603
- return DragTypeOverMeEnum.Bottom;
15604
- }
15605
- else {
15606
- return DragTypeOverMeEnum.Left;
15607
- }
15608
- }
15609
- else {
15610
- if (dy >= -tg * dx + rect.height) {
15611
- return DragTypeOverMeEnum.Right;
15612
- }
15613
- else {
15614
- return DragTypeOverMeEnum.Top;
15615
- }
15616
- }
15617
- }
15618
- function isPanelDynamic(element) {
15619
- return element instanceof QuestionPanelDynamicModel;
15620
- }
15621
- class DragDropSurveyElements extends DragDropCore {
15622
- constructor() {
15623
- super(...arguments);
15624
- this.insideContainer = null;
15625
- this.prevIsEdge = null;
15626
- // protected ghostSurveyElement: IElement = null;
15627
- this.dragOverIndicatorElement = null;
15628
- this.isDraggedElementSelected = false;
15629
- this.doBanDropHere = () => {
15630
- this.removeDragOverMarker(this.dragOverIndicatorElement);
15631
- this.removeDragOverMarker(this.dropTarget);
15632
- };
15633
- this.doDrop = () => {
15634
- var _a;
15635
- if (!this.dropTarget)
15636
- return;
15637
- const page = this.parentElement;
15638
- const dragged = this.draggedElement;
15639
- const src = this.draggedElement;
15640
- if (dragged.isPage && dragged instanceof PageModel) {
15641
- const survey = dragged.survey;
15642
- const indexOfDraggedPage = survey.pages.indexOf(dragged);
15643
- survey.pages.splice(indexOfDraggedPage, 1);
15644
- const indexOfDropTarget = survey.pages.indexOf(this.dropTarget) + (this.dragOverLocation === DragTypeOverMeEnum.Top ? 0 : 1);
15645
- survey.pages.splice(indexOfDropTarget, 0, dragged);
15646
- if (indexOfDraggedPage !== indexOfDropTarget) {
15647
- dragged["draggedFrom"] = indexOfDraggedPage < indexOfDropTarget ? indexOfDraggedPage : indexOfDraggedPage + 1;
15648
- }
15649
- return dragged;
15650
- }
15651
- const convertLocation = () => {
15652
- switch (this.dragOverLocation) {
15653
- case 4: return "top";
15654
- case 5: return "right";
15655
- case 6: return "bottom";
15656
- case 7: return "left";
15657
- default: return "bottom";
15658
- }
15659
- };
15660
- const srcContainer = src.parent || src.page;
15661
- if (!!srcContainer) {
15662
- page.survey.startMovingQuestion();
15663
- srcContainer.removeElement(src);
15664
- }
15665
- let dest = ((_a = this.dragOverIndicatorElement) === null || _a === void 0 ? void 0 : _a.isPanel) ? this.dragOverIndicatorElement : this.dropTarget;
15666
- if (isPanelDynamic(dest) && this.insideContainer)
15667
- dest = dest.template;
15668
- if (dest.isPage && dest.elements.length > 0 && !this.insideContainer)
15669
- return;
15670
- const isTargetIsContainer = dest.isPanel || dest.isPage;
15671
- if (isTargetIsContainer && this.insideContainer) {
15672
- dest.insertElement(src);
15673
- }
15674
- else {
15675
- const destParent = dest.parent || dest.page;
15676
- if (destParent)
15677
- destParent.insertElement(src, dest, convertLocation());
15678
- }
15679
- page.survey.stopMovingQuestion();
15680
- return dragged;
15681
- };
15682
- }
15683
- get draggedElementType() {
15684
- if (!!this.draggedElement && this.draggedElement.isPage) {
15685
- return "survey-page";
15686
- }
15687
- return "survey-element";
15688
- }
15689
- get maxNestedPanels() { return this.onGetMaxNestedPanels ? this.onGetMaxNestedPanels() : -1; }
15690
- // private isRight: boolean;
15691
- // protected prevIsRight: boolean;
15692
- startDragToolboxItem(event, draggedElementJson, toolboxItemModel) {
15693
- const draggedElement = this.createElementFromJson(draggedElementJson);
15694
- draggedElement.toolboxItemTitle = toolboxItemModel.title;
15695
- draggedElement.toolboxItemIconName = toolboxItemModel.iconName;
15696
- this.startDrag(event, draggedElement);
15697
- }
15698
- startDragSurveyElement(event, draggedElement, isElementSelected) {
15699
- this.isDraggedElementSelected = isElementSelected;
15700
- this.startDrag(event, draggedElement);
15701
- }
15702
- getShortcutText(draggedElement) {
15703
- return draggedElement.toolboxItemTitle || super.getShortcutText(draggedElement);
15704
- }
15705
- createDraggedElementShortcut(text, draggedElementNode, event) {
15706
- const draggedElementShortcut = document.createElement("div");
15707
- draggedElementShortcut.style.display = "flex";
15708
- const textSpan = document.createElement("span");
15709
- textSpan.className = "svc-dragged-element-shortcut__text";
15710
- textSpan.innerText = text;
15711
- if (this.draggedElement.toolboxItemIconName) {
15712
- draggedElementShortcut.appendChild(this.createDraggedElementIcon());
15713
- }
15714
- draggedElementShortcut.appendChild(textSpan);
15715
- draggedElementShortcut.className = this.getDraggedElementClass();
15716
- return draggedElementShortcut;
15717
- }
15718
- createDraggedElementIcon() {
15719
- const span = document.createElement("span");
15720
- span.className = "svc-dragged-element-shortcut__icon";
15721
- const iconName = getIconNameFromProxy(this.draggedElement.toolboxItemIconName);
15722
- const svgString = `<svg class="sv-svg-icon" role="img"><use xlink:href="#${iconName}"></use></svg>`;
15723
- span.innerHTML = svgString;
15724
- return span;
15725
- }
15726
- getDraggedElementClass() {
15727
- let result = "svc-dragged-element-shortcut";
15728
- if (!!this.draggedElement.toolboxItemIconName)
15729
- result += " svc-dragged-element-shortcut--has-icon";
15730
- if (this.isDraggedElementSelected)
15731
- result += " svc-dragged-element-shortcut--selected";
15732
- return result;
15733
- }
15734
- createElementFromJson(json) {
15735
- const element = this.createNewElement(json);
15736
- if (element["setSurveyImpl"]) {
15737
- element["setSurveyImpl"](this.survey);
15738
- }
15739
- else {
15740
- element["setData"](this.survey);
15741
- }
15742
- element.renderWidth = "100%";
15743
- return element;
15744
- }
15745
- createNewElement(json) {
15746
- var newElement = Serializer.createClass(json["type"]);
15747
- new JsonObject().toObject(json, newElement);
15748
- return newElement;
15749
- }
15750
- findDropTargetNodeByDragOverNode(dragOverNode) {
15751
- const ghostRow = dragOverNode.closest(".svc-row--ghost");
15752
- if (!!ghostRow) {
15753
- const ghostDataAttrSelector = "[data-sv-drop-target-survey-element='sv-drag-drop-ghost-survey-element-name']";
15754
- const ghostNode = dragOverNode.closest(ghostDataAttrSelector) || dragOverNode.querySelector(ghostDataAttrSelector);
15755
- if (!!ghostNode) {
15756
- return ghostNode;
15757
- }
15758
- }
15759
- const dropTargetNode = dragOverNode.closest(this.dropTargetDataAttributeName);
15760
- return dropTargetNode;
15761
- }
15762
- getDropTargetByDataAttributeValue(dataAttributeValue, dropTargetNode, event) {
15763
- const oldDragOverIndicatorElement = this.dragOverIndicatorElement;
15764
- if (!dataAttributeValue) {
15765
- // panel dynamic
15766
- const nearestDropTargetElement = dropTargetNode.parentElement.closest(this.dropTargetDataAttributeName);
15767
- dataAttributeValue = this.getDataAttributeValueByNode(nearestDropTargetElement);
15768
- }
15769
- if (!dataAttributeValue) {
15770
- throw new Error("Can't find drop target survey element name");
15771
- }
15772
- if (dataAttributeValue === DragDropSurveyElements.ghostSurveyElementName) {
15773
- return this.prevDropTarget;
15774
- }
15775
- // drop to new page
15776
- if (dataAttributeValue === "newGhostPage") {
15777
- return DragDropSurveyElements.newGhostPage;
15778
- }
15779
- // drop to page
15780
- let page = this.survey.getPageByName(dataAttributeValue);
15781
- if (page) {
15782
- return page;
15783
- }
15784
- // drop to question or panel
15785
- let dropTarget;
15786
- let dragOverElement;
15787
- this.survey.pages.forEach((page) => {
15788
- const question = page.getElementByName(dataAttributeValue);
15789
- if (question) {
15790
- dropTarget = question;
15791
- dragOverElement = question;
15792
- }
15793
- });
15794
- // drop to matrix detail panel
15795
- if ((dropTarget.getType() === "matrixdropdown" || dropTarget.getType() === "matrixdynamic") && dropTarget.detailPanelMode !== "none" && this.insideContainer) {
15796
- dropTarget = dropTarget.detailPanel;
15797
- }
15798
- // drop to question
15799
- //question inside paneldymanic
15800
- if (!dropTarget.page) {
15801
- const nearestDropTargetPageElement = dropTargetNode.parentElement.closest("[data-sv-drop-target-page]");
15802
- dataAttributeValue = nearestDropTargetPageElement.dataset.svDropTargetPage;
15803
- let page = this.survey.getPageByName(dataAttributeValue);
15804
- dropTarget.__page = page;
15805
- }
15806
- this.dragOverIndicatorElement = dragOverElement;
15807
- if (this.dragOverIndicatorElement != oldDragOverIndicatorElement) {
15808
- this.removeDragOverMarker(oldDragOverIndicatorElement);
15809
- }
15810
- return dropTarget;
15811
- // EO drop to question or panel
15812
- }
15813
- isDropTargetValid(dropTarget, dropTargetNode, dragOverLocation = DragTypeOverMeEnum.Top) {
15814
- if (!dropTarget)
15815
- return false;
15816
- if (dropTarget === this.draggedElement)
15817
- return false;
15818
- if (this.draggedElement.getType() === "paneldynamic" && dropTarget === this.draggedElement.template) {
15819
- return false;
15820
- }
15821
- if (this.maxNestedPanels >= 0 && this.draggedElement.isPanel) {
15822
- const pnl = this.draggedElement;
15823
- if (pnl.deepNested === undefined) {
15824
- pnl.deepNested = this.getMaximumNestedPanelCount(pnl, 0);
15825
- }
15826
- let len = SurveyHelper.getElementDeepLength(dropTarget);
15827
- if (dragOverLocation !== DragTypeOverMeEnum.InsideEmptyPanel && dropTarget.isPanel)
15828
- len--;
15829
- if (this.maxNestedPanels < len + pnl.deepNested)
15830
- return false;
15831
- }
15832
- if (DragDropSurveyElements.restrictDragQuestionBetweenPages &&
15833
- this.shouldRestricDragQuestionBetweenPages(dropTarget)) {
15834
- return false;
15835
- }
15836
- return true;
15837
- }
15838
- getMaximumNestedPanelCount(panel, deep) {
15839
- let max = deep;
15840
- panel.elements.forEach(el => {
15841
- if (el.isPanel) {
15842
- const pDeep = this.getMaximumNestedPanelCount(el, deep + 1);
15843
- if (pDeep > max) {
15844
- max = pDeep;
15845
- }
15846
- }
15847
- });
15848
- return max;
15849
- }
15850
- shouldRestricDragQuestionBetweenPages(dropTarget) {
15851
- const oldPage = this.draggedElement["page"];
15852
- const newPage = dropTarget.isPage ? dropTarget : dropTarget["page"];
15853
- // if oldPage === null then it is drop from the toolbox
15854
- return oldPage && oldPage !== newPage;
15855
- }
15856
- findDeepestDropTargetChild(parent) {
15857
- const selector = this.dropTargetDataAttributeName;
15858
- let result = parent;
15859
- while (!!parent) {
15860
- result = parent;
15861
- parent = parent.querySelector(selector);
15862
- }
15863
- return result;
15864
- }
15865
- isAllowDragOver(dropTarget, dragOverLocation) {
15866
- if (!this.survey || this.survey.onDragDropAllow.isEmpty)
15867
- return true;
15868
- const allowOptions = {
15869
- allow: true,
15870
- parent: this.parentElement,
15871
- source: this.draggedElement,
15872
- toElement: dropTarget,
15873
- draggedElement: this.draggedElement,
15874
- fromElement: this.draggedElement.parent,
15875
- target: dropTarget,
15876
- insertAfter: undefined,
15877
- insertBefore: undefined,
15878
- allowDropNextToAnother: true
15879
- };
15880
- if (dragOverLocation === DragTypeOverMeEnum.Bottom || dragOverLocation === DragTypeOverMeEnum.Right) {
15881
- allowOptions.insertAfter = dropTarget;
15882
- }
15883
- if (dragOverLocation === DragTypeOverMeEnum.Top || dragOverLocation === DragTypeOverMeEnum.Left) {
15884
- allowOptions.insertBefore = dropTarget;
15885
- }
15886
- this.survey.onDragDropAllow.fire(this.survey, allowOptions);
15887
- if (!allowOptions.allowDropNextToAnother) {
15888
- if (dragOverLocation === DragTypeOverMeEnum.Left) {
15889
- this.dragOverLocation = DragTypeOverMeEnum.Top;
15890
- }
15891
- if (dragOverLocation === DragTypeOverMeEnum.Right) {
15892
- this.dragOverLocation = DragTypeOverMeEnum.Bottom;
15893
- }
15894
- }
15895
- return allowOptions.allow;
15896
- }
15897
- dragOverCore(dropTarget, dragOverLocation) {
15898
- const oldDragOverIndicatorElement = this.dragOverIndicatorElement;
15899
- const oldDropTarget = this.dropTarget;
15900
- if (this.isSameElement(dropTarget)) {
15901
- this.allowDropHere = false;
15902
- return;
15903
- }
15904
- this.dropTarget = dropTarget;
15905
- this.dragOverLocation = dragOverLocation;
15906
- this.parentElement = this.dropTarget.isPage
15907
- ? this.dropTarget
15908
- : (this.dropTarget.page || this.dropTarget.__page);
15909
- if (!this.isAllowDragOver(dropTarget, dragOverLocation)) {
15910
- this.allowDropHere = false;
15911
- return;
15912
- }
15913
- if (dragOverLocation == DragTypeOverMeEnum.InsideEmptyPanel) {
15914
- this.dragOverIndicatorElement = this.dropTarget;
15915
- this.dragOverIndicatorElement.dragTypeOverMe = DragTypeOverMeEnum.InsideEmptyPanel;
15916
- }
15917
- else {
15918
- const row = this.parentElement.dragDropFindRow(this.dropTarget);
15919
- if (!!row && row.elements.length > 1 && (this.dragOverLocation === DragTypeOverMeEnum.Top || this.dragOverLocation === DragTypeOverMeEnum.Bottom)) {
15920
- row.dragTypeOverMe = this.dragOverLocation;
15921
- this.dragOverIndicatorElement = row;
15922
- }
15923
- else {
15924
- this.dropTarget.dragTypeOverMe = this.dragOverLocation;
15925
- this.dragOverIndicatorElement = this.dropTarget;
15926
- }
15927
- }
15928
- if (this.dragOverIndicatorElement != oldDragOverIndicatorElement)
15929
- this.removeDragOverMarker(oldDragOverIndicatorElement);
15930
- if (this.dropTarget != oldDropTarget)
15931
- this.removeDragOverMarker(oldDropTarget);
15932
- }
15933
- isSameElement(target) {
15934
- while (!!target) {
15935
- if (target === this.draggedElement)
15936
- return true;
15937
- target = target.parent;
15938
- }
15939
- return false;
15940
- }
15941
- isDragInsideItself(dragOverNodes) {
15942
- let result = false;
15943
- dragOverNodes.forEach((node) => {
15944
- if (node.classList.contains("svc-question__content--dragged")) {
15945
- result = true;
15946
- }
15947
- });
15948
- return result;
15949
- }
15950
- dragOver(event) {
15951
- const dropTargetNode = this.findDropTargetNodeFromPoint(event.clientX, event.clientY);
15952
- if (!dropTargetNode) {
15953
- this.banDropHere();
15954
- return;
15955
- }
15956
- if (document && document.elementsFromPoint && this.isDragInsideItself(document.elementsFromPoint(event.clientX, event.clientY))) {
15957
- this.banDropHere();
15958
- return null;
15959
- }
15960
- const oldInsideContainer = this.insideContainer;
15961
- this.insideContainer = !calculateIsEdge(dropTargetNode, event.clientY) && !calculateIsSide(dropTargetNode, event.clientX);
15962
- const dropTarget = this.getDropTargetByNode(dropTargetNode, event);
15963
- if (!!oldInsideContainer != !!this.insideContainer)
15964
- dropTarget.dragTypeOverMe = null;
15965
- const dropTargetRect = dropTargetNode.getBoundingClientRect();
15966
- const calcDirection = !settings.dragDrop.allowDragToTheSameLine || (!!this.draggedElement && this.draggedElement.isPage) ? "top-bottom" : null;
15967
- let dragOverLocation = calculateDragOverLocation(event.clientX, event.clientY, dropTargetRect, calcDirection);
15968
- if (!this.draggedElement.isPage && dropTarget && ((dropTarget.isPanel || dropTarget.isPage) && dropTarget.elements.length === 0 || isPanelDynamic(dropTarget) && dropTarget.template.elements.length == 0)) {
15969
- if (dropTarget.isPage || this.insideContainer) {
15970
- dragOverLocation = DragTypeOverMeEnum.InsideEmptyPanel;
15971
- }
15972
- }
15973
- const options = {
15974
- survey: this.survey,
15975
- draggedSurveyElement: this.draggedElement,
15976
- dragOverSurveyElement: dropTarget,
15977
- clientX: event.clientX,
15978
- clientY: event.clientY,
15979
- dragOverRect: dropTargetRect,
15980
- insideContainer: this.insideContainer,
15981
- dragOverLocation
15982
- };
15983
- if (this.onDragOverLocationCalculating) {
15984
- this.onDragOverLocationCalculating(options);
15985
- dragOverLocation = options.dragOverLocation;
15986
- this.insideContainer = options.insideContainer;
15987
- }
15988
- const isDropTargetValid = this.isDropTargetValid(dropTarget, dropTargetNode, dragOverLocation);
15989
- if (!isDropTargetValid) {
15990
- this.banDropHere();
15991
- return;
15992
- }
15993
- this.allowDropHere = true;
15994
- this.dragOverCore(dropTarget, dragOverLocation);
15995
- }
15996
- onStartDrag() {
15997
- // this.ghostSurveyElement = this.createGhostSurveyElement();
15998
- this.draggedElement.isDragMe = true;
15999
- }
16000
- moveElementInPanel(panel, src, target, targetIndex) {
16001
- var srcIndex = src.parent.elements.indexOf(src);
16002
- if (targetIndex > srcIndex) {
16003
- targetIndex--;
16004
- }
16005
- if (src === target && srcIndex === targetIndex) {
16006
- return;
16007
- }
16008
- panel.removeElement(src);
16009
- panel.addElement(target, targetIndex);
16010
- }
16011
- removeDragOverMarker(dropTarget) {
16012
- if (!!dropTarget) {
16013
- dropTarget.dragTypeOverMe = null;
16014
- }
16015
- }
16016
- clear() {
16017
- this.insideContainer = null;
16018
- this.removeDragOverMarker(this.prevDropTarget);
16019
- this.removeDragOverMarker(this.dropTarget);
16020
- this.removeDragOverMarker(this.dragOverIndicatorElement);
16021
- if (!!this.draggedElement) {
16022
- this.draggedElement.isDragMe = false;
16023
- }
16024
- super.clear();
16025
- }
16026
- getTargetParent(dropTarget) {
16027
- let targetParent = dropTarget.isPage || dropTarget.isPanel ? dropTarget : dropTarget.parent;
16028
- if (dropTarget.getType() === "paneldynamic") {
16029
- targetParent = dropTarget.templateValue;
16030
- }
16031
- return targetParent;
16032
- }
16033
- getTargetRow(dropTarget) {
16034
- const targetParent = this.getTargetParent(dropTarget);
16035
- let targetRow;
16036
- targetParent.rows.forEach((row) => {
16037
- if (row.elements.indexOf(dropTarget) !== -1) {
16038
- targetRow = row;
16039
- }
16040
- });
16041
- return targetRow;
16042
- }
16043
- }
16044
- DragDropSurveyElements.newGhostPage = null;
16045
- DragDropSurveyElements.restrictDragQuestionBetweenPages = false;
16046
- DragDropSurveyElements.edgeHeight = 30;
16047
- DragDropSurveyElements.nestedPanelDepth = -1;
16048
- DragDropSurveyElements.ghostSurveyElementName = "sv-drag-drop-ghost-survey-element-name"; // before renaming use globa search (we have also css selectors)
16049
-
16050
15539
  class SurveyElementActionContainer extends AdaptiveActionContainer {
16051
15540
  needToShrink(item, shrinkTypeConverterAction) {
16052
15541
  return (item.innerItem.location == "start" && shrinkTypeConverterAction || item.innerItem.location != "start");
@@ -16104,498 +15593,26 @@ class SurveyElementActionContainer extends AdaptiveActionContainer {
16104
15593
  this.setModeForActions(true);
16105
15594
  return;
16106
15595
  }
16107
- this.visibleActions.forEach((item) => {
16108
- if (item.id == "convertTo") {
16109
- item.mode = "small";
16110
- return;
16111
- }
16112
- if (item.id == "convertInputType") {
16113
- item.mode = "removed";
16114
- return;
16115
- }
16116
- item.mode = "popup";
16117
- });
16118
- this.dotsItem.visible = true;
16119
- this.hiddenItemsListModel.setItems(items.filter(i => i.mode == "popup").map(i => i.innerItem));
16120
- }
16121
- }
16122
- class SurveyElementAdornerBase extends Base {
16123
- get dragInsideCollapsedContainer() {
16124
- return this.collapsed && this.creator.dragDropSurveyElements.insideContainer;
16125
- }
16126
- getAnimatedElement() {
16127
- return null;
16128
- }
16129
- getInnerAnimatedElements() {
16130
- return [];
16131
- }
16132
- getCollapsingCssClassName() {
16133
- return "svc-question--leave";
16134
- }
16135
- getExpandingCssClassName() {
16136
- return "svc-question--enter";
16137
- }
16138
- get hoverDelay() {
16139
- return this.creator.pageHoverDelay;
16140
- }
16141
- hover(e, element) {
16142
- const processedFlagName = "__svc_question_processed";
16143
- if (!e[processedFlagName] && e.type === "mouseover") {
16144
- if (!this.hoverTimeout) {
16145
- this.hoverTimeout = setTimeout(() => {
16146
- this.isHovered = true;
16147
- this.hoverTimeout = undefined;
16148
- }, this.hoverDelay);
16149
- }
16150
- e[processedFlagName] = true;
16151
- }
16152
- else {
16153
- clearTimeout(this.hoverTimeout);
16154
- this.hoverTimeout = undefined;
16155
- this.isHovered = false;
16156
- }
16157
- }
16158
- getExpandCollapseAnimationOptions() {
16159
- const beforeRunAnimation = (el, animatingClassName) => {
16160
- prepareElementForVerticalAnimation(el);
16161
- const innerAnimatedElements = this.getInnerAnimatedElements();
16162
- innerAnimatedElements.forEach((elem) => {
16163
- prepareElementForVerticalAnimation(elem);
16164
- });
16165
- innerAnimatedElements.forEach((elem) => {
16166
- elem.classList.add(animatingClassName);
15596
+ if (this.visibleActions.length > 1) {
15597
+ this.visibleActions.forEach((item) => {
15598
+ if (item.id == "convertTo") {
15599
+ item.mode = "small";
15600
+ return;
15601
+ }
15602
+ if (item.id == "convertInputType") {
15603
+ item.mode = "removed";
15604
+ return;
15605
+ }
15606
+ item.mode = "popup";
16167
15607
  });
16168
- };
16169
- const afterRunAnimation = (el, animatingClassName) => {
16170
- this.expandCollapseAnimationRunning = false;
16171
- if (this.surveyElement) {
16172
- cleanHtmlElementAfterAnimation(el);
16173
- const innerAnimatedElements = this.getInnerAnimatedElements();
16174
- innerAnimatedElements.forEach((elem) => {
16175
- cleanHtmlElementAfterAnimation(elem);
16176
- });
16177
- innerAnimatedElements.forEach((elem) => {
16178
- elem.classList.remove(animatingClassName);
16179
- });
16180
- }
16181
- };
16182
- return {
16183
- getRerenderEvent: () => this.onElementRerendered,
16184
- getEnterOptions: () => {
16185
- const className = this.getExpandingCssClassName();
16186
- return {
16187
- cssClass: className,
16188
- onBeforeRunAnimation: (el) => {
16189
- beforeRunAnimation(el, className);
16190
- },
16191
- onAfterRunAnimation: (el) => {
16192
- afterRunAnimation(el, className);
16193
- },
16194
- };
16195
- },
16196
- getLeaveOptions: () => {
16197
- const className = this.getCollapsingCssClassName();
16198
- return {
16199
- cssClass: className,
16200
- onBeforeRunAnimation: (el) => {
16201
- beforeRunAnimation(el, className);
16202
- },
16203
- onAfterRunAnimation: (el) => {
16204
- afterRunAnimation(el, className);
16205
- },
16206
- };
16207
- },
16208
- getAnimatedElement: () => this.getAnimatedElement(),
16209
- isAnimationEnabled: () => this.animationAllowed
16210
- };
16211
- }
16212
- set renderedCollapsed(val) {
16213
- if (this.animationAllowed && val !== this.renderedCollapsed)
16214
- this.expandCollapseAnimationRunning = true;
16215
- this.animationCollapsed.sync(!val);
16216
- }
16217
- get renderedCollapsed() {
16218
- return !!this._renderedCollapsed;
16219
- }
16220
- createTopActionContainer() {
16221
- const actionContainer = new ActionContainer();
16222
- actionContainer.sizeMode = "small";
16223
- if (this.creator.expandCollapseButtonVisibility != "never") {
16224
- actionContainer.setItems([this.expandCollapseAction]);
16225
- actionContainer.cssClasses = {
16226
- root: "svc-survey-element-top-toolbar sv-action-bar",
16227
- item: "svc-survey-element-top-toolbar__item",
16228
- itemIcon: "svc-survey-element-toolbar-item__icon",
16229
- itemTitle: "svc-survey-element-toolbar-item__title",
16230
- itemTitleWithIcon: "svc-survey-element-toolbar-item__title--with-icon",
16231
- };
16232
- }
16233
- return actionContainer;
16234
- }
16235
- createActionContainer() {
16236
- const actionContainer = new SurveyElementActionContainer();
16237
- actionContainer.dotsItem.popupModel.horizontalPosition = "center";
16238
- return actionContainer;
16239
- }
16240
- get canExpandOnDrag() {
16241
- return this.surveyElement.isPanel || this.surveyElement.isPage || isPanelDynamic(this.surveyElement);
16242
- }
16243
- dragIn() {
16244
- if (!this.draggedIn) {
16245
- if (this.canExpandOnDrag && this.collapsed) {
16246
- this.draggedIn = true;
16247
- this.dragCollapsedTimer = setTimeout(() => {
16248
- this.expandWithDragIn();
16249
- }, this.creator.expandOnDragTimeOut);
16250
- }
16251
- }
16252
- }
16253
- expandWithDragIn() {
16254
- this.collapsed = false;
16255
- this.dragCollapsedTimer = undefined;
16256
- }
16257
- dragOut() {
16258
- if (this.draggedIn) {
16259
- clearTimeout(this.dragCollapsedTimer);
16260
- this.draggedIn = false;
16261
- }
16262
- }
16263
- allowExpandCollapseByDblClick(element) {
16264
- return true;
16265
- }
16266
- dblclick(event) {
16267
- if (this.allowExpandCollapseByDblClick(event.target)) {
16268
- if (this.allowExpandCollapse)
16269
- this.collapsed = !this.collapsed;
16270
- }
16271
- event.stopPropagation();
16272
- }
16273
- get element() {
16274
- return this.surveyElement;
16275
- }
16276
- constructor(creator, surveyElement) {
16277
- super();
16278
- this.creator = creator;
16279
- this.animationCollapsed = new AnimationBoolean(this.getExpandCollapseAnimationOptions(), (val) => {
16280
- this._renderedCollapsed = !val;
16281
- }, () => !this.renderedCollapsed);
16282
- this.draggedIn = false;
16283
- this.sidebarFlyoutModeChangedFunc = (_, options) => {
16284
- if (options.name === "flyoutMode") {
16285
- this.updateActionsProperties();
16286
- }
16287
- };
16288
- this.creatorOnLocaleChanged = (_, options) => {
16289
- if (this.surveyElement) {
16290
- this.updateActionsContainer(this.surveyElement);
16291
- this.updateActionsProperties();
16292
- }
16293
- };
16294
- this.actionVisibilityCache = {};
16295
- this.expandCollapseAction = this.getExpandCollapseAction();
16296
- this.attachToUI(surveyElement);
16297
- }
16298
- get isActionContainerCreated() {
16299
- return !!this.actionContainerValue;
16300
- }
16301
- get actionContainer() {
16302
- if (!this.actionContainerValue) {
16303
- this.actionContainerValue = this.createActionContainer();
16304
- if (this.surveyElement) {
16305
- this.updateActionsContainer(this.surveyElement);
16306
- this.updateActionsVisibility(false);
16307
- }
16308
- }
16309
- return this.actionContainerValue;
16310
- }
16311
- get topActionContainer() {
16312
- if (!this.topActionContainerValue) {
16313
- this.topActionContainerValue = this.createTopActionContainer();
16314
- if (this.surveyElement) {
16315
- this.updateActionsVisibility(true);
16316
- }
16317
- }
16318
- return this.topActionContainerValue;
16319
- }
16320
- static GetAdorner(surveyElement) {
16321
- return surveyElement.getPropertyValue(SurveyElementAdornerBase.AdornerValueName);
16322
- }
16323
- static RestoreStateFor(surveyElement) {
16324
- const adorner = SurveyElementAdornerBase.GetAdorner(surveyElement);
16325
- if (!!adorner) {
16326
- adorner.restoreState();
16327
- }
16328
- }
16329
- restoreState() {
16330
- var _a;
16331
- if (!!this.surveyElement) {
16332
- const state = (_a = this.creator.designerStateManager) === null || _a === void 0 ? void 0 : _a.getElementState(this.surveyElement);
16333
- this.collapsed = state.collapsed;
16334
- }
16335
- if (!this.surveyElement || this.surveyElement.isInteractiveDesignElement) {
16336
- this.needToRenderContent = !this.collapsed;
16337
- }
16338
- }
16339
- detachElement(surveyElement) {
16340
- if (surveyElement) {
16341
- surveyElement.setPropertyValue(SurveyElementAdornerBase.AdornerValueName, null);
16342
- surveyElement.unRegisterFunctionOnPropertyValueChanged("isSelectedInDesigner", "questionSelected");
16343
- this.cleanActionsContainer();
16344
- }
16345
- }
16346
- attachElement(surveyElement) {
16347
- var _a, _b;
16348
- if (surveyElement) {
16349
- (_b = (_a = this.creator) === null || _a === void 0 ? void 0 : _a.designerStateManager) === null || _b === void 0 ? void 0 : _b.initForElement(surveyElement);
16350
- surveyElement.registerFunctionOnPropertyValueChanged("isSelectedInDesigner", (newValue) => {
16351
- this.onElementSelectedChanged(newValue);
16352
- }, "questionSelected");
16353
- this.restoreState();
16354
- this.updateActionsContainer(surveyElement);
16355
- this.updateActionsProperties();
16356
- surveyElement.setPropertyValue(SurveyElementAdornerBase.AdornerValueName, this);
16357
- }
16358
- }
16359
- setSurveyElement(surveyElement) {
16360
- this.detachOnlyMyElement();
16361
- this.surveyElement = surveyElement;
16362
- this.attachElement(this.surveyElement);
16363
- }
16364
- checkActionProperties() {
16365
- if (this.creator.isElementSelected(this.surveyElement)) {
16366
- this.updateActionsProperties();
16367
- }
16368
- }
16369
- attachToUI(surveyElement, rootElement) {
16370
- if (!!rootElement) {
16371
- this.rootElement = rootElement;
16372
- }
16373
- if (this.surveyElement != surveyElement) {
16374
- this.setSurveyElement(surveyElement);
16375
- this.creator.onLocaleChanded.add(this.creatorOnLocaleChanged);
16376
- this.creator.sidebar.onPropertyChanged.add(this.sidebarFlyoutModeChangedFunc);
16377
- this.creator.expandCollapseManager.add(this);
16378
- }
16379
- }
16380
- detachOnlyMyElement() {
16381
- if (this.surveyElement && this.surveyElement.getPropertyValue(SurveyElementAdornerBase.AdornerValueName) === this && !this.surveyElement.isDisposed) {
16382
- this.detachElement(this.surveyElement);
16383
- }
16384
- }
16385
- detachFromUI() {
16386
- this.rootElement = undefined;
16387
- this.detachOnlyMyElement();
16388
- this.surveyElement = undefined;
16389
- this.creator.onLocaleChanded.remove(this.creatorOnLocaleChanged);
16390
- this.creator.sidebar.onPropertyChanged.remove(this.sidebarFlyoutModeChangedFunc);
16391
- this.creator.expandCollapseManager.remove(this);
16392
- }
16393
- dispose() {
16394
- this.detachFromUI();
16395
- this.disposeActions(this.actionContainerValue);
16396
- this.disposeActions(this.topActionContainerValue);
16397
- super.dispose();
16398
- this.sidebarFlyoutModeChangedFunc = undefined;
16399
- this.animationCollapsed = undefined;
16400
- }
16401
- disposeActions(container) {
16402
- if (!!container && !container.isDisposed) {
16403
- container.dispose();
16404
- }
16405
- }
16406
- onElementSelectedChanged(isSelected) {
16407
- if (!isSelected)
16408
- return;
16409
- this.updateActionsProperties();
16410
- }
16411
- getExpandCollapseAction() {
16412
- const collapseIcon = "icon-collapsepanel-16x16";
16413
- const expandIcon = "icon-expandpanel-16x16";
16414
- return {
16415
- id: "collapse",
16416
- css: "sv-action-bar-item--collapse",
16417
- locTooltipName: new ComputedUpdater(() => this.collapsed ? "ed.expandTooltip" : "ed.collapseTooltip"),
16418
- iconName: new ComputedUpdater(() => this.collapsed ? expandIcon : collapseIcon),
16419
- iconSize: "auto",
16420
- action: () => {
16421
- this.collapsed = !this.collapsed;
16422
- }
16423
- };
16424
- }
16425
- cleanActionsContainer() {
16426
- const container = this.actionContainerValue;
16427
- if (!container)
16428
- return;
16429
- const actions = container.actions;
16430
- container.setItems([]);
16431
- actions.forEach(action => action.dispose && action.dispose());
16432
- }
16433
- updateActionsContainer(surveyElement) {
16434
- if (!this.actionContainerValue)
16435
- return;
16436
- const actions = [];
16437
- this.buildActions(actions);
16438
- this.creator.onElementMenuItemsChanged(surveyElement, actions);
16439
- this.actionContainerValue.setItems(actions);
16440
- }
16441
- updateActionsProperties() {
16442
- if (this.isDisposed)
16443
- return;
16444
- this.updateActionsPropertiesCore();
16445
- }
16446
- updateActionsPropertiesCore() {
16447
- this.updateElementAllowOptions(this.creator.getElementAllowOperations(this.surveyElement), this.isOperationsAllow());
16448
- }
16449
- getAllowDragging(options) {
16450
- return options.allowDragging;
16451
- }
16452
- getAllowExpandCollapse(options) {
16453
- return this.creator.expandCollapseButtonVisibility != "never" && (options.allowExpandCollapse == undefined || !!options.allowExpandCollapse);
16454
- }
16455
- updateElementAllowOptions(options, operationsAllow) {
16456
- this.allowDragging = operationsAllow && this.getAllowDragging(options);
16457
- this.allowExpandCollapse = this.getAllowExpandCollapse(options);
16458
- this.allowEditOption = (options.allowEdit == undefined || !!options.allowEdit);
16459
- this.updateActionVisibility("delete", operationsAllow && options.allowDelete);
16460
- this.updateActionVisibility("duplicate", operationsAllow && options.allowCopy);
16461
- this.updateActionVisibility("collapse", this.allowExpandCollapse);
16462
- if (options.allowShowSettings === undefined) {
16463
- const settingsVisibility = (options.allowEdit !== undefined) ? (operationsAllow && options.allowEdit) : this.creator.sidebar.flyoutMode;
16464
- this.updateActionVisibility("settings", settingsVisibility);
15608
+ this.dotsItem.visible = true;
16465
15609
  }
16466
15610
  else {
16467
- this.updateActionVisibility("settings", options.allowShowSettings);
15611
+ this.visibleActions.forEach(i => i.mode = "small");
16468
15612
  }
16469
- this.setShowAddQuestionButton(options.allowEdit !== false);
16470
- }
16471
- isOperationsAllow() {
16472
- return !this.creator.readOnly;
16473
- }
16474
- updateActionVisibility(id, isVisible) {
16475
- var _a, _b;
16476
- var action = ((_a = this.actionContainerValue) === null || _a === void 0 ? void 0 : _a.getActionById(id)) || ((_b = this.topActionContainerValue) === null || _b === void 0 ? void 0 : _b.getActionById(id));
16477
- if (!action) {
16478
- this.actionVisibilityCache[id] = isVisible;
16479
- }
16480
- else {
16481
- if (action.visible !== isVisible) {
16482
- action.visible = isVisible;
16483
- }
16484
- }
16485
- }
16486
- updateActionsVisibility(isTop) {
16487
- for (var key in this.actionVisibilityCache) {
16488
- this.updateActionVisibility(key, this.actionVisibilityCache[key]);
16489
- }
16490
- }
16491
- getActionById(id) {
16492
- return this.actionContainer.getActionById(id) || this.topActionContainer.getActionById(id);
16493
- }
16494
- buildActions(items) {
16495
- items.push(new Action({
16496
- id: "duplicate",
16497
- iconName: "icon-duplicate_16x16",
16498
- css: "svc-action-bar-item--right",
16499
- title: this.creator.getLocString("survey.duplicate"),
16500
- visibleIndex: 10,
16501
- iconSize: "auto",
16502
- action: () => this.duplicate(),
16503
- onFocus: (isMouse, event) => this.disableActionFocusing(isMouse, event)
16504
- }));
16505
- items.push(new Action({
16506
- id: "settings",
16507
- iconName: "icon-settings_16x16",
16508
- css: "svc-action-bar-item--right",
16509
- title: this.creator.getLocString("ed.settings"),
16510
- locTooltipName: "ed.settingsTooltip",
16511
- visibleIndex: 20,
16512
- iconSize: "auto",
16513
- action: () => {
16514
- this.creator.setShowSidebar(true, true);
16515
- if (!this.creator.isMobileView) {
16516
- this.creator.sidebar.executeOnExpand(() => {
16517
- this.creator.propertyGrid.getAllQuestions()[0].focus();
16518
- });
16519
- }
16520
- }
16521
- }));
16522
- items.push(new Action({
16523
- id: "delete",
16524
- iconName: "icon-delete_16x16",
16525
- css: "svc-action-bar-item--right",
16526
- //needSeparator: items.length > 0,
16527
- title: this.creator.getLocString("pe.delete"),
16528
- visibleIndex: 30,
16529
- iconSize: "auto",
16530
- action: () => {
16531
- this.delete();
16532
- },
16533
- onFocus: (isMouse, event) => this.disableActionFocusing(isMouse, event)
16534
- }));
16535
- }
16536
- disableActionFocusing(isMouse, event) {
16537
- this.isDisableSelecting = isMouse;
16538
- }
16539
- canSelectElement() {
16540
- const res = !this.isDisableSelecting;
16541
- this.isDisableSelecting = false;
16542
- return res;
16543
- }
16544
- get allowEdit() {
16545
- return !!this.creator && !this.creator.readOnly && this.allowEditOption;
16546
- }
16547
- get showAddQuestionButton() {
16548
- return this.getPropertyValue("showAddQuestionButton");
16549
- }
16550
- setShowAddQuestionButton(val) {
16551
- this.setPropertyValue("showAddQuestionButton", val && this.allowEdit && !!this.creator && this.creator.showAddQuestionButton);
16552
- }
16553
- duplicate() { }
16554
- delete() {
16555
- this.creator.deleteElement(this.surveyElement);
16556
- }
16557
- getCss() {
16558
- return new CssClassBuilder().append("svc-hovered svc-hovered-ready", this.isHovered).toString();
15613
+ this.hiddenItemsListModel.setItems(items.filter(i => i.mode == "popup").map(i => i.innerItem));
16559
15614
  }
16560
15615
  }
16561
- SurveyElementAdornerBase.AdornerValueName = "__sjs_creator_adorner";
16562
- __decorate([
16563
- property({ defaultValue: true })
16564
- ], SurveyElementAdornerBase.prototype, "allowDragging", void 0);
16565
- __decorate([
16566
- property({ defaultValue: false })
16567
- ], SurveyElementAdornerBase.prototype, "expandCollapseAnimationRunning", void 0);
16568
- __decorate([
16569
- property({ defaultValue: true })
16570
- ], SurveyElementAdornerBase.prototype, "needToRenderContent", void 0);
16571
- __decorate([
16572
- property({ defaultValue: true })
16573
- ], SurveyElementAdornerBase.prototype, "allowExpandCollapse", void 0);
16574
- __decorate([
16575
- property({
16576
- onSet: (val, target) => {
16577
- target.renderedCollapsed = val;
16578
- if (!val)
16579
- target.needToRenderContent = true;
16580
- if (target.creator.designerStateManager && !target.creator.designerStateManager.isSuspended && target.surveyElement) {
16581
- target.creator.designerStateManager.getElementState(target.surveyElement).collapsed = val;
16582
- }
16583
- setTimeout(() => {
16584
- target.creator.survey.pages.forEach(p => p.ensureRowsVisibility());
16585
- target.creator.survey.getAllPanels().forEach(p => p.ensureRowsVisibility());
16586
- }, 50);
16587
- }
16588
- })
16589
- ], SurveyElementAdornerBase.prototype, "collapsed", void 0);
16590
- __decorate([
16591
- property()
16592
- ], SurveyElementAdornerBase.prototype, "_renderedCollapsed", void 0);
16593
- __decorate([
16594
- property()
16595
- ], SurveyElementAdornerBase.prototype, "isAnimationRunningCollapsed", void 0);
16596
- __decorate([
16597
- property({ defaultValue: false })
16598
- ], SurveyElementAdornerBase.prototype, "isHovered", void 0);
16599
15616
 
16600
15617
  let isLocaleEnableIfExecuting;
16601
15618
  function localeEnableIf(params) {
@@ -22049,7 +21066,9 @@ class PropertyGridViewModel extends Base {
22049
21066
  let titleName = this.getTitle();
22050
21067
  this.selectedElementName = titleName;
22051
21068
  this.objectSelectionAction.tooltip = titleName;
22052
- this.objectSelectionAction.title = this.propertyGridModel.showOneCategoryInPropertyGrid ? "" : titleName;
21069
+ if (!this.propertyGridModel.showOneCategoryInPropertyGrid) {
21070
+ this.objectSelectionAction.title = titleName;
21071
+ }
22053
21072
  }
22054
21073
  getTitle() {
22055
21074
  var obj = this.getSelectedObj();
@@ -22217,6 +21236,1074 @@ __decorate([
22217
21236
  property()
22218
21237
  ], PagesController.prototype, "page2Display", void 0);
22219
21238
 
21239
+ class SurveyElementAdornerBase extends Base {
21240
+ getAnimatedElement() {
21241
+ return null;
21242
+ }
21243
+ getInnerAnimatedElements() {
21244
+ return [];
21245
+ }
21246
+ getCollapsingCssClassName() {
21247
+ return "svc-question--leave";
21248
+ }
21249
+ getExpandingCssClassName() {
21250
+ return "svc-question--enter";
21251
+ }
21252
+ get hoverDelay() {
21253
+ return this.creator.pageHoverDelay;
21254
+ }
21255
+ hover(e, element) {
21256
+ const processedFlagName = "__svc_question_processed";
21257
+ if (!e[processedFlagName] && e.type === "mouseover") {
21258
+ if (!this.hoverTimeout) {
21259
+ this.hoverTimeout = setTimeout(() => {
21260
+ this.isHovered = true;
21261
+ this.hoverTimeout = undefined;
21262
+ }, this.hoverDelay);
21263
+ }
21264
+ e[processedFlagName] = true;
21265
+ }
21266
+ else {
21267
+ clearTimeout(this.hoverTimeout);
21268
+ this.hoverTimeout = undefined;
21269
+ this.isHovered = false;
21270
+ }
21271
+ }
21272
+ getExpandCollapseAnimationOptions() {
21273
+ const beforeRunAnimation = (el, animatingClassName) => {
21274
+ prepareElementForVerticalAnimation(el);
21275
+ const innerAnimatedElements = this.getInnerAnimatedElements();
21276
+ innerAnimatedElements.forEach((elem) => {
21277
+ prepareElementForVerticalAnimation(elem);
21278
+ });
21279
+ innerAnimatedElements.forEach((elem) => {
21280
+ elem.classList.add(animatingClassName);
21281
+ });
21282
+ };
21283
+ const afterRunAnimation = (el, animatingClassName) => {
21284
+ this.expandCollapseAnimationRunning = false;
21285
+ if (this.surveyElement) {
21286
+ cleanHtmlElementAfterAnimation(el);
21287
+ const innerAnimatedElements = this.getInnerAnimatedElements();
21288
+ innerAnimatedElements.forEach((elem) => {
21289
+ cleanHtmlElementAfterAnimation(elem);
21290
+ });
21291
+ innerAnimatedElements.forEach((elem) => {
21292
+ elem.classList.remove(animatingClassName);
21293
+ });
21294
+ }
21295
+ };
21296
+ return {
21297
+ getRerenderEvent: () => this.onElementRerendered,
21298
+ getEnterOptions: () => {
21299
+ const className = this.getExpandingCssClassName();
21300
+ return {
21301
+ cssClass: className,
21302
+ onBeforeRunAnimation: (el) => {
21303
+ beforeRunAnimation(el, className);
21304
+ },
21305
+ onAfterRunAnimation: (el) => {
21306
+ afterRunAnimation(el, className);
21307
+ },
21308
+ };
21309
+ },
21310
+ getLeaveOptions: () => {
21311
+ const className = this.getCollapsingCssClassName();
21312
+ return {
21313
+ cssClass: className,
21314
+ onBeforeRunAnimation: (el) => {
21315
+ beforeRunAnimation(el, className);
21316
+ },
21317
+ onAfterRunAnimation: (el) => {
21318
+ afterRunAnimation(el, className);
21319
+ },
21320
+ };
21321
+ },
21322
+ getAnimatedElement: () => this.getAnimatedElement(),
21323
+ isAnimationEnabled: () => this.animationAllowed
21324
+ };
21325
+ }
21326
+ set renderedCollapsed(val) {
21327
+ if (this.animationAllowed && val !== this.renderedCollapsed)
21328
+ this.expandCollapseAnimationRunning = true;
21329
+ this.animationCollapsed.sync(!val);
21330
+ }
21331
+ get renderedCollapsed() {
21332
+ return !!this._renderedCollapsed;
21333
+ }
21334
+ createTopActionContainer() {
21335
+ const actionContainer = new ActionContainer();
21336
+ actionContainer.sizeMode = "small";
21337
+ if (this.creator.expandCollapseButtonVisibility != "never") {
21338
+ actionContainer.setItems([this.expandCollapseAction]);
21339
+ actionContainer.cssClasses = {
21340
+ root: "svc-survey-element-top-toolbar sv-action-bar",
21341
+ item: "svc-survey-element-top-toolbar__item",
21342
+ itemIcon: "svc-survey-element-toolbar-item__icon",
21343
+ itemTitle: "svc-survey-element-toolbar-item__title",
21344
+ itemTitleWithIcon: "svc-survey-element-toolbar-item__title--with-icon",
21345
+ };
21346
+ }
21347
+ return actionContainer;
21348
+ }
21349
+ createActionContainer() {
21350
+ const actionContainer = new SurveyElementActionContainer();
21351
+ actionContainer.dotsItem.popupModel.horizontalPosition = "center";
21352
+ return actionContainer;
21353
+ }
21354
+ get canExpandOnDrag() {
21355
+ return this.surveyElement.isPanel || this.surveyElement.isPage || this.surveyElement instanceof QuestionPanelDynamicModel;
21356
+ }
21357
+ dragIn() {
21358
+ if (!this.draggedIn) {
21359
+ if (this.canExpandOnDrag && this.collapsed) {
21360
+ this.draggedIn = true;
21361
+ this.dragCollapsedTimer = setTimeout(() => {
21362
+ this.expandWithDragIn();
21363
+ }, this.creator.expandOnDragTimeOut);
21364
+ }
21365
+ }
21366
+ }
21367
+ expandWithDragIn() {
21368
+ this.collapsed = false;
21369
+ this.dragCollapsedTimer = undefined;
21370
+ }
21371
+ dragOut() {
21372
+ if (this.draggedIn) {
21373
+ clearTimeout(this.dragCollapsedTimer);
21374
+ this.draggedIn = false;
21375
+ }
21376
+ }
21377
+ allowExpandCollapseByDblClick(element) {
21378
+ return true;
21379
+ }
21380
+ dblclick(event) {
21381
+ if (this.allowExpandCollapseByDblClick(event.target)) {
21382
+ if (this.allowExpandCollapse)
21383
+ this.collapsed = !this.collapsed;
21384
+ }
21385
+ event.stopPropagation();
21386
+ }
21387
+ get element() {
21388
+ return this.surveyElement;
21389
+ }
21390
+ constructor(creator, surveyElement) {
21391
+ super();
21392
+ this.creator = creator;
21393
+ this.animationCollapsed = new AnimationBoolean(this.getExpandCollapseAnimationOptions(), (val) => {
21394
+ this._renderedCollapsed = !val;
21395
+ }, () => !this.renderedCollapsed);
21396
+ this.draggedIn = false;
21397
+ this.sidebarFlyoutModeChangedFunc = (_, options) => {
21398
+ if (options.name === "flyoutMode") {
21399
+ this.updateActionsProperties();
21400
+ }
21401
+ };
21402
+ this.creatorOnLocaleChanged = (_, options) => {
21403
+ if (this.surveyElement) {
21404
+ this.updateActionsContainer(this.surveyElement);
21405
+ this.updateActionsProperties();
21406
+ }
21407
+ };
21408
+ this.actionVisibilityCache = {};
21409
+ this.expandCollapseAction = this.getExpandCollapseAction();
21410
+ this.attachToUI(surveyElement);
21411
+ }
21412
+ get isActionContainerCreated() {
21413
+ return !!this.actionContainerValue;
21414
+ }
21415
+ get actionContainer() {
21416
+ if (!this.actionContainerValue) {
21417
+ this.actionContainerValue = this.createActionContainer();
21418
+ if (this.surveyElement) {
21419
+ this.updateActionsContainer(this.surveyElement);
21420
+ this.updateActionsVisibility(false);
21421
+ }
21422
+ }
21423
+ return this.actionContainerValue;
21424
+ }
21425
+ get topActionContainer() {
21426
+ if (!this.topActionContainerValue) {
21427
+ this.topActionContainerValue = this.createTopActionContainer();
21428
+ if (this.surveyElement) {
21429
+ this.updateActionsVisibility(true);
21430
+ }
21431
+ }
21432
+ return this.topActionContainerValue;
21433
+ }
21434
+ static GetAdorner(surveyElement) {
21435
+ return surveyElement.getPropertyValue(SurveyElementAdornerBase.AdornerValueName);
21436
+ }
21437
+ static RestoreStateFor(surveyElement) {
21438
+ const adorner = SurveyElementAdornerBase.GetAdorner(surveyElement);
21439
+ if (!!adorner) {
21440
+ adorner.restoreState();
21441
+ }
21442
+ }
21443
+ restoreState() {
21444
+ var _a;
21445
+ if (!!this.surveyElement) {
21446
+ this.collapsed = (_a = this.creator.designerStateManager) === null || _a === void 0 ? void 0 : _a.getElementCollapsed(this.surveyElement);
21447
+ }
21448
+ if (!this.surveyElement || this.surveyElement.isInteractiveDesignElement) {
21449
+ this.needToRenderContent = !this.collapsed;
21450
+ }
21451
+ }
21452
+ detachElement(surveyElement) {
21453
+ if (surveyElement) {
21454
+ surveyElement.setPropertyValue(SurveyElementAdornerBase.AdornerValueName, null);
21455
+ surveyElement.unRegisterFunctionOnPropertyValueChanged("isSelectedInDesigner", "questionSelected");
21456
+ this.cleanActionsContainer();
21457
+ }
21458
+ }
21459
+ attachElement(surveyElement) {
21460
+ var _a, _b;
21461
+ if (surveyElement) {
21462
+ (_b = (_a = this.creator) === null || _a === void 0 ? void 0 : _a.designerStateManager) === null || _b === void 0 ? void 0 : _b.initForElement(surveyElement);
21463
+ surveyElement.registerFunctionOnPropertyValueChanged("isSelectedInDesigner", (newValue) => {
21464
+ this.onElementSelectedChanged(newValue);
21465
+ }, "questionSelected");
21466
+ this.restoreState();
21467
+ this.updateActionsContainer(surveyElement);
21468
+ this.updateActionsProperties();
21469
+ surveyElement.setPropertyValue(SurveyElementAdornerBase.AdornerValueName, this);
21470
+ }
21471
+ }
21472
+ setSurveyElement(surveyElement) {
21473
+ this.detachOnlyMyElement();
21474
+ this.surveyElement = surveyElement;
21475
+ this.attachElement(this.surveyElement);
21476
+ }
21477
+ checkActionProperties() {
21478
+ if (this.creator.isElementSelected(this.surveyElement)) {
21479
+ this.updateActionsProperties();
21480
+ }
21481
+ }
21482
+ attachToUI(surveyElement, rootElement) {
21483
+ if (!!rootElement) {
21484
+ this.rootElement = rootElement;
21485
+ }
21486
+ if (this.surveyElement != surveyElement) {
21487
+ this.setSurveyElement(surveyElement);
21488
+ this.creator.onLocaleChanded.add(this.creatorOnLocaleChanged);
21489
+ this.creator.sidebar.onPropertyChanged.add(this.sidebarFlyoutModeChangedFunc);
21490
+ this.creator.expandCollapseManager.add(this);
21491
+ }
21492
+ }
21493
+ detachOnlyMyElement() {
21494
+ if (this.surveyElement && this.surveyElement.getPropertyValue(SurveyElementAdornerBase.AdornerValueName) === this && !this.surveyElement.isDisposed) {
21495
+ this.detachElement(this.surveyElement);
21496
+ }
21497
+ }
21498
+ detachFromUI() {
21499
+ this.rootElement = undefined;
21500
+ this.detachOnlyMyElement();
21501
+ this.surveyElement = undefined;
21502
+ this.creator.onLocaleChanded.remove(this.creatorOnLocaleChanged);
21503
+ this.creator.sidebar.onPropertyChanged.remove(this.sidebarFlyoutModeChangedFunc);
21504
+ this.creator.expandCollapseManager.remove(this);
21505
+ }
21506
+ dispose() {
21507
+ this.detachFromUI();
21508
+ this.disposeActions(this.actionContainerValue);
21509
+ this.disposeActions(this.topActionContainerValue);
21510
+ super.dispose();
21511
+ this.sidebarFlyoutModeChangedFunc = undefined;
21512
+ this.animationCollapsed = undefined;
21513
+ }
21514
+ disposeActions(container) {
21515
+ if (!!container && !container.isDisposed) {
21516
+ container.dispose();
21517
+ }
21518
+ }
21519
+ onElementSelectedChanged(isSelected) {
21520
+ if (!isSelected)
21521
+ return;
21522
+ this.updateActionsProperties();
21523
+ }
21524
+ getExpandCollapseAction() {
21525
+ const collapseIcon = "icon-collapsepanel-16x16";
21526
+ const expandIcon = "icon-expandpanel-16x16";
21527
+ return {
21528
+ id: "collapse",
21529
+ css: "sv-action-bar-item--collapse",
21530
+ locTooltipName: new ComputedUpdater(() => this.collapsed ? "ed.expandTooltip" : "ed.collapseTooltip"),
21531
+ iconName: new ComputedUpdater(() => this.collapsed ? expandIcon : collapseIcon),
21532
+ iconSize: "auto",
21533
+ action: () => {
21534
+ this.collapsed = !this.collapsed;
21535
+ }
21536
+ };
21537
+ }
21538
+ cleanActionsContainer() {
21539
+ const container = this.actionContainerValue;
21540
+ if (!container)
21541
+ return;
21542
+ const actions = container.actions;
21543
+ container.setItems([]);
21544
+ actions.forEach(action => action.dispose && action.dispose());
21545
+ }
21546
+ updateActionsContainer(surveyElement) {
21547
+ if (!this.actionContainerValue)
21548
+ return;
21549
+ const actions = [];
21550
+ this.buildActions(actions);
21551
+ this.creator.onElementMenuItemsChanged(surveyElement, actions);
21552
+ this.actionContainerValue.setItems(actions);
21553
+ }
21554
+ updateActionsProperties() {
21555
+ if (this.isDisposed)
21556
+ return;
21557
+ this.updateActionsPropertiesCore();
21558
+ }
21559
+ updateActionsPropertiesCore() {
21560
+ this.updateElementAllowOptions(this.creator.getElementAllowOperations(this.surveyElement), this.isOperationsAllow());
21561
+ }
21562
+ getAllowDragging(options) {
21563
+ return options.allowDragging;
21564
+ }
21565
+ getAllowExpandCollapse(options) {
21566
+ return this.creator.expandCollapseButtonVisibility != "never" && (options.allowExpandCollapse == undefined || !!options.allowExpandCollapse);
21567
+ }
21568
+ updateElementAllowOptions(options, operationsAllow) {
21569
+ this.allowDragging = operationsAllow && this.getAllowDragging(options);
21570
+ this.allowExpandCollapse = this.getAllowExpandCollapse(options);
21571
+ this.allowEditOption = (options.allowEdit == undefined || !!options.allowEdit);
21572
+ this.updateActionVisibility("delete", operationsAllow && options.allowDelete);
21573
+ this.updateActionVisibility("duplicate", operationsAllow && options.allowCopy);
21574
+ this.updateActionVisibility("collapse", this.allowExpandCollapse);
21575
+ if (options.allowShowSettings === undefined) {
21576
+ const settingsVisibility = (options.allowEdit !== undefined) ? (operationsAllow && options.allowEdit) : this.creator.sidebar.flyoutMode;
21577
+ this.updateActionVisibility("settings", settingsVisibility);
21578
+ }
21579
+ else {
21580
+ this.updateActionVisibility("settings", options.allowShowSettings);
21581
+ }
21582
+ this.setShowAddQuestionButton(options.allowEdit !== false);
21583
+ }
21584
+ isOperationsAllow() {
21585
+ return !this.creator.readOnly;
21586
+ }
21587
+ updateActionVisibility(id, isVisible) {
21588
+ var _a, _b;
21589
+ var action = ((_a = this.actionContainerValue) === null || _a === void 0 ? void 0 : _a.getActionById(id)) || ((_b = this.topActionContainerValue) === null || _b === void 0 ? void 0 : _b.getActionById(id));
21590
+ if (!action) {
21591
+ this.actionVisibilityCache[id] = isVisible;
21592
+ }
21593
+ else {
21594
+ if (action.visible !== isVisible) {
21595
+ action.visible = isVisible;
21596
+ }
21597
+ }
21598
+ }
21599
+ updateActionsVisibility(isTop) {
21600
+ for (var key in this.actionVisibilityCache) {
21601
+ this.updateActionVisibility(key, this.actionVisibilityCache[key]);
21602
+ }
21603
+ }
21604
+ getActionById(id) {
21605
+ return this.actionContainer.getActionById(id) || this.topActionContainer.getActionById(id);
21606
+ }
21607
+ buildActions(items) {
21608
+ items.push(new Action({
21609
+ id: "duplicate",
21610
+ iconName: "icon-duplicate_16x16",
21611
+ css: "svc-action-bar-item--right",
21612
+ title: this.creator.getLocString("survey.duplicate"),
21613
+ visibleIndex: 10,
21614
+ iconSize: "auto",
21615
+ action: () => this.duplicate(),
21616
+ onFocus: (isMouse, event) => this.disableActionFocusing(isMouse, event)
21617
+ }));
21618
+ items.push(new Action({
21619
+ id: "settings",
21620
+ iconName: "icon-settings_16x16",
21621
+ css: "svc-action-bar-item--right",
21622
+ title: this.creator.getLocString("ed.settings"),
21623
+ locTooltipName: "ed.settingsTooltip",
21624
+ visibleIndex: 20,
21625
+ iconSize: "auto",
21626
+ action: () => {
21627
+ this.creator.setShowSidebar(true, true);
21628
+ if (!this.creator.isMobileView) {
21629
+ this.creator.sidebar.executeOnExpand(() => {
21630
+ this.creator.propertyGrid.getAllQuestions()[0].focus();
21631
+ });
21632
+ }
21633
+ }
21634
+ }));
21635
+ items.push(new Action({
21636
+ id: "delete",
21637
+ iconName: "icon-delete_16x16",
21638
+ css: "svc-action-bar-item--right",
21639
+ //needSeparator: items.length > 0,
21640
+ title: this.creator.getLocString("pe.delete"),
21641
+ visibleIndex: 30,
21642
+ iconSize: "auto",
21643
+ action: () => {
21644
+ this.delete();
21645
+ },
21646
+ onFocus: (isMouse, event) => this.disableActionFocusing(isMouse, event)
21647
+ }));
21648
+ }
21649
+ disableActionFocusing(isMouse, event) {
21650
+ this.isDisableSelecting = isMouse;
21651
+ }
21652
+ canSelectElement() {
21653
+ const res = !this.isDisableSelecting;
21654
+ this.isDisableSelecting = false;
21655
+ return res;
21656
+ }
21657
+ get allowEdit() {
21658
+ return !!this.creator && !this.creator.readOnly && this.allowEditOption;
21659
+ }
21660
+ get showAddQuestionButton() {
21661
+ return this.getPropertyValue("showAddQuestionButton");
21662
+ }
21663
+ setShowAddQuestionButton(val) {
21664
+ this.setPropertyValue("showAddQuestionButton", val && this.allowEdit && !!this.creator && this.creator.showAddQuestionButton);
21665
+ }
21666
+ duplicate() { }
21667
+ delete() {
21668
+ this.creator.deleteElement(this.surveyElement);
21669
+ }
21670
+ getCss() {
21671
+ return new CssClassBuilder().append("svc-hovered svc-hovered-ready", this.isHovered).toString();
21672
+ }
21673
+ }
21674
+ SurveyElementAdornerBase.AdornerValueName = "__sjs_creator_adorner";
21675
+ __decorate([
21676
+ property({ defaultValue: true })
21677
+ ], SurveyElementAdornerBase.prototype, "allowDragging", void 0);
21678
+ __decorate([
21679
+ property({ defaultValue: false })
21680
+ ], SurveyElementAdornerBase.prototype, "expandCollapseAnimationRunning", void 0);
21681
+ __decorate([
21682
+ property({ defaultValue: null })
21683
+ ], SurveyElementAdornerBase.prototype, "dropIndicatorPosition", void 0);
21684
+ __decorate([
21685
+ property({ defaultValue: false })
21686
+ ], SurveyElementAdornerBase.prototype, "isBeingDragged", void 0);
21687
+ __decorate([
21688
+ property({ defaultValue: true })
21689
+ ], SurveyElementAdornerBase.prototype, "needToRenderContent", void 0);
21690
+ __decorate([
21691
+ property({ defaultValue: true })
21692
+ ], SurveyElementAdornerBase.prototype, "allowExpandCollapse", void 0);
21693
+ __decorate([
21694
+ property({
21695
+ onSet: (val, target) => {
21696
+ target.renderedCollapsed = val;
21697
+ if (!val)
21698
+ target.needToRenderContent = true;
21699
+ if (target.creator.designerStateManager && target.surveyElement) {
21700
+ target.creator.designerStateManager.setElementCollapsed(target.surveyElement, val);
21701
+ }
21702
+ setTimeout(() => {
21703
+ target.creator.survey.pages.forEach(p => p.ensureRowsVisibility());
21704
+ target.creator.survey.getAllPanels().forEach(p => p.ensureRowsVisibility());
21705
+ }, 50);
21706
+ }
21707
+ })
21708
+ ], SurveyElementAdornerBase.prototype, "collapsed", void 0);
21709
+ __decorate([
21710
+ property()
21711
+ ], SurveyElementAdornerBase.prototype, "_renderedCollapsed", void 0);
21712
+ __decorate([
21713
+ property()
21714
+ ], SurveyElementAdornerBase.prototype, "isAnimationRunningCollapsed", void 0);
21715
+ __decorate([
21716
+ property({ defaultValue: false })
21717
+ ], SurveyElementAdornerBase.prototype, "isHovered", void 0);
21718
+
21719
+ var DropIndicatorPosition;
21720
+ (function (DropIndicatorPosition) {
21721
+ DropIndicatorPosition["Inside"] = "inside";
21722
+ DropIndicatorPosition["Top"] = "top";
21723
+ DropIndicatorPosition["Bottom"] = "bottom";
21724
+ DropIndicatorPosition["Right"] = "right";
21725
+ DropIndicatorPosition["Left"] = "left";
21726
+ })(DropIndicatorPosition || (DropIndicatorPosition = {}));
21727
+ var ElType;
21728
+ (function (ElType) {
21729
+ ElType["Page"] = "page";
21730
+ ElType["Panel"] = "panel";
21731
+ ElType["Question"] = "question";
21732
+ ElType["DynamicPanel"] = "dynamic-panel";
21733
+ ElType["EmptySurvey"] = "empty-survey";
21734
+ })(ElType || (ElType = {}));
21735
+
21736
+ function calculateIsEdge(dropTargetNode, clientY) {
21737
+ const rect = dropTargetNode.getBoundingClientRect();
21738
+ return clientY - rect.top <= DragDropSurveyElements.edgeHeight || rect.bottom - clientY <= DragDropSurveyElements.edgeHeight;
21739
+ }
21740
+ function calculateIsSide(dropTargetNode, clientX) {
21741
+ const rect = dropTargetNode.getBoundingClientRect();
21742
+ return clientX - rect.left <= DragDropSurveyElements.edgeHeight || rect.right - clientX <= DragDropSurveyElements.edgeHeight;
21743
+ }
21744
+ function calculateDragOverLocation(clientX, clientY, rect, direction = null) {
21745
+ const tg = rect.height / rect.width;
21746
+ const dx = clientX - rect.x;
21747
+ const dy = clientY - rect.y;
21748
+ if (direction == "top-bottom") {
21749
+ if (dy >= rect.height / 2) {
21750
+ return DropIndicatorPosition.Bottom;
21751
+ }
21752
+ else {
21753
+ return DropIndicatorPosition.Top;
21754
+ }
21755
+ }
21756
+ if (direction == "left-right") {
21757
+ if (dx >= rect.width / 2) {
21758
+ return DropIndicatorPosition.Right;
21759
+ }
21760
+ else {
21761
+ return DropIndicatorPosition.Left;
21762
+ }
21763
+ }
21764
+ if (dy >= tg * dx) {
21765
+ if (dy >= -tg * dx + rect.height) {
21766
+ return DropIndicatorPosition.Bottom;
21767
+ }
21768
+ else {
21769
+ return DropIndicatorPosition.Left;
21770
+ }
21771
+ }
21772
+ else {
21773
+ if (dy >= -tg * dx + rect.height) {
21774
+ return DropIndicatorPosition.Right;
21775
+ }
21776
+ else {
21777
+ return DropIndicatorPosition.Top;
21778
+ }
21779
+ }
21780
+ }
21781
+ class DragDropSurveyElements extends DragDropCore {
21782
+ constructor() {
21783
+ super(...arguments);
21784
+ this.insideElement = null;
21785
+ this.prevIsEdge = null;
21786
+ // protected ghostSurveyElement: IElement = null;
21787
+ this.dragOverIndicatorElement = null;
21788
+ this.isDraggedElementSelected = false;
21789
+ this.doBanDropHere = () => {
21790
+ this.removeDragOverMarker(this.dragOverIndicatorElement);
21791
+ this.removeDragOverMarker(this.dropTarget);
21792
+ };
21793
+ this.doDrop = () => {
21794
+ var _a;
21795
+ if (!this.dropTarget)
21796
+ return;
21797
+ if (!this.dragOverLocation)
21798
+ return;
21799
+ const page = this.parentElement;
21800
+ const dragged = this.draggedElement;
21801
+ const src = this.draggedElement;
21802
+ if (dragged.isPage && dragged instanceof PageModel) {
21803
+ const survey = dragged.survey;
21804
+ survey.startMovingPage();
21805
+ const indexOfDraggedPage = survey.pages.indexOf(dragged);
21806
+ survey.pages.splice(indexOfDraggedPage, 1);
21807
+ const indexOfDropTarget = survey.pages.indexOf(this.dropTarget) + (this.dragOverLocation === DropIndicatorPosition.Top ? 0 : 1);
21808
+ survey.pages.splice(indexOfDropTarget, 0, dragged);
21809
+ survey.stopMovingPage();
21810
+ if (indexOfDraggedPage !== indexOfDropTarget) {
21811
+ dragged["draggedFrom"] = indexOfDraggedPage < indexOfDropTarget ? indexOfDraggedPage : indexOfDraggedPage + 1;
21812
+ }
21813
+ return dragged;
21814
+ }
21815
+ const convertLocation = () => {
21816
+ switch (this.dragOverLocation) {
21817
+ case "top": return "top";
21818
+ case "bottom": return "bottom";
21819
+ case "right": return "right";
21820
+ case "left": return "left";
21821
+ default: return "bottom";
21822
+ }
21823
+ };
21824
+ const srcContainer = src.parent || src.page;
21825
+ if (!!srcContainer) {
21826
+ page.survey.startMovingQuestion();
21827
+ srcContainer.removeElement(src);
21828
+ }
21829
+ let dest = ((_a = this.dragOverIndicatorElement) === null || _a === void 0 ? void 0 : _a.isPanel) ? this.dragOverIndicatorElement : this.dropTarget;
21830
+ if (this.dragOverLocation === DropIndicatorPosition.Inside) {
21831
+ if (this.isPanelDynamic(dest))
21832
+ dest = dest.template;
21833
+ dest.insertElement(src);
21834
+ }
21835
+ else {
21836
+ const destParent = dest.parent || dest.page;
21837
+ if (destParent)
21838
+ destParent.insertElement(src, dest, convertLocation());
21839
+ }
21840
+ page.survey.stopMovingQuestion();
21841
+ return dragged;
21842
+ };
21843
+ }
21844
+ get draggedElementAdorner() {
21845
+ if (!this.draggedElement)
21846
+ return null;
21847
+ return SurveyElementAdornerBase.GetAdorner(this.draggedElement);
21848
+ }
21849
+ get dropTargetAdorner() {
21850
+ if (!this.dropTarget)
21851
+ return null;
21852
+ return SurveyElementAdornerBase.GetAdorner(this.dropTarget);
21853
+ }
21854
+ get draggedElementType() {
21855
+ if (!!this.draggedElement && this.draggedElement.isPage) {
21856
+ return "survey-page";
21857
+ }
21858
+ return "survey-element";
21859
+ }
21860
+ get maxNestedPanels() { return this.onGetMaxNestedPanels ? this.onGetMaxNestedPanels() : -1; }
21861
+ // private isRight: boolean;
21862
+ // protected prevIsRight: boolean;
21863
+ startDragToolboxItem(event, draggedElementJson, toolboxItemModel) {
21864
+ const draggedElement = this.createElementFromJson(draggedElementJson);
21865
+ draggedElement.toolboxItemTitle = toolboxItemModel.title;
21866
+ draggedElement.toolboxItemIconName = toolboxItemModel.iconName;
21867
+ this.startDrag(event, draggedElement);
21868
+ }
21869
+ startDragSurveyElement(event, draggedElement, isElementSelected) {
21870
+ this.isDraggedElementSelected = isElementSelected;
21871
+ this.startDrag(event, draggedElement);
21872
+ }
21873
+ getShortcutText(draggedElement) {
21874
+ if (draggedElement.isPage)
21875
+ return draggedElement.name;
21876
+ return draggedElement.toolboxItemTitle || super.getShortcutText(draggedElement);
21877
+ }
21878
+ createDraggedElementShortcut(text, draggedElementNode, event) {
21879
+ const draggedElementShortcut = document.createElement("div");
21880
+ draggedElementShortcut.style.display = "flex";
21881
+ const textSpan = document.createElement("span");
21882
+ textSpan.className = "svc-dragged-element-shortcut__text";
21883
+ textSpan.innerText = text;
21884
+ if (this.draggedElement.toolboxItemIconName) {
21885
+ draggedElementShortcut.appendChild(this.createDraggedElementIcon());
21886
+ }
21887
+ draggedElementShortcut.appendChild(textSpan);
21888
+ draggedElementShortcut.className = this.getDraggedElementClass();
21889
+ return draggedElementShortcut;
21890
+ }
21891
+ createDraggedElementIcon() {
21892
+ const span = document.createElement("span");
21893
+ span.className = "svc-dragged-element-shortcut__icon";
21894
+ const iconName = getIconNameFromProxy(this.draggedElement.toolboxItemIconName);
21895
+ const svgString = `<svg class="sv-svg-icon" role="img"><use xlink:href="#${iconName}"></use></svg>`;
21896
+ span.innerHTML = svgString;
21897
+ return span;
21898
+ }
21899
+ getDraggedElementClass() {
21900
+ let result = "svc-dragged-element-shortcut";
21901
+ if (!!this.draggedElement.toolboxItemIconName)
21902
+ result += " svc-dragged-element-shortcut--has-icon";
21903
+ if (this.isDraggedElementSelected)
21904
+ result += " svc-dragged-element-shortcut--selected";
21905
+ return result;
21906
+ }
21907
+ createElementFromJson(json) {
21908
+ const element = this.createNewElement(json);
21909
+ if (element["setSurveyImpl"]) {
21910
+ element["setSurveyImpl"](this.survey);
21911
+ }
21912
+ else {
21913
+ element["setData"](this.survey);
21914
+ }
21915
+ element.renderWidth = "100%";
21916
+ return element;
21917
+ }
21918
+ createNewElement(json) {
21919
+ var newElement = Serializer.createClass(json["type"]);
21920
+ new JsonObject().toObject(json, newElement);
21921
+ return newElement;
21922
+ }
21923
+ isPanelDynamic(element) {
21924
+ return element instanceof QuestionPanelDynamicModel;
21925
+ }
21926
+ findDropTargetNodeByDragOverNode(dragOverNode) {
21927
+ const ghostRow = dragOverNode.closest(".svc-row--ghost");
21928
+ if (!!ghostRow) {
21929
+ const ghostDataAttrSelector = "[data-sv-drop-target-survey-element='sv-drag-drop-ghost-survey-element-name']";
21930
+ const ghostNode = dragOverNode.closest(ghostDataAttrSelector) || dragOverNode.querySelector(ghostDataAttrSelector);
21931
+ if (!!ghostNode) {
21932
+ return ghostNode;
21933
+ }
21934
+ }
21935
+ const dropTargetNode = dragOverNode.closest(this.dropTargetDataAttributeName);
21936
+ return dropTargetNode;
21937
+ }
21938
+ getDropTargetByDataAttributeValue(dataAttributeValue, dropTargetNode, event) {
21939
+ const oldDragOverIndicatorElement = this.dragOverIndicatorElement;
21940
+ if (!dataAttributeValue) {
21941
+ // panel dynamic
21942
+ const nearestDropTargetElement = dropTargetNode.parentElement.closest(this.dropTargetDataAttributeName);
21943
+ dataAttributeValue = this.getDataAttributeValueByNode(nearestDropTargetElement);
21944
+ }
21945
+ if (!dataAttributeValue) {
21946
+ throw new Error("Can't find drop target survey element name");
21947
+ }
21948
+ if (dataAttributeValue === DragDropSurveyElements.ghostSurveyElementName) {
21949
+ return this.prevDropTarget;
21950
+ }
21951
+ // drop to new page
21952
+ if (dataAttributeValue === "newGhostPage") {
21953
+ return DragDropSurveyElements.newGhostPage;
21954
+ }
21955
+ // drop to page
21956
+ let page = this.survey.getPageByName(dataAttributeValue);
21957
+ if (page) {
21958
+ return page;
21959
+ }
21960
+ // drop to question or panel
21961
+ let dropTarget;
21962
+ let dragOverElement;
21963
+ this.survey.pages.forEach((page) => {
21964
+ const question = page.getElementByName(dataAttributeValue);
21965
+ if (question) {
21966
+ dropTarget = question;
21967
+ dragOverElement = question;
21968
+ }
21969
+ });
21970
+ // drop to matrix detail panel
21971
+ if ((dropTarget.getType() === "matrixdropdown" || dropTarget.getType() === "matrixdynamic") && dropTarget.detailPanelMode !== "none" && this.insideElement) {
21972
+ dropTarget = dropTarget.detailPanel;
21973
+ }
21974
+ // drop to question
21975
+ //question inside paneldymanic
21976
+ if (!dropTarget.page) {
21977
+ const nearestDropTargetPageElement = dropTargetNode.parentElement.closest("[data-sv-drop-target-page]");
21978
+ dataAttributeValue = nearestDropTargetPageElement.dataset.svDropTargetPage;
21979
+ let page = this.survey.getPageByName(dataAttributeValue);
21980
+ dropTarget.__page = page;
21981
+ }
21982
+ this.dragOverIndicatorElement = dragOverElement;
21983
+ if (this.dragOverIndicatorElement != oldDragOverIndicatorElement) {
21984
+ this.removeDragOverMarker(oldDragOverIndicatorElement);
21985
+ }
21986
+ return dropTarget;
21987
+ // EO drop to question or panel
21988
+ }
21989
+ isDropTargetValid(dropTarget, dropTargetNode, dragOverLocation = DropIndicatorPosition.Top) {
21990
+ if (!dropTarget)
21991
+ return false;
21992
+ if (dropTarget === this.draggedElement)
21993
+ return false;
21994
+ if (this.draggedElement.getType() === "paneldynamic" && dropTarget === this.draggedElement.template) {
21995
+ return false;
21996
+ }
21997
+ if (this.maxNestedPanels >= 0 && this.draggedElement.isPanel) {
21998
+ const pnl = this.draggedElement;
21999
+ if (pnl.deepNested === undefined) {
22000
+ pnl.deepNested = this.getMaximumNestedPanelCount(pnl, 0);
22001
+ }
22002
+ let len = SurveyHelper.getElementDeepLength(dropTarget);
22003
+ if (dragOverLocation !== DropIndicatorPosition.Inside && dropTarget.isPanel)
22004
+ len--;
22005
+ if (this.maxNestedPanels < len + pnl.deepNested)
22006
+ return false;
22007
+ }
22008
+ if (DragDropSurveyElements.restrictDragQuestionBetweenPages &&
22009
+ this.shouldRestricDragQuestionBetweenPages(dropTarget)) {
22010
+ return false;
22011
+ }
22012
+ return true;
22013
+ }
22014
+ getMaximumNestedPanelCount(panel, deep) {
22015
+ let max = deep;
22016
+ panel.elements.forEach(el => {
22017
+ if (el.isPanel) {
22018
+ const pDeep = this.getMaximumNestedPanelCount(el, deep + 1);
22019
+ if (pDeep > max) {
22020
+ max = pDeep;
22021
+ }
22022
+ }
22023
+ });
22024
+ return max;
22025
+ }
22026
+ shouldRestricDragQuestionBetweenPages(dropTarget) {
22027
+ const oldPage = this.draggedElement["page"];
22028
+ const newPage = dropTarget.isPage ? dropTarget : dropTarget["page"];
22029
+ // if oldPage === null then it is drop from the toolbox
22030
+ return oldPage && oldPage !== newPage;
22031
+ }
22032
+ findDeepestDropTargetChild(parent) {
22033
+ const selector = this.dropTargetDataAttributeName;
22034
+ let result = parent;
22035
+ while (!!parent) {
22036
+ result = parent;
22037
+ parent = parent.querySelector(selector);
22038
+ }
22039
+ return result;
22040
+ }
22041
+ isAllowDragOver(dropTarget, dragOverLocation) {
22042
+ if (!this.survey || this.survey.onDragDropAllow.isEmpty)
22043
+ return true;
22044
+ const allowOptions = {
22045
+ allow: true,
22046
+ parent: this.parentElement,
22047
+ source: this.draggedElement,
22048
+ toElement: dropTarget,
22049
+ draggedElement: this.draggedElement,
22050
+ fromElement: this.draggedElement.parent,
22051
+ target: dropTarget,
22052
+ insertAfter: undefined,
22053
+ insertBefore: undefined,
22054
+ allowDropNextToAnother: true
22055
+ };
22056
+ if (dragOverLocation === DropIndicatorPosition.Bottom || dragOverLocation === DropIndicatorPosition.Right) {
22057
+ allowOptions.insertAfter = dropTarget;
22058
+ }
22059
+ if (dragOverLocation === DropIndicatorPosition.Top || dragOverLocation === DropIndicatorPosition.Left) {
22060
+ allowOptions.insertBefore = dropTarget;
22061
+ }
22062
+ this.survey.onDragDropAllow.fire(this.survey, allowOptions);
22063
+ if (!allowOptions.allowDropNextToAnother) {
22064
+ if (dragOverLocation === DropIndicatorPosition.Left) {
22065
+ this.dragOverLocation = DropIndicatorPosition.Top;
22066
+ }
22067
+ if (dragOverLocation === DropIndicatorPosition.Right) {
22068
+ this.dragOverLocation = DropIndicatorPosition.Bottom;
22069
+ }
22070
+ }
22071
+ return allowOptions.allow;
22072
+ }
22073
+ dragOverCore(dropTarget, dragOverLocation) {
22074
+ const oldDragOverIndicatorElement = this.dragOverIndicatorElement;
22075
+ const oldDropTarget = this.dropTarget;
22076
+ if (this.isSameElement(dropTarget)) {
22077
+ this.allowDropHere = false;
22078
+ return;
22079
+ }
22080
+ this.dropTarget = dropTarget;
22081
+ this.dragOverLocation = dragOverLocation;
22082
+ this.parentElement = this.dropTarget.isPage
22083
+ ? this.dropTarget
22084
+ : (this.dropTarget.page || this.dropTarget.__page);
22085
+ if (!this.isAllowDragOver(dropTarget, dragOverLocation)) {
22086
+ this.allowDropHere = false;
22087
+ return;
22088
+ }
22089
+ if (dragOverLocation == DropIndicatorPosition.Inside) {
22090
+ this.dragOverIndicatorElement = this.dropTarget;
22091
+ this.dropTargetAdorner.dropIndicatorPosition = DropIndicatorPosition.Inside;
22092
+ }
22093
+ else {
22094
+ const row = this.dragDropFindRow(this.dropTarget, this.parentElement);
22095
+ if (!!row && row.elements.length > 1 && (this.dragOverLocation === DropIndicatorPosition.Top || this.dragOverLocation === DropIndicatorPosition.Bottom)) {
22096
+ this.dragOverIndicatorElement = row;
22097
+ const adorner = SurveyElementAdornerBase.GetAdorner(row);
22098
+ if (adorner) {
22099
+ adorner.dropIndicatorPosition = this.dragOverLocation;
22100
+ }
22101
+ }
22102
+ else {
22103
+ this.dragOverIndicatorElement = this.dropTarget;
22104
+ if (this.draggedElement.isPage) {
22105
+ if (this.dragOverLocation === DropIndicatorPosition.Top || this.dragOverLocation === DropIndicatorPosition.Bottom) {
22106
+ this.dropTargetAdorner.dropIndicatorPosition = this.dragOverLocation;
22107
+ }
22108
+ else {
22109
+ this.dropTargetAdorner.dropIndicatorPosition = this.dragOverLocation;
22110
+ }
22111
+ }
22112
+ else {
22113
+ this.dropTargetAdorner.dropIndicatorPosition = this.dragOverLocation;
22114
+ }
22115
+ }
22116
+ }
22117
+ if (this.dragOverIndicatorElement != oldDragOverIndicatorElement)
22118
+ this.removeDragOverMarker(oldDragOverIndicatorElement);
22119
+ if (this.dropTarget != oldDropTarget)
22120
+ this.removeDragOverMarker(oldDropTarget);
22121
+ }
22122
+ dragDropFindRow(findElement, panel) {
22123
+ if (!findElement || findElement.isPage)
22124
+ return null;
22125
+ var element = findElement;
22126
+ var rows = panel.rows;
22127
+ for (var i = 0; i < rows.length; i++) {
22128
+ if (rows[i].elements.indexOf(element) > -1)
22129
+ return rows[i];
22130
+ }
22131
+ for (var i = 0; i < panel.elements.length; i++) {
22132
+ var pnl = panel.elements[i].getPanel();
22133
+ if (!pnl)
22134
+ continue;
22135
+ var row = this.dragDropFindRow(element, pnl);
22136
+ if (!!row)
22137
+ return row;
22138
+ }
22139
+ return null;
22140
+ }
22141
+ isSameElement(target) {
22142
+ while (!!target) {
22143
+ if (target === this.draggedElement)
22144
+ return true;
22145
+ target = target.parent;
22146
+ }
22147
+ return false;
22148
+ }
22149
+ isDragInsideItself(dragOverNodes) {
22150
+ let result = false;
22151
+ dragOverNodes.forEach((node) => {
22152
+ if (node.classList.contains("svc-question__content--dragged")) {
22153
+ result = true;
22154
+ }
22155
+ });
22156
+ return result;
22157
+ }
22158
+ getDragDropElementType(element) {
22159
+ if (element.isPage)
22160
+ return ElType.Page;
22161
+ if (element.isPanel)
22162
+ return ElType.Panel;
22163
+ if (element instanceof QuestionPanelDynamicModel)
22164
+ return ElType.DynamicPanel;
22165
+ return ElType.Question;
22166
+ }
22167
+ dragOver(event) {
22168
+ const dropTargetNode = this.findDropTargetNodeFromPoint(event.clientX, event.clientY);
22169
+ if (!dropTargetNode) {
22170
+ this.banDropHere();
22171
+ return;
22172
+ }
22173
+ if (document && document.elementsFromPoint && this.isDragInsideItself(document.elementsFromPoint(event.clientX, event.clientY))) {
22174
+ this.banDropHere();
22175
+ return null;
22176
+ }
22177
+ const oldinsideElement = this.insideElement;
22178
+ this.insideElement = !calculateIsEdge(dropTargetNode, event.clientY) && !calculateIsSide(dropTargetNode, event.clientX);
22179
+ const dropTarget = this.getDropTargetByNode(dropTargetNode, event);
22180
+ const dropTargetAdorner = SurveyElementAdornerBase.GetAdorner(dropTarget);
22181
+ if (!!oldinsideElement != !!this.insideElement) {
22182
+ dropTargetAdorner.dropIndicatorPosition = null;
22183
+ }
22184
+ const dropTargetRect = dropTargetNode.getBoundingClientRect();
22185
+ const calcDirection = !settings.dragDrop.allowDragToTheSameLine || (!!this.draggedElement && this.draggedElement.isPage) ? "top-bottom" : null;
22186
+ let dragOverLocation = calculateDragOverLocation(event.clientX, event.clientY, dropTargetRect, calcDirection);
22187
+ if (!this.draggedElement.isPage && dropTarget && ((dropTarget.isPanel || dropTarget.isPage) && dropTarget.elements.length === 0 || this.isPanelDynamic(dropTarget) && dropTarget.template.elements.length == 0)) {
22188
+ if (dropTarget.isPage || this.insideElement) {
22189
+ dragOverLocation = DropIndicatorPosition.Inside;
22190
+ }
22191
+ }
22192
+ if (!this.draggedElement.isPage && dropTarget.isPage && dropTargetAdorner.collapsed) {
22193
+ dragOverLocation = DropIndicatorPosition.Inside;
22194
+ }
22195
+ if ((dropTarget.isPanel || this.isPanelDynamic(dropTarget)) && this.insideElement && dropTargetAdorner.collapsed) {
22196
+ dragOverLocation = DropIndicatorPosition.Inside;
22197
+ }
22198
+ if (!this.draggedElement.isPage && dropTarget.isPage && dropTarget.elements.length !== 0 && !dropTargetAdorner.collapsed) {
22199
+ dragOverLocation = null;
22200
+ }
22201
+ // const dropTargetType = this.getDragDropElementType(dropTarget);
22202
+ // const draggedElementType = this.getDragDropElementType(this.draggedElement);
22203
+ // switch (dropTargetType) {
22204
+ // case ElType.Page: {
22205
+ // console.log("dropTargetType", dropTargetType);
22206
+ // break;
22207
+ // }
22208
+ // case ElType.Panel: {
22209
+ // console.log("dropTargetType", dropTargetType);
22210
+ // break;
22211
+ // }
22212
+ // case ElType.DynamicPanel: {
22213
+ // console.log("dropTargetType", dropTargetType);
22214
+ // break;
22215
+ // }
22216
+ // case ElType.Question: {
22217
+ // console.log("dropTargetType", dropTargetType);
22218
+ // break;
22219
+ // }
22220
+ // // case ElType.EmptySurvey: {
22221
+ // // console.log("dropTargetType", dropTargetType);
22222
+ // // break;
22223
+ // // }
22224
+ // }
22225
+ const options = {
22226
+ survey: this.survey,
22227
+ draggedSurveyElement: this.draggedElement,
22228
+ dragOverSurveyElement: dropTarget,
22229
+ clientX: event.clientX,
22230
+ clientY: event.clientY,
22231
+ dragOverRect: dropTargetRect,
22232
+ insideElement: this.insideElement,
22233
+ dragOverLocation
22234
+ };
22235
+ if (this.onDragOverLocationCalculating) {
22236
+ this.onDragOverLocationCalculating(options);
22237
+ dragOverLocation = options.dragOverLocation;
22238
+ this.insideElement = options.insideElement;
22239
+ }
22240
+ const isDropTargetValid = this.isDropTargetValid(dropTarget, dropTargetNode, dragOverLocation);
22241
+ if (!isDropTargetValid) {
22242
+ this.banDropHere();
22243
+ return;
22244
+ }
22245
+ this.allowDropHere = true;
22246
+ this.dragOverCore(dropTarget, dragOverLocation);
22247
+ }
22248
+ onStartDrag() {
22249
+ // this.ghostSurveyElement = this.createGhostSurveyElement();
22250
+ if (this.draggedElementAdorner) {
22251
+ this.draggedElementAdorner.isBeingDragged = true;
22252
+ }
22253
+ }
22254
+ moveElementInPanel(panel, src, target, targetIndex) {
22255
+ var srcIndex = src.parent.elements.indexOf(src);
22256
+ if (targetIndex > srcIndex) {
22257
+ targetIndex--;
22258
+ }
22259
+ if (src === target && srcIndex === targetIndex) {
22260
+ return;
22261
+ }
22262
+ panel.removeElement(src);
22263
+ panel.addElement(target, targetIndex);
22264
+ }
22265
+ removeDragOverMarker(dropTarget) {
22266
+ if (dropTarget) {
22267
+ const adorner = SurveyElementAdornerBase.GetAdorner(dropTarget);
22268
+ if (adorner) {
22269
+ adorner.dropIndicatorPosition = null;
22270
+ }
22271
+ }
22272
+ }
22273
+ clear() {
22274
+ this.insideElement = null;
22275
+ this.removeDragOverMarker(this.prevDropTarget);
22276
+ this.removeDragOverMarker(this.dropTarget);
22277
+ this.removeDragOverMarker(this.dragOverIndicatorElement);
22278
+ if (this.draggedElement && this.draggedElementAdorner) {
22279
+ this.draggedElementAdorner.isBeingDragged = false;
22280
+ }
22281
+ super.clear();
22282
+ }
22283
+ getTargetParent(dropTarget) {
22284
+ let targetParent = dropTarget.isPage || dropTarget.isPanel ? dropTarget : dropTarget.parent;
22285
+ if (dropTarget.getType() === "paneldynamic") {
22286
+ targetParent = dropTarget.templateValue;
22287
+ }
22288
+ return targetParent;
22289
+ }
22290
+ getTargetRow(dropTarget) {
22291
+ const targetParent = this.getTargetParent(dropTarget);
22292
+ let targetRow;
22293
+ targetParent.rows.forEach((row) => {
22294
+ if (row.elements.indexOf(dropTarget) !== -1) {
22295
+ targetRow = row;
22296
+ }
22297
+ });
22298
+ return targetRow;
22299
+ }
22300
+ }
22301
+ DragDropSurveyElements.newGhostPage = null;
22302
+ DragDropSurveyElements.restrictDragQuestionBetweenPages = false;
22303
+ DragDropSurveyElements.edgeHeight = 30;
22304
+ DragDropSurveyElements.nestedPanelDepth = -1;
22305
+ DragDropSurveyElements.ghostSurveyElementName = "sv-drag-drop-ghost-survey-element-name"; // before renaming use globa search (we have also css selectors)
22306
+
22220
22307
  const designTabSurveyThemeJSON = {
22221
22308
  "cssVariables": {
22222
22309
  "--sjs-base-unit": "var(--ctr-surface-base-unit)",
@@ -22732,6 +22819,14 @@ class DesignerStateManager {
22732
22819
  stateMap[newName] = new ElementState();
22733
22820
  }, "designerStateManager");
22734
22821
  }
22822
+ getElementCollapsed(element) {
22823
+ return this.getElementState(element).collapsed;
22824
+ }
22825
+ setElementCollapsed(element, isCollapsed) {
22826
+ if (this.isSuspended)
22827
+ return;
22828
+ this.getElementState(element).collapsed = isCollapsed;
22829
+ }
22735
22830
  getElementState(element) {
22736
22831
  return this.createElementState(element, true);
22737
22832
  }
@@ -22878,7 +22973,7 @@ class DomDocumentHelper {
22878
22973
  }
22879
22974
  class CreatorStylesManager {
22880
22975
  static findSheet(styleSheetId) {
22881
- if (typeof document === "undefined")
22976
+ if (!DomDocumentHelper.isAvailable())
22882
22977
  return null;
22883
22978
  for (let i = 0; i < document.styleSheets.length; i++) {
22884
22979
  if (!!document.styleSheets[i].ownerNode && document.styleSheets[i].ownerNode["id"] === styleSheetId) {
@@ -22888,6 +22983,8 @@ class CreatorStylesManager {
22888
22983
  return null;
22889
22984
  }
22890
22985
  static createSheet(styleSheetId) {
22986
+ if (!DomDocumentHelper.isAvailable())
22987
+ return null;
22891
22988
  let style = DomDocumentHelper.createElement("style");
22892
22989
  style.id = styleSheetId;
22893
22990
  style.appendChild(new Text(""));
@@ -22900,13 +22997,15 @@ class CreatorStylesManager {
22900
22997
  if (!sheet) {
22901
22998
  sheet = CreatorStylesManager.createSheet(CreatorStylesManager.SurveyJSCreatorStylesSheetId);
22902
22999
  }
22903
- if (Object.keys(rules).length) {
22904
- rules.forEach((rule) => {
22905
- try {
22906
- sheet.insertRule(`${rule.selector} { ${rule.styles} }`, 0);
22907
- }
22908
- catch (e) { }
22909
- });
23000
+ if (sheet) {
23001
+ if (Object.keys(rules).length) {
23002
+ rules.forEach((rule) => {
23003
+ try {
23004
+ sheet.insertRule(`${rule.selector} { ${rule.styles} }`, 0);
23005
+ }
23006
+ catch (e) { }
23007
+ });
23008
+ }
22910
23009
  }
22911
23010
  }
22912
23011
  }
@@ -24593,6 +24692,9 @@ class StringEditorViewModelBase extends Base {
24593
24692
  this.blurredByEscape = false;
24594
24693
  this.focusedProgram = false;
24595
24694
  this.characterCounter = new CharacterCounter();
24695
+ this.onLocaleChanged = () => {
24696
+ this.resetPropertyValue("placeholderValue");
24697
+ };
24596
24698
  this.activate = () => {
24597
24699
  const element = this.getEditorElement();
24598
24700
  if (element && element.offsetParent != null) {
@@ -24605,6 +24707,7 @@ class StringEditorViewModelBase extends Base {
24605
24707
  this.justFocused = false;
24606
24708
  this.locString = locString;
24607
24709
  this.checkMarkdownToTextConversion(this.locString.owner, this.locString.name);
24710
+ this.addCreatorEvents();
24608
24711
  }
24609
24712
  afterRender() {
24610
24713
  if (this.connector.focusOnEditor) {
@@ -24614,20 +24717,33 @@ class StringEditorViewModelBase extends Base {
24614
24717
  }
24615
24718
  detachFromUI() {
24616
24719
  var _a;
24720
+ this.removeCreatorEvents();
24617
24721
  (_a = this.connector) === null || _a === void 0 ? void 0 : _a.onDoActivate.remove(this.activate);
24618
24722
  this.getEditorElement = undefined;
24619
24723
  this.blurEditor = undefined;
24620
24724
  }
24621
24725
  dispose() {
24726
+ var _a;
24727
+ (_a = this.creator) === null || _a === void 0 ? void 0 : _a.onLocaleChanded.remove(this.onLocaleChanged);
24622
24728
  super.dispose();
24623
24729
  this.detachFromUI();
24624
24730
  }
24731
+ addCreatorEvents() {
24732
+ var _a;
24733
+ (_a = this.creator) === null || _a === void 0 ? void 0 : _a.onLocaleChanded.add(this.onLocaleChanged);
24734
+ }
24735
+ removeCreatorEvents() {
24736
+ var _a;
24737
+ (_a = this.creator) === null || _a === void 0 ? void 0 : _a.onLocaleChanded.remove(this.onLocaleChanged);
24738
+ }
24625
24739
  setLocString(locString) {
24626
24740
  var _a;
24741
+ this.removeCreatorEvents();
24627
24742
  (_a = this.connector) === null || _a === void 0 ? void 0 : _a.onDoActivate.remove(this.activate);
24628
24743
  this.locString = locString;
24629
24744
  this.connector = StringEditorConnector.get(locString);
24630
24745
  this.connector.onDoActivate.add(this.activate);
24746
+ this.addCreatorEvents();
24631
24747
  }
24632
24748
  checkConstraints(event) {
24633
24749
  if (!this.compostionInProgress && this.maxLength > 0 && event.keyCode >= 32) {
@@ -25984,14 +26100,12 @@ class ExpandCollapseManager {
25984
26100
  .concat(this.creator.survey.getAllQuestions());
25985
26101
  }
25986
26102
  updateCollapsed(elements, value, reason) {
25987
- const canToSaveToStateManager = this.creator.designerStateManager && !this.creator.designerStateManager.isSuspended;
25988
26103
  elements.forEach(element => {
26104
+ var _a;
25989
26105
  if (element.isQuestion && this._lockQuestions)
25990
26106
  return;
25991
- if (canToSaveToStateManager) {
25992
- this.creator.designerStateManager.getElementState(element).collapsed =
25993
- this.creator.getElementExpandCollapseState(element, reason, value);
25994
- }
26107
+ const collapsed = this.creator.getElementExpandCollapseState(element, reason, value);
26108
+ (_a = this.creator.designerStateManager) === null || _a === void 0 ? void 0 : _a.setElementCollapsed(element, collapsed);
25995
26109
  });
25996
26110
  for (let i = this.adorners.length - 1; i >= 0; i--) {
25997
26111
  const element = this.adorners[i].element;
@@ -26000,9 +26114,7 @@ class ExpandCollapseManager {
26000
26114
  if (elements.indexOf(element) == -1)
26001
26115
  continue;
26002
26116
  if (this.adorners[i].allowExpandCollapse) {
26003
- let newState = canToSaveToStateManager ?
26004
- this.creator.designerStateManager.getElementState(element).collapsed :
26005
- this.creator.getElementExpandCollapseState(element, reason, value);
26117
+ const newState = this.creator.getElementExpandCollapseState(element, reason, value);
26006
26118
  this.adorners[i].collapsed = newState;
26007
26119
  }
26008
26120
  }
@@ -26051,6 +26163,9 @@ class TabbedMenuContainer extends AdaptiveActionContainer {
26051
26163
  this.creator = creator;
26052
26164
  this.dotsItem.popupModel.horizontalPosition = "center";
26053
26165
  this.dotsItem.popupModel.cssClass += " svc-tabbed-menu-item__popup svc-creator-popup";
26166
+ this.dotsItem.css += " svc-tabbed-menu-dots";
26167
+ this.dotsItem.innerCss += " svc-tabbed-menu-dots__item";
26168
+ this.dotsItem.iconSize = "auto";
26054
26169
  this.hiddenItemsListModel.cssClasses = listComponentCss;
26055
26170
  this.minVisibleItemsCount = 1;
26056
26171
  }
@@ -27230,6 +27345,10 @@ class SurveyCreatorModel extends Base {
27230
27345
  this.onHtmlToMarkdown = this.addCreatorEvent();
27231
27346
  /**
27232
27347
  * An event that is raised when Survey Creator obtains the expand/collapse state of a survey element on the design surface. Handle this event to set a required state.
27348
+ *
27349
+ * For information on event handler parameters, refer to descriptions within the interface.
27350
+ *
27351
+ * [View Demo](https://surveyjs.io/survey-creator/examples/expand-and-collapse-survey-elements/ (linkStyle))
27233
27352
  * @see [ICreatorOptions.collapseQuestions](https://surveyjs.io/survey-creator/documentation/api-reference/icreatoroptions#collapseQuestions)
27234
27353
  * @see [ICreatorOptions.collapsePanels](https://surveyjs.io/survey-creator/documentation/api-reference/icreatoroptions#collapsePanels)
27235
27354
  * @see [ICreatorOptions.collapsePages](https://surveyjs.io/survey-creator/documentation/api-reference/icreatoroptions#collapsePages)
@@ -27624,6 +27743,9 @@ class SurveyCreatorModel extends Base {
27624
27743
  * An event that is raised when users change a property in a [Survey Creator theme](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#creatorTheme).
27625
27744
  */
27626
27745
  this.onCreatorThemePropertyChanged = this.addCreatorEvent();
27746
+ /**
27747
+ * An event that is raised when users select a [Survey Creator theme](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#creatorTheme) from the drop-down list of UI themes.
27748
+ */
27627
27749
  this.onCreatorThemeSelected = this.addCreatorEvent();
27628
27750
  // /**
27629
27751
  // * You need to set this property to true if you want to use tabs instead of accordion in the popup element's editor.
@@ -29326,7 +29448,7 @@ class SurveyCreatorModel extends Base {
29326
29448
  this.currentFocusTimeout = setTimeout(() => {
29327
29449
  this.currentFocusInterval = setInterval(() => {
29328
29450
  var _a, _b;
29329
- const el = document.getElementById(selEl.id);
29451
+ let el = this.getHtmlElementForScroll(selEl);
29330
29452
  if (!!selEl && (focus || startEdit && (!selEl.hasTitle || selEl.isPanel))) {
29331
29453
  if (!el || this.rootElement.getAnimations({ subtree: true }).filter((animation => animation.effect.getComputedTiming().activeDuration !== Infinity && (animation.pending || animation.playState !== "finished")))[0])
29332
29454
  return;
@@ -29343,7 +29465,7 @@ class SurveyCreatorModel extends Base {
29343
29465
  SurveyHelper.scrollIntoViewIfNeeded((_b = el.parentElement) !== null && _b !== void 0 ? _b : el, () => { return scrollIntoViewOptions; }, true);
29344
29466
  }
29345
29467
  }
29346
- if (!propertyName && el.parentElement) {
29468
+ if (!propertyName && el.parentElement && selEl.getType() !== "matrixdropdowncolumn") {
29347
29469
  let elToFocus = (typeof (focus) === "string") ? el.parentElement.querySelector(focus) : el.parentElement;
29348
29470
  elToFocus && elToFocus.focus({ preventScroll: true });
29349
29471
  }
@@ -29358,10 +29480,17 @@ class SurveyCreatorModel extends Base {
29358
29480
  }, 1);
29359
29481
  }, 100);
29360
29482
  }
29483
+ getHtmlElementForScroll(element) {
29484
+ const id = element.getType() === "matrixdropdowncolumn" ? element.colOwner.id : element.id;
29485
+ return document.getElementById(id);
29486
+ }
29361
29487
  getSelectedSurveyElement() {
29362
29488
  var sel = this.selectedElement;
29363
29489
  if (!sel || sel.getType() == "survey")
29364
29490
  return null;
29491
+ if (this.selectedElement.getType() === "matrixdropdowncolumn") {
29492
+ return this.selectedElement;
29493
+ }
29365
29494
  return sel.isInteractiveDesignElement && sel.id ? sel : null;
29366
29495
  }
29367
29496
  onSelectingElement(val) {
@@ -29375,6 +29504,8 @@ class SurveyCreatorModel extends Base {
29375
29504
  }
29376
29505
  /**
29377
29506
  * Opens [Survey Creator theme](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#creatorTheme) settings in Property Grid. Applies only if [`propertyGridNavigationMode`](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#propertyGridNavigationMode) is `"buttons"`.
29507
+ *
29508
+ * [View Demo](https://surveyjs.io/survey-creator/examples/dynamic-ui-customization/ (linkStyle))
29378
29509
  * @see closeCreatorThemeSettings
29379
29510
  * @see showCreatorThemeSettings
29380
29511
  */
@@ -30335,6 +30466,8 @@ class SurveyCreatorModel extends Base {
30335
30466
  }
30336
30467
  /**
30337
30468
  * Applies a specified UI theme to Survey Creator.
30469
+ *
30470
+ * [View Demo](https://surveyjs.io/survey-creator/examples/dynamic-ui-customization/ (linkStyle))
30338
30471
  * @param theme An `ICreatorTheme` object with theme settings.
30339
30472
  * @see creatorTheme
30340
30473
  * @see showCreatorThemeSettings
@@ -31139,18 +31272,6 @@ __decorate([
31139
31272
  ], PageNavigatorViewModel.prototype, "visibleItemsCount", void 0);
31140
31273
 
31141
31274
  class PageAdorner extends SurveyElementAdornerBase {
31142
- updateDragTypeOverMe() {
31143
- var _a;
31144
- if (!this.isDisposed) {
31145
- this.dragTypeOverMe = (_a = this.page) === null || _a === void 0 ? void 0 : _a.dragTypeOverMe;
31146
- }
31147
- }
31148
- updateIsDragMe() {
31149
- var _a;
31150
- if (!this.isDisposed) {
31151
- this.isDragMe = (_a = this.page) === null || _a === void 0 ? void 0 : _a.isDragMe;
31152
- }
31153
- }
31154
31275
  updateShowPlaceholder(visibleRows) {
31155
31276
  this.showPlaceholder = !this.isGhost && (visibleRows || this.page.visibleRows).length === 0;
31156
31277
  }
@@ -31206,15 +31327,12 @@ class PageAdorner extends SurveyElementAdornerBase {
31206
31327
  updateActionVisibility(id, isVisible) {
31207
31328
  super.updateActionVisibility(id, !this.isGhost && isVisible);
31208
31329
  }
31209
- get dragInsideCollapsedContainer() {
31210
- return this.collapsed;
31211
- }
31212
31330
  getAllowExpandCollapse(options) {
31213
31331
  return !this.isGhost && super.getAllowExpandCollapse(options);
31214
31332
  }
31215
31333
  attachElement(surveyElement) {
31216
31334
  super.attachElement(surveyElement);
31217
- this.dragTypeOverMe = null;
31335
+ this.dropIndicatorPosition = null;
31218
31336
  if (!!surveyElement) {
31219
31337
  surveyElement["surveyChangedCallback"] = () => {
31220
31338
  this.isPageLive = !!surveyElement.survey;
@@ -31222,12 +31340,6 @@ class PageAdorner extends SurveyElementAdornerBase {
31222
31340
  if (this.isGhost) {
31223
31341
  this.addGhostPageSubsribes(surveyElement);
31224
31342
  }
31225
- surveyElement.registerFunctionOnPropertiesValueChanged(["dragTypeOverMe"], () => {
31226
- this.updateDragTypeOverMe();
31227
- }, "dragOver");
31228
- surveyElement.registerFunctionOnPropertiesValueChanged(["isDragMe"], () => {
31229
- this.updateIsDragMe();
31230
- }, "dragOver");
31231
31343
  surveyElement.registerFunctionOnPropertiesValueChanged(["visibleRows"], (newValue) => {
31232
31344
  this.updateShowPlaceholder(newValue);
31233
31345
  }, "updatePlaceholder");
@@ -31236,8 +31348,6 @@ class PageAdorner extends SurveyElementAdornerBase {
31236
31348
  surveyElement.updateCustomWidgets();
31237
31349
  surveyElement.setWasShown(true);
31238
31350
  this.checkActionProperties();
31239
- this.dragTypeOverMe = surveyElement.dragTypeOverMe;
31240
- this.isDragMe = surveyElement.isDragMe;
31241
31351
  if (this.creator.pageEditMode !== "single") {
31242
31352
  surveyElement.locTitle.placeholder = () => { return surveyElement.isStartPage ? "pe.startPageTitlePlaceholder" : "pe.pageTitlePlaceholder"; };
31243
31353
  surveyElement.locDescription.placeholder = "pe.pageDescriptionPlaceholder";
@@ -31249,14 +31359,13 @@ class PageAdorner extends SurveyElementAdornerBase {
31249
31359
  delete surveyElement.locTitle.placeholder;
31250
31360
  delete surveyElement.locDescription.placeholder;
31251
31361
  surveyElement.unRegisterFunctionOnPropertiesValueChanged(["elements"], "updatePlaceholder");
31252
- surveyElement.unRegisterFunctionOnPropertiesValueChanged(["dragTypeOverMe", "isDragMe"], "dragOver");
31253
31362
  surveyElement.unRegisterFunctionOnPropertiesValueChanged(["title", "description"], "add_ghost");
31254
31363
  surveyElement.unRegisterFunctionOnPropertiesValueChanged(["visibleRows"], "updatePlaceholder");
31255
31364
  surveyElement["surveyChangedCallback"] = undefined;
31256
31365
  }
31257
31366
  super.detachElement(surveyElement);
31258
31367
  if (!this.isDisposed) {
31259
- this.dragTypeOverMe = null;
31368
+ this.dropIndicatorPosition = null;
31260
31369
  }
31261
31370
  }
31262
31371
  onElementSelectedChanged(isSelected) {
@@ -31305,7 +31414,6 @@ class PageAdorner extends SurveyElementAdornerBase {
31305
31414
  container.sizeMode = "small";
31306
31415
  container.cssClasses = this.containerCssClasses();
31307
31416
  container.dotsItem.iconSize = "auto";
31308
- container.dotsItem.cssClasses.itemIcon += " svc-page-toolbar-item__icon";
31309
31417
  return container;
31310
31418
  }
31311
31419
  createTopActionContainer() {
@@ -31353,53 +31461,32 @@ class PageAdorner extends SurveyElementAdornerBase {
31353
31461
  event.cancelBubble = true;
31354
31462
  }
31355
31463
  get css() {
31356
- let result = super.getCss();
31357
- if (this.dragDropHelper.draggedElement && this.dragDropHelper.draggedElement.isPage) {
31358
- if (this.dragTypeOverMe === DragTypeOverMeEnum.Top) {
31359
- result += " svc-question__content--drag-over-top";
31360
- }
31361
- if (this.dragTypeOverMe === DragTypeOverMeEnum.Bottom) {
31362
- result += " svc-question__content--drag-over-bottom";
31363
- }
31464
+ const isShowAddQuestionButton = !!this.creator && !this.creator.showAddQuestionButton;
31465
+ const isGhostEmpty = this.isGhost && this.creator.survey.pages.length > 0;
31466
+ const isInsideCollapsed = this.dropIndicatorPosition === DropIndicatorPosition.Inside && this.collapsed;
31467
+ let result = new CssClassBuilder()
31468
+ .append(super.getCss())
31469
+ .append("svc-page__content--dragged", this.isBeingDragged)
31470
+ .append("svc-question__content--drag-over-top", this.dropIndicatorPosition === DropIndicatorPosition.Top)
31471
+ .append("svc-question__content--drag-over-bottom", this.dropIndicatorPosition === DropIndicatorPosition.Bottom)
31472
+ .append("svc-page__content--collapsed-drag-over-inside", isInsideCollapsed)
31473
+ .append("svc-question__content--drag-over-inside", this.dropIndicatorPosition === DropIndicatorPosition.Inside && this.showPlaceholder)
31474
+ .append("svc-page--drag-over-empty", this.dropIndicatorPosition === DropIndicatorPosition.Inside && !!isGhostEmpty)
31475
+ .append("svc-page--drag-over-empty-no-add-button", this.dropIndicatorPosition === DropIndicatorPosition.Inside && !!isGhostEmpty && isShowAddQuestionButton)
31476
+ .append("svc-page__content--collapse-" + this.creator.expandCollapseButtonVisibility, this.allowExpandCollapse || !!this.page["isGhost"])
31477
+ .append("svc-page__content--collapsed", (this.allowExpandCollapse || !!this.page["isGhost"]) && (this.renderedCollapsed || !!this.page["isGhost"]))
31478
+ .append("svc-page__content--animation-running", (this.allowExpandCollapse || !!this.page["isGhost"]) && (this.expandCollapseAnimationRunning))
31479
+ .append("svc-page__content--new", !!this.isGhost)
31480
+ .append("svc-page__content--selected", !this.isGhost && !!this.creator.isElementSelected(this.page))
31481
+ .append("svc-page__content--no-header", !this.isGhost && settings$1.designMode.showEmptyTitles === false)
31482
+ .toString();
31483
+ if (isInsideCollapsed) {
31484
+ this.dragIn();
31364
31485
  }
31365
31486
  else {
31366
- if (!!this.dragTypeOverMe && this.showPlaceholder) {
31367
- result = "svc-question__content--drag-over-inside";
31368
- }
31369
- else if (!!this.dragTypeOverMe && this.page.elements.length === 0 && this.creator.survey.pages.length > 0) {
31370
- result = "svc-page--drag-over-empty";
31371
- if (!!this.creator && !this.creator.showAddQuestionButton) {
31372
- result += " svc-page--drag-over-empty-no-add-button";
31373
- }
31374
- }
31375
- if (!!this.dragTypeOverMe && this.collapsed) {
31376
- this.dragIn();
31377
- result += " svc-page__content--collapsed-drag-over-inside";
31378
- }
31379
- else {
31380
- this.dragOut();
31381
- }
31382
- }
31383
- if (this.allowExpandCollapse || this.page["isGhost"]) {
31384
- result += (" svc-page__content--collapse-" + this.creator.expandCollapseButtonVisibility);
31385
- if (this.renderedCollapsed || this.page["isGhost"])
31386
- result += (" svc-page__content--collapsed");
31387
- if (this.expandCollapseAnimationRunning)
31388
- result += (" svc-page__content--animation-running");
31389
- }
31390
- if (this.isDragMe) {
31391
- result += " svc-page__content--dragged";
31392
- }
31393
- if (this.isGhost) {
31394
- return result + " svc-page__content--new";
31395
- }
31396
- if (this.creator.isElementSelected(this.page)) {
31397
- result += " svc-page__content--selected";
31398
- }
31399
- if (settings$1.designMode.showEmptyTitles === false) {
31400
- result += " svc-page__content--no-header";
31487
+ this.dragOut();
31401
31488
  }
31402
- return result.trim();
31489
+ return result;
31403
31490
  }
31404
31491
  hoverStopper(event, element) {
31405
31492
  event["__svc_question_processed"] = true;
@@ -31479,12 +31566,6 @@ __decorate([
31479
31566
  __decorate([
31480
31567
  property({ defaultValue: "" })
31481
31568
  ], PageAdorner.prototype, "currentAddQuestionType", void 0);
31482
- __decorate([
31483
- property({ defaultValue: null })
31484
- ], PageAdorner.prototype, "dragTypeOverMe", void 0);
31485
- __decorate([
31486
- property({ defaultValue: false })
31487
- ], PageAdorner.prototype, "isDragMe", void 0);
31488
31569
  __decorate([
31489
31570
  property({
31490
31571
  onSet(val, target, prevVal) {
@@ -31505,42 +31586,32 @@ class RowViewModel extends Base {
31505
31586
  this.creator = creator;
31506
31587
  this.row = row;
31507
31588
  this.templateData = templateData;
31508
- this.rowDragTypeOverMeChanged = (s, o) => {
31509
- if (o.name == "dragTypeOverMe")
31510
- this.dragTypeOverMe = o.newValue;
31511
- };
31512
- this.dragTypeOverMe = this.row.dragTypeOverMe;
31589
+ if (this.row) {
31590
+ this.row.setPropertyValue(SurveyElementAdornerBase.AdornerValueName, this);
31591
+ }
31513
31592
  }
31514
31593
  subscribeElementChanges() {
31515
- this.row.onPropertyChanged.add(this.rowDragTypeOverMeChanged);
31594
+ this.row.setPropertyValue(SurveyElementAdornerBase.AdornerValueName, this);
31516
31595
  }
31517
31596
  unsubscribeElementChanges() {
31518
- this.row.onPropertyChanged.remove(this.rowDragTypeOverMeChanged);
31597
+ this.row.setPropertyValue(SurveyElementAdornerBase.AdornerValueName, null);
31519
31598
  }
31520
31599
  get cssClasses() {
31521
- let result = "svc-row";
31522
- let ghostClass = " svc-row--ghost";
31523
- if (this.row.elements.length === 1 &&
31524
- this.row.elements[0].name === "sv-drag-drop-ghost-survey-element-name") {
31525
- result += ghostClass;
31526
- }
31527
- if (this.dragTypeOverMe === DragTypeOverMeEnum.Top) {
31528
- result += " svc-row--drag-over-top";
31529
- }
31530
- if (this.dragTypeOverMe === DragTypeOverMeEnum.Bottom) {
31531
- result += " svc-row--drag-over-bottom";
31532
- }
31533
- return result;
31600
+ return new CssClassBuilder()
31601
+ .append("svc-row")
31602
+ .append("svc-row--ghost", this.row.elements.length === 1 && this.row.elements[0].name === "sv-drag-drop-ghost-survey-element-name")
31603
+ .append("svc-row--drag-over-top", this.dropIndicatorPosition === DropIndicatorPosition.Top)
31604
+ .append("svc-row--drag-over-bottom", this.dropIndicatorPosition === DropIndicatorPosition.Bottom)
31605
+ .toString();
31534
31606
  }
31535
31607
  dispose() {
31536
31608
  super.dispose();
31537
31609
  this.unsubscribeElementChanges();
31538
- this.rowDragTypeOverMeChanged = undefined;
31539
31610
  }
31540
31611
  }
31541
31612
  __decorate([
31542
- property()
31543
- ], RowViewModel.prototype, "dragTypeOverMe", void 0);
31613
+ property({ defaultValue: null })
31614
+ ], RowViewModel.prototype, "dropIndicatorPosition", void 0);
31544
31615
 
31545
31616
  class QuestionAdornerViewModel extends SurveyElementAdornerBase {
31546
31617
  constructor(creator, surveyElement, templateData) {
@@ -31599,57 +31670,34 @@ class QuestionAdornerViewModel extends SurveyElementAdornerBase {
31599
31670
  .append("svc-question__adorner--collapse-" + this.creator.expandCollapseButtonVisibility, true).toString();
31600
31671
  }
31601
31672
  css() {
31673
+ const isInsideCollapsed = this.dropIndicatorPosition === DropIndicatorPosition.Inside && this.collapsed;
31602
31674
  if (!this.surveyElement.isInteractiveDesignElement)
31603
31675
  return "";
31604
- let result = "svc-question__content";
31605
- result += typeof this.surveyElement.getType === "function" ? (" svc-question__content--" + this.surveyElement.getType()) : "";
31606
- if (this.creator.isElementSelected(this.surveyElement)) {
31607
- result += " svc-question__content--selected";
31608
- }
31609
- if (this.isEmptyElement) {
31610
- result += " svc-question__content--empty";
31611
- }
31612
- if (this.isEmptyTemplate) {
31613
- result += " svc-question__content--empty-template";
31614
- }
31615
- if (this.renderedCollapsed) {
31616
- result += " svc-question__content--collapsed";
31617
- }
31618
- if (!this.surveyElement.hasTitle || (!this.surveyElement.isPanel && this.surveyElement.getTitleLocation() === "hidden")) {
31619
- result += " svc-question__content--title-hidden";
31620
- }
31621
- if (this.surveyElement.hasTitleOnBottom) {
31622
- result += " svc-question__content--title-bottom";
31623
- }
31624
- if (this.isDragMe) {
31625
- result += " svc-question__content--dragged";
31626
- }
31627
- if (!!this.dragTypeOverMe && (this.canExpandOnDrag) && this.dragInsideCollapsedContainer) {
31676
+ if (isInsideCollapsed) {
31628
31677
  this.dragIn();
31629
- result += " svc-question__content--collapsed-drag-over-inside";
31630
31678
  }
31631
31679
  else {
31632
31680
  this.dragOut();
31633
31681
  }
31634
- if (this.dragTypeOverMe === DragTypeOverMeEnum.InsideEmptyPanel) {
31635
- result += " svc-question__content--drag-over-inside";
31636
- }
31637
- if (!this.dragInsideCollapsedContainer) {
31638
- if (this.dragTypeOverMe === DragTypeOverMeEnum.Left) {
31639
- result += " svc-question__content--drag-over-left";
31640
- }
31641
- if (this.dragTypeOverMe === DragTypeOverMeEnum.Right) {
31642
- result += " svc-question__content--drag-over-right";
31643
- }
31644
- if (this.dragTypeOverMe === DragTypeOverMeEnum.Top) {
31645
- result += " svc-question__content--drag-over-top";
31646
- }
31647
- if (this.dragTypeOverMe === DragTypeOverMeEnum.Bottom) {
31648
- result += " svc-question__content--drag-over-bottom";
31649
- }
31650
- if (this.creator) {
31651
- result = this.creator.getElementAddornerCssCallback(this.surveyElement, result);
31652
- }
31682
+ let result = new CssClassBuilder()
31683
+ .append("svc-question__content")
31684
+ .append("svc-question__content--" + this.surveyElement.getType(), typeof this.surveyElement.getType === "function")
31685
+ .append("svc-question__content--selected", !!this.creator.isElementSelected(this.surveyElement))
31686
+ .append("svc-question__content--empty", this.isEmptyElement)
31687
+ .append("svc-question__content--empty-template", this.isEmptyTemplate)
31688
+ .append("svc-question__content--collapsed", this.renderedCollapsed)
31689
+ .append("svc-question__content--title-hidden", !this.surveyElement.hasTitle || (!this.surveyElement.isPanel && this.surveyElement.getTitleLocation() === "hidden"))
31690
+ .append("svc-question__content--title-bottom", !!this.surveyElement.hasTitleOnBottom)
31691
+ .append("svc-question__content--dragged", this.isBeingDragged)
31692
+ .append("svc-question__content--collapsed-drag-over-inside", isInsideCollapsed)
31693
+ .append("svc-question__content--drag-over-inside", this.dropIndicatorPosition === DropIndicatorPosition.Inside && !this.collapsed)
31694
+ .append("svc-question__content--drag-over-top", this.dropIndicatorPosition === DropIndicatorPosition.Top)
31695
+ .append("svc-question__content--drag-over-bottom", this.dropIndicatorPosition === DropIndicatorPosition.Bottom)
31696
+ .append("svc-question__content--drag-over-right", this.dropIndicatorPosition === DropIndicatorPosition.Right)
31697
+ .append("svc-question__content--drag-over-left", this.dropIndicatorPosition === DropIndicatorPosition.Left)
31698
+ .toString();
31699
+ if (!isInsideCollapsed && this.creator) {
31700
+ result = this.creator.getElementAddornerCssCallback(this.surveyElement, result);
31653
31701
  }
31654
31702
  return result;
31655
31703
  }
@@ -31686,15 +31734,9 @@ class QuestionAdornerViewModel extends SurveyElementAdornerBase {
31686
31734
  }
31687
31735
  expandWithDragIn() {
31688
31736
  super.expandWithDragIn();
31689
- this.element.dragTypeOverMe = null;
31737
+ this.dropIndicatorPosition = null;
31690
31738
  this.creator.dragDropSurveyElements.dropTarget = null;
31691
31739
  }
31692
- get isDragMe() {
31693
- return this.surveyElement.isDragMe;
31694
- }
31695
- get dragTypeOverMe() {
31696
- return this.element.dragTypeOverMe;
31697
- }
31698
31740
  get isBannerShowing() {
31699
31741
  return this.isUsingCarryForward || this.isUsingRestfull || this.isMessagePanelVisible;
31700
31742
  }
@@ -31816,7 +31858,6 @@ class QuestionAdornerViewModel extends SurveyElementAdornerBase {
31816
31858
  actionContainer.sizeMode = "small";
31817
31859
  actionContainer.cssClasses = defaultCssClasses;
31818
31860
  actionContainer.dotsItem.css += " svc-survey-element-toolbar__dots-item";
31819
- actionContainer.dotsItem.innerCss += " svc-survey-element-toolbar__item";
31820
31861
  return actionContainer;
31821
31862
  }
31822
31863
  updateActionsPropertiesCore() {
@@ -32041,20 +32082,25 @@ class QuestionAdornerViewModel extends SurveyElementAdornerBase {
32041
32082
  let selectedAction;
32042
32083
  let selectedSubaction = undefined;
32043
32084
  let selectedSubactions = undefined;
32085
+ const toolboxItemToAction = (item, needSeparator = false) => {
32086
+ return this.creator.createIActionBarItemByClass(item, needSeparator, (questionType, json) => { this.convertQuestion(questionType, json, defaultJsons); });
32087
+ };
32044
32088
  availableItems.forEach((item) => {
32045
32089
  var _a;
32046
32090
  const needSeparator = lastItem && item.category != lastItem.category;
32047
- const action = this.creator.createIActionBarItemByClass(item, needSeparator, (questionType, json) => { this.convertQuestion(questionType, json, defaultJsons); });
32091
+ const action = toolboxItemToAction(item, needSeparator);
32048
32092
  if (this.toolboxItemIsCorresponded(item, !!selectedAction)) {
32049
32093
  selectedAction = action;
32050
- selectedSubactions = item.items;
32094
+ if (item.items) {
32095
+ selectedSubactions = item.items.map(subitem => toolboxItemToAction(subitem));
32096
+ }
32051
32097
  }
32052
32098
  if (((_a = item.items) === null || _a === void 0 ? void 0 : _a.length) > 0 && this.creator.toolbox.showSubitems) {
32053
32099
  const subactions = [];
32054
32100
  let selectedSubactionLocal = undefined;
32055
32101
  let allChildsAreCompatibleToParent = false;
32056
32102
  item.items.forEach(subitem => {
32057
- const subaction = this.creator.createIActionBarItemByClass(subitem, false, (questionType, json) => { this.convertQuestion(questionType, json, defaultJsons); });
32103
+ const subaction = toolboxItemToAction(subitem);
32058
32104
  if (this.toolboxItemIsCorresponded(subitem, !!selectedAction))
32059
32105
  selectedSubactionLocal = subitem;
32060
32106
  if (this.jsonsAreCompatible(item.json, subitem.json))
@@ -32062,7 +32108,7 @@ class QuestionAdornerViewModel extends SurveyElementAdornerBase {
32062
32108
  subactions.push(subaction);
32063
32109
  });
32064
32110
  if (!allChildsAreCompatibleToParent && subactions.length > 0) {
32065
- const defaultSubaction = this.creator.createIActionBarItemByClass(item, false, (questionType, json) => { this.convertQuestion(questionType, json, defaultJsons); });
32111
+ const defaultSubaction = toolboxItemToAction(item);
32066
32112
  defaultSubaction.id = action.id + "-default";
32067
32113
  defaultSubaction.iconName = undefined;
32068
32114
  defaultSubaction.markerIconName = undefined;
@@ -32224,9 +32270,8 @@ class QuestionAdornerViewModel extends SurveyElementAdornerBase {
32224
32270
  items.push(inputTypeConverter);
32225
32271
  }
32226
32272
  items[items.length - 1].css += " svc-dropdown-action--convertTo-last";
32227
- if (typeof element["isRequired"] !== "undefined" &&
32228
- propertyExists(element, "isRequired") &&
32229
- isPropertyVisible(element, "isRequired")) {
32273
+ if (typeof element["isRequired"] !== "undefined" && !!element.getType
32274
+ && SurveyHelper.isPropertyVisible(element, Serializer.findProperty(element.getType(), "isRequired"), this.creator)) {
32230
32275
  items.push(this.createRequiredAction());
32231
32276
  }
32232
32277
  }
@@ -32963,7 +33008,8 @@ class MatrixCellWrapperViewModel extends Base {
32963
33008
  componentName: "svc-question-editor-content",
32964
33009
  data: {
32965
33010
  survey: editSurvey.survey,
32966
- creator: this.creator
33011
+ creator: this.creator,
33012
+ style: designTabSurveyThemeJSON.cssVariables
32967
33013
  },
32968
33014
  onApply: () => {
32969
33015
  editSurvey.apply();
@@ -33321,7 +33367,6 @@ QuestionFactory.Instance.registerQuestion("linkvalue", (name) => {
33321
33367
  class ScrollViewModel {
33322
33368
  constructor() {
33323
33369
  this._lockScroll = false;
33324
- //this.dragTypeOverMe = this.row.dragTypeOverMe;
33325
33370
  }
33326
33371
  setRootElement(element) {
33327
33372
  this._containerElementValue = element === null || element === void 0 ? void 0 : element.querySelector(".svc-scroll__scroller");
@@ -34118,15 +34163,16 @@ class FastEntryEditorBase extends PropertyEditorSetupValue {
34118
34163
  collectNames(item, type, separatorCounter) {
34119
34164
  let text = "";
34120
34165
  this.names.forEach((name) => {
34166
+ let str = undefined;
34121
34167
  if (type === "itemvalues") {
34122
34168
  if (name == "value")
34123
34169
  return;
34124
- var str = name == "text" ? item.pureText : item[name];
34170
+ str = name == "text" ? item.pureText : item[name];
34125
34171
  }
34126
34172
  else {
34127
- var str = item[name];
34173
+ str = item[name];
34128
34174
  }
34129
- if (!!str) {
34175
+ if (!Helpers.isValueEmpty(str)) {
34130
34176
  for (var i = 0; i < separatorCounter; i++) {
34131
34177
  text += ItemValue.Separator;
34132
34178
  }
@@ -34391,10 +34437,9 @@ class PropertyGridEditorMatrix extends PropertyGridEditor {
34391
34437
  if (!!prop && !!prop.className) {
34392
34438
  var properties = Serializer.getProperties(prop.className);
34393
34439
  for (var i = 0; i < properties.length; i++) {
34394
- if (!this.isPropertyShownInList(properties[i])) {
34395
- continue;
34440
+ if (SurveyHelper.isPropertyVisible(undefined, properties[i], undefined, "list")) {
34441
+ res.push(properties[i].name);
34396
34442
  }
34397
- res.push(properties[i].name);
34398
34443
  }
34399
34444
  }
34400
34445
  return res.length > 0 ? res : this.getDefaulColumnNames();
@@ -34402,9 +34447,6 @@ class PropertyGridEditorMatrix extends PropertyGridEditor {
34402
34447
  getDefaulColumnNames() {
34403
34448
  return [];
34404
34449
  }
34405
- isPropertyShownInList(prop) {
34406
- return prop.visible && prop.showMode !== "form";
34407
- }
34408
34450
  getObjTypeName() {
34409
34451
  return "";
34410
34452
  }
@@ -34759,7 +34801,7 @@ class PropertyGridEditorMatrixPages extends PropertyGridEditorMatrix {
34759
34801
  return "name";
34760
34802
  }
34761
34803
  getBaseValue(prop) {
34762
- return "page";
34804
+ return editorLocalization.getString("ed.newPageName");
34763
34805
  }
34764
34806
  getAllowRowDragDrop(prop) { return true; }
34765
34807
  }
@@ -35016,14 +35058,14 @@ class PropertyGridEditorBindings extends PropertyGridEditor {
35016
35058
  onCreated(obj, question, prop, options) {
35017
35059
  question.contentPanel.fromJSON({ elements: this.getQuestions(obj, options) });
35018
35060
  question.valueFromDataCallback = (value) => {
35019
- if (!value && obj.bindings.getNames().length > 0) {
35020
- const result = {};
35021
- for (const bindingName of obj.bindings.getNames()) {
35022
- result[bindingName] = obj.bindings.getValueNameByPropertyName(bindingName);
35061
+ const keys = obj.bindings.getNames();
35062
+ const result = {};
35063
+ if (keys.length > 0) {
35064
+ for (const key of keys) {
35065
+ result[key] = !!value ? value[key] : obj.bindings.getValueNameByPropertyName(key);
35023
35066
  }
35024
- return result;
35025
35067
  }
35026
- return value;
35068
+ return result;
35027
35069
  };
35028
35070
  }
35029
35071
  getQuestions(obj, options) {
@@ -35717,8 +35759,8 @@ class CreatorPreset extends CreatorPresetBase {
35717
35759
  }
35718
35760
 
35719
35761
  let Version;
35720
- Version = `${"2.0.0"}`;
35721
- checkLibraryVersion(`${"2.0.0"}`, "survey-creator-core");
35762
+ Version = `${"2.0.1"}`;
35763
+ checkLibraryVersion(`${"2.0.1"}`, "survey-creator-core");
35722
35764
 
35723
- export { AceJsonEditorModel, ColorCalculator, CreatorAction, CreatorBase, CreatorEvent, CreatorPreset, CreatorPresetBase, CreatorPresetPropertyGrid, CreatorPresetPropertyGridDefinition, CreatorPresetTabs, CreatorPresetToolbox, CreatorPresetToolboxConfigurator, CreatorPresetToolboxDefinition, CreatorResponsivityManager, CreatorThemeModel, CreatorThemes, DEFAULT_MONITOR_DPI, DefaultFonts, DragDropSurveyElements, EditorLocalization, EmptySurveyCreatorOptions, FooterToolbarActionContainer, HEXToRGB, HSBToRGB, HueColorCalculator, ImageItemValueWrapperViewModel, ItemValueWrapperViewModel, JsonDuplicateNameError, JsonEditorBaseModel, LogicEvent, LogoImageViewModel, MatrixCellWrapperEditSurvey, MatrixCellWrapperViewModel, MenuButton, ObjType, ObjectSelector, ObjectSelectorItem, ObjectSelectorModel, PageAdorner, PageNavigatorViewModel, PagesController, PredefinedBackgroundColors, PredefinedColors, PredefinedCreatorThemes, PredefinedThemes, PropertyEditorSetupValue, PropertyGridCellsEditor, PropertyGridEditor, PropertyGridEditorBackgroundCornerRadius, PropertyGridEditorBindings, PropertyGridEditorBoolean, PropertyGridEditorCollection, PropertyGridEditorColor, PropertyGridEditorColorWithAlpha, PropertyGridEditorCondition, PropertyGridEditorDateTime, PropertyGridEditorDropdown, PropertyGridEditorExpression, PropertyGridEditorFontSettings, PropertyGridEditorHtml, PropertyGridEditorImageSize, PropertyGridEditorMatrix, PropertyGridEditorMatrixCalculatedValues, PropertyGridEditorMatrixColumns, PropertyGridEditorMatrixHtmlConditions, PropertyGridEditorMatrixItemValues, PropertyGridEditorMatrixLayoutColumns, PropertyGridEditorMatrixMultipleTypes, PropertyGridEditorMatrixMutlipleTextItems, PropertyGridEditorMatrixPages, PropertyGridEditorMatrixRateValues, PropertyGridEditorMatrixTriggers, PropertyGridEditorMatrixUrlConditions, PropertyGridEditorMatrixValidators, PropertyGridEditorNumber, PropertyGridEditorPage, PropertyGridEditorQuestion, PropertyGridEditorQuestionCarryForward, PropertyGridEditorQuestionHeader, PropertyGridEditorQuestionMaskSettings, PropertyGridEditorQuestionRestfull, PropertyGridEditorQuestionSelectBase, PropertyGridEditorQuestionValue, PropertyGridEditorSet, PropertyGridEditorShadowEffects, PropertyGridEditorSpinEdit, PropertyGridEditorString, PropertyGridEditorStringArray, PropertyGridEditorStringBase, PropertyGridEditorSwitchToggle, PropertyGridEditorText, PropertyGridEditorUndefinedBoolean, PropertyGridLinkEditor, PropertyGridModel, PropertyGridPanelValueEditor, PropertyGridRowValueEditor, PropertyGridTitleActionsCreator, PropertyGridTriggerValueEditor, PropertyGridTriggerValueInLogicEditor, PropertyGridValueEditor, PropertyGridValueEditorBase, PropertyGridViewModel, PropertyJSONGenerator, QuestionAdornerViewModel, QuestionColorModel, QuestionCommentWithResetModel, QuestionConvertMode, QuestionConverter, QuestionDropdownAdornerViewModel, QuestionEmbeddedSurveyModel, QuestionFileEditorModel, QuestionImageAdornerViewModel, QuestionLinkValueModel, QuestionRatingAdornerViewModel, QuestionSpinEditorModel, QuestionTextWithResetModel, QuestionToolbox, QuestionToolboxCategory, QuestionToolboxItem, RGBToHSB, ResetValueAdorner, ResizeManager, RowViewModel, ScrollViewModel, SearchManager, SearchManagerPropertyGrid, SearchManagerToolbox, SidebarHeaderModel, SidebarModel, SidebarPageModel, StringEditorConnector, StringEditorViewModelBase, StringItemsNavigatorBase, SurveyCreatorModel, SurveyHelper, SurveyJSON5, SurveyLogic, SurveyLogicUI, SurveyQuestionEditorDefinition, SurveyQuestionEditorPropertyDefinition, SurveyQuestionEditorTabDefinition, SurveyQuestionProperties, SurveyResultsItemModel, SurveyResultsModel, SurveySimulatorModel, SurveyTextWorker, SurveyTextWorkerError, SurveyTextWorkerJsonError, SurveyTextWorkerParserError, Switcher, TabControlModel, TabDesignerPlugin, TabDesignerViewModel, TabJsonEditorAcePlugin, TabJsonEditorBasePlugin, TabJsonEditorTextareaPlugin, TabLogicPlugin, TabTestPlugin, TabTranslationPlugin, TabbedMenuContainer, TabbedMenuItem, TestSurveyTabViewModel, TextareaJsonEditorModel, ThemeModelEditorDefinition, ThemeTabPlugin, ThemeTabViewModel, Themes, ToolbarActionContainer, ToolboxToolViewModel, Transaction, Translation, TranslationEditor, TranslationForEditor, TranslationGroup, TranslationItem, TranslationItemBase, TranslationItemString, UndoRedoAction, UndoRedoArrayAction, UndoRedoManager, UndoRedoPlugin, Version, assign, assignDefaultClasses, backgroundCornerRadiusFromCssVariable, backgroundCornerRadiusToCssVariable, calculateDragOverLocation, calculateIsEdge, calculateIsSide, capitalize, clearNewLines, colorsAreEqual, convertRgbaToString, copyCssClasses, copyObject, createBoxShadow, createBoxShadowReset, createColor, createExportCSVAction, createImportCSVAction, creatorThemeModelEditorDefinition, creatorThemeModelPropertyGridDefinition, defaultCreatorThemesOrder, defaultPropertyGridDefinition, defaultStrings, defaultThemesOrder, editableStringRendererName, editorLocalization, enStrings, findParentNode, focusFirstControl, fontsettingsFromCssVariable, fontsettingsToCssVariable, getAcceptedTypesByContentMode, getElementWrapperComponentData, getElementWrapperComponentName, getFirstNonTextElement, getItemValueWrapperComponentData, getItemValueWrapperComponentName, getLocString, getNextItemText, getNextItemValue, getNextValue, getNodesFromKoComponentInfo, getOS, getPredefinedBackgoundColorsChoices, getPredefinedColorsItemValues, getQuestionContentWrapperComponentName, getQuestionFromObj, getRGBaChannelValues, iconsV1, iconsV2, ignoreUndoRedo, imageMimeTypes, ingectAlpha, initLogicOperator, initialSettingsAllowShowEmptyTitleInDesignMode, initializeDesignTimeSurveyModel, isPanelDynamic, isPropertyVisible, isStringEditable, isTextInput, listComponentCss, editorLocalization as localization, logicCss, notShortCircuitAnd, parseBoxShadow, parseColor, parseRgbaFromString, propertyExists, propertyGridCss, registerAdorner, registerCreatorTheme, registerSurveyTheme, removeAdorners, roundTo2Decimals, saveToFileHandler, scrollElementIntoView, select, setSurveyJSONForPropertyGrid, settings, setupLocale, simulatorDevices, svgBundle, themeModelPropertyGridDefinition, toggleHovered, translationCss, trimBoxShadowValue, trimEmptyFields, undoRedoTransaction, updateBackgroundCornerRadiusJSON, updateFontSettingsJSON, updateShadowEffectsJSON, updatecoloralphaJSON, wrapTextByCurlyBraces };
35765
+ export { AceJsonEditorModel, ColorCalculator, CreatorAction, CreatorBase, CreatorEvent, CreatorPreset, CreatorPresetBase, CreatorPresetPropertyGrid, CreatorPresetPropertyGridDefinition, CreatorPresetTabs, CreatorPresetToolbox, CreatorPresetToolboxConfigurator, CreatorPresetToolboxDefinition, CreatorResponsivityManager, CreatorThemeModel, CreatorThemes, DEFAULT_MONITOR_DPI, DefaultFonts, DragDropSurveyElements, EditorLocalization, EmptySurveyCreatorOptions, FooterToolbarActionContainer, HEXToRGB, HSBToRGB, HueColorCalculator, ImageItemValueWrapperViewModel, ItemValueWrapperViewModel, JsonDuplicateNameError, JsonEditorBaseModel, LogicEvent, LogoImageViewModel, MatrixCellWrapperEditSurvey, MatrixCellWrapperViewModel, MenuButton, ObjType, ObjectSelector, ObjectSelectorItem, ObjectSelectorModel, PageAdorner, PageNavigatorViewModel, PagesController, PredefinedBackgroundColors, PredefinedColors, PredefinedCreatorThemes, PredefinedThemes, PropertyEditorSetupValue, PropertyGridCellsEditor, PropertyGridEditor, PropertyGridEditorBackgroundCornerRadius, PropertyGridEditorBindings, PropertyGridEditorBoolean, PropertyGridEditorCollection, PropertyGridEditorColor, PropertyGridEditorColorWithAlpha, PropertyGridEditorCondition, PropertyGridEditorDateTime, PropertyGridEditorDropdown, PropertyGridEditorExpression, PropertyGridEditorFontSettings, PropertyGridEditorHtml, PropertyGridEditorImageSize, PropertyGridEditorMatrix, PropertyGridEditorMatrixCalculatedValues, PropertyGridEditorMatrixColumns, PropertyGridEditorMatrixHtmlConditions, PropertyGridEditorMatrixItemValues, PropertyGridEditorMatrixLayoutColumns, PropertyGridEditorMatrixMultipleTypes, PropertyGridEditorMatrixMutlipleTextItems, PropertyGridEditorMatrixPages, PropertyGridEditorMatrixRateValues, PropertyGridEditorMatrixTriggers, PropertyGridEditorMatrixUrlConditions, PropertyGridEditorMatrixValidators, PropertyGridEditorNumber, PropertyGridEditorPage, PropertyGridEditorQuestion, PropertyGridEditorQuestionCarryForward, PropertyGridEditorQuestionHeader, PropertyGridEditorQuestionMaskSettings, PropertyGridEditorQuestionRestfull, PropertyGridEditorQuestionSelectBase, PropertyGridEditorQuestionValue, PropertyGridEditorSet, PropertyGridEditorShadowEffects, PropertyGridEditorSpinEdit, PropertyGridEditorString, PropertyGridEditorStringArray, PropertyGridEditorStringBase, PropertyGridEditorSwitchToggle, PropertyGridEditorText, PropertyGridEditorUndefinedBoolean, PropertyGridLinkEditor, PropertyGridModel, PropertyGridPanelValueEditor, PropertyGridRowValueEditor, PropertyGridTitleActionsCreator, PropertyGridTriggerValueEditor, PropertyGridTriggerValueInLogicEditor, PropertyGridValueEditor, PropertyGridValueEditorBase, PropertyGridViewModel, PropertyJSONGenerator, QuestionAdornerViewModel, QuestionColorModel, QuestionCommentWithResetModel, QuestionConvertMode, QuestionConverter, QuestionDropdownAdornerViewModel, QuestionEmbeddedSurveyModel, QuestionFileEditorModel, QuestionImageAdornerViewModel, QuestionLinkValueModel, QuestionRatingAdornerViewModel, QuestionSpinEditorModel, QuestionTextWithResetModel, QuestionToolbox, QuestionToolboxCategory, QuestionToolboxItem, RGBToHSB, ResetValueAdorner, ResizeManager, RowViewModel, ScrollViewModel, SearchManager, SearchManagerPropertyGrid, SearchManagerToolbox, SidebarHeaderModel, SidebarModel, SidebarPageModel, StringEditorConnector, StringEditorViewModelBase, StringItemsNavigatorBase, SurveyCreatorModel, SurveyHelper, SurveyJSON5, SurveyLogic, SurveyLogicUI, SurveyQuestionEditorDefinition, SurveyQuestionEditorPropertyDefinition, SurveyQuestionEditorTabDefinition, SurveyQuestionProperties, SurveyResultsItemModel, SurveyResultsModel, SurveySimulatorModel, SurveyTextWorker, SurveyTextWorkerError, SurveyTextWorkerJsonError, SurveyTextWorkerParserError, Switcher, TabControlModel, TabDesignerPlugin, TabDesignerViewModel, TabJsonEditorAcePlugin, TabJsonEditorBasePlugin, TabJsonEditorTextareaPlugin, TabLogicPlugin, TabTestPlugin, TabTranslationPlugin, TabbedMenuContainer, TabbedMenuItem, TestSurveyTabViewModel, TextareaJsonEditorModel, ThemeModelEditorDefinition, ThemeTabPlugin, ThemeTabViewModel, Themes, ToolbarActionContainer, ToolboxToolViewModel, Transaction, Translation, TranslationEditor, TranslationForEditor, TranslationGroup, TranslationItem, TranslationItemBase, TranslationItemString, UndoRedoAction, UndoRedoArrayAction, UndoRedoManager, UndoRedoPlugin, Version, assign, assignDefaultClasses, backgroundCornerRadiusFromCssVariable, backgroundCornerRadiusToCssVariable, calculateDragOverLocation, calculateIsEdge, calculateIsSide, capitalize, clearNewLines, colorsAreEqual, convertRgbaToString, copyCssClasses, copyObject, createBoxShadow, createBoxShadowReset, createColor, createExportCSVAction, createImportCSVAction, creatorThemeModelEditorDefinition, creatorThemeModelPropertyGridDefinition, defaultCreatorThemesOrder, defaultPropertyGridDefinition, defaultStrings, defaultThemesOrder, editableStringRendererName, editorLocalization, enStrings, findParentNode, focusFirstControl, fontsettingsFromCssVariable, fontsettingsToCssVariable, getAcceptedTypesByContentMode, getElementWrapperComponentData, getElementWrapperComponentName, getFirstNonTextElement, getItemValueWrapperComponentData, getItemValueWrapperComponentName, getLocString, getLocaleStrings, getNextItemText, getNextItemValue, getNextValue, getNodesFromKoComponentInfo, getOS, getPredefinedBackgoundColorsChoices, getPredefinedColorsItemValues, getQuestionContentWrapperComponentName, getQuestionFromObj, getRGBaChannelValues, iconsV1, iconsV2, ignoreUndoRedo, imageMimeTypes, ingectAlpha, initLogicOperator, initialSettingsAllowShowEmptyTitleInDesignMode, initializeDesignTimeSurveyModel, isStringEditable, isTextInput, listComponentCss, editorLocalization as localization, logicCss, notShortCircuitAnd, parseBoxShadow, parseColor, parseRgbaFromString, propertyGridCss, registerAdorner, registerCreatorTheme, registerSurveyTheme, removeAdorners, roundTo2Decimals, saveToFileHandler, scrollElementIntoView, select, setSurveyJSONForPropertyGrid, settings, setupLocale, simulatorDevices, svgBundle, themeModelPropertyGridDefinition, toggleHovered, translationCss, trimBoxShadowValue, trimEmptyFields, undoRedoTransaction, updateBackgroundCornerRadiusJSON, updateFontSettingsJSON, updateShadowEffectsJSON, updatecoloralphaJSON, wrapTextByCurlyBraces };
35724
35766
  //# sourceMappingURL=survey-creator-core.js.map