@trackunit/react-core-contexts-api 0.2.91-alpha-acd06a6798.0 → 0.2.92

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/index.cjs.js CHANGED
@@ -125,6 +125,55 @@ const isIrisOptions = (options) => {
125
125
  ("extensionId") in options);
126
126
  };
127
127
 
128
+ /** The property to sort by. */
129
+ exports.SiteSortByProperty = void 0;
130
+ (function (SiteSortByProperty) {
131
+ SiteSortByProperty["Area"] = "AREA";
132
+ SiteSortByProperty["CenterLatitude"] = "CENTER_LATITUDE";
133
+ SiteSortByProperty["CenterLongitude"] = "CENTER_LONGITUDE";
134
+ SiteSortByProperty["City"] = "CITY";
135
+ SiteSortByProperty["Country"] = "COUNTRY";
136
+ SiteSortByProperty["CreatedDate"] = "CREATED_DATE";
137
+ SiteSortByProperty["Description"] = "DESCRIPTION";
138
+ SiteSortByProperty["EndDate"] = "END_DATE";
139
+ SiteSortByProperty["LastModifiedDate"] = "LAST_MODIFIED_DATE";
140
+ SiteSortByProperty["Name"] = "NAME";
141
+ SiteSortByProperty["StartDate"] = "START_DATE";
142
+ SiteSortByProperty["Status"] = "STATUS";
143
+ SiteSortByProperty["StreetAddress"] = "STREET_ADDRESS";
144
+ SiteSortByProperty["Type"] = "TYPE";
145
+ SiteSortByProperty["ZipCode"] = "ZIP_CODE";
146
+ SiteSortByProperty["ZoneId"] = "ZONE_ID";
147
+ })(exports.SiteSortByProperty || (exports.SiteSortByProperty = {}));
148
+ /**
149
+ * Ensures that a string is a valid SiteSortByProperty enum value
150
+ *
151
+ * @param input A string to test against SiteSortByProperty
152
+ * @returns {SiteSortByProperty.Name} The SiteSortByProperty enum value or the default value (SiteSortByProperty.Name)
153
+ */
154
+ const validateStringAsSiteSortByProperty = (input) => {
155
+ const fallback = exports.SiteSortByProperty.Name;
156
+ if (!input) {
157
+ return fallback;
158
+ }
159
+ switch (input) {
160
+ case exports.SiteSortByProperty.Area:
161
+ return exports.SiteSortByProperty.Area;
162
+ case exports.SiteSortByProperty.EndDate:
163
+ return exports.SiteSortByProperty.EndDate;
164
+ case exports.SiteSortByProperty.Name:
165
+ return exports.SiteSortByProperty.Name;
166
+ case exports.SiteSortByProperty.StartDate:
167
+ return exports.SiteSortByProperty.StartDate;
168
+ case exports.SiteSortByProperty.Status:
169
+ return exports.SiteSortByProperty.Status;
170
+ case exports.SiteSortByProperty.Type:
171
+ return exports.SiteSortByProperty.Type;
172
+ default:
173
+ return fallback;
174
+ }
175
+ };
176
+
128
177
  const UserSubscriptionPackage = {
129
178
  EXPLORE_FLEET_OWNER: "Explore (Fleet Owner)",
130
179
  EVOLVE_FLEET_OWNER: "Evolve (Fleet Owner)",
@@ -146,3 +195,4 @@ exports.createEvent = createEvent;
146
195
  exports.isIrisOptions = isIrisOptions;
147
196
  exports.siteHomePageIds = siteHomePageIds;
148
197
  exports.validateStringAsAssetSortByProperty = validateStringAsAssetSortByProperty;
198
+ exports.validateStringAsSiteSortByProperty = validateStringAsSiteSortByProperty;
package/index.esm.js CHANGED
@@ -121,6 +121,55 @@ const isIrisOptions = (options) => {
121
121
  ("extensionId") in options);
122
122
  };
123
123
 
