@aehrc/smart-forms-renderer 0.8.0 → 0.9.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/lib/components/Alert.styles.d.ts +2 -7
- package/lib/components/Box.styles.d.ts +6 -21
- package/lib/components/FormComponents/BooleanItem/BooleanItem.d.ts +3 -3
- package/lib/components/FormComponents/BooleanItem/BooleanItem.js +5 -4
- package/lib/components/FormComponents/BooleanItem/BooleanItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.d.ts +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.js +6 -5
- package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.d.ts +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js +15 -14
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.d.ts +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js +15 -14
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.d.ts +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.js +8 -8
- package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.d.ts +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js +6 -6
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.d.ts +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js +6 -5
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.d.ts +1 -0
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js +2 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.d.ts +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js +8 -7
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.d.ts +1 -0
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.js +2 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.d.ts +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.js +8 -7
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/CustomDateItem/CustomDateField2.d.ts +18 -0
- package/lib/components/FormComponents/CustomDateItem/CustomDateField2.js +31 -0
- package/lib/components/FormComponents/CustomDateItem/CustomDateField2.js.map +1 -0
- package/lib/components/FormComponents/CustomDateItem/CustomDateItem.d.ts +9 -0
- package/lib/components/FormComponents/CustomDateItem/CustomDateItem.js +68 -0
- package/lib/components/FormComponents/CustomDateItem/CustomDateItem.js.map +1 -0
- package/lib/components/FormComponents/CustomDateItem/CustomDateTimeField.d.ts +9 -0
- package/lib/components/FormComponents/CustomDateItem/CustomDateTimeField.js +75 -0
- package/lib/components/FormComponents/CustomDateItem/CustomDateTimeField.js.map +1 -0
- package/lib/components/FormComponents/CustomDateItem/CustomDateTimePickerText2.d.ts +9 -0
- package/lib/components/FormComponents/CustomDateItem/CustomDateTimePickerText2.js +75 -0
- package/lib/components/FormComponents/CustomDateItem/CustomDateTimePickerText2.js.map +1 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/CustomDateField.d.ts +18 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/CustomDateField.js +33 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/CustomDateField.js.map +1 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/DatePicker.d.ts +11 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/DatePicker.js +55 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/DatePicker.js.map +1 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/DatePickerButton.d.ts +9 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/DatePickerButton.js +13 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/DatePickerButton.js.map +1 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/MuiDatePicker.d.ts +5 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/MuiDatePicker.js +20 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/MuiDatePicker.js.map +1 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/hooks/useParseDates.d.ts +5 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/hooks/useParseDates.js +27 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/hooks/useParseDates.js.map +1 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/index.d.ts +1 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/index.js +18 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/index.js.map +1 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/utils/index.d.ts +1 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/utils/index.js +18 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/utils/index.js.map +1 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/utils/parseDates.d.ts +9 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/utils/parseDates.js +121 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/utils/parseDates.js.map +1 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePickerText.d.ts +9 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePickerText.js +71 -0
- package/lib/components/FormComponents/CustomDateItem/customDateTimePickerText.js.map +1 -0
- package/lib/components/FormComponents/CustomDateItem/index.d.ts +1 -0
- package/lib/components/FormComponents/CustomDateItem/index.js +18 -0
- package/lib/components/FormComponents/CustomDateItem/index.js.map +1 -0
- package/lib/components/FormComponents/DateItem/DateItem.d.ts +3 -3
- package/lib/components/FormComponents/DateItem/DateItem.js +5 -4
- package/lib/components/FormComponents/DateItem/DateItem.js.map +1 -1
- package/lib/components/FormComponents/DateItem/DatePicker.d.ts +2 -0
- package/lib/components/FormComponents/DateItem/DatePicker.js +42 -0
- package/lib/components/FormComponents/DateItem/DatePicker.js.map +1 -0
- package/lib/components/FormComponents/DateItem/DatePickerField.d.ts +8 -0
- package/lib/components/FormComponents/DateItem/DatePickerField.js +24 -0
- package/lib/components/FormComponents/DateItem/DatePickerField.js.map +1 -0
- package/lib/components/FormComponents/DateTimeItem/DateTimeItem.d.ts +3 -3
- package/lib/components/FormComponents/DateTimeItem/DateTimeItem.js +5 -4
- package/lib/components/FormComponents/DateTimeItem/DateTimeItem.js.map +1 -1
- package/lib/components/FormComponents/DecimalItem/DecimalItem.d.ts +3 -3
- package/lib/components/FormComponents/DecimalItem/DecimalItem.js +7 -7
- package/lib/components/FormComponents/DecimalItem/DecimalItem.js.map +1 -1
- package/lib/components/FormComponents/DisplayItem/DisplayBox.d.ts +0 -0
- package/lib/components/FormComponents/DisplayItem/DisplayBox.js +2 -0
- package/lib/components/FormComponents/DisplayItem/DisplayBox.js.map +1 -0
- package/lib/components/FormComponents/DisplayItem/DisplayBox.styles.d.ts +4 -0
- package/lib/components/FormComponents/DisplayItem/DisplayBox.styles.js +35 -0
- package/lib/components/FormComponents/DisplayItem/DisplayBox.styles.js.map +1 -0
- package/lib/components/FormComponents/DisplayItem/DisplayInstructions.d.ts +3 -1
- package/lib/components/FormComponents/DisplayItem/DisplayInstructions.js +2 -2
- package/lib/components/FormComponents/DisplayItem/DisplayInstructions.js.map +1 -1
- package/lib/components/FormComponents/DisplayItem/DisplayInstructions.styles.d.ts +2 -7
- package/lib/components/FormComponents/DisplayItem/DisplayInstructions.styles.js +0 -1
- package/lib/components/FormComponents/DisplayItem/DisplayInstructions.styles.js.map +1 -1
- package/lib/components/FormComponents/DisplayItem/DisplayItem.js +2 -2
- package/lib/components/FormComponents/DisplayItem/DisplayItem.js.map +1 -1
- package/lib/components/FormComponents/GridGroup/GridGroup.d.ts +3 -3
- package/lib/components/FormComponents/GridGroup/GridGroup.js +16 -9
- package/lib/components/FormComponents/GridGroup/GridGroup.js.map +1 -1
- package/lib/components/FormComponents/GridGroup/GridRow.d.ts +3 -3
- package/lib/components/FormComponents/GridGroup/GridRow.js +4 -4
- package/lib/components/FormComponents/GridGroup/GridRow.js.map +1 -1
- package/lib/components/FormComponents/GridGroup/GridTable.d.ts +3 -2
- package/lib/components/FormComponents/GridGroup/GridTable.js +9 -4
- package/lib/components/FormComponents/GridGroup/GridTable.js.map +1 -1
- package/lib/components/FormComponents/GridGroup/index.d.ts +1 -0
- package/lib/components/FormComponents/GridGroup/index.js +18 -0
- package/lib/components/FormComponents/GridGroup/index.js.map +1 -0
- package/lib/components/FormComponents/GroupItem/GroupHeading.d.ts +1 -0
- package/lib/components/FormComponents/GroupItem/GroupHeading.js +6 -5
- package/lib/components/FormComponents/GroupItem/GroupHeading.js.map +1 -1
- package/lib/components/FormComponents/GroupItem/GroupItem.d.ts +3 -4
- package/lib/components/FormComponents/GroupItem/GroupItem.js +7 -5
- package/lib/components/FormComponents/GroupItem/GroupItem.js.map +1 -1
- package/lib/components/FormComponents/GroupItem/GroupItem.styles.d.ts +2 -6
- package/lib/components/FormComponents/GroupItem/GroupItemSwitcher.d.ts +3 -3
- package/lib/components/FormComponents/GroupItem/GroupItemSwitcher.js +11 -12
- package/lib/components/FormComponents/GroupItem/GroupItemSwitcher.js.map +1 -1
- package/lib/components/FormComponents/IntegerItem/IntegerItem.d.ts +3 -3
- package/lib/components/FormComponents/IntegerItem/IntegerItem.js +7 -7
- package/lib/components/FormComponents/IntegerItem/IntegerItem.js.map +1 -1
- package/lib/components/FormComponents/IntegerItem/SliderItem.d.ts +9 -0
- package/lib/components/FormComponents/IntegerItem/SliderItem.js +75 -0
- package/lib/components/FormComponents/IntegerItem/SliderItem.js.map +1 -0
- package/lib/components/FormComponents/Item.styles.d.ts +0 -4
- package/lib/components/FormComponents/Item.styles.js +0 -4
- package/lib/components/FormComponents/Item.styles.js.map +1 -1
- package/lib/components/FormComponents/ItemParts/FadingCheckIcon.js +2 -2
- package/lib/components/FormComponents/ItemParts/FadingCheckIcon.js.map +1 -1
- package/lib/components/FormComponents/ItemParts/ItemFieldGrid.d.ts +3 -2
- package/lib/components/FormComponents/ItemParts/ItemFieldGrid.js +3 -3
- package/lib/components/FormComponents/ItemParts/ItemFieldGrid.js.map +1 -1
- package/lib/components/FormComponents/ItemParts/ItemLabelText.d.ts +1 -0
- package/lib/components/FormComponents/ItemParts/ItemLabelText.js +4 -6
- package/lib/components/FormComponents/ItemParts/ItemLabelText.js.map +1 -1
- package/lib/components/FormComponents/ItemParts/ItemLabelWrapper.d.ts +1 -0
- package/lib/components/FormComponents/ItemParts/ItemLabelWrapper.js +2 -2
- package/lib/components/FormComponents/ItemParts/ItemLabelWrapper.js.map +1 -1
- package/lib/components/FormComponents/Lists.styles.d.ts +2 -9
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.d.ts +3 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.js +2 -3
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.d.ts +3 -3
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.js +8 -7
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.d.ts +3 -3
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js +16 -15
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.d.ts +3 -3
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.js +6 -6
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.d.ts +3 -3
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js +7 -6
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.d.ts +3 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.js +2 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.d.ts +3 -3
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.js +7 -6
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.d.ts +3 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.js +2 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.d.ts +3 -3
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.js +8 -7
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/RepeatGroup/AddItemButton.d.ts +1 -0
- package/lib/components/FormComponents/RepeatGroup/AddItemButton.js +2 -2
- package/lib/components/FormComponents/RepeatGroup/AddItemButton.js.map +1 -1
- package/lib/components/FormComponents/RepeatGroup/DeleteItemButton.d.ts +1 -0
- package/lib/components/FormComponents/RepeatGroup/DeleteItemButton.js +2 -2
- package/lib/components/FormComponents/RepeatGroup/DeleteItemButton.js.map +1 -1
- package/lib/components/FormComponents/RepeatGroup/RepeatGroup.d.ts +2 -2
- package/lib/components/FormComponents/RepeatGroup/RepeatGroup.js +20 -7
- package/lib/components/FormComponents/RepeatGroup/RepeatGroup.js.map +1 -1
- package/lib/components/FormComponents/RepeatGroup/RepeatGroupItem.d.ts +2 -2
- package/lib/components/FormComponents/RepeatGroup/RepeatGroupItem.js +5 -3
- package/lib/components/FormComponents/RepeatGroup/RepeatGroupItem.js.map +1 -1
- package/lib/components/FormComponents/RepeatItem/AddItemButton.d.ts +1 -0
- package/lib/components/FormComponents/RepeatItem/AddItemButton.js +2 -2
- package/lib/components/FormComponents/RepeatItem/AddItemButton.js.map +1 -1
- package/lib/components/FormComponents/RepeatItem/DeleteItemButton.d.ts +1 -0
- package/lib/components/FormComponents/RepeatItem/DeleteItemButton.js +2 -2
- package/lib/components/FormComponents/RepeatItem/DeleteItemButton.js.map +1 -1
- package/lib/components/FormComponents/RepeatItem/RepeatField.d.ts +3 -3
- package/lib/components/FormComponents/RepeatItem/RepeatField.js +5 -3
- package/lib/components/FormComponents/RepeatItem/RepeatField.js.map +1 -1
- package/lib/components/FormComponents/RepeatItem/RepeatItem.d.ts +4 -3
- package/lib/components/FormComponents/RepeatItem/RepeatItem.js +15 -5
- package/lib/components/FormComponents/RepeatItem/RepeatItem.js.map +1 -1
- package/lib/components/FormComponents/RepeatItem/RepeatItem.styles.d.ts +4 -18
- package/lib/components/FormComponents/RepeatItem/index.d.ts +1 -0
- package/lib/components/FormComponents/RepeatItem/index.js +18 -0
- package/lib/components/FormComponents/RepeatItem/index.js.map +1 -0
- package/lib/components/FormComponents/SingleItem/SingleItem.d.ts +3 -3
- package/lib/components/FormComponents/SingleItem/SingleItem.js +4 -2
- package/lib/components/FormComponents/SingleItem/SingleItem.js.map +1 -1
- package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.d.ts +3 -3
- package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.js +20 -15
- package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.js.map +1 -1
- package/lib/components/FormComponents/SliderItem/DisplayBox.styles.d.ts +4 -0
- package/lib/components/FormComponents/SliderItem/DisplayBox.styles.js +35 -0
- package/lib/components/FormComponents/SliderItem/DisplayBox.styles.js.map +1 -0
- package/lib/components/FormComponents/SliderItem/Slider.styles.d.ts +6 -0
- package/lib/components/FormComponents/SliderItem/Slider.styles.js +33 -0
- package/lib/components/FormComponents/SliderItem/Slider.styles.js.map +1 -0
- package/lib/components/FormComponents/SliderItem/SliderDisplayValue.d.ts +8 -0
- package/lib/components/FormComponents/SliderItem/SliderDisplayValue.js +28 -0
- package/lib/components/FormComponents/SliderItem/SliderDisplayValue.js.map +1 -0
- package/lib/components/FormComponents/SliderItem/SliderField.d.ts +16 -0
- package/lib/components/FormComponents/SliderItem/SliderField.js +41 -0
- package/lib/components/FormComponents/SliderItem/SliderField.js.map +1 -0
- package/lib/components/FormComponents/SliderItem/SliderItem.d.ts +9 -0
- package/lib/components/FormComponents/SliderItem/SliderItem.js +56 -0
- package/lib/components/FormComponents/SliderItem/SliderItem.js.map +1 -0
- package/lib/components/FormComponents/SliderItem/SliderLabels.d.ts +7 -0
- package/lib/components/FormComponents/SliderItem/SliderLabels.js +32 -0
- package/lib/components/FormComponents/SliderItem/SliderLabels.js.map +1 -0
- package/lib/components/FormComponents/StringItem/StringItem.d.ts +3 -3
- package/lib/components/FormComponents/StringItem/StringItem.js +5 -4
- package/lib/components/FormComponents/StringItem/StringItem.js.map +1 -1
- package/lib/components/FormComponents/Tables/AddRowButton.d.ts +1 -0
- package/lib/components/FormComponents/Tables/AddRowButton.js +2 -2
- package/lib/components/FormComponents/Tables/AddRowButton.js.map +1 -1
- package/lib/components/FormComponents/Tables/DeleteRowButton.d.ts +1 -0
- package/lib/components/FormComponents/Tables/DeleteRowButton.js +2 -2
- package/lib/components/FormComponents/Tables/DeleteRowButton.js.map +1 -1
- package/lib/components/FormComponents/Tables/GroupTable.d.ts +4 -3
- package/lib/components/FormComponents/Tables/GroupTable.js +25 -6
- package/lib/components/FormComponents/Tables/GroupTable.js.map +1 -1
- package/lib/components/FormComponents/Tables/GroupTableRow.d.ts +3 -3
- package/lib/components/FormComponents/Tables/GroupTableRow.js +4 -4
- package/lib/components/FormComponents/Tables/GroupTableRow.js.map +1 -1
- package/lib/components/FormComponents/Tables/QItemGroupTable.js +5 -7
- package/lib/components/FormComponents/Tables/QItemGroupTable.js.map +1 -1
- package/lib/components/FormComponents/Tables/QItemGroupTableRow.js +2 -2
- package/lib/components/FormComponents/Tables/QItemGroupTableRow.js.map +1 -1
- package/lib/components/FormComponents/TextItem/TextItem.d.ts +3 -3
- package/lib/components/FormComponents/TextItem/TextItem.js +5 -4
- package/lib/components/FormComponents/TextItem/TextItem.js.map +1 -1
- package/lib/components/FormComponents/TimeItem/TimeItem.d.ts +3 -3
- package/lib/components/FormComponents/TimeItem/TimeItem.js +5 -4
- package/lib/components/FormComponents/TimeItem/TimeItem.js.map +1 -1
- package/lib/components/FormComponents/UrlItem/UrlItem.d.ts +3 -3
- package/lib/components/FormComponents/UrlItem/UrlItem.js +5 -4
- package/lib/components/FormComponents/UrlItem/UrlItem.js.map +1 -1
- package/lib/components/FormComponents/index.d.ts +3 -0
- package/lib/components/FormComponents/index.js +3 -0
- package/lib/components/FormComponents/index.js.map +1 -1
- package/lib/components/Lists.styles.d.ts +2 -9
- package/lib/components/Renderer/BaseRenderer.js +3 -5
- package/lib/components/Renderer/BaseRenderer.js.map +1 -1
- package/lib/components/Renderer/FormBodyCollapsible.d.ts +2 -2
- package/lib/components/Renderer/FormBodyCollapsible.js +6 -5
- package/lib/components/Renderer/FormBodyCollapsible.js.map +1 -1
- package/lib/components/Renderer/FormBodySingleCollapsibleWrapper.d.ts +2 -2
- package/lib/components/Renderer/FormBodySingleCollapsibleWrapper.js.map +1 -1
- package/lib/components/Renderer/FormBodyTabbed.d.ts +2 -2
- package/lib/components/Renderer/FormBodyTabbed.js +6 -5
- package/lib/components/Renderer/FormBodyTabbed.js.map +1 -1
- package/lib/components/Renderer/FormTopLevelItem.d.ts +2 -2
- package/lib/components/Renderer/FormTopLevelItem.js +9 -5
- package/lib/components/Renderer/FormTopLevelItem.js.map +1 -1
- package/lib/components/Tabs/FormBodySingleTab.js +1 -1
- package/lib/components/Tabs/FormBodySingleTab.js.map +1 -1
- package/lib/components/Tabs/ShowCompletedTabsSection.js +1 -1
- package/lib/components/Tabs/ShowCompletedTabsSection.js.map +1 -1
- package/lib/hooks/useDateSeparatorValidation.d.ts +2 -0
- package/lib/hooks/useDateSeparatorValidation.js +25 -0
- package/lib/hooks/useDateSeparatorValidation.js.map +1 -0
- package/lib/hooks/useDateValidation.d.ts +2 -0
- package/lib/hooks/useDateValidation.js +61 -0
- package/lib/hooks/useDateValidation.js.map +1 -0
- package/lib/hooks/useDecimalCalculatedExpression.d.ts +0 -1
- package/lib/hooks/useDecimalCalculatedExpression.js +3 -3
- package/lib/hooks/useDecimalCalculatedExpression.js.map +1 -1
- package/lib/hooks/useInitialiseRepeatAnswers.d.ts +1 -1
- package/lib/hooks/useInitialiseRepeatAnswers.js.map +1 -1
- package/lib/hooks/useIntegerCalculatedExpression.d.ts +0 -1
- package/lib/hooks/useIntegerCalculatedExpression.js +3 -3
- package/lib/hooks/useIntegerCalculatedExpression.js.map +1 -1
- package/lib/hooks/useMinimalStringCalculatedExpression.d.ts +11 -0
- package/lib/hooks/useMinimalStringCalculatedExpression.js +37 -0
- package/lib/hooks/useMinimalStringCalculatedExpression.js.map +1 -0
- package/lib/hooks/useReadOnly.d.ts +3 -0
- package/lib/hooks/useReadOnly.js +26 -0
- package/lib/hooks/useReadOnly.js.map +1 -0
- package/lib/hooks/useSliderExtensions.d.ts +10 -0
- package/lib/hooks/useSliderExtensions.js +37 -0
- package/lib/hooks/useSliderExtensions.js.map +1 -0
- package/lib/hooks/useTerminologyServerQuery.js +0 -1
- package/lib/hooks/useTerminologyServerQuery.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +15 -6
- package/lib/index.js.map +1 -1
- package/lib/interfaces/calculatedExpression.interface.d.ts +1 -1
- package/lib/interfaces/index.d.ts +2 -0
- package/lib/interfaces/index.js +18 -0
- package/lib/interfaces/index.js.map +1 -0
- package/lib/interfaces/questionnaireStore.interface.d.ts +1 -0
- package/lib/interfaces/renderProps.interface.d.ts +7 -3
- package/lib/stores/useQuestionnaireStore.d.ts +1 -0
- package/lib/stores/useQuestionnaireStore.js +28 -12
- package/lib/stores/useQuestionnaireStore.js.map +1 -1
- package/lib/test.d.ts +4 -0
- package/lib/test.js +18 -0
- package/lib/test.js.map +1 -0
- package/lib/theme/customGlobalStyles.js +0 -4
- package/lib/theme/customGlobalStyles.js.map +1 -1
- package/lib/theme/overrides/Typography.d.ts +13 -0
- package/lib/theme/overrides/Typography.js +31 -0
- package/lib/theme/overrides/Typography.js.map +1 -0
- package/lib/theme/typography.d.ts +0 -2
- package/lib/theme/typography.js +3 -5
- package/lib/theme/typography.js.map +1 -1
- package/lib/utils/calculatedExpression.d.ts +17 -1
- package/lib/utils/calculatedExpression.js +71 -20
- package/lib/utils/calculatedExpression.js.map +1 -1
- package/lib/utils/dayjsExtend.d.ts +1 -0
- package/lib/utils/dayjsExtend.js +22 -0
- package/lib/utils/dayjsExtend.js.map +1 -0
- package/lib/utils/enableWhenExpression.d.ts +5 -1
- package/lib/utils/enableWhenExpression.js +26 -21
- package/lib/utils/enableWhenExpression.js.map +1 -1
- package/lib/utils/fhirpath.d.ts +3 -1
- package/lib/utils/fhirpath.js +25 -15
- package/lib/utils/fhirpath.js.map +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +1 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/initialiseForm.d.ts +2 -0
- package/lib/utils/initialiseForm.js +13 -5
- package/lib/utils/initialiseForm.js.map +1 -1
- package/lib/utils/itemControl.d.ts +12 -0
- package/lib/utils/itemControl.js +30 -0
- package/lib/utils/itemControl.js.map +1 -1
- package/lib/utils/launchContext.d.ts +0 -0
- package/lib/utils/launchContext.js +2 -0
- package/lib/utils/launchContext.js.map +1 -0
- package/lib/utils/mapItem.d.ts +1 -1
- package/lib/utils/qrItem.d.ts +1 -7
- package/lib/utils/qrItem.js +1 -12
- package/lib/utils/qrItem.js.map +1 -1
- package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js +4 -2
- package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js.map +1 -1
- package/lib/utils/removeHidden.js +2 -1
- package/lib/utils/removeHidden.js.map +1 -1
- package/lib/utils/repopulateIntoResponse.js +90 -29
- package/lib/utils/repopulateIntoResponse.js.map +1 -1
- package/lib/utils/repopulateItems.d.ts +14 -1
- package/lib/utils/repopulateItems.js +251 -70
- package/lib/utils/repopulateItems.js.map +1 -1
- package/lib/utils/repopulateRepeatGroup.js +9 -1
- package/lib/utils/repopulateRepeatGroup.js.map +1 -1
- package/lib/utils/slider.d.ts +28 -0
- package/lib/utils/slider.js +89 -0
- package/lib/utils/slider.js.map +1 -0
- package/package.json +20 -18
- package/src/components/FormComponents/BooleanItem/BooleanItem.tsx +10 -7
- package/src/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.tsx +11 -8
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.tsx +46 -35
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.tsx +48 -37
- package/src/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.tsx +21 -11
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.tsx +11 -10
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.tsx +12 -9
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.tsx +3 -2
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.tsx +16 -11
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.tsx +3 -2
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.tsx +14 -9
- package/src/components/FormComponents/CustomDateItem/CustomDateItem.tsx +140 -0
- package/src/components/FormComponents/CustomDateItem/customDateTimePicker/CustomDateField.tsx +96 -0
- package/src/components/FormComponents/CustomDateItem/customDateTimePicker/DatePicker.tsx +81 -0
- package/src/components/FormComponents/CustomDateItem/customDateTimePicker/DatePickerButton.tsx +33 -0
- package/src/components/FormComponents/{Typography.styles.ts → CustomDateItem/customDateTimePicker/MuiDatePicker.ts} +4 -7
- package/src/components/FormComponents/CustomDateItem/customDateTimePicker/index.ts +18 -0
- package/src/components/FormComponents/CustomDateItem/customDateTimePicker/utils/index.ts +18 -0
- package/src/components/FormComponents/CustomDateItem/customDateTimePicker/utils/parseDates.ts +154 -0
- package/src/components/FormComponents/CustomDateItem/index.ts +18 -0
- package/src/components/FormComponents/DateItem/DateItem.tsx +10 -8
- package/src/components/FormComponents/DateTimeItem/DateTimeItem.tsx +10 -8
- package/src/components/FormComponents/DecimalItem/DecimalItem.tsx +11 -10
- package/src/components/FormComponents/DisplayItem/DisplayInstructions.styles.ts +0 -1
- package/src/components/FormComponents/DisplayItem/DisplayInstructions.tsx +8 -3
- package/src/components/FormComponents/DisplayItem/DisplayItem.tsx +2 -2
- package/src/components/FormComponents/GridGroup/GridGroup.tsx +49 -15
- package/src/components/FormComponents/GridGroup/GridRow.tsx +12 -7
- package/src/components/FormComponents/GridGroup/GridTable.tsx +32 -8
- package/src/components/FormComponents/GridGroup/index.ts +18 -0
- package/src/components/FormComponents/GroupItem/GroupHeading.tsx +12 -6
- package/src/components/FormComponents/GroupItem/GroupItem.tsx +13 -8
- package/src/components/FormComponents/GroupItem/GroupItemSwitcher.tsx +33 -11
- package/src/components/FormComponents/IntegerItem/IntegerItem.tsx +11 -10
- package/src/components/FormComponents/Item.styles.ts +0 -5
- package/src/components/FormComponents/ItemParts/FadingCheckIcon.tsx +2 -2
- package/src/components/FormComponents/ItemParts/ItemFieldGrid.tsx +6 -5
- package/src/components/FormComponents/ItemParts/ItemLabelText.tsx +10 -5
- package/src/components/FormComponents/ItemParts/ItemLabelWrapper.tsx +3 -2
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.tsx +10 -4
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.tsx +15 -9
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.tsx +58 -47
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.tsx +15 -6
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.tsx +13 -10
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.tsx +10 -4
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.tsx +12 -7
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.tsx +10 -4
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.tsx +14 -9
- package/src/components/FormComponents/RepeatGroup/AddItemButton.tsx +3 -2
- package/src/components/FormComponents/RepeatGroup/DeleteItemButton.tsx +3 -2
- package/src/components/FormComponents/RepeatGroup/RepeatGroup.tsx +61 -10
- package/src/components/FormComponents/RepeatGroup/RepeatGroupItem.tsx +23 -7
- package/src/components/FormComponents/RepeatItem/AddItemButton.tsx +3 -2
- package/src/components/FormComponents/RepeatItem/DeleteItemButton.tsx +3 -2
- package/src/components/FormComponents/RepeatItem/RepeatField.tsx +33 -9
- package/src/components/FormComponents/RepeatItem/RepeatItem.tsx +44 -7
- package/src/components/FormComponents/RepeatItem/index.ts +18 -0
- package/src/components/FormComponents/SingleItem/SingleItem.tsx +12 -6
- package/src/components/FormComponents/SingleItem/SingleItemSwitcher.tsx +41 -11
- package/src/components/FormComponents/SliderItem/Slider.styles.ts +34 -0
- package/src/components/FormComponents/SliderItem/SliderDisplayValue.tsx +43 -0
- package/src/components/FormComponents/SliderItem/SliderField.tsx +88 -0
- package/src/components/FormComponents/SliderItem/SliderItem.tsx +115 -0
- package/src/components/FormComponents/SliderItem/SliderLabels.tsx +53 -0
- package/src/components/FormComponents/StringItem/StringItem.tsx +9 -7
- package/src/components/FormComponents/Tables/AddRowButton.tsx +3 -2
- package/src/components/FormComponents/Tables/DeleteRowButton.tsx +3 -2
- package/src/components/FormComponents/Tables/GroupTable.tsx +70 -7
- package/src/components/FormComponents/Tables/GroupTableRow.tsx +12 -7
- package/src/components/FormComponents/TextItem/TextItem.tsx +9 -7
- package/src/components/FormComponents/TimeItem/TimeItem.tsx +10 -8
- package/src/components/FormComponents/UrlItem/UrlItem.tsx +9 -7
- package/src/components/FormComponents/index.ts +3 -0
- package/src/components/Renderer/BaseRenderer.tsx +5 -12
- package/src/components/Renderer/FormBodyCollapsible.tsx +9 -7
- package/src/components/Renderer/FormBodySingleCollapsibleWrapper.tsx +2 -3
- package/src/components/Renderer/FormBodyTabbed.tsx +9 -7
- package/src/components/Renderer/FormTopLevelItem.tsx +21 -13
- package/src/components/Tabs/FormBodySingleTab.tsx +1 -1
- package/src/components/Tabs/ShowCompletedTabsSection.tsx +1 -1
- package/src/hooks/useDateValidation.tsx +79 -0
- package/src/hooks/useDecimalCalculatedExpression.ts +3 -4
- package/src/hooks/useInitialiseRepeatAnswers.ts +1 -1
- package/src/hooks/useIntegerCalculatedExpression.ts +3 -4
- package/src/hooks/useReadOnly.ts +30 -0
- package/src/hooks/useSliderExtensions.ts +50 -0
- package/src/hooks/useTerminologyServerQuery.ts +0 -2
- package/src/index.ts +12 -9
- package/src/interfaces/calculatedExpression.interface.ts +1 -1
- package/src/interfaces/questionnaireStore.interface.ts +1 -0
- package/src/interfaces/renderProps.interface.ts +8 -3
- package/src/stores/useQuestionnaireStore.ts +39 -16
- package/src/theme/customGlobalStyles.tsx +0 -4
- package/src/theme/typography.ts +3 -5
- package/src/utils/calculatedExpression.ts +104 -35
- package/src/utils/dayjsExtend.ts +23 -0
- package/src/utils/enableWhenExpression.ts +49 -34
- package/src/utils/fhirpath.ts +50 -31
- package/src/utils/index.ts +1 -0
- package/src/utils/initialiseForm.ts +15 -5
- package/src/utils/itemControl.ts +32 -0
- package/src/utils/mapItem.ts +1 -1
- package/src/utils/qrItem.ts +1 -16
- package/src/utils/questionnaireStoreUtils/createQuestionaireModel.ts +4 -2
- package/src/utils/removeHidden.ts +2 -1
- package/src/utils/repopulateIntoResponse.ts +134 -43
- package/src/utils/repopulateItems.ts +379 -101
- package/src/utils/slider.ts +112 -0
- package/src/utils/repopulateRepeatGroup.ts +0 -68
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Dayjs } from 'dayjs';
|
|
3
|
+
interface DatePickerProps {
|
|
4
|
+
valueString: string;
|
|
5
|
+
readOnly: boolean;
|
|
6
|
+
anchorEl: HTMLElement | null;
|
|
7
|
+
onSelectDate: (newValueDayjs: Dayjs) => void;
|
|
8
|
+
onFocus: (focus: boolean) => void;
|
|
9
|
+
}
|
|
10
|
+
declare function DatePicker(props: DatePickerProps): React.JSX.Element;
|
|
11
|
+
export default DatePicker;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import React, { useState } from 'react';
|
|
18
|
+
import dayjs from 'dayjs';
|
|
19
|
+
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
|
20
|
+
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
21
|
+
import MuiDatePicker from './MuiDatePicker';
|
|
22
|
+
// import { DatePicker as MuiDatePicker, LocalizationProvider } from '@mui/x-date-pickers';
|
|
23
|
+
import DatePickerButton from './DatePickerButton';
|
|
24
|
+
function DatePicker(props) {
|
|
25
|
+
const { valueString, readOnly, anchorEl, onSelectDate, onFocus } = props;
|
|
26
|
+
const [open, setOpen] = useState(false);
|
|
27
|
+
const valueDayJs = valueString ? dayjs(valueString, 'DD/MM/YYYY') : null;
|
|
28
|
+
return (React.createElement(LocalizationProvider, { dateAdapter: AdapterDayjs },
|
|
29
|
+
React.createElement(MuiDatePicker, { value: valueDayJs !== null && valueDayJs !== void 0 ? valueDayJs : null, disabled: readOnly, slots: { field: DatePickerButton }, slotProps: {
|
|
30
|
+
field: {
|
|
31
|
+
onOpen: () => {
|
|
32
|
+
setOpen(!open);
|
|
33
|
+
onFocus(true);
|
|
34
|
+
},
|
|
35
|
+
readOnly: readOnly
|
|
36
|
+
},
|
|
37
|
+
textField: {
|
|
38
|
+
size: 'small'
|
|
39
|
+
},
|
|
40
|
+
popper: {
|
|
41
|
+
anchorEl: () => anchorEl
|
|
42
|
+
}
|
|
43
|
+
}, open: open, onClose: () => {
|
|
44
|
+
setOpen(false);
|
|
45
|
+
onFocus(false);
|
|
46
|
+
}, onChange: (newValue) => {
|
|
47
|
+
if (!newValue) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
onSelectDate(newValue);
|
|
51
|
+
onFocus(false);
|
|
52
|
+
} })));
|
|
53
|
+
}
|
|
54
|
+
export default DatePicker;
|
|
55
|
+
//# sourceMappingURL=DatePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../../../src/components/FormComponents/CustomDateItem/customDateTimePicker/DatePicker.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,2FAA2F;AAC3F,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAUlD,SAAS,UAAU,CAAC,KAAsB;IACxC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAEzE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAExC,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAEzE,OAAO,CACL,oBAAC,oBAAoB,IAAC,WAAW,EAAE,YAAY;QAC7C,oBAAC,aAAa,IACZ,KAAK,EAAE,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,IAAI,EACzB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAClC,SAAS,EAAE;gBACT,KAAK,EAAE;oBACL,MAAM,EAAE,GAAG,EAAE;wBACX,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;wBACf,OAAO,CAAC,IAAI,CAAC,CAAC;oBAChB,CAAC;oBACD,QAAQ,EAAE,QAAQ;iBACZ;gBACR,SAAS,EAAE;oBACT,IAAI,EAAE,OAAO;iBACd;gBACD,MAAM,EAAE;oBACN,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAuB;iBACxC;aACF,EACD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,GAAG,EAAE;gBACZ,OAAO,CAAC,KAAK,CAAC,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,CAAC;YACjB,CAAC,EACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE;gBACrB,IAAI,CAAC,QAAQ,EAAE;oBACb,OAAO;iBACR;gBAED,YAAY,CAAC,QAAQ,CAAC,CAAC;gBACvB,OAAO,CAAC,KAAK,CAAC,CAAC;YACjB,CAAC,GACD,CACmB,CACxB,CAAC;AACJ,CAAC;AAED,eAAe,UAAU,CAAC"}
|
package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/DatePickerButton.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BaseSingleInputFieldProps, DateValidationError, FieldSection } from '@mui/x-date-pickers/models';
|
|
3
|
+
import type { Dayjs } from 'dayjs';
|
|
4
|
+
interface DatePickerButtonProps extends BaseSingleInputFieldProps<Dayjs | null, Dayjs, FieldSection, DateValidationError> {
|
|
5
|
+
onOpen?: () => void;
|
|
6
|
+
readOnly?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare function DatePickerButton(props: DatePickerButtonProps): React.JSX.Element;
|
|
9
|
+
export default DatePickerButton;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import IconButton from '@mui/material/IconButton';
|
|
3
|
+
import EventIcon from '@mui/icons-material/Event';
|
|
4
|
+
function DatePickerButton(props) {
|
|
5
|
+
const { onOpen, readOnly } = props;
|
|
6
|
+
return (React.createElement(IconButton, { sx: { height: 24, width: 24 }, disabled: readOnly, onClick: (e) => {
|
|
7
|
+
e.stopPropagation();
|
|
8
|
+
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
9
|
+
} },
|
|
10
|
+
React.createElement(EventIcon, { fontSize: "small" })));
|
|
11
|
+
}
|
|
12
|
+
export default DatePickerButton;
|
|
13
|
+
//# sourceMappingURL=DatePickerButton.js.map
|
package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/DatePickerButton.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePickerButton.js","sourceRoot":"","sources":["../../../../../src/components/FormComponents/CustomDateItem/customDateTimePicker/DatePickerButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAQlD,SAAS,gBAAgB,CAAC,KAA4B;IACpD,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEnC,OAAO,CACL,oBAAC,UAAU,IACT,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAC7B,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,MAAM,aAAN,MAAM,uBAAN,MAAM,EAAI,CAAC;QACb,CAAC;QACD,oBAAC,SAAS,IAAC,QAAQ,EAAC,OAAO,GAAG,CACnB,CACd,CAAC;AACJ,CAAC;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const MuiDatePicker: (<TDate>(props: import("@mui/x-date-pickers/DatePicker").DatePickerProps<TDate> & import("react").RefAttributes<HTMLDivElement>) => import("react").JSX.Element) & {
|
|
3
|
+
propTypes?: any;
|
|
4
|
+
};
|
|
5
|
+
export default MuiDatePicker;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
|
|
18
|
+
const MuiDatePicker = DatePicker;
|
|
19
|
+
export default MuiDatePicker;
|
|
20
|
+
//# sourceMappingURL=MuiDatePicker.js.map
|
package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/MuiDatePicker.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MuiDatePicker.js","sourceRoot":"","sources":["../../../../../src/components/FormComponents/CustomDateItem/customDateTimePicker/MuiDatePicker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D,MAAM,aAAa,GAAG,UAAU,CAAC;AAEjC,eAAe,aAAa,CAAC"}
|
package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/hooks/useParseDates.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { parseInputToDateOptions } from '../utils/parseDates';
|
|
18
|
+
function useParseDates(input) {
|
|
19
|
+
// No options displayed when input is empty or search term is less than 2 characters
|
|
20
|
+
if (input.length === 0 || (input.length < 2 && input.length > 0)) {
|
|
21
|
+
return { dateOptions: [], seperator: '' };
|
|
22
|
+
}
|
|
23
|
+
const { dateOptions, seperator } = parseInputToDateOptions(input);
|
|
24
|
+
return { dateOptions, seperator };
|
|
25
|
+
}
|
|
26
|
+
export default useParseDates;
|
|
27
|
+
//# sourceMappingURL=useParseDates.js.map
|
package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/hooks/useParseDates.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useParseDates.js","sourceRoot":"","sources":["../../../../../../src/components/FormComponents/CustomDateItem/customDateTimePicker/hooks/useParseDates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,SAAS,aAAa,CAAC,KAAa;IAIlC,oFAAoF;IACpF,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE;QAChE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;KAC3C;IAED,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAElE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;AACpC,CAAC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './utils';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export * from './utils';
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/FormComponents/CustomDateItem/customDateTimePicker/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { parseFhirDateToDisplayDate } from './parseDates';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export { parseFhirDateToDisplayDate } from './parseDates';
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/components/FormComponents/CustomDateItem/customDateTimePicker/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC"}
|
package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/utils/parseDates.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function validateInput(input: string): boolean;
|
|
2
|
+
export declare function validateTwoMatches(monthInput: string, yearInput: string): boolean;
|
|
3
|
+
export declare function validateThreeMatches(dayInput: string, monthInput: string, yearInput: string): boolean;
|
|
4
|
+
export declare function getNumOfSeparators(valueDate: string, seperator: string): number;
|
|
5
|
+
export declare function parseFhirDateToDisplayDate(fhirDate: string): {
|
|
6
|
+
displayDate: string;
|
|
7
|
+
parseFail?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function parseInputDateToFhirDate(displayDate: string): string;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import dayjs from 'dayjs';
|
|
18
|
+
const inputMatchRegex = /(\d{4}|\d{3}|\d{2})/g;
|
|
19
|
+
export function validateInput(input) {
|
|
20
|
+
const matches = input.match(inputMatchRegex);
|
|
21
|
+
if (!matches) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
const seperator = input.includes('/') ? '/' : null;
|
|
25
|
+
if (matches.length === 1) {
|
|
26
|
+
// seperator not supposed to be present if only one match present
|
|
27
|
+
if (seperator) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
return matches[0].length === 4;
|
|
31
|
+
}
|
|
32
|
+
// Invalid if seperator is not present
|
|
33
|
+
if (!seperator) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
// Invalid if num of slots don't match the number of regex matches
|
|
37
|
+
const slotsMatched = input.split(seperator);
|
|
38
|
+
if (slotsMatched.length != matches.length) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
// Handle MM/YYYY format
|
|
42
|
+
if (matches.length === 2) {
|
|
43
|
+
return validateTwoMatches(matches[0], matches[1]);
|
|
44
|
+
}
|
|
45
|
+
// Handle DD/MM/YYYY format
|
|
46
|
+
if (matches.length === 3) {
|
|
47
|
+
return validateThreeMatches(matches[0], matches[1], matches[2]);
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
export function validateTwoMatches(monthInput, yearInput) {
|
|
52
|
+
const monthNum = parseInt(monthInput, 10);
|
|
53
|
+
if (monthNum < 1 || monthNum > 12) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return (monthInput.length === 1 || monthInput.length === 2) && yearInput.length === 4;
|
|
57
|
+
}
|
|
58
|
+
export function validateThreeMatches(dayInput, monthInput, yearInput) {
|
|
59
|
+
const dayNum = parseInt(dayInput, 10);
|
|
60
|
+
if (dayNum < 1 || dayNum > 31) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
const monthNum = parseInt(monthInput, 10);
|
|
64
|
+
if (monthNum < 1 || monthNum > 12) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
return ((dayInput.length === 1 || dayInput.length === 2) &&
|
|
68
|
+
(monthInput.length === 1 || monthInput.length === 2) &&
|
|
69
|
+
yearInput.length === 4);
|
|
70
|
+
}
|
|
71
|
+
export function getNumOfSeparators(valueDate, seperator) {
|
|
72
|
+
const regex = new RegExp(seperator, 'g');
|
|
73
|
+
return [...valueDate.matchAll(regex)].length;
|
|
74
|
+
}
|
|
75
|
+
export function parseFhirDateToDisplayDate(fhirDate) {
|
|
76
|
+
if (fhirDate.length === 0) {
|
|
77
|
+
return { displayDate: '' };
|
|
78
|
+
}
|
|
79
|
+
const numOfSeparators = getNumOfSeparators(fhirDate, '-');
|
|
80
|
+
if (numOfSeparators === 2) {
|
|
81
|
+
const threeMatchesDate = dayjs(fhirDate, `YYYY-MM-DD`);
|
|
82
|
+
if (threeMatchesDate.isValid()) {
|
|
83
|
+
return { displayDate: threeMatchesDate.format('DD/MM/YYYY') };
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (numOfSeparators === 1) {
|
|
87
|
+
const twoMatchesDate = dayjs(fhirDate, `YYYY-MM`);
|
|
88
|
+
if (twoMatchesDate.isValid()) {
|
|
89
|
+
return { displayDate: twoMatchesDate.format('MM/YYYY') };
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const oneMatchDate = dayjs(fhirDate, `YYYY`);
|
|
93
|
+
if (oneMatchDate.isValid()) {
|
|
94
|
+
return { displayDate: oneMatchDate.format('YYYY') };
|
|
95
|
+
}
|
|
96
|
+
return { displayDate: fhirDate, parseFail: true };
|
|
97
|
+
}
|
|
98
|
+
export function parseInputDateToFhirDate(displayDate) {
|
|
99
|
+
const numOfSeparators = getNumOfSeparators(displayDate, '/');
|
|
100
|
+
if (numOfSeparators === 2) {
|
|
101
|
+
const threeMatchesDate = dayjs(displayDate, `DD/MM/YYYY`);
|
|
102
|
+
if (threeMatchesDate.isValid()) {
|
|
103
|
+
return threeMatchesDate.format('YYYY-MM-DD');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (numOfSeparators === 1) {
|
|
107
|
+
const twoMatchesDate = dayjs(displayDate, `MM/YYYY`);
|
|
108
|
+
if (twoMatchesDate.isValid()) {
|
|
109
|
+
return twoMatchesDate.format('YYYY-MM');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (displayDate.length === 4) {
|
|
113
|
+
const oneMatchDate = dayjs(displayDate, 'YYYY');
|
|
114
|
+
if (oneMatchDate.isValid()) {
|
|
115
|
+
return displayDate;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// Default to YYYY-MM-DD format if all else fails
|
|
119
|
+
return dayjs(displayDate).format('YYYY-MM-DD');
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=parseDates.js.map
|
package/lib/components/FormComponents/CustomDateItem/customDateTimePicker/utils/parseDates.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseDates.js","sourceRoot":"","sources":["../../../../../../src/components/FormComponents/CustomDateItem/customDateTimePicker/utils/parseDates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,eAAe,GAAG,sBAAsB,CAAC;AAE/C,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAE7C,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,KAAK,CAAC;KACd;IAED,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IAEnD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;QACxB,iEAAiE;QACjE,IAAI,SAAS,EAAE;YACb,OAAO,KAAK,CAAC;SACd;QAED,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;KAChC;IAED,sCAAsC;IACtC,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,KAAK,CAAC;KACd;IAED,kEAAkE;IAClE,MAAM,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAC5C,IAAI,YAAY,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE;QACzC,OAAO,K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MAAM,CAAC,EAAE,CAAC;KACrD;IAED,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,WAAmB;IAC1D,MAAM,eAAe,GAAG,kBAAkB,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAE7D,IAAI,eAAe,KAAK,CAAC,EAAE;QACzB,MAAM,gBAAgB,GAAG,KAAK,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QAC1D,IAAI,gBAAgB,CAAC,OAAO,EAAE,EAAE;YAC9B,OAAO,gBAAgB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;SAC9C;KACF;IAED,IAAI,eAAe,KAAK,CAAC,EAAE;QACzB,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACrD,IAAI,cAAc,CAAC,OAAO,EAAE,EAAE;YAC5B,OAAO,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;SACzC;KACF;IAED,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;QAC5B,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QAChD,IAAI,YAAY,CAAC,OAAO,EAAE,EAAE;YAC1B,OAAO,WAAW,CAAC;SACpB;KACF;IAED,iDAAiD;IACjD,OAAO,KAAK,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
|
|
3
|
+
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
4
|
+
interface CustomDateTimePickerTextProps extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute {
|
|
5
|
+
qItem: QuestionnaireItem;
|
|
6
|
+
qrItem: QuestionnaireResponseItem;
|
|
7
|
+
}
|
|
8
|
+
declare function CustomDateTimePickerText(props: CustomDateTimePickerTextProps): React.JSX.Element;
|
|
9
|
+
export default CustomDateTimePickerText;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import React, { useState } from 'react';
|
|
18
|
+
import useReadOnly from '../../../hooks/useReadOnly';
|
|
19
|
+
import useRenderingExtensions from '../../../hooks/useRenderingExtensions';
|
|
20
|
+
import { FullWidthFormComponentBox } from '../../Box.styles';
|
|
21
|
+
import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
|
|
22
|
+
import { parseFhirDateToDisplayDate, parseInputDateToFhirDate, validateInput } from './customDateTimePicker/utils/parseDates';
|
|
23
|
+
import { createEmptyQrItem } from '../../../utils/qrItem';
|
|
24
|
+
import useDateValidation from '../../../hooks/useDateValidation';
|
|
25
|
+
import CustomDateField2 from './CustomDateField2';
|
|
26
|
+
function CustomDateTimePickerText(props) {
|
|
27
|
+
const { qItem, qrItem, isRepeated, isTabled, parentIsReadOnly, onQrItemChange } = props;
|
|
28
|
+
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
29
|
+
const { displayPrompt, displayInstructions, entryFormat } = useRenderingExtensions(qItem);
|
|
30
|
+
const qrDate = qrItem !== null && qrItem !== void 0 ? qrItem : createEmptyQrItem(qItem);
|
|
31
|
+
// Init input value
|
|
32
|
+
let valueDate = '';
|
|
33
|
+
if (qrDate.answer) {
|
|
34
|
+
if (qrDate.answer[0].valueDate) {
|
|
35
|
+
valueDate = qrDate.answer[0].valueDate;
|
|
36
|
+
}
|
|
37
|
+
else if (qrDate.answer[0].valueDateTime) {
|
|
38
|
+
valueDate = qrDate.answer[0].valueDateTime;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const { displayDate, parseFail } = parseFhirDateToDisplayDate(valueDate);
|
|
42
|
+
const [input, setInput] = useState(displayDate);
|
|
43
|
+
const [focused, setFocused] = useState(false);
|
|
44
|
+
// Perform validation checks
|
|
45
|
+
const errorFeedback = useDateValidation(input, parseFail);
|
|
46
|
+
function handleSelectDate(selectedDate) {
|
|
47
|
+
setInput(selectedDate);
|
|
48
|
+
onQrItemChange(Object.assign(Object.assign({}, createEmptyQrItem(qItem)), { answer: [{ valueDate: parseInputDateToFhirDate(selectedDate) }] }));
|
|
49
|
+
}
|
|
50
|
+
function handleInputChange(newInput) {
|
|
51
|
+
setInput(newInput);
|
|
52
|
+
if (newInput === '') {
|
|
53
|
+
onQrItemChange(createEmptyQrItem(qItem));
|
|
54
|
+
}
|
|
55
|
+
if (!validateInput(newInput)) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
onQrItemChange(Object.assign(Object.assign({}, createEmptyQrItem(qItem)), { answer: [{ valueDate: parseInputDateToFhirDate(newInput) }] }));
|
|
59
|
+
}
|
|
60
|
+
if (isRepeated) {
|
|
61
|
+
return (React.createElement(CustomDateField2, { linkId: qItem.linkId, valueDate: displayDate, input: input, feedback: errorFeedback !== null && errorFeedback !== void 0 ? errorFeedback : '', isFocused: focused, displayPrompt: displayPrompt, entryFormat: entryFormat, readOnly: readOnly, isTabled: isTabled, setFocused: setFocused, onInputChange: handleInputChange, onSelectDate: handleSelectDate }));
|
|
62
|
+
}
|
|
63
|
+
return (React.createElement(FullWidthFormComponentBox, { "data-test": "q-item-date-box" },
|
|
64
|
+
React.createElement(ItemFieldGrid, { qItem: qItem, displayInstructions: displayInstructions, readOnly: readOnly },
|
|
65
|
+
React.createElement(CustomDateField2, { linkId: qItem.linkId, valueDate: displayDate, input: input, feedback: errorFeedback !== null && errorFeedback !== void 0 ? errorFeedback : '', isFocused: focused, displayPrompt: displayPrompt, entryFormat: entryFormat, readOnly: readOnly, isTabled: isTabled, setFocused: setFocused, onInputChange: handleInputChange, onSelectDate: handleSelectDate }),
|
|
66
|
+
React.createElement(React.Fragment, null,
|
|
67
|
+
"Verify date: ",
|
|
68
|
+
displayDate))));
|
|
69
|
+
}
|
|
70
|
+
export default CustomDateTimePickerText;
|
|
71
|
+
//# sourceMappingURL=CustomDateTimePickerText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomDateTimePickerText.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/CustomDateItem/CustomDateTimePickerText.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAQxC,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,aAAa,MAAM,4BAA4B,CAAC;AACvD,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,aAAa,EACd,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,iBAAiB,MAA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ACZ,QAAQ,EAAE,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,EAAE,EAC7B,SAAS,EAAE,OAAO,EAClB,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,iBAAiB,EAChC,YAAY,EAAE,gBAAgB,GAC9B;YACF;;gBAAgB,WAAW,CAAI,CACjB,CACU,CAC7B,CAAC;AACJ,CAAC;AAED,eAAe,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './customDateTimePicker';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export * from './customDateTimePicker';
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/CustomDateItem/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,wBAAwB,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
|
|
2
|
+
import type { PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
|
|
3
3
|
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
4
|
-
interface DateItemProps extends PropsWithQrItemChangeHandler
|
|
4
|
+
interface DateItemProps extends PropsWithQrItemChangeHandler, PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithParentIsReadOnlyAttribute {
|
|
5
5
|
qItem: QuestionnaireItem;
|
|
6
|
-
qrItem: QuestionnaireResponseItem;
|
|
6
|
+
qrItem: QuestionnaireResponseItem | null;
|
|
7
7
|
}
|
|
8
8
|
declare function DateItem(props: DateItemProps): React.JSX.Element;
|
|
9
9
|
export default DateItem;
|
|
@@ -21,10 +21,11 @@ import { FullWidthFormComponentBox } from '../../Box.styles';
|
|
|
21
21
|
import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
|
|
22
22
|
import DateField from './DateField';
|
|
23
23
|
import dayjs from 'dayjs';
|
|
24
|
+
import useReadOnly from '../../../hooks/useReadOnly';
|
|
24
25
|
function DateItem(props) {
|
|
25
|
-
const { qItem, qrItem, isRepeated, isTabled, onQrItemChange } = props;
|
|
26
|
-
|
|
27
|
-
const { displayPrompt, displayInstructions,
|
|
26
|
+
const { qItem, qrItem, isRepeated, isTabled, parentIsReadOnly, onQrItemChange } = props;
|
|
27
|
+
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
28
|
+
const { displayPrompt, displayInstructions, entryFormat } = useRenderingExtensions(qItem);
|
|
28
29
|
// Init input value
|
|
29
30
|
let dateString = null;
|
|
30
31
|
if (qrItem === null || qrItem === void 0 ? void 0 : qrItem.answer) {
|
|
@@ -50,7 +51,7 @@ function DateItem(props) {
|
|
|
50
51
|
return (React.createElement(DateField, { value: dateDayJs, displayPrompt: displayPrompt, entryFormat: entryFormat, readOnly: readOnly, onDateChange: handleDateChange, isTabled: isTabled }));
|
|
51
52
|
}
|
|
52
53
|
return (React.createElement(FullWidthFormComponentBox, { "data-test": "q-item-date-box" },
|
|
53
|
-
React.createElement(ItemFieldGrid, { qItem: qItem, displayInstructions: displayInstructions },
|
|
54
|
+
React.createElement(ItemFieldGrid, { qItem: qItem, displayInstructions: displayInstructions, readOnly: readOnly },
|
|
54
55
|
React.createElement(DateField, { value: dateDayJs, displayPrompt: displayPrompt, entryFormat: entryFormat, readOnly: readOnly, onDateChange: handleDateChange, isTabled: isTabled }))));
|
|
55
56
|
}
|
|
56
57
|
export default DateItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/DateItem/DateItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DateItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/DateItem/DateItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,aAAa,MAAM,4BAA4B,CAAC;AACvD,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAWrD,SAAS,QAAQ,CAAC,KAAoB;IACpC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,GA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gB,EAC9B,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;KACH;IAED,OAAO,CACL,oBAAC,yBAAyB,iBAAW,iBAAiB;QACpD,oBAAC,aAAa,IAAC,KAAK,EAAE,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,QAAQ;YACvF,oBAAC,SAAS,IACR,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,gBAAgB,EAC9B,QAAQ,EAAE,QAAQ,GAClB,CACY,CACU,CAC7B,CAAC;AACJ,CAAC;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import React, { useState } from 'react';
|
|
18
|
+
import { DatePicker, LocalizationProvider } from '@mui/x-date-pickers';
|
|
19
|
+
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
|
20
|
+
function DateField(props) {
|
|
21
|
+
const { value, displayPrompt, entryFormat, readOnly, isTabled, onDateChange } = props;
|
|
22
|
+
const [name, setName] = useState('');
|
|
23
|
+
function handleInputChange(newValue) {
|
|
24
|
+
setName(newValue);
|
|
25
|
+
}
|
|
26
|
+
return (React.createElement(LocalizationProvider, { dateAdapter: AdapterDayjs },
|
|
27
|
+
React.createElement(DatePicker, { format: entryFormat !== '' ? entryFormat : 'DD/MM/YYYY', value: value, disabled: readOnly, label: displayPrompt, sx: { maxWidth: !isTabled ? 280 : 3000, minWidth: 160 }, onChange: onDateChange, slots: { textField: DatePickerField }, slotProps: { textField: { helperText: 'Please enter a valid date' } }, "data-test": "q-item-date-field" })));
|
|
28
|
+
}
|
|
29
|
+
function DatePickerField({ value: string, onChange: }) { }
|
|
30
|
+
() => ;
|
|
31
|
+
{
|
|
32
|
+
// Parse the value for a valid date time
|
|
33
|
+
const parsedValue = new Date(value);
|
|
34
|
+
// Convert the parsed value to the format that is used in the DatePicker
|
|
35
|
+
const formattedValue = parsedValue.toLocaleDateString();
|
|
36
|
+
return (React.createElement(MuiTextField, { value: formattedValue, onChange: () => {
|
|
37
|
+
// Change the value of the DatePicker
|
|
38
|
+
onChange(parsedValue);
|
|
39
|
+
} }));
|
|
40
|
+
}
|
|
41
|
+
export default DatePicker;
|
|
42
|
+
//# sourceMappingURL=DatePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/DateItem/DatePicker.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGxC,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAYhE,SAAS,SAAS,CAAC,KAAqB;IACtC,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAEtF,MAAM,CAAC,IAAI,EAAE,OAA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import type { PropsWithIsTabledAttribute } from '../../../interfaces/renderProps.interface';
|
|
3
|
+
interface DatePickerProps extends PropsWithIsTabledAttribute {
|
|
4
|
+
input: string;
|
|
5
|
+
onInputChange: (newInput: string) => string;
|
|
6
|
+
}
|
|
7
|
+
declare function DatePickerField(props: DatePickerProps): React.JSX.Element;
|
|
8
|
+
export default DatePickerField;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import MuiTextField from '../TextItem/MuiTextField';
|
|
19
|
+
function DatePickerField(props) {
|
|
20
|
+
const { input, onInputChange } = props;
|
|
21
|
+
return React.createElement(MuiTextField, { value: input, onChange: (event) => onInputChange(event.target.value) });
|
|
22
|
+
}
|
|
23
|
+
export default DatePickerField;
|
|
24
|
+
//# sourceMappingURL=DatePickerField.js.map
|