survey-creator-js 3.0.0-beta.3 → 3.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,15 @@
1
1
  /*!
2
- * SurveyJS Creator v3.0.0-beta.3
2
+ * SurveyJS Creator v3.0.0-beta.4
3
3
  * (c) 2015-2026 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
- import * as React from 'react';
9
- import { createElement, Fragment } from 'react';
10
- import { ReactElementFactory, SurveyElementBase, attachKey2click, SvgIcon, Survey, SvgBundleComponent, PopupModal, SurveyActionBar, NotifierComponent, ReactQuestionFactory, SurveyLocStringViewer, TitleElement, ReactSurveyElementsWrapper, LoadingIndicatorComponent, SurveyPage, Popup, LogoImage, SurveyQuestionElementBase, SurveyQuestion, SurveyPanel, Scroll, CharacterCounterComponent, SurveyQuestionDropdown, SurveyHeader, List, SurveyQuestionText } from 'survey-react-ui';
11
- import { assign, SurveyCreatorModel, RowViewModel, QuestionAdornerViewModel, QuestionDropdownAdornerViewModel, QuestionImageAdornerViewModel, QuestionRatingAdornerViewModel, PageAdorner, LogoImageViewModel, editorLocalization, ItemValueWrapperViewModel, ImageItemValueWrapperViewModel, MatrixCellWrapperViewModel, SurveyResultsModel, ToolboxToolViewModel, editableStringRendererName, StringEditorViewModelBase, initLogicOperator, PageNavigatorViewModel } from 'survey-creator-core';
8
+ import * as React from 'survey-js-ui';
9
+ import { ReactElementFactory, SurveyElementBase, attachKey2click, SvgIcon, Survey, SvgBundleComponent, PopupModal, SurveyActionBar, NotifierComponent, ReactQuestionFactory, SurveyLocStringViewer, TitleElement, ReactSurveyElementsWrapper, LoadingIndicatorComponent, SurveyPage, LogoImage, SurveyQuestionElementBase, SurveyQuestion, SurveyPanel, createElement, Popup, Scroll, CharacterCounterComponent, SurveyQuestionDropdown, SurveyHeader, List, Fragment, SurveyQuestionText, preact } from 'survey-js-ui';
10
+ import { assign, SurveyCreatorModel, RowViewModel, QuestionAdornerViewModel, QuestionDropdownAdornerViewModel, QuestionImageAdornerViewModel, QuestionRatingAdornerViewModel, PageAdorner, PanelAdornerViewModel, LogoImageViewModel, editorLocalization, ItemValueWrapperViewModel, ImageItemValueWrapperViewModel, MatrixCellWrapperViewModel, SurveyResultsModel, ToolboxToolViewModel, editableStringRendererName, StringEditorViewModelBase, initLogicOperator, PageNavigatorViewModel } from 'survey-creator-core';
12
11
  export { PropertyGridEditorCollection, SurveyLogic, SurveyLogicUI, SurveyQuestionEditorDefinition, ToolboxToolViewModel, editorLocalization, localization, settings, svgBundle } from 'survey-creator-core';
13
- import * as ReactDOM from 'react-dom';
14
12
  import { CssClassBuilder, settings, RendererFactory, unwrap, checkLibraryVersion } from 'survey-core';
15
- import { preact } from 'survey-js-ui';
16
13
 
17
14
  class TabbedMenuComponent extends SurveyElementBase {
18
15
  get model() {
@@ -65,10 +62,10 @@ class TabbedMenuItemWrapper extends SurveyElementBase {
65
62
  if (this.item.css) {
66
63
  css += " " + this.item.css;
67
64
  }
68
- css += (!this.item.isVisible ? " sv-action--hidden" : "");
65
+ css += (!this.item.isVisible ? " svc-tabbed-menu-item-container--hidden" : "");
69
66
  const component = ReactElementFactory.Instance.createElement(this.item.component || "svc-tabbed-menu-item", { item: this.item });
70
67
  return (React.createElement("span", { key: this.item.id, className: css, ref: this.ref },
71
- React.createElement("div", { className: "sv-action__content" }, component)));
68
+ React.createElement("div", { className: "svc-tabbed-menu-item-container__content" }, component)));
72
69
  }
73
70
  componentDidMount() {
74
71
  super.componentDidMount();
@@ -82,8 +79,8 @@ class TabbedMenuItemWrapper extends SurveyElementBase {
82
79
  }
83
80
  };
84
81
  queueMicrotask(() => {
85
- if (ReactDOM["flushSync"]) {
86
- ReactDOM["flushSync"](() => {
82
+ if (React["flushSync"]) {
83
+ React["flushSync"](() => {
87
84
  update();
88
85
  });
89
86
  }
@@ -206,7 +203,8 @@ class SurveyCreatorComponent extends SurveyElementBase {
206
203
  : ReactElementFactory.Instance.createElement(tab.componentContent, {
207
204
  creator: creator,
208
205
  survey: creator.survey,
209
- data: tab.data.model
206
+ data: tab.data.model,
207
+ model: tab.data.model
210
208
  });
211
209
  const className = "svc-creator-tab" + (creator.toolboxLocation == "right" ? " svc-creator__toolbox--right" : "");
212
210
  return (React.createElement("div", { role: "tabpanel", key: tab.id, id: "scrollableDiv-" + tab.id, "aria-labelledby": "tab-" + tab.id, className: className }, component));
@@ -599,8 +597,9 @@ class QuestionDropdownAdornerComponent extends QuestionAdornerComponent {
599
597
  isChecked: this.question.value === item.value
600
598
  }), this.question, item))))),
601
599
  this.dropdownModel.needToCollapse ?
602
- React.createElement(ActionButton, { click: this.dropdownModel.switchCollapse, text: this.dropdownModel.getButtonText(), allowBubble: true }) :
603
- null)));
600
+ ReactElementFactory.Instance.createElement("sv-action-bar-item", {
601
+ item: this.dropdownModel.collapseAction,
602
+ }) : null)));
604
603
  }
605
604
  }
606
605
  ReactElementFactory.Instance.registerElement("svc-dropdown-question", (props) => {
@@ -631,8 +630,7 @@ class QuestionImageAdornerComponent extends QuestionAdornerComponent {
631
630
  React.createElement(LoadingIndicatorComponent, null))));
632
631
  }
633
632
  renderChooseButton() {
634
- return (React.createElement("div", { className: "svc-image-question-controls" }, this.model.allowEdit ? attachKey2click(React.createElement("span", { className: "svc-context-button", onClick: () => this.imageModel.chooseFile(this.imageModel) },
635
- React.createElement(SvgIcon, { size: "auto", iconName: "icon-choosefile" }))) : null));
633
+ return React.createElement(SurveyActionBar, { model: this.imageModel.imageActionsContainer });
636
634
  }
637
635
  renderElementPlaceholder() {
638
636
  return this.imageModel.isUploading ? this.renderLoadingPlaceholder() : this.renderChooseButton();
@@ -683,11 +681,7 @@ class QuestionRatingAdornerComponent extends CreatorModelElement {
683
681
  const model = this.ratingModel;
684
682
  return (React.createElement(React.Fragment, null,
685
683
  React.createElement("div", { className: "svc-rating-question-content" },
686
- React.createElement("div", { className: model.controlsClassNames },
687
- model.allowRemove ? attachKey2click(React.createElement("span", { role: "button", className: model.removeClassNames, "aria-label": model.removeTooltip, onClick: () => model.removeItem(model) },
688
- React.createElement(SvgIcon, { size: "auto", iconName: "icon-remove_16x16", title: model.removeTooltip }))) : null,
689
- model.allowAdd ? attachKey2click(React.createElement("span", { role: "button", className: model.addClassNames, "aria-label": model.addTooltip, onClick: () => model.addItem(model) },
690
- React.createElement(SvgIcon, { size: "auto", iconName: "icon-add_16x16", title: model.addTooltip }))) : null),
684
+ React.createElement(SurveyActionBar, { model: model.rateActionsContainer }),
691
685
  this.props.element)));
692
686
  }
693
687
  }
@@ -860,31 +854,24 @@ ReactElementFactory.Instance.registerElement("svc-page", (props) => {
860
854
 
861
855
  class AddQuestionButtonComponent extends SurveyElementBase {
862
856
  get model() {
863
- return this.props.item.data;
857
+ return this.item.data;
858
+ }
859
+ get item() {
860
+ return this.props.item;
861
+ }
862
+ getStateElement() {
863
+ return this.item;
864
864
  }
865
865
  renderTypeSelector() {
866
- const questionTypeSelectorModel = this.model.questionTypeSelectorModel;
867
- return attachKey2click(React.createElement("button", { type: "button", onClick: (e) => {
868
- e.stopPropagation();
869
- questionTypeSelectorModel.action();
870
- }, className: "svc-element__question-type-selector", title: this.model.addNewQuestionText, role: "button" },
871
- React.createElement("span", { className: "svc-element__question-type-selector-icon" },
872
- React.createElement(SvgIcon, { iconName: questionTypeSelectorModel.iconName, size: "auto", title: this.model.addNewQuestionText })),
873
- this.props.renderPopup === undefined || this.props.renderPopup ?
874
- React.createElement(Popup, { model: questionTypeSelectorModel.popupModel })
875
- : null));
866
+ return React.createElement("div", { className: this.item.cssClasses.itemTypeSelector }, ReactElementFactory.Instance.createElement("sv-action-bar-item-dropdown", { item: this.model.questionTypeSelectorModel }));
876
867
  }
877
868
  renderElement() {
878
- const addButtonClass = this.props.buttonClass || "svc-btn";
879
- return React.createElement(React.Fragment, null,
880
- attachKey2click(React.createElement("div", { className: "svc-element__add-new-question " + addButtonClass, onClick: (e) => {
881
- e.stopPropagation();
882
- this.model.addNewQuestion(this.model, new ReactMouseEvent(e));
883
- }, onMouseOver: (e) => this.model.hoverStopper && this.model.hoverStopper(e.nativeEvent, e.currentTarget) },
884
- React.createElement(SvgIcon, { className: "svc-panel__add-new-question-icon", iconName: "icon-add_24x24", size: "auto" }),
885
- React.createElement("span", { className: "svc-add-new-item-button__text" }, this.model.addNewQuestionText),
886
- this.props.renderPopup !== false ? this.renderTypeSelector() : null)),
887
- this.props.renderPopup === false ? this.renderTypeSelector() : null);
869
+ return React.createElement(React.Fragment, null, attachKey2click(React.createElement("div", { className: this.item.getActionBarItemCss(), onClick: (e) => {
870
+ e.stopPropagation();
871
+ this.model.addNewQuestion(this.model, new ReactMouseEvent(e));
872
+ }, onMouseOver: (e) => this.model.hoverStopper && this.model.hoverStopper(e.nativeEvent, e.currentTarget) },
873
+ React.createElement("span", { className: this.item.getActionBarItemTitleCss() }, this.model.addNewQuestionText),
874
+ this.renderTypeSelector())));
888
875
  }
889
876
  }
890
877
  ReactElementFactory.Instance.registerElement("svc-add-new-question-btn", (props) => {
@@ -899,23 +886,17 @@ class PanelAdornerComponent extends QuestionAdornerComponent {
899
886
  return (React.createElement("div", { className: "svc-panel__placeholder_frame-wrapper" },
900
887
  React.createElement("div", { className: "svc-panel__placeholder_frame" },
901
888
  React.createElement("div", { className: "svc-panel__placeholder" }, this.model.placeholderText),
902
- this.model.showAddQuestionButton ? attachKey2click(React.createElement("div", { className: "svc-panel__add-new-question svc-action-button", onClick: (e) => {
903
- e.stopPropagation();
904
- this.model.addNewQuestion();
905
- } },
906
- React.createElement(SvgIcon, { className: "svc-panel__add-new-question-icon", iconName: "icon-add_24x24", size: "auto" }),
907
- React.createElement("span", { className: "svc-add-new-item-button__text" }, this.model.addNewQuestionText))) : null)));
889
+ this.model.showAddQuestionButton ? React.createElement(SurveyActionBar, { model: this.model.addQuestionActionsContainer }) : null)));
908
890
  }
909
891
  disableTabStop() {
910
892
  return true;
911
893
  }
894
+ createQuestionViewModel(props) {
895
+ return new PanelAdornerViewModel(props.componentData, props.question, null);
896
+ }
912
897
  renderFooter() {
913
898
  return (React.createElement(React.Fragment, null,
914
- !this.model.isEmptyElement && this.model.element.isPanel && this.model.showAddQuestionButton ? (React.createElement("div", { className: "svc-panel__add-new-question-container" },
915
- React.createElement("div", { className: "svc-panel__question-type-selector-popup" },
916
- React.createElement(Popup, { model: this.model.questionTypeSelectorModel.popupModel })),
917
- React.createElement("div", { className: "svc-panel__add-new-question-wrapper" },
918
- React.createElement(AddQuestionButtonComponent, { item: { data: this.model }, buttonClass: "svc-action-button", renderPopup: false })))) : null,
899
+ !this.model.isEmptyElement && this.model.element.isPanel && this.model.showAddQuestionButton ? (React.createElement(SurveyActionBar, { model: this.model.addQuestionActionsContainer, handleClick: false })) : null,
919
900
  super.renderFooter()));
920
901
  }
921
902
  }
@@ -945,18 +926,8 @@ class LogoImageComponent extends CreatorModelElement {
945
926
  super.componentDidMount();
946
927
  this.model.root = this.rootRef.current;
947
928
  }
948
- renderChooseButton() {
949
- return attachKey2click(React.createElement("span", { className: "svc-context-button", onClick: () => this.model.chooseFile(this.model) },
950
- React.createElement(SvgIcon, { size: "auto", iconName: "icon-choosefile" })));
951
- }
952
- renderClearButton() {
953
- return attachKey2click(React.createElement("span", { className: "svc-context-button svc-context-button--danger", onClick: () => this.model.remove(this.model) },
954
- React.createElement(SvgIcon, { size: "auto", iconName: "icon-clear" })));
955
- }
956
929
  renderButtons() {
957
- return (React.createElement("div", { className: "svc-context-container svc-logo-image-controls" },
958
- this.renderChooseButton(),
959
- this.renderClearButton()));
930
+ return React.createElement(SurveyActionBar, { model: this.model.actionsContainer });
960
931
  }
961
932
  renderImage() {
962
933
  return React.createElement("div", { className: this.model.containerCss },
@@ -1117,18 +1088,18 @@ class ItemValueAdornerComponent extends CreatorModelElement {
1117
1088
  super.componentWillUnmount();
1118
1089
  this.props.item.setRootElement(undefined);
1119
1090
  }
1091
+ renderButton(action) {
1092
+ return ReactElementFactory.Instance.createElement("sv-action-bar-item", {
1093
+ item: action,
1094
+ });
1095
+ }
1120
1096
  render() {
1121
1097
  this.model.item = this.props.item;
1122
- const button = this.model.allowAdd ? (attachKey2click(React.createElement("span", { role: "button", className: "svc-item-value-controls__button svc-item-value-controls__add", "aria-label": this.model.tooltip, onClick: () => {
1123
- this.model.add(this.model);
1124
- this.model.isNew = false;
1125
- } },
1126
- React.createElement(SvgIcon, { size: "auto", iconName: "icon-add_16x16", title: this.model.tooltip })))) : (React.createElement(React.Fragment, null,
1098
+ const button = this.model.allowAdd ? (this.renderButton(this.model.addAction)) : (React.createElement(React.Fragment, null,
1127
1099
  " ",
1128
- this.model.isDraggable ? (React.createElement("span", { className: "svc-item-value-controls__button svc-item-value-controls__drag" },
1100
+ this.model.isDraggable ? (React.createElement("span", { className: "svc-item-value-controls__drag" },
1129
1101
  React.createElement(SvgIcon, { className: "svc-item-value-controls__drag-icon", size: "auto", iconName: "icon-drag-24x24", title: this.model.dragTooltip }))) : null,
1130
- this.model.allowRemove ? attachKey2click(React.createElement("span", { role: "button", className: "svc-item-value-controls__button svc-item-value-controls__remove", "aria-label": this.model.tooltip, onClick: () => this.model.remove(this.model) },
1131
- React.createElement(SvgIcon, { size: "auto", iconName: "icon-remove_16x16", title: this.model.tooltip }))) : null));
1102
+ this.model.allowRemove ? this.renderButton(this.model.removeAction) : null));
1132
1103
  const itemkey = this.props.element.key + (this.model.allowAdd ? "_new" : "");
1133
1104
  return (React.createElement(React.Fragment, null,
1134
1105
  React.createElement("div", { ref: this.rootRef, className: "svc-item-value-wrapper" +
@@ -1146,16 +1117,11 @@ class ItemValueAdornerComponent extends CreatorModelElement {
1146
1117
  renderPanelAction() {
1147
1118
  if (!this.model.canShowPanel())
1148
1119
  return null;
1149
- const isShowPanel = this.model.showPanel;
1150
- const icName = isShowPanel ? "icon-collapsepanel-16x16" : "icon-expandpanel-16x16";
1151
- const btn = attachKey2click(React.createElement("span", { role: "button", className: "svc-item-value-controls__button svc-item-value-controls__add svc-choice-elements-button", onClick: () => {
1152
- this.model.togglePanel();
1153
- } },
1154
- React.createElement(SvgIcon, { size: "auto", iconName: icName })));
1120
+ const btn = this.renderButton(this.model.expandPanelAction);
1155
1121
  return React.createElement("div", { className: "svc-item-value-controls svc-choice-elements-button-container" }, btn);
1156
1122
  }
1157
1123
  renderPanel() {
1158
- if (!this.model.showPanel)
1124
+ if (!this.model.renderedShowPanel)
1159
1125
  return null;
1160
1126
  const creator = this.model.creator;
1161
1127
  const survey = creator.survey;
@@ -1203,13 +1169,11 @@ class ImageItemValueAdornerComponent extends CreatorModelElement {
1203
1169
  React.createElement(LoadingIndicatorComponent, null));
1204
1170
  }
1205
1171
  renderNewItemControls() {
1206
- const addButton = attachKey2click(React.createElement("span", { className: this.model.addButtonCss, onClick: () => this.model.chooseNewFile(this.model) }, this.model.showChooseButtonAsIcon ?
1207
- React.createElement(SvgIcon, { size: "auto", iconName: "icon-add-lg", title: this.model.addFileTitle }) :
1208
- React.createElement("span", null, this.model.chooseImageText)));
1172
+ const controls = React.createElement(SurveyActionBar, { model: this.model.actionsContainer });
1209
1173
  const placeholder = this.model.showPlaceholder ? React.createElement("span", { className: "svc-image-item-value__placeholder" }, this.model.placeholderText) : null;
1210
1174
  return React.createElement(React.Fragment, null,
1211
1175
  placeholder,
1212
- addButton);
1176
+ controls);
1213
1177
  }
1214
1178
  render() {
1215
1179
  this.model.item = this.props.item;
@@ -1230,17 +1194,7 @@ class ImageItemValueAdornerComponent extends CreatorModelElement {
1230
1194
  else {
1231
1195
  content = (React.createElement(React.Fragment, null,
1232
1196
  React.createElement("div", { className: "svc-image-item-value__item" }, this.props.element),
1233
- this.model.isDraggable && this.model.canRenderControls ?
1234
- React.createElement("span", { className: "svc-context-button svc-image-item-value-controls__drag-area-indicator", onPointerDown: (event) => this.model.onPointerDown(event) },
1235
- React.createElement(SvgIcon, { size: "auto", iconName: "icon-drag-24x24" }))
1236
- : null,
1237
- this.model.canRenderControls ?
1238
- React.createElement("div", { className: "svc-context-container svc-image-item-value-controls" },
1239
- this.model.allowRemove && !this.model.isUploading ? attachKey2click(React.createElement("span", { className: "svc-context-button", onClick: () => this.model.chooseFile(this.model) },
1240
- React.createElement(SvgIcon, { role: "button", size: "auto", iconName: "icon-choosefile", title: this.model.selectFileTitle }))) : null,
1241
- this.model.allowRemove && !this.model.isUploading ? attachKey2click(React.createElement("span", { className: "svc-context-button svc-context-button--danger", onClick: () => this.model.remove(this.model) },
1242
- React.createElement(SvgIcon, { role: "button", size: "auto", iconName: "icon-delete", title: this.model.removeFileTitle }))) : null)
1243
- : null));
1197
+ this.model.canRenderControls ? React.createElement(SurveyActionBar, { model: this.model.topActionsContainer }) : null));
1244
1198
  }
1245
1199
  return (React.createElement("div", { ref: this.rootRef, className: this.model.getRootCss(), key: this.props.element.key, "data-sv-drop-target-item-value": this.model.isDraggable ? this.model.item.value : undefined, onPointerDown: (event) => this.model.onPointerDown(event), onDragStart: this.preventDragHandler, onDrop: this.model.onDrop, onDragEnter: this.model.onDragEnter, onDragOver: this.model.onDragOver, onDragLeave: this.model.onDragLeave },
1246
1200
  React.createElement("div", { className: "svc-image-item-value-wrapper__ghost", style: imageStyle }),
@@ -1255,6 +1209,15 @@ class ImageItemValueAdornerComponent extends CreatorModelElement {
1255
1209
  content)));
1256
1210
  }
1257
1211
  }
1212
+ class ImageItemDragAction extends SurveyElementBase {
1213
+ renderElement() {
1214
+ return React.createElement("span", { className: this.props.item.getActionBarItemCss(), onPointerDown: (event) => this.props.item.data.model.onPointerDown(event) },
1215
+ React.createElement(SvgIcon, { size: "auto", iconName: this.props.item.iconName, className: this.props.item.cssClasses.itemIcon }));
1216
+ }
1217
+ }
1218
+ ReactElementFactory.Instance.registerElement("svc-image-item-drag-action", (props) => {
1219
+ return React.createElement(ImageItemDragAction, props);
1220
+ });
1258
1221
  ReactElementFactory.Instance.registerElement("svc-image-item-value", (props) => {
1259
1222
  return React.createElement(ImageItemValueAdornerComponent, props);
1260
1223
  });
@@ -1288,8 +1251,9 @@ class MatrixCellAdornerComponent extends CreatorModelElement {
1288
1251
  render() {
1289
1252
  let controls = null;
1290
1253
  if (!!this.model.isSupportCellEditor) {
1291
- controls = React.createElement("div", { className: "svc-matrix-cell__question-controls" }, attachKey2click(React.createElement("span", { className: "svc-matrix-cell__question-controls-button svc-context-button", onClick: (event) => this.model.editQuestion(this.model, event) },
1292
- React.createElement(SvgIcon, { size: "auto", iconName: "icon-edit" }))));
1254
+ controls = React.createElement("div", { className: "svc-matrix-cell__question-controls" }, ReactElementFactory.Instance.createElement("sv-action-bar-item", {
1255
+ item: this.model.editAction,
1256
+ }));
1293
1257
  }
1294
1258
  return (React.createElement("div", { className: "svc-matrix-cell", tabIndex: -1, key: this.props.element.key, onClick: (e) => !this.props.question && this.model.selectContext(this.model, e), onMouseOut: e => this.model.hover(e.nativeEvent, e.currentTarget), onMouseOver: e => this.model.hover(e.nativeEvent, e.currentTarget) },
1295
1259
  React.createElement("div", { className: "svc-matrix-cell--selected" + (this.model.isSelected ? " svc-visible" : "") }),
@@ -1407,7 +1371,7 @@ class SurveyCreatorToolboxTool extends CreatorModelElement {
1407
1371
  });
1408
1372
  return (React.createElement("div", { className: item.css, key: item.id, ref: this.rootRef },
1409
1373
  (item.needSeparator && !this.creator.toolbox.showCategoryTitles) ? (React.createElement("div", { className: "svc-toolbox__category-separator" })) : null,
1410
- React.createElement("div", { className: "svc-toolbox__tool-content sv-action__content", onPointerDown: (event) => {
1374
+ React.createElement("div", { className: "svc-toolbox__tool-content", onPointerDown: (event) => {
1411
1375
  event.persist();
1412
1376
  this.model.onPointerDown(event);
1413
1377
  } }, itemComponent)));
@@ -1420,8 +1384,8 @@ class SurveyCreatorToolboxTool extends CreatorModelElement {
1420
1384
  super.componentDidMount();
1421
1385
  this.item.updateModeCallback = (mode, callback) => {
1422
1386
  queueMicrotask(() => {
1423
- if (ReactDOM["flushSync"]) {
1424
- ReactDOM["flushSync"](() => {
1387
+ if (React["flushSync"]) {
1388
+ React["flushSync"](() => {
1425
1389
  this.item.mode = mode;
1426
1390
  });
1427
1391
  }
@@ -1779,11 +1743,10 @@ class TabButtonComponent extends SurveyElementBase {
1779
1743
  const model = this.props.model;
1780
1744
  if (!model.visible)
1781
1745
  return null;
1782
- const button = attachKey2click(React.createElement("div", { className: model.buttonClassName, title: model.tooltip, onClick: () => { model.action(); } },
1783
- React.createElement("div", { className: "svc-menu-action__icon" },
1784
- React.createElement("div", { className: "svc-menu-action__icon-container" },
1785
- React.createElement(SvgIcon, { iconName: model.iconName, size: "auto" })))), model);
1786
- return (React.createElement("div", { className: "svc-menu-action" }, button));
1746
+ const itemComponent = ReactElementFactory.Instance.createElement(this.props.model.component || "sv-action-bar-item", {
1747
+ item: this.props.model,
1748
+ });
1749
+ return (React.createElement("div", { className: "svc-sidebar-tabs__item" }, itemComponent));
1787
1750
  }
1788
1751
  }
1789
1752
 
@@ -1856,7 +1819,7 @@ class SideBarPropertyGridHeader extends SurveyElementBase {
1856
1819
  return this.objectSelectionAction;
1857
1820
  }
1858
1821
  renderElement() {
1859
- const button = attachKey2click(React.createElement("div", { className: this.objectSelectionAction.buttonClassName, onClick: () => this.objectSelectionAction.action() },
1822
+ const button = attachKey2click(React.createElement("div", { className: this.objectSelectionAction.getActionBarItemCss() + " svc-sidebar__header-object-selector", onClick: () => this.objectSelectionAction.action() },
1860
1823
  React.createElement("div", { className: "svc-sidebar__header-caption" },
1861
1824
  React.createElement("span", { className: "svc-sidebar__header-title" }, this.objectSelectionAction.title),
1862
1825
  React.createElement("span", { className: "svc-sidebar__header-subtitle" }, this.objectSelectionAction.tooltip))), this.props.model);
@@ -1954,6 +1917,26 @@ ReactElementFactory.Instance.registerElement("svc-side-bar", (props) => {
1954
1917
  return React.createElement(SidebarComponent, props);
1955
1918
  });
1956
1919
 
1920
+ class SideBarLaunchCard extends React.Component {
1921
+ render() {
1922
+ const model = this.props.model;
1923
+ if (!model)
1924
+ return null;
1925
+ return (React.createElement("div", { className: "spg-launch" },
1926
+ React.createElement("button", { className: "spg-launch__card", onClick: model.onClick },
1927
+ React.createElement("div", { className: "spg-launch__container" },
1928
+ React.createElement("div", { className: "spg-launch__text" }, model.title),
1929
+ React.createElement("div", { className: "spg-launch__text2" }, model.description)),
1930
+ React.createElement("div", { className: "spg-launch__icon" },
1931
+ React.createElement("div", { className: "spg-launch__chevron-right-16-x-16" },
1932
+ React.createElement("div", { className: "spg-launch__icon2" },
1933
+ React.createElement(SvgIcon, { size: "auto", iconName: "chevrondown-24x24" })))))));
1934
+ }
1935
+ }
1936
+ ReactElementFactory.Instance.registerElement("svc-side-bar-launch-card", (props) => {
1937
+ return React.createElement(SideBarLaunchCard, props);
1938
+ });
1939
+
1957
1940
  class TranslationLineSkeleton extends React.Component {
1958
1941
  render() {
1959
1942
  return (React.createElement("div", { className: "sd-translation-line-skeleton" }));
@@ -2194,10 +2177,8 @@ class SurveyPageNavigator extends CreatorModelElement {
2194
2177
  }
2195
2178
  componentDidMount() {
2196
2179
  super.componentDidMount();
2197
- if (this.props.pageEditMode !== "bypage") {
2198
- const el = this.containerRef.current;
2199
- this.model.attachToUI(el);
2200
- }
2180
+ const el = this.containerRef.current;
2181
+ this.model.attachToUI(el);
2201
2182
  }
2202
2183
  componentWillUnmount() {
2203
2184
  super.componentWillUnmount();
@@ -2205,14 +2186,8 @@ class SurveyPageNavigator extends CreatorModelElement {
2205
2186
  this.model.setScrollableContainer(undefined);
2206
2187
  }
2207
2188
  renderElement() {
2208
- let className = "svc-page-navigator__selector svc-page-navigator__button";
2209
- if (this.model.isPopupOpened)
2210
- className += " svc-page-navigator__button--pressed";
2211
2189
  return (React.createElement("div", { className: "svc-page-navigator", ref: this.containerRef, style: { display: this.model.visible ? "flex" : "none" } },
2212
- React.createElement("div", null,
2213
- attachKey2click(React.createElement("div", { role: "button", className: className, onClick: () => this.model.togglePageSelector(), title: this.model.pageSelectorCaption },
2214
- React.createElement(SvgIcon, { className: "svc-page-navigator__button-icon", iconName: this.model.icon, size: "auto", title: this.model.pageSelectorCaption }))),
2215
- React.createElement(Popup, { model: this.model.popupModel })),
2190
+ React.createElement("div", null, ReactElementFactory.Instance.createElement("sv-action-bar-item-dropdown", { item: this.model.selectorAction })),
2216
2191
  React.createElement("div", null, this.model.visibleItems.map((item) => (React.createElement(SurveyPageNavigatorItem, { key: item.id, item: item }))))));
2217
2192
  }
2218
2193
  }
@@ -2471,25 +2446,6 @@ ReactElementFactory.Instance.registerElement("svc-tab-json-editor-ace", (props)
2471
2446
  return React.createElement(TabJsonEditorAceComponent, props);
2472
2447
  });
2473
2448
 
2474
- class TabLogicAddButtonComponent extends SurveyElementBase {
2475
- get model() {
2476
- return this.props.button;
2477
- }
2478
- getStateElement() {
2479
- return this.model;
2480
- }
2481
- renderElement() {
2482
- const buttonClassName = "svc-logic-tab__content-action svc-btn" + ((this.model.enabled !== undefined && !this.model.enabled) ? " svc-logic-tab__content-action--disabled" : "");
2483
- return attachKey2click(React.createElement("div", { role: "button", onClick: (e) => {
2484
- e.stopPropagation();
2485
- this.model.action();
2486
- }, className: buttonClassName, title: this.model.title },
2487
- React.createElement("span", { className: "svc-btn__text" }, this.model.title)));
2488
- }
2489
- }
2490
- ReactElementFactory.Instance.registerElement("svc-tab-logic-add-button", (props) => {
2491
- return React.createElement(TabLogicAddButtonComponent, props);
2492
- });
2493
2449
  class TabLogicComponent extends SurveyElementBase {
2494
2450
  get model() {
2495
2451
  return this.props.data;
@@ -2505,21 +2461,26 @@ class TabLogicComponent extends SurveyElementBase {
2505
2461
  }
2506
2462
  renderViewContent() {
2507
2463
  const logicTabClassName = "svc-plugin-tab__content svc-logic-tab svc-logic-tab__content " + (this.model.hasItems ? "" : "svc-logic-tab--empty");
2508
- const addLogic = !this.model.readOnly ? React.createElement(TabLogicAddButtonComponent, { button: this.model.addNewButton }) : undefined;
2464
+ const actions = !this.model.readOnly ? React.createElement(SurveyActionBar, { model: this.model.contentActionsContainer }) : undefined;
2509
2465
  return (React.createElement(Fragment, null,
2510
2466
  React.createElement("div", { className: logicTabClassName }, this.model.hasItems ?
2511
2467
  (React.createElement(React.Fragment, null,
2512
2468
  React.createElement(Survey, { model: this.model.itemsSurvey }),
2513
- addLogic))
2469
+ actions))
2514
2470
  : (React.createElement("div", { className: "svc-logic-tab__content-empty" },
2515
2471
  React.createElement(SurfacePlaceholder, { name: "logic", placeholderTitleText: this.model.placeholderTitleText, placeholderDescriptionText: this.model.placeholderDescriptionText }),
2516
- addLogic)))));
2472
+ actions)))));
2517
2473
  }
2518
2474
  }
2519
2475
  ReactElementFactory.Instance.registerElement("svc-tab-logic", (props) => {
2520
2476
  return React.createElement(TabLogicComponent, props);
2521
2477
  });
2522
2478
 
2479
+ function simulatorShellStyle(overlayHeight) {
2480
+ return overlayHeight
2481
+ ? { ["--sv-popup-overlay-height"]: overlayHeight }
2482
+ : {};
2483
+ }
2523
2484
  class SurveySimulator extends SurveyElementBase {
2524
2485
  get model() {
2525
2486
  return this.props.model;
@@ -2527,8 +2488,21 @@ class SurveySimulator extends SurveyElementBase {
2527
2488
  getStateElement() {
2528
2489
  return this.model;
2529
2490
  }
2491
+ componentDidMount() {
2492
+ super.componentDidMount();
2493
+ this.model.queueSurveyLayoutRefresh();
2494
+ }
2495
+ componentDidUpdate(prevProps, prevState) {
2496
+ super.componentDidUpdate(prevProps, prevState);
2497
+ this.model.queueSurveyLayoutRefresh();
2498
+ }
2499
+ componentWillUnmount() {
2500
+ this.model.cancelSurveyLayoutRefresh();
2501
+ super.componentWillUnmount();
2502
+ }
2530
2503
  renderElement() {
2531
2504
  const mainSimulatorClass = this.model.getRootCss();
2505
+ const shellStyle = simulatorShellStyle(this.model.popupOverlayHeight);
2532
2506
  if (!this.model.survey) {
2533
2507
  return React.createElement("div", { className: mainSimulatorClass });
2534
2508
  }
@@ -2545,36 +2519,17 @@ class SurveySimulator extends SurveyElementBase {
2545
2519
  this.model.simulatorFrame.scale +
2546
2520
  ") translate(-50%, -50%)"
2547
2521
  } },
2548
- React.createElement("div", { className: "svd-simulator-content" },
2522
+ React.createElement("div", { className: "svd-simulator-content", style: shellStyle },
2549
2523
  React.createElement(Survey, { model: this.model.survey }))))));
2550
2524
  }
2551
2525
  else {
2552
2526
  return (React.createElement("div", { className: mainSimulatorClass },
2553
- React.createElement("div", { className: "svd-simulator-content" },
2527
+ React.createElement("div", { className: "svd-simulator-content", style: shellStyle },
2554
2528
  React.createElement(Survey, { model: this.model.survey }))));
2555
2529
  }
2556
2530
  }
2557
2531
  }
2558
2532
 
2559
- class TabPreviewTestSurveyAgainComponent extends SurveyElementBase {
2560
- get model() {
2561
- return this.props.model.testAgainAction;
2562
- }
2563
- getStateElement() {
2564
- return this.model;
2565
- }
2566
- renderElement() {
2567
- const buttonClassName = "svc-preview__test-again svc-btn";
2568
- return attachKey2click(React.createElement("div", { role: "button", onClick: (e) => {
2569
- e.stopPropagation();
2570
- this.model.action();
2571
- }, className: buttonClassName, title: this.model.title },
2572
- React.createElement("span", { className: "svc-btn__text" }, this.model.title)));
2573
- }
2574
- }
2575
- ReactElementFactory.Instance.registerElement("svc-complete-page", (props) => {
2576
- return React.createElement(TabPreviewTestSurveyAgainComponent, props);
2577
- });
2578
2533
  class TabPreviewSurveyComponent extends SurveyElementBase {
2579
2534
  constructor(props) {
2580
2535
  super(props);
@@ -2594,7 +2549,7 @@ class TabPreviewSurveyComponent extends SurveyElementBase {
2594
2549
  this.model.showResults ? React.createElement(SurveyResults, { survey: this.model.simulator.survey }) : null));
2595
2550
  }
2596
2551
  renderElement() {
2597
- const tabContentClassName = "svc-creator-tab__content svc-test-tab__content" + (this.model.isPageToolbarVisible ? " svc-creator-tab__content--with-toolbar" : "");
2552
+ const tabContentClassName = "svc-creator-tab__content svc-test-tab__content " + this.model.tabContentAdditionalCss;
2598
2553
  return (React.createElement("div", { className: tabContentClassName },
2599
2554
  this.model.simulator.survey.isEmpty ? this.renderPlaceholder() : this.renderSimulator(),
2600
2555
  this.getBottomToolbar()));
@@ -2644,7 +2599,7 @@ class TabThemeSurveyComponent extends SurveyElementBase {
2644
2599
  this.model.showResults ? React.createElement(SurveyResults, { survey: this.model.simulator.survey }) : null));
2645
2600
  }
2646
2601
  renderElement() {
2647
- const tabContentClassName = "svc-creator-tab__content svc-test-tab__content" + (this.model.isPageToolbarVisible ? " svc-creator-tab__content--with-toolbar" : "");
2602
+ const tabContentClassName = "svc-creator-tab__content svc-test-tab__content " + this.model.tabContentAdditionalCss;
2648
2603
  return (React.createElement("div", { className: tabContentClassName },
2649
2604
  this.model.simulator.survey.isEmpty ? this.renderPlaceholder() : this.renderSimulator(),
2650
2605
  this.getBottomToolbar()));
@@ -2737,15 +2692,37 @@ class ComponentContainer extends React.Component {
2737
2692
  super(props);
2738
2693
  }
2739
2694
  render() {
2740
- return (React.createElement("div", { className: this.props.model.cssClass }, this.props.model.elements.map((element, index) => {
2695
+ const children = this.props.model.elements.map((element, index) => {
2741
2696
  return ReactElementFactory.Instance.createElement(element.componentName, Object.assign(Object.assign({}, element.componentData), { key: index }));
2742
- })));
2697
+ });
2698
+ const inner = this.props.model.scrollable ? React.createElement(Scroll, null,
2699
+ " ",
2700
+ children,
2701
+ " ") : children;
2702
+ return (this.props.model.wrapped ? React.createElement("div", { className: this.props.model.cssClass },
2703
+ " ",
2704
+ inner,
2705
+ " ") : React.createElement(React.Fragment, null, inner));
2743
2706
  }
2744
2707
  }
2745
2708
  ReactElementFactory.Instance.registerElement("svc-component-container", (props) => {
2746
2709
  return React.createElement(ComponentContainer, props);
2747
2710
  });
2748
2711
 
2712
+ class IconItem extends React.Component {
2713
+ render() {
2714
+ const item = this.props.item;
2715
+ if (!item)
2716
+ return null;
2717
+ return (React.createElement("div", { className: "svc-icon-item" },
2718
+ React.createElement(SvgIcon, { className: "svc-icon-item__icon", size: "auto", iconName: item.value }),
2719
+ React.createElement("span", { className: "svc-icon-item__text" }, item.title)));
2720
+ }
2721
+ }
2722
+ ReactElementFactory.Instance.registerElement("svc-presets-icon-item", (props) => {
2723
+ return React.createElement(IconItem, props);
2724
+ });
2725
+
2749
2726
  class SwitcherComponent extends SurveyElementBase {
2750
2727
  get item() {
2751
2728
  return this.props.item;
@@ -2789,6 +2766,24 @@ ReactElementFactory.Instance.registerElement("json-error-item", (props) => {
2789
2766
  return React.createElement(ItemTemplateComponent$1, props);
2790
2767
  });
2791
2768
 
2769
+ class TabContainerComponent extends SurveyElementBase {
2770
+ constructor(props) {
2771
+ super(props);
2772
+ }
2773
+ getStateElement() {
2774
+ return this.model;
2775
+ }
2776
+ get model() {
2777
+ return this.props.data;
2778
+ }
2779
+ renderElement() {
2780
+ return React.createElement(ComponentContainer, { model: this.model.containerModel });
2781
+ }
2782
+ }
2783
+ ReactElementFactory.Instance.registerElement("svc-tab-container", (props) => {
2784
+ return React.createElement(TabContainerComponent, props);
2785
+ });
2786
+
2792
2787
  class SurveyQuestionSpinEditor extends SurveyQuestionText {
2793
2788
  constructor(props) {
2794
2789
  super(props);
@@ -2949,8 +2944,8 @@ ReactQuestionFactory.Instance.registerQuestion("sv-boolean-switch", (props) => {
2949
2944
  RendererFactory.Instance.registerRenderer("boolean", "switch", "sv-boolean-switch");
2950
2945
 
2951
2946
  let Version;
2952
- Version = `${"3.0.0-beta.3"}`;
2953
- checkLibraryVersion(`${"3.0.0-beta.3"}`, "survey-creator-react");
2947
+ Version = `${"3.0.0-beta.4"}`;
2948
+ checkLibraryVersion(`${"3.0.0-beta.4"}`, "survey-creator-react");
2954
2949
 
2955
2950
  function renderSurveyCreator(creator, element, props = {}) {
2956
2951
  let node = element;
@@ -2979,5 +2974,5 @@ if (typeof window !== "undefined") {
2979
2974
  }
2980
2975
  }
2981
2976
 
2982
- export { ActionButton, AdaptiveToolbox, CellQuestionAdornerComponent, CellQuestionDropdownAdornerComponent, ComponentContainer, CreatorSurveyPageComponent, ImageItemValueAdornerComponent, ItemValueAdornerComponent, LogoImageComponent, MatrixCellAdornerComponent, PanelAdornerComponent, PropertyGridComponent, PropertyGridPlaceholderComponent, QuestionAdornerComponent, QuestionBanner, QuestionDropdownAdornerComponent, QuestionEditorContentComponent, QuestionErrorComponent, QuestionImageAdornerComponent, QuestionRatingAdornerComponent, QuestionWidgetAdornerComponent, QuestionWrapperFooter, QuestionWrapperHeader, ReactDragEvent, ReactMouseEvent, RowWrapper, SearchComponent, SideBarDefaultHeader, SidebarComponent, SurveyCreator, SurveyCreatorComponent, SurveyCreatorToolboxCategory, SurveyCreatorToolboxItem, SurveyCreatorToolboxItemGroup, SurveyCreatorToolboxTool, SurveyElementEmbeddedSurvey, SurveyLocStringEditor, SurveyLogicOpertor, SurveyNavigation, SurveyQuestionBooleanSwitch, SurveyQuestionColor, SurveyQuestionFileEditor, SurveyQuestionFileEditorButton, SurveyQuestionLinkValue, SurveyQuestionSpinEditor, SurveyResults, SurveyResultsByRow, SurveySimulator, SurveySpinEditorButton, SwitcherComponent, TabButtonComponent, TabDesignerComponent, TabJsonEditorAceComponent, TabJsonEditorErrorsComponent, TabJsonEditorTextareaComponent, TabLogicAddButtonComponent, TabLogicComponent, TabPreviewSurveyComponent, TabPreviewTestSurveyAgainComponent, TabThemeSurveyComponent, TabTranslationComponent, TabbedMenuComponent, TabbedMenuItemComponent, ToolboxList, TranslateFromAction, TranslationLineSkeleton, Version, renderSurveyCreator };
2977
+ export { ActionButton, AdaptiveToolbox, AddQuestionButtonComponent, CellQuestionAdornerComponent, CellQuestionDropdownAdornerComponent, ComponentContainer, CreatorSurveyPageComponent, IconItem, ImageItemValueAdornerComponent, ItemValueAdornerComponent, LogoImageComponent, MatrixCellAdornerComponent, PanelAdornerComponent, PropertyGridComponent, PropertyGridPlaceholderComponent, QuestionAdornerComponent, QuestionBanner, QuestionDropdownAdornerComponent, QuestionEditorContentComponent, QuestionErrorComponent, QuestionImageAdornerComponent, QuestionRatingAdornerComponent, QuestionWidgetAdornerComponent, QuestionWrapperFooter, QuestionWrapperHeader, ReactDragEvent, ReactMouseEvent, RowWrapper, SearchComponent, SideBarDefaultHeader, SideBarLaunchCard, SidebarComponent, SurveyCreator, SurveyCreatorComponent, SurveyCreatorToolboxCategory, SurveyCreatorToolboxItem, SurveyCreatorToolboxItemGroup, SurveyCreatorToolboxTool, SurveyElementEmbeddedSurvey, SurveyLocStringEditor, SurveyLogicOpertor, SurveyNavigation, SurveyQuestionBooleanSwitch, SurveyQuestionColor, SurveyQuestionFileEditor, SurveyQuestionFileEditorButton, SurveyQuestionLinkValue, SurveyQuestionSpinEditor, SurveyResults, SurveyResultsByRow, SurveySimulator, SurveySpinEditorButton, SwitcherComponent, TabButtonComponent, TabContainerComponent, TabDesignerComponent, TabJsonEditorAceComponent, TabJsonEditorErrorsComponent, TabJsonEditorTextareaComponent, TabLogicComponent, TabPreviewSurveyComponent, TabThemeSurveyComponent, TabTranslationComponent, TabbedMenuComponent, TabbedMenuItemComponent, ToolboxList, TranslateFromAction, TranslationLineSkeleton, Version, renderSurveyCreator };
2983
2978
  //# sourceMappingURL=survey-creator-js.mjs.map