survey-creator-react 2.0.5 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * SurveyJS Creator React v2.0.5
2
+ * SurveyJS Creator React v2.0.7
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
@@ -7,10 +7,10 @@
7
7
 
8
8
  import * as React from 'react';
9
9
  import { createElement, Fragment } from 'react';
10
- import * as ReactDOM from 'react-dom';
11
- import { ReactElementFactory, SurveyElementBase, attachKey2click, SvgIcon, Survey, SvgBundleComponent, PopupModal, SurveyActionBar, NotifierComponent, ReactQuestionFactory, SurveyLocStringViewer, TitleElement, ReactSurveyElementsWrapper, LoadingIndicatorComponent, SurveyPage, Popup, LogoImage, SurveyQuestionElementBase, SurveyQuestion, Scroll, CharacterCounterComponent, SurveyQuestionDropdown, SurveyHeader, List, SurveyQuestionButtonGroup, SurveyQuestionText } from 'survey-react-ui';
12
- import { assign, SurveyCreatorModel, RowViewModel, QuestionAdornerViewModel, QuestionDropdownAdornerViewModel, QuestionImageAdornerViewModel, QuestionRatingAdornerViewModel, PageAdorner, LogoImageViewModel, editorLocalization, ItemValueWrapperViewModel, ImageItemValueWrapperViewModel, MatrixCellWrapperViewModel, SurveyResultsModel, ToolboxToolViewModel, editableStringRendererName, StringEditorViewModelBase, initLogicOperator, PageNavigatorViewModel } from 'survey-creator-core';
10
+ import { ReactElementFactory, SurveyElementBase, attachKey2click, SvgIcon, Survey, ReactQuestionFactory, SurveyLocStringViewer, SvgBundleComponent, PopupModal, SurveyActionBar, NotifierComponent, TitleElement, ReactSurveyElementsWrapper, LoadingIndicatorComponent, SurveyPage, Popup, LogoImage, SurveyQuestionElementBase, SurveyQuestion, Scroll, CharacterCounterComponent, SurveyQuestionDropdown, SurveyHeader, List, SurveyQuestionText } from 'survey-react-ui';
11
+ import { SurveyCreatorModel, assign, RowViewModel, QuestionAdornerViewModel, QuestionDropdownAdornerViewModel, QuestionImageAdornerViewModel, QuestionRatingAdornerViewModel, PageAdorner, LogoImageViewModel, editorLocalization, ItemValueWrapperViewModel, ImageItemValueWrapperViewModel, MatrixCellWrapperViewModel, SurveyResultsModel, ToolboxToolViewModel, editableStringRendererName, StringEditorViewModelBase, initLogicOperator, PageNavigatorViewModel } from 'survey-creator-core';
13
12
  export { PropertyGridEditorCollection, SurveyLogic, SurveyLogicUI, SurveyQuestionEditorDefinition, ToolboxToolViewModel, editorLocalization, localization, settings, svgBundle } from 'survey-creator-core';
13
+ import * as ReactDOM from 'react-dom';
14
14
  import { ResponsivityManager, CssClassBuilder, settings, VerticalResponsivityManager, RendererFactory, unwrap, checkLibraryVersion } from 'survey-core';
15
15
 
