survey-react-ui 2.3.9 → 2.3.11

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 - Survey JavaScript library v2.3.9
2
+ * surveyjs - Survey JavaScript library v2.3.11
3
3
  * Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
@@ -118,6 +118,16 @@ class SurveyElementBase extends React.Component {
118
118
  });
119
119
  }
120
120
  };
121
+ this.onArrayChangedCallback = (stateElement, options) => {
122
+ if (this.isRendering)
123
+ return;
124
+ this.changedStatePropNameValue = options.name;
125
+ this.setState((state) => {
126
+ var newState = {};
127
+ newState[options.name] = options.newValue;
128
+ return newState;
129
+ });
130
+ };
121
131
  }
122
132
  componentDidMount() {
123
133
  this.makeBaseElementsReact();
@@ -244,16 +254,7 @@ class SurveyElementBase extends React.Component {
244
254
  var val = hash[key];
245
255
  if (Array.isArray(val)) {
246
256
  var val = val;
247
- val["onArrayChanged"] = (arrayChanges) => {
248
- if (this.isRendering)
249
- return;
250
- this.changedStatePropNameValue = key;
251
- this.setState((state) => {
252
- var newState = {};
253
- newState[key] = val;
254
- return newState;
255
- });
256
- };
257
+ stateElement.addOnArrayChangedCallback(val, this.onArrayChangedCallback);
257
258
  }
258
259
  });
259
260
  stateElement.setPropertyValueCoreHandler = this.propertyValueChangedHandler;
@@ -270,7 +271,7 @@ class SurveyElementBase extends React.Component {
270
271
  var val = hash[key];
271
272
  if (Array.isArray(val)) {
272
273
  var val = val;
273
- val["onArrayChanged"] = () => { };
274
+ stateElement.removeOnArrayChangedCallback(val, this.onArrayChangedCallback);
274
275
  }
275
276
  });
276
277
  }
@@ -801,13 +802,16 @@ class TitleActions extends React.Component {
801
802
  get element() {
802
803
  return this.props.element;
803
804
  }
805
+ get renderActions() {
806
+ return this.props.renderActions === undefined ? true : this.props.renderActions;
807
+ }
804
808
  render() {
805
809
  const titleContent = React.createElement(TitleContent, { element: this.element, cssClasses: this.cssClasses });
806
810
  if (!this.element.hasTitleActions)
807
811
  return titleContent;
808
812
  return (React.createElement("div", { className: "sv-title-actions" },
809
813
  React.createElement("span", { className: "sv-title-actions__title" }, titleContent),
810
- React.createElement(SurveyActionBar, { model: this.element.getTitleToolbar() })));
814
+ (this.renderActions ? React.createElement(SurveyActionBar, { model: this.element.getTitleToolbar() }) : null)));
811
815
  }
812
816
  }
813
817
  RendererFactory.Instance.registerRenderer("element", "title-actions", "sv-title-actions");
