survey-creator-js 2.5.13 → 2.5.15

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,15 +1,18 @@
1
1
  /*!
2
- * SurveyJS Creator UI v2.5.13
2
+ * SurveyJS Creator v2.5.15
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 'survey-js-ui';
9
- import { ReactElementFactory, SurveyElementBase, attachKey2click, SvgIcon, Survey, SvgBundleComponent, PopupModal, SurveyActionBar, NotifierComponent, ReactQuestionFactory, SurveyLocStringViewer, TitleElement, ReactSurveyElementsWrapper, LoadingIndicatorComponent, SurveyPage, Popup, LogoImage, SurveyQuestionElementBase, SurveyQuestion, SurveyPanel, createElement, Scroll, CharacterCounterComponent, SurveyQuestionDropdown, SurveyHeader, List, Fragment, SurveyQuestionText, preact } from 'survey-js-ui';
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';
10
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';
11
12
  export { PropertyGridEditorCollection, SurveyLogic, SurveyLogicUI, SurveyQuestionEditorDefinition, ToolboxToolViewModel, editorLocalization, localization, settings, svgBundle } from 'survey-creator-core';
13
+ import * as ReactDOM from 'react-dom';
12
14
  import { CssClassBuilder, settings, RendererFactory, unwrap, checkLibraryVersion } from 'survey-core';
15
+ import { preact } from 'survey-js-ui';
13
16
 
14
17
  class TabbedMenuComponent extends SurveyElementBase {
15
18
  get model() {
@@ -79,8 +82,8 @@ class TabbedMenuItemWrapper extends SurveyElementBase {
79
82
  }
80
83
  };
81
84
  queueMicrotask(() => {
82
- if (React["flushSync"]) {
83
- React["flushSync"](() => {
85
+ if (ReactDOM["flushSync"]) {
86
+ ReactDOM["flushSync"](() => {
84
87
  update();
85
88
  });
86
89
  }
@@ -1022,19 +1025,34 @@ ReactQuestionFactory.Instance.registerQuestion("linkvalue", (props) => {
1022
1025
  });
1023
1026
 
1024
1027
  class SurveyElementEmbeddedSurvey extends SurveyQuestionElementBase {
1028
+ constructor() {
1029
+ super(...arguments);
1030
+ this.rootRef = React.createRef();
1031
+ }
1025
1032
  get embeddedSurvey() {
1026
- return (this.props.element || this.props.question);
1033
+ const element = (this.props.element || this.props.question);
1034
+ if (!element)
1035
+ return null;
1036
+ const survey = element.embeddedSurvey;
1037
+ if (!survey || !survey.currentPage)
1038
+ return null;
1039
+ return survey;
1027
1040
  }
1028
1041
  get creator() {
1029
1042
  return this.props.creator;
1030
1043
  }
1044
+ componentDidMount() {
1045
+ super.componentDidMount();
1046
+ if (this.embeddedSurvey) {
1047
+ this.embeddedSurvey.rootElement = this.rootRef.current;
1048
+ }
1049
+ }
1031
1050
  render() {
1032
- if (!this.embeddedSurvey)
1051
+ const survey = this.embeddedSurvey;
1052
+ if (!survey)
1033
1053
  return null;
1034
- const survey = this.embeddedSurvey.embeddedSurvey;
1035
- if (!survey || !survey.currentPage)
1036
- return null;
1037
- return React.createElement(SurveyPage, { survey: survey, page: survey.currentPage, css: survey.css, creator: this.creator });
1054
+ return React.createElement("div", { style: { display: "contents" }, ref: this.rootRef },
1055
+ React.createElement(SurveyPage, { survey: survey, page: survey.currentPage, css: survey.css, creator: this.creator }));
1038
1056
  }
1039
1057
  }
1040
1058
  ReactQuestionFactory.Instance.registerQuestion("embeddedsurvey", (props) => {
@@ -1408,8 +1426,8 @@ class SurveyCreatorToolboxTool extends CreatorModelElement {
1408
1426
  super.componentDidMount();
1409
1427
  this.item.updateModeCallback = (mode, callback) => {
1410
1428
  queueMicrotask(() => {
1411
- if (React["flushSync"]) {
1412
- React["flushSync"](() => {
1429
+ if (ReactDOM["flushSync"]) {
1430
+ ReactDOM["flushSync"](() => {
1413
1431
  this.item.mode = mode;
1414
1432
  });
1415
1433
  }
@@ -1603,9 +1621,12 @@ class SearchComponent extends SurveyElementBase {
1603
1621
  if (!this.model.isVisible)
1604
1622
  return null;
1605
1623
  const onChange = (e) => {
1606
- const { root } = settings.environment;
1607
- if (e.target === root.activeElement) {
1608
- this.model.filterString = e.target.value;
1624
+ const target = e.target;
1625
+ const root = (target === null || target === void 0 ? void 0 : target.getRootNode()) || settings.environment.root;
1626
+ if (!(root instanceof Document || root instanceof ShadowRoot))
1627
+ return;
1628
+ if (target === root.activeElement) {
1629
+ this.model.filterString = target.value;
1609
1630
  }
1610
1631
  };
1611
1632
  return (React.createElement("div", { className: "svc-search" },
@@ -2945,13 +2966,14 @@ ReactQuestionFactory.Instance.registerQuestion("sv-boolean-switch", (props) => {
2945
2966
  RendererFactory.Instance.registerRenderer("boolean", "switch", "sv-boolean-switch");
2946
2967
 
2947
2968
  let Version;
2948
- Version = `${"2.5.13"}`;
2949
- checkLibraryVersion(`${"2.5.13"}`, "survey-creator-react");
2969
+ Version = `${"2.5.15"}`;
2970
+ checkLibraryVersion(`${"2.5.15"}`, "survey-creator-react");
2950
2971
 
2951
2972
  function renderSurveyCreator(creator, element, props = {}) {
2952
2973
  let node = element;
2974
+ const rootElement = creator.rootElement || document;
2953
2975
  if (typeof element === "string") {
2954
- node = document.getElementById(element);
2976
+ node = rootElement.querySelector("#" + element);
2955
2977
  }
2956
2978
  const survey = preact.createElement(SurveyCreatorComponent, Object.assign({ creator }, props));
2957
2979
  preact.render(survey, node);