survey-react-ui 2.0.9 → 2.1.0
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/fesm/survey-react-ui.mjs +115 -21
- package/fesm/survey-react-ui.mjs.map +1 -1
- package/package.json +2 -2
- package/survey-react-ui.js +263 -108
- package/survey-react-ui.js.map +1 -1
- package/survey-react-ui.min.js +1 -1
- package/survey-react-ui.min.js.LICENSE.txt +1 -1
- package/typings/entries/react-ui-model.d.ts +1 -0
- package/typings/src/reactquestion_checkbox.d.ts +1 -0
- package/typings/src/reactquestion_matrixdropdownbase.d.ts +1 -0
- package/typings/src/reactquestion_radiogroup.d.ts +1 -0
- package/typings/src/reactquestion_slider.d.ts +16 -0
package/fesm/survey-react-ui.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - Survey JavaScript library v2.0
|
|
2
|
+
* surveyjs - Survey JavaScript library v2.1.0
|
|
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
|
*/
|
|
@@ -1473,7 +1473,7 @@ class SurveyQuestion extends SurveyElementBase {
|
|
|
1473
1473
|
const singleInput = singleSummary || (question.singleInputQuestion ? this.renderSingleInputQuestion(question, cssClasses) : undefined);
|
|
1474
1474
|
const questionContent = singleInput || this.wrapQuestionContent(this.renderQuestionContent());
|
|
1475
1475
|
return (React.createElement(React.Fragment, null,
|
|
1476
|
-
React.createElement("div", { ref: this.rootRef, id: question.id, className: question.getRootCss(), style: rootStyle, role: question.ariaRole, "aria-required": this.question.ariaRequired, "aria-invalid": this.question.ariaInvalid, "aria-label": this.question.ariaLabel, "aria-labelledby": question.ariaLabelledBy, "aria-describedby": question.ariaDescribedBy, "aria-expanded": question.ariaExpanded
|
|
1476
|
+
React.createElement("div", { ref: this.rootRef, id: question.id, className: question.getRootCss(), style: rootStyle, "data-name": question.name, role: question.ariaRole, "aria-required": this.question.ariaRequired, "aria-invalid": this.question.ariaInvalid, "aria-label": this.question.ariaLabel, "aria-labelledby": question.ariaLabelledBy, "aria-describedby": question.ariaDescribedBy, "aria-expanded": question.ariaExpanded },
|
|
1477
1477
|
singleBreadcrumbs,
|
|
1478
1478
|
errorsAboveQuestion,
|
|
1479
1479
|
headerTop,
|
|
@@ -1925,7 +1925,7 @@ class PopupModal extends SurveyElementBase {
|
|
|
1925
1925
|
PopupModal.modalDescriptors = [];
|
|
1926
1926
|
|
|
1927
1927
|
/*!
|
|
1928
|
-
* surveyjs - Survey JavaScript library v2.0
|
|
1928
|
+
* surveyjs - Survey JavaScript library v2.1.0
|
|
1929
1929
|
* Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
|
|
1930
1930
|
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
|
1931
1931
|
*/
|
|
@@ -1995,7 +1995,7 @@ var iconsV1 = {
|
|
|
1995
1995
|
};
|
|
1996
1996
|
|
|
1997
1997
|
/*!
|
|
1998
|
-
* surveyjs - Survey JavaScript library v2.0
|
|
1998
|
+
* surveyjs - Survey JavaScript library v2.1.0
|
|
1999
1999
|
* Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
|
|
2000
2000
|
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
|
2001
2001
|
*/
|
|
@@ -2479,7 +2479,7 @@ class SurveyPanel extends SurveyPanelBase {
|
|
|
2479
2479
|
}
|
|
2480
2480
|
renderContent(style, rows, className) {
|
|
2481
2481
|
const bottom = this.renderBottom();
|
|
2482
|
-
return (React.createElement("div", { style: style, className: className, id: this.panel.contentId },
|
|
2482
|
+
return (React.createElement("div", { style: style, className: className, id: this.panel.contentId, role: this.panel.ariaRole, "aria-labelledby": this.panel.ariaLabelledBy, "aria-label": this.panel.ariaLabel },
|
|
2483
2483
|
rows,
|
|
2484
2484
|
bottom));
|
|
2485
2485
|
}
|
|
@@ -2744,6 +2744,9 @@ class SurveyQuestionCheckboxItem extends ReactSurveyElement {
|
|
|
2744
2744
|
get hideCaption() {
|
|
2745
2745
|
return this.props.hideCaption === true;
|
|
2746
2746
|
}
|
|
2747
|
+
get ariaLabel() {
|
|
2748
|
+
return this.props.ariaLabel || null;
|
|
2749
|
+
}
|
|
2747
2750
|
componentDidUpdate(prevProps, prevState) {
|
|
2748
2751
|
super.componentDidUpdate(prevProps, prevState);
|
|
2749
2752
|
if (prevProps.item !== this.props.item && !this.question.isDesignMode) {
|
|
@@ -2780,7 +2783,7 @@ class SurveyQuestionCheckboxItem extends ReactSurveyElement {
|
|
|
2780
2783
|
const itemLabel = !this.hideCaption ? React.createElement("span", { className: this.cssClasses.controlLabel }, this.renderLocString(this.item.locText, this.textStyle)) : null;
|
|
2781
2784
|
return (React.createElement("div", { className: itemClass, role: "presentation", ref: this.rootRef },
|
|
2782
2785
|
React.createElement("label", { className: labelClass },
|
|
2783
|
-
React.createElement("input", { className: this.cssClasses.itemControl, type: "checkbox", name: this.question.name + this.item.id, value: this.item.value, id: id, style: this.inputStyle, disabled: !this.question.getItemEnabled(this.item), readOnly: this.question.isReadOnlyAttr, checked: isChecked, onChange: this.handleOnChange, required: this.question.hasRequiredError() }),
|
|
2786
|
+
React.createElement("input", { className: this.cssClasses.itemControl, type: "checkbox", name: this.question.name + this.item.id, value: this.item.value, id: id, style: this.inputStyle, disabled: !this.question.getItemEnabled(this.item), readOnly: this.question.isReadOnlyAttr, checked: isChecked, onChange: this.handleOnChange, required: this.question.hasRequiredError(), "aria-label": this.ariaLabel }),
|
|
2784
2787
|
this.cssClasses.materialDecorator ?
|
|
2785
2788
|
React.createElement("span", { className: this.cssClasses.materialDecorator }, this.question.itemSvgIcon ?
|
|
2786
2789
|
React.createElement("svg", { className: this.cssClasses.itemDecorator },
|
|
@@ -3083,7 +3086,7 @@ class TagboxFilterString extends SurveyElementBase {
|
|
|
3083
3086
|
(React.createElement("div", { className: this.question.cssClasses.hintSuffix },
|
|
3084
3087
|
React.createElement("span", { style: { visibility: "hidden" }, "data-bind": "text: model.filterString" }, this.model.inputStringRendered),
|
|
3085
3088
|
React.createElement("span", null, this.model.hintStringSuffix))) : null,
|
|
3086
|
-
React.createElement("input", { type: "text", autoComplete: "off", id: this.question.getInputId(), inputMode: this.model.inputMode, ref: (element) => (this.inputElement = element), className: this.question.cssClasses.filterStringInput, disabled: this.question.isInputReadOnly, readOnly: this.model.filterReadOnly ? true : undefined, size: !this.model.inputStringRendered ? 1 : undefined, role: this.model.
|
|
3089
|
+
React.createElement("input", { type: "text", autoComplete: "off", id: this.question.getInputId(), inputMode: this.model.inputMode, ref: (element) => (this.inputElement = element), className: this.question.cssClasses.filterStringInput, disabled: this.question.isInputReadOnly, readOnly: this.model.filterReadOnly ? true : undefined, size: !this.model.inputStringRendered ? 1 : undefined, role: this.model.ariaInputRole, "aria-required": this.model.ariaInputRequired, "aria-invalid": this.model.ariaInputInvalid, "aria-errormessage": this.model.ariaInputErrorMessage, "aria-expanded": this.model.ariaInputExpanded, "aria-label": this.model.ariaInputLabel, "aria-labelledby": this.model.ariaInputLabelledby, "aria-describedby": this.model.ariaInputDescribedby, "aria-controls": this.model.ariaInputControls, "aria-activedescendant": this.model.ariaInputActivedescendant, placeholder: this.model.filterStringPlaceholder, onKeyDown: (e) => { this.keyhandler(e); }, onChange: (e) => { this.onChange(e); }, onBlur: (e) => { this.onBlur(e); }, onFocus: (e) => { this.onFocus(e); } }))));
|
|
3087
3090
|
}
|
|
3088
3091
|
}
|
|
3089
3092
|
ReactQuestionFactory.Instance.registerQuestion("sv-tagbox-filter", (props) => {
|
|
@@ -3177,17 +3180,17 @@ class SurveyQuestionDropdownBase extends SurveyQuestionUncontrolledElement {
|
|
|
3177
3180
|
}
|
|
3178
3181
|
}
|
|
3179
3182
|
renderSelect(cssClasses) {
|
|
3180
|
-
var _a, _b;
|
|
3181
3183
|
let selectElement = null;
|
|
3184
|
+
const dropdownListModel = this.question.dropdownListModel;
|
|
3182
3185
|
if (this.question.isReadOnly) {
|
|
3183
3186
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3184
3187
|
// @ts-ignore
|
|
3185
|
-
selectElement = React.createElement("div", { id: this.question.inputId, "aria-label":
|
|
3188
|
+
selectElement = React.createElement("div", { id: this.question.inputId, role: dropdownListModel === null || dropdownListModel === void 0 ? void 0 : dropdownListModel.ariaQuestionRole, "aria-label": dropdownListModel === null || dropdownListModel === void 0 ? void 0 : dropdownListModel.ariaQuestionLabel, "aria-labelledby": dropdownListModel === null || dropdownListModel === void 0 ? void 0 : dropdownListModel.ariaQuestionLabelledby, "aria-describedby": dropdownListModel === null || dropdownListModel === void 0 ? void 0 : dropdownListModel.ariaQuestionDescribedby, "aria-expanded": "false", "aria-readonly": "true", "aria-disabled": "true", tabIndex: this.question.isDisabledAttr ? undefined : 0, className: this.question.getControlClass(), ref: (div) => (this.setControl(div)) }, this.renderReadOnlyElement());
|
|
3186
3189
|
}
|
|
3187
3190
|
else {
|
|
3188
3191
|
selectElement = React.createElement(React.Fragment, null,
|
|
3189
|
-
this.renderInput(
|
|
3190
|
-
React.createElement(Popup, { model:
|
|
3192
|
+
this.renderInput(dropdownListModel),
|
|
3193
|
+
React.createElement(Popup, { model: dropdownListModel.popupModel }));
|
|
3191
3194
|
}
|
|
3192
3195
|
return (React.createElement("div", { className: cssClasses.selectWrapper, onClick: this.click },
|
|
3193
3196
|
selectElement,
|
|
@@ -3213,7 +3216,7 @@ class SurveyQuestionDropdownBase extends SurveyQuestionUncontrolledElement {
|
|
|
3213
3216
|
return (React.createElement("div", { id: this.question.inputId, className: this.question.getControlClass(), tabIndex: dropdownListModel.noTabIndex ? undefined : 0,
|
|
3214
3217
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3215
3218
|
// @ts-ignore
|
|
3216
|
-
disabled: this.question.isDisabledAttr, required: this.question.isRequired, onKeyDown: this.keyhandler, onBlur: this.blur, onFocus: this.focus, role:
|
|
3219
|
+
disabled: this.question.isDisabledAttr, required: this.question.isRequired, onKeyDown: this.keyhandler, onBlur: this.blur, onFocus: this.focus, role: dropdownListModel.ariaQuestionRole, "aria-required": dropdownListModel.ariaQuestionRequired, "aria-invalid": dropdownListModel.ariaQuestionInvalid, "aria-errormessage": dropdownListModel.ariaQuestionErrorMessage, "aria-expanded": dropdownListModel.ariaQuestionExpanded, "aria-label": dropdownListModel.ariaQuestionLabel, "aria-labelledby": dropdownListModel.ariaQuestionLabelledby, "aria-describedby": dropdownListModel.ariaQuestionDescribedby, "aria-controls": dropdownListModel.ariaQuestionControls, "aria-activedescendant": dropdownListModel.ariaQuestionActivedescendant, ref: (div) => (this.setControl(div)) },
|
|
3217
3220
|
dropdownListModel.showHintPrefix ?
|
|
3218
3221
|
(React.createElement("div", { className: this.question.cssClasses.hintPrefix },
|
|
3219
3222
|
React.createElement("span", null, dropdownListModel.hintStringPrefix))) : null,
|
|
@@ -3223,7 +3226,7 @@ class SurveyQuestionDropdownBase extends SurveyQuestionUncontrolledElement {
|
|
|
3223
3226
|
React.createElement("span", { style: { visibility: "hidden" }, "data-bind": "text: model.filterString" }, dropdownListModel.inputStringRendered),
|
|
3224
3227
|
React.createElement("span", null, dropdownListModel.hintStringSuffix))) : null,
|
|
3225
3228
|
valueElement,
|
|
3226
|
-
React.createElement("input", { type: "text", autoComplete: "off", id: this.question.getInputId(), ref: (element) => (this.inputElement = element), className: this.question.cssClasses.filterStringInput, role: dropdownListModel.
|
|
3229
|
+
React.createElement("input", { type: "text", autoComplete: "off", id: this.question.getInputId(), ref: (element) => (this.inputElement = element), className: this.question.cssClasses.filterStringInput, role: dropdownListModel.ariaInputRole, "aria-required": dropdownListModel.ariaInputRequired, "aria-invalid": dropdownListModel.ariaInputInvalid, "aria-errormessage": dropdownListModel.ariaInputErrorMessage, "aria-expanded": dropdownListModel.ariaInputExpanded, "aria-label": dropdownListModel.ariaInputLabel, "aria-labelledby": dropdownListModel.ariaInputLabelledby, "aria-describedby": dropdownListModel.ariaInputDescribedby, "aria-controls": dropdownListModel.ariaInputControls, "aria-activedescendant": dropdownListModel.ariaInputActivedescendant, placeholder: dropdownListModel.placeholderRendered, readOnly: dropdownListModel.filterReadOnly ? true : undefined, tabIndex: dropdownListModel.noTabIndex ? undefined : -1, disabled: this.question.isDisabledAttr, inputMode: dropdownListModel.inputMode, onChange: (e) => { onInputChange(e); }, onBlur: this.blur, onFocus: this.focus })),
|
|
3227
3230
|
this.createClearButton()));
|
|
3228
3231
|
}
|
|
3229
3232
|
createClearButton() {
|
|
@@ -3324,7 +3327,7 @@ class SurveyQuestionTagbox extends SurveyQuestionDropdownBase {
|
|
|
3324
3327
|
return (React.createElement("div", { id: this.question.inputId, className: this.question.getControlClass(), tabIndex: dropdownListModel.noTabIndex ? undefined : 0,
|
|
3325
3328
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3326
3329
|
// @ts-ignore
|
|
3327
|
-
disabled: this.question.isInputReadOnly, required: this.question.isRequired, onKeyDown: this.keyhandler, onBlur: this.blur, role:
|
|
3330
|
+
disabled: this.question.isInputReadOnly, required: this.question.isRequired, onKeyDown: this.keyhandler, onBlur: this.blur, role: dropdownListModel.ariaQuestionRole, "aria-required": dropdownListModel.ariaQuestionRequired, "aria-invalid": dropdownListModel.ariaQuestionInvalid, "aria-errormessage": dropdownListModel.ariaQuestionErrorMessage, "aria-label": dropdownListModel.ariaQuestionLabel, "aria-labelledby": dropdownListModel.ariaQuestionLabelledby, "aria-describedby": dropdownListModel.ariaQuestionDescribedby, "aria-expanded": dropdownListModel.ariaQuestionExpanded, "aria-controls": dropdownListModel.ariaQuestionControls, "aria-activedescendant": dropdownListModel.ariaQuestionActivedescendant, ref: (div) => (this.setControl(div)) },
|
|
3328
3331
|
React.createElement("div", { className: this.question.cssClasses.controlValue },
|
|
3329
3332
|
items,
|
|
3330
3333
|
React.createElement(TagboxFilterString, { model: dropdownMultiSelectListModel, question: this.question })),
|
|
@@ -3366,7 +3369,7 @@ class SurveyQuestionDropdownSelect extends SurveyQuestionDropdown {
|
|
|
3366
3369
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3367
3370
|
// @ts-ignore
|
|
3368
3371
|
React.createElement("div", { id: this.question.inputId, className: this.question.getControlClass(), disabled: true }, this.question.readOnlyText)) :
|
|
3369
|
-
(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.
|
|
3372
|
+
(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 },
|
|
3370
3373
|
this.question.allowClear ? (React.createElement("option", { value: "" }, this.question.placeholder)) : null,
|
|
3371
3374
|
this.question.visibleChoices.map((item, i) => React.createElement(SurveyQuestionOptionItem, { key: "item" + i, item: item }))));
|
|
3372
3375
|
return (React.createElement("div", { className: cssClasses.selectWrapper },
|
|
@@ -3943,6 +3946,9 @@ class SurveyQuestionRadioItem extends ReactSurveyElement {
|
|
|
3943
3946
|
get hideCaption() {
|
|
3944
3947
|
return this.props.hideCaption === true;
|
|
3945
3948
|
}
|
|
3949
|
+
get ariaLabel() {
|
|
3950
|
+
return this.props.ariaLabel || null;
|
|
3951
|
+
}
|
|
3946
3952
|
shouldComponentUpdate(nextProps, nextState) {
|
|
3947
3953
|
if (!super.shouldComponentUpdate(nextProps, nextState))
|
|
3948
3954
|
return false;
|
|
@@ -3980,7 +3986,7 @@ class SurveyQuestionRadioItem extends ReactSurveyElement {
|
|
|
3980
3986
|
const itemLabel = !this.hideCaption ? React.createElement("span", { className: controlLabelClass }, this.renderLocString(this.item.locText, this.textStyle)) : null;
|
|
3981
3987
|
return (React.createElement("div", { className: itemClass, role: "presentation", ref: this.rootRef },
|
|
3982
3988
|
React.createElement("label", { onMouseDown: this.handleOnMouseDown, className: labelClass },
|
|
3983
|
-
React.createElement("input", { "aria-errormessage": this.question.ariaErrormessage, className: this.cssClasses.itemControl, id: this.question.getItemId(this.item), type: "radio", name: this.question.questionName, checked: this.isChecked, value: this.item.value, disabled: !this.question.getItemEnabled(this.item), readOnly: this.question.isReadOnlyAttr, onChange: this.handleOnChange }),
|
|
3989
|
+
React.createElement("input", { "aria-errormessage": this.question.ariaErrormessage, className: this.cssClasses.itemControl, id: this.question.getItemId(this.item), type: "radio", name: this.question.questionName, checked: this.isChecked, value: this.item.value, disabled: !this.question.getItemEnabled(this.item), readOnly: this.question.isReadOnlyAttr, onChange: this.handleOnChange, "aria-label": this.ariaLabel }),
|
|
3984
3990
|
this.cssClasses.materialDecorator ?
|
|
3985
3991
|
React.createElement("span", { className: this.cssClasses.materialDecorator }, this.question.itemSvgIcon ?
|
|
3986
3992
|
React.createElement("svg", { className: this.cssClasses.itemDecorator },
|
|
@@ -4601,11 +4607,14 @@ class SurveyQuestionMatrixDropdownCell extends SurveyQuestionAndErrorsCell {
|
|
|
4601
4607
|
}
|
|
4602
4608
|
renderCellCheckboxButton() {
|
|
4603
4609
|
var key = this.cell.question.id + "item" + this.cell.choiceIndex;
|
|
4604
|
-
return (React.createElement(SurveyQuestionCheckboxItem, { key: key, question: this.cell.question, cssClasses: this.cell.question.cssClasses, isDisplayMode: this.cell.question.isInputReadOnly, item: this.cell.item, isFirst: this.cell.isFirstChoice, index: this.cell.choiceIndex.toString(), hideCaption: true }));
|
|
4610
|
+
return (React.createElement(SurveyQuestionCheckboxItem, { key: key, question: this.cell.question, cssClasses: this.cell.question.cssClasses, isDisplayMode: this.cell.question.isInputReadOnly, item: this.cell.item, isFirst: this.cell.isFirstChoice, index: this.cell.choiceIndex.toString(), hideCaption: true, ariaLabel: this.getCellAriaLabel() }));
|
|
4605
4611
|
}
|
|
4606
4612
|
renderCellRadiogroupButton() {
|
|
4607
4613
|
var key = this.cell.question.id + "item" + this.cell.choiceIndex;
|
|
4608
|
-
return (React.createElement(SurveyQuestionRadioItem, { key: key, question: this.cell.question, cssClasses: this.cell.question.cssClasses, isDisplayMode: this.cell.question.isInputReadOnly, item: this.cell.item, index: this.cell.choiceIndex.toString(), isChecked: this.cell.question.value === this.cell.item.value, isDisabled: this.cell.question.isReadOnly || !this.cell.item.isEnabled, hideCaption: true }));
|
|
4614
|
+
return (React.createElement(SurveyQuestionRadioItem, { key: key, question: this.cell.question, cssClasses: this.cell.question.cssClasses, isDisplayMode: this.cell.question.isInputReadOnly, item: this.cell.item, index: this.cell.choiceIndex.toString(), isChecked: this.cell.question.value === this.cell.item.value, isDisabled: this.cell.question.isReadOnly || !this.cell.item.isEnabled, hideCaption: true, ariaLabel: this.getCellAriaLabel() }));
|
|
4615
|
+
}
|
|
4616
|
+
getCellAriaLabel() {
|
|
4617
|
+
return this.question.parentQuestion.getCellAriaLabel(this.cell.row.locText.renderedHtml, this.cell.column.locTitle.renderedHtml);
|
|
4609
4618
|
}
|
|
4610
4619
|
}
|
|
4611
4620
|
|
|
@@ -5051,7 +5060,7 @@ class List extends SurveyElementBase {
|
|
|
5051
5060
|
return null;
|
|
5052
5061
|
const items = this.renderItems();
|
|
5053
5062
|
const ulStyle = { display: this.model.isEmpty ? "none" : null };
|
|
5054
|
-
return (React.createElement("ul", { className: this.model.getListClass(), style: ulStyle, role: this.model.listRole, "aria-label": this.model.
|
|
5063
|
+
return (React.createElement("ul", { className: this.model.getListClass(), style: ulStyle, role: this.model.listRole, "aria-label": this.model.a11ya11y_input_ariaLabel, id: this.model.elementId, onMouseDown: (e) => {
|
|
5055
5064
|
e.preventDefault();
|
|
5056
5065
|
}, onKeyDown: this.handleKeydown, onMouseMove: this.handleMouseMove }, items));
|
|
5057
5066
|
}
|
|
@@ -5182,6 +5191,91 @@ ReactQuestionFactory.Instance.registerQuestion("sv-rating-dropdown", (props) =>
|
|
|
5182
5191
|
});
|
|
5183
5192
|
RendererFactory.Instance.registerRenderer("rating", "dropdown", "sv-rating-dropdown");
|
|
5184
5193
|
|
|
5194
|
+
class SurveyQuestionSlider extends SurveyQuestionElementBase {
|
|
5195
|
+
constructor(props) {
|
|
5196
|
+
super(props);
|
|
5197
|
+
this.rangeInputRef = React.createRef();
|
|
5198
|
+
}
|
|
5199
|
+
componentDidMount() {
|
|
5200
|
+
super.componentDidMount();
|
|
5201
|
+
this.question.refreshInputRange(this.rangeInputRef.current);
|
|
5202
|
+
}
|
|
5203
|
+
get question() {
|
|
5204
|
+
return this.questionBase;
|
|
5205
|
+
}
|
|
5206
|
+
getStateElement() {
|
|
5207
|
+
return this.question;
|
|
5208
|
+
}
|
|
5209
|
+
renderElement() {
|
|
5210
|
+
const { cssClasses, showLabels, sliderType, getTrackPercentLeft, getTrackPercentRight, allowDragRange, setValueByClickOnPath } = this.question;
|
|
5211
|
+
const rangeInput = (sliderType === "single" && allowDragRange) ? null : this.getRangeInput();
|
|
5212
|
+
const thumbsAndInputs = this.getInputsAndThumbs();
|
|
5213
|
+
const labels = showLabels ? this.getLabels() : null;
|
|
5214
|
+
return (React.createElement("div", { className: this.question.rootCss, ref: (div) => (this.setControl(div)) },
|
|
5215
|
+
rangeInput,
|
|
5216
|
+
React.createElement("div", { className: cssClasses.visualContainer, onPointerUp: (e) => { setValueByClickOnPath(e.nativeEvent, this.control); } },
|
|
5217
|
+
React.createElement("div", { className: cssClasses.visualContainerSlider },
|
|
5218
|
+
React.createElement("div", { className: cssClasses.inverseTrackLeft, style: { width: getTrackPercentLeft() + "%" } }),
|
|
5219
|
+
React.createElement("div", { className: cssClasses.inverseTrackRight, style: { width: getTrackPercentRight() + "%" } }),
|
|
5220
|
+
React.createElement("div", { className: cssClasses.rangeTrack, style: { left: getTrackPercentLeft() + "%", right: getTrackPercentRight() + "%" } }),
|
|
5221
|
+
thumbsAndInputs)),
|
|
5222
|
+
labels));
|
|
5223
|
+
}
|
|
5224
|
+
getInputsAndThumbs() {
|
|
5225
|
+
const inputsAndThumbs = [];
|
|
5226
|
+
const value = this.question.getRenderedValue();
|
|
5227
|
+
for (let i = 0; i < value.length; i++) {
|
|
5228
|
+
const thumbAndInput = React.createElement(React.Fragment, { key: i },
|
|
5229
|
+
this.getInput(i),
|
|
5230
|
+
this.getThumb(i));
|
|
5231
|
+
inputsAndThumbs.push(thumbAndInput);
|
|
5232
|
+
}
|
|
5233
|
+
return inputsAndThumbs;
|
|
5234
|
+
}
|
|
5235
|
+
getThumb(i) {
|
|
5236
|
+
const { cssClasses, getThumbContainerCss, tooltipVisibility, tooltipCss, getPercent, getRenderedValue, getTooltipValue } = this.question;
|
|
5237
|
+
const value = getRenderedValue()[i];
|
|
5238
|
+
let tooltip = null;
|
|
5239
|
+
if (tooltipVisibility !== "never") {
|
|
5240
|
+
tooltip = React.createElement("div", { className: tooltipCss },
|
|
5241
|
+
React.createElement("div", { className: cssClasses.tooltipPanel },
|
|
5242
|
+
React.createElement("div", { className: cssClasses.tooltipValue }, getTooltipValue(i))));
|
|
5243
|
+
}
|
|
5244
|
+
const thumb = React.createElement("div", { className: getThumbContainerCss(i), style: { left: getPercent(value) + "%" } },
|
|
5245
|
+
tooltip,
|
|
5246
|
+
React.createElement("div", { className: cssClasses.thumb },
|
|
5247
|
+
React.createElement("div", { className: cssClasses.thumbDot })));
|
|
5248
|
+
return thumb;
|
|
5249
|
+
}
|
|
5250
|
+
getInput(i) {
|
|
5251
|
+
const { renderedMax: max, renderedMin: min, step, cssClasses, isDisabledAttr, getRenderedValue, handleOnChange, handlePointerDown, handlePointerUp, handleKeyDown, handleKeyUp, handleOnFocus, handleOnBlur } = this.question;
|
|
5252
|
+
const value = getRenderedValue()[i];
|
|
5253
|
+
const input = React.createElement("input", { className: cssClasses.input, id: "sjs-slider-input-" + i, type: "range", min: min, max: max, step: step, value: value, onChange: (e) => { handleOnChange(e.nativeEvent, i); }, onPointerDown: (e) => { handlePointerDown(e.nativeEvent); }, onPointerUp: (e) => { e.stopPropagation(); handlePointerUp(e.nativeEvent); }, onKeyDown: (e) => { handleKeyDown(e.nativeEvent); }, onKeyUp: (e) => { handleKeyUp(e.nativeEvent); }, onFocus: () => { handleOnFocus(i); }, onBlur: () => { handleOnBlur(); }, disabled: isDisabledAttr, "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 });
|
|
5254
|
+
return input;
|
|
5255
|
+
}
|
|
5256
|
+
getRangeInput() {
|
|
5257
|
+
const { renderedMax: max, renderedMin: min, step, cssClasses, handleRangeOnChange, handleRangePointerDown, handleRangePointerUp } = this.question;
|
|
5258
|
+
return React.createElement("input", { name: "range-input", ref: this.rangeInputRef, className: cssClasses.input, type: "range", "aria-hidden": "true", min: min, max: max, step: step, tabIndex: -1, onChange: (e) => { handleRangeOnChange(e.nativeEvent); }, onPointerDown: (e) => { e.persist(); handleRangePointerDown(e.nativeEvent, this.control); }, onPointerUp: (e) => { handleRangePointerUp(e.nativeEvent, this.control); } });
|
|
5259
|
+
}
|
|
5260
|
+
getLabels() {
|
|
5261
|
+
const labels = [];
|
|
5262
|
+
const { renderedLabels, cssClasses, handleLabelPointerUp, getLabelCss } = this.question;
|
|
5263
|
+
for (let i = 0; i < renderedLabels.length; i++) {
|
|
5264
|
+
const value = renderedLabels[i].value;
|
|
5265
|
+
const text = renderedLabels[i].locText;
|
|
5266
|
+
const label = React.createElement("div", { key: i, className: getLabelCss(i), style: { left: value + "%" }, onPointerUp: (e) => { handleLabelPointerUp(e.nativeEvent, i); } },
|
|
5267
|
+
React.createElement("div", { className: cssClasses.labelTick }),
|
|
5268
|
+
React.createElement("div", { className: cssClasses.labelText }, this.renderLocString(text)));
|
|
5269
|
+
labels.push(label);
|
|
5270
|
+
}
|
|
5271
|
+
return React.createElement("div", { className: cssClasses.labelsContainer },
|
|
5272
|
+
React.createElement("div", null, labels));
|
|
5273
|
+
}
|
|
5274
|
+
}
|
|
5275
|
+
ReactQuestionFactory.Instance.registerQuestion("slider", (props) => {
|
|
5276
|
+
return React.createElement(SurveyQuestionSlider, props);
|
|
5277
|
+
});
|
|
5278
|
+
|
|
5185
5279
|
class SurveyQuestionExpression extends SurveyQuestionElementBase {
|
|
5186
5280
|
constructor(props) {
|
|
5187
5281
|
super(props);
|
|
@@ -6085,7 +6179,7 @@ ReactElementFactory.Instance.registerElement(LocalizableString.editableRenderer,
|
|
|
6085
6179
|
return React.createElement(SurveyLocStringEditor, props);
|
|
6086
6180
|
});
|
|
6087
6181
|
|
|
6088
|
-
checkLibraryVersion(`${"2.0
|
|
6182
|
+
checkLibraryVersion(`${"2.1.0"}`, "survey-react-ui");
|
|
6089
6183
|
|
|
6090
|
-
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, Survey, SurveyActionBar, SurveyElementBase, SurveyElementErrors, SurveyFileChooseButton, 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, SurveyQuestionTagbox, SurveyQuestionTagboxItem, SurveyQuestionText, SurveyRow, SurveyTimerPanel, SurveyWindow, SvgBundleComponent, SvgIcon, TagboxFilterString, TitleActions, TitleElement, attachKey2click };
|
|
6184
|
+
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, Survey, SurveyActionBar, SurveyElementBase, SurveyElementErrors, SurveyFileChooseButton, 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 };
|
|
6091
6185
|
//# sourceMappingURL=survey-react-ui.mjs.map
|