mobility-toolbox-js 2.0.0-beta.8 → 2.0.1-beta.13
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/api/RoutingAPI.js +15 -0
- package/api/RoutingAPI.test.js +25 -0
- package/api/StopsAPI.js +12 -0
- package/api/StopsAPI.test.js +22 -0
- package/api/TralisAPI.js +359 -0
- package/api/TralisAPI.test.js +67 -0
- package/{src/api/tralis → api}/TralisAPIUtils.js +2 -32
- package/api/index.js +3 -0
- package/{index.html → api/typedefs.js} +0 -0
- package/common/Tracker.js +93 -0
- package/common/api/HttpAPI.js +30 -0
- package/common/api/HttpAPI.test.js +50 -0
- package/common/api/WebSocketAPI.js +175 -0
- package/{src/api/tralis/WebSocketConnector.test.js → common/api/WebSocketAPI.test.js} +100 -145
- package/common/controls/Control.js +81 -0
- package/{src/common → common}/controls/Control.test.js +32 -43
- package/common/index.js +4 -0
- package/common/layers/Layer.js +213 -0
- package/{src/common → common}/layers/Layer.test.js +185 -244
- package/common/mixins/CopyrightMixin.js +24 -0
- package/common/mixins/SearchMixin.js +110 -0
- package/common/mixins/TralisLayerMixin.js +479 -0
- package/common/styles/index.js +4 -0
- package/{src/common → common}/styles/trackerDefaultStyle.js +39 -175
- package/common/styles/trackerDelayStyle.js +8 -0
- package/{src/common → common}/styles/trackerSimpleStyle.js +4 -8
- package/{src/common → common}/trackerConfig.js +61 -99
- package/common/trackerConfig.test.js +23 -0
- package/{src/doc/examples/ol-mapbox-layer.md → common/typedefs.js} +0 -0
- package/common/utils/createTrackerFilters.js +56 -0
- package/common/utils/createTrackerFilters.test.js +79 -0
- package/{src/common → common}/utils/getMapboxMapCopyrights.js +3 -16
- package/common/utils/getMapboxMapCopyrights.test.js +40 -0
- package/{src/common → common}/utils/getMapboxStyleUrl.js +3 -13
- package/{src/common → common}/utils/getVehiclePosition.js +3 -33
- package/common/utils/index.js +5 -0
- package/common/utils/removeDuplicate.js +8 -0
- package/common/utils/removeDuplicate.test.js +19 -0
- package/{src/common → common}/utils/sortByDelay.js +2 -7
- package/common/utils/timeUtils.js +20 -0
- package/common/utils/timeUtils.test.js +10 -0
- package/index.js +8 -0
- package/mapbox/controls/CopyrightControl.js +29 -0
- package/mapbox/controls/index.js +1 -0
- package/mapbox/index.js +4 -0
- package/mapbox/layers/Layer.js +57 -0
- package/mapbox/layers/Layer.test.js +182 -0
- package/mapbox/layers/TralisLayer.js +182 -0
- package/{src/mapbox → mapbox}/layers/TralisLayer.test.js +12 -14
- package/mapbox/layers/index.js +2 -0
- package/{src/mapbox → mapbox}/utils.js +7 -21
- package/mbt.js +50444 -0
- package/mbt.js.map +7 -0
- package/mbt.min.js +1005 -0
- package/mbt.min.js.map +7 -0
- package/ol/controls/CopyrightControl.js +42 -0
- package/ol/controls/CopyrightControl.test.js +165 -0
- package/ol/controls/RoutingControl.js +387 -0
- package/ol/controls/RoutingControl.test.js +151 -0
- package/ol/controls/StopFinderControl.js +10 -0
- package/ol/controls/StopFinderControl.test.js +48 -0
- package/ol/controls/index.js +3 -0
- package/ol/index.js +5 -0
- package/ol/layers/Layer.js +88 -0
- package/ol/layers/Layer.test.js +174 -0
- package/ol/layers/MapboxLayer.js +203 -0
- package/{src/ol → ol}/layers/MapboxLayer.test.js +58 -84
- package/ol/layers/MapboxStyleLayer.js +187 -0
- package/{src/ol → ol}/layers/MapboxStyleLayer.test.js +97 -128
- package/ol/layers/MaplibreLayer.js +139 -0
- package/ol/layers/RoutingLayer.js +61 -0
- package/{src/ol → ol}/layers/RoutingLayer.test.js +15 -24
- package/ol/layers/TralisLayer.js +185 -0
- package/ol/layers/TralisLayer.test.js +79 -0
- package/ol/layers/VectorLayer.js +22 -0
- package/{src/ol → ol}/layers/VectorLayer.test.js +34 -45
- package/ol/layers/WMSLayer.js +38 -0
- package/ol/layers/WMSLayer.test.js +76 -0
- package/ol/layers/index.js +8 -0
- package/{src/ol → ol}/styles/fullTrajectoryDelayStyle.js +11 -15
- package/ol/styles/fullTrajectoryStyle.js +43 -0
- package/ol/styles/index.js +2 -0
- package/package.json +34 -74
- package/.babelrc +0 -6
- package/.esdoc.json +0 -17
- package/.eslintignore +0 -1
- package/.github/workflows/conventional-pr-title.yml +0 -21
- package/.github/workflows/cypress.yml +0 -29
- package/.github/workflows/nodejs.yml +0 -28
- package/.husky/commit-msg +0 -4
- package/.husky/post-checkout +0 -4
- package/.husky/post-merge +0 -4
- package/.husky/post-rebase +0 -4
- package/.husky/pre-commit +0 -4
- package/.neutrinorc.js +0 -176
- package/.nvmrc +0 -1
- package/CHANGELOG.md +0 -10
- package/LICENSE +0 -21
- package/__mocks__/mapbox-gl.js +0 -81
- package/__mocks__/maplibre-gl.js +0 -81
- package/commitlint.config.js +0 -1
- package/cypress/fixtures/example.json +0 -5
- package/cypress/integration/examples/api.spec.js +0 -7
- package/cypress/integration/examples/examples.spec.js +0 -7
- package/cypress/integration/examples/navigation.spec.js +0 -29
- package/cypress/plugins/index.js +0 -21
- package/cypress/support/commands.js +0 -25
- package/cypress/support/index.js +0 -20
- package/cypress.json +0 -4
- package/data/fetchRoute.json +0 -292
- package/data/fetchTrajectories.json +0 -18
- package/data/fetchTrajectoryById.json +0 -3
- package/data/fetchTrajectoryStations.json +0 -18
- package/data/stopsSearch.json +0 -15
- package/documentation.yml +0 -4
- package/esdoc/README.md +0 -27
- package/esdoc/plugins/MyPlugin.js +0 -69
- package/esdoc/plugins/dynamic-property-plugin/Plugin.js +0 -50
- package/esdoc/plugins/externals-plugin/Plugin.js +0 -45
- package/esdoc/plugins/externals-plugin/externals.js +0 -96
- package/global-setup.js +0 -3
- package/indexweb.html +0 -49
- package/jest.config.js +0 -5
- package/pull_request_template.md +0 -17
- package/renovate.json +0 -4
- package/scripts/read-pkg-json.js +0 -22
- package/src/api/index.js +0 -3
- package/src/api/routing/RoutingAPI.js +0 -44
- package/src/api/routing/RoutingAPI.test.js +0 -41
- package/src/api/stops/StopsAPI.js +0 -41
- package/src/api/stops/StopsAPI.test.js +0 -34
- package/src/api/tralis/TralisAPI.js +0 -731
- package/src/api/tralis/TralisAPI.test.js +0 -75
- package/src/api/tralis/WebSocketConnector.js +0 -338
- package/src/api/tralis/typedefs.js +0 -81
- package/src/assets/Lato-Black.ttf +0 -0
- package/src/assets/Lato-BlackItalic.ttf +0 -0
- package/src/assets/Lato-Bold.ttf +0 -0
- package/src/assets/Lato-BoldItalic.ttf +0 -0
- package/src/assets/Lato-Italic.ttf +0 -0
- package/src/assets/Lato-Light.ttf +0 -0
- package/src/assets/Lato-LightItalic.ttf +0 -0
- package/src/assets/Lato-Regular.ttf +0 -0
- package/src/assets/Lato-Thin.ttf +0 -0
- package/src/assets/Lato-ThinItalic.ttf +0 -0
- package/src/assets/OFL.txt +0 -93
- package/src/common/Tracker.js +0 -197
- package/src/common/api/api.js +0 -64
- package/src/common/api/api.test.js +0 -68
- package/src/common/controls/Control.js +0 -146
- package/src/common/index.js +0 -5
- package/src/common/layers/Layer.js +0 -404
- package/src/common/mixins/CopyrightMixin.js +0 -48
- package/src/common/mixins/SearchMixin.js +0 -176
- package/src/common/mixins/TralisLayerMixin.js +0 -930
- package/src/common/styles/index.js +0 -4
- package/src/common/styles/trackerDelayStyle.js +0 -17
- package/src/common/trackerConfig.test.js +0 -25
- package/src/common/typedefs.js +0 -23
- package/src/common/utils/createTrackerFilters.js +0 -87
- package/src/common/utils/createTrackerFilters.test.js +0 -95
- package/src/common/utils/getMapboxMapCopyrights.test.js +0 -47
- package/src/common/utils/index.js +0 -5
- package/src/common/utils/removeDuplicate.js +0 -22
- package/src/common/utils/removeDuplicate.test.js +0 -22
- package/src/common/utils/timeUtils.js +0 -44
- package/src/common/utils/timeUtils.test.js +0 -16
- package/src/doc/App.js +0 -116
- package/src/doc/App.scss +0 -51
- package/src/doc/_redirects +0 -2
- package/src/doc/components/CodeSandboxButton.js +0 -103
- package/src/doc/components/Documentation.js +0 -40
- package/src/doc/components/Esdoc/Anchor.js +0 -57
- package/src/doc/components/Esdoc/ClassDoc.js +0 -272
- package/src/doc/components/Esdoc/DeprecatedHTML.js +0 -16
- package/src/doc/components/Esdoc/DetailDocs.js +0 -281
- package/src/doc/components/Esdoc/DetailHTML.js +0 -33
- package/src/doc/components/Esdoc/DirectSubclassHTML.js +0 -30
- package/src/doc/components/Esdoc/DocBuilderUtils.js +0 -694
- package/src/doc/components/Esdoc/DocLinkHTML.js +0 -62
- package/src/doc/components/Esdoc/DocsLinkHTML.js +0 -38
- package/src/doc/components/Esdoc/Esdoc.js +0 -63
- package/src/doc/components/Esdoc/EsdocContent.js +0 -51
- package/src/doc/components/Esdoc/EsdocNavigation.js +0 -13
- package/src/doc/components/Esdoc/EsdocSearch.js +0 -81
- package/src/doc/components/Esdoc/ExperimentalHTML.js +0 -17
- package/src/doc/components/Esdoc/ExtendsChainHTML.js +0 -32
- package/src/doc/components/Esdoc/FileDocLinkHTML.js +0 -60
- package/src/doc/components/Esdoc/IdentifiersDoc.js +0 -113
- package/src/doc/components/Esdoc/IndirectSubclassHTML.js +0 -30
- package/src/doc/components/Esdoc/InheritedSummaryDoc.js +0 -70
- package/src/doc/components/Esdoc/InheritedSummaryHTML.js +0 -38
- package/src/doc/components/Esdoc/MixinClassesHTML.js +0 -29
- package/src/doc/components/Esdoc/NavDoc.js +0 -112
- package/src/doc/components/Esdoc/OverrideMethod.js +0 -44
- package/src/doc/components/Esdoc/OverrideMethodDescription.js +0 -35
- package/src/doc/components/Esdoc/Properties.js +0 -89
- package/src/doc/components/Esdoc/README.md +0 -45
- package/src/doc/components/Esdoc/SignatureHTML.js +0 -123
- package/src/doc/components/Esdoc/SingleDoc.js +0 -31
- package/src/doc/components/Esdoc/SummaryDoc.js +0 -160
- package/src/doc/components/Esdoc/SummaryHTML.js +0 -96
- package/src/doc/components/Esdoc/TypeDocLinkHTML.js +0 -249
- package/src/doc/components/Esdoc/css/identifiers.css +0 -38
- package/src/doc/components/Esdoc/css/search.css +0 -76
- package/src/doc/components/Esdoc/css/style.css +0 -603
- package/src/doc/components/Esdoc/index.js +0 -7
- package/src/doc/components/Example.js +0 -153
- package/src/doc/components/Examples.js +0 -183
- package/src/doc/components/Home.js +0 -106
- package/src/doc/components/TrackerExample.js +0 -38
- package/src/doc/examples/assets/tralis-live-map/index.js +0 -11
- package/src/doc/examples/assets/tralis-live-map/s1kreis.svg +0 -105
- package/src/doc/examples/assets/tralis-live-map/s20kreis.svg +0 -101
- package/src/doc/examples/assets/tralis-live-map/s2kreis.svg +0 -95
- package/src/doc/examples/assets/tralis-live-map/s3kreis.svg +0 -95
- package/src/doc/examples/assets/tralis-live-map/s4kreis.svg +0 -95
- package/src/doc/examples/assets/tralis-live-map/s6kreis.svg +0 -95
- package/src/doc/examples/assets/tralis-live-map/s7kreis.svg +0 -95
- package/src/doc/examples/assets/tralis-live-map/s8kreis.svg +0 -93
- package/src/doc/examples/assets/tralis-live-map/unknown.svg +0 -107
- package/src/doc/examples/mb-copyright.html +0 -26
- package/src/doc/examples/mb-copyright.js +0 -37
- package/src/doc/examples/mb-tracker.html +0 -1
- package/src/doc/examples/mb-tracker.js +0 -39
- package/src/doc/examples/mb-tracker.md +0 -1
- package/src/doc/examples/mb-tralis.html +0 -1
- package/src/doc/examples/mb-tralis.js +0 -34
- package/src/doc/examples/ol-copyright.html +0 -26
- package/src/doc/examples/ol-copyright.js +0 -43
- package/src/doc/examples/ol-mapbox-layer.html +0 -1
- package/src/doc/examples/ol-mapbox-layer.js +0 -28
- package/src/doc/examples/ol-mapbox-style-layer.html +0 -12
- package/src/doc/examples/ol-mapbox-style-layer.js +0 -44
- package/src/doc/examples/ol-query.html +0 -32
- package/src/doc/examples/ol-query.js +0 -83
- package/src/doc/examples/ol-routing.html +0 -26
- package/src/doc/examples/ol-routing.js +0 -59
- package/src/doc/examples/ol-routing.md +0 -1
- package/src/doc/examples/ol-stop-finder.html +0 -15
- package/src/doc/examples/ol-stop-finder.js +0 -31
- package/src/doc/examples/ol-stop-finder.md +0 -1
- package/src/doc/examples/ol-tracker.html +0 -1
- package/src/doc/examples/ol-tracker.js +0 -44
- package/src/doc/examples/ol-tracker.md +0 -1
- package/src/doc/examples/ol-tralis.html +0 -5
- package/src/doc/examples/ol-tralis.js +0 -57
- package/src/doc/examples/tralis-live-map.html +0 -1
- package/src/doc/examples/tralis-live-map.js +0 -51
- package/src/doc/examples/tralis-live-map.md +0 -3
- package/src/doc/examples.js +0 -107
- package/src/doc/img/examples/live_tracker_mb.jpg +0 -0
- package/src/doc/img/examples/live_tracker_munich.jpg +0 -0
- package/src/doc/img/examples/live_tracker_ol.jpg +0 -0
- package/src/doc/img/examples/mapbox.jpg +0 -0
- package/src/doc/img/examples/mapbox_style.jpg +0 -0
- package/src/doc/img/examples/ol-copyright.png +0 -0
- package/src/doc/img/examples/query_objects.jpg +0 -0
- package/src/doc/img/examples/routing.jpg +0 -0
- package/src/doc/img/examples/simple_map.jpg +0 -0
- package/src/doc/img/examples/stops.jpg +0 -0
- package/src/doc/img/favico.ico +0 -0
- package/src/doc/index.js +0 -21
- package/src/iife.js +0 -7
- package/src/index.js +0 -10
- package/src/mapbox/controls/CopyrightControl.js +0 -58
- package/src/mapbox/controls/index.js +0 -2
- package/src/mapbox/index.js +0 -4
- package/src/mapbox/layers/Layer.js +0 -118
- package/src/mapbox/layers/Layer.test.js +0 -202
- package/src/mapbox/layers/TralisLayer.js +0 -329
- package/src/mapbox/layers/index.js +0 -2
- package/src/ol/README.md +0 -0
- package/src/ol/controls/CopyrightControl.js +0 -80
- package/src/ol/controls/CopyrightControl.test.js +0 -211
- package/src/ol/controls/RoutingControl.js +0 -752
- package/src/ol/controls/RoutingControl.test.js +0 -216
- package/src/ol/controls/StopFinderControl.js +0 -38
- package/src/ol/controls/StopFinderControl.test.js +0 -59
- package/src/ol/controls/index.js +0 -3
- package/src/ol/controls/snapshots/RoutingControlRouteGen10.json +0 -58
- package/src/ol/controls/snapshots/RoutingControlRouteGen100.json +0 -292
- package/src/ol/controls/snapshots/RoutingControlRouteGen30.json +0 -69
- package/src/ol/controls/snapshots/RoutingControlRouteGen5.json +0 -58
- package/src/ol/controls/snapshots/RoutingControlRouteOSM.json +0 -759
- package/src/ol/controls/snapshots/RoutingControlStation1.json +0 -60
- package/src/ol/controls/snapshots/RoutingControlStation2.json +0 -49
- package/src/ol/index.js +0 -5
- package/src/ol/layers/Layer.js +0 -193
- package/src/ol/layers/Layer.test.js +0 -197
- package/src/ol/layers/MapboxLayer.js +0 -378
- package/src/ol/layers/MapboxStyleLayer.js +0 -417
- package/src/ol/layers/MaplibreLayer.js +0 -280
- package/src/ol/layers/RoutingLayer.js +0 -91
- package/src/ol/layers/TralisLayer.js +0 -359
- package/src/ol/layers/TralisLayer.test.js +0 -97
- package/src/ol/layers/VectorLayer.js +0 -43
- package/src/ol/layers/WMSLayer.js +0 -80
- package/src/ol/layers/WMSLayer.test.js +0 -84
- package/src/ol/layers/index.js +0 -8
- package/src/ol/styles/fullTrajectoryStyle.js +0 -51
- package/src/ol/styles/index.js +0 -2
- package/src/setupTests.js +0 -15
- package/webpack.config.js +0 -6
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import trackerDefaultStyle from './trackerDefaultStyle';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A tracker style that display the delay as backgroundColor.
|
|
5
|
-
*
|
|
6
|
-
* @param {*} trajectory The trajectory to render.
|
|
7
|
-
* @param {*} viewState The view state of the map.
|
|
8
|
-
* @param {*} options Some options to change the rendering
|
|
9
|
-
* @return a canvas
|
|
10
|
-
*/
|
|
11
|
-
const style = (trajectory, viewState, options) => {
|
|
12
|
-
return trackerDefaultStyle(trajectory, viewState, {
|
|
13
|
-
...options,
|
|
14
|
-
useDelayStyle: true,
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
export default style;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { getTypeIndex } from './trackerConfig';
|
|
2
|
-
|
|
3
|
-
describe('trackerConfig', () => {
|
|
4
|
-
describe('#getTypeIndex()', () => {
|
|
5
|
-
test("retrurn the type is it's not a string", () => {
|
|
6
|
-
const obj = { foo: 'foo' };
|
|
7
|
-
expect(getTypeIndex(obj)).toBe(obj);
|
|
8
|
-
expect(getTypeIndex(0)).toBe(0);
|
|
9
|
-
expect(getTypeIndex(null)).toBe(null);
|
|
10
|
-
expect(getTypeIndex(undefined)).toBe(undefined);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
test('find good index for new tracker values', () => {
|
|
14
|
-
expect(getTypeIndex('tram')).toBe(0);
|
|
15
|
-
expect(getTypeIndex('subway')).toBe(1);
|
|
16
|
-
expect(getTypeIndex('bus')).toBe(3);
|
|
17
|
-
expect(getTypeIndex('ferry')).toBe(4);
|
|
18
|
-
expect(getTypeIndex('cablecar')).toBe(5);
|
|
19
|
-
expect(getTypeIndex('gondola')).toBe(6);
|
|
20
|
-
expect(getTypeIndex('funicular')).toBe(7);
|
|
21
|
-
expect(getTypeIndex('coach')).toBe(8);
|
|
22
|
-
expect(getTypeIndex('rail')).toBe(9);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
});
|
package/src/common/typedefs.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {function} FilterFunction
|
|
3
|
-
* @param {Object} vehicle Vehicle to filter.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @typedef {Object} ViewState
|
|
8
|
-
* @property {number} time A time in ms.
|
|
9
|
-
* @property {number[2]} center A center in mercator coordinate.
|
|
10
|
-
* @property {number[4]} extent An Extent in mercator coordinates.
|
|
11
|
-
* @property {number[2]} size A size ([width, height]).
|
|
12
|
-
* @property {number} rotation A rotation in radians.
|
|
13
|
-
* @property {number} resolution A resolution.
|
|
14
|
-
* @property {number} zoom A zoom level.
|
|
15
|
-
* @property {number} pixelRatio A pixel ratio.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @typedef {Object} FeatureInfo
|
|
20
|
-
* @property {Layer} layer A layer.
|
|
21
|
-
* @property {ol/Feature~Feature[]} features An array of features.
|
|
22
|
-
* @property {number[2]} coordinate The coordinate where to find the featue.
|
|
23
|
-
*/
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Return a filter functions based on some parameters of a vehicle.
|
|
3
|
-
*
|
|
4
|
-
* @param {string|Array<string>} line - A list of vehicle's name to filter. Names can be separated by a comma. Ex: 'S1,S2,S3'
|
|
5
|
-
* @param {string|Array<string} route - A list of vehicle's route (contained in routeIdentifier property) to filter. Indentifiers can be separated by a comma. Ex: 'id1,id2,id3'
|
|
6
|
-
* @param {string|Array<string} operator A list of vehicle's operator to filter. Operators can be separated by a comma. Ex: 'SBB,DB'
|
|
7
|
-
* @param {Regexp} regexLine - A regex aplly of vehcile's name.
|
|
8
|
-
* @private
|
|
9
|
-
*/
|
|
10
|
-
const createFilters = (line, route, operator, regexLine) => {
|
|
11
|
-
const filterList = [];
|
|
12
|
-
|
|
13
|
-
if (!line && !route && !operator && !regexLine) {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (regexLine) {
|
|
18
|
-
const regexLineList =
|
|
19
|
-
typeof regexLine === 'string' ? [regexLine] : regexLine;
|
|
20
|
-
const lineFilter = (item) => {
|
|
21
|
-
const name =
|
|
22
|
-
item.properties.name ||
|
|
23
|
-
(item.properties.line && item.properties.line.name) ||
|
|
24
|
-
'';
|
|
25
|
-
if (!name) {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
return regexLineList.some((regexStr) =>
|
|
29
|
-
new RegExp(regexStr, 'i').test(name),
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
filterList.push(lineFilter);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (line) {
|
|
36
|
-
const lineFiltersList = typeof line === 'string' ? line.split(',') : line;
|
|
37
|
-
const lineList = lineFiltersList.map((l) =>
|
|
38
|
-
l.replace(/\s+/g, '').toUpperCase(),
|
|
39
|
-
);
|
|
40
|
-
const lineFilter = (item) => {
|
|
41
|
-
const { line: linee, name } = item.properties;
|
|
42
|
-
const lineName = (name || (linee && linee.name) || '').toUpperCase();
|
|
43
|
-
if (!lineName) {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
return lineList.includes(lineName);
|
|
47
|
-
};
|
|
48
|
-
filterList.push(lineFilter);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (route) {
|
|
52
|
-
const routes = typeof route === 'string' ? route.split(',') : route;
|
|
53
|
-
const routeList = routes.map((item) => parseInt(item, 10));
|
|
54
|
-
const routeFilter = (item) => {
|
|
55
|
-
const routeId = parseInt(
|
|
56
|
-
item.properties.routeIdentifier.split('.')[0],
|
|
57
|
-
10,
|
|
58
|
-
);
|
|
59
|
-
return routeList.includes(routeId);
|
|
60
|
-
};
|
|
61
|
-
filterList.push(routeFilter);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (operator) {
|
|
65
|
-
const operatorList = typeof operator === 'string' ? [operator] : operator;
|
|
66
|
-
const operatorFilter = (item) =>
|
|
67
|
-
operatorList.some((op) =>
|
|
68
|
-
new RegExp(op, 'i').test(item.properties.operator),
|
|
69
|
-
);
|
|
70
|
-
filterList.push(operatorFilter);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (!filterList.length) {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return (t) => {
|
|
78
|
-
for (let i = 0; i < filterList.length; i += 1) {
|
|
79
|
-
if (!filterList[i](t)) {
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return true;
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export default createFilters;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import createTrackerFilters from './createTrackerFilters';
|
|
2
|
-
|
|
3
|
-
const u1 = {
|
|
4
|
-
properties: {
|
|
5
|
-
routeIdentifier: '001.000827.004:7',
|
|
6
|
-
operator: 'FoO',
|
|
7
|
-
line: {
|
|
8
|
-
name: 'U1',
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
const ireta = {
|
|
13
|
-
properties: {
|
|
14
|
-
routeIdentifier: '0022.000827.004:7',
|
|
15
|
-
operator: 'BAR',
|
|
16
|
-
line: {
|
|
17
|
-
name: 'IRETA',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
const arb = {
|
|
22
|
-
properties: {
|
|
23
|
-
routeIdentifier: '00333.000827.004:7',
|
|
24
|
-
operator: 'qux',
|
|
25
|
-
line: {
|
|
26
|
-
name: 'ARB',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const trajectories = [u1, ireta, arb];
|
|
32
|
-
|
|
33
|
-
describe('#createTrackerFilter()', () => {
|
|
34
|
-
test('returns null', () => {
|
|
35
|
-
const filterFunc = createTrackerFilters();
|
|
36
|
-
expect(filterFunc).toBe(null);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
describe('using line', () => {
|
|
40
|
-
test('as string', () => {
|
|
41
|
-
const filterFunc = createTrackerFilters('u1,foo');
|
|
42
|
-
expect(trajectories.filter(filterFunc)).toEqual([u1]);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
test('as array of string', () => {
|
|
46
|
-
const filterFunc = createTrackerFilters(['u1', 'foo', 'IRETA']);
|
|
47
|
-
expect(trajectories.filter(filterFunc)).toEqual([u1, ireta]);
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
describe('using route identifier', () => {
|
|
52
|
-
test('as string', () => {
|
|
53
|
-
const filterFunc = createTrackerFilters(null, '1,foo');
|
|
54
|
-
expect(trajectories.filter(filterFunc)).toEqual([u1]);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
test('as array of string', () => {
|
|
58
|
-
const filterFunc = createTrackerFilters(null, ['22', 'foo', '1']);
|
|
59
|
-
expect(trajectories.filter(filterFunc)).toEqual([u1, ireta]);
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
describe('using operator', () => {
|
|
64
|
-
test('as string', () => {
|
|
65
|
-
const filterFunc = createTrackerFilters(null, null, 'foo');
|
|
66
|
-
expect(trajectories.filter(filterFunc)).toEqual([u1]);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test('as array of string', () => {
|
|
70
|
-
const filterFunc = createTrackerFilters(null, null, ['bar', 'foo', '1']);
|
|
71
|
-
expect(trajectories.filter(filterFunc)).toEqual([u1, ireta]);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
describe('using regexLine', () => {
|
|
76
|
-
test('as string', () => {
|
|
77
|
-
const filterFunc = createTrackerFilters(
|
|
78
|
-
null,
|
|
79
|
-
null,
|
|
80
|
-
null,
|
|
81
|
-
'^(S|R$|RE|PE|D|IRE|RB|TER)',
|
|
82
|
-
);
|
|
83
|
-
expect(trajectories.filter(filterFunc)).toEqual([ireta]);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
test('as array of string', () => {
|
|
87
|
-
const filterFunc = createTrackerFilters(null, null, null, [
|
|
88
|
-
'^IR',
|
|
89
|
-
'^ARB$',
|
|
90
|
-
'foo',
|
|
91
|
-
]);
|
|
92
|
-
expect(trajectories.filter(filterFunc)).toEqual([ireta, arb]);
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import getMapboxMapCopyrights from './getMapboxMapCopyrights';
|
|
2
|
-
|
|
3
|
-
describe('getMapboxMapCopyrights()', () => {
|
|
4
|
-
test('returns an empty array if map is not defined', () => {
|
|
5
|
-
expect(getMapboxMapCopyrights().length).toBe(0);
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
test('returns an empty array if map.style is not defined', () => {
|
|
9
|
-
expect(getMapboxMapCopyrights({}).length).toBe(0);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
test('returns non depluicated copyrights in an array', () => {
|
|
13
|
-
expect(
|
|
14
|
-
getMapboxMapCopyrights({
|
|
15
|
-
style: {
|
|
16
|
-
sourceCaches: {
|
|
17
|
-
used: {
|
|
18
|
-
used: true,
|
|
19
|
-
getSource() {
|
|
20
|
-
return {
|
|
21
|
-
attribution:
|
|
22
|
-
'<a href="https://www.openmaptiles.org/" target="_blank">© OpenMapTiles</a> <a href="https://www.openstreetmap.org/about/" target="_blank">© OpenStreetMap contributors</a>',
|
|
23
|
-
};
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
'not used': {
|
|
27
|
-
used: false,
|
|
28
|
-
},
|
|
29
|
-
'also used': {
|
|
30
|
-
used: true,
|
|
31
|
-
getSource() {
|
|
32
|
-
return {
|
|
33
|
-
attribution:
|
|
34
|
-
'<a href="https://www.openmaptiles.org/" target="_blank">© OpenMapTiles</a> <a href="https://www.imagico.de/" target="_blank">© imagico</a>',
|
|
35
|
-
};
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
}),
|
|
41
|
-
).toEqual([
|
|
42
|
-
'<a href="https://www.openmaptiles.org/" target="_blank">© OpenMapTiles</a>',
|
|
43
|
-
'<a href="https://www.openstreetmap.org/about/" target="_blank">© OpenStreetMap contributors</a>',
|
|
44
|
-
'<a href="https://www.imagico.de/" target="_blank">© imagico</a>',
|
|
45
|
-
]);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { default as getMapboxStyleUrl } from './getMapboxStyleUrl';
|
|
2
|
-
export { default as getMapboxMapCopyrights } from './getMapboxMapCopyrights';
|
|
3
|
-
export { default as removeDuplicate } from './removeDuplicate';
|
|
4
|
-
export * from './timeUtils';
|
|
5
|
-
export { default as sortByDelay } from './sortByDelay';
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This function remove duplicates lower case string value of an array.
|
|
3
|
-
* It removes also null, undefined or non string values.
|
|
4
|
-
*
|
|
5
|
-
* @param {array} array Array of values.
|
|
6
|
-
* @ignore
|
|
7
|
-
*/
|
|
8
|
-
const removeDuplicate = (array) => {
|
|
9
|
-
const arrWithoutEmptyValues = array.filter(
|
|
10
|
-
(val) => val !== undefined && val !== null && val.trim && val.trim(),
|
|
11
|
-
);
|
|
12
|
-
const lowerCasesValues = arrWithoutEmptyValues.map((str) =>
|
|
13
|
-
str.toLowerCase(),
|
|
14
|
-
);
|
|
15
|
-
const uniqueLowerCaseValues = [...new Set(lowerCasesValues)];
|
|
16
|
-
const uniqueValues = uniqueLowerCaseValues.map((uniqueStr) =>
|
|
17
|
-
arrWithoutEmptyValues.find((str) => str.toLowerCase() === uniqueStr),
|
|
18
|
-
);
|
|
19
|
-
return uniqueValues;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export default removeDuplicate;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import removeDuplicate from './removeDuplicate';
|
|
2
|
-
|
|
3
|
-
describe('removeDuplicate()', () => {
|
|
4
|
-
test('removes duplicates', () => {
|
|
5
|
-
expect(
|
|
6
|
-
removeDuplicate([
|
|
7
|
-
'a',
|
|
8
|
-
' ',
|
|
9
|
-
' ',
|
|
10
|
-
'b',
|
|
11
|
-
'a',
|
|
12
|
-
undefined,
|
|
13
|
-
null,
|
|
14
|
-
'A',
|
|
15
|
-
0,
|
|
16
|
-
'c',
|
|
17
|
-
'b',
|
|
18
|
-
'B',
|
|
19
|
-
]),
|
|
20
|
-
).toEqual(['a', 'b', 'c']);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get a Date object as UTC date string .
|
|
3
|
-
* ex: 2019 09 01
|
|
4
|
-
* @ignore
|
|
5
|
-
*/
|
|
6
|
-
export const getUTCDateString = (now = new Date()) => {
|
|
7
|
-
let month = (now.getUTCMonth() + 1).toString();
|
|
8
|
-
month = month.length === 1 ? `0${month}` : month;
|
|
9
|
-
let day = now.getUTCDate().toString();
|
|
10
|
-
day = day.length === 1 ? `0${day}` : day;
|
|
11
|
-
|
|
12
|
-
return [now.getUTCFullYear(), month, day].join('');
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Get the UTC time string of Date object.
|
|
17
|
-
* ex: 09:05:01.123
|
|
18
|
-
* @ignore
|
|
19
|
-
*/
|
|
20
|
-
export const getUTCTimeString = (date) =>
|
|
21
|
-
[
|
|
22
|
-
date.getUTCHours(),
|
|
23
|
-
date.getUTCMinutes(),
|
|
24
|
-
`${date.getUTCSeconds()}.${date.getUTCMilliseconds()}`,
|
|
25
|
-
].join(':');
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Returns a string representation of a number, with a zero if the number is lower than 10.
|
|
29
|
-
* @ignore
|
|
30
|
-
*/
|
|
31
|
-
export const pad = (integer) => (integer < 10 ? `0${integer}` : integer);
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Returns a 'hh:mm' string from a time in ms.
|
|
35
|
-
* @param {Number} timeInMs Time in milliseconds.
|
|
36
|
-
* @ignore
|
|
37
|
-
*/
|
|
38
|
-
export const getHoursAndMinutes = (timeInMs) => {
|
|
39
|
-
if (!timeInMs || timeInMs <= 0) {
|
|
40
|
-
return '';
|
|
41
|
-
}
|
|
42
|
-
const date = new Date(timeInMs);
|
|
43
|
-
return `${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
|
44
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { getUTCDateString, getUTCTimeString } from './timeUtils';
|
|
2
|
-
|
|
3
|
-
describe('timeUtils', () => {
|
|
4
|
-
test('getUTCDateString should be correct.', () => {
|
|
5
|
-
expect(getUTCDateString(new Date(2020, 5, 30))).toBe('20200630');
|
|
6
|
-
expect(
|
|
7
|
-
getUTCDateString(new Date('January 1, 2021 00:15:30 GMT+2:00')),
|
|
8
|
-
).toBe('20201231');
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
test('getUTCTimeString should be correct.', () => {
|
|
12
|
-
expect(getUTCTimeString(new Date(2020, 5, 30, 11, 5, 1, 123))).toBe(
|
|
13
|
-
'11:5:1.123',
|
|
14
|
-
);
|
|
15
|
-
});
|
|
16
|
-
});
|
package/src/doc/App.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ThemeProvider, makeStyles } from '@material-ui/core/styles';
|
|
3
|
-
import Container from '@material-ui/core/Container';
|
|
4
|
-
import { Outlet, Routes, Route, Navigate, Link } from 'react-router-dom';
|
|
5
|
-
import { geopsTheme, Header, Footer } from '@geops/geops-ui';
|
|
6
|
-
import Examples from './components/Examples';
|
|
7
|
-
import Example from './components/Example';
|
|
8
|
-
import Documentation from './components/Documentation';
|
|
9
|
-
import Home from './components/Home';
|
|
10
|
-
|
|
11
|
-
import 'typeface-lato';
|
|
12
|
-
import './App.scss';
|
|
13
|
-
|
|
14
|
-
const useStyles = makeStyles({
|
|
15
|
-
content: {
|
|
16
|
-
flexGrow: 1,
|
|
17
|
-
overflowY: 'auto',
|
|
18
|
-
paddingBottom: 115,
|
|
19
|
-
margin: 'auto',
|
|
20
|
-
marginTop: 30,
|
|
21
|
-
},
|
|
22
|
-
documentation: {
|
|
23
|
-
flexGrow: 1,
|
|
24
|
-
overflowY: 'auto',
|
|
25
|
-
padding: 0,
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const tabs = [
|
|
30
|
-
{
|
|
31
|
-
label: 'Home',
|
|
32
|
-
component: Link,
|
|
33
|
-
to: '/home',
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
label: 'API',
|
|
37
|
-
component: Link,
|
|
38
|
-
to: '/api',
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
label: 'Examples',
|
|
42
|
-
component: Link,
|
|
43
|
-
to: '/examples',
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
label: 'Code',
|
|
47
|
-
href: 'https://github.com/geops/mobility-toolbox-js',
|
|
48
|
-
},
|
|
49
|
-
];
|
|
50
|
-
|
|
51
|
-
function Main() {
|
|
52
|
-
return (
|
|
53
|
-
<ThemeProvider theme={geopsTheme}>
|
|
54
|
-
<Header title="mobility-toolbox-js" tabs={tabs} />
|
|
55
|
-
<Outlet />
|
|
56
|
-
<Footer />
|
|
57
|
-
</ThemeProvider>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function App() {
|
|
62
|
-
const classes = useStyles();
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<Routes>
|
|
66
|
-
<Route path="/" element={<Main />}>
|
|
67
|
-
<Route index element={<Navigate to="/home" />} />
|
|
68
|
-
<Route
|
|
69
|
-
index
|
|
70
|
-
path="/home"
|
|
71
|
-
element={
|
|
72
|
-
<Container className={classes.content}>
|
|
73
|
-
<Home />
|
|
74
|
-
</Container>
|
|
75
|
-
}
|
|
76
|
-
/>
|
|
77
|
-
<Route
|
|
78
|
-
path="/examples"
|
|
79
|
-
element={
|
|
80
|
-
<Container className={classes.content}>
|
|
81
|
-
<Examples />
|
|
82
|
-
</Container>
|
|
83
|
-
}
|
|
84
|
-
/>
|
|
85
|
-
<Route
|
|
86
|
-
path="/example/:exampleKey"
|
|
87
|
-
element={
|
|
88
|
-
<Container className={classes.content}>
|
|
89
|
-
<Example />
|
|
90
|
-
</Container>
|
|
91
|
-
}
|
|
92
|
-
/>
|
|
93
|
-
<Route path="/api">
|
|
94
|
-
<Route
|
|
95
|
-
index
|
|
96
|
-
element={
|
|
97
|
-
<Container className={classes.documentation} maxWidth={false}>
|
|
98
|
-
<Documentation />
|
|
99
|
-
</Container>
|
|
100
|
-
}
|
|
101
|
-
/>
|
|
102
|
-
<Route
|
|
103
|
-
path="*"
|
|
104
|
-
element={
|
|
105
|
-
<Container className={classes.documentation} maxWidth={false}>
|
|
106
|
-
<Documentation />
|
|
107
|
-
</Container>
|
|
108
|
-
}
|
|
109
|
-
/>
|
|
110
|
-
</Route>
|
|
111
|
-
</Route>
|
|
112
|
-
</Routes>
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export default App;
|
package/src/doc/App.scss
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
html {
|
|
2
|
-
height: 100%;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
body {
|
|
6
|
-
margin: 0;
|
|
7
|
-
font-family: Lato, Arial, sans-serif;
|
|
8
|
-
color: #353535;
|
|
9
|
-
position: relative;
|
|
10
|
-
min-height: 100%;
|
|
11
|
-
overflow-y: scroll;
|
|
12
|
-
font-size: 18px;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
a {
|
|
16
|
-
text-decoration: none;
|
|
17
|
-
color: #76b833;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
#map a {
|
|
21
|
-
color: initial;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/* geops ui css */
|
|
25
|
-
button.geops-ui {
|
|
26
|
-
color: #fff;
|
|
27
|
-
padding: 5px 15px;
|
|
28
|
-
font-size: 18px;
|
|
29
|
-
box-sizing: border-box;
|
|
30
|
-
transition:
|
|
31
|
-
background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
|
|
32
|
-
box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
|
|
33
|
-
border 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
34
|
-
font-weight: 700;
|
|
35
|
-
line-height: 24px;
|
|
36
|
-
border-radius: 5px;
|
|
37
|
-
text-transform: none;
|
|
38
|
-
background-color: #76b833;
|
|
39
|
-
border: 0;
|
|
40
|
-
outline: none;
|
|
41
|
-
|
|
42
|
-
&:not([disabled]) {
|
|
43
|
-
cursor: pointer;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
&:hover {
|
|
47
|
-
box-shadow: 0 5px 16px #35353540;
|
|
48
|
-
text-decoration: none;
|
|
49
|
-
background-color: #76b833;
|
|
50
|
-
}
|
|
51
|
-
}
|
package/src/doc/_redirects
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { getParameters } from 'codesandbox/lib/api/define';
|
|
4
|
-
import { Button, SvgIcon } from '@material-ui/core';
|
|
5
|
-
import { makeStyles } from '@material-ui/core/styles';
|
|
6
|
-
|
|
7
|
-
const useStyles = makeStyles({
|
|
8
|
-
button: {
|
|
9
|
-
padding: '5px 15px',
|
|
10
|
-
},
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
function CodeSandboxButton({ html, js, extraFiles, ...props }) {
|
|
14
|
-
const classes = useStyles();
|
|
15
|
-
|
|
16
|
-
if (!html || !js) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const dataSB = {
|
|
21
|
-
files: {
|
|
22
|
-
'index.html': {
|
|
23
|
-
content: `${html}<script src="index.js"></script>`,
|
|
24
|
-
},
|
|
25
|
-
'index.js': {
|
|
26
|
-
content: js // eslint-disable-next-line no-template-curly-in-string
|
|
27
|
-
.replaceAll('${window.apiKey}', window.apiKey)
|
|
28
|
-
.replaceAll('window.apiKey', `'${window.apiKey}'`),
|
|
29
|
-
},
|
|
30
|
-
'package.json': {
|
|
31
|
-
content: {
|
|
32
|
-
name: 'vanilla',
|
|
33
|
-
version: '1.0.0',
|
|
34
|
-
description: 'Mobility example starter project',
|
|
35
|
-
main: 'index.html',
|
|
36
|
-
scripts: {
|
|
37
|
-
start: 'parcel index.html --open',
|
|
38
|
-
build: 'parcel build index.html',
|
|
39
|
-
},
|
|
40
|
-
dependencies: {
|
|
41
|
-
'mapbox-gl': '1',
|
|
42
|
-
'maplibre-gl': '2',
|
|
43
|
-
'mobility-toolbox-js': 'latest@beta',
|
|
44
|
-
ol: '6.3.1',
|
|
45
|
-
'query-string': '6.13.1',
|
|
46
|
-
},
|
|
47
|
-
devDependencies: {
|
|
48
|
-
'@babel/core': '7.2.0',
|
|
49
|
-
'parcel-bundler': '^1.6.1',
|
|
50
|
-
},
|
|
51
|
-
keywords: [
|
|
52
|
-
'javascript',
|
|
53
|
-
'starter',
|
|
54
|
-
'mobility-toolbox-js',
|
|
55
|
-
'mobility',
|
|
56
|
-
'toolbox',
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
...extraFiles,
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
const dataSBStr = getParameters(dataSB);
|
|
64
|
-
return (
|
|
65
|
-
<form
|
|
66
|
-
action="https://codesandbox.io/api/v1/sandboxes/define"
|
|
67
|
-
method="POST"
|
|
68
|
-
target="_blank"
|
|
69
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
70
|
-
{...props}
|
|
71
|
-
>
|
|
72
|
-
<input type="hidden" name="parameters" value={dataSBStr} />
|
|
73
|
-
<Button
|
|
74
|
-
type="submit"
|
|
75
|
-
className={classes.button}
|
|
76
|
-
startIcon={
|
|
77
|
-
<SvgIcon fontSize="large">
|
|
78
|
-
<path
|
|
79
|
-
d="M2 6l10.455-6L22.91 6L23 17.95L12.455 24L2 18V6zm2.088 2.481v4.757l3.345 1.86v3.516l3.972 2.296v-8.272L4.088 8.481zm16.739 0l-7.317 4.157v8.272l3.972-2.296V15.1l3.345-1.861V8.48zM5.134 6.601l7.303 4.144l7.32-4.18l-3.871-2.197l-3.41 1.945l-3.43-1.968L5.133 6.6z"
|
|
80
|
-
fill="currentColor"
|
|
81
|
-
/>
|
|
82
|
-
</SvgIcon>
|
|
83
|
-
}
|
|
84
|
-
>
|
|
85
|
-
Edit in Sandbox
|
|
86
|
-
</Button>
|
|
87
|
-
</form>
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
CodeSandboxButton.propTypes = {
|
|
92
|
-
html: PropTypes.string,
|
|
93
|
-
js: PropTypes.string,
|
|
94
|
-
extraFiles: PropTypes.shape(),
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
CodeSandboxButton.defaultProps = {
|
|
98
|
-
html: null,
|
|
99
|
-
js: null,
|
|
100
|
-
extraFiles: {},
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export default React.memo(CodeSandboxButton);
|