@opentripplanner/core-utils
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.createChainableTypeChecker = createChainableTypeChecker; | ||
exports.userLocationType = exports.geocodedFeatureType = exports.configuredCompanyType = exports.configuredModesType = exports.configuredModeType = exports.modeSelectorOptionsType = exports.modeOptionType = exports.latlngType = exports.stationType = exports.transitiveDataType = exports.stopLayerStopType = exports.transitIndexStopWithRoutes = exports.timeOptionsType = exports.locationType = exports.itineraryType = exports.fareType = exports.legType = exports.placeType = exports.stepsType = exports.encodedPolylineType = exports.configType = exports.vehicleRentalMapOverlaySymbolsType = exports.transitVehicleType = exports.languageConfigType = exports.transitOperatorType = exports.leafletPathType = exports.companyType = void 0; | ||
exports.userLocationType = exports.geocodedFeatureType = exports.configuredCompanyType = exports.configuredModesType = exports.configuredModeType = exports.modeSelectorOptionsType = exports.modeOptionType = exports.latlngType = exports.stationType = exports.transitiveDataType = exports.stopLayerStopType = exports.transitIndexStopWithRoutes = exports.timeOptionsType = exports.locationType = exports.itineraryType = exports.fareType = exports.legType = exports.placeType = exports.stepsType = exports.encodedPolylineType = exports.configType = exports.vehicleRentalMapOverlaySymbolsType = exports.transitVehicleType = exports.zoomBasedSymbolType = exports.languageConfigType = exports.transitOperatorType = exports.leafletPathType = exports.companyType = void 0; | ||
@@ -74,3 +74,6 @@ var _propTypes = _interopRequireDefault(require("prop-types")); | ||
}); | ||
/** describes the objects from the real-time vehicle service */ | ||
/** | ||
* Defines which symbol to render based on a zoom level, and optionally by entity type. | ||
* (Only one symbol is rendered fo any zoom level.) | ||
*/ | ||
@@ -80,2 +83,36 @@ | ||
const zoomBasedSymbolType = _propTypes.default.shape({ | ||
/** | ||
* A function with the signature (entity: object) => string | ||
* that determines the type of an entity. | ||
* symbolByType and getType must be either be both specified or both ommited. | ||
*/ | ||
getType: _propTypes.default.func, | ||
/** | ||
* The zoom level beginning at which the marker is drawn, | ||
* unless another marker with a higher minZoom is met. | ||
*/ | ||
minZoom: _propTypes.default.number.isRequired, | ||
/** | ||
* The symbol-representing component to draw, with the signature | ||
* ({ entity: object, zoom: number }) => Element | ||
* where entity must have an id attribute and contain coordinates information for placement on the map. | ||
*/ | ||
symbol: _propTypes.default.elementType.isRequired, | ||
/** | ||
* The symbol-representing component to draw for each entity type, | ||
* with the same signature as symbol. If a type returned by getType() is not listed, | ||
* then the component defined in the 'symbol' attribute will be rendered by default. | ||
* symbolByType and getType must be either be both specified or both ommited. | ||
*/ | ||
symbolByType: _propTypes.default.objectOf(_propTypes.default.elementType) | ||
}); | ||
/** describes the objects from the real-time vehicle service */ | ||
exports.zoomBasedSymbolType = zoomBasedSymbolType; | ||
const transitVehicleType = _propTypes.default.shape({ | ||
@@ -100,10 +137,9 @@ routeShortName: _propTypes.default.string, | ||
const vehicleRentalMapOverlaySymbolsType = _propTypes.default.arrayOf(_propTypes.default.shape({ | ||
const vehicleRentalMapOverlaySymbolsType = _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.shape({ | ||
dockStrokeColor: _propTypes.default.string, | ||
fillColor: _propTypes.default.string, | ||
maxZoom: _propTypes.default.number.isRequired, | ||
minZoom: _propTypes.default.number.isRequired, | ||
pixels: _propTypes.default.number, | ||
type: _propTypes.default.string.isRequired | ||
}).isRequired); | ||
}), zoomBasedSymbolType]).isRequired); | ||
/** | ||
@@ -110,0 +146,0 @@ * Represents the expected configuration of the webapp. |
{ | ||
"name": "@opentripplanner/core-utils", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Core functionality that is shared among numerous UI components", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -53,2 +53,33 @@ import PropTypes from "prop-types"; | ||
/** | ||
* Defines which symbol to render based on a zoom level, and optionally by entity type. | ||
* (Only one symbol is rendered fo any zoom level.) | ||
*/ | ||
export const zoomBasedSymbolType = PropTypes.shape({ | ||
/** | ||
* A function with the signature (entity: object) => string | ||
* that determines the type of an entity. | ||
* symbolByType and getType must be either be both specified or both ommited. | ||
*/ | ||
getType: PropTypes.func, | ||
/** | ||
* The zoom level beginning at which the marker is drawn, | ||
* unless another marker with a higher minZoom is met. | ||
*/ | ||
minZoom: PropTypes.number.isRequired, | ||
/** | ||
* The symbol-representing component to draw, with the signature | ||
* ({ entity: object, zoom: number }) => Element | ||
* where entity must have an id attribute and contain coordinates information for placement on the map. | ||
*/ | ||
symbol: PropTypes.elementType.isRequired, | ||
/** | ||
* The symbol-representing component to draw for each entity type, | ||
* with the same signature as symbol. If a type returned by getType() is not listed, | ||
* then the component defined in the 'symbol' attribute will be rendered by default. | ||
* symbolByType and getType must be either be both specified or both ommited. | ||
*/ | ||
symbolByType: PropTypes.objectOf(PropTypes.elementType) | ||
}); | ||
/** describes the objects from the real-time vehicle service */ | ||
@@ -76,10 +107,12 @@ export const transitVehicleType = PropTypes.shape({ | ||
export const vehicleRentalMapOverlaySymbolsType = PropTypes.arrayOf( | ||
PropTypes.shape({ | ||
dockStrokeColor: PropTypes.string, | ||
fillColor: PropTypes.string, | ||
maxZoom: PropTypes.number.isRequired, | ||
minZoom: PropTypes.number.isRequired, | ||
pixels: PropTypes.number, | ||
type: PropTypes.string.isRequired | ||
}).isRequired | ||
PropTypes.oneOfType([ | ||
PropTypes.shape({ | ||
dockStrokeColor: PropTypes.string, | ||
fillColor: PropTypes.string, | ||
minZoom: PropTypes.number.isRequired, | ||
pixels: PropTypes.number, | ||
type: PropTypes.string.isRequired | ||
}), | ||
zoomBasedSymbolType | ||
]).isRequired | ||
); | ||
@@ -86,0 +119,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
222545
6149