survey-creator-react 3.0.0 → 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.
package/package.json CHANGED
@@ -1,33 +1,40 @@
1
1
  {
2
2
  "name": "survey-creator-react",
3
- "version": "3.0.0",
4
- "description": "A white-label drag-and-drop form builder for React that lets you design complex, interactive forms and surveys without writing code. It generates JSON schemas used by the SurveyJS Form Library to render dynamic forms in your React app.",
3
+ "version": "3.0.1",
4
+ "description": "Embeddable SurveyJS drag-and-drop form builder for JSON-based forms in React. Create dynamic surveys, polls, quizzes, and other forms, configure conditional logic and validation, and customize the editor UI.",
5
5
  "author": "DevSoft Baltic OU <info@devsoftbaltic.com>",
6
6
  "homepage": "https://surveyjs.io/",
7
7
  "license": "SEE LICENSE IN LICENSE",
8
8
  "licenseUrl": "https://surveyjs.io/licensing",
9
9
  "keywords": [
10
10
  "react",
11
+ "react-component",
12
+ "react-form-builder",
11
13
  "survey",
12
14
  "form",
13
15
  "surveyjs",
14
- "survey-library",
15
- "react-component",
16
+ "survey-creator",
17
+ "survey-builder",
18
+ "survey-editor",
16
19
  "form-builder",
17
- "dynamic-form-builder",
20
+ "form-editor",
21
+ "json-form-builder",
22
+ "json-form-editor",
23
+ "json-forms",
18
24
  "drag-and-drop-form-builder",
19
- "form-library",
20
- "form-management",
25
+ "visual-form-builder",
26
+ "no-code-form-builder",
27
+ "dynamic-form-builder",
28
+ "conditional-logic",
29
+ "embeddable",
21
30
  "questionnaire",
22
31
  "data-collection",
23
- "ui-component",
24
- "json",
25
- "json-schema",
26
- "react-schema-form",
27
- "survey-creator",
28
- "survey-builder",
29
- "client-side",
30
- "frontend",
32
+ "bootstrap",
33
+ "bootswatch",
34
+ "mui",
35
+ "material-ui",
36
+ "shadcn",
37
+ "shadcn-ui",
31
38
  "javascript",
32
39
  "typescript"
33
40
  ],
@@ -60,9 +67,9 @@
60
67
  "ace-builds": "^1.4.12",
61
68
  "react": "^16.5.0 || ^17.0.1 || ^18.1.0 || ^19.0.0",
62
69
  "react-dom": "^16.5.0 || ^17.0.1 || ^18.1.0 || ^19.0.0",
63
- "survey-core": "3.0.0",
64
- "survey-react-ui": "3.0.0",
65
- "survey-creator-core": "3.0.0"
70
+ "survey-core": "3.0.1",
71
+ "survey-react-ui": "3.0.1",
72
+ "survey-creator-core": "3.0.1"
66
73
  },
