Skip to content

Commit

Permalink
Support number step
Browse files Browse the repository at this point in the history
  • Loading branch information
blcham committed Apr 27, 2021
1 parent 2198c04 commit b7deb21
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/components/answer/InputAnswer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ class InputPropertiesResolver {
props.rows = 5;
break;
case 'number':
props = { ...props, ...InputPropertiesResolver._resolveNumberRestrictions(question) };
props = {
...props,
...InputPropertiesResolver._resolveNumberRestrictions(question),
...this._resolveStepRestriction(question)
};
break;
default:
break;
Expand All @@ -73,6 +77,14 @@ class InputPropertiesResolver {
return props;
}

static _resolveStepRestriction(question) {
let restriction = {};
if (question[Constants.STEP] !== undefined) {
restriction['step'] = JsonLdUtils.getJsonAttValue(question, Constants.STEP);
}
return restriction;
}

static _resolveNumberRestrictions(question) {
let restriction = {};
Object.getOwnPropertyNames(NUMBER_RULES).forEach((key) => {
Expand Down
1 change: 1 addition & 0 deletions src/constants/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export default class Constants {

BOOLEAN: 'http://www.w3.org/2001/XMLSchema#boolean'
};
static STEP = 'http://onto.fel.cvut.cz/ontologies/form/step';
static ACCEPTS_ANSWER_VALUE = 'http://onto.fel.cvut.cz/ontologies/form/accepts-answer-value';
static ACCEPTS = 'http://onto.fel.cvut.cz/ontologies/form/accepts';
static HAS_DATATYPE = 'http://onto.fel.cvut.cz/ontologies/form/has-datatype';
Expand Down

0 comments on commit b7deb21

Please sign in to comment.