@trackunit/iris-app-runtime-core 0.3.97 → 0.3.99

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
@@ -129,19 +129,19 @@ const CurrentUserRuntime = {
129
129
  * @returns { CustomFieldValue } an updated CustomFieldValue
130
130
  */
131
131
  const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue) => {
132
- if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.BOOLEAN) {
132
+ if (customFieldDefinition.type === "BOOLEAN") {
133
133
  return {
134
134
  booleanValue: newValue ? true : false,
135
- type: irisAppRuntimeCoreApi.CustomFieldType.BOOLEAN,
135
+ type: "BOOLEAN",
136
136
  };
137
137
  }
138
- else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.DATE) {
138
+ else if (customFieldDefinition.type === "DATE") {
139
139
  return {
140
140
  dateValue: newValue ? getDateValue(newValue) : null,
141
- type: irisAppRuntimeCoreApi.CustomFieldType.DATE,
141
+ type: "DATE",
142
142
  };
143
143
  }
144
- else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.DROPDOWN) {
144
+ else if (customFieldDefinition.type === "DROPDOWN") {
145
145
  const stringArrayValue = [];
146
146
  if (Array.isArray(newValue)) {
147
147
  newValue.forEach(item => {
@@ -163,16 +163,16 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
163
163
  }
164
164
  return {
165
165
  stringArrayValue: stringArrayValue,
166
- type: irisAppRuntimeCoreApi.CustomFieldType.DROPDOWN,
166
+ type: "DROPDOWN",
167
167
  };
168
168
  }
169
- else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.EMAIL) {
169
+ else if (customFieldDefinition.type === "EMAIL") {
170
170
  return {
171
171
  stringValue: getStringValue(newValue),
172
- type: irisAppRuntimeCoreApi.CustomFieldType.EMAIL,
172
+ type: "EMAIL",
173
173
  };
174
174
  }
175
- else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.NUMBER) {
175
+ else if (customFieldDefinition.type === "NUMBER") {
176
176
  let value = customFieldDefinition.isInteger
177
177
  ? parseInt(newValue)
178
178
  : parseFloat(newValue);
@@ -181,31 +181,31 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
181
181
  }
182
182
  return {
183
183
  numberValue: value,
184
- type: irisAppRuntimeCoreApi.CustomFieldType.NUMBER,
184
+ type: "NUMBER",
185
185
  };
186
186
  }
187
- else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.MONETARY) {
187
+ else if (customFieldDefinition.type === "MONETARY") {
188
188
  return {
189
189
  numberValue: newValue,
190
- type: irisAppRuntimeCoreApi.CustomFieldType.MONETARY,
190
+ type: "MONETARY",
191
191
  };
192
192
  }
193
- else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.PHONE_NUMBER) {
193
+ else if (customFieldDefinition.type === "PHONE_NUMBER") {
194
194
  return {
195
195
  stringValue: getStringValue(newValue),
196
- type: irisAppRuntimeCoreApi.CustomFieldType.PHONE_NUMBER,
196
+ type: "PHONE_NUMBER",
197
197
  };
198
198
  }
199
- else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.STRING) {
199
+ else if (customFieldDefinition.type === "STRING") {
200
200
  return {
201
201
  stringValue: getStringValue(newValue),
202
- type: irisAppRuntimeCoreApi.CustomFieldType.STRING,
202
+ type: "STRING",
203
203
  };
204
204
  }
205
- else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.WEB_ADDRESS) {
205
+ else if (customFieldDefinition.type === "WEB_ADDRESS") {
206
206
  return {
207
207
  stringValue: getStringValue(newValue),
208
- type: irisAppRuntimeCoreApi.CustomFieldType.WEB_ADDRESS,
208
+ type: "WEB_ADDRESS",
209
209
  };
210
210
  }
211
211
  throw new Error("Unsupported custom field type");
package/index.esm.js CHANGED
@@ -1,4 +1,3 @@
1
- import { CustomFieldType } from '@trackunit/iris-app-runtime-core-api';
2
1
  export * from '@trackunit/iris-app-runtime-core-api';
3
2
  import { connectToParent } from 'penpal';
4
3
 
@@ -126,19 +125,19 @@ const CurrentUserRuntime = {
126
125
  * @returns { CustomFieldValue } an updated CustomFieldValue
127
126
  */
128
127
  const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue) => {
129
- if (customFieldDefinition.type === CustomFieldType.BOOLEAN) {
128
+ if (customFieldDefinition.type === "BOOLEAN") {
130
129
  return {
131
130
  booleanValue: newValue ? true : false,
132
- type: CustomFieldType.BOOLEAN,
131
+ type: "BOOLEAN",
133
132
  };
134
133
  }
135
- else if (customFieldDefinition.type === CustomFieldType.DATE) {
134
+ else if (customFieldDefinition.type === "DATE") {
136
135
  return {
137
136
  dateValue: newValue ? getDateValue(newValue) : null,
138
- type: CustomFieldType.DATE,
137
+ type: "DATE",
139
138
  };
140
139
  }
141
- else if (customFieldDefinition.type === CustomFieldType.DROPDOWN) {
140
+ else if (customFieldDefinition.type === "DROPDOWN") {
142
141
  const stringArrayValue = [];
143
142
  if (Array.isArray(newValue)) {
144
143
  newValue.forEach(item => {
@@ -160,16 +159,16 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
160
159
  }
161
160
  return {
162
161
  stringArrayValue: stringArrayValue,
163
- type: CustomFieldType.DROPDOWN,
162
+ type: "DROPDOWN",
164
163
  };
165
164
  }
166
- else if (customFieldDefinition.type === CustomFieldType.EMAIL) {
165
+ else if (customFieldDefinition.type === "EMAIL") {
167
166
  return {
168
167
  stringValue: getStringValue(newValue),
169
- type: CustomFieldType.EMAIL,
168
+ type: "EMAIL",
170
169
  };
171
170
  }
172
- else if (customFieldDefinition.type === CustomFieldType.NUMBER) {
171
+ else if (customFieldDefinition.type === "NUMBER") {
173
172
  let value = customFieldDefinition.isInteger
174
173
  ? parseInt(newValue)
175
174
  : parseFloat(newValue);
@@ -178,31 +177,31 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
178
177
  }
179
178
  return {
180
179
  numberValue: value,
181
- type: CustomFieldType.NUMBER,
180
+ type: "NUMBER",
182
181
  };
183
182
  }
184
- else if (customFieldDefinition.type === CustomFieldType.MONETARY) {
183
+ else if (customFieldDefinition.type === "MONETARY") {
185
184
  return {
186
185
  numberValue: newValue,
187
- type: CustomFieldType.MONETARY,
186
+ type: "MONETARY",
188
187
  };
189
188
  }
190
- else if (customFieldDefinition.type === CustomFieldType.PHONE_NUMBER) {
189
+ else if (customFieldDefinition.type === "PHONE_NUMBER") {
191
190
  return {
192
191
  stringValue: getStringValue(newValue),
193
- type: CustomFieldType.PHONE_NUMBER,
192
+ type: "PHONE_NUMBER",
194
193
  };
195
194
  }
196
- else if (customFieldDefinition.type === CustomFieldType.STRING) {
195
+ else if (customFieldDefinition.type === "STRING") {
197
196
  return {
198
197
  stringValue: getStringValue(newValue),
199
- type: CustomFieldType.STRING,
198
+ type: "STRING",
200
199
  };
201
200
  }
202
- else if (customFieldDefinition.type === CustomFieldType.WEB_ADDRESS) {
201
+ else if (customFieldDefinition.type === "WEB_ADDRESS") {
203
202
  return {
204
203
  stringValue: getStringValue(newValue),
205
- type: CustomFieldType.WEB_ADDRESS,
204
+ type: "WEB_ADDRESS",
206
205
  };
207
206
  }
208
207
  throw new Error("Unsupported custom field type");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app-runtime-core",
3
- "version": "0.3.97",
3
+ "version": "0.3.99",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -1,4 +1,4 @@
1
- import { CustomFieldDefinition, CustomFieldError, CustomFieldValue, EntityIdentity, UnitSiType, UnitUsType, ValueAndDefinition, ValueAndDefinitionKey } from "@trackunit/iris-app-runtime-core-api";
1
+ import { CustomFieldError, CustomFieldType, CustomFieldValue, EntityIdentity, UnitSiType, UnitUsType, ValueAndDefinition, ValueAndDefinitionKey } from "@trackunit/iris-app-runtime-core-api";
2
2
  import { SystemOfMeasurementType } from "@trackunit/react-core-contexts-api";
3
3
  export interface DropdownSelection {
4
4
  value: string;
@@ -10,7 +10,10 @@ export interface DropdownSelection {
10
10
  * @param newValue the new value to set
11
11
  * @returns { CustomFieldValue } an updated CustomFieldValue
12
12
  */
13
- export declare const getCustomFieldValueToSaveFromRawValue: (customFieldDefinition: CustomFieldDefinition, newValue: boolean | string | string[] | DropdownSelection[] | DropdownSelection | number) => CustomFieldValue;
13
+ export declare const getCustomFieldValueToSaveFromRawValue: (customFieldDefinition: {
14
+ type: CustomFieldType;
15
+ isInteger?: boolean | null;
16
+ }, newValue: boolean | string | string[] | DropdownSelection[] | DropdownSelection | number) => CustomFieldValue;
14
17
  /**
15
18
  * Convert the received value to a string
16
19
  */