67
74
  "peerDependenciesMeta": {
68
75
  "ace-builds": {
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * SurveyJS Creator v3.0.0
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
@@ -190,6 +190,7 @@
190
190
  React__namespace.createElement(surveyReactUi.SvgBundleComponent, null),
191
191
  React__namespace.createElement(surveyReactUi.PopupModal, null),
192
192
  React__namespace.createElement("div", { className: areaClassName },
193
+ this.renderCollabBar(),
193
194
  React__namespace.createElement("div", { className: fullContainerClassName },
194
195
  React__namespace.createElement("div", { className: "svc-flex-column svc-flex-row__element svc-flex-row__element--growing" },
195
196
  React__namespace.createElement("div", { className: "svc-top-bar" },
@@ -210,6 +211,15 @@
210
211
  licenseBanner,
211
212
  React__namespace.createElement(surveyReactUi.NotifierComponent, { notifier: creator.notifier }))));
212
213
  }
214
+ // The strip is a plain ComponentContainerModel, so the generic container
215
+ // component draws it. `collabBar` is typed as Base in creator-core to keep the
216
+ // creator free of a dependency on the collaboration plugin, hence the cast.
217
+ renderCollabBar() {
218
+ const bar = this.creator.collabBar;
219
+ if (!bar)
220
+ return null;
221
+ return surveyReactUi.ReactElementFactory.Instance.createElement("svc-component-container", { model: bar.container });
222
+ }
213
223
  renderActiveTab() {
214
224
  const creator = this.props.creator;
215
225
  return this.renderCreatorTab(creator.activeTabMenuItem);
@@ -779,6 +789,49 @@
779
789
  return React__namespace.createElement(CellQuestionDropdownAdornerComponent, props);
780
790
  });
781
791
 
792
+ // The flattened choice list of a dropdown/tagbox question in the translation side-by-side
793
+ // panes. Chrome-free: no designer adorner, no itemvalue wrappers - the choice texts render
794
+ // through the survey's string renderer (editable in the target pane, plain in the source one).
795
+ class TranslationDropdownQuestionComponent extends CreatorModelElement {
796
+ createModel(props) {
797
+ if (!!this.model) {
798
+ this.model.dispose();
799
+ }
800
+ this.model = new surveyCreatorCore.TranslationDropdownViewModel(props.question, props.componentData ? props.componentData.translation : undefined);
801
+ }
802
+ getUpdatedModelProps() {
803
+ return ["question", "componentData"];
804
+ }
805
+ getStateElement() {
806
+ return this.model;
807
+ }
808
+ componentWillUnmount() {
809
+ super.componentWillUnmount();
810
+ this.model.dispose();
811
+ }
812
+ renderElement() {
813
+ const question = this.props.question;
814
+ const textStyle = this.props.question.textStyle;
815
+ return (React__namespace.createElement(React__namespace.Fragment, null,
816
+ this.props.element,
817
+ React__namespace.createElement("div", { className: "st-dropdown-choices--wrapper" },
818
+ React__namespace.createElement("div", { className: "svc-question__dropdown-choices" }, this.model.getRenderedItems().map((item, index) => (React__namespace.createElement("div", { className: this.model.getChoiceCss(), key: `translation_choice_${index}` }, surveyReactUi.ReactElementFactory.Instance.createElement(this.model.itemComponent, {
819
+ question: question,
820
+ cssClasses: question.cssClasses,
821
+ isDisplayMode: true,
822
+ item: item,
823
+ textStyle: textStyle,
824
+ index: index,
825
+ isChecked: false
826
+ }))))),
827
+ this.model.needToCollapse ?
828
+ surveyReactUi.ReactElementFactory.Instance.createElement("sv-action-bar-item", { item: this.model.collapseAction }) : null)));
829
+ }
830
+ }
831
+ surveyReactUi.ReactElementFactory.Instance.registerElement(surveyCreatorCore.translationDropdownComponentName, (props) => {
832
+ return React__namespace.createElement(TranslationDropdownQuestionComponent, props);
833
+ });
834
+
782
835
  const PageElementContent = React__namespace.memo(({ page, survey, creator }) => {
783
836
  return React__namespace.createElement(surveyReactUi.SurveyPage, { page: page, survey: survey, creator: creator });
784
837
  });
@@ -789,11 +842,15 @@
789
842
  this.rootRef = React__namespace.createRef();
790
843
  }
791
844
  createModel(props) {
845
+ var _a;
792
846
  if (this.model) {
793
- this.model.attachToUI(props.page, this.rootRef.current);
847
+ this.model.dispose();
794
848
  }
795
849
  this.model = this.createPageAdorner(props.creator, props.page);
796
850
  this.model.isGhost = this.props.isGhost;
851
+ if (!!((_a = this.rootRef) === null || _a === void 0 ? void 0 : _a.current)) {
852
+ this.model.attachToUI(props.page, this.rootRef.current);
853
+ }
797
854
  }
798
855
  createPageAdorner(creator, page) {
799
856
  return new surveyCreatorCore.PageAdorner(creator, page);
@@ -807,6 +864,7 @@
807
864
  }
808
865
  componentDidUpdate(prevProps, prevState) {
809
866
  super.componentDidUpdate(prevProps, prevState);
867
+ this.model.attachToUI(this.props.page, this.rootRef.current);
810
868
  }
