diff --git a/src/I18n/languages/cz.json b/src/I18n/languages/cz.json index 4a3cddaeb..e11289033 100644 --- a/src/I18n/languages/cz.json +++ b/src/I18n/languages/cz.json @@ -245,6 +245,7 @@ "car": "Car", "selectCar": "Select a car", "selectCars": "Select cars", + "clearCar": "Clear car", "noCarMessageTitle": "Indicate what car you are using to get better recharges", "addCarTitle": "Add a car", "addCarButton": "Add car", diff --git a/src/I18n/languages/de.json b/src/I18n/languages/de.json index 37789d029..81bd61b47 100644 --- a/src/I18n/languages/de.json +++ b/src/I18n/languages/de.json @@ -245,6 +245,7 @@ "car": "Car", "selectCar": "Select a car", "selectCars": "Select cars", + "clearCar": "Clear car", "noCarMessageTitle": "Indicate what car you are using to get better recharges", "addCarTitle": "Add a car", "addCarButton": "Add car", diff --git a/src/I18n/languages/en.json b/src/I18n/languages/en.json index a89d665e6..28619c6ab 100644 --- a/src/I18n/languages/en.json +++ b/src/I18n/languages/en.json @@ -245,6 +245,7 @@ "car": "Car", "selectCar": "Select a car", "selectCars": "Select cars", + "clearCar": "Clear car", "noCarMessageTitle": "Indicate what car you are using to get better recharges", "addCarTitle": "Add a car", "addCarButton": "Add car", diff --git a/src/I18n/languages/es.json b/src/I18n/languages/es.json index 7438cad46..990d87863 100644 --- a/src/I18n/languages/es.json +++ b/src/I18n/languages/es.json @@ -245,6 +245,7 @@ "car": "Vehículo", "selectCar": "Select a car", "selectCars": "Select cars", + "clearCar": "Clear car", "noCarMessageTitle": "Indicate what car you are using to get better recharges", "addCarTitle": "Add a car", "addCarButton": "Add car", diff --git a/src/I18n/languages/fr.json b/src/I18n/languages/fr.json index eeec697c6..05ab84c94 100644 --- a/src/I18n/languages/fr.json +++ b/src/I18n/languages/fr.json @@ -245,6 +245,7 @@ "car": "Voiture", "selectCar": "Sélectionnez une voiture", "selectCars": "Sélectionnez des voitures", + "clearCar": "Effacer voiture", "noCarMessageTitle": "Indiquez la voiture utilisée pour bénéficier de meilleures recharges", "addCarTitle": "Ajouter une voiture", "addCarButton": "Ajouter", diff --git a/src/I18n/languages/it.json b/src/I18n/languages/it.json index c6a978aaf..f3ed3a469 100644 --- a/src/I18n/languages/it.json +++ b/src/I18n/languages/it.json @@ -245,6 +245,7 @@ "car": "Car", "selectCar": "Select a car", "selectCars": "Select cars", + "clearCar": "Clear car", "noCarMessageTitle": "Indicate what car you are using to get better recharges", "addCarTitle": "Ajouter une voiture", "addCarButton": "Ajouter", diff --git a/src/I18n/languages/pt.json b/src/I18n/languages/pt.json index 4e77870ff..b5ae470cd 100644 --- a/src/I18n/languages/pt.json +++ b/src/I18n/languages/pt.json @@ -245,6 +245,7 @@ "car": "Car", "selectCar": "Select a car", "selectCars": "Select cars", + "clearCar": "Clear car", "noCarMessageTitle": "Indicate what car you are using to get better recharges", "addCarTitle": "Ajouter une voiture", "addCarButton": "Ajouter", diff --git a/src/components/modal/ModalSelect.tsx b/src/components/modal/ModalSelect.tsx index 97761c9bf..a477ac68f 100644 --- a/src/components/modal/ModalSelect.tsx +++ b/src/components/modal/ModalSelect.tsx @@ -14,18 +14,27 @@ import computeListItemCommonStyle from '../list/ListItemCommonStyle'; export interface Props extends BaseProps { defaultItem?: T; buildItemName?: (item: T) => string; + // Disable the opening with specific styles disabled?: boolean; label?: string; + // Render list item renderItem?: (item?: T) => React.ReactElement; + // Render a generic item when the items list is empty (only if renderItemPlaceholder is null) renderNoItem?: () => React.ReactElement; + // Render a generic item when nothing is selected renderItemPlaceholder?: () => React.ReactElement; + // Whether or not to display the button to clear the input + clearable?: boolean; selectionMode: ItemSelectionMode; onItemsSelected: (selectedItems: T[]) => void; defaultItemLoading?: boolean; + // Can open the modal openable?: boolean; + itemsEquals?: (a: T, b: T) => boolean; } interface State { isVisible: boolean; + noneSelected: boolean; selectedItems: T[]; selectedItemsCount: number; } @@ -42,12 +51,15 @@ export default class ModalSelect extends React.Component this.props.onItemsSelected([])); } public render() { @@ -57,17 +69,15 @@ export default class ModalSelect extends React.Component - - {label && {label}} - {this.renderButton(style)} - + {label && {label}} + {this.renderButton(style)} this.setState({ isVisible: false })} // Modal component registers the given method for hardwareBackPress event and unregisters it when the modal inner content unmounts. // Inner component list also unsubscribe on unmount, allowing the last subscriber to choose back implementation. @@ -91,7 +101,7 @@ export default class ModalSelect extends React.Component {selectionMode === ItemSelectionMode.MULTI && ( -