16
16
  class TabbedMenuComponent extends SurveyElementBase {
@@ -214,15 +214,8 @@ class SurveyCreator extends SurveyCreatorModel {
214
214
  super(options, options2);
215
215
  }
216
216
  render(target) {
217
- let node = target;
218
- if (typeof target === "string") {
219
- node = document.getElementById(target);
220
- }
221
- /* eslint-disable react/no-deprecated */
222
- ReactDOM.unmountComponentAtNode(node);
223
- ReactDOM.render(React.createElement(React.StrictMode, null,
224
- React.createElement(SurveyCreatorComponent, { creator: this })), node);
225
- /* eslint-enable react/no-deprecated */
217
+ // eslint-disable-next-line no-console
218
+ console.error("The render method is deprecated. Use SurveyCreatorComponent instead.");
226
219
  }
227
220
  //ISurveyCreator
228
221
  createQuestionElement(question) {
@@ -1125,6 +1118,15 @@ class ImageItemValueAdornerComponent extends CreatorModelElement {
1125
1118
  return React.createElement("div", { className: "svc-image-item-value__loading" },
1126
1119
  React.createElement(LoadingIndicatorComponent, null));
1127
1120
  }
1121
+ renderNewItemControls() {
1122
+ const addButton = attachKey2click(React.createElement("span", { className: this.model.addButtonCss, onClick: () => this.model.chooseNewFile(this.model) }, this.model.showChooseButtonAsIcon ?
1123
+ React.createElement(SvgIcon, { size: "auto", iconName: "icon-add-lg", title: this.model.addFileTitle }) :
1124
+ React.createElement("span", null, this.model.chooseImageText)));
1125
+ const placeholder = this.model.showPlaceholder ? React.createElement("span", { className: "svc-image-item-value__placeholder" }, this.model.placeholderText) : null;
1126
+ return React.createElement(React.Fragment, null,
1127
+ placeholder,
1128
+ addButton);
1129
+ }
1128
1130
  render() {
1129
1131
  this.model.item = this.props.item;
1130
1132
  const isNew = !this.props.question.isItemInList(this.props.item);
@@ -1133,12 +1135,13 @@ class ImageItemValueAdornerComponent extends CreatorModelElement {
1133
1135
  let content = null;
1134
1136
  if (isNew || this.model.isUploading) {
1135
1137
  content = (React.createElement(React.Fragment, null,
1136
- React.createElement("div", { className: "svc-image-item-value__item", onDrop: this.model.onDrop, onDragOver: this.model.onDragOver, onDragLeave: this.model.onDragLeave },
1138
+ React.createElement("div", { className: "svc-image-item-value__item" },
1137
1139
  React.createElement("div", { className: "sd-imagepicker__item sd-imagepicker__item--inline" },
1138
1140
  React.createElement("label", { className: "sd-imagepicker__label" },
1139
1141
  React.createElement("div", { style: imageStyle, className: "sd-imagepicker__image" }, this.model.isUploading ? this.renderLoadingIndicator() : null)))),
1140
- React.createElement("div", { className: "svc-image-item-value-controls" }, this.model.allowAdd && !this.model.isUploading ? attachKey2click(React.createElement("span", { className: "svc-context-button svc-image-item-value-controls__add", onClick: () => this.model.chooseNewFile(this.model) },
1141
- React.createElement(SvgIcon, { size: "auto", iconName: "icon-add-lg", title: this.model.addFileTitle }))) : null)));
1142
+ this.model.allowAdd && !this.model.isUploading ?
1143
+ React.createElement("div", { className: "svc-image-item-value-controls" }, this.renderNewItemControls())
1144
+ : null));
1142
1145
  }
1143
1146
  else {
1144
1147
  content = (React.createElement(React.Fragment, null,
@@ -1155,7 +1158,7 @@ class ImageItemValueAdornerComponent extends CreatorModelElement {
1155
1158
  React.createElement(SvgIcon, { role: "button", size: "auto", iconName: "icon-delete", title: this.model.removeFileTitle }))) : null)
1156
1159
  : null));
1157
1160
  }
1158
- 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 },
1161
+ 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 },
1159
1162
  React.createElement("div", { className: "svc-image-item-value-wrapper__ghost", style: imageStyle }),