124
+ /** The property to sort by. */
125
+ var SiteSortByProperty;
126
+ (function (SiteSortByProperty) {
127
+ SiteSortByProperty["Area"] = "AREA";
128
+ SiteSortByProperty["CenterLatitude"] = "CENTER_LATITUDE";
129
+ SiteSortByProperty["CenterLongitude"] = "CENTER_LONGITUDE";
130
+ SiteSortByProperty["City"] = "CITY";
131
+ SiteSortByProperty["Country"] = "COUNTRY";
132
+ SiteSortByProperty["CreatedDate"] = "CREATED_DATE";
133
+ SiteSortByProperty["Description"] = "DESCRIPTION";
134
+ SiteSortByProperty["EndDate"] = "END_DATE";
135
+ SiteSortByProperty["LastModifiedDate"] = "LAST_MODIFIED_DATE";
136
+ SiteSortByProperty["Name"] = "NAME";
137
+ SiteSortByProperty["StartDate"] = "START_DATE";
138
+ SiteSortByProperty["Status"] = "STATUS";
139
+ SiteSortByProperty["StreetAddress"] = "STREET_ADDRESS";
140
+ SiteSortByProperty["Type"] = "TYPE";
141
+ SiteSortByProperty["ZipCode"] = "ZIP_CODE";
142
+ SiteSortByProperty["ZoneId"] = "ZONE_ID";
143
+ })(SiteSortByProperty || (SiteSortByProperty = {}));
144
+ /**
145
+ * Ensures that a string is a valid SiteSortByProperty enum value
146
+ *
147
+ * @param input A string to test against SiteSortByProperty
148
+ * @returns {SiteSortByProperty.Name} The SiteSortByProperty enum value or the default value (SiteSortByProperty.Name)
149
+ */
150
+ const validateStringAsSiteSortByProperty = (input) => {
151
+ const fallback = SiteSortByProperty.Name;
152
+ if (!input) {
153
+ return fallback;
154
+ }
155
+ switch (input) {
156
+ case SiteSortByProperty.Area:
157
+ return SiteSortByProperty.Area;
158
+ case SiteSortByProperty.EndDate:
159
+ return SiteSortByProperty.EndDate;
160
+ case SiteSortByProperty.Name:
161
+ return SiteSortByProperty.Name;
162
+ case SiteSortByProperty.StartDate:
163
+ return SiteSortByProperty.StartDate;
164
+ case SiteSortByProperty.Status:
165
+ return SiteSortByProperty.Status;
166
+ case SiteSortByProperty.Type:
167
+ return SiteSortByProperty.Type;
168
+ default:
169
+ return fallback;
170
+ }
171
+ };
172
+
124
173
  const UserSubscriptionPackage = {
125
174
  EXPLORE_FLEET_OWNER: "Explore (Fleet Owner)",
126
175
  EVOLVE_FLEET_OWNER: "Evolve (Fleet Owner)",
@@ -134,4 +183,4 @@ const UserSubscriptionPackage = {
134
183
  NONE: "NONE",
135
184
  };
136
185
 
137
- export { AssetSortByProperty, SortOrder, SystemOfMeasurement, TimeZonePreference, UserSubscriptionPackage, assetHomePageIds, createEvent, isIrisOptions, siteHomePageIds, validateStringAsAssetSortByProperty };
186
+ export { AssetSortByProperty, SiteSortByProperty, SortOrder, SystemOfMeasurement, TimeZonePreference, UserSubscriptionPackage, assetHomePageIds, createEvent, isIrisOptions, siteHomePageIds, validateStringAsAssetSortByProperty, validateStringAsSiteSortByProperty };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-core-contexts-api",
3
- "version": "0.2.91-alpha-acd06a6798.0",
3
+ "version": "0.2.92",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
package/src/index.d.ts CHANGED
@@ -4,9 +4,9 @@ export * from "./assetSortingContext";
4
4
  export * from "./currentUserContext";
5
5
  export * from "./environmentContext";
6
6
  export * from "./filterBarContext";
7
- export * from "./globalSelectionContext";
8
7
  export * from "./navigationContext";
9
8
  export * from "./oemBrandingContext";
9
+ export * from "./siteSortingContext";
10
10
  export * from "./toastContext";
11
11
  export * from "./tokenContext";
12
12
  export * from "./userSubscriptionContext";
@@ -0,0 +1,26 @@
1
+ /** The property to sort by. */
2
+ export declare enum SiteSortByProperty {
3
+ Area = "AREA",
4
+ CenterLatitude = "CENTER_LATITUDE",
5
+ CenterLongitude = "CENTER_LONGITUDE",
6
+ City = "CITY",
7
+ Country = "COUNTRY",
8
+ CreatedDate = "CREATED_DATE",
9
+ Description = "DESCRIPTION",
10
+ EndDate = "END_DATE",
11
+ LastModifiedDate = "LAST_MODIFIED_DATE",
12
+ Name = "NAME",
13
+ StartDate = "START_DATE",
14
+ Status = "STATUS",
15
+ StreetAddress = "STREET_ADDRESS",
16
+ Type = "TYPE",
17
+ ZipCode = "ZIP_CODE",
18
+ ZoneId = "ZONE_ID"
19
+ }
20
+ /**
21
+ * Ensures that a string is a valid SiteSortByProperty enum value
22
+ *
23
+ * @param input A string to test against SiteSortByProperty
24
+ * @returns {SiteSortByProperty.Name} The SiteSortByProperty enum value or the default value (SiteSortByProperty.Name)
25
+ */
26
+ export declare const validateStringAsSiteSortByProperty: (input?: string) => SiteSortByProperty;
@@ -1,18 +0,0 @@
1
- export interface IGlobalSelectionContext {
2
- /**
3
- * Details about the globally selected entity and its type
4
- * returns `null` if no selection currently.
5
- */
6
- selection: Readonly<SiteSelection | GroupSelection> | null;
7
- }
8
- export interface SiteSelection extends TypedSelection<"site"> {
9
- siteId: string;
10
- }
11
- export interface GroupSelection extends TypedSelection<"group"> {
12
- groupId: string;
13
- }
14
- interface TypedSelection<Type extends string> {
15
- type: Type;
16
- displayName: string;
17
- }
18
- export {};