survey-creator-js 3.0.0-beta.6 → 3.0.0-beta.7
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-creator-js.mjs +48 -10
- package/fesm/survey-creator-js.mjs.map +1 -1
- package/package.json +4 -4
- package/survey-creator-js.js +61 -11
- package/survey-creator-js.js.map +1 -1
- package/survey-creator-js.min.js +2 -2
- package/typings/survey-creator-react/src/custom-questions/Swatch.d.ts +23 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* SurveyJS Creator v3.0.0-beta.
|
|
2
|
+
* SurveyJS Creator v3.0.0-beta.7
|
|
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
|
|
@@ -2125,7 +2125,7 @@ ReactElementFactory.Instance.registerElement(editableStringRendererName, (props)
|
|
|
2125
2125
|
class QuestionErrorComponent extends React.Component {
|
|
2126
2126
|
render() {
|
|
2127
2127
|
return (React.createElement("div", null,
|
|
2128
|
-
React.createElement(SvgIcon, { "aria-hidden": "true", iconName: "icon-alert_24x24", size: "
|
|
2128
|
+
React.createElement(SvgIcon, { "aria-hidden": "true", iconName: "icon-alert_24x24", size: "auto", className: this.props.cssClasses.error.icon }),
|
|
2129
2129
|
React.createElement("span", { className: this.props.cssClasses.error.item || undefined },
|
|
2130
2130
|
React.createElement(SurveyLocStringViewer, { model: this.props.error.locText }))));
|
|
2131
2131
|
}
|
|
@@ -2832,12 +2832,44 @@ ReactQuestionFactory.Instance.registerQuestion("spinedit", (props) => {
|
|
|
2832
2832
|
return React.createElement(SurveyQuestionSpinEditor, props);
|
|
2833
2833
|
});
|
|
2834
2834
|
|
|
2835
|
+
class Swatch extends React.Component {
|
|
2836
|
+
get rootClassName() {
|
|
2837
|
+
var _a;
|
|
2838
|
+
return (_a = this.props.className) !== null && _a !== void 0 ? _a : "sd-color-swatch";
|
|
2839
|
+
}
|
|
2840
|
+
get rootStyle() {
|
|
2841
|
+
return { backgroundColor: this.props.color };
|
|
2842
|
+
}
|
|
2843
|
+
renderIcon() {
|
|
2844
|
+
var _a, _b;
|
|
2845
|
+
if (!this.props.showIcon)
|
|
2846
|
+
return null;
|
|
2847
|
+
return (React.createElement(SvgIcon, { iconName: (_a = this.props.swatchIcon) !== null && _a !== void 0 ? _a : "icon-dropper-16x16", size: "auto", className: (_b = this.props.iconClassName) !== null && _b !== void 0 ? _b : "sd-color-swatch__icon" }));
|
|
2848
|
+
}
|
|
2849
|
+
renderColorInput() {
|
|
2850
|
+
const { onColorInputChange, colorInputValue, colorInputClassName, inputDisabled, arias } = this.props;
|
|
2851
|
+
if (!onColorInputChange)
|
|
2852
|
+
return null;
|
|
2853
|
+
return (React.createElement("input", Object.assign({ type: "color", disabled: inputDisabled, value: colorInputValue, className: colorInputClassName, onChange: onColorInputChange, tabIndex: -1 }, arias)));
|
|
2854
|
+
}
|
|
2855
|
+
render() {
|
|
2856
|
+
const content = (React.createElement("div", { className: "sd-color-swatch__content", style: this.rootStyle },
|
|
2857
|
+
this.renderIcon(),
|
|
2858
|
+
this.renderColorInput()));
|
|
2859
|
+
if (this.props.onColorInputChange) {
|
|
2860
|
+
return React.createElement("label", { className: this.rootClassName }, content);
|
|
2861
|
+
}
|
|
2862
|
+
return React.createElement("div", { className: this.rootClassName }, content);
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2865
|
+
|
|
2835
2866
|
class ItemTemplateComponent extends SurveyElementBase {
|
|
2836
2867
|
render() {
|
|
2837
2868
|
const item = this.props.item;
|
|
2838
|
-
return (React.createElement(
|
|
2839
|
-
React.createElement("
|
|
2840
|
-
|
|
2869
|
+
return (React.createElement("div", { className: "sd-color-swatch-item" },
|
|
2870
|
+
React.createElement("div", { className: "sd-color-swatch-item__label" },
|
|
2871
|
+
React.createElement("span", { key: 2, className: "sd-color-swatch-item__caption" }, this.renderLocString(item.locTitle, undefined, "locString"))),
|
|
2872
|
+
React.createElement(Swatch, { color: item.value })));
|
|
2841
2873
|
}
|
|
2842
2874
|
}
|
|
2843
2875
|
ReactElementFactory.Instance.registerElement("color-item", (props) => {
|
|
@@ -2866,9 +2898,15 @@ class SurveyQuestionColor extends SurveyQuestionText {
|
|
|
2866
2898
|
return this.question.renderedValue;
|
|
2867
2899
|
}
|
|
2868
2900
|
renderColorSwatch() {
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
React.createElement(
|
|
2901
|
+
const question = this.question;
|
|
2902
|
+
return (React.createElement("div", { className: question.cssClasses.colorSwatch },
|
|
2903
|
+
React.createElement(Swatch, { className: question.getSwatchCss(), swatchIcon: question.cssClasses.swatchIcon, iconClassName: question.cssClasses.iconClassName, color: question.renderedValue, showIcon: true, colorInputValue: question.renderedColorValue, colorInputClassName: question.cssClasses.colorInput, inputDisabled: this.isDisplayMode, onColorInputChange: (event) => question.onColorInputChange(event.nativeEvent), arias: {
|
|
2904
|
+
"aria-required": question.a11y_input_ariaRequired,
|
|
2905
|
+
"aria-labelledby": question.a11y_input_ariaLabelledBy,
|
|
2906
|
+
"aria-label": question.a11y_input_ariaLabel,
|
|
2907
|
+
"aria-invalid": question.a11y_input_ariaInvalid,
|
|
2908
|
+
"aria-describedby": question.a11y_input_ariaDescribedBy,
|
|
2909
|
+
} })));
|
|
2872
2910
|
}
|
|
2873
2911
|
renderButtons() {
|
|
2874
2912
|
return this.question.hasVisibleInputActions ? React.createElement(SurveyActionBar, { model: this.question.inputActionsContainer }) : null;
|
|
@@ -2944,8 +2982,8 @@ ReactQuestionFactory.Instance.registerQuestion("sv-boolean-switch", (props) => {
|
|
|
2944
2982
|
RendererFactory.Instance.registerRenderer("boolean", "switch", "sv-boolean-switch");
|
|
2945
2983
|
|
|
2946
2984
|
let Version;
|
|
2947
|
-
Version = `${"3.0.0-beta.
|
|
2948
|
-
checkLibraryVersion(`${"3.0.0-beta.
|
|
2985
|
+
Version = `${"3.0.0-beta.7"}`;
|
|
2986
|
+
checkLibraryVersion(`${"3.0.0-beta.7"}`, "survey-creator-react");
|
|
2949
2987
|
|
|
2950
2988
|
function renderSurveyCreator(creator, element, props = {}) {
|
|
2951
2989
|
let node = element;
|