@mapsindoors/react-native-maps-indoors-mapbox 0.0.5-beta

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.
Files changed (147) hide show
  1. package/LICENSE +11 -0
  2. package/README.md +178 -0
  3. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  4. package/android/.gradle/7.4/checksums/md5-checksums.bin +0 -0
  5. package/android/.gradle/7.4/checksums/sha1-checksums.bin +0 -0
  6. package/android/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock +0 -0
  7. package/android/.gradle/7.4/dependencies-accessors/gc.properties +0 -0
  8. package/android/.gradle/7.4/executionHistory/executionHistory.bin +0 -0
  9. package/android/.gradle/7.4/executionHistory/executionHistory.lock +0 -0
  10. package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
  11. package/android/.gradle/7.4/fileHashes/fileHashes.bin +0 -0
  12. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  13. package/android/.gradle/7.4/fileHashes/resourceHashesCache.bin +0 -0
  14. package/android/.gradle/7.4/gc.properties +0 -0
  15. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  16. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  17. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  18. package/android/.gradle/file-system.probe +0 -0
  19. package/android/.gradle/vcs-1/gc.properties +0 -0
  20. package/android/.idea/compiler.xml +6 -0
  21. package/android/.idea/gradle.xml +19 -0
  22. package/android/.idea/jarRepositories.xml +45 -0
  23. package/android/.idea/misc.xml +10 -0
  24. package/android/.idea/vcs.xml +6 -0
  25. package/android/README.md +14 -0
  26. package/android/build.gradle +169 -0
  27. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  28. package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  29. package/android/gradle.properties +17 -0
  30. package/android/gradlew +234 -0
  31. package/android/gradlew.bat +89 -0
  32. package/android/local.properties +8 -0
  33. package/android/src/main/AndroidManifest.xml +6 -0
  34. package/android/src/main/java/com/reactlibrary/DirectionsRendererModule.java +207 -0
  35. package/android/src/main/java/com/reactlibrary/DirectionsServiceModule.java +130 -0
  36. package/android/src/main/java/com/reactlibrary/MPDisplayRuleModule.java +816 -0
  37. package/android/src/main/java/com/reactlibrary/MapControlModule.java +661 -0
  38. package/android/src/main/java/com/reactlibrary/MapsIndoorsModule.java +327 -0
  39. package/android/src/main/java/com/reactlibrary/MapsIndoorsPackage.java +46 -0
  40. package/android/src/main/java/com/reactlibrary/MapsIndoorsViewManager.java +119 -0
  41. package/android/src/main/java/com/reactlibrary/UtilsModule.java +165 -0
  42. package/android/src/main/java/com/reactlibrary/models/Bounds.java +19 -0
  43. package/android/src/main/java/com/reactlibrary/models/Filter.java +77 -0
  44. package/android/src/main/java/com/reactlibrary/models/Location.java +17 -0
  45. package/android/src/main/java/com/reactlibrary/models/MPCameraPosition.java +29 -0
  46. package/android/src/main/java/com/reactlibrary/models/MPCameraUpdate.java +92 -0
  47. package/android/src/main/java/com/reactlibrary/models/MPError.java +38 -0
  48. package/android/src/main/java/com/reactlibrary/models/PositionProvider.java +46 -0
  49. package/android/src/main/java/com/reactlibrary/models/PositionResult.java +117 -0
  50. package/android/src/main/java/com/reactlibrary/models/Query.java +30 -0
  51. package/android/src/main/res/values/google_maps_api_key.xml +4 -0
  52. package/android/src/main/res/values/mapbox_api_key.xml +5 -0
  53. package/index.ts +184 -0
  54. package/ios/DirectionsRendererBridge.m +53 -0
  55. package/ios/DirectionsRendererModule.swift +187 -0
  56. package/ios/DirectionsServiceBridge.m +46 -0
  57. package/ios/DirectionsServiceModule.swift +149 -0
  58. package/ios/MPDisplayRuleBridge.m +410 -0
  59. package/ios/MPDisplayRuleModule.swift +845 -0
  60. package/ios/MapControlBridge.m +178 -0
  61. package/ios/MapControlModule.swift +602 -0
  62. package/ios/MapsIndoors.xcodeproj/project.pbxproj +318 -0
  63. package/ios/MapsIndoors.xcworkspace/contents.xcworkspacedata +7 -0
  64. package/ios/MapsIndoors.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  65. package/ios/MapsIndoorsBridge.m +98 -0
  66. package/ios/MapsIndoorsData.swift +203 -0
  67. package/ios/MapsIndoorsModule.swift +247 -0
  68. package/ios/MapsIndoorsViewManager.swift +30 -0
  69. package/ios/MapsIndoorsViewManagerBridge.m +9 -0
  70. package/ios/ReactPositionProvider.swift +25 -0
  71. package/ios/UtilsBridge.m +63 -0
  72. package/ios/UtilsModule.swift +146 -0
  73. package/ios/helpers.swift +57 -0
  74. package/ios/react-native-maps-indoors-Bridging-Header.h +6 -0
  75. package/package.json +52 -0
  76. package/react-native-maps-indoors-mapbox.podspec +30 -0
  77. package/src/EventNames.ts +21 -0
  78. package/src/MPBounds.ts +137 -0
  79. package/src/MPBuilding.ts +334 -0
  80. package/src/MPBuildingCollection.ts +57 -0
  81. package/src/MPBuildingInfo.ts +63 -0
  82. package/src/MPCameraEvent.ts +17 -0
  83. package/src/MPCameraEventListener.ts +17 -0
  84. package/src/MPCameraPosition.ts +83 -0
  85. package/src/MPCameraUpdate.ts +174 -0
  86. package/src/MPCameraViewFitMode.ts +21 -0
  87. package/src/MPCategory.ts +76 -0
  88. package/src/MPCategoryCollection.ts +62 -0
  89. package/src/MPCollection.ts +59 -0
  90. package/src/MPCollisionHandling.ts +12 -0
  91. package/src/MPDataField.ts +69 -0
  92. package/src/MPDirectionsRenderer.ts +194 -0
  93. package/src/MPDirectionsService.ts +119 -0
  94. package/src/MPDisplayRule.ts +1027 -0
  95. package/src/MPEntity.ts +60 -0
  96. package/src/MPEntityInfo.ts +28 -0
  97. package/src/MPError.ts +122 -0
  98. package/src/MPFilter.ts +168 -0
  99. package/src/MPFilterBehavior.ts +95 -0
  100. package/src/MPFloor.ts +170 -0
  101. package/src/MPFloorSelectorInterface.ts +63 -0
  102. package/src/MPGeometry.ts +91 -0
  103. package/src/MPHighway.ts +14 -0
  104. package/src/MPIconSize.ts +39 -0
  105. package/src/MPLocation.ts +386 -0
  106. package/src/MPLocationPropertyNames.ts +30 -0
  107. package/src/MPLocationType.ts +16 -0
  108. package/src/MPMapConfig.ts +211 -0
  109. package/src/MPMapStyle.ts +57 -0
  110. package/src/MPMultiPolygon.ts +205 -0
  111. package/src/MPPoint.ts +165 -0
  112. package/src/MPPolygon.ts +206 -0
  113. package/src/MPPositionProviderInterface.ts +45 -0
  114. package/src/MPPositionResultInterface.ts +42 -0
  115. package/src/MPPropertyData.ts +215 -0
  116. package/src/MPQuery.ts +69 -0
  117. package/src/MPRoute.ts +95 -0
  118. package/src/MPRouteCoordinate.ts +95 -0
  119. package/src/MPRouteLeg.ts +128 -0
  120. package/src/MPRouteProperty.ts +83 -0
  121. package/src/MPRouteStep.ts +176 -0
  122. package/src/MPSelectionBehavior.ts +93 -0
  123. package/src/MPSettings3D.ts +107 -0
  124. package/src/MPSize.ts +21 -0
  125. package/src/MPSolution.ts +180 -0
  126. package/src/MPSolutionConfig.ts +127 -0
  127. package/src/MPSolutionDisplayRule.ts +13 -0
  128. package/src/MPUserRole.ts +60 -0
  129. package/src/MPUserRoleCollection.ts +37 -0
  130. package/src/MPUtils.ts +157 -0
  131. package/src/MPVenue.ts +294 -0
  132. package/src/MPVenueCollection.ts +58 -0
  133. package/src/MPVenueInfo.ts +62 -0
  134. package/src/MapControl.ts +861 -0
  135. package/src/MapView.tsx +34 -0
  136. package/src/MapsIndoors.ts +530 -0
  137. package/src/OnBuildingFoundAtCameraTargetListener.ts +17 -0
  138. package/src/OnFloorSelectionChangedListener.ts +17 -0
  139. package/src/OnFloorUpdateListener.ts +16 -0
  140. package/src/OnLegSelectedListener.ts +17 -0
  141. package/src/OnLiveLocationUpdateListener.ts +17 -0
  142. package/src/OnLocationSelectedListener.ts +17 -0
  143. package/src/OnMapClickListener.ts +20 -0
  144. package/src/OnMarkerClickListener.ts +17 -0
  145. package/src/OnMarkerInfoWindowClickListener.ts +17 -0
  146. package/src/OnPositionUpdateListener.ts +17 -0
  147. package/src/OnVenueFoundAtCameraTargetListener.ts +17 -0