1160
1163
  React.createElement("div", { className: "svc-image-item-value-wrapper__content" },
1161
1164
  React.createElement("input", { type: "file", "aria-hidden": "true", tabIndex: -1, accept: this.model.acceptedTypes, className: "svc-choose-file-input", style: {
@@ -2056,14 +2059,12 @@ class SurveyLogicOpertor extends SurveyQuestionDropdown {
2056
2059
  renderInput() {
2057
2060
  const q = this.question;
2058
2061
  initLogicOperator(q);
2059
- const text = (q.selectedItemLocText) ? this.renderLocString(q.selectedItemLocText) : "";
2062
+ const text = (q.locReadOnlyText) ? this.renderLocString(q.locReadOnlyText) : "";
2060
2063
  return (React.createElement("div", { id: this.question.inputId, className: q.getControlClass(), tabIndex: this.question.isInputReadOnly ? undefined : 0,
2061
2064
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2062
2065
  // @ts-ignore
2063
2066
  disabled: this.question.isInputReadOnly, required: this.question.isRequired, onChange: this.updateValueOnEvent, onInput: this.updateValueOnEvent, onKeyUp: this.keyhandler, role: this.question.ariaRole, "aria-required": this.question.ariaRequired, "aria-label": this.question.ariaLabel, "aria-labelledby": this.question.ariaLabelledBy, "aria-invalid": this.question.ariaInvalid, "aria-errormessage": this.question.ariaErrormessage, "aria-expanded": this.question.ariaExpanded },
2064
- React.createElement("div", { className: this.question.cssClasses.controlValue },
2065
- text,
2066
- React.createElement("div", null, q.readOnlyText)),
2067
+ React.createElement("div", { className: this.question.cssClasses.controlValue }, text),
2067
2068
  this.createClearButton()));
2068
2069
  }
2069
2070
  }
@@ -2594,9 +2595,6 @@ class PropertyGridComponent extends SurveyElementBase {
2594
2595
  React.createElement(Survey, { model: this.model.survey })));
2595
2596
  }
2596
2597
  }
2597
- ReactQuestionFactory.Instance.registerQuestion("buttongroup", (props) => {
2598
- return React.createElement(SurveyQuestionButtonGroup, props);
2599
- });
2600
2598
  ReactElementFactory.Instance.registerElement("svc-property-grid", (props) => {
2601
2599
  return React.createElement(PropertyGridComponent, props);
2602
2600
  });
@@ -2737,7 +2735,7 @@ class SurveyQuestionFileEditor extends SurveyQuestionText {
2737
2735
  }
2738
2736
  renderInput() {
2739
2737
  return (React.createElement(React.Fragment, null,
2740
- React.createElement("input", { disabled: this.isDisplayMode, className: this.questionFile.cssClasses.control, placeholder: this.questionFile.renderedPlaceholder, ref: (input) => (this.setControl(input)), autoComplete: "off", type: "text", onBlur: (event) => this.questionFile.onInputBlur(event.nativeEvent), onChange: (event) => this.questionFile.onInputChange(event.nativeEvent) })));
2738
+ React.createElement("input", { disabled: this.question.isTextInputReadOnly, className: this.questionFile.cssClasses.control, placeholder: this.questionFile.renderedPlaceholder, ref: (input) => (this.setControl(input)), autoComplete: "off", type: "text", onBlur: (event) => this.questionFile.onInputBlur(event.nativeEvent), onChange: (event) => this.questionFile.onInputChange(event.nativeEvent) })));
2741
2739
  }
2742
2740
  renderFileInput() {
2743
2741
  return (React.createElement("input", { type: "file", disabled: this.isDisplayMode, className: this.questionFile.cssClasses.fileInput, id: this.questionFile.inputId, "aria-required": this.questionFile.ariaRequired, "aria-label": this.questionFile.ariaLabel, "aria-invalid": this.questionFile.ariaInvalid, "aria-describedby": this.questionFile.ariaDescribedBy, multiple: false, title: this.questionFile.inputTitle, accept: this.questionFile.acceptedTypes, tabIndex: -1, onChange: (event) => this.questionFile.onFileInputChange(event.nativeEvent) }));
@@ -2815,8 +2813,8 @@ ReactQuestionFactory.Instance.registerQuestion("sv-boolean-switch", (props) => {
2815
2813
  RendererFactory.Instance.registerRenderer("boolean", "switch", "sv-boolean-switch");
2816
2814
 
2817
2815
  let Version;
2818
- Version = `${"2.0.5"}`;
2819
- checkLibraryVersion(`${"2.0.5"}`, "survey-creator-react");
2816
+ Version = `${"2.0.7"}`;
2817
+ checkLibraryVersion(`${"2.0.7"}`, "survey-creator-react");
2820
2818
 
2821
2819
  export { ActionButton, AdaptiveToolbox, CellQuestionAdornerComponent, CellQuestionDropdownAdornerComponent, 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, SurveyQuestionLinkValue, SurveyQuestionSpinEditor, SurveyQuestionTextWithReset, SurveyResults, SurveyResultsByRow, SurveySimulator, SwitcherComponent, TabButtonComponent, TabDesignerComponent, TabJsonEditorAceComponent, TabJsonEditorErrorsComponent, TabJsonEditorTextareaComponent, TabLogicAddButtonComponent, TabLogicComponent, TabPreviewSurveyComponent, TabPreviewTestSurveyAgainComponent, TabThemeSurveyComponent, TabTranslationComponent, TabbedMenuComponent, TabbedMenuItemComponent, ToolboxList, TranslateFromAction, TranslationLineSkeleton, Version };
2822
2820
  //# sourceMappingURL=survey-creator-react.mjs.map