@@ -834,7 +838,7 @@ class TitleElement extends React.Component {
834
838
  return null;
835
839
  const ariaLabel = element.titleAriaLabel || undefined;
836
840
  const titleExpandableSvg = this.renderTitleExpandableSvg();
837
- const titleContent = (React.createElement(TitleActions, { element: element, cssClasses: element.cssClasses }));
841
+ const titleContent = (React.createElement(TitleActions, { element: element, cssClasses: element.cssClasses, renderActions: this.props.renderActions }));
838
842
  let onClick = undefined;
839
843
  let onKeyUp = undefined;
840
844
  if (element.hasTitleEvents) {
@@ -1074,7 +1078,7 @@ class PopupModal extends SurveyElementBase {
1074
1078
  PopupModal.modalDescriptors = [];
1075
1079
 
1076
1080
  /*!
1077
- * surveyjs - Survey JavaScript library v2.3.9
1081
+ * surveyjs - Survey JavaScript library v2.3.11
1078
1082
  * Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
1079
1083
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
1080
1084
  */
@@ -1144,7 +1148,7 @@ var iconsV1 = {
1144
1148
  };
1145
1149
 
1146
1150
  /*!
1147
- * surveyjs - Survey JavaScript library v2.3.9
1151
+ * surveyjs - Survey JavaScript library v2.3.11
1148
1152
  * Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
1149
1153
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
1150
1154
  */
@@ -1928,7 +1932,7 @@ class SurveyQuestionCommentValueItem extends SurveyQuestionCommentItem {
1928
1932
  getTextAreaModel() {
1929
1933
  return this.props.question.getCommentTextAreaModel(this.props.item);
1930
1934
  }
1931
- getKey() { return this.props.item.normalizedId; }
1935
+ getKey() { return this.props.item.uniqueId; }
1932
1936
  }
1933
1937
  ReactQuestionFactory.Instance.registerQuestion("comment", (props) => {
1934
1938
  return React.createElement(SurveyQuestionComment, props);
@@ -2170,7 +2174,7 @@ class SurveyQuestion extends SurveyElementBase {
2170
2174
  var descriptionUnderInput = question.hasDescriptionUnderInput
2171
2175
  ? this.renderDescription()
2172
2176
  : null;
2173
- return (React.createElement("div", { className: question.cssContent || undefined, style: contentStyle, "aria-hidden": question.contentAriaHidden, role: "presentation" },
2177
+ return (React.createElement("div", { className: question.cssContent || undefined, style: contentStyle, "aria-hidden": question.contentAriaHidden, role: "presentation", "data-sv-drop-target-matrix": this.question.dragDropMatrixAttribute, "data-sv-drop-target-matrix-row": this.question.dragDropMatrixAttribute },
2174
2178
  questionRender,
2175
2179
  comment,
2176
2180
  descriptionUnderInput));
@@ -2646,7 +2650,7 @@ ReactElementFactory.Instance.registerElement("flowpanel", props => {
2646
2650
  return React.createElement(SurveyFlowPanel, props);
2647
2651
  });
2648
2652
 
2649
- class SurveyQuestionCheckbox extends SurveyQuestionElementBase {
2653
+ class SurveyQuestionSelectbase extends SurveyQuestionElementBase {
2650
2654
  constructor(props) {
2651
2655
  super(props);
2652
2656
  }
@@ -2656,29 +2660,29 @@ class SurveyQuestionCheckbox extends SurveyQuestionElementBase {
2656
2660
  renderElement() {
2657
2661
  var cssClasses = this.question.cssClasses;
2658
2662
  return (React.createElement("fieldset", { className: this.question.getSelectBaseRootCss(), ref: (fieldset) => (this.setControl(fieldset)), role: this.question.a11y_input_ariaRole, "aria-required": this.question.a11y_input_ariaRequired, "aria-label": this.question.a11y_input_ariaLabel, "aria-labelledby": this.question.a11y_input_ariaLabelledBy, "aria-describedby": this.question.a11y_input_ariaDescribedBy, "aria-invalid": this.question.a11y_input_ariaInvalid, "aria-errormessage": this.question.a11y_input_ariaErrormessage },
2659
- React.createElement("legend", { className: "sv-hidden" }, this.question.locTitle.renderedHtml),
2660
- this.getHeader(),
2663
+ this.renderHeader(),
2661
2664
  this.question.hasColumns
2662
2665
  ? this.getColumnedBody(cssClasses)
2663
2666
  : this.getBody(cssClasses),
2664
2667
  this.getFooter()));
2665
2668
  }
2666
- getHeader() {
2667
- if (this.question.hasHeadItems) {
2668
- return this.question.headItems.map((item, ii) => this.renderItem(item, false, this.question.cssClasses));
2669
- }
2670
- }
2669
+ renderHeader() { return null; }
2671
2670
  getFooter() {
2672
2671
  if (this.question.hasFootItems) {
2673
- return this.question.footItems.map((item, ii) => this.renderItem(item, false, this.question.cssClasses));
2672
+ const items = this.question.footItems.map((item, ii) => this.renderItem(item, false, this.question.cssClasses));
2673
+ return React.createElement(React.Fragment, null, items);
2674
2674
  }
2675
+ return null;
2675
2676
  }
2677
+ getStateValue() { return undefined; }
2678
+ isItemChecked(item, value) { return false; }
2676
2679
  getColumnedBody(cssClasses) {
2677
2680
  return (React.createElement("div", { className: cssClasses.rootMultiColumn }, this.getColumns(cssClasses)));
2678
2681
  }
2679
2682
  getColumns(cssClasses) {
2683
+ const value = this.getStateValue();
2680
2684
  return this.question.columns.map((column, ci) => {
2681
- var items = column.map((item, ii) => this.renderItem(item, ci === 0 && ii === 0, cssClasses, "" + ci + ii));
2685
+ var items = column.map((item, ii) => this.renderItem(item, ci === 0 && ii === 0, cssClasses, "" + ci + ii, this.isItemChecked(item, value)));
2682
2686
  return (React.createElement("div", { key: "column" + ci + this.question.getItemsColumnKey(column), className: this.question.getColumnClass(), role: "presentation" }, items));
2683
2687
  });
2684
2688
  }
@@ -2691,22 +2695,23 @@ class SurveyQuestionCheckbox extends SurveyQuestionElementBase {
2691
2695
  }
2692
2696
  }
2693
2697
  getItems(cssClasses, choices) {
2694
- var renderedItems = [];
2695
- for (var i = 0; i < choices.length; i++) {
2696
- var item = choices[i];
2697
- var renderedItem = this.renderItem(item, i == 0, cssClasses, "" + i);
2698
+ const items = [];
2699
+ const value = this.getStateValue();
2700
+ for (let i = 0; i < choices.length; i++) {
2701
+ const item = choices[i];
2702
+ const renderedItem = this.renderItem(item, i == 0, cssClasses, "" + i, this.isItemChecked(item, value));
2698
2703
  if (!!renderedItem) {
2699
- renderedItems.push(renderedItem);
2704
+ items.push(renderedItem);
2700
2705
  }
2701
2706
  }
2702
- return renderedItems;
2707
+ return items;
2703
2708
  }
2704
2709
  get textStyle() {
2705
2710
  return null;
2706
2711
  }
2707
- renderItem(item, isFirst, cssClasses, index) {
2712
+ renderItem(item, isFirst, cssClasses, index, isChecked) {
2708
2713
  const renderedItem = ReactElementFactory.Instance.createElement(this.question.itemComponent, {
2709
- key: item.value,
2714
+ key: item.uniqueId,
2710
2715
  question: this.question,
2711
2716
  cssClasses: cssClasses,
2712
2717
  isDisplayMode: this.isDisplayMode,
@@ -2714,6 +2719,8 @@ class SurveyQuestionCheckbox extends SurveyQuestionElementBase {
2714
2719
  textStyle: this.textStyle,
2715
2720
  index: index,
2716
2721
  isFirst: isFirst,
2722
+ isChecked: isChecked,
2723
+ creator: this.props.creator,
2717
2724
  });
2718
2725
  const survey = this.question.survey;
2719
2726
  let wrappedItem = null;
@@ -2723,11 +2730,11 @@ class SurveyQuestionCheckbox extends SurveyQuestionElementBase {
2723
2730
  return wrappedItem !== null && wrappedItem !== void 0 ? wrappedItem : renderedItem;
2724
2731
  }
2725
2732
  }
2726
- class SurveyQuestionCheckboxItem extends ReactSurveyElement {
2733
+ class SurveyQuestionSelectBaseItem extends ReactSurveyElement {
2727
2734
  constructor(props) {
2728
2735
  super(props);
2729
2736
  this.handleOnChange = (event) => {
2730
- this.question.clickItemHandler(this.item, event.target.checked);
2737
+ this.doOnItemChange(event);
2731
2738
  };
2732
2739
  this.rootRef = React.createRef();
2733
2740
  }
@@ -2774,15 +2781,19 @@ class SurveyQuestionCheckboxItem extends ReactSurveyElement {
2774
2781
  !!this.question.customWidget.widgetJson.isDefaultRender ||
2775
2782
  !!this.question.customWidget.widgetJson.render);
2776
2783
  }
2784
+ doOnItemChange(event) { }
2777
2785
  canRender() {
2778
2786
  return !!this.item && !!this.question;
2779
2787
  }
2780
2788
  renderElement() {
2781
- const isChecked = this.question.isItemSelected(this.item);
2782
2789
  return React.createElement(React.Fragment, null,
2783
- this.renderCheckbox(isChecked, null),
2790
+ this.renderElementContent(),
2791
+ this.renderPanel(),
2784
2792
  this.renderComment());
2785
2793
  }
2794
+ renderElementContent() {
2795
+ return null;
2796
+ }
2786
2797
  get inputStyle() {
2787
2798
  return null; //{ marginRight: "3px" };
2788
2799
  }
@@ -2792,7 +2803,61 @@ class SurveyQuestionCheckboxItem extends ReactSurveyElement {
2792
2803
  return React.createElement("div", { className: this.question.getCommentAreaCss(true) },
2793
2804
  React.createElement(SurveyQuestionCommentValueItem, { question: this.question, item: this.item, cssClasses: this.question.cssClasses }));
2794
2805
  }
2795
- renderCheckbox(isChecked, otherItem) {
2806
+ renderPanel() {
2807
+ if (this.item.isPanelShowing) {
2808
+ const panel = this.item.panel;
2809
+ return (React.createElement(SurveyPanel, { key: panel.id, element: panel, survey: this.question.survey, cssClasses: this.props.cssClasses, isDisplayMode: this.isDisplayMode, creator: this.props.creator }));
2810
+ }
2811
+ return null;
2812
+ }
2813
+ componentDidMount() {
2814
+ super.componentDidMount();
2815
+ if (!this.question.isDesignMode) {
2816
+ this.item.setRootElement(this.rootRef.current);
2817
+ }
2818
+ }
2819
+ componentWillUnmount() {
2820
+ super.componentWillUnmount();
2821
+ if (!this.question.isDesignMode) {
2822
+ this.item.setRootElement(undefined);
2823
+ }
2824
+ }
2825
+ }
2826
+
2827
+ class SurveyQuestionCheckbox extends SurveyQuestionSelectbase {
2828
+ constructor(props) {
2829
+ super(props);
2830
+ }
2831
+ get question() {
2832
+ return this.questionBase;
2833
+ }
2834
+ renderHeader() {
2835
+ return React.createElement(React.Fragment, null,
2836
+ React.createElement("legend", { className: "sv-hidden" }, this.question.locTitle.renderedHtml),
2837
+ this.getHeader());
2838
+ }
2839
+ getHeader() {
2840
+ if (this.question.hasHeadItems) {
2841
+ return this.question.headItems.map((item, ii) => this.renderItem(item, false, this.question.cssClasses));
2842
+ }
2843
+ return null;
2844
+ }
2845
+ }
2846
+ class SurveyQuestionCheckboxItem extends SurveyQuestionSelectBaseItem {
2847
+ constructor(props) {
2848
+ super(props);
2849
+ }
2850
+ doOnItemChange(event) {
2851
+ this.question.clickItemHandler(this.item, event.target.checked);
2852
+ }
2853
+ renderElementContent() {
2854
+ const isChecked = this.question.isItemSelected(this.item);
2855
+ return this.renderCheckbox(isChecked);
2856
+ }
2857
+ get inputStyle() {
2858
+ return null; //{ marginRight: "3px" };
2859
+ }
2860
+ renderCheckbox(isChecked) {
2796
2861
  const id = this.question.getItemId(this.item);
2797
2862
  const itemClass = this.question.getItemClass(this.item);
2798
2863
  const labelClass = this.question.getLabelClass(this.item);
@@ -2806,20 +2871,7 @@ class SurveyQuestionCheckboxItem extends ReactSurveyElement {
2806
2871
  React.createElement("use", { xlinkHref: this.question.itemSvgIcon })) :
2807
2872
  null) :
2808
2873
  null,
2809
- itemLabel),
2810
- otherItem));
2811
- }
2812
- componentDidMount() {
2813
- super.componentDidMount();
2814
- if (!this.question.isDesignMode) {
2815
- this.item.setRootElement(this.rootRef.current);
2816
- }
2817
- }
2818
- componentWillUnmount() {
2819
- super.componentWillUnmount();
2820
- if (!this.question.isDesignMode) {
2821
- this.item.setRootElement(undefined);
2822
- }
2874
+ itemLabel)));
2823
2875
  }
2824
2876
  }
2825
2877
  ReactElementFactory.Instance.registerElement("survey-checkbox-item", (props) => {
@@ -2879,7 +2931,7 @@ class SurveyQuestionRanking extends SurveyQuestionElementBase {
2879
2931
  const index = i;
2880
2932
  const indexText = this.question.getNumberByIndex(index);
2881
2933
  const tabIndex = this.question.getItemTabIndex(item);
2882
- const renderedItem = (React.createElement(SurveyQuestionRankingItem, { key: item.value, text: text, index: index, indexText: indexText, itemTabIndex: tabIndex, handleKeydown: handleKeydown, handlePointerDown: handlePointerDown, handlePointerUp: handlePointerUp, cssClasses: cssClasses, itemClass: itemClass, question: question, unrankedItem: unrankedItem, item: item }));
2934
+ const renderedItem = (React.createElement(SurveyQuestionRankingItem, { key: item.uniqueId, text: text, index: index, indexText: indexText, itemTabIndex: tabIndex, handleKeydown: handleKeydown, handlePointerDown: handlePointerDown, handlePointerUp: handlePointerUp, cssClasses: cssClasses, itemClass: itemClass, question: question, unrankedItem: unrankedItem, item: item }));
2883
2935
  const survey = this.question.survey;
2884
2936
  let wrappedItem = null;
2885
2937
  if (!!survey) {
@@ -3259,7 +3311,7 @@ class SurveyQuestionDropdownBase extends SurveyQuestionUncontrolledElement {
3259
3311
  renderOther(item, cssClasses) {
3260
3312
  if (!item || !item.isCommentShowing)
3261
3313
  return null;
3262
- return (React.createElement("div", { key: item.normalizedId, className: this.question.getCommentAreaCss(true) },
3314
+ return (React.createElement("div", { key: item.uniqueId, className: this.question.getCommentAreaCss(true) },
3263
3315
  React.createElement(SurveyQuestionCommentValueItem, { question: this.question, item: item, cssClasses: this.question.cssClasses })));
3264
3316
  }
3265
3317
  renderEditorButtons() {
@@ -3382,7 +3434,7 @@ class SurveyQuestionDropdownSelect extends SurveyQuestionDropdown {
3382
3434
  React.createElement("div", { id: this.question.inputId, className: this.question.getControlClass(), disabled: true }, this.question.readOnlyText)) :
3383
3435
  (React.createElement("select", { id: this.question.inputId, className: this.question.getControlClass(), ref: (select) => (this.setControl(select)), autoComplete: this.question.autocomplete, onChange: this.updateValueOnEvent, onInput: this.updateValueOnEvent, onClick: click, onKeyUp: keyup, "aria-required": this.question.a11y_input_ariaRequired, "aria-label": this.question.a11y_input_ariaLabel, "aria-invalid": this.question.a11y_input_ariaInvalid, "aria-errormessage": this.question.a11y_input_ariaErrormessage, required: this.question.isRequired },
3384
3436
  this.question.allowClear ? (React.createElement("option", { value: "" }, this.question.placeholder)) : null,
3385
- this.question.visibleChoices.map((item, i) => React.createElement(SurveyQuestionOptionItem, { key: "item" + i, item: item }))));
3437
+ this.question.visibleChoices.map((item) => React.createElement(SurveyQuestionOptionItem, { key: item.uniqueId, item: item }))));
3386
3438
  return (React.createElement("div", { className: cssClasses.selectWrapper },
3387
3439
  selectElement,
3388
3440
  this.createChevronButton()));
@@ -3428,21 +3480,19 @@ class SurveyQuestionMatrix extends SurveyQuestionElementBase {
3428
3480
  var headers = [];
3429
3481
  for (var i = 0; i < this.question.visibleColumns.length; i++) {
3430
3482
  var column = this.question.visibleColumns[i];
3431
- var key = "column" + i;
3432
3483
  var columText = this.renderLocString(column.locText);
3433
3484
  const style = {};
3434
3485
  if (!!this.question.columnMinWidth) {
3435
3486
  style.minWidth = this.question.columnMinWidth;
3436
3487
  style.width = this.question.columnMinWidth;
3437
3488
  }
3438
- headers.push(React.createElement("th", { className: this.question.cssClasses.headerCell, style: style, key: key }, this.wrapCell({ column: column }, columText, "column-header")));
3489
+ headers.push(React.createElement("th", { className: this.question.cssClasses.headerCell, style: style, key: column.uniqueId }, this.wrapCell({ column: column }, columText, "column-header")));
3439
3490
  }
3440
3491
  var rows = [];
3441
3492
  var visibleRows = this.question.visibleRows;
3442
3493
  for (var i = 0; i < visibleRows.length; i++) {
3443
3494
  var row = visibleRows[i];
3444
- var key = "row-" + row.name + "-" + i;
3445
- rows.push(React.createElement(SurveyQuestionMatrixRow, { key: key, question: this.question, cssClasses: cssClasses, row: row, isFirst: i == 0 }));
3495
+ rows.push(React.createElement(SurveyQuestionMatrixRow, { key: row.uniqueId, question: this.question, cssClasses: cssClasses, row: row, isFirst: i == 0 }));
3446
3496
  }
3447
3497
  var header = !this.question.showHeader ? null : (React.createElement("thead", { role: "presentation" },
3448
3498
  React.createElement("tr", null,
@@ -3508,7 +3558,7 @@ class SurveyQuestionMatrixRow extends ReactSurveyElement {
3508
3558
  for (var i = 0; i < this.question.visibleColumns.length; i++) {
3509
3559
  let td = null;
3510
3560
  const column = this.question.visibleColumns[i];
3511
- const key = "value" + i;
3561
+ const key = column.uniqueId;
3512
3562
  let itemClass = this.question.getItemClass(row, column);
3513
3563
  if (this.question.hasCellText) {
3514
3564
  const getHandler = (column) => () => this.cellClick(row, column);
@@ -3807,7 +3857,7 @@ class SurveyQuestionMultipleText extends SurveyQuestionElementBase {
3807
3857
  else {
3808
3858
  cellContent = React.createElement(SurveyMultipleTextItem, { question: this.question, item: cell.item, creator: this.creator, cssClasses: cssClasses });
3809
3859
  }
3810
- return (React.createElement("td", { key: "item" + index, className: cell.className, onFocus: focusIn }, cellContent));
3860
+ return (React.createElement("td", { key: cell.item.id, className: cell.className, onFocus: focusIn }, cellContent));
3811
3861
  }
3812
3862
  renderRow(rowIndex, cells, cssClasses) {
3813
3863
  const key = "item" + rowIndex;
@@ -3855,90 +3905,32 @@ ReactQuestionFactory.Instance.registerQuestion("multipletext", (props) => {
3855
3905
  return React.createElement(SurveyQuestionMultipleText, props);
3856
3906
  });
3857
3907
 
3858
- class SurveyQuestionRadiogroup extends SurveyQuestionElementBase {
3908
+ class SurveyQuestionRadiogroup extends SurveyQuestionSelectbase {
3859
3909
  constructor(props) {
3860
3910
  super(props);
3861
3911
  }
3862
3912
  get question() {
3863
3913
  return this.questionBase;
3864
3914
  }
3865
- renderElement() {
3866
- var cssClasses = this.question.cssClasses;
3867
- var clearButton = null;
3868
- if (this.question.showClearButtonInContent) {
3869
- clearButton = (React.createElement("div", null,
3870
- React.createElement("input", { type: "button", className: this.question.cssClasses.clearButton, onClick: () => this.question.clearValue(true), value: this.question.clearButtonCaption })));
3871
- }
3872
- return (React.createElement("fieldset", { className: this.question.getSelectBaseRootCss(), ref: (fieldset) => (this.setControl(fieldset)), role: this.question.a11y_input_ariaRole, "aria-required": this.question.a11y_input_ariaRequired, "aria-label": this.question.a11y_input_ariaLabel, "aria-labelledby": this.question.a11y_input_ariaLabelledBy, "aria-describedby": this.question.a11y_input_ariaDescribedBy, "aria-invalid": this.question.a11y_input_ariaInvalid, "aria-errormessage": this.question.a11y_input_ariaErrormessage },
3873
- this.question.hasColumns
3874
- ? this.getColumnedBody(cssClasses)
3875
- : this.getBody(cssClasses),
3876
- this.getFooter(),
3877
- clearButton));
3878
- }
3879
3915
  getFooter() {
3880
- if (this.question.hasFootItems) {
3881
- return this.question.footItems.map((item, ii) => this.renderItem(item, false, this.question.cssClasses));
3882
- }
3883
- }
3884
- getColumnedBody(cssClasses) {
3885
- return (React.createElement("div", { className: cssClasses.rootMultiColumn }, this.getColumns(cssClasses)));
3886
- }
3887
- getColumns(cssClasses) {
3888
- var value = this.getStateValue();
3889
- return this.question.columns.map((column, ci) => {
3890
- var items = column.map((item, ii) => this.renderItem(item, value, cssClasses, "" + ci + ii));
3891
- return (React.createElement("div", { key: "column" + ci + this.question.getItemsColumnKey(column), className: this.question.getColumnClass(), role: "presentation" }, items));
3892
- });
3893
- }
3894
- getBody(cssClasses) {
3895
- if (this.question.blockedRow) {
3896
- return React.createElement("div", { className: cssClasses.rootRow }, this.getItems(cssClasses, this.question.dataChoices));
3897
- }
3898
- else {
3899
- return React.createElement(React.Fragment, null, this.getItems(cssClasses, this.question.bodyItems));
3900
- }
3901
- }
3902
- getItems(cssClasses, choices) {
3903
- var items = [];
3904
- var value = this.getStateValue();
3905
- for (var i = 0; i < choices.length; i++) {
3906
- var item = choices[i];
3907
- var renderedItem = this.renderItem(item, value, cssClasses, "" + i);
3908
- items.push(renderedItem);
3909
- }
3910
- return items;
3911
- }
3912
- get textStyle() {
3913
- return null; //{ display: "inline", position: "static" };
3916
+ return React.createElement(React.Fragment, null,
3917
+ super.getFooter(),
3918
+ this.renderClearButton());
3914
3919
  }
3915
- renderItem(item, value, cssClasses, index) {
3916
- const renderedItem = ReactElementFactory.Instance.createElement(this.question.itemComponent, {
3917
- key: item.value,
3918
- question: this.question,
3919
- cssClasses: cssClasses,
3920
- isDisplayMode: this.isDisplayMode,
3921
- item: item,
3922
- textStyle: this.textStyle,
3923
- index: index,
3924
- isChecked: value === item.value,
3925
- });
3926
- const survey = this.question.survey;
3927
- let wrappedItem = null;
3928
- if (!!survey) {
3929
- wrappedItem = ReactSurveyElementsWrapper.wrapItemValue(survey, renderedItem, this.question, item);
3930
- }
3931
- return wrappedItem !== null && wrappedItem !== void 0 ? wrappedItem : renderedItem;
3920
+ renderClearButton() {
3921
+ if (!this.question.showClearButtonInContent)
3922
+ return null;
3923
+ return (React.createElement("div", null,
3924
+ React.createElement("input", { type: "button", className: this.question.cssClasses.clearButton, onClick: () => this.question.clearValueFromUI(), value: this.question.clearButtonCaption })));
3932
3925
  }
3933
3926
  getStateValue() {
3934
3927
  return !this.question.isEmpty() ? this.question.renderedValue : "";
3935
3928
  }
3929
+ isItemChecked(item, value) { return item.value === value; }
3936
3930
  }
3937
- class SurveyQuestionRadioItem extends ReactSurveyElement {
3931
+ class SurveyQuestionRadioItem extends SurveyQuestionSelectBaseItem {
3938
3932
  constructor(props) {
3939
3933
  super(props);
3940
- this.rootRef = React.createRef();
3941
- this.handleOnChange = this.handleOnChange.bind(this);
3942
3934
  this.handleOnMouseDown = this.handleOnMouseDown.bind(this);
3943
3935
  }
3944
3936
  getStateElement() {
@@ -3947,64 +3939,17 @@ class SurveyQuestionRadioItem extends ReactSurveyElement {
3947
3939
  get question() {
3948
3940
  return this.props.question;
3949
3941
  }
3950
- get item() {
3951
- return this.props.item;
3952
- }
3953
- get textStyle() {
3954
- return this.props.textStyle;
3955
- }
3956
- get index() {
3957
- return this.props.index;
3958
- }
3959
3942
  get isChecked() {
3960
3943
  return this.props.isChecked;
3961
3944
  }
3962
- get hideCaption() {
3963
- return this.props.hideCaption === true;
3964
- }
3965
- get ariaLabel() {
3966
- return this.props.ariaLabel || null;
3967
- }
3968
- shouldComponentUpdate(nextProps, nextState) {
3969
- if (!super.shouldComponentUpdate(nextProps, nextState))
3970
- return false;
3971
- if (!this.question)
3972
- return false;
3973
- return (!this.question.customWidget ||
3974
- !!this.question.customWidgetData.isNeedRender ||
3975
- !!this.question.customWidget.widgetJson.isDefaultRender ||
3976
- !!this.question.customWidget.widgetJson.render);
3977
- }
3978
- handleOnChange(event) {
3945
+ doOnItemChange(event) {
3979
3946
  this.question.clickItemHandler(this.item);
3980
3947
  }
3981
3948
  handleOnMouseDown(event) {
3982
3949
  this.question.onMouseDown();
3983
3950
  }
3984
- canRender() {
3985
- return !!this.question && !!this.item;
3986
- }
3987
- componentDidUpdate(prevProps, prevState) {
3988
- super.componentDidUpdate(prevProps, prevState);
3989
- if (prevProps.item !== this.props.item && !this.question.isDesignMode) {
3990
- if (this.props.item) {
3991
- this.props.item.setRootElement(this.rootRef.current);
3992
- }
3993
- if (prevProps.item) {
3994
- prevProps.item.setRootElement(undefined);
3995
- }
3996
- }
3997
- }
3998
- renderElement() {
3999
- return React.createElement(React.Fragment, null,
4000
- this.renderRadioButton(),
4001
- this.renderComment());
4002
- }
4003
- renderComment() {
4004
- if (!this.item.isCommentShowing)
4005
- return null;
4006
- return React.createElement("div", { className: this.question.getCommentAreaCss(true) },
4007
- React.createElement(SurveyQuestionCommentValueItem, { question: this.question, item: this.item, cssClasses: this.question.cssClasses }));
3951
+ renderElementContent() {
3952
+ return this.renderRadioButton();
4008
3953
  }
4009
3954
  renderRadioButton() {
4010
3955
  var itemClass = this.question.getItemClass(this.item);
@@ -4022,18 +3967,6 @@ class SurveyQuestionRadioItem extends ReactSurveyElement {
4022
3967
  null,
4023
3968
  itemLabel)));
4024
3969
  }
4025
- componentDidMount() {
4026
- super.componentDidMount();
4027
- if (!this.question.isDesignMode) {
4028
- this.item.setRootElement(this.rootRef.current);
4029
- }
4030
- }
4031
- componentWillUnmount() {
4032
- super.componentWillUnmount();
4033
- if (!this.question.isDesignMode) {
4034
- this.item.setRootElement(undefined);
4035
- }
4036
- }
4037
3970
  }
4038
3971
  ReactElementFactory.Instance.registerElement("survey-radiogroup-item", (props) => {
4039
3972
  return React.createElement(SurveyQuestionRadioItem, props);
@@ -4489,7 +4422,7 @@ class SurveyQuestionMatrixDropdownBase extends SurveyQuestionElementBase {
4489
4422
  return this.renderTableDiv();
4490
4423
  }
4491
4424
  renderTableDiv() {
4492
- return (React.createElement("div", { className: this.question.cssClasses.tableWrapper, "data-sv-drop-target-matrix-row": this.question.renderedTable.wrapperDropTargetId, ref: (root) => (this.setControl(root)) },
4425
+ return (React.createElement("div", { className: this.question.cssClasses.tableWrapper, ref: (root) => (this.setControl(root)) },
4493
4426
  React.createElement(SurveyQuestionMatrixTable, { question: this.question, creator: this.creator, wrapCell: (cell, element, reason) => this.wrapCell(cell, element, reason) })));
4494
4427
  }
4495
4428
  }
@@ -5443,7 +5376,7 @@ class SurveyQuestionImagePicker extends SurveyQuestionElementBase {
5443
5376
  }
5444
5377
  getColumns(cssClasses) {
5445
5378
  return this.question.columns.map((column, ci) => {
5446
- var items = column.map((item, ii) => this.renderItem("item" + ii, item, cssClasses));
5379
+ var items = column.map((item, ii) => this.renderItem(item, cssClasses));
5447
5380
  return (React.createElement("div", { key: "column" + ci + this.question.getItemsColumnKey(column), className: this.question.getColumnClass(), role: "presentation" }, items));
5448
5381
  });
5449
5382
  }
@@ -5451,16 +5384,15 @@ class SurveyQuestionImagePicker extends SurveyQuestionElementBase {
5451
5384
  var items = [];
5452
5385
  for (var i = 0; i < this.question.visibleChoices.length; i++) {
5453
5386
  var item = this.question.visibleChoices[i];
5454
- var key = "item" + i;
5455
- items.push(this.renderItem(key, item, cssClasses));
5387
+ items.push(this.renderItem(item, cssClasses));
5456
5388
  }
5457
5389
  return items;
5458
5390
  }
5459
5391
  get textStyle() {
5460
5392
  return { marginLeft: "3px", display: "inline", position: "static" };
5461
5393
  }
5462
- renderItem(key, item, cssClasses) {
5463
- const renderedItem = React.createElement(SurveyQuestionImagePickerItem, { key: key, question: this.question, item: item, cssClasses: cssClasses });
5394
+ renderItem(item, cssClasses) {
5395
+ const renderedItem = React.createElement(SurveyQuestionImagePickerItem, { key: item.uniqueId, question: this.question, item: item, cssClasses: cssClasses });
5464
5396
  const survey = this.question.survey;
5465
5397
  let wrappedItem = null;
5466
5398
  if (!!survey) {
@@ -5646,7 +5578,7 @@ class SurveyQuestionSignaturePad extends SurveyQuestionElementBase {
5646
5578
  return null;
5647
5579
  var cssClasses = this.question.cssClasses;
5648
5580
  return React.createElement("div", { className: cssClasses.controls },
5649
- React.createElement("button", { type: "button", className: cssClasses.clearButton, title: this.question.clearButtonCaption, onClick: () => this.question.clearValue(true) },
5581
+ React.createElement("button", { type: "button", className: cssClasses.clearButton, title: this.question.clearButtonCaption, onClick: () => this.question.clearValueFromUI() },
5650
5582
  this.question.cssClasses.clearButtonIconId ? React.createElement(SvgIcon, { iconName: this.question.cssClasses.clearButtonIconId, size: "auto" }) : React.createElement("span", null, "\u2716"),
5651
5583
  " "));
5652
5584
  }
@@ -6093,9 +6025,20 @@ class SliderLabelItem extends SurveyElementBase {
6093
6025
  renderElement() {
6094
6026
  const { cssClasses, handleLabelPointerUp, getLabelCss, getPercent } = this.question;
6095
6027
  const { value, locText } = this.item;
6096
- return React.createElement("div", { key: this.item.id, className: getLabelCss(locText), style: { left: getPercent(value) + "%" }, onPointerUp: (e) => { handleLabelPointerUp(e.nativeEvent, value); } },
6028
+ let labelText = null;
6029
+ let labelTextSecondary = null;
6030
+ if (this.item.showValue) {
6031
+ labelText = React.createElement("div", { className: cssClasses.labelText }, this.item.value);
6032
+ labelTextSecondary = React.createElement("div", { className: cssClasses.labelTextSecondaryMode }, this.renderLocString(locText));
6033
+ }
6034
+ else {
6035
+ labelText = React.createElement("div", { className: cssClasses.labelText }, this.renderLocString(locText));
6036
+ }
6037
+ return React.createElement("div", { key: this.item.uniqueId, className: getLabelCss(locText), style: { left: getPercent(value) + "%" }, onPointerUp: (e) => { handleLabelPointerUp(e.nativeEvent, value); } },
6097
6038
  React.createElement("div", { className: cssClasses.labelTick }),
6098
- React.createElement("div", { className: cssClasses.labelText }, this.renderLocString(locText)));
6039
+ React.createElement("div", { className: cssClasses.labelTextContainer },
6040
+ labelText,
6041
+ labelTextSecondary));
6099
6042
  }
6100
6043
  }
6101
6044
  ReactElementFactory.Instance.registerElement("sv-slider-label-item", (props) => {
@@ -6235,7 +6178,7 @@ ReactElementFactory.Instance.registerElement(LocalizableString.editableRenderer,
6235
6178
  return React.createElement(SurveyLocStringEditor, props);
6236
6179
  });
6237
6180
 
6238
- checkLibraryVersion(`${"2.3.9"}`, "survey-react-ui");
6181
+ checkLibraryVersion(`${"2.3.11"}`, "survey-react-ui");
6239
6182
 
6240
6183
  export { CharacterCounterComponent, ComponentsContainer, Header, HeaderCell, HeaderMobile, List, ListItemContent, ListItemGroup, LoadingIndicatorComponent, LogoImage, MatrixRow, NotifierComponent, Popup, PopupModal, PopupSurvey, QuestionErrorComponent, RatingDropdownItem, RatingItem, RatingItemSmiley, RatingItemStar, ReactElementFactory, ReactQuestionFactory, ReactSurveyElement, ReactSurveyElementsWrapper, Scroll, Skeleton, SliderLabelItem, Survey, SurveyActionBar, SurveyElementBase, SurveyElementErrors, SurveyFileChooseButton, SurveyFileItem, SurveyFilePreview, SurveyFlowPanel, SurveyHeader, SurveyLocStringEditor, SurveyLocStringViewer, SurveyNavigationBase, SurveyNavigationButton, SurveyPage, SurveyPanel, SurveyProgress, SurveyProgressButtons, SurveyProgressToc, SurveyQuestion, SurveyQuestionAndErrorsCell, SurveyQuestionBoolean, SurveyQuestionBooleanCheckbox, SurveyQuestionBooleanRadio, SurveyQuestionButtonGroup, SurveyQuestionButtonGroupDropdown, SurveyQuestionCheckbox, SurveyQuestionCheckboxItem, SurveyQuestionComment, SurveyQuestionCommentItem, SurveyQuestionComposite, SurveyQuestionCustom, SurveyQuestionDropdown, SurveyQuestionDropdownBase, SurveyQuestionDropdownSelect, SurveyQuestionElementBase, SurveyQuestionEmpty, SurveyQuestionExpression, SurveyQuestionFile, SurveyQuestionHtml, SurveyQuestionImage, SurveyQuestionImagePicker, SurveyQuestionMatrix, SurveyQuestionMatrixCell, SurveyQuestionMatrixDetailButton, SurveyQuestionMatrixDropdown, SurveyQuestionMatrixDropdownBase, SurveyQuestionMatrixDropdownCell, SurveyQuestionMatrixDynamic, SurveyQuestionMatrixDynamicAddButton, SurveyQuestionMatrixDynamicDragDropIcon, SurveyQuestionMatrixDynamicRemoveButton, SurveyQuestionMatrixRow, SurveyQuestionMultipleText, SurveyQuestionOptionItem, SurveyQuestionPanelDynamic, SurveyQuestionPanelDynamicAddButton, SurveyQuestionPanelDynamicNextButton, SurveyQuestionPanelDynamicPrevButton, SurveyQuestionPanelDynamicProgressText, SurveyQuestionPanelDynamicRemoveButton, SurveyQuestionRadioItem, SurveyQuestionRadiogroup, SurveyQuestionRanking, SurveyQuestionRankingItem, SurveyQuestionRankingItemContent, SurveyQuestionRating, SurveyQuestionRatingDropdown, SurveyQuestionSignaturePad, SurveyQuestionSlider, SurveyQuestionTagbox, SurveyQuestionTagboxItem, SurveyQuestionText, SurveyRow, SurveyTimerPanel, SurveyWindow, SvgBundleComponent, SvgIcon, TagboxFilterString, TitleActions, TitleElement, attachKey2click };
6241
6184
  //# sourceMappingURL=survey-react-ui.mjs.map