811
869
  getUpdatedModelProps() {
812
870
  return ["creator", "page"];
@@ -2651,24 +2709,65 @@
2651
2709
  return (React__namespace.createElement("div", { className: "svc-creator-tab__content svc-translation-tab" + (this.model.isEmpty ? " svc-translation-tab--empty" : "") }, this.renderElementContent()));
2652
2710
  }
2653
2711
  renderElementContent() {
2654
- var _a, _b;
2655
2712
  if (this.model.isEmpty) {
2656
2713
  return React__namespace.createElement(SurfacePlaceholder, { name: "translation", placeholderTitleText: this.model.placeholderTitleText, placeholderDescriptionText: this.model.placeholderDescriptionText });
2657
2714
  }
2658
- else {
2659
- return (React__namespace.createElement("div", { className: "st-content" },
2660
- React__namespace.createElement("div", { className: "svc-flex-column st-strings-wrapper" },
2661
- React__namespace.createElement("div", { className: "svc-flex-row st-strings-header" },
2662
- React__namespace.createElement(surveyReactUi.Survey, { key: (_a = this.model.stringsHeaderSurvey) === null || _a === void 0 ? void 0 : _a.elementIdPrefix, model: this.model.stringsHeaderSurvey })),
2663
- React__namespace.createElement("div", { className: "svc-flex-row svc-plugin-tab__content st-strings" },
2664
- React__namespace.createElement(surveyReactUi.Survey, { key: (_b = this.model.stringsSurvey) === null || _b === void 0 ? void 0 : _b.elementIdPrefix, model: this.model.stringsSurvey })))));
2715
+ if (this.model.isSideBySideForms) {
2716
+ return this.renderSideBySideContent(this.model);
2665
2717
  }
2718
+ // The side-by-side grid view reuses the default strings-grid markup.
2719
+ return this.renderStringsContent(this.model);
2720
+ }
2721
+ renderStringsContent(model) {
2722
+ var _a, _b;
2723
+ return (React__namespace.createElement("div", { className: "st-content" },
2724
+ React__namespace.createElement("div", { className: "svc-flex-column st-strings-wrapper" },
2725
+ React__namespace.createElement("div", { className: "svc-flex-row st-strings-header" },
2726
+ React__namespace.createElement(surveyReactUi.Survey, { key: (_a = model.stringsHeaderSurvey) === null || _a === void 0 ? void 0 : _a.elementIdPrefix, model: model.stringsHeaderSurvey })),
2727
+ React__namespace.createElement("div", { className: "svc-flex-row svc-plugin-tab__content st-strings" },
2728
+ React__namespace.createElement(surveyReactUi.Survey, { key: (_b = model.stringsSurvey) === null || _b === void 0 ? void 0 : _b.elementIdPrefix, model: model.stringsSurvey })))));
2729
+ }
2730
+ renderSideBySideContent(model) {
2731
+ var _a;
2732
+ // No target language selected: the target pane is not rendered and the source pane takes
2733
+ // the whole surface.
2734
+ const targetSurvey = model.targetSurvey;
2735
+ return (React__namespace.createElement("div", { className: "st-side-by-side" + (!targetSurvey ? " st-side-by-side--no-target" : "") },
2736
+ React__namespace.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); } },
2737
+ React__namespace.createElement(surveyReactUi.Survey, { model: model.sourceSurvey })),
2738
+ !!targetSurvey ?
2739
+ React__namespace.createElement("div", { key: targetSurvey.elementIdPrefix, className: "st-side-by-side__target", ref: (el) => { model.setTargetScrollElement(el); } },
2740
+ React__namespace.createElement(surveyReactUi.Survey, { model: targetSurvey })) : null));
2666
2741
  }
2667
2742
  }
2668
2743
  surveyReactUi.ReactElementFactory.Instance.registerElement("svc-tab-translation", (props) => {
2669
2744
  return React__namespace.createElement(TabTranslationComponent, props);
2670
2745
  });
2671
2746
 
