survey-creator-react 3.0.0-beta.9 → 3.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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * SurveyJS Creator v3.0.0-beta.9
2
+ * SurveyJS Creator v3.0.1
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
@@ -8,7 +8,7 @@
8
8
  import * as React from 'react';
9
9
  import { createElement, Fragment } from 'react';
10
10
  import { ReactElementFactory, SurveyElementBase, attachKey2click, SvgIcon, Survey, ReactQuestionFactory, SurveyLocStringViewer, SvgBundleComponent, PopupModal, SurveyActionBar, NotifierComponent, TitleElement, ReactSurveyElementsWrapper, LoadingIndicatorComponent, SurveyPage, LogoImage, SurveyQuestionElementBase, SurveyQuestion, SurveyPanel, Popup, Scroll, CharacterCounterComponent, SurveyQuestionDropdown, SurveyHeader, List, SurveyQuestionText } from 'survey-react-ui';
11
- import { SurveyCreatorModel, assign, RowViewModel, QuestionAdornerViewModel, QuestionDropdownAdornerViewModel, QuestionImageAdornerViewModel, QuestionRatingAdornerViewModel, PageAdorner, PanelAdornerViewModel, LogoImageViewModel, editorLocalization, ItemValueWrapperViewModel, ImageItemValueWrapperViewModel, MatrixCellWrapperViewModel, SurveyResultsModel, ToolboxToolViewModel, editableStringRendererName, StringEditorViewModelBase, initLogicOperator, PageNavigatorViewModel } from 'survey-creator-core';
11
+ import { SurveyCreatorModel, assign, RowViewModel, QuestionAdornerViewModel, QuestionDropdownAdornerViewModel, QuestionImageAdornerViewModel, QuestionRatingAdornerViewModel, translationDropdownComponentName, TranslationDropdownViewModel, PageAdorner, PanelAdornerViewModel, LogoImageViewModel, editorLocalization, ItemValueWrapperViewModel, ImageItemValueWrapperViewModel, MatrixCellWrapperViewModel, SurveyResultsModel, ToolboxToolViewModel, editableStringRendererName, StringEditorViewModelBase, initLogicOperator, PageNavigatorViewModel, translationLocaleItemComponentName, getTranslationLocaleProgress } from 'survey-creator-core';
12
12
  export { PropertyGridEditorCollection, SurveyLogic, SurveyLogicUI, SurveyQuestionEditorDefinition, ToolboxToolViewModel, editorLocalization, localization, settings, svgBundle } from 'survey-creator-core';
13
13
  import * as ReactDOM from 'react-dom';
14
14
  import { CssClassBuilder, settings, RendererFactory, unwrap, checkLibraryVersion } from 'survey-core';
