@singularsystems/neo-core 1.3.0 → 1.3.1
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/dist/Data/Serialiser.js +1 -1
- package/dist/Dates/DateUtils.d.ts +7 -2
- package/dist/Dates/DateUtils.js +13 -2
- package/dist/Model/List.d.ts +2 -0
- package/dist/Model/List.js +8 -0
- package/dist/Settings.d.ts +1 -1
- package/dist/Settings.js +1 -1
- package/dist/Utils.js +5 -0
- package/package.json +1 -1
package/dist/Data/Serialiser.js
CHANGED
|
@@ -152,7 +152,7 @@ var Serialiser = /** @class */ (function () {
|
|
|
152
152
|
to[key] = NumberUtils.decimalService.toNumber(fromValue);
|
|
153
153
|
}
|
|
154
154
|
else if (propertyInfo.timeZoneSerialisation === TimeZoneFormat.None && fromValue instanceof Date) {
|
|
155
|
-
to[key] = DateUtils.
|
|
155
|
+
to[key] = DateUtils.formatApi(fromValue, propertyInfo.timeZoneSerialisation);
|
|
156
156
|
}
|
|
157
157
|
else {
|
|
158
158
|
to[key] = fromValue;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IPropertyInstance } from "../Model/PropertyInstance";
|
|
2
|
+
import { TimeZoneFormat } from "../Misc";
|
|
2
3
|
import { ITimeSpan, TimeSpan } from "./TimeSpan";
|
|
3
4
|
export default class DateUtils {
|
|
4
5
|
static defaultFormatString: string;
|
|
@@ -11,7 +12,11 @@ export default class DateUtils {
|
|
|
11
12
|
monthNames: string[];
|
|
12
13
|
};
|
|
13
14
|
static format(date: Date, formatString?: string, utc?: boolean): string;
|
|
14
|
-
static format(dateProperty:
|
|
15
|
+
static format(dateProperty: IPropertyInstance<Date>): string;
|
|
16
|
+
/**
|
|
17
|
+
* Formats a date using api standards.
|
|
18
|
+
*/
|
|
19
|
+
static formatApi(date: Date, timezoneFormat: TimeZoneFormat): string;
|
|
15
20
|
private static pad;
|
|
16
21
|
/**
|
|
17
22
|
* Tries to parse a date from a string using the supplied format string
|
package/dist/Dates/DateUtils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TimeZoneFormat } from "../Misc";
|
|
2
2
|
import { TimeSpan } from "./TimeSpan";
|
|
3
3
|
var DateUtils = /** @class */ (function () {
|
|
4
4
|
function DateUtils() {
|
|
@@ -9,7 +9,7 @@ var DateUtils = /** @class */ (function () {
|
|
|
9
9
|
var dateProperty = dateOrDateProperty;
|
|
10
10
|
if (dateProperty === null || dateProperty === void 0 ? void 0 : dateProperty.propertyInfo) {
|
|
11
11
|
date = dateProperty.value;
|
|
12
|
-
formatString = dateProperty.propertyInfo.timeZoneSerialisation ===
|
|
12
|
+
formatString = dateProperty.propertyInfo.timeZoneSerialisation === TimeZoneFormat.None ? DateUtils.defaultFormatString : DateUtils.defaultFormatStringWithTime;
|
|
13
13
|
}
|
|
14
14
|
if (!date)
|
|
15
15
|
return "";
|
|
@@ -57,6 +57,17 @@ var DateUtils = /** @class */ (function () {
|
|
|
57
57
|
return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
|
|
58
58
|
});
|
|
59
59
|
};
|
|
60
|
+
/**
|
|
61
|
+
* Formats a date using api standards.
|
|
62
|
+
*/
|
|
63
|
+
DateUtils.formatApi = function (date, timezoneFormat) {
|
|
64
|
+
if (timezoneFormat === TimeZoneFormat.UTC) {
|
|
65
|
+
return date.toISOString();
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
return DateUtils.format(date, "yyyy-MM-dd") + "T00:00:00";
|
|
69
|
+
}
|
|
70
|
+
};
|
|
60
71
|
DateUtils.pad = function (val, len) {
|
|
61
72
|
if (len === void 0) { len = 2; }
|
|
62
73
|
val = String(val);
|
package/dist/Model/List.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export default class List<T> extends Array<T> {
|
|
|
14
14
|
private _deletedList;
|
|
15
15
|
get deletedList(): T[];
|
|
16
16
|
get canDeserialise(): ObjectFactory | (new () => T) | undefined;
|
|
17
|
+
/** Returns items that are not marked for deletion */
|
|
18
|
+
get activeItems(): T[];
|
|
17
19
|
/** Returns the count of non deleted items. */
|
|
18
20
|
get activeLength(): number;
|
|
19
21
|
private baseMethods;
|
package/dist/Model/List.js
CHANGED
|
@@ -40,6 +40,14 @@ var List = /** @class */ (function (_super) {
|
|
|
40
40
|
enumerable: false,
|
|
41
41
|
configurable: true
|
|
42
42
|
});
|
|
43
|
+
Object.defineProperty(List.prototype, "activeItems", {
|
|
44
|
+
/** Returns items that are not marked for deletion */
|
|
45
|
+
get: function () {
|
|
46
|
+
return this.filter(function (item) { return !item.isSelfDeleting; });
|
|
47
|
+
},
|
|
48
|
+
enumerable: false,
|
|
49
|
+
configurable: true
|
|
50
|
+
});
|
|
43
51
|
Object.defineProperty(List.prototype, "activeLength", {
|
|
44
52
|
/** Returns the count of non deleted items. */
|
|
45
53
|
get: function () {
|
package/dist/Settings.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export declare const Settings: {
|
|
|
29
29
|
collapsed: any;
|
|
30
30
|
sortAsc: any;
|
|
31
31
|
sortDesc: any;
|
|
32
|
-
/**
|
|
32
|
+
/** **Note:** also change the back icon in the `buttons.backButton` setting. */
|
|
33
33
|
backIcon: any;
|
|
34
34
|
unDelete: any;
|
|
35
35
|
shouldSuppress: (context: {
|
package/dist/Settings.js
CHANGED
|
@@ -27,7 +27,7 @@ export var Settings = {
|
|
|
27
27
|
collapsed: "far-plus-square",
|
|
28
28
|
sortAsc: "sort-up",
|
|
29
29
|
sortDesc: "sort-down",
|
|
30
|
-
/**
|
|
30
|
+
/** **Note:** also change the back icon in the `buttons.backButton` setting. */
|
|
31
31
|
backIcon: "arrow-left",
|
|
32
32
|
unDelete: "trash-restore",
|
|
33
33
|
shouldSuppress: function (context) { return false; },
|
package/dist/Utils.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { __spreadArray } from "tslib";
|
|
2
2
|
import { DebounceHelper } from './DebounceHelper';
|
|
3
3
|
import { ensureTypeInfo } from './Model/NeoTypeInfo';
|
|
4
|
+
import DateUtils from "./Dates/DateUtils";
|
|
5
|
+
import { TimeZoneFormat } from "./Misc";
|
|
4
6
|
var lut = [];
|
|
5
7
|
for (var i = 0; i < 256; i++) {
|
|
6
8
|
lut[i] = (i < 16 ? '0' : '') + (i).toString(16);
|
|
@@ -233,6 +235,9 @@ var Utils = /** @class */ (function () {
|
|
|
233
235
|
}
|
|
234
236
|
return queryString;
|
|
235
237
|
}
|
|
238
|
+
if (plainObject instanceof Date) {
|
|
239
|
+
return DateUtils.formatApi(plainObject, DateUtils.stripTime(plainObject).getTime() === plainObject.getTime() ? TimeZoneFormat.None : TimeZoneFormat.UTC);
|
|
240
|
+
}
|
|
236
241
|
return buildQueryString.apply(void 0, __spreadArray([plainObject, ""], properties, false));
|
|
237
242
|
};
|
|
238
243
|
return Utils;
|