2747
+ // An item of the target language dropdown: the language name and, at the right edge, how much of
2748
+ // the survey is already translated into it. The counts are precomputed on the choices themselves
2749
+ // (see updateTargetLocaleChoices) - a language with no translations carries none.
2750
+ class TranslationLocaleItemComponent extends surveyReactUi.SurveyElementBase {
2751
+ get item() {
2752
+ return this.props.item;
2753
+ }
2754
+ getStateElement() {
2755
+ return this.item;
2756
+ }
2757
+ renderElement() {
2758
+ const item = this.item;
2759
+ if (!item)
2760
+ return null;
2761
+ const progress = surveyCreatorCore.getTranslationLocaleProgress(item);
2762
+ return (React__namespace.createElement("div", { className: "svc-translation-locale-item" },
2763
+ React__namespace.createElement("span", { className: "svc-translation-locale-item__name" }, this.renderLocString(item.locTitle, undefined, "locString")),
2764
+ !!progress ? React__namespace.createElement("span", { className: "svc-translation-locale-item__progress" }, progress) : null));
2765
+ }
2766
+ }
2767
+ surveyReactUi.ReactElementFactory.Instance.registerElement(surveyCreatorCore.translationLocaleItemComponentName, (props) => {
2768
+ return React__namespace.createElement(TranslationLocaleItemComponent, props);
2769
+ });
2770
+
2672
2771
  class ObjectSelectorComponent extends surveyReactUi.SurveyElementBase {
2673
2772
  get model() {
2674
2773
  return this.props.model;
@@ -2765,6 +2864,90 @@
2765
2864
  return React__namespace.createElement(SwitcherComponent, props);
2766
2865
  });
2767
2866
 
2867
+ // The collaboration feature's only row renderer: a leading marker (avatar circle
2868
+ // or icon), a title and an optional subtitle. Shared by the connection plate, a
2869
+ // roster entry, a Version History row and the floating panel's title.
2870
+ //
2871
+ // Presentation only - it binds NO events. Interaction belongs to whatever wraps
2872
+ // the row (the <li> of sv-list, the <button> of sv-action-bar) or to nothing at
2873
+ // all, as for the connection plate. See CollabRowAction.
2874
+ class CollabRowComponent extends surveyReactUi.SurveyElementBase {
2875
+ get item() {
2876
+ return this.props.item;
2877
+ }
2878
+ getStateElement() {
2879
+ return this.item;
2880
+ }
2881
+ canRender() {
2882
+ return !!this.item && this.item.visible && super.canRender();
2883
+ }
2884
+ renderMarker() {
2885
+ const item = this.item;
2886
+ if (item.hasMarkerText) {
2887
+ return React__namespace.createElement("span", { className: item.markerCss }, item.markerText);
2888
+ }
2889
+ if (item.hasMarkerIcon) {
2890
+ return (React__namespace.createElement("span", { className: "svc-collab-row__icon" },
2891
+ React__namespace.createElement(surveyReactUi.SvgIcon, { iconName: item.markerIconName, size: item.markerIconSize })));
2892
+ }
2893
+ return null;
2894
+ }
2895
+ renderElement() {
2896
+ const item = this.item;
2897
+ return (React__namespace.createElement("div", { className: item.rowCss, role: item.rowRole || undefined, "aria-expanded": item.ariaExpanded },
2898
+ this.renderMarker(),
2899
+ React__namespace.createElement("span", { className: "svc-collab-row__title" }, item.title),
2900
+ item.hasSubtitle ? React__namespace.createElement("span", { className: "svc-collab-row__subtitle" }, item.subtitle) : null));
2901
+ }
2902
+ }
2903
+ surveyReactUi.ReactElementFactory.Instance.registerElement("svc-collab-row", (props) => {
2904
+ return React__namespace.createElement(CollabRowComponent, props);
2905
+ });
2906
+
2907
+ // A non-modal window: docked to the viewport's right edge until its header is
2908
+ // dragged, then free-floating. position:fixed, so it contributes nothing to the
2909
+ // creator's flex layout while still living inside the themed root, where the
2910
+ // --sjs2-* custom properties are defined.
2911
+ //
2912
+ // Markup only. The root node is handed to the model the way survey-core's popup
2913
+ // views do, and the header's raw pointerdown is forwarded; geometry, listeners,
2914
+ // focus and the drag itself all live in FloatingPanelModel. Hiding is part of
2915
+ // `style` too, which is why the root is always rendered.
2916
+ class FloatingPanelComponent extends surveyReactUi.SurveyElementBase {
2917
+ constructor(props) {
2918
+ super(props);
2919
+ this.root = React__namespace.createRef();
2920
+ }
2921
+ get model() {
2922
+ return this.props.model;
2923
+ }
2924
+ getStateElement() {
2925
+ return this.model;
2926
+ }
2927
+ componentDidMount() {
2928
+ super.componentDidMount();
2929
+ this.model.setComponentElement(this.root.current);
2930
+ }
2931
+ componentWillUnmount() {
2932
+ super.componentWillUnmount();
2933
+ this.model.resetComponentElement();
2934
+ }
2935
+ renderElement() {
2936
+ const model = this.model;
2937
+ const content = surveyReactUi.ReactElementFactory.Instance.createElement(model.contentComponentName, model.contentComponentData);
2938
+ return (React__namespace.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() },
2939
+ React__namespace.createElement("div", { className: model.headerCss, onPointerDown: (e) => model.onPointerDown(e.nativeEvent) },
2940
+ React__namespace.createElement("span", { id: model.titleId, className: "svc-floating-panel__title" }, model.titleText),
2941
+ React__namespace.createElement("span", { className: "svc-floating-panel__drag", "aria-hidden": "true" },
2942
+ React__namespace.createElement(surveyReactUi.SvgIcon, { iconName: "icon-draghorizontal-24x16", size: "auto" })),
2943
+ React__namespace.createElement(surveyReactUi.SurveyActionBar, { model: model.headerToolbar })),
2944
+ React__namespace.createElement("div", { className: model.bodyCss }, content)));
2945
+ }
2946
+ }
2947
+ surveyReactUi.ReactElementFactory.Instance.registerElement("svc-floating-panel", (props) => {
2948
+ return React__namespace.createElement(FloatingPanelComponent, props);
2949
+ });
2950
+
2768
2951
  let ItemTemplateComponent$1 = class ItemTemplateComponent extends surveyReactUi.SurveyElementBase {
2769
2952
  render() {
2770
2953
  const item = this.props.item;
@@ -2986,8 +3169,8 @@
2986
3169
  });
