@trackunit/iris-app-runtime-core 0.3.143 → 0.3.144

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
@@ -135,6 +135,12 @@ const CurrentUserRuntime = {
135
135
  */
136
136
  const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue) => {
137
137
  if (customFieldDefinition.type === "BOOLEAN") {
138
+ if (newValue === null) {
139
+ return {
140
+ booleanValue: null,
141
+ type: "BOOLEAN",
142
+ };
143
+ }
138
144
  return {
139
145
  booleanValue: newValue ? true : false,
140
146
  type: "BOOLEAN",
@@ -147,6 +153,12 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
147
153
  };
148
154
  }
149
155
  else if (customFieldDefinition.type === "DROPDOWN") {
156
+ if (newValue === null) {
157
+ return {
158
+ stringArrayValue: null,
159
+ type: "DROPDOWN",
160
+ };
161
+ }
150
162
  const stringArrayValue = [];
151
163
  if (Array.isArray(newValue)) {
152
164
  newValue.forEach(item => {
@@ -173,7 +185,7 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
173
185
  }
174
186
  else if (customFieldDefinition.type === "EMAIL") {
175
187
  return {
176
- stringValue: getStringValue(newValue),
188
+ stringValue: newValue ? getStringValue(newValue) : null,
177
189
  type: "EMAIL",
178
190
  };
179
191
  }
@@ -191,25 +203,25 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
191
203
  }
192
204
  else if (customFieldDefinition.type === "MONETARY") {
193
205
  return {
194
- numberValue: newValue,
206
+ numberValue: newValue ? newValue : null,
195
207
  type: "MONETARY",
196
208
  };
197
209
  }
198
210
  else if (customFieldDefinition.type === "PHONE_NUMBER") {
199
211
  return {
200
- stringValue: getStringValue(newValue),
212
+ stringValue: newValue ? getStringValue(newValue) : null,
201
213
  type: "PHONE_NUMBER",
202
214
  };
203
215
  }
204
216
  else if (customFieldDefinition.type === "STRING") {
205
217
  return {
206
- stringValue: getStringValue(newValue),
218
+ stringValue: newValue ? getStringValue(newValue) : null,
207
219
  type: "STRING",
208
220
  };
209
221
  }
210
222
  else if (customFieldDefinition.type === "WEB_ADDRESS") {
211
223
  return {
212
- stringValue: getStringValue(newValue),
224
+ stringValue: newValue ? getStringValue(newValue) : null,
213
225
  type: "WEB_ADDRESS",
214
226
  };
215
227
  }
package/index.esm.js CHANGED
@@ -131,6 +131,12 @@ const CurrentUserRuntime = {
131
131
  */
132
132
  const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue) => {
133
133
  if (customFieldDefinition.type === "BOOLEAN") {
134
+ if (newValue === null) {
135
+ return {
136
+ booleanValue: null,
137
+ type: "BOOLEAN",
138
+ };
139
+ }
134
140
  return {
135
141
  booleanValue: newValue ? true : false,
136
142
  type: "BOOLEAN",
@@ -143,6 +149,12 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
143
149
  };
144
150
  }
145
151
  else if (customFieldDefinition.type === "DROPDOWN") {
152
+ if (newValue === null) {
153
+ return {
154
+ stringArrayValue: null,
155
+ type: "DROPDOWN",
156
+ };
157
+ }
146
158
  const stringArrayValue = [];
147
159
  if (Array.isArray(newValue)) {
148
160
  newValue.forEach(item => {
@@ -169,7 +181,7 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
169
181
  }
170
182
  else if (customFieldDefinition.type === "EMAIL") {
171
183
  return {
172
- stringValue: getStringValue(newValue),
184
+ stringValue: newValue ? getStringValue(newValue) : null,
173
185
  type: "EMAIL",
174
186
  };
175
187
  }
@@ -187,25 +199,25 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
187
199
  }
188
200
  else if (customFieldDefinition.type === "MONETARY") {
189
201
  return {
190
- numberValue: newValue,
202
+ numberValue: newValue ? newValue : null,
191
203
  type: "MONETARY",
192
204
  };
193
205
  }
194
206
  else if (customFieldDefinition.type === "PHONE_NUMBER") {
195
207
  return {
196
- stringValue: getStringValue(newValue),
208
+ stringValue: newValue ? getStringValue(newValue) : null,
197
209
  type: "PHONE_NUMBER",
198
210
  };
199
211
  }
200
212
  else if (customFieldDefinition.type === "STRING") {
201
213
  return {
202
- stringValue: getStringValue(newValue),
214
+ stringValue: newValue ? getStringValue(newValue) : null,
203
215
  type: "STRING",
204
216
  };
205
217
  }
206
218
  else if (customFieldDefinition.type === "WEB_ADDRESS") {
207
219
  return {
208
- stringValue: getStringValue(newValue),
220
+ stringValue: newValue ? getStringValue(newValue) : null,
209
221
  type: "WEB_ADDRESS",
210
222
  };
211
223
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app-runtime-core",
3
- "version": "0.3.143",
3
+ "version": "0.3.144",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -13,7 +13,7 @@ export interface DropdownSelection {
13
13
  export declare const getCustomFieldValueToSaveFromRawValue: (customFieldDefinition: {
14
14
  type: CustomFieldType;
15
15
  isInteger?: boolean | null;
16
- }, newValue: boolean | string | string[] | DropdownSelection[] | DropdownSelection | number) => CustomFieldValue;
16
+ }, newValue: boolean | string | string[] | DropdownSelection[] | DropdownSelection | number | null) => CustomFieldValue;
17
17
  /**
18
18
  * Convert the received value to a string
19
19
  */