@roqua/quby-frontend 0.4.2 → 0.5.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/CHANGELOG.md +9 -0
- package/lib/assets/quby/application.css +0 -1416
- package/lib/components/AnswerPage.js +26 -49
- package/lib/components/AnswerPage.js.map +1 -1
- package/lib/components/MainLabel.js +6 -14
- package/lib/components/MainLabel.js.map +1 -1
- package/lib/components/Paginator.js +29 -53
- package/lib/components/Paginator.js.map +1 -1
- package/lib/components/PanelContent.js +8 -17
- package/lib/components/PanelContent.js.map +1 -1
- package/lib/components/PanelItem.js +8 -15
- package/lib/components/PanelItem.js.map +1 -1
- package/lib/components/ProgressBar.js +10 -18
- package/lib/components/ProgressBar.js.map +1 -1
- package/lib/components/Quby.d.ts +2 -2
- package/lib/components/Quby.d.ts.map +1 -1
- package/lib/components/Quby.js +9 -16
- package/lib/components/Quby.js.map +1 -1
- package/lib/components/QuestionDescription.js +3 -10
- package/lib/components/QuestionDescription.js.map +1 -1
- package/lib/components/QuestionWrapper.js +10 -28
- package/lib/components/QuestionWrapper.js.map +1 -1
- package/lib/components/ValidationErrors.js +10 -30
- package/lib/components/ValidationErrors.js.map +1 -1
- package/lib/components/index.js +2 -14
- package/lib/components/index.js.map +1 -1
- package/lib/components/items/HtmlItem.js +4 -12
- package/lib/components/items/HtmlItem.js.map +1 -1
- package/lib/components/items/QuestionItem.js +34 -42
- package/lib/components/items/QuestionItem.js.map +1 -1
- package/lib/components/items/UnknownItem.js +3 -11
- package/lib/components/items/UnknownItem.js.map +1 -1
- package/lib/components/questions/CheckBoxQuestion.js +33 -43
- package/lib/components/questions/CheckBoxQuestion.js.map +1 -1
- package/lib/components/questions/DatePartsQuestion.js +18 -26
- package/lib/components/questions/DatePartsQuestion.js.map +1 -1
- package/lib/components/questions/FloatQuestion.js +16 -24
- package/lib/components/questions/FloatQuestion.js.map +1 -1
- package/lib/components/questions/IntegerQuestion.js +16 -24
- package/lib/components/questions/IntegerQuestion.js.map +1 -1
- package/lib/components/questions/RadioQuestion.js +32 -42
- package/lib/components/questions/RadioQuestion.js.map +1 -1
- package/lib/components/questions/ScaleQuestion.js +31 -41
- package/lib/components/questions/ScaleQuestion.js.map +1 -1
- package/lib/components/questions/SelectQuestion.js +21 -31
- package/lib/components/questions/SelectQuestion.js.map +1 -1
- package/lib/components/questions/SliderQuestion.js +59 -67
- package/lib/components/questions/SliderQuestion.js.map +1 -1
- package/lib/components/questions/StringQuestion.js +16 -24
- package/lib/components/questions/StringQuestion.js.map +1 -1
- package/lib/components/questions/TextareaQuestion.js +15 -23
- package/lib/components/questions/TextareaQuestion.js.map +1 -1
- package/lib/core/index.d.ts +1 -0
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +5 -16
- package/lib/core/index.js.map +1 -1
- package/lib/core/mock_helpers.js +11 -17
- package/lib/core/mock_helpers.js.map +1 -1
- package/lib/core/questionnaire.js +8 -13
- package/lib/core/questionnaire.js.map +1 -1
- package/lib/core/questionnaire_json.d.ts +5 -3
- package/lib/core/questionnaire_json.d.ts.map +1 -1
- package/lib/core/questionnaire_json.js +2 -2
- package/lib/core/questionnaire_json.js.map +1 -1
- package/lib/core/response.d.ts +13 -5
- package/lib/core/response.d.ts.map +1 -1
- package/lib/core/response.js +72 -78
- package/lib/core/response.js.map +1 -1
- package/lib/core/response_json.d.ts +11 -0
- package/lib/core/response_json.d.ts.map +1 -0
- package/lib/core/response_json.js +68 -0
- package/lib/core/response_json.js.map +1 -0
- package/lib/core/validators.js +56 -169
- package/lib/core/validators.js.map +1 -1
- package/lib/core/visibility_rules.js +37 -90
- package/lib/core/visibility_rules.js.map +1 -1
- package/lib/i18n.js +7 -12
- package/lib/i18n.js.map +1 -1
- package/lib/index.js +3 -15
- package/lib/index.js.map +1 -1
- package/package.json +3 -2
|
@@ -1,58 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var classnames_1 = __importDefault(require("classnames"));
|
|
9
|
-
var MainLabel_1 = require("../MainLabel");
|
|
10
|
-
var QuestionWrapper_1 = require("../QuestionWrapper");
|
|
11
|
-
var QuestionDescription_1 = require("../QuestionDescription");
|
|
12
|
-
var RadioQuestion = function (_a) {
|
|
13
|
-
var question = _a.question, fieldState = _a.fieldState, setQuestionRef = _a.setQuestionRef;
|
|
14
|
-
var handleChange = function (event) {
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { MainLabel } from "../MainLabel";
|
|
4
|
+
import { QuestionWrapper } from "../QuestionWrapper";
|
|
5
|
+
import { QuestionDescription } from "../QuestionDescription";
|
|
6
|
+
export const RadioQuestion = ({ question, fieldState, setQuestionRef }) => {
|
|
7
|
+
const handleChange = (event) => {
|
|
15
8
|
fieldState.setValue(event.target.value);
|
|
16
9
|
};
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
?
|
|
24
|
-
:
|
|
10
|
+
const fieldsClassNames = classNames("fields", question.presentation !== "horizontal" ? `options${question.children.length}` : null);
|
|
11
|
+
return (React.createElement(QuestionWrapper, { question: question, fieldState: fieldState, setQuestionRef: setQuestionRef },
|
|
12
|
+
React.createElement(MainLabel, { question: question }),
|
|
13
|
+
React.createElement("div", { className: "description-and-fields" },
|
|
14
|
+
React.createElement(QuestionDescription, { question: question }),
|
|
15
|
+
React.createElement("div", { className: fieldsClassNames, id: htmlId(question) }, question.children.map((child, index) => (child.type === 'option'
|
|
16
|
+
? React.createElement(Option, { key: child.key, question: question, option: child, index: index, fieldState: fieldState })
|
|
17
|
+
: React.createElement("div", { key: child.key, className: "inner-title", dangerouslySetInnerHTML: { __html: child.html } })))))));
|
|
25
18
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var question = _a.question, option = _a.option, index = _a.index, fieldState = _a.fieldState;
|
|
29
|
-
var divClassNames = (0, classnames_1["default"])("option", {
|
|
19
|
+
const Option = ({ question, option, index, fieldState }) => {
|
|
20
|
+
const divClassNames = classNames("option", {
|
|
30
21
|
show_values: false // TODO
|
|
31
22
|
});
|
|
32
|
-
|
|
23
|
+
const inputClassNames = classNames(question.type, {
|
|
33
24
|
subinput: false,
|
|
34
25
|
deselectable: false // TODO
|
|
35
26
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
27
|
+
const checked = fieldState.value === option.key;
|
|
28
|
+
const handleChange = (event) => fieldState.setValue(option.key);
|
|
29
|
+
const handleClick = (event) => { (checked && question.deselectable ? fieldState.setValue(null) : true); };
|
|
30
|
+
return (React.createElement("div", { className: divClassNames },
|
|
31
|
+
React.createElement("div", { className: "radiocheckwrapper" },
|
|
32
|
+
React.createElement("input", { type: "radio", name: question.key, id: option.viewId, className: inputClassNames, checked: checked, onChange: handleChange, onClick: handleClick, onFocus: fieldState.setAsActiveQuestion })),
|
|
33
|
+
React.createElement(ShowValue, { question: question, option: option }),
|
|
34
|
+
React.createElement("div", { className: "labelwrapper" },
|
|
35
|
+
React.createElement("label", { htmlFor: option.viewId },
|
|
36
|
+
React.createElement("span", { dangerouslySetInnerHTML: { __html: option.description } }))),
|
|
37
|
+
React.createElement(SubQuestions, null)));
|
|
47
38
|
};
|
|
48
|
-
|
|
49
|
-
var question = _a.question, option = _a.option;
|
|
39
|
+
const ShowValue = ({ question, option }) => {
|
|
50
40
|
return null; // TODO
|
|
51
41
|
};
|
|
52
|
-
|
|
42
|
+
const SubQuestions = () => {
|
|
53
43
|
return null; // TODO
|
|
54
44
|
};
|
|
55
45
|
function htmlId(question) {
|
|
56
|
-
return
|
|
46
|
+
return `answer_${question.key}_input`;
|
|
57
47
|
}
|
|
58
48
|
//# sourceMappingURL=RadioQuestion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioQuestion.js","sourceRoot":"","sources":["../../../src/components/questions/RadioQuestion.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RadioQuestion.js","sourceRoot":"","sources":["../../../src/components/questions/RadioQuestion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAQ7D,MAAM,CAAC,MAAM,aAAa,GAAmC,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,EAAE,EAAE;IACxG,MAAM,YAAY,GAAG,CAAC,KAA0C,EAAE,EAAE;QAClE,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC,CAAC;IACF,MAAM,gBAAgB,GAAG,UAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC,YAAY,KAAK,YAAY,CAAC,CAAC,CAAC,UAAU,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAEpI,OAAO,CACL,oBAAC,eAAe,IAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc;QACzF,oBAAC,SAAS,IAAC,QAAQ,EAAE,QAAQ,GAAI;QACjC,6BAAK,SAAS,EAAC,wBAAwB;YACrC,oBAAC,mBAAmB,IAAC,QAAQ,EAAE,QAAQ,GAAI;YAE3C,6BAAK,SAAS,EAAE,gBAAgB,EAAE,EAAE,EAAE,MAAM,CAAC,QAAQ,CAAC,IACnD,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC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,6BAAK,SAAS,EAAC,mBAAmB;YAChC,+BACE,IAAI,EAAC,OAAO,EACZ,IAAI,EAAE,QAAQ,CAAC,GAAG,EAClB,EAAE,EAAE,MAAM,CAAC,MAAM,EACjB,SAAS,EAAE,eAAe,EAC1B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,UAAU,CAAC,mBAAmB,GACvC,CACE;QAEN,oBAAC,SAAS,IAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAI;QAEjD,6BAAK,SAAS,EAAC,cAAc;YAC3B,+BAAO,OAAO,EAAE,MAAM,CAAC,MAAM;gBAC3B,8BAAM,uBAAuB,EAAE,EAAC,MAAM,EAAE,MAAM,CAAC,WAAW,EAAC,GAAI,CACzD,CACJ;QAEN,oBAAC,YAAY,OAAG,CACZ,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAgF,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;IACtH,OAAO,IAAI,CAAC,CAAC,OAAO;AACtB,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,GAAG,EAAE;IACxB,OAAO,IAAI,CAAC,CAAC,OAAO;AACtB,CAAC,CAAC;AAEF,SAAS,MAAM,CAAC,QAAwB;IACtC,OAAO,UAAU,QAAQ,CAAC,GAAG,QAAQ,CAAC;AACxC,CAAC"}
|
|
@@ -1,56 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var classnames_1 = __importDefault(require("classnames"));
|
|
9
|
-
var MainLabel_1 = require("../MainLabel");
|
|
10
|
-
var QuestionWrapper_1 = require("../QuestionWrapper");
|
|
11
|
-
var QuestionDescription_1 = require("../QuestionDescription");
|
|
12
|
-
var ScaleQuestion = function (_a) {
|
|
13
|
-
var question = _a.question, fieldState = _a.fieldState, setQuestionRef = _a.setQuestionRef;
|
|
14
|
-
var handleChange = function (event) {
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { MainLabel } from "../MainLabel";
|
|
4
|
+
import { QuestionWrapper } from "../QuestionWrapper";
|
|
5
|
+
import { QuestionDescription } from "../QuestionDescription";
|
|
6
|
+
export const ScaleQuestion = ({ question, fieldState, setQuestionRef }) => {
|
|
7
|
+
const handleChange = (event) => {
|
|
15
8
|
fieldState.setValue(event.target.value);
|
|
16
9
|
};
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
const fieldsClassNames = classNames("fields", question.presentation !== "horizontal" ? `options${question.children.length}` : null);
|
|
11
|
+
return (React.createElement(QuestionWrapper, { question: question, fieldState: fieldState, setQuestionRef: setQuestionRef },
|
|
12
|
+
React.createElement(MainLabel, { question: question }),
|
|
13
|
+
React.createElement("div", { className: "description-and-fields" },
|
|
14
|
+
React.createElement(QuestionDescription, { question: question }),
|
|
15
|
+
React.createElement("div", { className: fieldsClassNames, id: htmlId(question) },
|
|
16
|
+
React.createElement("table", { cellSpacing: "0" },
|
|
17
|
+
React.createElement("tbody", null,
|
|
18
|
+
React.createElement("tr", null, question.children.map((child, index) => (React.createElement(Option, { key: child.key, question: question, option: child, index: index, fieldState: fieldState }))))))))));
|
|
26
19
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var question = _a.question, option = _a.option, index = _a.index, fieldState = _a.fieldState;
|
|
30
|
-
var tdClassNames = (0, classnames_1["default"])("option", "optionwidth".concat(question.children.length), {
|
|
20
|
+
const Option = ({ question, option, index, fieldState }) => {
|
|
21
|
+
const tdClassNames = classNames("option", `optionwidth${question.children.length}`, {
|
|
31
22
|
first: index <= 0,
|
|
32
23
|
last: index >= question.children.length - 1
|
|
33
24
|
});
|
|
34
|
-
|
|
25
|
+
const inputClassNames = classNames(question.type, {
|
|
35
26
|
subinput: false,
|
|
36
27
|
deselectable: false // TODO
|
|
37
28
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
29
|
+
const checked = fieldState.value === option.key;
|
|
30
|
+
const handleChange = (event) => fieldState.setValue(option.key);
|
|
31
|
+
const handleClick = () => (checked && question.deselectable ? fieldState.setValue(null) : true);
|
|
32
|
+
return (React.createElement("td", { className: tdClassNames },
|
|
33
|
+
React.createElement(ShowValue, { question: question, option: option }),
|
|
34
|
+
React.createElement("span", null,
|
|
35
|
+
React.createElement("input", { type: "radio", name: question.key, id: option.viewId, className: inputClassNames, checked: checked, onChange: handleChange, onClick: handleClick, onFocus: fieldState.setAsActiveQuestion }),
|
|
36
|
+
React.createElement("br", null),
|
|
37
|
+
React.createElement("label", { htmlFor: option.viewId },
|
|
38
|
+
React.createElement("span", { dangerouslySetInnerHTML: { __html: option.description } })))));
|
|
48
39
|
};
|
|
49
|
-
|
|
50
|
-
var question = _a.question, option = _a.option;
|
|
40
|
+
const ShowValue = ({ question, option }) => {
|
|
51
41
|
return null; // TODO
|
|
52
42
|
};
|
|
53
43
|
function htmlId(question) {
|
|
54
|
-
return
|
|
44
|
+
return `answer_${question.key}_input`;
|
|
55
45
|
}
|
|
56
46
|
//# sourceMappingURL=ScaleQuestion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScaleQuestion.js","sourceRoot":"","sources":["../../../src/components/questions/ScaleQuestion.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScaleQuestion.js","sourceRoot":"","sources":["../../../src/components/questions/ScaleQuestion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE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AAO,EAAE,MAAM,CAAC,MAAM;gBAC3B,8BAAM,uBAAuB,EAAE,EAAC,MAAM,EAAE,MAAM,CAAC,WAAW,EAAC,GAAI,CACzD,CACH,CACJ,CACN,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAgF,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;IACtH,OAAO,IAAI,CAAC,CAAC,OAAO;AACtB,CAAC,CAAC;AAEF,SAAS,MAAM,CAAC,QAAmB;IACjC,OAAO,UAAU,QAAQ,CAAC,GAAG,QAAQ,CAAC;AACxC,CAAC"}
|
|
@@ -1,44 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var classnames_1 = __importDefault(require("classnames"));
|
|
9
|
-
var MainLabel_1 = require("../MainLabel");
|
|
10
|
-
var QuestionWrapper_1 = require("../QuestionWrapper");
|
|
11
|
-
var QuestionDescription_1 = require("../QuestionDescription");
|
|
12
|
-
var SelectQuestion = function (_a) {
|
|
13
|
-
var question = _a.question, fieldState = _a.fieldState, setQuestionRef = _a.setQuestionRef;
|
|
14
|
-
var handleChange = function (event) {
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { MainLabel } from "../MainLabel";
|
|
4
|
+
import { QuestionWrapper } from "../QuestionWrapper";
|
|
5
|
+
import { QuestionDescription } from "../QuestionDescription";
|
|
6
|
+
export const SelectQuestion = ({ question, fieldState, setQuestionRef }) => {
|
|
7
|
+
const handleChange = (event) => {
|
|
15
8
|
fieldState.setValue(event.target.value);
|
|
16
9
|
};
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
const fieldsClassNames = classNames("fields", question.presentation !== "horizontal" ? `options${question.children.length}` : null);
|
|
11
|
+
return (React.createElement(QuestionWrapper, { question: question, fieldState: fieldState, setQuestionRef: setQuestionRef },
|
|
12
|
+
React.createElement(MainLabel, { question: question }),
|
|
13
|
+
React.createElement("div", { className: "description-and-fields" },
|
|
14
|
+
React.createElement(QuestionDescription, { question: question }),
|
|
15
|
+
React.createElement("div", { className: fieldsClassNames, id: htmlId(question) },
|
|
16
|
+
React.createElement("select", { onChange: handleChange, onFocus: fieldState.setAsActiveQuestion },
|
|
24
17
|
question.placeholder
|
|
25
|
-
?
|
|
18
|
+
? React.createElement("option", { key: "placeholder", className: "placeholder" }, question.placeholder)
|
|
26
19
|
: null,
|
|
27
|
-
question.children.map(
|
|
20
|
+
question.children.map((child, index) => (React.createElement(Option, { key: child.key, question: question, option: child, index: index, fieldState: fieldState }))))))));
|
|
28
21
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var question = _a.question, option = _a.option, index = _a.index, fieldState = _a.fieldState;
|
|
32
|
-
return (react_1["default"].createElement("option", { value: option.key, disabled: false }, option.description));
|
|
22
|
+
const Option = ({ question, option, index, fieldState }) => {
|
|
23
|
+
return (React.createElement("option", { value: option.key, disabled: false }, option.description));
|
|
33
24
|
};
|
|
34
|
-
|
|
35
|
-
var question = _a.question, option = _a.option;
|
|
25
|
+
const ShowValue = ({ question, option }) => {
|
|
36
26
|
return null; // TODO
|
|
37
27
|
};
|
|
38
|
-
|
|
28
|
+
const SubQuestions = () => {
|
|
39
29
|
return null; // TODO
|
|
40
30
|
};
|
|
41
31
|
function htmlId(question) {
|
|
42
|
-
return
|
|
32
|
+
return `answer_${question.key}_input`;
|
|
43
33
|
}
|
|
44
34
|
//# sourceMappingURL=SelectQuestion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectQuestion.js","sourceRoot":"","sources":["../../../src/components/questions/SelectQuestion.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelectQuestion.js","sourceRoot":"","sources":["../../../src/components/questions/SelectQuestion.tsx"],"names":[],"mappings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AC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CACvC,oBAAC,MAAM,IAAC,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,GAAI,CACpG,CAAC,CACK,CACL,CACF,CACU,CACnB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAKP,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE;IAC/C,OAAO,CACL,gCAAQ,KAAK,EAAE,MAAM,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,IACvC,MAAM,CAAC,WAAW,CACZ,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAGV,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;IAC5B,OAAO,IAAI,CAAC,CAAC,OAAO;AACtB,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,GAAG,EAAE;IACxB,OAAO,IAAI,CAAC,CAAC,OAAO;AACtB,CAAC,CAAC;AAEF,SAAS,MAAM,CAAC,QAAyB;IACvC,OAAO,UAAU,QAAQ,CAAC,GAAG,QAAQ,CAAC;AACxC,CAAC"}
|
|
@@ -1,98 +1,90 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
exports.__esModule = true;
|
|
17
|
-
exports.SliderQuestion = void 0;
|
|
18
|
-
var react_1 = __importDefault(require("react"));
|
|
19
|
-
var react_range_1 = require("react-range");
|
|
20
|
-
var MainLabel_1 = require("../MainLabel");
|
|
21
|
-
var QuestionWrapper_1 = require("../QuestionWrapper");
|
|
22
|
-
var QuestionDescription_1 = require("../QuestionDescription");
|
|
23
|
-
var SliderQuestion = function (_a) {
|
|
24
|
-
var question = _a.question, fieldState = _a.fieldState, setQuestionRef = _a.setQuestionRef;
|
|
25
|
-
var handleChange = function (newValues) {
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Range } from 'react-range';
|
|
3
|
+
import { MainLabel } from "../MainLabel";
|
|
4
|
+
import { QuestionWrapper } from "../QuestionWrapper";
|
|
5
|
+
import { QuestionDescription } from "../QuestionDescription";
|
|
6
|
+
export const SliderQuestion = ({ question, fieldState, setQuestionRef }) => {
|
|
7
|
+
const handleChange = (newValues) => {
|
|
26
8
|
fieldState.setValue(newValues[0]);
|
|
27
9
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
10
|
+
const blank = fieldState.value == null;
|
|
11
|
+
const value = fieldState.value || question.defaultPosition;
|
|
12
|
+
const markerLabels = calculateMarkerLabels(question);
|
|
13
|
+
return (React.createElement(QuestionWrapper, { question: question, fieldState: fieldState, setQuestionRef: setQuestionRef },
|
|
14
|
+
React.createElement(MainLabel, { question: question }),
|
|
15
|
+
React.createElement("div", { className: "description-and-fields" },
|
|
16
|
+
React.createElement(QuestionDescription, { question: question }),
|
|
17
|
+
React.createElement("div", { className: "fields" },
|
|
18
|
+
React.createElement(Range, { values: [value], onChange: handleChange, min: question.minimum, max: question.maximum, step: question.step, renderTrack: ({ props, children }) => (React.createElement("div", { ...props, style: { ...props.style, ...trackStyles } }, children)), renderThumb: (thumbProps) => renderThumb({
|
|
19
|
+
...thumbProps,
|
|
20
|
+
blank: blank,
|
|
21
|
+
showTooltip: question.valueTooltip,
|
|
22
|
+
startThumbHidden: question.startThumbHidden,
|
|
23
|
+
onFocus: fieldState.setAsActiveQuestion
|
|
24
|
+
}), renderMark: ({ props, index }) => (markerLabels[index] !== undefined
|
|
25
|
+
? renderMark(props, markerLabels[index])
|
|
26
|
+
: null) })))));
|
|
45
27
|
};
|
|
46
|
-
exports.SliderQuestion = SliderQuestion;
|
|
47
28
|
// blank: no value is set in fieldState
|
|
48
29
|
// showTooltip: how a tooltip with the value while dragging
|
|
49
30
|
// startThumbHidden:
|
|
50
31
|
// if set: hide thumb while <blank>
|
|
51
32
|
// if not set: thumb appears a very translucent grey when <blank>
|
|
52
|
-
|
|
53
|
-
var props = _a.props, value = _a.value, index = _a.index, isDragged = _a.isDragged, blank = _a.blank, showTooltip = _a.showTooltip, startThumbHidden = _a.startThumbHidden, onFocus = _a.onFocus;
|
|
33
|
+
const renderThumb = ({ props, value, index, isDragged, blank, showTooltip, startThumbHidden, onFocus }) => {
|
|
54
34
|
if (startThumbHidden && blank) {
|
|
55
|
-
return
|
|
35
|
+
return React.createElement("div", { ...props });
|
|
56
36
|
}
|
|
57
|
-
return (
|
|
37
|
+
return (React.createElement("div", { ...props, style: {
|
|
38
|
+
...props.style,
|
|
39
|
+
...baseThumbStyles,
|
|
40
|
+
...(isDragged && isDraggedThumbStyles),
|
|
41
|
+
...(blank && invalidThumbStyles)
|
|
42
|
+
}, onFocus: onFocus },
|
|
58
43
|
"||",
|
|
59
|
-
showTooltip && isDragged &&
|
|
44
|
+
showTooltip && isDragged && React.createElement("div", { style: labelStyles }, value)));
|
|
60
45
|
};
|
|
61
46
|
// Outer div is vertical bar.
|
|
62
47
|
// inner div is absolutely center positioned label.
|
|
63
48
|
// Note: Labels will take no action to avoid eachother!
|
|
64
|
-
|
|
65
|
-
|
|
49
|
+
const renderMark = (props, label) => (React.createElement("div", { ...props, style: {
|
|
50
|
+
...props.style,
|
|
51
|
+
top: '18px',
|
|
52
|
+
marginTop: 0,
|
|
53
|
+
height: '9px',
|
|
54
|
+
width: '1px',
|
|
55
|
+
backgroundColor: '#d3d3d3'
|
|
56
|
+
} },
|
|
57
|
+
React.createElement("div", { style: {
|
|
66
58
|
position: 'absolute',
|
|
67
59
|
top: '8px',
|
|
68
60
|
transform: label.first
|
|
69
61
|
? undefined
|
|
70
62
|
: label.last
|
|
71
63
|
? 'translateX(-100%)'
|
|
72
|
-
: 'translateX(-50%)'
|
|
73
|
-
}, dangerouslySetInnerHTML: { __html: label.text } })));
|
|
64
|
+
: 'translateX(-50%)',
|
|
65
|
+
}, dangerouslySetInnerHTML: { __html: label.text } })));
|
|
74
66
|
// {<markerIndex>: {text: .., first: true, last: false}}
|
|
75
67
|
// There can be hundreds of markers, but we'll only ever show the ones with a label.
|
|
76
|
-
|
|
68
|
+
const calculateMarkerLabels = (question) => {
|
|
77
69
|
if (question.labels.length === 0)
|
|
78
70
|
return {};
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
question.labels.forEach(
|
|
82
|
-
|
|
71
|
+
const nroMarkers = (question.maximum - question.minimum) / question.step;
|
|
72
|
+
const markerLabels = {};
|
|
73
|
+
question.labels.forEach((label, labelIndex) => {
|
|
74
|
+
const markerIdx = Math.floor((labelIndex * nroMarkers / (question.labels.length - 1)));
|
|
83
75
|
markerLabels[markerIdx] = { text: label, first: labelIndex === 0, last: labelIndex === question.labels.length - 1 };
|
|
84
76
|
});
|
|
85
77
|
return markerLabels;
|
|
86
78
|
};
|
|
87
|
-
|
|
79
|
+
const trackStyles = {
|
|
88
80
|
border: '1px solid #d3d3d3',
|
|
89
81
|
background: '#fafafa',
|
|
90
82
|
height: '18px',
|
|
91
83
|
borderRadius: '4px',
|
|
92
84
|
marginBottom: '18px',
|
|
93
|
-
boxShadow: 'inset 0 1px 1px #F0F0F0, 0 3px 6px -5px #BBB'
|
|
85
|
+
boxShadow: 'inset 0 1px 1px #F0F0F0, 0 3px 6px -5px #BBB',
|
|
94
86
|
};
|
|
95
|
-
|
|
87
|
+
const baseThumbStyles = {
|
|
96
88
|
height: '28px',
|
|
97
89
|
width: '34px',
|
|
98
90
|
textAlign: 'center',
|
|
@@ -101,23 +93,23 @@ var baseThumbStyles = {
|
|
|
101
93
|
color: '#E8E7E6',
|
|
102
94
|
border: '1px solid #9AC1DD',
|
|
103
95
|
borderRadius: '3px',
|
|
104
|
-
boxShadow: 'inset 0 0 1px #FFF, inset 0 1px 7px #9AC1DD, 0 3px 6px -3px #9AC1DD'
|
|
96
|
+
boxShadow: 'inset 0 0 1px #FFF, inset 0 1px 7px #9AC1DD, 0 3px 6px -3px #9AC1DD',
|
|
105
97
|
};
|
|
106
|
-
|
|
107
|
-
boxShadow: 'inset 0 0 1px #FFF, inset 0 1px 7px #DDD, 0 3px 6px -3px #BBB'
|
|
98
|
+
const isDraggedThumbStyles = {
|
|
99
|
+
boxShadow: 'inset 0 0 1px #FFF, inset 0 1px 7px #DDD, 0 3px 6px -3px #BBB',
|
|
108
100
|
};
|
|
109
|
-
|
|
101
|
+
const invalidThumbStyles = {
|
|
110
102
|
backgroundColor: "rgba(255, 255, 255, .5)",
|
|
111
103
|
boxShadow: 'none',
|
|
112
|
-
border: '1px solid #D9D9D9'
|
|
104
|
+
border: '1px solid #D9D9D9',
|
|
113
105
|
};
|
|
114
|
-
|
|
106
|
+
const labelStyles = {
|
|
115
107
|
position: 'absolute',
|
|
116
108
|
top: '-28px',
|
|
117
109
|
left: '17px',
|
|
118
110
|
transform: 'translateX(-50%)',
|
|
119
111
|
color: '#000',
|
|
120
112
|
fontWeight: 'bold',
|
|
121
|
-
padding: '4px'
|
|
113
|
+
padding: '4px',
|
|
122
114
|
};
|
|
123
115
|
//# sourceMappingURL=SliderQuestion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliderQuestion.js","sourceRoot":"","sources":["../../../src/components/questions/SliderQuestion.tsx"],"names":[],"mappings":"
|
|
1
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
var MainLabel_1 = require("../MainLabel");
|
|
10
|
-
var QuestionWrapper_1 = require("../QuestionWrapper");
|
|
11
|
-
var QuestionDescription_1 = require("../QuestionDescription");
|
|
12
|
-
var StringQuestion = function (_a) {
|
|
13
|
-
var _b;
|
|
14
|
-
var question = _a.question, fieldState = _a.fieldState, setQuestionRef = _a.setQuestionRef;
|
|
15
|
-
var handleChange = function (event) {
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { MainLabel } from "../MainLabel";
|
|
4
|
+
import { QuestionWrapper } from "../QuestionWrapper";
|
|
5
|
+
import { QuestionDescription } from "../QuestionDescription";
|
|
6
|
+
export const StringQuestion = ({ question, fieldState, setQuestionRef }) => {
|
|
7
|
+
var _a;
|
|
8
|
+
const handleChange = (event) => {
|
|
16
9
|
fieldState.setValue(event.target.value);
|
|
17
10
|
};
|
|
18
|
-
|
|
11
|
+
const className = classNames(question.type, {
|
|
19
12
|
sized: !!question.size,
|
|
20
13
|
subitem: false // TODO
|
|
21
14
|
});
|
|
22
|
-
return (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
return (React.createElement(QuestionWrapper, { question: question, fieldState: fieldState, setQuestionRef: setQuestionRef },
|
|
16
|
+
React.createElement(MainLabel, { question: question }),
|
|
17
|
+
React.createElement("div", { className: "description-and-fields" },
|
|
18
|
+
React.createElement(QuestionDescription, { question: question }),
|
|
19
|
+
React.createElement("div", { className: "fields", id: htmlId(question) },
|
|
20
|
+
React.createElement("input", { type: "text", className: className, value: fieldState.value || "", size: (_a = question.size) !== null && _a !== void 0 ? _a : undefined, onChange: handleChange, onFocus: fieldState.setAsActiveQuestion })))));
|
|
28
21
|
};
|
|
29
|
-
exports.StringQuestion = StringQuestion;
|
|
30
22
|
function htmlId(question) {
|
|
31
|
-
return
|
|
23
|
+
return `answer_${question.key}_input`;
|
|
32
24
|
}
|
|
33
25
|
//# sourceMappingURL=StringQuestion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StringQuestion.js","sourceRoot":"","sources":["../../../src/components/questions/StringQuestion.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StringQuestion.js","sourceRoot":"","sources":["../../../src/components/questions/StringQuestion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAQ7D,MAAM,CAAC,MAAM,cAAc,GAAmC,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,EAAE,EAAE;;IACzG,MAAM,YAAY,GAAG,CAAC,KAA0C,EAAE,EAAE;QAClE,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC,CAAC;IACF,MAAM,SAAS,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE;QAC1C,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI;QACtB,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAC,CAAC;IAEH,OAAO,CACL,oBAAC,eAAe,IAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc;QACzF,oBAAC,SAAS,IAAC,QAAQ,EAAE,QAAQ,GAAI;QACjC,6BAAK,SAAS,EAAC,wBAAwB;YACrC,oBAAC,mBAAmB,IAAC,QAAQ,EAAE,QAAQ,GAAI;YAC3C,6BAAK,SAAS,EAAC,QAAQ,EAAC,EAAE,EAAE,MAAM,CAAC,QAAQ,CAAC;gBAE1C,+BACE,IAAI,EAAC,MAAM,EACX,SAAS,EAAE,SAAS,EACpB,KAA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