Aller au contenu principal

Type Alias: LunaticState

LunaticState = object

Defined in: src/use-lunatic/type.ts:294

Return type of useLunatic.

Allow to operate the survey.

Properties

PropertyTypeDescriptionDefined in
compileControls() => objectAllow to fetch controls.src/use-lunatic/type.ts:332
currentErrors?objectErrors in the current page / iteration.src/use-lunatic/type.ts:317
errors?objectErrors in the survey.src/use-lunatic/type.ts:315
getChangedData(reset?) => LunaticDataGet data that have changed since last reset. Returns the same thing as getData().src/use-lunatic/type.ts:387
getComponents() => LunaticComponentProps[]Components to display in the current page. Return an array with the various components' properties. The orchestrator has to handle how they are displayed, using the componentType property to select the appropriate component. Examples // using LunaticComponents import { useLunatic, LunaticComponents } from '@inseefr/lunatic'; function App({ source, data }) { const { getComponents, Provider } = useLunatic(source, data, {}); const components = getComponents(); return ( <Provider> <LunaticComponents components={components} /> </Provider> ); } // using custom components import { useLunatic, LunaticComponents } from '@inseefr/lunatic'; const customCompoonents = { Input: MyCustomInput, InputNumber: MyCustomInputNumber, }; function App({ source, data }) { const { getComponents, Provider } = useLunatic(source, data, {}); const components = getComponents(); return ( <Provider> <LunaticComponents components={components} slots={customComponents} /> </Provider> ); } See LunaticComponentssrc/use-lunatic/type.ts:380
getData(withRefreshedCalculated, variableNames?) => LunaticDataGet data collected by the survey.src/use-lunatic/type.ts:382
getMultimode() => Record<string, boolean>Return the multimode state *src/use-lunatic/type.ts:411
goNextPage() => voidNavigate to the next page.src/use-lunatic/type.ts:328
goPreviousPage() => voidNavigate to the previous page.src/use-lunatic/type.ts:330
goToPage(page) => voidNavigate to a specific page.src/use-lunatic/type.ts:321
handleChangesLunaticChangesHandlerChange several variable values. Be careful when using this function. In most cases, you don't need this function. It's used directly by the components (and available as a props.) - With only one change or with serveral changes Example handleChanges([{name: "MY_VAR", value: "new value"}]) handleChanges([ {name: "MY_VAR", value: "new value"}, {name: "MY_VAR_2", value: "new value 2"} ])src/use-lunatic/type.ts:409
hasPageResponse() => booleanReturn true as soon as the current page has at least one answer.src/use-lunatic/type.ts:391
isFirstPagebooleanWhether or not we're on the survey first page.src/use-lunatic/type.ts:311
isInLoopbooleanWhether or not we're in a loop.src/use-lunatic/type.ts:305
isLastPagebooleanWhether or not we're on the survey last page (we reached maxPage).src/use-lunatic/type.ts:313
loopVariablesstring[]Current loop's variables.src/use-lunatic/type.ts:307
modalErrors?Record<string, LunaticError[]>Errors in modal.src/use-lunatic/type.ts:319
overviewInterpretedLunaticOverviewItem[]-src/use-lunatic/type.ts:297
pagerLunaticPagerCurrent pager.src/use-lunatic/type.ts:296
pageTagPageTagCurrent page numerotation.src/use-lunatic/type.ts:299
ProviderFunctionComponent<PropsWithChildren>Necessary component that must wraps LunaticComponents to make the library works.src/use-lunatic/type.ts:303
resetChangedData() => voidEmpty the store of changed variables.src/use-lunatic/type.ts:389
roundaboutLoopVariablesstring[]Current roundabout loop's variables.src/use-lunatic/type.ts:309
updatedAtnumberDate of the last handleChange function call.src/use-lunatic/type.ts:301