Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions demo/src/InputsTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import {
ExpandingTextField,
CustomFormProvider,
SelectClearable,
DirectoryItemsInput,
ElementType,
} from '../../src';

const AUTOCOMPLETE_INPUT = 'autocomplete';
Expand All @@ -36,6 +38,7 @@ const INTEGER_INPUT = 'integer';
const FLOAT_INPUT = 'float';
const CHECKBOX_INPUT = 'checkbox';
const SWITCH_INPUT = 'switch';
const DIRECTORY_ITEMS_INPUT = 'directoryItems';

const emptyFormData = {
[AUTOCOMPLETE_INPUT]: null,
Expand All @@ -48,6 +51,7 @@ const emptyFormData = {
[FLOAT_INPUT]: null,
[CHECKBOX_INPUT]: false, // or null, but should then be nullable in schema
[SWITCH_INPUT]: false, // or null, but should then be nullable in schema
[DIRECTORY_ITEMS_INPUT]: [],
};

const formSchema = yup.object().shape({
Expand All @@ -61,6 +65,7 @@ const formSchema = yup.object().shape({
[FLOAT_INPUT]: yup.number().nullable(),
[CHECKBOX_INPUT]: yup.boolean(),
[SWITCH_INPUT]: yup.boolean(),
[DIRECTORY_ITEMS_INPUT]: yup.array().of(yup.object()).default([]),
});

const options = [
Expand Down Expand Up @@ -166,6 +171,17 @@ function InputsTab() {
<Grid item xs={gridSize}>
<SwitchInput name={SWITCH_INPUT} label="inputs/switch" />
</Grid>
<Grid item xs={gridSize}>
<DirectoryItemsInput
name={DIRECTORY_ITEMS_INPUT}
label="inputs/directory-items"
titleId="inputs/directory-items"
elementType={ElementType.FILTER}
allowMultiSelect
hideErrorMessage
disable
/>
</Grid>
</Grid>
<Box
sx={{
Expand Down
6 changes: 5 additions & 1 deletion demo/src/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ import {
equipmentsEn,
equipmentsFr,
equipmentStyles,
EquipmentType,
filterEn,
filterExpertEn,
filterExpertFr,
Expand All @@ -91,6 +92,8 @@ import {
networkModificationsFr,
OverflowableChipWithHelperText,
OverflowableText,
parametersEn,
parametersFr,
reportViewerEn,
reportViewerFr,
SnackbarProvider,
Expand All @@ -104,7 +107,6 @@ import {
treeviewFinderEn,
treeviewFinderFr,
useSnackMessage,
EquipmentType,
} from '../../src';

const messages = {
Expand All @@ -127,6 +129,7 @@ const messages = {
...commonButtonEn,
...networkModificationsEn,
...inputsEn,
...parametersEn,
...translations.en,
},
fr: {
Expand All @@ -148,6 +151,7 @@ const messages = {
...networkModificationsFr,
...multipleSelectionDialogFr,
...inputsFr,
...parametersFr,
...translations.fr,
},
};
Expand Down
Loading
Loading