-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add all setup fields plus dummy placeholders to required fields
- Loading branch information
Showing
12 changed files
with
141 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import i18n from '@dhis2/d2-i18n' | ||
import { Field, InputFieldFF } from '@dhis2/ui' | ||
import React from 'react' | ||
import { Field as FieldRFF, useField } from 'react-final-form' | ||
|
||
export function CategoryComboField() { | ||
const validate = () => {} | ||
const { input, meta } = useField('categoryCombo', { | ||
validateFields: [], | ||
validate, | ||
format: (categoryCombo) => categoryCombo && categoryCombo.id, | ||
parse: (id) => ({ id }), | ||
}) | ||
return ( | ||
<FieldRFF<string | undefined> | ||
component={InputFieldFF} | ||
inputWidth="400px" | ||
label={i18n.t('{{fieldLabel}} (required)', { | ||
fieldLabel: i18n.t('Category combination'), | ||
})} | ||
name="categoryCombo.id" | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import i18n from '@dhis2/d2-i18n' | ||
import { InputFieldFF } from '@dhis2/ui' | ||
import React from 'react' | ||
import { Field as FieldRFF, useField } from 'react-final-form' | ||
|
||
export function PeriodTypeField() { | ||
const validate = () => {} | ||
const { input, meta } = useField('categoryCombo', { | ||
validateFields: [], | ||
validate, | ||
format: (categoryCombo) => categoryCombo && categoryCombo.id, | ||
parse: (id) => ({ id }), | ||
}) | ||
return ( | ||
<FieldRFF<string | undefined> | ||
component={InputFieldFF} | ||
inputWidth="400px" | ||
label={i18n.t('Period type')} | ||
name="periodType" | ||
/> | ||
|
||
// <Field | ||
// required | ||
// name="periodType" | ||
// label={i18n.t('{{fieldLabel}} (required)', { | ||
// fieldLabel: i18n.t('Period type'), | ||
// })} | ||
// error={meta.touched && !!meta.error} | ||
// validationText={meta.touched ? meta.error : undefined} | ||
// > | ||
// | ||
// <ModelSingleSelect | ||
// required | ||
// useInitialOptionQuery={useInitialCategoryComboQuery} | ||
// useOptionsQuery={useCategoryCombosQuery} | ||
// invalid={meta.touched && !!meta.error} | ||
// selected={input.value} | ||
// onChange={({ selected }) => { | ||
// input.onChange(selected) | ||
// input.onBlur() | ||
// }} | ||
// onBlur={input.onBlur} | ||
// onFocus={input.onFocus} | ||
// /> | ||
// </Field> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters