@trackunit/iris-app-runtime-core 0.3.203 → 0.3.207
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 +11 -17
- package/index.esm.js +11 -17
- package/package.json +1 -1
- package/src/CustomFieldRuntime.d.ts +2 -2
package/index.cjs.js
CHANGED
|
@@ -125,9 +125,9 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
|
|
|
125
125
|
type: "BOOLEAN",
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
-
else if (customFieldDefinition.type === "DATE") {
|
|
128
|
+
else if (customFieldDefinition.type === "DATE" || newValue instanceof Date) {
|
|
129
129
|
return {
|
|
130
|
-
dateValue: newValue ? getDateValue(newValue) : null,
|
|
130
|
+
dateValue: typeof newValue === "string" || newValue instanceof Date ? getDateValue(newValue) : null,
|
|
131
131
|
type: "DATE",
|
|
132
132
|
};
|
|
133
133
|
}
|
|
@@ -227,7 +227,7 @@ const getStringValue = (value) => {
|
|
|
227
227
|
*/
|
|
228
228
|
const getDateValue = (value) => {
|
|
229
229
|
// remove timezone to ensure the date is always the same
|
|
230
|
-
const date = new Date(value.substring(0, 10));
|
|
230
|
+
const date = typeof value === "string" ? new Date(value.substring(0, 10)) : value;
|
|
231
231
|
const dateFormatted = date.toISOString().split("T");
|
|
232
232
|
if (dateFormatted.length !== 2) {
|
|
233
233
|
return undefined;
|
|
@@ -404,25 +404,19 @@ const ThemeCssRuntime = {
|
|
|
404
404
|
|
|
405
405
|
const ToastRuntime = {
|
|
406
406
|
async addToast(toast) {
|
|
407
|
-
var _a, _b;
|
|
407
|
+
var _a, _b, _c, _d;
|
|
408
408
|
const api = await getHostConnector();
|
|
409
|
-
|
|
410
|
-
.addToast({
|
|
409
|
+
const response = await api.addToast({
|
|
411
410
|
...toast,
|
|
412
411
|
primaryAction: (_a = toast.primaryAction) === null || _a === void 0 ? void 0 : _a.label,
|
|
413
412
|
secondaryAction: (_b = toast.secondaryAction) === null || _b === void 0 ? void 0 : _b.label,
|
|
414
|
-
})
|
|
415
|
-
.then(res => {
|
|
416
|
-
var _a, _b, _c, _d;
|
|
417
|
-
switch (res) {
|
|
418
|
-
case "primaryAction":
|
|
419
|
-
(_b = (_a = toast.primaryAction) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
420
|
-
break;
|
|
421
|
-
case "secondaryAction":
|
|
422
|
-
(_d = (_c = toast.secondaryAction) === null || _c === void 0 ? void 0 : _c.onClick) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
423
|
-
break;
|
|
424
|
-
}
|
|
425
413
|
});
|
|
414
|
+
switch (response) {
|
|
415
|
+
case "primaryAction":
|
|
416
|
+
case "secondaryAction":
|
|
417
|
+
(_d = (_c = toast[response]) === null || _c === void 0 ? void 0 : _c.onClick) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
418
|
+
break;
|
|
419
|
+
}
|
|
426
420
|
},
|
|
427
421
|
};
|
|
428
422
|
|
package/index.esm.js
CHANGED
|
@@ -123,9 +123,9 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
|
|
|
123
123
|
type: "BOOLEAN",
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
-
else if (customFieldDefinition.type === "DATE") {
|
|
126
|
+
else if (customFieldDefinition.type === "DATE" || newValue instanceof Date) {
|
|
127
127
|
return {
|
|
128
|
-
dateValue: newValue ? getDateValue(newValue) : null,
|
|
128
|
+
dateValue: typeof newValue === "string" || newValue instanceof Date ? getDateValue(newValue) : null,
|
|
129
129
|
type: "DATE",
|
|
130
130
|
};
|
|
131
131
|
}
|
|
@@ -225,7 +225,7 @@ const getStringValue = (value) => {
|
|
|
225
225
|
*/
|
|
226
226
|
const getDateValue = (value) => {
|
|
227
227
|
// remove timezone to ensure the date is always the same
|
|
228
|
-
const date = new Date(value.substring(0, 10));
|
|
228
|
+
const date = typeof value === "string" ? new Date(value.substring(0, 10)) : value;
|
|
229
229
|
const dateFormatted = date.toISOString().split("T");
|
|
230
230
|
if (dateFormatted.length !== 2) {
|
|
231
231
|
return undefined;
|
|
@@ -402,25 +402,19 @@ const ThemeCssRuntime = {
|
|
|
402
402
|
|
|
403
403
|
const ToastRuntime = {
|
|
404
404
|
async addToast(toast) {
|
|
405
|
-
var _a, _b;
|
|
405
|
+
var _a, _b, _c, _d;
|
|
406
406
|
const api = await getHostConnector();
|
|
407
|
-
|
|
408
|
-
.addToast({
|
|
407
|
+
const response = await api.addToast({
|
|
409
408
|
...toast,
|
|
410
409
|
primaryAction: (_a = toast.primaryAction) === null || _a === void 0 ? void 0 : _a.label,
|
|
411
410
|
secondaryAction: (_b = toast.secondaryAction) === null || _b === void 0 ? void 0 : _b.label,
|
|
412
|
-
})
|
|
413
|
-
.then(res => {
|
|
414
|
-
var _a, _b, _c, _d;
|
|
415
|
-
switch (res) {
|
|
416
|
-
case "primaryAction":
|
|
417
|
-
(_b = (_a = toast.primaryAction) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
418
|
-
break;
|
|
419
|
-
case "secondaryAction":
|
|
420
|
-
(_d = (_c = toast.secondaryAction) === null || _c === void 0 ? void 0 : _c.onClick) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
421
|
-
break;
|
|
422
|
-
}
|
|
423
411
|
});
|
|
412
|
+
switch (response) {
|
|
413
|
+
case "primaryAction":
|
|
414
|
+
case "secondaryAction":
|
|
415
|
+
(_d = (_c = toast[response]) === null || _c === void 0 ? void 0 : _c.onClick) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
416
|
+
break;
|
|
417
|
+
}
|
|
424
418
|
},
|
|
425
419
|
};
|
|
426
420
|
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ export interface DropdownSelection {
|
|
|
15
15
|
export declare const getCustomFieldValueToSaveFromRawValue: (customFieldDefinition: {
|
|
16
16
|
type: CustomFieldType;
|
|
17
17
|
isInteger?: boolean | null;
|
|
18
|
-
}, newValue: boolean | string | string[] | DropdownSelection[] | DropdownSelection | number | null) => CustomFieldValue;
|
|
18
|
+
}, newValue: boolean | string | string[] | DropdownSelection[] | DropdownSelection | number | Date | null) => CustomFieldValue;
|
|
19
19
|
/**
|
|
20
20
|
* Convert the received value to a string
|
|
21
21
|
*/
|
|
@@ -24,7 +24,7 @@ export declare const getStringValue: (value: boolean | string | string[] | Dropd
|
|
|
24
24
|
* Format the received value to a date string
|
|
25
25
|
* yyyy-mm-dd
|
|
26
26
|
*/
|
|
27
|
-
export declare const getDateValue: (value: string) => string | undefined;
|
|
27
|
+
export declare const getDateValue: (value: string | Date) => string | undefined;
|
|
28
28
|
/**
|
|
29
29
|
* Format a custom field value to ensure a consistent representation in the ui.
|
|
30
30
|
*/
|