2987
3170
 
2988
3171
  exports.Version = void 0;
2989
- exports.Version = `${"3.0.0"}`;
2990
- surveyCore.checkLibraryVersion(`${"3.0.0"}`, "survey-creator-react");
3172
+ exports.Version = `${"3.0.1"}`;
3173
+ surveyCore.checkLibraryVersion(`${"3.0.1"}`, "survey-creator-react");
2991
3174
 
2992
3175
  Object.defineProperty(exports, "PropertyGridEditorCollection", {
2993
3176
  enumerable: true,
@@ -3030,8 +3213,10 @@
3030
3213
  exports.AddQuestionButtonComponent = AddQuestionButtonComponent;
3031
3214
  exports.CellQuestionAdornerComponent = CellQuestionAdornerComponent;
3032
3215
  exports.CellQuestionDropdownAdornerComponent = CellQuestionDropdownAdornerComponent;
3216
+ exports.CollabRowComponent = CollabRowComponent;
3033
3217
  exports.ComponentContainer = ComponentContainer;
3034
3218
  exports.CreatorSurveyPageComponent = CreatorSurveyPageComponent;
3219
+ exports.FloatingPanelComponent = FloatingPanelComponent;
3035
3220
  exports.IconItem = IconItem;
3036
3221
  exports.ImageItemValueAdornerComponent = ImageItemValueAdornerComponent;
3037
3222
  exports.ItemValueAdornerComponent = ItemValueAdornerComponent;
@@ -3091,7 +3276,9 @@
3091
3276
  exports.TabbedMenuItemComponent = TabbedMenuItemComponent;
3092
3277
  exports.ToolboxList = ToolboxList;
3093
3278
  exports.TranslateFromAction = TranslateFromAction;
3279
+ exports.TranslationDropdownQuestionComponent = TranslationDropdownQuestionComponent;
3094
3280
  exports.TranslationLineSkeleton = TranslationLineSkeleton;
3281
+ exports.TranslationLocaleItemComponent = TranslationLocaleItemComponent;
3095
3282
 
3096
3283
  }));
3097
3284
  //# sourceMappingURL=survey-creator-react.js.map