@turnit-ou/shared 0.0.0-stage → 2.18.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/@types/@mui/index.d.ts +125 -0
- package/@types/axios/index.d.ts +7 -0
- package/@types/openapi-client-axios/index.d.ts +5 -0
- package/@types/openapi-typescript/index.d.ts +71 -0
- package/@types/react-final-form-arrays/index.d.ts +75 -0
- package/@types/react-table/index.d.ts +292 -0
- package/components/Alert/AlertTemplate.d.ts +3 -0
- package/components/Alert/AlertTemplate.js +66 -0
- package/components/Alert/index.d.ts +4 -0
- package/components/Alert/index.js +17 -0
- package/components/ConfirmButton.d.ts +15 -0
- package/components/ConfirmButton.js +47 -0
- package/components/Drawer.d.ts +4 -0
- package/components/Drawer.js +24 -0
- package/components/DrawerForm/DrawerFormCardActions.d.ts +5 -0
- package/components/DrawerForm/DrawerFormCardActions.js +21 -0
- package/components/DrawerForm/DrawerFormCloseButton.d.ts +3 -0
- package/components/DrawerForm/DrawerFormCloseButton.js +5 -0
- package/components/DrawerForm/DrawerFormContext.d.ts +7 -0
- package/components/DrawerForm/DrawerFormContext.js +4 -0
- package/components/DrawerForm.d.ts +10 -0
- package/components/DrawerForm.js +84 -0
- package/components/Editor/Editor.d.ts +9 -0
- package/components/Editor/Editor.js +36 -0
- package/components/Editor/Toolbar.d.ts +7 -0
- package/components/Editor/Toolbar.js +31 -0
- package/components/Editor/buttons/FormatLinkButton.d.ts +5 -0
- package/components/Editor/buttons/FormatLinkButton.js +64 -0
- package/components/Editor/buttons/InsertImageButton.d.ts +5 -0
- package/components/Editor/buttons/InsertImageButton.js +59 -0
- package/components/Editor/buttons.d.ts +15 -0
- package/components/Editor/buttons.js +70 -0
- package/components/Editor/createButton.d.ts +28 -0
- package/components/Editor/createButton.js +68 -0
- package/components/Editor/editor.scss +45 -0
- package/components/Ellipsis.d.ts +9 -0
- package/components/Ellipsis.js +22 -0
- package/components/EllipsisText.d.ts +8 -0
- package/components/EllipsisText.js +25 -0
- package/components/EnvironmentBanner.d.ts +8 -0
- package/components/EnvironmentBanner.js +25 -0
- package/components/Header/AccessibilityModal.d.ts +5 -0
- package/components/Header/AccessibilityModal.js +28 -0
- package/components/Header/AllowedBusinessEntityModal.d.ts +9 -0
- package/components/Header/AllowedBusinessEntityModal.js +24 -0
- package/components/Header/LanguageSelect.d.ts +2 -0
- package/components/Header/LanguageSelect.js +80 -0
- package/components/Header/MenuItems.d.ts +9 -0
- package/components/Header/MenuItems.js +55 -0
- package/components/Header/ModuleIcon.d.ts +7 -0
- package/components/Header/ModuleIcon.js +119 -0
- package/components/Header/index.d.ts +44 -0
- package/components/Header/index.js +89 -0
- package/components/Layout/LayoutCol.d.ts +8 -0
- package/components/Layout/LayoutCol.js +26 -0
- package/components/Layout/index.d.ts +32 -0
- package/components/Layout/index.js +56 -0
- package/components/Loadable.d.ts +11 -0
- package/components/Loadable.js +3 -0
- package/components/SearchCard.d.ts +8 -0
- package/components/SearchCard.js +81 -0
- package/components/SearchForm.d.ts +14 -0
- package/components/SearchForm.js +51 -0
- package/components/SearchFormTable.d.ts +8 -0
- package/components/SearchFormTable.js +32 -0
- package/components/SearchResult.d.ts +13 -0
- package/components/SearchResult.js +67 -0
- package/components/Table/TableCaption.d.ts +6 -0
- package/components/Table/TableCaption.js +25 -0
- package/components/Table/TableCell.d.ts +17 -0
- package/components/Table/TableCell.js +45 -0
- package/components/Table/TableCellEditable.d.ts +28 -0
- package/components/Table/TableCellEditable.js +151 -0
- package/components/Table/TableCellEditableAction.d.ts +13 -0
- package/components/Table/TableCellEditableAction.js +70 -0
- package/components/Table/TableCellEditableField.d.ts +17 -0
- package/components/Table/TableCellEditableField.js +1 -0
- package/components/Table/TableCellEditableTimeDuration.d.ts +13 -0
- package/components/Table/TableCellEditableTimeDuration.js +12 -0
- package/components/Table/TableContext.d.ts +11 -0
- package/components/Table/TableContext.js +4 -0
- package/components/Table/TablePagination.d.ts +5 -0
- package/components/Table/TablePagination.js +84 -0
- package/components/Table.d.ts +53 -0
- package/components/Table.js +389 -0
- package/components/Version.d.ts +5 -0
- package/components/Version.js +23 -0
- package/dto/businessEntity.d.ts +15 -0
- package/dto/businessEntity.js +1 -0
- package/dto/classification.d.ts +9 -0
- package/dto/classification.js +1 -0
- package/dto/classifier.d.ts +13 -0
- package/dto/classifier.js +4 -0
- package/dto/common.d.ts +5 -0
- package/dto/common.js +1 -0
- package/dto/fare.d.ts +11 -0
- package/dto/fare.js +1 -0
- package/dto/line-network.d.ts +23 -0
- package/dto/line-network.js +1 -0
- package/dto/option.d.ts +7 -0
- package/dto/option.js +1 -0
- package/dto/pagination.d.ts +10 -0
- package/dto/pagination.js +1 -0
- package/fields/FormCheckbox.d.ts +11 -0
- package/fields/FormCheckbox.js +5 -0
- package/fields/FormCheckboxGroup.d.ts +6 -0
- package/fields/FormCheckboxGroup.js +20 -0
- package/fields/FormController.d.ts +7 -0
- package/fields/FormController.js +16 -0
- package/fields/FormDatepicker.d.ts +8 -0
- package/fields/FormDatepicker.js +7 -0
- package/fields/FormInput.d.ts +8 -0
- package/fields/FormInput.js +4 -0
- package/fields/FormRadioGroup.d.ts +10 -0
- package/fields/FormRadioGroup.js +6 -0
- package/fields/FormSelect.d.ts +11 -0
- package/fields/FormSelect.js +9 -0
- package/fields/FormSwitch.d.ts +11 -0
- package/fields/FormSwitch.js +5 -0
- package/fields/FormTimeZoneSelect.d.ts +4 -0
- package/fields/FormTimeZoneSelect.js +8 -0
- package/fields/index.d.ts +9 -0
- package/fields/index.js +9 -0
- package/form/ArrayField.d.ts +27 -0
- package/form/ArrayField.js +69 -0
- package/form/CheckboxField.d.ts +8 -0
- package/form/CheckboxField.js +14 -0
- package/form/CheckboxGroupField.d.ts +6 -0
- package/form/CheckboxGroupField.js +15 -0
- package/form/ConditionField.d.ts +7 -0
- package/form/ConditionField.js +20 -0
- package/form/ContentField.d.ts +7 -0
- package/form/ContentField.js +15 -0
- package/form/CounterField.d.ts +5 -0
- package/form/CounterField.js +7 -0
- package/form/DateField.d.ts +8 -0
- package/form/DateField.js +52 -0
- package/form/DatesArrayField.d.ts +8 -0
- package/form/DatesArrayField.js +79 -0
- package/form/DependSelectField.d.ts +8 -0
- package/form/DependSelectField.js +12 -0
- package/form/EditorField.d.ts +5 -0
- package/form/EditorField.js +7 -0
- package/form/FileField.d.ts +12 -0
- package/form/FileField.js +9 -0
- package/form/FormField.d.ts +15 -0
- package/form/FormField.js +22 -0
- package/form/ModalFieldArray.d.ts +13 -0
- package/form/ModalFieldArray.js +62 -0
- package/form/PeriodField.d.ts +24 -0
- package/form/PeriodField.js +111 -0
- package/form/RadioGroupField.d.ts +10 -0
- package/form/RadioGroupField.js +21 -0
- package/form/SearchField.d.ts +19 -0
- package/form/SearchField.js +51 -0
- package/form/SelectField.d.ts +8 -0
- package/form/SelectField.js +13 -0
- package/form/SelectOwnerField.d.ts +11 -0
- package/form/SelectOwnerField.js +11 -0
- package/form/StopsSelect/StopSelectWithSearch.d.ts +28 -0
- package/form/StopsSelect/StopSelectWithSearch.js +181 -0
- package/form/StopsSelect/StopsSelect.d.ts +19 -0
- package/form/StopsSelect/StopsSelect.js +65 -0
- package/form/StopsSelect/StopsSelectModal.d.ts +26 -0
- package/form/StopsSelect/StopsSelectModal.js +280 -0
- package/form/StopsSelect/StopsSelectSearchForm.d.ts +22 -0
- package/form/StopsSelect/StopsSelectSearchForm.js +43 -0
- package/form/SwitchField.d.ts +9 -0
- package/form/SwitchField.js +16 -0
- package/form/TextField.d.ts +6 -0
- package/form/TextField.js +21 -0
- package/form/TimeDurationField.d.ts +6 -0
- package/form/TimeDurationField.js +54 -0
- package/form/TimeZoneField.d.ts +6 -0
- package/form/TimeZoneField.js +8 -0
- package/form/ToggleButtonGroupField.d.ts +12 -0
- package/form/ToggleButtonGroupField.js +16 -0
- package/form/hooks/addLazyFieldMetaState.d.ts +3 -0
- package/form/hooks/addLazyFieldMetaState.js +55 -0
- package/form/hooks/getValue.d.ts +3 -0
- package/form/hooks/getValue.js +60 -0
- package/form/hooks/useConstant.d.ts +13 -0
- package/form/hooks/useConstant.js +20 -0
- package/form/hooks/useConstantCallback.d.ts +7 -0
- package/form/hooks/useConstantCallback.js +14 -0
- package/form/hooks/useField.d.ts +3 -0
- package/form/hooks/useField.js +175 -0
- package/form/hooks/useFieldArray.d.ts +6 -0
- package/form/hooks/useFieldArray.js +87 -0
- package/form/hooks/useLatest.d.ts +3 -0
- package/form/hooks/useLatest.js +8 -0
- package/form/hooks/useModalTableSelectedRows.d.ts +12 -0
- package/form/hooks/useModalTableSelectedRows.js +66 -0
- package/form/hooks/useWatch.d.ts +12 -0
- package/form/hooks/useWatch.js +16 -0
- package/form/index.d.ts +45 -0
- package/form/index.js +58 -0
- package/form/mutators/change.d.ts +2 -0
- package/form/mutators/change.js +9 -0
- package/form/validate.d.ts +14 -0
- package/form/validate.js +39 -0
- package/helpers/capitalize.d.ts +1 -0
- package/helpers/capitalize.js +1 -0
- package/helpers/filter.d.ts +4 -0
- package/helpers/filter.js +21 -0
- package/helpers/formSubmit.d.ts +5 -0
- package/helpers/formSubmit.js +21 -0
- package/helpers/index.d.ts +7 -0
- package/helpers/index.js +7 -0
- package/helpers/makeClassificationOptions.d.ts +30 -0
- package/helpers/makeClassificationOptions.js +29 -0
- package/helpers/map.d.ts +1 -0
- package/helpers/map.js +1 -0
- package/helpers/openapi.d.ts +10 -0
- package/helpers/openapi.js +10 -0
- package/helpers/renderRangeError.d.ts +1 -0
- package/helpers/renderRangeError.js +20 -0
- package/helpers/sentry/assertEnvVariable.d.ts +1 -0
- package/helpers/sentry/assertEnvVariable.js +7 -0
- package/helpers/sentry/sentryConfig.d.ts +2 -0
- package/helpers/sentry/sentryConfig.js +18 -0
- package/helpers/serializeErrors.d.ts +2 -0
- package/helpers/serializeErrors.js +13 -0
- package/hooks/index.d.ts +26 -0
- package/hooks/index.js +26 -0
- package/hooks/useAllowedBusinessEntities.d.ts +4 -0
- package/hooks/useAllowedBusinessEntities.js +9 -0
- package/hooks/useBusinessEntitiesByType.d.ts +8 -0
- package/hooks/useBusinessEntitiesByType.js +17 -0
- package/hooks/useChangePassword.d.ts +14 -0
- package/hooks/useChangePassword.js +48 -0
- package/hooks/useClassification.d.ts +9 -0
- package/hooks/useClassification.js +16 -0
- package/hooks/useDraggable.d.ts +5 -0
- package/hooks/useDraggable.js +11 -0
- package/hooks/useEllipsis.d.ts +10 -0
- package/hooks/useEllipsis.js +79 -0
- package/hooks/useFavicon.d.ts +1 -0
- package/hooks/useFavicon.js +13 -0
- package/hooks/useFormTable.d.ts +24 -0
- package/hooks/useFormTable.js +105 -0
- package/hooks/useFormTableControls.d.ts +31 -0
- package/hooks/useFormTableControls.js +34 -0
- package/hooks/useInertBackground.d.ts +20 -0
- package/hooks/useInertBackground.js +57 -0
- package/hooks/useIsMounted.d.ts +2 -0
- package/hooks/useIsMounted.js +11 -0
- package/hooks/useLanguage.d.ts +1 -0
- package/hooks/useLanguage.js +2 -0
- package/hooks/useLoaded.d.ts +1 -0
- package/hooks/useLoaded.js +19 -0
- package/hooks/useLocale.d.ts +1 -0
- package/hooks/useLocale.js +7 -0
- package/hooks/useModal.d.ts +307 -0
- package/hooks/useModal.js +12 -0
- package/hooks/useOptions.d.ts +13 -0
- package/hooks/useOptions.js +24 -0
- package/hooks/usePrevious.d.ts +1 -0
- package/hooks/usePrevious.js +12 -0
- package/hooks/usePrompt.d.ts +8 -0
- package/hooks/usePrompt.js +17 -0
- package/hooks/useRowActive.d.ts +6 -0
- package/hooks/useRowActive.js +104 -0
- package/hooks/useRowEditActions.d.ts +5 -0
- package/hooks/useRowEditActions.js +12 -0
- package/hooks/useRowExpandToggle.d.ts +5 -0
- package/hooks/useRowExpandToggle.js +13 -0
- package/hooks/useRowHidden.d.ts +4 -0
- package/hooks/useRowHidden.js +6 -0
- package/hooks/useRowSelectCheckbox.d.ts +27 -0
- package/hooks/useRowSelectCheckbox.js +48 -0
- package/hooks/useTable.d.ts +4 -0
- package/hooks/useTable.js +38 -0
- package/hooks/useTableRowHighlight.d.ts +4 -0
- package/hooks/useTableRowHighlight.js +16 -0
- package/hooks/useTranslation.d.ts +3 -0
- package/hooks/useTranslation.js +3 -0
- package/hooks/useWeekdayOptions.d.ts +40 -0
- package/hooks/useWeekdayOptions.js +66 -0
- package/i18n/index.d.ts +13 -0
- package/i18n/index.js +82 -0
- package/i18n/resources/de.json +115 -0
- package/i18n/resources/el.json +116 -0
- package/i18n/resources/en-AE.json +115 -0
- package/i18n/resources/en.json +118 -0
- package/i18n/resources/es.json +115 -0
- package/i18n/resources/fr.json +115 -0
- package/i18n/resources/index.d.ts +1295 -0
- package/i18n/resources/index.js +24 -0
- package/i18n/resources/it.json +115 -0
- package/i18n/resources/lt.json +115 -0
- package/i18n/resources/pt.json +115 -0
- package/i18n/resources/sk.json +115 -0
- package/i18n/resources/sv.json +116 -0
- package/i18n/trans/alert.d.ts +8 -0
- package/i18n/trans/alert.js +10 -0
- package/i18n/trans/button.d.ts +24 -0
- package/i18n/trans/button.js +26 -0
- package/i18n/trans/error.d.ts +10 -0
- package/i18n/trans/error.js +12 -0
- package/i18n/trans/field.d.ts +19 -0
- package/i18n/trans/field.js +21 -0
- package/i18n/trans/index.d.ts +13 -0
- package/i18n/trans/index.js +20 -0
- package/i18n/trans/label.d.ts +18 -0
- package/i18n/trans/label.js +20 -0
- package/i18n/trans/option.d.ts +6 -0
- package/i18n/trans/option.js +8 -0
- package/i18n/trans/qty.d.ts +5 -0
- package/i18n/trans/qty.js +7 -0
- package/i18n/trans/table.d.ts +8 -0
- package/i18n/trans/table.js +10 -0
- package/i18n/trans/title.d.ts +6 -0
- package/i18n/trans/title.js +8 -0
- package/i18n/trans/tooltip.d.ts +8 -0
- package/i18n/trans/tooltip.js +10 -0
- package/icons/1-class.svg +4 -0
- package/icons/2-class-calm.svg +5 -0
- package/icons/2-class-crossed.svg +5 -0
- package/icons/2-class.svg +4 -0
- package/icons/3-class.svg +4 -0
- package/icons/4-class.svg +4 -0
- package/icons/ac-crossed.svg +6 -0
- package/icons/ac.svg +9 -0
- package/icons/accessibility.svg +5 -0
- package/icons/add-journey-segment.svg +9 -0
- package/icons/add-person.svg +6 -0
- package/icons/add.svg +4 -0
- package/icons/air-condition.svg +11 -0
- package/icons/airport.svg +4 -0
- package/icons/alert-circle.svg +5 -0
- package/icons/arrow-down.svg +4 -0
- package/icons/arrow-left-circle.svg +5 -0
- package/icons/arrow-left.svg +4 -0
- package/icons/arrow-right.svg +4 -0
- package/icons/arrow-up.svg +4 -0
- package/icons/baby-care.svg +7 -0
- package/icons/bar.svg +6 -0
- package/icons/bed.svg +3 -0
- package/icons/bicycle-crossed.svg +6 -0
- package/icons/bicycle.svg +8 -0
- package/icons/bin.svg +6 -0
- package/icons/break.svg +5 -0
- package/icons/breakfast-1-class.svg +5 -0
- package/icons/breakfast-2-class.svg +5 -0
- package/icons/breakfast.svg +3 -0
- package/icons/bus.svg +7 -0
- package/icons/business-area.svg +6 -0
- package/icons/by-aisle.svg +8 -0
- package/icons/by-window.svg +6 -0
- package/icons/cafe-1-class.svg +5 -0
- package/icons/calendar.svg +6 -0
- package/icons/cancel.svg +5 -0
- package/icons/cargo.svg +4 -0
- package/icons/carriage-bot.svg +6 -0
- package/icons/carriage-mid.svg +4 -0
- package/icons/carriage-top.svg +12 -0
- package/icons/carriage.svg +3 -0
- package/icons/cart.svg +3 -0
- package/icons/cd.svg +4 -0
- package/icons/check-circle.svg +4 -0
- package/icons/check.svg +3 -0
- package/icons/checkbox-checked.svg +4 -0
- package/icons/checkbox-indeterminate.svg +5 -0
- package/icons/checkbox-mark.svg +3 -0
- package/icons/checkbox.svg +3 -0
- package/icons/chevron-down.svg +3 -0
- package/icons/chevron-left.svg +3 -0
- package/icons/chevron-right.svg +3 -0
- package/icons/chevron-up.svg +3 -0
- package/icons/circle.svg +3 -0
- package/icons/clock.svg +5 -0
- package/icons/clone.svg +4 -0
- package/icons/close-bold.svg +4 -0
- package/icons/close.svg +4 -0
- package/icons/coffee-machine-crossed.svg +6 -0
- package/icons/coffee-machine.svg +7 -0
- package/icons/coin.svg +4 -0
- package/icons/comment.svg +3 -0
- package/icons/compartment.svg +6 -0
- package/icons/couchette.svg +6 -0
- package/icons/cube.svg +1 -0
- package/icons/currency.svg +4 -0
- package/icons/deactivate.svg +4 -0
- package/icons/delete.svg +4 -0
- package/icons/dining.svg +7 -0
- package/icons/direction-bottom.svg +4 -0
- package/icons/direction-forward-v.svg +4 -0
- package/icons/direction-forward.svg +4 -0
- package/icons/direction-left.svg +4 -0
- package/icons/direction-reverse-v.svg +4 -0
- package/icons/direction-reverse.svg +4 -0
- package/icons/direction-right.svg +4 -0
- package/icons/direction-top.svg +4 -0
- package/icons/dots.svg +5 -0
- package/icons/download.svg +5 -0
- package/icons/drag-n-drop.svg +3 -0
- package/icons/draggable.svg +5 -0
- package/icons/duplicate.svg +4 -0
- package/icons/dvd.svg +5 -0
- package/icons/edit.svg +3 -0
- package/icons/empty-search.svg +9 -0
- package/icons/empty-state.svg +13 -0
- package/icons/empty.svg +9 -0
- package/icons/empty_search_purple.svg +6 -0
- package/icons/error-circle.svg +4 -0
- package/icons/eu-law.svg +5 -0
- package/icons/external_link.svg +5 -0
- package/icons/family-area.svg +7 -0
- package/icons/file-settings.svg +3 -0
- package/icons/file.svg +11 -0
- package/icons/filter.svg +3 -0
- package/icons/flip.svg +11 -0
- package/icons/food-1-class.svg +5 -0
- package/icons/food-plus.svg +5 -0
- package/icons/food.svg +7 -0
- package/icons/grid-cell.svg +1 -0
- package/icons/grid.svg +6 -0
- package/icons/headphones.svg +5 -0
- package/icons/helping-hand-crossed.svg +12 -0
- package/icons/helping-hand.svg +3 -0
- package/icons/hide.svg +4 -0
- package/icons/home.svg +4 -0
- package/icons/index.json +228 -0
- package/icons/info-circle.svg +5 -0
- package/icons/insurance.svg +6 -0
- package/icons/journey-changeover.svg +5 -0
- package/icons/journey-light.svg +5 -0
- package/icons/journey.svg +5 -0
- package/icons/key.svg +4 -0
- package/icons/language.svg +3 -0
- package/icons/link.svg +4 -0
- package/icons/list.svg +8 -0
- package/icons/locker.svg +8 -0
- package/icons/logout.svg +5 -0
- package/icons/luggage.svg +9 -0
- package/icons/mail.svg +4 -0
- package/icons/meeting-lounge.svg +10 -0
- package/icons/metro.svg +3 -0
- package/icons/middle-seat.svg +7 -0
- package/icons/minus.svg +3 -0
- package/icons/minus24.svg +3 -0
- package/icons/mobile-crossed.svg +7 -0
- package/icons/mobile.svg +6 -0
- package/icons/movingo.svg +3 -0
- package/icons/multimedia.svg +9 -0
- package/icons/near-bicycle.svg +5 -0
- package/icons/near-pet.svg +5 -0
- package/icons/near-wheelchair.svg +8 -0
- package/icons/night-train.svg +4 -0
- package/icons/nonstop.svg +3 -0
- package/icons/occupancy-seat-hover.svg +11 -0
- package/icons/occupancy-seat-selected.svg +11 -0
- package/icons/occupancy-seat.svg +4 -0
- package/icons/oneway.svg +4 -0
- package/icons/pet-crossed.svg +5 -0
- package/icons/pet.svg +7 -0
- package/icons/pic.svg +5 -0
- package/icons/playground.svg +7 -0
- package/icons/plus.svg +4 -0
- package/icons/plus24.svg +4 -0
- package/icons/popup-controls.svg +15 -0
- package/icons/power-socket.svg +6 -0
- package/icons/preview.svg +3 -0
- package/icons/print.svg +5 -0
- package/icons/priority-seat-elderly.svg +6 -0
- package/icons/priority-seat-pregnant.svg +5 -0
- package/icons/profile.svg +4 -0
- package/icons/question.svg +5 -0
- package/icons/radio-filled.svg +4 -0
- package/icons/radio.svg +3 -0
- package/icons/reclining-seat.svg +9 -0
- package/icons/refresh.svg +6 -0
- package/icons/reload.svg +4 -0
- package/icons/remove-circle.svg +3 -0
- package/icons/replace.svg +6 -0
- package/icons/reservation-crossed.svg +4 -0
- package/icons/reservation-mandatory.svg +4 -0
- package/icons/reservation-optional.svg +5 -0
- package/icons/resplus-horizontal.svg +1 -0
- package/icons/resplus.svg +3 -0
- package/icons/restaurant.svg +3 -0
- package/icons/roundtrip.svg +6 -0
- package/icons/save.svg +5 -0
- package/icons/search.svg +4 -0
- package/icons/seat-compartment.svg +8 -0
- package/icons/seat-selected.svg +3 -0
- package/icons/seat.svg +5 -0
- package/icons/sent.svg +34 -0
- package/icons/service-dog.svg +4 -0
- package/icons/settings.svg +4 -0
- package/icons/shift.svg +3 -0
- package/icons/ship.svg +3 -0
- package/icons/show.svg +4 -0
- package/icons/shower.svg +9 -0
- package/icons/silence.svg +6 -0
- package/icons/sink.svg +5 -0
- package/icons/skis.svg +8 -0
- package/icons/sleeper-car-bedding.svg +6 -0
- package/icons/sleeper-car.svg +5 -0
- package/icons/smoking-crossed.svg +6 -0
- package/icons/sort.svg +6 -0
- package/icons/stairs-down.svg +5 -0
- package/icons/stairs-up.svg +5 -0
- package/icons/star-filled.svg +3 -0
- package/icons/star.svg +3 -0
- package/icons/stroller.svg +6 -0
- package/icons/sw-law.svg +5 -0
- package/icons/switch.svg +3 -0
- package/icons/table.svg +6 -0
- package/icons/tag.svg +4 -0
- package/icons/taxi.svg +3 -0
- package/icons/tick.svg +3 -0
- package/icons/ticket-cancel.svg +8 -0
- package/icons/ticket-change.svg +3 -0
- package/icons/ticket-manage.svg +7 -0
- package/icons/ticket-refund.svg +8 -0
- package/icons/ticket-travel-pass.svg +4 -0
- package/icons/ticket.svg +6 -0
- package/icons/tickets.svg +4 -0
- package/icons/train.svg +3 -0
- package/icons/transfer.svg +3 -0
- package/icons/trash.svg +6 -0
- package/icons/triange.svg +17 -0
- package/icons/tv.svg +5 -0
- package/icons/unaccompanied-minor.svg +8 -0
- package/icons/upload.svg +5 -0
- package/icons/usb.svg +9 -0
- package/icons/visibility-off.svg +4 -0
- package/icons/visibility-on.svg +4 -0
- package/icons/voucher.svg +5 -0
- package/icons/wardrobe.svg +4 -0
- package/icons/warning.svg +3 -0
- package/icons/water.svg +5 -0
- package/icons/wc.svg +4 -0
- package/icons/wheelchair-lift-reservation.svg +8 -0
- package/icons/wheelchair-lift.svg +6 -0
- package/icons/wheelchair-ramp.svg +8 -0
- package/icons/wheelchair-space-reservation.svg +13 -0
- package/icons/wheelchair-space.svg +4 -0
- package/icons/wheelchair.svg +5 -0
- package/icons/wifi-crossed.svg +9 -0
- package/icons/wifi.svg +6 -0
- package/index.css +327 -0
- package/index.d.ts +31 -0
- package/index.js +32 -0
- package/mui/Accordion.d.ts +17 -0
- package/mui/Accordion.js +46 -0
- package/mui/Button/index.d.ts +16 -0
- package/mui/Button/index.js +35 -0
- package/mui/Card/CardHeader.d.ts +7 -0
- package/mui/Card/CardHeader.js +43 -0
- package/mui/Card/index.d.ts +4 -0
- package/mui/Card/index.js +4 -0
- package/mui/Checkbox/CheckboxGroup.d.ts +26 -0
- package/mui/Checkbox/CheckboxGroup.js +81 -0
- package/mui/Checkbox/index.d.ts +18 -0
- package/mui/Checkbox/index.js +40 -0
- package/mui/Chip/ChipSecondarySmall.d.ts +10 -0
- package/mui/Chip/ChipSecondarySmall.js +40 -0
- package/mui/CircularProgress/index.d.ts +3 -0
- package/mui/CircularProgress/index.js +36 -0
- package/mui/Collapsible/index.d.ts +9 -0
- package/mui/Collapsible/index.js +66 -0
- package/mui/Counter/index.d.ts +9 -0
- package/mui/Counter/index.js +37 -0
- package/mui/DatePicker/DatePicker.scss +276 -0
- package/mui/DatePicker/DatePickerContext.d.ts +8 -0
- package/mui/DatePicker/DatePickerContext.js +2 -0
- package/mui/DatePicker/DatePickerHeader.d.ts +3 -0
- package/mui/DatePicker/DatePickerHeader.js +63 -0
- package/mui/DatePicker/DatePickerHeaderSelect.d.ts +10 -0
- package/mui/DatePicker/DatePickerHeaderSelect.js +72 -0
- package/mui/DatePicker/DatePickerInput.d.ts +6 -0
- package/mui/DatePicker/DatePickerInput.js +28 -0
- package/mui/DatePicker/TimeInput.d.ts +10 -0
- package/mui/DatePicker/TimeInput.js +63 -0
- package/mui/DatePicker/index.d.ts +52 -0
- package/mui/DatePicker/index.js +187 -0
- package/mui/Dropdown/index.d.ts +22 -0
- package/mui/Dropdown/index.js +90 -0
- package/mui/EditableLabel/index.d.ts +7 -0
- package/mui/EditableLabel/index.js +81 -0
- package/mui/ExternalLink/index.d.ts +8 -0
- package/mui/ExternalLink/index.js +11 -0
- package/mui/FileInput/index.d.ts +27 -0
- package/mui/FileInput/index.js +66 -0
- package/mui/FormControl/index.d.ts +23 -0
- package/mui/FormControl/index.js +36 -0
- package/mui/FormField/index.d.ts +8 -0
- package/mui/FormField/index.js +12 -0
- package/mui/Icon/index.d.ts +21 -0
- package/mui/Icon/index.js +47 -0
- package/mui/Input/index.d.ts +28 -0
- package/mui/Input/index.js +102 -0
- package/mui/Loader/index.d.ts +9 -0
- package/mui/Loader/index.js +47 -0
- package/mui/Modal/index.d.ts +16 -0
- package/mui/Modal/index.js +64 -0
- package/mui/Pagination/index.d.ts +6 -0
- package/mui/Pagination/index.js +23 -0
- package/mui/Paper/index.d.ts +4 -0
- package/mui/Paper/index.js +3 -0
- package/mui/Popper/index.d.ts +13 -0
- package/mui/Popper/index.js +139 -0
- package/mui/RadioGroup/index.d.ts +26 -0
- package/mui/RadioGroup/index.js +41 -0
- package/mui/ReadOnlyField/index.d.ts +8 -0
- package/mui/ReadOnlyField/index.js +35 -0
- package/mui/Select/index.d.ts +47 -0
- package/mui/Select/index.js +164 -0
- package/mui/Stepper/StepIconComponent.d.ts +6 -0
- package/mui/Stepper/StepIconComponent.js +93 -0
- package/mui/Stepper/index.d.ts +6 -0
- package/mui/Stepper/index.js +13 -0
- package/mui/Switch/index.d.ts +3 -0
- package/mui/Switch/index.js +2 -0
- package/mui/Tab/index.d.ts +60 -0
- package/mui/Tab/index.js +12 -0
- package/mui/Tabs/index.d.ts +22 -0
- package/mui/Tabs/index.js +70 -0
- package/mui/TimeDurationLabel/index.d.ts +7 -0
- package/mui/TimeDurationLabel/index.js +13 -0
- package/mui/ToggleButton/index.d.ts +4 -0
- package/mui/ToggleButton/index.js +57 -0
- package/mui/ToggleButtonGroup/index.d.ts +25 -0
- package/mui/ToggleButtonGroup/index.js +61 -0
- package/mui/ToggleList/index.d.ts +11 -0
- package/mui/ToggleList/index.js +54 -0
- package/mui/Tooltip/index.d.ts +11 -0
- package/mui/Tooltip/index.js +36 -0
- package/mui/index.d.ts +36 -0
- package/mui/index.js +36 -0
- package/mui/provider.d.ts +9 -0
- package/mui/provider.js +22 -0
- package/mui/theme.d.ts +17 -0
- package/mui/theme.js +1228 -0
- package/package.json +197 -4
- package/services/api.d.ts +28 -0
- package/services/api.js +141 -0
- package/services/index.d.ts +2 -0
- package/services/index.js +2 -0
- package/services/openapi.d.ts +6 -0
- package/services/openapi.js +112 -0
- package/store/index.d.ts +6 -0
- package/store/index.js +1 -0
- package/store/useClassificationOptions.d.ts +3 -0
- package/store/useClassificationOptions.js +2 -0
- package/types.d.ts +2423 -0
- package/utils/array.d.ts +2 -0
- package/utils/array.js +21 -0
- package/utils/auth.d.ts +2 -0
- package/utils/auth.js +31 -0
- package/utils/color.d.ts +29 -0
- package/utils/color.js +132 -0
- package/utils/date.d.ts +40 -0
- package/utils/date.js +51 -0
- package/utils/filter.d.ts +3 -0
- package/utils/filter.js +11 -0
- package/utils/getScrollbarSize.d.ts +1 -0
- package/utils/getScrollbarSize.js +8 -0
- package/utils/index.d.ts +12 -0
- package/utils/index.js +12 -0
- package/utils/input.d.ts +2 -0
- package/utils/input.js +2 -0
- package/utils/knowledge-owl-script.d.ts +64 -0
- package/utils/knowledge-owl-script.js +226 -0
- package/utils/locales.d.ts +3 -0
- package/utils/locales.js +24 -0
- package/utils/noop.d.ts +1 -0
- package/utils/noop.js +1 -0
- package/utils/percentage.d.ts +6 -0
- package/utils/percentage.js +43 -0
- package/utils/redirect.d.ts +1 -0
- package/utils/redirect.js +6 -0
- package/utils/sort.d.ts +21 -0
- package/utils/sort.js +32 -0
- package/utils/storage.d.ts +2 -0
- package/utils/storage.js +2 -0
- package/utils/timeDuration.d.ts +26 -0
- package/utils/timeDuration.js +78 -0
- package/utils/wallClock.d.ts +17 -0
- package/utils/wallClock.js +178 -0
- package/wrappers/ApiInitializer.d.ts +9 -0
- package/wrappers/ApiInitializer.js +21 -0
- package/wrappers/AuthWrapper.d.ts +6 -0
- package/wrappers/AuthWrapper.js +38 -0
- package/wrappers/AxiosErrorsInterceptorWrapper.d.ts +2 -0
- package/wrappers/AxiosErrorsInterceptorWrapper.js +30 -0
- package/README.md +0 -3
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useMemo } from 'react';
|
|
3
|
+
import { metaError } from "./FormField";
|
|
4
|
+
import { useFieldArray } from 'react-final-form-arrays';
|
|
5
|
+
import { validate } from "./validate";
|
|
6
|
+
import { Link, Stack, Typography } from '@mui/material';
|
|
7
|
+
import { Input, Modal } from "../mui";
|
|
8
|
+
import { useModal } from "../hooks";
|
|
9
|
+
import head from 'lodash/head';
|
|
10
|
+
import get from 'lodash/get';
|
|
11
|
+
import keys from 'lodash/keys';
|
|
12
|
+
import values from 'lodash/values';
|
|
13
|
+
import { noop } from "../utils/noop";
|
|
14
|
+
import { useFormContext } from "./";
|
|
15
|
+
import { flatten } from 'nest-deep';
|
|
16
|
+
import { TransError } from "../i18n/trans/error";
|
|
17
|
+
import { TransButton } from "../i18n/trans/button";
|
|
18
|
+
import { TransLabel } from "../i18n/trans/label";
|
|
19
|
+
import { ArrayField } from "./ArrayField";
|
|
20
|
+
export function ModalFieldArray(props) {
|
|
21
|
+
const { name, path, accessor, validate: validateProp, label, modalLabel, disabled, required, validateRequired = true, modalProps, showAllItems, onSave, onClose, } = props;
|
|
22
|
+
const array = useFieldArray(name, {
|
|
23
|
+
validate: validate.compose(validateProp, required &&
|
|
24
|
+
validateRequired &&
|
|
25
|
+
validate.required(_jsx(TransError, { i18nKey: "required" }))),
|
|
26
|
+
});
|
|
27
|
+
const error = metaError(array.meta);
|
|
28
|
+
const { length, value } = array.fields;
|
|
29
|
+
const parsedValue = useMemo(() => {
|
|
30
|
+
if (length === 0)
|
|
31
|
+
return [];
|
|
32
|
+
if (typeof accessor === 'function')
|
|
33
|
+
return (value ?? []).map(accessor);
|
|
34
|
+
return (path ? value.map((value) => get(value, path)) : value) ?? [];
|
|
35
|
+
}, [accessor, length, path, value]);
|
|
36
|
+
const displayValue = useMemo(() => parsedValue[0] ?? '', [parsedValue]);
|
|
37
|
+
const displayLabel = useMemo(() => {
|
|
38
|
+
if (!showAllItems)
|
|
39
|
+
return _jsx(TransLabel, { i18nKey: "plusMore", values: { count: length - 1 } });
|
|
40
|
+
return `+ ${parsedValue.slice(1).join(', ')}`;
|
|
41
|
+
}, [showAllItems, length, parsedValue]);
|
|
42
|
+
const displayError = useMemo(() => {
|
|
43
|
+
if (['string', 'undefined'].includes(typeof error))
|
|
44
|
+
return error;
|
|
45
|
+
return head(values(flatten({ [name]: error })).filter(Boolean));
|
|
46
|
+
}, [error, name]);
|
|
47
|
+
const modal = useModal();
|
|
48
|
+
const { blur, getFieldState } = useFormContext();
|
|
49
|
+
const handleClose = useCallback(async (event, reason) => {
|
|
50
|
+
await onClose?.(event, reason);
|
|
51
|
+
blur(name);
|
|
52
|
+
const { error: errors } = getFieldState(name);
|
|
53
|
+
if (Array.isArray(errors) && reason === 'action') {
|
|
54
|
+
keys(flatten({ [name]: errors })).forEach((key) => blur(key));
|
|
55
|
+
}
|
|
56
|
+
else
|
|
57
|
+
modal.onClose();
|
|
58
|
+
}, [blur, getFieldState, modal, name, onClose]);
|
|
59
|
+
return (_jsxs(_Fragment, { children: [_jsx(Input, { label: label, value: displayValue ?? '', onChange: noop, disabled: true, required: required, helper: _jsxs(Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", component: "span", children: [typeof length === 'number' && Boolean(length > 1) ? (_jsx(Typography, { variant: "body2", component: "span", children: displayLabel })) : (_jsx("span", {})), _jsx(Link, { href: "#", underline: "none", color: disabled && 'gray', ...(!disabled && { onClick: modal.onOpen }), "data-testid": "add-edit-anchor", children: _jsx(TransButton, { i18nKey: "addEdit" }) })] }), error: !modal.open && displayError }), _jsx(Modal, { title: modalLabel ?? label, open: modal.open, onClose: handleClose, actionButton: {
|
|
60
|
+
onClick: onSave,
|
|
61
|
+
}, maxWidth: "xs", fullWidth: true, keepMounted: true, ...modalProps, children: _jsx(ArrayField, { ...props, label: null }) })] }));
|
|
62
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { GridProps } from '@mui/material';
|
|
2
|
+
import { DateFieldProps } from "./";
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { TimeDuration } from "../utils";
|
|
5
|
+
interface PeriodFieldSpacingProps {
|
|
6
|
+
spacing?: number;
|
|
7
|
+
}
|
|
8
|
+
declare type GridPeriodFieldProps = (GridProps & PeriodFieldSpacingProps) | false;
|
|
9
|
+
interface PeriodFieldWrapperProps {
|
|
10
|
+
grid?: GridPeriodFieldProps;
|
|
11
|
+
isSeparatorMargin?: boolean;
|
|
12
|
+
componentFrom: ReactNode;
|
|
13
|
+
componentTo: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export interface PeriodFieldProps<TValue extends string, Range extends boolean> {
|
|
16
|
+
from: DateFieldProps<TValue, Range>;
|
|
17
|
+
to: DateFieldProps<TValue, Range>;
|
|
18
|
+
maxRange?: TimeDuration;
|
|
19
|
+
grid?: GridPeriodFieldProps;
|
|
20
|
+
timeOnly?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare function PeriodField<TValue extends string, Range extends boolean>({ from, to, maxRange, grid, timeOnly, }: PeriodFieldProps<TValue, Range>): JSX.Element;
|
|
23
|
+
export declare function PeriodGridWrapper({ grid, isSeparatorMargin, componentFrom, componentTo, }: PeriodFieldWrapperProps): JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Grid } from '@mui/material';
|
|
3
|
+
import { makeStyles } from '@mui/styles';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { addSeconds, setDay } from 'date-fns';
|
|
6
|
+
import { DateField, FormField } from "./";
|
|
7
|
+
import { isString } from 'lodash';
|
|
8
|
+
import { useCallback, useMemo } from 'react';
|
|
9
|
+
import { TimeUnit, convertTimeDurationToNumber, getEndOfDate, getStartOfDate, parseDateString, } from "../utils";
|
|
10
|
+
import { currentLocaleConfiguration } from "../i18n";
|
|
11
|
+
const DEFAULT_GRID_ITEMS = 2;
|
|
12
|
+
const DEFAULT_GRID_SPACING = 2;
|
|
13
|
+
const useStylesPeriodField = makeStyles(() => ({
|
|
14
|
+
field: {
|
|
15
|
+
marginTop: '24px',
|
|
16
|
+
},
|
|
17
|
+
}), {
|
|
18
|
+
name: 'PeriodField',
|
|
19
|
+
});
|
|
20
|
+
const getValueForPeriodLimit = ({ value, isPeriodTo, maxRange, }) => {
|
|
21
|
+
if (isString(value)) {
|
|
22
|
+
return parseDateString(value);
|
|
23
|
+
}
|
|
24
|
+
if (maxRange) {
|
|
25
|
+
return parseDateString(isPeriodTo ? value.to : value.from);
|
|
26
|
+
}
|
|
27
|
+
return parseDateString(isPeriodTo ? value.from : value.to);
|
|
28
|
+
};
|
|
29
|
+
const getValueForRangeLimit = ({ value, isPeriodTo, maxRange, }) => {
|
|
30
|
+
if (!value || !isString(value) || !maxRange) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
const limit = getValueForPeriodLimit({ value, isPeriodTo, maxRange });
|
|
34
|
+
const days = limit.getDay();
|
|
35
|
+
const hours = limit.getHours();
|
|
36
|
+
const rangeInSeconds = convertTimeDurationToNumber(maxRange, TimeUnit.SECONDS);
|
|
37
|
+
return addSeconds(hours !== 0
|
|
38
|
+
? setDay(getStartOfDate(limit), days + 1)
|
|
39
|
+
: setDay(getEndOfDate(limit), days - 1), isPeriodTo ? rangeInSeconds : -rangeInSeconds);
|
|
40
|
+
};
|
|
41
|
+
export function PeriodField({ from, to, maxRange, grid = {}, timeOnly = false, }) {
|
|
42
|
+
const isFromMargin = useMemo(() => Boolean(!from.label && to.label), [from.label, to.label]);
|
|
43
|
+
const isToMargin = useMemo(() => Boolean(!to.label && from.label), [from.label, to.label]);
|
|
44
|
+
const isSeparatorMargin = useMemo(() => Boolean(to.label || from.label), [from.label, to.label]);
|
|
45
|
+
const classes = useStylesPeriodField();
|
|
46
|
+
const renderPeriodFromField = useCallback(() => {
|
|
47
|
+
const { className, ...rest } = from;
|
|
48
|
+
return (_jsx(FormField, { name: to.name, subscription: { value: true }, render: ({ input: { value } }) => (_jsx(DateField, { ...(timeOnly
|
|
49
|
+
? {
|
|
50
|
+
showTimeSelect: true,
|
|
51
|
+
showTimeSelectOnly: true,
|
|
52
|
+
dateFormat: currentLocaleConfiguration.timeFormat,
|
|
53
|
+
timeFormat: currentLocaleConfiguration.timeFormat,
|
|
54
|
+
timeIntervals: 1,
|
|
55
|
+
}
|
|
56
|
+
: {
|
|
57
|
+
minDate: getValueForRangeLimit({
|
|
58
|
+
value,
|
|
59
|
+
isPeriodTo: false,
|
|
60
|
+
maxRange,
|
|
61
|
+
}),
|
|
62
|
+
maxDate: getValueForPeriodLimit({ value, isPeriodTo: false }),
|
|
63
|
+
dateType: 'start',
|
|
64
|
+
}), className: classNames(className, {
|
|
65
|
+
[classes.field]: isFromMargin,
|
|
66
|
+
}), ...rest })) }));
|
|
67
|
+
}, [classes.field, from, isFromMargin, maxRange, to.name, timeOnly]);
|
|
68
|
+
const renderPeriodToField = useCallback(() => {
|
|
69
|
+
const { className, ...rest } = to;
|
|
70
|
+
return (_jsx(FormField, { name: from.name, subscription: { value: true }, render: ({ input: { value } }) => (_jsx(DateField, { ...(timeOnly
|
|
71
|
+
? {
|
|
72
|
+
showTimeSelect: true,
|
|
73
|
+
showTimeSelectOnly: true,
|
|
74
|
+
dateFormat: currentLocaleConfiguration.timeFormat,
|
|
75
|
+
timeFormat: currentLocaleConfiguration.timeFormat,
|
|
76
|
+
timeIntervals: 1,
|
|
77
|
+
}
|
|
78
|
+
: {
|
|
79
|
+
minDate: getValueForPeriodLimit({ value, isPeriodTo: true }),
|
|
80
|
+
maxDate: getValueForRangeLimit({
|
|
81
|
+
value,
|
|
82
|
+
isPeriodTo: true,
|
|
83
|
+
maxRange,
|
|
84
|
+
}),
|
|
85
|
+
dateType: 'end',
|
|
86
|
+
}), className: classNames(className, { [classes.field]: isToMargin }), ...rest })) }));
|
|
87
|
+
}, [classes.field, from.name, isToMargin, maxRange, to, timeOnly]);
|
|
88
|
+
if (grid) {
|
|
89
|
+
return (_jsx(PeriodGridWrapper, { grid: grid, isSeparatorMargin: isSeparatorMargin, componentFrom: renderPeriodFromField(), componentTo: renderPeriodToField() }));
|
|
90
|
+
}
|
|
91
|
+
return (_jsxs(_Fragment, { children: [renderPeriodFromField(), renderPeriodToField()] }));
|
|
92
|
+
}
|
|
93
|
+
const useStylesPeriodGridWrapper = makeStyles((theme) => ({
|
|
94
|
+
root: {
|
|
95
|
+
display: 'flex',
|
|
96
|
+
},
|
|
97
|
+
separator: ({ spacing, isSeparatorMargin }) => ({
|
|
98
|
+
marginTop: isSeparatorMargin ? '30px' : '6px',
|
|
99
|
+
minWidth: theme.spacing(spacing ?? DEFAULT_GRID_SPACING),
|
|
100
|
+
textAlign: 'center',
|
|
101
|
+
}),
|
|
102
|
+
}), {
|
|
103
|
+
name: 'PeriodGridWrapper',
|
|
104
|
+
});
|
|
105
|
+
export function PeriodGridWrapper({ grid, isSeparatorMargin = true, componentFrom, componentTo, }) {
|
|
106
|
+
const classes = useStylesPeriodGridWrapper({
|
|
107
|
+
spacing: grid ? grid.spacing : undefined,
|
|
108
|
+
isSeparatorMargin,
|
|
109
|
+
});
|
|
110
|
+
return (_jsxs(Grid, { item: true, xs: DEFAULT_GRID_ITEMS, className: classes.root, ...grid, children: [componentFrom, _jsx(Box, { className: classes.separator, children: "-" }), componentTo] }));
|
|
111
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormFieldAdapterProps } from "./FormField";
|
|
3
|
+
import { RadioGroupProps } from "../mui/RadioGroup";
|
|
4
|
+
import { RadioProps } from '@mui/material';
|
|
5
|
+
export interface RadioGroupFieldProps<TValue> extends FormFieldAdapterProps<TValue>, Pick<RadioGroupProps, 'options' | 'inline' | 'required' | 'disabled'>, RadioProps {
|
|
6
|
+
name: string;
|
|
7
|
+
nowrap?: boolean;
|
|
8
|
+
readOnly?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function RadioGroupField<TValue>({ name, inline, options, nowrap, readOnly, ...props }: RadioGroupFieldProps<TValue>): JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FormField, metaError } from "./FormField";
|
|
3
|
+
import { parseValue, RadioGroupLabel } from "../mui/RadioGroup";
|
|
4
|
+
import { useOptions } from "../hooks/useOptions";
|
|
5
|
+
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
6
|
+
import { FormControl } from "../mui";
|
|
7
|
+
import FormGroup from '@mui/material/FormGroup';
|
|
8
|
+
import { Radio } from '@mui/material';
|
|
9
|
+
import { useCallback } from 'react';
|
|
10
|
+
export function RadioGroupField({ name, inline, options, nowrap, readOnly, ...props }) {
|
|
11
|
+
const handleFormControlClick = useCallback((event) => readOnly ? event.preventDefault() : undefined, [readOnly]);
|
|
12
|
+
const preparedOptions = useOptions(options);
|
|
13
|
+
return (_jsx(FormField, { name: name, ...props,
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15
|
+
render: ({ input: _, meta, ...field }) => {
|
|
16
|
+
const error = metaError(meta);
|
|
17
|
+
return (_jsx(FormControl, { error: error, ...field, labelComponent: RadioGroupLabel, onClick: handleFormControlClick, children: _jsx(FormGroup, { ...(inline && {
|
|
18
|
+
row: true,
|
|
19
|
+
}), sx: { gap: 1, ...(nowrap && { flexWrap: 'nowrap' }) }, children: preparedOptions.map(({ label, value, disabled }, idx) => (_jsx(FormField, { name: name, type: "radio", value: value, parse: parseValue, render: ({ input }) => (_jsx(FormControlLabel, { label: label, ...input, disabled: disabled, control: _jsx(Radio, { color: error ? 'error' : 'secondary' }) }, idx)) }, idx))) }) }));
|
|
20
|
+
} }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type FC, type ReactNode } from 'react';
|
|
2
|
+
import { type Classifier } from "../dto/classifier";
|
|
3
|
+
import { type FormFieldProps } from "./FormField";
|
|
4
|
+
declare type SearchFieldValue = Classifier<string> | Classifier<number> | Array<Classifier<number>> | Array<Classifier<string>>;
|
|
5
|
+
export interface SearchModalProps<TValue extends SearchFieldValue> {
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
name: string;
|
|
8
|
+
onSubmit: (value: TValue) => void;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
}
|
|
11
|
+
export interface SearchFieldProps<TValue extends SearchFieldValue> extends FormFieldProps<TValue> {
|
|
12
|
+
label: ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ModalSearchFieldProps<TValue extends SearchFieldValue> {
|
|
16
|
+
modal: FC<SearchModalProps<TValue>>;
|
|
17
|
+
}
|
|
18
|
+
export declare const SearchField: <TValue extends SearchFieldValue>(props: SearchFieldProps<TValue> & ModalSearchFieldProps<TValue>) => JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useMemo } from 'react';
|
|
3
|
+
import { Button, IconButton, Stack } from '@mui/material';
|
|
4
|
+
import { useFormContext } from "./";
|
|
5
|
+
import { FormField, metaError, } from "./FormField";
|
|
6
|
+
import { useModal } from "../hooks";
|
|
7
|
+
import { TransButton } from "../i18n/trans/button";
|
|
8
|
+
import { FormControl, Icon } from "../mui";
|
|
9
|
+
import { makeStyles } from '@mui/styles';
|
|
10
|
+
import { TransQty } from "../i18n/trans/qty";
|
|
11
|
+
import { getAccessabilityValue } from "../utils";
|
|
12
|
+
import classNames from 'classnames';
|
|
13
|
+
const useStyles = makeStyles((theme) => ({
|
|
14
|
+
value: {
|
|
15
|
+
whiteSpace: 'nowrap',
|
|
16
|
+
overflow: 'hidden',
|
|
17
|
+
textOverflow: 'ellipsis',
|
|
18
|
+
lineHeight: 1.75,
|
|
19
|
+
marginRight: theme.spacing(),
|
|
20
|
+
},
|
|
21
|
+
more: {
|
|
22
|
+
whiteSpace: 'nowrap',
|
|
23
|
+
lineHeight: 1.75,
|
|
24
|
+
marginRight: theme.spacing(),
|
|
25
|
+
},
|
|
26
|
+
accessibilityButton: {
|
|
27
|
+
border: 'none !important',
|
|
28
|
+
textDecoration: 'underline',
|
|
29
|
+
},
|
|
30
|
+
}), {
|
|
31
|
+
name: 'SearchField',
|
|
32
|
+
});
|
|
33
|
+
function SearchFieldAdapter({ label, modal: ModalComponent, input, meta, className, required, }) {
|
|
34
|
+
const classes = useStyles();
|
|
35
|
+
const { name, value, ...rest } = input;
|
|
36
|
+
const { open: isOpen, onOpen, onClose } = useModal();
|
|
37
|
+
const form = useFormContext();
|
|
38
|
+
const accessibility = useMemo(getAccessabilityValue, []);
|
|
39
|
+
const multiple = useMemo(() => Array.isArray(value), [value]);
|
|
40
|
+
const firstItem = useMemo(() => Array.isArray(value) ? value[0] : value, [value]);
|
|
41
|
+
const itemsLength = useMemo(() => (Array.isArray(value) ? value.length : 1), [value]);
|
|
42
|
+
const error = useMemo(() => metaError(meta), [meta]);
|
|
43
|
+
const handleSubmit = useCallback((value) => {
|
|
44
|
+
form.change(name, value);
|
|
45
|
+
onClose();
|
|
46
|
+
}, [form, name, onClose]);
|
|
47
|
+
return (_jsxs(_Fragment, { children: [_jsx(FormControl, { label: label, error: error, className: className, required: required, children: _jsxs(Stack, { direction: "row", alignItems: "center", className: classNames({ error }), children: [firstItem && _jsx("span", { className: classes.value, children: firstItem.name }), Boolean(itemsLength > 1) && (_jsx("span", { className: classes.more, children: _jsx(TransQty, { i18nKey: "plusMore", values: { num: itemsLength - 1 } }) })), firstItem && !multiple ? (_jsx(IconButton, { onClick: () => form.change(name), children: _jsx(Icon, { name: "close" }) })) : (_jsx(Button, { variant: "text", size: "small", onClick: onOpen, sx: { px: 0, minWidth: 'unset' }, className: classNames({
|
|
48
|
+
[classes.accessibilityButton]: accessibility,
|
|
49
|
+
}), children: _jsx(TransButton, { i18nKey: "addEdit" }) }))] }) }), ModalComponent && (_jsx(ModalComponent, { name: name, isOpen: isOpen, onSubmit: handleSubmit, onClose: onClose, ...rest }))] }));
|
|
50
|
+
}
|
|
51
|
+
export const SearchField = (props) => _jsx(FormField, { component: SearchFieldAdapter, ...props });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FinalFieldAdapterProps, FormFieldProps } from "./FormField";
|
|
3
|
+
import { SelectProps, SelectValue } from "../mui/Select";
|
|
4
|
+
export declare type SelectFieldAdapterProps<TValue extends SelectValue, Multi extends boolean> = FinalFieldAdapterProps<TValue, HTMLDivElement> & SelectProps<TValue, Multi>;
|
|
5
|
+
export interface SelectFieldProps<TValue extends SelectValue, Multi extends boolean> extends SelectProps<TValue, Multi>, Omit<FormFieldProps<TValue>, 'value' | 'multiple'> {
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const SelectField: <TValue extends SelectValue, Multi extends boolean = false>(props: SelectFieldProps<TValue, Multi>) => JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import { FormField, metaError, } from "./FormField";
|
|
4
|
+
import { Select } from "../mui/Select";
|
|
5
|
+
import _kebabCase from 'lodash/kebabCase';
|
|
6
|
+
function SelectFieldAdapter({ input, meta, onChange, ...props }) {
|
|
7
|
+
const handleChange = useCallback((value) => {
|
|
8
|
+
input.onChange(value);
|
|
9
|
+
onChange?.(value);
|
|
10
|
+
}, [input, onChange]);
|
|
11
|
+
return (_jsx(Select, { labelPosition: "top", ...input, ...props, onChange: handleChange, multiple: input.multiple, error: metaError(meta), "data-testid": `${input.name ? _kebabCase(input.name) + '-' : ''}select-field` }));
|
|
12
|
+
}
|
|
13
|
+
export const SelectField = (props) => _jsx(FormField, { component: SelectFieldAdapter, ...props });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SelectFieldProps } from "./";
|
|
3
|
+
import { BusinessEntityType } from "../hooks";
|
|
4
|
+
import { BusinessEntity } from "../dto/businessEntity";
|
|
5
|
+
import { SelectValue } from "../mui/Select";
|
|
6
|
+
export interface SelectOwnerFieldProps<D extends SelectValue, Multi extends boolean = false> extends Partial<SelectFieldProps<D, Multi>> {
|
|
7
|
+
businessEntities: Array<BusinessEntity<D>>;
|
|
8
|
+
allowedBusinessEntityTypes: Array<BusinessEntityType>;
|
|
9
|
+
name?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const SelectOwnerField: <D extends SelectValue, Multi extends boolean = false>({ businessEntities, allowedBusinessEntityTypes, name, ...props }: SelectOwnerFieldProps<D, Multi>) => JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { TransField } from "../i18n/trans/field";
|
|
4
|
+
import { SelectField } from "./";
|
|
5
|
+
import { useAllowedBusinessEntities } from "../hooks";
|
|
6
|
+
import { makeClassificationOptions } from "../helpers";
|
|
7
|
+
export const SelectOwnerField = ({ businessEntities, allowedBusinessEntityTypes, name = 'ownerId', ...props }) => {
|
|
8
|
+
const allowedBusinessEntities = useAllowedBusinessEntities(businessEntities, allowedBusinessEntityTypes);
|
|
9
|
+
const options = useMemo(() => makeClassificationOptions(allowedBusinessEntities), [allowedBusinessEntities]);
|
|
10
|
+
return (_jsx(SelectField, { name: name, label: _jsx(TransField, { i18nKey: "owner" }), options: options, required: true, ...props }));
|
|
11
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReactNode, FC } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
name: string;
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
required?: boolean;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
/**
|
|
8
|
+
* When true, allows selecting multiple stops. Renders chips in the autocomplete
|
|
9
|
+
* and passes the modal in multi-select mode. Form value becomes Array<StopOption>.
|
|
10
|
+
*/
|
|
11
|
+
multiple?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* List of stop ids that should be fetched when first rendering the component.
|
|
14
|
+
*/
|
|
15
|
+
initialStopIds?: Array<number>;
|
|
16
|
+
/**
|
|
17
|
+
* List of stop guids that should be fetched when first rendering the component.
|
|
18
|
+
* Use this when stop identifiers are UUIDs instead of numeric IDs.
|
|
19
|
+
*/
|
|
20
|
+
initialStopGuids?: Array<string>;
|
|
21
|
+
}
|
|
22
|
+
export interface StopOption {
|
|
23
|
+
id: number;
|
|
24
|
+
guid: string;
|
|
25
|
+
label: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const StopSelectWithSearch: FC<Props>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect, useMemo, useCallback, useRef, } from 'react';
|
|
3
|
+
import { Autocomplete, TextField, CircularProgress, IconButton, } from '@mui/material';
|
|
4
|
+
import _debounce from 'lodash/debounce';
|
|
5
|
+
import _isEqual from 'lodash/isEqual';
|
|
6
|
+
import { api } from "../../services";
|
|
7
|
+
import qs from 'qs';
|
|
8
|
+
import { FormField } from "../FormField";
|
|
9
|
+
import { FormControl, Icon } from "../../mui";
|
|
10
|
+
import { useField } from 'react-final-form';
|
|
11
|
+
import { useModal } from "../../hooks";
|
|
12
|
+
import { StopsSelectModal, } from "./StopsSelectModal";
|
|
13
|
+
import Box from '@mui/material/Box';
|
|
14
|
+
import { useTranslation } from "../../hooks/useTranslation";
|
|
15
|
+
export const StopSelectWithSearch = ({ name, label, required = false, placeholder, multiple = false, initialStopIds, initialStopGuids, }) => {
|
|
16
|
+
const { t } = useTranslation();
|
|
17
|
+
const { input: fieldInput } = useField(name, {
|
|
18
|
+
subscription: { value: true },
|
|
19
|
+
});
|
|
20
|
+
const [value, setValue] = useState(multiple ? [] : null);
|
|
21
|
+
const [inputValue, setInputValue] = useState('');
|
|
22
|
+
const [options, setOptions] = useState([]);
|
|
23
|
+
const [loading, setLoading] = useState(false);
|
|
24
|
+
const initialStopsFetchedRef = useRef(false);
|
|
25
|
+
const lastFetchedStopIdsRef = useRef(undefined);
|
|
26
|
+
const lastFetchedInputValueRef = useRef('');
|
|
27
|
+
const { open: isModalOpen, onOpen: onModalOpen, onClose: onModalClose, } = useModal();
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
const isEmpty = multiple
|
|
30
|
+
? !fieldInput.value ||
|
|
31
|
+
(Array.isArray(fieldInput.value) && fieldInput.value.length === 0)
|
|
32
|
+
: !fieldInput.value;
|
|
33
|
+
const hasValue = multiple
|
|
34
|
+
? Array.isArray(value) && value.length > 0
|
|
35
|
+
: Boolean(value);
|
|
36
|
+
if (isEmpty && hasValue) {
|
|
37
|
+
// Form was reset or value was cleared externally
|
|
38
|
+
setValue(multiple ? [] : null);
|
|
39
|
+
setInputValue('');
|
|
40
|
+
initialStopsFetchedRef.current = false;
|
|
41
|
+
lastFetchedStopIdsRef.current = undefined;
|
|
42
|
+
lastFetchedInputValueRef.current = '';
|
|
43
|
+
}
|
|
44
|
+
}, [fieldInput.value, value, multiple]);
|
|
45
|
+
const makeStopOptions = useCallback((items) => items.map((item) => ({
|
|
46
|
+
id: item.id,
|
|
47
|
+
guid: item.guid,
|
|
48
|
+
label: item.name,
|
|
49
|
+
})), []);
|
|
50
|
+
const fetchOptions = useMemo(() => _debounce(async (params) => {
|
|
51
|
+
setLoading(true);
|
|
52
|
+
const { data } = await api.get(`/stops${qs.stringify(params, { addQueryPrefix: true, arrayFormat: 'comma' })}`, {
|
|
53
|
+
baseURL: process.env.REACT_APP_API_LM ||
|
|
54
|
+
import.meta.env?.VITE_APP_API_LM,
|
|
55
|
+
});
|
|
56
|
+
const stopOptions = makeStopOptions(data.items);
|
|
57
|
+
setOptions(stopOptions);
|
|
58
|
+
setLoading(false);
|
|
59
|
+
if (params.stopIds?.length || params.stopGuids?.length) {
|
|
60
|
+
initialStopsFetchedRef.current = true;
|
|
61
|
+
if (stopOptions.length > 0) {
|
|
62
|
+
setValue(multiple ? stopOptions : stopOptions[0]);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, 500), [makeStopOptions, multiple]);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
const trimmedInput = inputValue.trim();
|
|
68
|
+
const hasInitialStopIds = initialStopIds?.length && initialStopIds.length > 0;
|
|
69
|
+
const hasInitialStopGuids = initialStopGuids?.length && initialStopGuids.length > 0;
|
|
70
|
+
const shouldFetchInitialStops = (hasInitialStopIds || hasInitialStopGuids) &&
|
|
71
|
+
(!_isEqual(initialStopIds, lastFetchedStopIdsRef.current) ||
|
|
72
|
+
!initialStopsFetchedRef.current);
|
|
73
|
+
// Only fetch by name if the input value has actually changed
|
|
74
|
+
const shouldFetchByName = trimmedInput && trimmedInput !== lastFetchedInputValueRef.current;
|
|
75
|
+
if (shouldFetchInitialStops) {
|
|
76
|
+
lastFetchedStopIdsRef.current = initialStopIds;
|
|
77
|
+
initialStopsFetchedRef.current = true;
|
|
78
|
+
fetchOptions({
|
|
79
|
+
...(hasInitialStopIds && { stopIds: initialStopIds }),
|
|
80
|
+
...(hasInitialStopGuids && { stopGuids: initialStopGuids }),
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
else if (shouldFetchByName) {
|
|
84
|
+
lastFetchedInputValueRef.current = trimmedInput;
|
|
85
|
+
fetchOptions({ name: trimmedInput, limit: 20 });
|
|
86
|
+
}
|
|
87
|
+
}, [inputValue, fetchOptions, initialStopIds, initialStopGuids, name]);
|
|
88
|
+
const handleModalConfirm = useCallback((stops, input) => {
|
|
89
|
+
if (multiple) {
|
|
90
|
+
const stopOptions = stops.map((stop) => ({
|
|
91
|
+
id: stop.id,
|
|
92
|
+
guid: stop.guid || '',
|
|
93
|
+
label: stop.name,
|
|
94
|
+
}));
|
|
95
|
+
// Merge new selections into options for the autocomplete dropdown
|
|
96
|
+
setOptions((prevOptions) => {
|
|
97
|
+
const existingIds = new Set(prevOptions.map((opt) => opt.id));
|
|
98
|
+
const newOptions = stopOptions.filter((opt) => !existingIds.has(opt.id));
|
|
99
|
+
return [...newOptions, ...prevOptions];
|
|
100
|
+
});
|
|
101
|
+
setValue(stopOptions);
|
|
102
|
+
setInputValue('');
|
|
103
|
+
input.onChange(stopOptions.length > 0 ? stopOptions : undefined);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
const selectedStop = stops[stops.length - 1];
|
|
107
|
+
if (selectedStop) {
|
|
108
|
+
const stopOption = {
|
|
109
|
+
id: selectedStop.id,
|
|
110
|
+
guid: selectedStop.guid || '',
|
|
111
|
+
label: selectedStop.name,
|
|
112
|
+
};
|
|
113
|
+
// Add the new selection to options if it's not already there
|
|
114
|
+
setOptions((prevOptions) => {
|
|
115
|
+
const exists = prevOptions.some((opt) => opt.id === stopOption.id);
|
|
116
|
+
if (exists) {
|
|
117
|
+
return prevOptions;
|
|
118
|
+
}
|
|
119
|
+
return [stopOption, ...prevOptions];
|
|
120
|
+
});
|
|
121
|
+
setValue(stopOption);
|
|
122
|
+
setInputValue(stopOption.label);
|
|
123
|
+
input.onChange(stopOption);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}, [multiple]);
|
|
127
|
+
return (_jsx(FormField, { name: name, render: ({ input }) => (_jsxs(_Fragment, { children: [_jsx(FormControl, { label: label, required: required, children: _jsx(Autocomplete, { multiple: multiple, value: value, freeSolo: false, onChange: (_, newVal) => {
|
|
128
|
+
if (multiple) {
|
|
129
|
+
const arr = newVal;
|
|
130
|
+
setValue(arr);
|
|
131
|
+
input.onChange(arr.length > 0 ? arr : undefined);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
const single = newVal ?? null;
|
|
135
|
+
setValue(single);
|
|
136
|
+
setInputValue(single ? single.label : '');
|
|
137
|
+
input.onChange(single ?? undefined); // undefined will delete key from form values
|
|
138
|
+
// Clear lastFetchedStopIdsRef when clearing the field so that
|
|
139
|
+
// reset will re-fetch and restore the original value
|
|
140
|
+
if (!single) {
|
|
141
|
+
lastFetchedStopIdsRef.current = undefined;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}, isOptionEqualToValue: (opt, val) => opt.id === val.id, inputValue: inputValue, onInputChange: (_, newInput, reason) => {
|
|
145
|
+
// In multiple mode, "reset" fires after chip add — ignore it
|
|
146
|
+
// to keep the search text the user is typing
|
|
147
|
+
if (multiple && reason === 'reset')
|
|
148
|
+
return;
|
|
149
|
+
setInputValue(newInput);
|
|
150
|
+
}, options: options, getOptionLabel: (opt) => opt.label, loading: loading, sx: {
|
|
151
|
+
'& .MuiAutocomplete-clearIndicator': {
|
|
152
|
+
visibility: 'visible',
|
|
153
|
+
},
|
|
154
|
+
}, renderInput: (params) => (_jsx(TextField, { ...params, placeholder: placeholder || t('label.typeToSearchStops'), InputProps: {
|
|
155
|
+
...params.InputProps,
|
|
156
|
+
endAdornment: (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'row' }, children: [loading ? (_jsx(CircularProgress, { size: 20, sx: { mr: 2 } })) : (_jsx(IconButton, { onClick: onModalOpen, size: "small", sx: {
|
|
157
|
+
mr: 2,
|
|
158
|
+
position: 'absolute',
|
|
159
|
+
right: (multiple
|
|
160
|
+
? Array.isArray(value) && value.length > 0
|
|
161
|
+
: Boolean(value))
|
|
162
|
+
? '48px'
|
|
163
|
+
: '24px',
|
|
164
|
+
top: 'calc(50% - 14px)',
|
|
165
|
+
}, "data-testid": `${name}-advanced-search-button`, children: _jsx(Icon, { name: "search" }) })), params.InputProps.endAdornment] })),
|
|
166
|
+
} })) }) }), _jsx(StopsSelectModal, { open: isModalOpen, onClose: onModalClose, multiple: multiple, onConfirm: (stops) => handleModalConfirm(stops, input), initialSelectedStops: multiple
|
|
167
|
+
? value.map((v) => ({
|
|
168
|
+
id: v.id,
|
|
169
|
+
name: v.label,
|
|
170
|
+
guid: v.guid,
|
|
171
|
+
}))
|
|
172
|
+
: value
|
|
173
|
+
? [
|
|
174
|
+
{
|
|
175
|
+
id: value.id,
|
|
176
|
+
name: value.label,
|
|
177
|
+
guid: value.guid,
|
|
178
|
+
},
|
|
179
|
+
]
|
|
180
|
+
: [] })] })) }));
|
|
181
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { FormFieldProps } from "../FormField";
|
|
3
|
+
import { StopsSelectTableRow } from "./StopsSelectModal";
|
|
4
|
+
declare type StopsSelectProps<StopId extends number | string> = {
|
|
5
|
+
label?: ReactNode;
|
|
6
|
+
onConfirm?: (name: string, stops: Array<StopsSelectTableRow<StopId>>) => void;
|
|
7
|
+
unselectableStops?: Array<StopsSelectTableRow<StopId>>;
|
|
8
|
+
staticSelectedStops?: Array<StopsSelectTableRow<StopId>>;
|
|
9
|
+
hasDisabledRows?: boolean;
|
|
10
|
+
showOnlySelectedView?: boolean;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
disableAddEdit?: boolean;
|
|
13
|
+
className?: string;
|
|
14
|
+
getAllRowId?: (row: StopsSelectTableRow<StopId>) => string;
|
|
15
|
+
getSelectedRowId?: (row: StopsSelectTableRow<StopId>) => string;
|
|
16
|
+
};
|
|
17
|
+
declare type StopsSelectValue = Map<string, StopsSelectTableRow> | Array<StopsSelectTableRow> | StopsSelectTableRow | null | undefined;
|
|
18
|
+
export declare const StopsSelect: <TValue extends StopsSelectValue, StopId extends string | number>(props: FormFieldProps<TValue, HTMLElement, TValue, import("react-final-form").FieldRenderProps<TValue, HTMLElement, TValue>> & StopsSelectProps<StopId>) => JSX.Element;
|
|
19
|
+
export {};
|