@@ -0,0 +1,83 @@
1
+ import { Platform } from "react-native";
2
+ import MPPoint from "./MPPoint";
3
+
4
+ /**
5
+ * A camera position object, used to move the camera to a specific position.
6
+ *
7
+ * @export
8
+ * @class MPCameraPosition
9
+ * @typedef {MPCameraPosition}
10
+ */
11
+ export default class MPCameraPosition {
12
+
13
+
14
+ /**
15
+ * Creates an instance of MPCameraPosition.
16
+ *
17
+ * @constructor
18
+ * @private
19
+ * @param {number} zoom The zoom level of the camera.
20
+ * @param {MPPoint} target The target of the camera.
21
+ * @param {number} tilt The camera's tilt value.
22
+ * @param {number} bearing The camera's heading.
23
+ */
24
+ public constructor(
25
+ public readonly zoom: number,
26
+ public readonly target: MPPoint,
27
+ public readonly tilt: number,
28
+ public readonly bearing: number,
29
+ ) { }
30
+
31
+ /**
32
+ * Creator for MPBuildingCollection, used to decode JSON from the MapsIndoors SDK.
33
+ *
34
+ * @public
35
+ * @static
36
+ * @param {MPCameraPositionParams} object
37
+ * @returns {MPCameraPosition}
38
+ */
39
+ public static create(object: MPCameraPositionParams): MPCameraPosition {
40
+ const target = object.target instanceof MPPoint ? object.target : MPPoint.create(object.target);
41
+
42
+ return new MPCameraPosition(
43
+ object?.zoom,
44
+ target,
45
+ object?.bearing ?? 0,
46
+ object?.tilt ?? 0,
47
+ );
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Parameter interface for {@link MPCameraPosition}.
53
+ *
54
+ * @export
55
+ * @interface MPCameraPositionParams
56
+ * @typedef {MPCameraPositionParams}
57
+ */
58
+ export interface MPCameraPositionParams {
59
+ /**
60
+ * The zoom level of the camera.
61
+ *
62
+ * @type {number}
63
+ */
64
+ zoom: number,
65
+ /**
66
+ * The target of the camera.
67
+ *
68
+ * @type {MPPoint}
69
+ */
70
+ target: MPPoint | any,
71
+ /**
72
+ * The camera's tilt value.
73
+ *
74
+ * @type {?number}
75
+ */
76
+ tilt?: number,
77
+ /**
78
+ * The camera's heading.
79
+ *
80
+ * @type {?number}
81
+ */
82
+ bearing?: number,
83
+ }
@@ -0,0 +1,174 @@
1
+ import MPBounds from "./MPBounds";
2
+ import MPCameraPosition from "./MPCameraPosition";
3
+ import MPPoint from "./MPPoint";
4
+ import MPSize from "./MPSize"
5
+
6
+ /**
7
+ * An object that can be used to update the position of the camera by calling {@link MapControl.animateCamera()}.
8
+ *
9
+ * @export
10
+ * @class MPCameraUpdate
11
+ * @typedef {MPCameraUpdate}
12
+ */
13
+ export default class MPCameraUpdate {
14
+ /**
15
+ * The mode of the update, used internally.
16
+ *
17
+ * @public
18
+ * @readonly
19
+ * @type {!Mode}
20
+ */
21
+ public readonly mode!: Mode;
22
+ /**
23
+ * The target of the camera update.
24
+ *
25
+ * @public
26
+ * @readonly
27
+ * @type {?MPPoint}
28
+ */
29
+ public readonly point?: MPPoint;
30
+ /**
31
+ * An area the camera must cover.
32
+ *
33
+ * @public
34
+ * @readonly
35
+ * @type {?MPBounds}
36
+ */
37
+ public readonly bounds?: MPBounds;
38
+ /**
39
+ * The padding between the border of the targeted area and the edge of the map.
40
+ *
41
+ * @public
42
+ * @readonly
43
+ * @type {?number}
44
+ */
45
+ public readonly padding?: number;
46
+ /**
47
+ * Specified width of the {@link padding}.
48
+ *
49
+ * @public
50
+ * @readonly
51
+ * @type {?number}
52
+ */
53
+ public readonly width?: number;
54
+ /**
55
+ * Specified height of the {@link padding}.
56
+ *
57
+ * @public
58
+ * @readonly
59
+ * @type {?number}
60
+ */
61
+ public readonly height?: number;
62
+ /**
63
+ * The camera level of the update.
64
+ *
65
+ * @public
66
+ * @readonly
67
+ * @type {?number}
68
+ */
69
+ public readonly zoom?: number;
70
+ /**
71
+ * A specific camera position.
72
+ *
73
+ * @public
74
+ * @readonly
75
+ * @type {?MPCameraPosition}
76
+ */
77
+ public readonly position?: MPCameraPosition;
78
+
79
+
80
+ /**
81
+ * Creates an instance of MPCameraUpdate.
82
+ *
83
+ * @constructor
84
+ * @private
85
+ * @param {Mode} mode
86
+ * @param {*} obj
87
+ */
88
+ private constructor(mode: Mode, obj: any) {
89
+ this.mode = mode;
90
+ this.point = obj.point;
91
+ this.bounds = obj.bounds;
92
+ this.padding = obj.padding;
93
+ this.width = obj.width;
94
+ this.height = obj.height;
95
+ this.zoom = obj.zoom;
96
+ this.position = obj.position;
97
+ }
98
+
99
+ /**
100
+ * Construct the update from a point.
101
+ *
102
+ * @public
103
+ * @static
104
+ * @param {MPPoint} point
105
+ * @returns {MPCameraUpdate}
106
+ */
107
+ public static fromPoint(point: MPPoint): MPCameraUpdate {
108
+ return new MPCameraUpdate(Mode.fromPoint, { point: point });
109
+ }
110
+
111
+ /**
112
+ * Construct the update from a bounding box with some padding.
113
+ *
114
+ * @public
115
+ * @static
116
+ * @param {MPBounds} bounds
117
+ * @param {number} padding
118
+ * @param {?MPSize} [size] Can be used to set a specific width/height padding
119
+ * @returns {MPCameraUpdate}
120
+ */
121
+ public static fromBounds(bounds: MPBounds, padding: number, size?: MPSize): MPCameraUpdate {
122
+ return new MPCameraUpdate(Mode.fromBounds, { bounds: bounds, padding: padding, height: size?.height, width: size?.width });
123
+ }
124
+
125
+ /**
126
+ * Zooms the camera by the given amount.
127
+ *
128
+ * @public
129
+ * @static
130
+ * @param {number} amount
131
+ * @returns {MPCameraUpdate}
132
+ */
133
+ public static zoomBy(amount: number): MPCameraUpdate {
134
+ return new MPCameraUpdate(Mode.zoomBy, { zoom: amount });
135
+ }
136
+
137
+ /**
138
+ * Zooms the camera to the given level.
139
+ *
140
+ * @public
141
+ * @static
142
+ * @param {number} level
143
+ * @returns {MPCameraUpdate}
144
+ */
145
+ public static zoomTo(level: number): MPCameraUpdate {
146
+ return new MPCameraUpdate(Mode.zoomTo, { zoom: level });
147
+ }
148
+
149
+ /**
150
+ * Constructs the update from the given position.
151
+ *
152
+ * @public
153
+ * @static
154
+ * @param {MPCameraPosition} position
155
+ * @returns {MPCameraUpdate}
156
+ */
157
+ public static fromCameraPosition(position: MPCameraPosition): MPCameraUpdate {
158
+ return new MPCameraUpdate(Mode.fromCameraPosition, { position: position });
159
+ }
160
+
161
+ }
162
+
163
+ /**
164
+ * Internal.
165
+ *
166
+ * @enum {number}
167
+ */
168
+ enum Mode {
169
+ fromPoint = "fromPoint",
170
+ fromBounds = "fromBounds",
171
+ zoomBy = "zoomBy",
172
+ zoomTo = "zoomTo",
173
+ fromCameraPosition = "fromCameraPosition",
174
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * /// Different ways the camera can fit a route inside the screen
3
+ *
4
+ * @export
5
+ * @enum {number}
6
+ */
7
+ export enum MPCameraViewFitMode {
8
+ /**
9
+ * The camera will point north.
10
+ */
11
+ northAligned,
12
+ /**
13
+ * The camera will be aligned with the direction of the first step.
14
+ */
15
+ firstStepAligned,
16
+ /**
17
+ * The camera will point in the same direction as a line that
18
+ * goes directly from the origin to the destination.
19
+ */
20
+ startToEndAligned,
21
+ }
@@ -0,0 +1,76 @@
1
+ import { MPDataField } from "../index";
2
+
3
+ /**
4
+ * A category which contains a number of fields
5
+ *
6
+ * @export
7
+ * @class MPCategory
8
+ * @typedef {MPCategory}
9
+ */
10
+ export default class MPCategory {
11
+ /**
12
+ * Creates an instance of MPCategory.
13
+ *
14
+ * @constructor
15
+ * @private
16
+ * @param {string} key The ID of the category.
17
+ * @param {string} value The category's readable name.
18
+ * @param {?Map<string, MPDataField>} [fields] The category's data fields.
19
+ */
20
+ private constructor(
21
+ public readonly key: string,
22
+ public readonly value: string,
23
+ public readonly fields?: Map<string, MPDataField>
24
+ ) { }
25
+
26
+ /**
27
+ * Creator for MPCategory, used to decode JSON from the MapsIndoors SDK.
28
+ *
29
+ * @public
30
+ * @static
31
+ * @param {MPCategoryParams} object
32
+ * @returns {MPCategory}
33
+ */
34
+ public static create(object: MPCategoryParams): MPCategory {
35
+ let fields: Map<string, MPDataField> | undefined;
36
+ if (object?.fields !== undefined) {
37
+ fields = new Map();
38
+ Object.keys(object?.fields).forEach(key => {
39
+ fields!.set(key, MPDataField.create(object?.fields!.get(key)))
40
+ });
41
+ }
42
+ return new MPCategory(
43
+ object?.key,
44
+ object?.value,
45
+ fields,
46
+ );
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Parameter interface for {@link MPCategory}.
52
+ *
53
+ * @export
54
+ * @interface MPCategoryParams
55
+ * @typedef {MPCategoryParams}
56
+ */
57
+ export interface MPCategoryParams {
58
+ /**
59
+ * The ID of the category.
60
+ *
61
+ * @type {string}
62
+ */
63
+ key: string,
64
+ /**
65
+ * The category's readable name.
66
+ *
67
+ * @type {string}
68
+ */
69
+ value: string,
70
+ /**
71
+ * The category's data fields.
72
+ *
73
+ * @type {?Map<string, MPDataField>}
74
+ */
75
+ fields?: Map<string, MPDataField>,
76
+ }
@@ -0,0 +1,62 @@
1
+ import MPCategory from "./MPCategory";
2
+ import MPCollection from "./MPCollection";
3
+ import MPDataField from "./MPDataField";
4
+
5
+ /**
6
+ * A simple collection holder for categories.
7
+ *
8
+ * @export
9
+ * @class MPCategoryCollection
10
+ * @typedef {MPCategoryCollection}
11
+ * @extends {MPCollection<MPCategory>}
12
+ */
13
+ export default class MPCategoryCollection extends MPCollection<MPCategory> {
14
+ /**
15
+ * Creates an instance of MPCategoryCollection.
16
+ *
17
+ * @constructor
18
+ * @private
19
+ * @param {MPCategory[]} category A collection of categories used in MapsIndoors.
20
+ */
21
+ private constructor(category: MPCategory[]) {
22
+ super();
23
+ this.map = new Map(category.map((category) => [category.key, category]));
24
+ }
25
+
26
+ /**
27
+ * Get a category's value directly.
28
+ *
29
+ * @public
30
+ * @param {string} key
31
+ * @returns {(string | undefined)}
32
+ */
33
+ public getValue(key: string) : string | undefined {
34
+ let category: MPCategory | undefined = this.getById(key);
35
+ return category?.value;
36
+ }
37
+
38
+ /**
39
+ * Get a category's fields directly.
40
+ *
41
+ * @public
42
+ * @param {string} key
43
+ * @returns {(Map<string, MPDataField> | undefined)}
44
+ */
45
+ public getFields(key: string) : Map<string, MPDataField> | undefined {
46
+ let category: MPCategory | undefined = this.getById(key);
47
+ return category?.fields;
48
+ }
49
+
50
+ /**
51
+ * Creator for MPCategoryCollection, used to decode JSON from the MapsIndoors SDK.
52
+ *
53
+ * @public
54
+ * @static
55
+ * @param {?*} [object]
56
+ * @returns {MPCategoryCollection}
57
+ */
58
+ public static create(object?: any) : MPCategoryCollection {
59
+ let category: MPCategory[] = object?.map((venue: any) => MPCategory.create(venue));
60
+ return new MPCategoryCollection(category);
61
+ }
62
+ }
@@ -0,0 +1,59 @@
1
+
2
+ /**
3
+ * A generic collection used by MapsIndoors.
4
+ *
5
+ * @export
6
+ * @abstract
7
+ * @class MPCollection
8
+ * @typedef {MPCollection}
9
+ * @template Type
10
+ */
11
+ export default abstract class MPCollection<Type> {
12
+ /**
13
+ * The map the objects are kept in.
14
+ *
15
+ * @protected
16
+ * @type {!Map<String, Type>}
17
+ */
18
+ protected map!: Map<String, Type>;
19
+
20
+ /**
21
+ * Creates an instance of MPCollection.
22
+ *
23
+ * @constructor
24
+ * @protected
25
+ */
26
+ protected constructor() { }
27
+
28
+ /**
29
+ * Gets all objects contained in the collection.
30
+ *
31
+ * @public
32
+ * @returns {Array<Type>}
33
+ */
34
+ public getAll(): Array<Type> {
35
+ return Array.from(this.map.values());
36
+ }
37
+
38
+ /**
39
+ * Get a object by its identifier.
40
+ *
41
+ * @public
42
+ * @param {string} id
43
+ * @returns {(Type | undefined)}
44
+ */
45
+ public getById(id: string): Type | undefined {
46
+ return this.map.get(id);
47
+ }
48
+
49
+ /**
50
+ * The number of objects in the collection.
51
+ *
52
+ * @public
53
+ * @readonly
54
+ * @type {number}
55
+ */
56
+ public get size(): number {
57
+ return this.map.size;
58
+ }
59
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Describes how the SDK should handle markers and labels overlapping with other markers and labels.
3
+ *
4
+ * @export
5
+ * @enum {number}
6
+ */
7
+ export enum MPCollisionHandling {
8
+ allowOverlap,
9
+ removeLabelFirst,
10
+ removeIconFirst,
11
+ removeIconAndLabel,
12
+ }
@@ -0,0 +1,69 @@
1
+ /**
2
+ * A data field contains a single field value with descriptive
3
+ * text and a type that defines the type of the value (eg. text or number).
4
+ *
5
+ * @export
6
+ * @class MPDataField
7
+ * @typedef {MPDataField}
8
+ */
9
+ export default class MPDataField {
10
+ /**
11
+ * Creates an instance of MPDataField.
12
+ *
13
+ * @constructor
14
+ * @private
15
+ * @param {?string} [value] The value of the field.
16
+ * @param {?string} [text] Text that describes the value.
17
+ * @param {?string} [type] The type of the value (text, number, etc.)
18
+ */
19
+ private constructor(
20
+ public readonly value?: string,
21
+ public readonly text?: string,
22
+ public readonly type?: string
23
+ ) { };
24
+
25
+ /**
26
+ /**
27
+ * Creator for MPDataField, used to decode JSON from the MapsIndoors SDK.
28
+ *
29
+ * @public
30
+ * @static
31
+ * @param {MPDataFieldParams} object
32
+ * @returns {MPDataField}
33
+ */
34
+ public static create(object: MPDataFieldParams): MPDataField {
35
+ return new MPDataField(
36
+ object?.value,
37
+ object?.text,
38
+ object?.type,
39
+ );
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Parameter interface for {@link MPDataField}.
45
+ *
46
+ * @export
47
+ * @interface MPDataFieldParams
48
+ * @typedef {MPDataFieldParams}
49
+ */
50
+ export interface MPDataFieldParams {
51
+ /**
52
+ * The value of the field.
53
+ *
54
+ * @type {?string}
55
+ */
56
+ value?: string,
57
+ /**
58
+ * Text that describes the value.
59
+ *
60
+ * @type {?string}
61
+ */
62
+ text?: string,
63
+ /**
64
+ * The type of the value (text, number, etc.)
65
+ *
66
+ * @type {?string}
67
+ */
68
+ type?: string,
69
+ }