Loading editor/package.json +1 −1 Original line number Diff line number Diff line { "name": "@inject/editor", "version": "0.19.1", "version": "0.20.1", "description": "Editor module to Inject Exercise Platform", "main": "index.js", "license": "MIT", Loading editor/src/assets/pageContent/injectSpecification.ts +10 −0 Original line number Diff line number Diff line Loading @@ -144,4 +144,14 @@ export const QUESTIONNAIRE_QUESTION_FORM: Form = { tooltip: '', optional: true, }, minimalLength: { label: 'Minimal answer length', tooltip: '', optional: true, }, maximalLength: { label: 'Maximal answer length', tooltip: '', optional: true, }, } editor/src/assets/pageContent/tools.ts +10 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,11 @@ export const TOOL_FORM: Form = { label: 'Default response', tooltip: '', }, buttonCaption: { label: 'Button caption', tooltip: '', optional: true, }, } export const TOOL_RESPONSE_FORM: Form = { Loading @@ -50,6 +55,11 @@ export const TOOL_RESPONSE_FORM: Form = { tooltip: '', optional: true, }, buttonCaption: { label: 'Button caption', tooltip: '', optional: true, }, } export const TOOL_RESPONSE_CONNECTIONS_FORM: Form = { Loading editor/src/components/InjectSpecification/QuestionnaireForm/AutoFreeformForm.tsx +24 −4 Original line number Diff line number Diff line Loading @@ -32,13 +32,14 @@ import type { } from '../../../indexeddb/types' import TooltipLabel from '../../Tooltips/TooltipLabel' import TooltipSwitch from '../../Tooltips/TooltipSwitch' import { MinMax } from './MinMax' import QuestionnaireMilestoneForm from './QuestionnaireMilestoneForm' interface QuestionnaireQuestionFormProps { questionnaireQuestion?: QuestionnaireQuestion autoFreeformQuestion?: QuestionnaireQuestionAutoFreeForm injectInfoId: number buttonProps: ButtonProps questionnaireQuestion?: QuestionnaireQuestion autoFreeformQuestion?: QuestionnaireQuestionAutoFreeForm } type State< Loading @@ -50,6 +51,8 @@ type State< update: (id?: number) => Promise<void> correctAnswer: string regex: boolean min?: number max?: number }, > = S & ZustandSetterSingle<S> Loading @@ -72,7 +75,7 @@ const AutoFreeformForm: FC<QuestionnaireQuestionFormProps> = ({ })), set: (item, value) => set({ [item]: value }), update: async id => { const { multiline, text, note, correctAnswer, regex } = get() const { multiline, text, note, correctAnswer, regex, min, max } = get() const correctMilestones = ( await db.questionnaireMilestones Loading Loading @@ -110,6 +113,8 @@ const AutoFreeformForm: FC<QuestionnaireQuestionFormProps> = ({ regex, correctMilestones, incorrectMilestones, min, max, } ) Loading @@ -129,6 +134,8 @@ const AutoFreeformForm: FC<QuestionnaireQuestionFormProps> = ({ note: questionnaireQuestion?.note, correctAnswer: autoFreeformQuestion?.correctAnswer, regex: autoFreeformQuestion?.regex, min: autoFreeformQuestion?.min, max: autoFreeformQuestion?.max, }) }, [isOpen, state, questionnaireQuestion, autoFreeformQuestion]) Loading Loading @@ -233,7 +240,6 @@ const AutoFreeformForm: FC<QuestionnaireQuestionFormProps> = ({ margin-block: 1rem !important; `} /> <TooltipLabel label={QUESTIONNAIRE_QUESTION_FORM.note}> <ShallowGetSet store={state} Loading Loading @@ -265,6 +271,20 @@ const AutoFreeformForm: FC<QuestionnaireQuestionFormProps> = ({ title={QUESTIONNAIRE_QUESTION_FORM.incorrectMilestones.label} correct={false} /> <ShallowGetSet store={state} get={({ min, max }) => [min, max]} set={({ set }) => set} > {([min, max], set) => ( <MinMax min={min} max={max} onMinChange={value => set('min', value)} onMaxChange={value => set('max', value)} /> )} </ShallowGetSet> </DialogBody> <DialogFooter actions={ Loading editor/src/components/InjectSpecification/QuestionnaireForm/FreeformForm.tsx +27 −3 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import type { } from '../../../indexeddb/types' import TooltipLabel from '../../Tooltips/TooltipLabel' import TooltipSwitch from '../../Tooltips/TooltipSwitch' import { MinMax } from './MinMax' import QuestionnaireMilestoneForm from './QuestionnaireMilestoneForm' interface QuestionnaireQuestionFormProps { Loading @@ -45,6 +46,8 @@ type State< valid: boolean multiline: boolean note?: string min?: number max?: number update: (id?: number) => Promise<void> }, > = S & ZustandSetterSingle<S> Loading @@ -61,12 +64,16 @@ const FreeformForm: FC<QuestionnaireQuestionFormProps> = ({ text: '', multiline: false, note: '', min: undefined, max: undefined, ...compute(get, state => ({ valid: state.text !== '', valid: state.text !== '' && (!state.max || !state.min || state.min <= state.max), })), set: (item, value) => set({ [item]: value }), update: async id => { const { multiline, text, note } = get() const { multiline, text, note, min, max } = get() const relatedMilestones = ( await db.questionnaireMilestones Loading @@ -85,6 +92,8 @@ const FreeformForm: FC<QuestionnaireQuestionFormProps> = ({ { multiline, relatedMilestones, min, max, } ) Loading @@ -102,6 +111,8 @@ const FreeformForm: FC<QuestionnaireQuestionFormProps> = ({ text: questionnaireQuestion?.text ?? '', multiline: freeformQuestion?.multiline, note: questionnaireQuestion?.note ?? '', min: freeformQuestion?.min, max: freeformQuestion?.max, }) }, [isOpen, state, questionnaireQuestion, freeformQuestion]) Loading Loading @@ -165,7 +176,6 @@ const FreeformForm: FC<QuestionnaireQuestionFormProps> = ({ /> )} </ShallowGetSet> <QuestionnaireMilestoneForm questionId={freeformQuestion?.id} injectInfoId={injectInfoId} Loading @@ -186,6 +196,20 @@ const FreeformForm: FC<QuestionnaireQuestionFormProps> = ({ )} </ShallowGetSet> </TooltipLabel> <ShallowGetSet store={state} get={({ min, max }) => [min, max]} set={({ set }) => set} > {([min, max], set) => ( <MinMax min={min} max={max} onMinChange={value => set('min', value)} onMaxChange={value => set('max', value)} /> )} </ShallowGetSet> </DialogBody> <DialogFooter actions={ Loading Loading
editor/package.json +1 −1 Original line number Diff line number Diff line { "name": "@inject/editor", "version": "0.19.1", "version": "0.20.1", "description": "Editor module to Inject Exercise Platform", "main": "index.js", "license": "MIT", Loading
editor/src/assets/pageContent/injectSpecification.ts +10 −0 Original line number Diff line number Diff line Loading @@ -144,4 +144,14 @@ export const QUESTIONNAIRE_QUESTION_FORM: Form = { tooltip: '', optional: true, }, minimalLength: { label: 'Minimal answer length', tooltip: '', optional: true, }, maximalLength: { label: 'Maximal answer length', tooltip: '', optional: true, }, }
editor/src/assets/pageContent/tools.ts +10 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,11 @@ export const TOOL_FORM: Form = { label: 'Default response', tooltip: '', }, buttonCaption: { label: 'Button caption', tooltip: '', optional: true, }, } export const TOOL_RESPONSE_FORM: Form = { Loading @@ -50,6 +55,11 @@ export const TOOL_RESPONSE_FORM: Form = { tooltip: '', optional: true, }, buttonCaption: { label: 'Button caption', tooltip: '', optional: true, }, } export const TOOL_RESPONSE_CONNECTIONS_FORM: Form = { Loading
editor/src/components/InjectSpecification/QuestionnaireForm/AutoFreeformForm.tsx +24 −4 Original line number Diff line number Diff line Loading @@ -32,13 +32,14 @@ import type { } from '../../../indexeddb/types' import TooltipLabel from '../../Tooltips/TooltipLabel' import TooltipSwitch from '../../Tooltips/TooltipSwitch' import { MinMax } from './MinMax' import QuestionnaireMilestoneForm from './QuestionnaireMilestoneForm' interface QuestionnaireQuestionFormProps { questionnaireQuestion?: QuestionnaireQuestion autoFreeformQuestion?: QuestionnaireQuestionAutoFreeForm injectInfoId: number buttonProps: ButtonProps questionnaireQuestion?: QuestionnaireQuestion autoFreeformQuestion?: QuestionnaireQuestionAutoFreeForm } type State< Loading @@ -50,6 +51,8 @@ type State< update: (id?: number) => Promise<void> correctAnswer: string regex: boolean min?: number max?: number }, > = S & ZustandSetterSingle<S> Loading @@ -72,7 +75,7 @@ const AutoFreeformForm: FC<QuestionnaireQuestionFormProps> = ({ })), set: (item, value) => set({ [item]: value }), update: async id => { const { multiline, text, note, correctAnswer, regex } = get() const { multiline, text, note, correctAnswer, regex, min, max } = get() const correctMilestones = ( await db.questionnaireMilestones Loading Loading @@ -110,6 +113,8 @@ const AutoFreeformForm: FC<QuestionnaireQuestionFormProps> = ({ regex, correctMilestones, incorrectMilestones, min, max, } ) Loading @@ -129,6 +134,8 @@ const AutoFreeformForm: FC<QuestionnaireQuestionFormProps> = ({ note: questionnaireQuestion?.note, correctAnswer: autoFreeformQuestion?.correctAnswer, regex: autoFreeformQuestion?.regex, min: autoFreeformQuestion?.min, max: autoFreeformQuestion?.max, }) }, [isOpen, state, questionnaireQuestion, autoFreeformQuestion]) Loading Loading @@ -233,7 +240,6 @@ const AutoFreeformForm: FC<QuestionnaireQuestionFormProps> = ({ margin-block: 1rem !important; `} /> <TooltipLabel label={QUESTIONNAIRE_QUESTION_FORM.note}> <ShallowGetSet store={state} Loading Loading @@ -265,6 +271,20 @@ const AutoFreeformForm: FC<QuestionnaireQuestionFormProps> = ({ title={QUESTIONNAIRE_QUESTION_FORM.incorrectMilestones.label} correct={false} /> <ShallowGetSet store={state} get={({ min, max }) => [min, max]} set={({ set }) => set} > {([min, max], set) => ( <MinMax min={min} max={max} onMinChange={value => set('min', value)} onMaxChange={value => set('max', value)} /> )} </ShallowGetSet> </DialogBody> <DialogFooter actions={ Loading
editor/src/components/InjectSpecification/QuestionnaireForm/FreeformForm.tsx +27 −3 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import type { } from '../../../indexeddb/types' import TooltipLabel from '../../Tooltips/TooltipLabel' import TooltipSwitch from '../../Tooltips/TooltipSwitch' import { MinMax } from './MinMax' import QuestionnaireMilestoneForm from './QuestionnaireMilestoneForm' interface QuestionnaireQuestionFormProps { Loading @@ -45,6 +46,8 @@ type State< valid: boolean multiline: boolean note?: string min?: number max?: number update: (id?: number) => Promise<void> }, > = S & ZustandSetterSingle<S> Loading @@ -61,12 +64,16 @@ const FreeformForm: FC<QuestionnaireQuestionFormProps> = ({ text: '', multiline: false, note: '', min: undefined, max: undefined, ...compute(get, state => ({ valid: state.text !== '', valid: state.text !== '' && (!state.max || !state.min || state.min <= state.max), })), set: (item, value) => set({ [item]: value }), update: async id => { const { multiline, text, note } = get() const { multiline, text, note, min, max } = get() const relatedMilestones = ( await db.questionnaireMilestones Loading @@ -85,6 +92,8 @@ const FreeformForm: FC<QuestionnaireQuestionFormProps> = ({ { multiline, relatedMilestones, min, max, } ) Loading @@ -102,6 +111,8 @@ const FreeformForm: FC<QuestionnaireQuestionFormProps> = ({ text: questionnaireQuestion?.text ?? '', multiline: freeformQuestion?.multiline, note: questionnaireQuestion?.note ?? '', min: freeformQuestion?.min, max: freeformQuestion?.max, }) }, [isOpen, state, questionnaireQuestion, freeformQuestion]) Loading Loading @@ -165,7 +176,6 @@ const FreeformForm: FC<QuestionnaireQuestionFormProps> = ({ /> )} </ShallowGetSet> <QuestionnaireMilestoneForm questionId={freeformQuestion?.id} injectInfoId={injectInfoId} Loading @@ -186,6 +196,20 @@ const FreeformForm: FC<QuestionnaireQuestionFormProps> = ({ )} </ShallowGetSet> </TooltipLabel> <ShallowGetSet store={state} get={({ min, max }) => [min, max]} set={({ set }) => set} > {([min, max], set) => ( <MinMax min={min} max={max} onMinChange={value => set('min', value)} onMaxChange={value => set('max', value)} /> )} </ShallowGetSet> </DialogBody> <DialogFooter actions={ Loading