@@ -172,6 +172,7 @@ class SurveyCreatorComponent extends SurveyElementBase {
172
172
  React.createElement(SvgBundleComponent, null),
173
173
  React.createElement(PopupModal, null),
174
174
  React.createElement("div", { className: areaClassName },
175
+ this.renderCollabBar(),
175
176
  React.createElement("div", { className: fullContainerClassName },
176
177
  React.createElement("div", { className: "svc-flex-column svc-flex-row__element svc-flex-row__element--growing" },
177
178
  React.createElement("div", { className: "svc-top-bar" },
@@ -192,6 +193,15 @@ class SurveyCreatorComponent extends SurveyElementBase {
192
193
  licenseBanner,
193
194
  React.createElement(NotifierComponent, { notifier: creator.notifier }))));
194
195
  }
196
+ // The strip is a plain ComponentContainerModel, so the generic container
197
+ // component draws it. `collabBar` is typed as Base in creator-core to keep the
198
+ // creator free of a dependency on the collaboration plugin, hence the cast.
199
+ renderCollabBar() {
200
+ const bar = this.creator.collabBar;
201
+ if (!bar)
202
+ return null;
203
+ return ReactElementFactory.Instance.createElement("svc-component-container", { model: bar.container });
204
+ }
195
205
  renderActiveTab() {
196
206
  const creator = this.props.creator;
197
207
  return this.renderCreatorTab(creator.activeTabMenuItem);
@@ -761,6 +771,49 @@ ReactElementFactory.Instance.registerElement("svc-cell-dropdown-question", (prop
761
771
  return React.createElement(CellQuestionDropdownAdornerComponent, props);
762
772
  });
763
773
 
774
+ // The flattened choice list of a dropdown/tagbox question in the translation side-by-side
775
+ // panes. Chrome-free: no designer adorner, no itemvalue wrappers - the choice texts render
776
+ // through the survey's string renderer (editable in the target pane, plain in the source one).
777
+ class TranslationDropdownQuestionComponent extends CreatorModelElement {
778
+ createModel(props) {
779
+ if (!!this.model) {
780
+ this.model.dispose();
781
+ }
782
+ this.model = new TranslationDropdownViewModel(props.question, props.componentData ? props.componentData.translation : undefined);
783
+ }
784
+ getUpdatedModelProps() {
785
+ return ["question", "componentData"];
786
+ }
787
+ getStateElement() {
788
+ return this.model;
789
+ }
790
+ componentWillUnmount() {
791
+ super.componentWillUnmount();
792
+ this.model.dispose();
793
+ }
794
+ renderElement() {
795
+ const question = this.props.question;
796
+ const textStyle = this.props.question.textStyle;
797
+ return (React.createElement(React.Fragment, null,
798
+ this.props.element,
799
+ React.createElement("div", { className: "st-dropdown-choices--wrapper" },
800
+ React.createElement("div", { className: "svc-question__dropdown-choices" }, this.model.getRenderedItems().map((item, index) => (React.createElement("div", { className: this.model.getChoiceCss(), key: `translation_choice_${index}` }, ReactElementFactory.Instance.createElement(this.model.itemComponent, {
801
+ question: question,
802
+ cssClasses: question.cssClasses,
803
+ isDisplayMode: true,
804
+ item: item,
805
+ textStyle: textStyle,
806
+ index: index,
807
+ isChecked: false
808
+ }))))),
809
+ this.model.needToCollapse ?
810
+ ReactElementFactory.Instance.createElement("sv-action-bar-item", { item: this.model.collapseAction }) : null)));
811
+ }
812
+ }
813
+ ReactElementFactory.Instance.registerElement(translationDropdownComponentName, (props) => {
814
+ return React.createElement(TranslationDropdownQuestionComponent, props);
815
+ });
816
+
764
817
  const PageElementContent = React.memo(({ page, survey, creator }) => {
765
818
  return React.createElement(SurveyPage, { page: page, survey: survey, creator: creator });
766
819
  });
@@ -771,11 +824,15 @@ class CreatorSurveyPageComponent extends CreatorModelElement {
771
824
  this.rootRef = React.createRef();
772
825
  }
773
826
  createModel(props) {
827
+ var _a;
774
828
  if (this.model) {
775
- this.model.attachToUI(props.page, this.rootRef.current);
829
+ this.model.dispose();
776
830
  }
777
831
  this.model = this.createPageAdorner(props.creator, props.page);
778
832
  this.model.isGhost = this.props.isGhost;
833
+ if (!!((_a = this.rootRef) === null || _a === void 0 ? void 0 : _a.current)) {
834
+ this.model.attachToUI(props.page, this.rootRef.current);
835
+ }
779
836
  }
780
837
  createPageAdorner(creator, page) {
781
838
  return new PageAdorner(creator, page);
@@ -789,6 +846,7 @@ class CreatorSurveyPageComponent extends CreatorModelElement {
789
846
  }
790
847
  componentDidUpdate(prevProps, prevState) {
791
848
  super.componentDidUpdate(prevProps, prevState);
849
+ this.model.attachToUI(this.props.page, this.rootRef.current);
792
850
  }
793
851
  getUpdatedModelProps() {
794
852
  return ["creator", "page"];
@@ -2633,24 +2691,65 @@ class TabTranslationComponent extends SurveyElementBase {
2633
2691
  return (React.createElement("div", { className: "svc-creator-tab__content svc-translation-tab" + (this.model.isEmpty ? " svc-translation-tab--empty" : "") }, this.renderElementContent()));
2634
2692
  }
2635
2693
  renderElementContent() {
2636
- var _a, _b;
2637
2694
  if (this.model.isEmpty) {
2638
2695
  return React.createElement(SurfacePlaceholder, { name: "translation", placeholderTitleText: this.model.placeholderTitleText, placeholderDescriptionText: this.model.placeholderDescriptionText });
2639
2696
  }
2640
- else {
2641
- return (React.createElement("div", { className: "st-content" },
2642
- React.createElement("div", { className: "svc-flex-column st-strings-wrapper" },
2643
- React.createElement("div", { className: "svc-flex-row st-strings-header" },
2644
- React.createElement(Survey, { key: (_a = this.model.stringsHeaderSurvey) === null || _a === void 0 ? void 0 : _a.elementIdPrefix, model: this.model.stringsHeaderSurvey })),
2645
- React.createElement("div", { className: "svc-flex-row svc-plugin-tab__content st-strings" },
2646
- React.createElement(Survey, { key: (_b = this.model.stringsSurvey) === null || _b === void 0 ? void 0 : _b.elementIdPrefix, model: this.model.stringsSurvey })))));
2697
+ if (this.model.isSideBySideForms) {
2698
+ return this.renderSideBySideContent(this.model);
2647
2699
  }
2700
+ // The side-by-side grid view reuses the default strings-grid markup.
2701
+ return this.renderStringsContent(this.model);
2702
+ }
2703
+ renderStringsContent(model) {
2704
+ var _a, _b;
2705
+ return (React.createElement("div", { className: "st-content" },
2706
+ React.createElement("div", { className: "svc-flex-column st-strings-wrapper" },
2707
+ React.createElement("div", { className: "svc-flex-row st-strings-header" },
2708
+ React.createElement(Survey, { key: (_a = model.stringsHeaderSurvey) === null || _a === void 0 ? void 0 : _a.elementIdPrefix, model: model.stringsHeaderSurvey })),
2709
+ React.createElement("div", { className: "svc-flex-row svc-plugin-tab__content st-strings" },
2710
+ React.createElement(Survey, { key: (_b = model.stringsSurvey) === null || _b === void 0 ? void 0 : _b.elementIdPrefix, model: model.stringsSurvey })))));
2711
+ }
2712
+ renderSideBySideContent(model) {
2713
+ var _a;
2714
+ // No target language selected: the target pane is not rendered and the source pane takes
2715
+ // the whole surface.
2716
+ const targetSurvey = model.targetSurvey;
2717
+ return (React.createElement("div", { className: "st-side-by-side" + (!targetSurvey ? " st-side-by-side--no-target" : "") },
2718
+ React.createElement("div", { key: (_a = model.sourceSurvey) === null || _a === void 0 ? void 0 : _a.elementIdPrefix, className: "st-side-by-side__source", ref: (el) => { model.setSourceScrollElement(el); } },
2719
+ React.createElement(Survey, { model: model.sourceSurvey })),
2720
+ !!targetSurvey ?
2721
+ React.createElement("div", { key: targetSurvey.elementIdPrefix, className: "st-side-by-side__target", ref: (el) => { model.setTargetScrollElement(el); } },
2722
+ React.createElement(Survey, { model: targetSurvey })) : null));
2648
2723
  }
2649
2724
  }
2650
2725
  ReactElementFactory.Instance.registerElement("svc-tab-translation", (props) => {
2651
2726
  return React.createElement(TabTranslationComponent, props);
2652
2727
  });
2653
2728
 
2729
+ // An item of the target language dropdown: the language name and, at the right edge, how much of
2730
+ // the survey is already translated into it. The counts are precomputed on the choices themselves
2731
+ // (see updateTargetLocaleChoices) - a language with no translations carries none.
2732
+ class TranslationLocaleItemComponent extends SurveyElementBase {
2733
+ get item() {
2734
+ return this.props.item;
2735
+ }
2736
+ getStateElement() {
2737
+ return this.item;
2738
+ }
2739
+ renderElement() {
2740
+ const item = this.item;
2741
+ if (!item)
2742
+ return null;
2743
+ const progress = getTranslationLocaleProgress(item);
2744
+ return (React.createElement("div", { className: "svc-translation-locale-item" },
2745
+ React.createElement("span", { className: "svc-translation-locale-item__name" }, this.renderLocString(item.locTitle, undefined, "locString")),
2746
+ !!progress ? React.createElement("span", { className: "svc-translation-locale-item__progress" }, progress) : null));
2747
+ }
2748
+ }
2749
+ ReactElementFactory.Instance.registerElement(translationLocaleItemComponentName, (props) => {
2750
+ return React.createElement(TranslationLocaleItemComponent, props);
2751
+ });
2752
+
2654
2753
  class ObjectSelectorComponent extends SurveyElementBase {
2655
2754
  get model() {
2656
2755
  return this.props.model;
@@ -2747,6 +2846,90 @@ ReactElementFactory.Instance.registerElement("svc-switcher", (props) => {
2747
2846
  return React.createElement(SwitcherComponent, props);
2748
2847
  });
2749
2848
 
2849
+ // The collaboration feature's only row renderer: a leading marker (avatar circle
2850
+ // or icon), a title and an optional subtitle. Shared by the connection plate, a
2851
+ // roster entry, a Version History row and the floating panel's title.
2852
+ //
2853
+ // Presentation only - it binds NO events. Interaction belongs to whatever wraps
2854
+ // the row (the <li> of sv-list, the <button> of sv-action-bar) or to nothing at
2855
+ // all, as for the connection plate. See CollabRowAction.
2856
+ class CollabRowComponent extends SurveyElementBase {
2857
+ get item() {
2858
+ return this.props.item;
2859
+ }
2860
+ getStateElement() {
2861
+ return this.item;
2862
+ }
2863
+ canRender() {
2864
+ return !!this.item && this.item.visible && super.canRender();
2865
+ }
2866
+ renderMarker() {
2867
+ const item = this.item;
2868
+ if (item.hasMarkerText) {
2869
+ return React.createElement("span", { className: item.markerCss }, item.markerText);
2870
+ }
2871
+ if (item.hasMarkerIcon) {
2872
+ return (React.createElement("span", { className: "svc-collab-row__icon" },
2873
+ React.createElement(SvgIcon, { iconName: item.markerIconName, size: item.markerIconSize })));
2874
+ }
2875
+ return null;
2876
+ }
2877
+ renderElement() {
2878
+ const item = this.item;
2879
+ return (React.createElement("div", { className: item.rowCss, role: item.rowRole || undefined, "aria-expanded": item.ariaExpanded },
2880
+ this.renderMarker(),
2881
+ React.createElement("span", { className: "svc-collab-row__title" }, item.title),
2882
+ item.hasSubtitle ? React.createElement("span", { className: "svc-collab-row__subtitle" }, item.subtitle) : null));
2883
+ }
2884
+ }
2885
+ ReactElementFactory.Instance.registerElement("svc-collab-row", (props) => {
2886
+ return React.createElement(CollabRowComponent, props);
2887
+ });
2888
+
2889
+ // A non-modal window: docked to the viewport's right edge until its header is
2890
+ // dragged, then free-floating. position:fixed, so it contributes nothing to the
2891
+ // creator's flex layout while still living inside the themed root, where the
2892
+ // --sjs2-* custom properties are defined.
2893
+ //
2894
+ // Markup only. The root node is handed to the model the way survey-core's popup
2895
+ // views do, and the header's raw pointerdown is forwarded; geometry, listeners,
2896
+ // focus and the drag itself all live in FloatingPanelModel. Hiding is part of
2897
+ // `style` too, which is why the root is always rendered.
2898
+ class FloatingPanelComponent extends SurveyElementBase {
2899
+ constructor(props) {
2900
+ super(props);
2901
+ this.root = React.createRef();
2902
+ }
2903
+ get model() {
2904
+ return this.props.model;
2905
+ }
2906
+ getStateElement() {
2907
+ return this.model;
2908
+ }
2909
+ componentDidMount() {
2910
+ super.componentDidMount();
2911
+ this.model.setComponentElement(this.root.current);
2912
+ }
2913
+ componentWillUnmount() {
2914
+ super.componentWillUnmount();
2915
+ this.model.resetComponentElement();
2916
+ }
2917
+ renderElement() {
2918
+ const model = this.model;
2919
+ const content = ReactElementFactory.Instance.createElement(model.contentComponentName, model.contentComponentData);
2920
+ return (React.createElement("div", { ref: this.root, className: model.rootCss, style: model.style, role: "dialog", "aria-modal": false, "aria-labelledby": model.titleId, tabIndex: -1, onPointerDownCapture: () => model.bringToFront() },
2921
+ React.createElement("div", { className: model.headerCss, onPointerDown: (e) => model.onPointerDown(e.nativeEvent) },
2922
+ React.createElement("span", { id: model.titleId, className: "svc-floating-panel__title" }, model.titleText),
2923
+ React.createElement("span", { className: "svc-floating-panel__drag", "aria-hidden": "true" },
2924
+ React.createElement(SvgIcon, { iconName: "icon-draghorizontal-24x16", size: "auto" })),
2925
+ React.createElement(SurveyActionBar, { model: model.headerToolbar })),
2926
+ React.createElement("div", { className: model.bodyCss }, content)));
2927
+ }
2928
+ }
2929
+ ReactElementFactory.Instance.registerElement("svc-floating-panel", (props) => {
2930
+ return React.createElement(FloatingPanelComponent, props);
2931
+ });
2932
+
2750
2933
  let ItemTemplateComponent$1 = class ItemTemplateComponent extends SurveyElementBase {
2751
2934
  render() {
2752
2935
  const item = this.props.item;
@@ -2955,7 +3138,8 @@ class SurveyQuestionFileEditorButton extends SurveyElementBase {
2955
3138
  renderElement() {
2956
3139
  return (React.createElement("div", null,
2957
3140
  attachKey2click(React.createElement("label", { onClick: event => this.question.chooseFiles(event.nativeEvent), className: this.item.getActionBarItemCss(), htmlFor: this.question.inputId, "aria-label": this.question.chooseButtonCaption },
2958
- React.createElement(SvgIcon, { iconName: this.item.iconName, size: "auto", title: this.item.title, className: this.item.cssClasses.itemIcon }))),
3141
+ React.createElement(SvgIcon, { iconName: this.item.iconName, size: "auto", title: this.item.title, className: this.item.cssClasses.itemIcon }),
3142
+ React.createElement("span", { className: "sv-visuallyhidden" }, this.question.chooseButtonCaption))),
2959
3143
  React.createElement("input", { type: "file", disabled: this.item.disabled, className: this.question.cssClasses.fileInput, id: this.question.inputId, "aria-required": this.question.ariaRequired, "aria-label": this.question.ariaLabel, "aria-invalid": this.question.ariaInvalid, "aria-describedby": this.question.ariaDescribedBy, multiple: false, title: this.question.inputTitle, accept: this.question.acceptedTypes, tabIndex: -1, onChange: (event) => this.question.onFileInputChange(event.nativeEvent) })));
2960
3144
  }
2961
3145
  }
@@ -2967,8 +3151,8 @@ ReactElementFactory.Instance.registerElement("sv-fileedit-button", (props) => {
2967
3151
  });
2968
3152
 
2969
3153
  let Version;
2970
- Version = `${"3.0.0-beta.9"}`;
2971
- checkLibraryVersion(`${"3.0.0-beta.9"}`, "survey-creator-react");
3154
+ Version = `${"3.0.1"}`;
3155
+ checkLibraryVersion(`${"3.0.1"}`, "survey-creator-react");
2972
3156
 
2973
- 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, 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 };
3157
+ export { ActionButton, AdaptiveToolbox, AddQuestionButtonComponent, CellQuestionAdornerComponent, CellQuestionDropdownAdornerComponent, CollabRowComponent, ComponentContainer, CreatorSurveyPageComponent, FloatingPanelComponent, 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, SurveyQuestionColor, SurveyQuestionFileEditor, SurveyQuestionFileEditorButton, SurveyQuestionLinkValue, SurveyQuestionSpinEditor, SurveyResults, SurveyResultsByRow, SurveySimulator, SurveySpinEditorButton, SwitcherComponent, TabButtonComponent, TabContainerComponent, TabDesignerComponent, TabJsonEditorAceComponent, TabJsonEditorErrorsComponent, TabJsonEditorTextareaComponent, TabLogicComponent, TabPreviewSurveyComponent, TabThemeSurveyComponent, TabTranslationComponent, TabbedMenuComponent, TabbedMenuItemComponent, ToolboxList, TranslateFromAction, TranslationDropdownQuestionComponent, TranslationLineSkeleton, TranslationLocaleItemComponent, Version };
2974
3158
  //# sourceMappingURL=survey-creator-react.mjs.map