@aehrc/smart-forms-renderer 0.1.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/dist/api/populate.d.ts +8 -0
- package/dist/components/Alert.styles.d.ts +12 -0
- package/dist/components/BackToTopButton/BackToTopButton.d.ts +7 -0
- package/dist/components/Box.styles.d.ts +28 -0
- package/dist/components/FormComponents/BooleanItem/BooleanField.d.ts +8 -0
- package/dist/components/FormComponents/BooleanItem/BooleanItem.d.ts +9 -0
- package/dist/components/FormComponents/DateItem/DateField.d.ts +12 -0
- package/dist/components/FormComponents/DateItem/DateItem.d.ts +9 -0
- package/dist/components/FormComponents/DateTimeItem/DateTimeField.d.ts +12 -0
- package/dist/components/FormComponents/DateTimeItem/DateTimeItem.d.ts +9 -0
- package/dist/components/FormComponents/DecimalItem/DecimalField.d.ts +15 -0
- package/dist/components/FormComponents/DecimalItem/DecimalItem.d.ts +9 -0
- package/dist/components/FormComponents/DisplayItem/DisplayInstructions.d.ts +6 -0
- package/dist/components/FormComponents/DisplayItem/DisplayInstructions.styles.d.ts +9 -0
- package/dist/components/FormComponents/DisplayItem/DisplayItem.d.ts +7 -0
- package/dist/components/FormComponents/GridGroup/GridGroup.d.ts +10 -0
- package/dist/components/FormComponents/GridGroup/GridRow.d.ts +11 -0
- package/dist/components/FormComponents/GridGroup/GridTable.d.ts +11 -0
- package/dist/components/FormComponents/GroupItem/GroupHeading.d.ts +9 -0
- package/dist/components/FormComponents/GroupItem/GroupItem.d.ts +15 -0
- package/dist/components/FormComponents/GroupItem/GroupItem.styles.d.ts +11 -0
- package/dist/components/FormComponents/GroupItem/GroupItemSwitcher.d.ts +10 -0
- package/dist/components/FormComponents/GroupItem/NextTabButton.d.ts +7 -0
- package/dist/components/FormComponents/GroupItem/NextTabButtonWrapper.d.ts +8 -0
- package/dist/components/FormComponents/IntegerItem/IntegerField.d.ts +15 -0
- package/dist/components/FormComponents/IntegerItem/IntegerItem.d.ts +9 -0
- package/dist/components/FormComponents/Item.styles.d.ts +6 -0
- package/dist/components/FormComponents/ItemParts/ContextDisplayItem.d.ts +7 -0
- package/dist/components/FormComponents/ItemParts/FadingCheckIcon.d.ts +6 -0
- package/dist/components/FormComponents/ItemParts/ItemFieldGrid.d.ts +10 -0
- package/dist/components/FormComponents/ItemParts/ItemLabelText.d.ts +7 -0
- package/dist/components/FormComponents/ItemParts/ItemLabelWrapper.d.ts +7 -0
- package/dist/components/FormComponents/ItemParts/QItemCheckboxSingle.d.ts +10 -0
- package/dist/components/FormComponents/ItemParts/QItemCheckboxSingleWithOpenLabel.d.ts +10 -0
- package/dist/components/FormComponents/ItemParts/QItemRadioButtonWithOpenLabel.d.ts +10 -0
- package/dist/components/FormComponents/Lists.styles.d.ts +11 -0
- package/dist/components/FormComponents/QItemChoice/QItemChoice.d.ts +9 -0
- package/dist/components/FormComponents/QItemChoice/QItemChoiceAutocomplete.d.ts +9 -0
- package/dist/components/FormComponents/QItemChoice/QItemChoiceCheckboxAnswerOption.d.ts +11 -0
- package/dist/components/FormComponents/QItemChoice/QItemChoiceCheckboxAnswerValueSet.d.ts +11 -0
- package/dist/components/FormComponents/QItemChoice/QItemChoiceRadioAnswerOption.d.ts +11 -0
- package/dist/components/FormComponents/QItemChoice/QItemChoiceRadioAnswerValueSet.d.ts +11 -0
- package/dist/components/FormComponents/QItemChoice/QItemChoiceRadioSingle.d.ts +8 -0
- package/dist/components/FormComponents/QItemChoice/QItemChoiceSelectAnswerOption.d.ts +9 -0
- package/dist/components/FormComponents/QItemChoice/QItemChoiceSelectAnswerValueSet.d.ts +9 -0
- package/dist/components/FormComponents/QItemOpenChoice/QItemOpenChoice.d.ts +9 -0
- package/dist/components/FormComponents/QItemOpenChoice/QItemOpenChoiceAutocomplete.d.ts +9 -0
- package/dist/components/FormComponents/QItemOpenChoice/QItemOpenChoiceCheckboxAnswerOption.d.ts +11 -0
- package/dist/components/FormComponents/QItemOpenChoice/QItemOpenChoiceRadioAnswerOption.d.ts +11 -0
- package/dist/components/FormComponents/QItemOpenChoice/QItemOpenChoiceSelectAnswerOption.d.ts +9 -0
- package/dist/components/FormComponents/QItemOpenChoice/QItemOpenChoiceSelectAnswerValueSet.d.ts +9 -0
- package/dist/components/FormComponents/RepeatGroup/AddItemButton.d.ts +8 -0
- package/dist/components/FormComponents/RepeatGroup/DeleteItemButton.d.ts +9 -0
- package/dist/components/FormComponents/RepeatGroup/RepeatGroup.d.ts +10 -0
- package/dist/components/FormComponents/RepeatGroup/RepeatGroupItem.d.ts +13 -0
- package/dist/components/FormComponents/RepeatItem/AddItemButton.d.ts +8 -0
- package/dist/components/FormComponents/RepeatItem/DeleteItemButton.d.ts +9 -0
- package/dist/components/FormComponents/RepeatItem/RepeatField.d.ts +12 -0
- package/dist/components/FormComponents/RepeatItem/RepeatItem.d.ts +9 -0
- package/dist/components/FormComponents/RepeatItem/RepeatItem.styles.d.ts +22 -0
- package/dist/components/FormComponents/SingleItem/SingleItem.d.ts +9 -0
- package/dist/components/FormComponents/SingleItem/SingleItemSwitcher.d.ts +9 -0
- package/dist/components/FormComponents/StringItem/StringField.d.ts +15 -0
- package/dist/components/FormComponents/StringItem/StringItem.d.ts +9 -0
- package/dist/components/FormComponents/Tables/DeleteRowButton.d.ts +9 -0
- package/dist/components/FormComponents/Tables/QItemGroupTable.d.ts +10 -0
- package/dist/components/FormComponents/Tables/QItemGroupTableRow.d.ts +10 -0
- package/dist/components/FormComponents/Tables/Table.styles.d.ts +10 -0
- package/dist/components/FormComponents/TextItem/TextField.d.ts +14 -0
- package/dist/components/FormComponents/TextItem/TextItem.d.ts +9 -0
- package/dist/components/FormComponents/Textfield.styles.d.ts +5 -0
- package/dist/components/FormComponents/TimeItem/TimeField.d.ts +12 -0
- package/dist/components/FormComponents/TimeItem/TimeItem.d.ts +9 -0
- package/dist/components/FormComponents/Typography.styles.d.ts +6 -0
- package/dist/components/FormComponents/UrlItem/UrlField.d.ts +14 -0
- package/dist/components/FormComponents/UrlItem/UrlItem.d.ts +9 -0
- package/dist/components/FormRenderer/FormBodyCollapsible.d.ts +9 -0
- package/dist/components/FormRenderer/FormBodySingleCollapsible.d.ts +12 -0
- package/dist/components/FormRenderer/FormBodySingleCollapsibleWrapper.d.ts +12 -0
- package/dist/components/FormRenderer/FormBodyTabbed.d.ts +9 -0
- package/dist/components/FormRenderer/FormRenderer.d.ts +3 -0
- package/dist/components/FormRenderer/FormTitle.d.ts +7 -0
- package/dist/components/FormRenderer/FormTopLevelItem.d.ts +9 -0
- package/dist/components/FormRenderer/SmartFormsRenderer.d.ts +9 -0
- package/dist/components/FormRenderer/index.d.ts +1 -0
- package/dist/components/Iconify/Iconify.d.ts +10 -0
- package/dist/components/Lists.styles.d.ts +11 -0
- package/dist/components/Tabs/CompleteTabButton.d.ts +7 -0
- package/dist/components/Tabs/FormBodySingleTab.d.ts +10 -0
- package/dist/components/Tabs/FormBodyTabList.d.ts +10 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/hooks/useBackToTop.d.ts +2 -0
- package/dist/hooks/useDebounce.d.ts +2 -0
- package/dist/hooks/useDecimalCalculatedExpression.d.ts +14 -0
- package/dist/hooks/useHidden.d.ts +3 -0
- package/dist/hooks/useInitialiseGroupTable.d.ts +4 -0
- package/dist/hooks/useInitialiseRenderer.d.ts +3 -0
- package/dist/hooks/useInitialiseRepeatAnswers.d.ts +4 -0
- package/dist/hooks/useInitialiseRepeatGroups.d.ts +4 -0
- package/dist/hooks/useIntegerCalculatedExpression.d.ts +13 -0
- package/dist/hooks/useQueryClient.d.ts +3 -0
- package/dist/hooks/useRenderingExtensions.d.ts +13 -0
- package/dist/hooks/useResponsive.d.ts +2 -0
- package/dist/hooks/useStringCalculatedExpression.d.ts +12 -0
- package/dist/hooks/useTerminologyServerQuery.d.ts +11 -0
- package/dist/hooks/useValidationError.d.ts +3 -0
- package/dist/hooks/useValueSetCodings.d.ts +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +10481 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +10526 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/answerExpression.interface.d.ts +5 -0
- package/dist/interfaces/calculatedExpression.interface.d.ts +4 -0
- package/dist/interfaces/choice.enum.d.ts +20 -0
- package/dist/interfaces/enableWhen.interface.d.ts +15 -0
- package/dist/interfaces/groupTable.interface.d.ts +5 -0
- package/dist/interfaces/populate.interface.d.ts +41 -0
- package/dist/interfaces/questionnaireStore.interface.d.ts +18 -0
- package/dist/interfaces/regex.interface.d.ts +4 -0
- package/dist/interfaces/renderProps.interface.d.ts +13 -0
- package/dist/interfaces/repeatGroup.interface.d.ts +9 -0
- package/dist/interfaces/repeatItem.interface.d.ts +5 -0
- package/dist/interfaces/tab.interface.d.ts +6 -0
- package/dist/interfaces/valueSet.interface.d.ts +5 -0
- package/dist/interfaces/variables.interface.d.ts +9 -0
- package/dist/setup-jest.d.ts +1 -0
- package/dist/stores/useConfigStore.d.ts +18 -0
- package/dist/stores/useQuestionnaireResponseStore.d.ts +14 -0
- package/dist/stores/useQuestionnaireStore.d.ts +34 -0
- package/dist/stories/FormRendererWrapper.stories.d.ts +11 -0
- package/dist/stories/SmartFormsRenderer.stories.d.ts +14 -0
- package/dist/utils/calculatedExpression.d.ts +14 -0
- package/dist/utils/choice.d.ts +44 -0
- package/dist/utils/debounce.d.ts +2 -0
- package/dist/utils/emptyResource.d.ts +3 -0
- package/dist/utils/enableWhen.d.ts +47 -0
- package/dist/utils/enableWhenExpression.d.ts +13 -0
- package/dist/utils/fhirpath.d.ts +19 -0
- package/dist/utils/initialiseForm.d.ts +20 -0
- package/dist/utils/itemControl.d.ts +108 -0
- package/dist/utils/mapItem.d.ts +18 -0
- package/dist/utils/openChoice.d.ts +22 -0
- package/dist/utils/parseInputs.d.ts +4 -0
- package/dist/utils/populate.d.ts +16 -0
- package/dist/utils/populateCallback.d.ts +6 -0
- package/dist/utils/populateContexts.d.ts +13 -0
- package/dist/utils/populateInputParams.d.ts +8 -0
- package/dist/utils/qItem.d.ts +32 -0
- package/dist/utils/qrItem.d.ts +42 -0
- package/dist/utils/questionnaireStoreUtils/addAdditionalVariables.d.ts +2 -0
- package/dist/utils/questionnaireStoreUtils/createQuestionaireModel.d.ts +3 -0
- package/dist/utils/questionnaireStoreUtils/extractContainedValueSets.d.ts +13 -0
- package/dist/utils/questionnaireStoreUtils/extractLaunchContext.d.ts +3 -0
- package/dist/utils/questionnaireStoreUtils/extractOtherExtensions.d.ts +34 -0
- package/dist/utils/questionnaireStoreUtils/extractTabs.d.ts +3 -0
- package/dist/utils/questionnaireStoreUtils/extractVariables.d.ts +15 -0
- package/dist/utils/questionnaireStoreUtils/resolveValueSets.d.ts +7 -0
- package/dist/utils/tabs.d.ts +75 -0
- package/dist/utils/valueSet.d.ts +21 -0
- package/package.json +71 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Extension, Questionnaire } from 'fhir/r4';
|
|
2
|
+
import type { LaunchContext, QuestionnaireLevelXFhirQueryVariable, SourceQuery } from '../interfaces/populate.interface';
|
|
3
|
+
export declare function getLaunchContexts(questionnaire: Questionnaire): LaunchContext[];
|
|
4
|
+
export declare function isLaunchContext(extension: Extension): extension is LaunchContext;
|
|
5
|
+
export declare function getSourceQueries(questionnaire: Questionnaire): SourceQuery[];
|
|
6
|
+
export declare function isSourceQuery(extension: Extension): extension is SourceQuery;
|
|
7
|
+
/**
|
|
8
|
+
* Filter x-fhir-query variables from questionnaire's extensions needed for population
|
|
9
|
+
*
|
|
10
|
+
* @author Sean Fong
|
|
11
|
+
*/
|
|
12
|
+
export declare function getQuestionnaireLevelXFhirQueryVariables(questionnaire: Questionnaire): QuestionnaireLevelXFhirQueryVariable[];
|
|
13
|
+
export declare function isXFhirQueryVariable(extension: Extension): extension is QuestionnaireLevelXFhirQueryVariable;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Encounter, Parameters, Patient, Practitioner, Questionnaire } from 'fhir/r4';
|
|
2
|
+
import type { LaunchContext, QuestionnaireLevelXFhirQueryVariable, SourceQuery } from '../interfaces/populate.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Define population input parameters without any batch response contexts
|
|
5
|
+
*
|
|
6
|
+
* @author Sean Fong
|
|
7
|
+
*/
|
|
8
|
+
export declare function createPopulateInputParameters(questionnaire: Questionnaire, patient: Patient, user: Practitioner, encounter: Encounter | null, launchContexts: LaunchContext[], sourceQueries: SourceQuery[], questionnaireLevelVariables: QuestionnaireLevelXFhirQueryVariable[]): Parameters | null;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Questionnaire, QuestionnaireItem } from 'fhir/r4';
|
|
2
|
+
import type { EnableWhenExpression, EnableWhenItems } from '../interfaces/enableWhen.interface';
|
|
3
|
+
interface isHiddenParams {
|
|
4
|
+
questionnaireItem: QuestionnaireItem;
|
|
5
|
+
enableWhenIsActivated: boolean;
|
|
6
|
+
enableWhenItems: EnableWhenItems;
|
|
7
|
+
enableWhenExpressions: Record<string, EnableWhenExpression>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Test the given QItem on a series of checks to verify if the item should be displayed
|
|
11
|
+
* Check if qItem has hidden attribute
|
|
12
|
+
* Check if qItem fufilled its enableWhen criteria
|
|
13
|
+
*
|
|
14
|
+
* @author Sean Fong
|
|
15
|
+
*/
|
|
16
|
+
export declare function isHidden(params: isHiddenParams): boolean;
|
|
17
|
+
interface isHiddenByEnableWhensParams {
|
|
18
|
+
linkId: string;
|
|
19
|
+
enableWhenIsActivated: boolean;
|
|
20
|
+
enableWhenItems: EnableWhenItems;
|
|
21
|
+
enableWhenExpressions: Record<string, EnableWhenExpression>;
|
|
22
|
+
}
|
|
23
|
+
export declare function isHiddenByEnableWhens(params: isHiddenByEnableWhensParams): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Check if qItem is a repeat item AND if it isn't a checkbox item
|
|
26
|
+
* Note: repeat checkbox items are rendered as multi-select checkbox instead of being rendered as a traditional repeat item
|
|
27
|
+
*
|
|
28
|
+
* @author Sean Fong
|
|
29
|
+
*/
|
|
30
|
+
export declare function isRepeatItemAndNotCheckbox(qItem: QuestionnaireItem): boolean;
|
|
31
|
+
export declare function getXHtmlStringFromQuestionnaire(questionnaire: Questionnaire): string | null;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Questionnaire, QuestionnaireItem, QuestionnaireResponse, QuestionnaireResponseItem } from 'fhir/r4';
|
|
2
|
+
import type { QrRepeatGroup } from '../interfaces/repeatGroup.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Create a questionnaireResponse from a given questionnaire form item
|
|
5
|
+
* A questionnaire form item is the first item of a questionnaire
|
|
6
|
+
*
|
|
7
|
+
* @author Sean Fong
|
|
8
|
+
*/
|
|
9
|
+
export declare function createQuestionnaireResponse(questionnaire: Questionnaire): QuestionnaireResponse;
|
|
10
|
+
/**
|
|
11
|
+
* Remove items with no answers from a given questionnaireResponse
|
|
12
|
+
* Also remove any starting or trailing whitespace from valueStrings
|
|
13
|
+
* Generated questionnaireResponse only has items with answers
|
|
14
|
+
*
|
|
15
|
+
* @author Sean Fong
|
|
16
|
+
*/
|
|
17
|
+
export declare function removeNoAnswerQrItem(qrItem: QuestionnaireResponseItem): QuestionnaireResponseItem | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Create an empty group qrItem from a given group qItem
|
|
20
|
+
*
|
|
21
|
+
* @author Sean Fong
|
|
22
|
+
*/
|
|
23
|
+
export declare function createQrGroup(qItem: QuestionnaireItem): QuestionnaireResponseItem;
|
|
24
|
+
/**
|
|
25
|
+
* Create an empty qrItem from a given qItem
|
|
26
|
+
*
|
|
27
|
+
* @author Sean Fong
|
|
28
|
+
*/
|
|
29
|
+
export declare function createEmptyQrItem(qItem: QuestionnaireItem): QuestionnaireResponseItem;
|
|
30
|
+
/**
|
|
31
|
+
* Create an empty qrItem from a given qItem with its display unit
|
|
32
|
+
*
|
|
33
|
+
* @author Sean Fong
|
|
34
|
+
*/
|
|
35
|
+
export declare function createEmptyQrItemWithUnit(qItem: QuestionnaireItem, unit: string): QuestionnaireResponseItem;
|
|
36
|
+
/**
|
|
37
|
+
* Updates the QuestionnaireResponseItem group by adding/removing a new/modified child QuestionnaireResponseItem into/from a qrGroup
|
|
38
|
+
* Takes either a single newQrItem or an array of newQrItems
|
|
39
|
+
*
|
|
40
|
+
* @author Sean Fong
|
|
41
|
+
*/
|
|
42
|
+
export declare function updateQrGroup(newQrItem: QuestionnaireResponseItem | null, newQrRepeatGroup: QrRepeatGroup | null, qrGroup: QuestionnaireResponseItem, qItemsIndexMap: Record<string, number>): void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Questionnaire } from 'fhir/r4';
|
|
2
|
+
import type { QuestionnaireModel } from '../../interfaces/questionnaireStore.interface';
|
|
3
|
+
export declare function createQuestionnaireModel(questionnaire: Questionnaire, additionalVariables: Record<string, object>): Promise<QuestionnaireModel>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ValueSetPromise } from '../../interfaces/valueSet.interface';
|
|
2
|
+
import type { Coding, Questionnaire, ValueSet } from 'fhir/r4';
|
|
3
|
+
export declare function extractContainedValueSets(questionnaire: Questionnaire): {
|
|
4
|
+
processedValueSetCodings: Record<string, Coding[]>;
|
|
5
|
+
processedValueSetUrls: Record<string, string>;
|
|
6
|
+
valueSetPromises: Record<string, ValueSetPromise>;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Sets an array of codings with the values from a valueSet
|
|
10
|
+
*
|
|
11
|
+
* @author Sean Fong
|
|
12
|
+
*/
|
|
13
|
+
export declare function getValueSetUrlFromContained(valueSet: ValueSet): string;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Expression, Questionnaire, QuestionnaireItem } from 'fhir/r4';
|
|
2
|
+
import type { CalculatedExpression } from '../../interfaces/calculatedExpression.interface';
|
|
3
|
+
import type { EnableWhenExpression, EnableWhenItemProperties } from '../../interfaces/enableWhen.interface';
|
|
4
|
+
import type { AnswerExpression } from '../../interfaces/answerExpression.interface';
|
|
5
|
+
import type { ValueSetPromise } from '../../interfaces/valueSet.interface';
|
|
6
|
+
import type { Variables } from '../../interfaces/variables.interface';
|
|
7
|
+
interface ReturnParamsRecursive {
|
|
8
|
+
variables: Variables;
|
|
9
|
+
enableWhenItems: Record<string, EnableWhenItemProperties>;
|
|
10
|
+
enableWhenExpressions: Record<string, EnableWhenExpression>;
|
|
11
|
+
calculatedExpressions: Record<string, CalculatedExpression>;
|
|
12
|
+
answerExpressions: Record<string, AnswerExpression>;
|
|
13
|
+
valueSetPromises: Record<string, ValueSetPromise>;
|
|
14
|
+
}
|
|
15
|
+
export declare function extractOtherExtensions(questionnaire: Questionnaire, variables: Variables, valueSetPromises: Record<string, ValueSetPromise>): ReturnParamsRecursive;
|
|
16
|
+
/**
|
|
17
|
+
* Get enableWhen items' linked items and enableBehaviour attribute and save them in an EnableWhenItemProperties object
|
|
18
|
+
*
|
|
19
|
+
* @author Sean Fong
|
|
20
|
+
*/
|
|
21
|
+
export declare function getEnableWhenItemProperties(qItem: QuestionnaireItem): EnableWhenItemProperties | null;
|
|
22
|
+
/**
|
|
23
|
+
* Check if an enableWhenExpression extension is present
|
|
24
|
+
*
|
|
25
|
+
* @author Sean Fong
|
|
26
|
+
*/
|
|
27
|
+
export declare function getEnableWhenExpression(qItem: QuestionnaireItem): Expression | null;
|
|
28
|
+
/**
|
|
29
|
+
* Check if an calculatedExpression extension is present
|
|
30
|
+
*
|
|
31
|
+
* @author Sean Fong
|
|
32
|
+
*/
|
|
33
|
+
export declare function getCalculatedExpression(qItem: QuestionnaireItem): Expression | null;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Expression, Extension, Questionnaire } from 'fhir/r4';
|
|
2
|
+
import type { Variables } from '../../interfaces/variables.interface';
|
|
3
|
+
export declare function extractQuestionnaireLevelVariables(questionnaire: Questionnaire): Variables;
|
|
4
|
+
/**
|
|
5
|
+
* Get fhirpath variables from an array of extensions
|
|
6
|
+
*
|
|
7
|
+
* @author Sean Fong
|
|
8
|
+
*/
|
|
9
|
+
export declare function getFhirPathVariables(extensions: Extension[]): Expression[];
|
|
10
|
+
/**
|
|
11
|
+
* Get x-fhir-query variables from an array of extensions
|
|
12
|
+
*
|
|
13
|
+
* @author Sean Fong
|
|
14
|
+
*/
|
|
15
|
+
export declare function getXFhirQueryVariables(extensions: Extension[]): Expression[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Coding } from 'fhir/r4';
|
|
2
|
+
import type { Variables } from '../../interfaces/variables.interface';
|
|
3
|
+
import type { ValueSetPromise } from '../../interfaces/valueSet.interface';
|
|
4
|
+
export declare function resolveValueSets(variables: Variables, valueSetPromises: Record<string, ValueSetPromise>, processedValueSetCodings: Record<string, Coding[]>): Promise<{
|
|
5
|
+
variables: Variables;
|
|
6
|
+
processedValueSetCodings: Record<string, Coding[]>;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Tabs } from '../interfaces/tab.interface';
|
|
2
|
+
import type { EnableWhenExpression, EnableWhenItems } from '../interfaces/enableWhen.interface';
|
|
3
|
+
import type { QuestionnaireItem } from 'fhir/r4';
|
|
4
|
+
export declare function getFirstVisibleTab(tabs: Tabs, enableWhenItems: EnableWhenItems, enableWhenExpressions: Record<string, EnableWhenExpression>): number;
|
|
5
|
+
/**
|
|
6
|
+
* Checks if any of the items in a qItem array is a tabbed item
|
|
7
|
+
* Returns true if there is at least one tabbed item
|
|
8
|
+
*
|
|
9
|
+
* @author Sean Fong
|
|
10
|
+
*/
|
|
11
|
+
export declare function containsTabs(topLevelQItem: QuestionnaireItem): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Checks if a top-level QItem is a tab container
|
|
14
|
+
* All items within a tab container are tabbed items
|
|
15
|
+
*
|
|
16
|
+
* @author Sean Fong
|
|
17
|
+
*/
|
|
18
|
+
export declare function isTabContainer(topLevelQItem: QuestionnaireItem): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Get tabbed items from a qItem array
|
|
21
|
+
*
|
|
22
|
+
* @author Sean Fong
|
|
23
|
+
*/
|
|
24
|
+
export declare function getTabbedItems(items: QuestionnaireItem[]): QuestionnaireItem[];
|
|
25
|
+
/**
|
|
26
|
+
* Check if a qItem is a tabbed item
|
|
27
|
+
*
|
|
28
|
+
* @author Sean Fong
|
|
29
|
+
*/
|
|
30
|
+
export declare function isTab(item: QuestionnaireItem): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Create a <linkId, {isComplete: boolean}> key-value pair for all tabbed items in a qItem array
|
|
33
|
+
*
|
|
34
|
+
* @author Sean Fong
|
|
35
|
+
*/
|
|
36
|
+
export declare function constructTabsWithProperties(qItems: QuestionnaireItem[] | undefined, hasTabContainer: boolean): Tabs;
|
|
37
|
+
interface constructTabsWithVisibilityParams {
|
|
38
|
+
tabs: Tabs;
|
|
39
|
+
enableWhenIsActivated: boolean;
|
|
40
|
+
enableWhenItems: EnableWhenItems;
|
|
41
|
+
enableWhenExpressions: Record<string, EnableWhenExpression>;
|
|
42
|
+
}
|
|
43
|
+
export declare function constructTabsWithVisibility(params: constructTabsWithVisibilityParams): {
|
|
44
|
+
linkId: string;
|
|
45
|
+
isVisible: boolean;
|
|
46
|
+
}[];
|
|
47
|
+
interface getNextVisibleTabIndexParams {
|
|
48
|
+
tabs: Tabs;
|
|
49
|
+
currentTabIndex: number;
|
|
50
|
+
enableWhenIsActivated: boolean;
|
|
51
|
+
enableWhenItems: EnableWhenItems;
|
|
52
|
+
enableWhenExpressions: Record<string, EnableWhenExpression>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get index of next visible tab
|
|
56
|
+
*
|
|
57
|
+
* @author Sean Fong
|
|
58
|
+
*/
|
|
59
|
+
export declare function getNextVisibleTabIndex(params: getNextVisibleTabIndexParams): number;
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* Get index of first visible tab
|
|
63
|
+
*
|
|
64
|
+
* @author Sean Fong
|
|
65
|
+
*/
|
|
66
|
+
export declare function getFirstVisibleTabIndex(tabs: Tabs, enableWhenIsActivated: boolean, enableWhenItems: EnableWhenItems, enableWhenExpressions: Record<string, EnableWhenExpression>): number | undefined;
|
|
67
|
+
/**
|
|
68
|
+
*
|
|
69
|
+
* Find number of visible tabs
|
|
70
|
+
*
|
|
71
|
+
* @author Sean Fong
|
|
72
|
+
*/
|
|
73
|
+
export declare function findNumOfVisibleTabs(tabs: Tabs, enableWhenIsActivated: boolean, enableWhenItems: EnableWhenItems, enableWhenExpressions: Record<string, EnableWhenExpression>): number;
|
|
74
|
+
export declare function getContextDisplays(item: QuestionnaireItem): QuestionnaireItem[];
|
|
75
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Coding, Encounter, Expression, FhirResource, Patient, Practitioner, QuestionnaireItem, ValueSet } from 'fhir/r4';
|
|
2
|
+
import type { FhirResourceString } from '../interfaces/populate.interface';
|
|
3
|
+
import type { ValueSetPromise } from '../interfaces/valueSet.interface';
|
|
4
|
+
import type { VariableXFhirQuery } from '../interfaces/variables.interface';
|
|
5
|
+
export declare function getTerminologyServerUrl(qItem: QuestionnaireItem): string | undefined;
|
|
6
|
+
export declare function getValueSetPromise(url: string, terminologyServer?: string): Promise<ValueSet>;
|
|
7
|
+
export declare function resolvePromises(valueSetPromises: Record<string, ValueSetPromise>): Promise<Record<string, ValueSetPromise>>;
|
|
8
|
+
/**
|
|
9
|
+
* Sets an array of codings with the values from a valueSet
|
|
10
|
+
*
|
|
11
|
+
* @author Sean Fong
|
|
12
|
+
*/
|
|
13
|
+
export declare function getValueSetCodings(valueSet: ValueSet): Coding[];
|
|
14
|
+
/**
|
|
15
|
+
* Evaluate valueSets in answerExpression with fhirpath
|
|
16
|
+
*
|
|
17
|
+
* @author Sean Fong
|
|
18
|
+
*/
|
|
19
|
+
export declare function evaluateAnswerExpressionValueSet(answerExpression: Expression, itemLevelVariables: Expression[], preprocessedCodings: Record<string, Coding[]>): Coding[];
|
|
20
|
+
export declare function createValueSetToXFhirQueryVariableNameMap(variables: Record<string, VariableXFhirQuery>): Record<string, string>;
|
|
21
|
+
export declare function getResourceFromLaunchContext(resourceType: FhirResourceString, patient: Patient | null, user: Practitioner | null, encounter: Encounter | null): FhirResource | null;
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aehrc/smart-forms-renderer",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"module": "dist/index.esm.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "rollup -c",
|
|
12
|
+
"test": "jest",
|
|
13
|
+
"test:watch": "jest --watch",
|
|
14
|
+
"storybook": "storybook dev -p 6006",
|
|
15
|
+
"build-storybook": "storybook build"
|
|
16
|
+
},
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"@emotion/react": ">=11.11.0",
|
|
19
|
+
"@emotion/styled": ">=11.10.0",
|
|
20
|
+
"@iconify/react": ">=4.1.0",
|
|
21
|
+
"@mui/icons-material": ">=5.14.0",
|
|
22
|
+
"@mui/lab": ">=5.0.0-alpha.137",
|
|
23
|
+
"@mui/material": ">=5.14.0",
|
|
24
|
+
"@mui/x-date-pickers": ">=6.10.0",
|
|
25
|
+
"@tanstack/react-query": ">=4.29.0",
|
|
26
|
+
"dayjs": ">=1.10.0",
|
|
27
|
+
"fhirclient": ">=2.5.0",
|
|
28
|
+
"fhirpath": ">=3.6.0",
|
|
29
|
+
"html-react-parser": ">=4.0.0",
|
|
30
|
+
"lodash.clonedeep": ">=4.0.0",
|
|
31
|
+
"lodash.debounce": ">=4.0.8",
|
|
32
|
+
"nanoid": ">=4.0.0",
|
|
33
|
+
"react-markdown": ">=8.0.0",
|
|
34
|
+
"zustand": ">=4.4.0",
|
|
35
|
+
"react": ">=17.0.0",
|
|
36
|
+
"react-dom": ">=17.0.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/fhir": "^0.0.37",
|
|
40
|
+
"@babel/core": "^7.15.0",
|
|
41
|
+
"@rollup/plugin-commonjs": "^17.1.0",
|
|
42
|
+
"@rollup/plugin-json": "^4.1.0",
|
|
43
|
+
"@rollup/plugin-node-resolve": "^11.2.1",
|
|
44
|
+
"@storybook/addon-essentials": "^7.4.0",
|
|
45
|
+
"@storybook/addon-interactions": "^7.4.0",
|
|
46
|
+
"@storybook/addon-links": "^7.4.0",
|
|
47
|
+
"@storybook/addon-onboarding": "^1.0.8",
|
|
48
|
+
"@storybook/addon-styling": "^1.3.7",
|
|
49
|
+
"@storybook/blocks": "^7.4.0",
|
|
50
|
+
"@storybook/react": "^7.4.0",
|
|
51
|
+
"@storybook/react-vite": "^7.4.0",
|
|
52
|
+
"@storybook/testing-library": "^0.2.0",
|
|
53
|
+
"@testing-library/jest-dom": "^5.14.1",
|
|
54
|
+
"@testing-library/react": "^11.2.7",
|
|
55
|
+
"@testing-library/react-hooks": "^7.0.2",
|
|
56
|
+
"@types/jest": "^29.5.4",
|
|
57
|
+
"@types/react": "^18.2.18",
|
|
58
|
+
"@types/react-dom": "^18.2.7",
|
|
59
|
+
"jest": "^29.6.4",
|
|
60
|
+
"jest-environment-jsdom": "^29.6.4",
|
|
61
|
+
"react": "^18.2.0",
|
|
62
|
+
"react-dom": "^18.2.0",
|
|
63
|
+
"rollup": "^2.56.3",
|
|
64
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
65
|
+
"rollup-plugin-typescript2": "^0.29.0",
|
|
66
|
+
"storybook": "^7.4.0",
|
|
67
|
+
"ts-jest": "^29.1.1",
|
|
68
|
+
"tslib": "^2.6.2",
|
|
69
|
+
"typescript": "^5.2.2"
|
|
70
|
+
}
|
|
71
|
+
}
|