@singularsystems/neo-core 1.0.16 → 1.0.18
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/Components/AnimationHelper.d.ts +7 -2
- package/dist/Components/AnimationHelper.js +20 -4
- package/dist/Components/BootstrapTypes.d.ts +1 -0
- package/dist/Components/ButtonOptions.d.ts +2 -0
- package/dist/Components/DatePicker/DatePicker.d.ts +1 -0
- package/dist/Components/DatePicker/DatePicker.js +13 -0
- package/dist/Components/PositionHelper.d.ts +1 -0
- package/dist/Components/PositionHelper.js +3 -0
- package/dist/Data/DataView.d.ts +2 -1
- package/dist/Data/DataView.js +0 -1
- package/dist/Data/Paging/PageManager.d.ts +1 -1
- package/dist/Data/Paging/PageManager.js +1 -1
- package/dist/Dates/DateUtils.d.ts +1 -1
- package/dist/Dates/DateUtils.js +35 -28
- package/package.json +5 -5
|
@@ -6,7 +6,8 @@ export default class AnimationHelper {
|
|
|
6
6
|
private container;
|
|
7
7
|
private animationClassName;
|
|
8
8
|
private currentChild;
|
|
9
|
-
private previousChild
|
|
9
|
+
private previousChild?;
|
|
10
|
+
private removingChild?;
|
|
10
11
|
private zIndex;
|
|
11
12
|
/**
|
|
12
13
|
* Creates an animation helper
|
|
@@ -22,7 +23,11 @@ export default class AnimationHelper {
|
|
|
22
23
|
/**
|
|
23
24
|
* Marks a child element of the container for removal. The element will only be removed from the DOM when the animation is complete.
|
|
24
25
|
*/
|
|
25
|
-
static beginRemove(container: HTMLElement, element: HTMLElement): void;
|
|
26
|
+
static beginRemove(container: HTMLElement, element: HTMLElement, onRemoved?: () => void): void;
|
|
27
|
+
/**
|
|
28
|
+
* Begins to remove the previously added child.
|
|
29
|
+
*/
|
|
30
|
+
private beginRemove;
|
|
26
31
|
/**
|
|
27
32
|
* Removes the previous child immediately with no animation.
|
|
28
33
|
*/
|
|
@@ -31,14 +31,30 @@ var AnimationHelper = /** @class */ (function () {
|
|
|
31
31
|
/**
|
|
32
32
|
* Marks a child element of the container for removal. The element will only be removed from the DOM when the animation is complete.
|
|
33
33
|
*/
|
|
34
|
-
AnimationHelper.beginRemove = function (container, element) {
|
|
34
|
+
AnimationHelper.beginRemove = function (container, element, onRemoved) {
|
|
35
35
|
// TODO: check that the element has a transision of the correct type applied to it, otherwise remove immediately.
|
|
36
36
|
element.addEventListener("transitionend", function () {
|
|
37
37
|
if (container.contains(element)) {
|
|
38
38
|
container.removeChild(element);
|
|
39
|
+
if (onRemoved !== undefined) {
|
|
40
|
+
onRemoved();
|
|
41
|
+
}
|
|
39
42
|
}
|
|
40
43
|
});
|
|
41
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* Begins to remove the previously added child.
|
|
47
|
+
*/
|
|
48
|
+
AnimationHelper.prototype.beginRemove = function (child) {
|
|
49
|
+
var _this = this;
|
|
50
|
+
if (this.removingChild) {
|
|
51
|
+
this.container.removeChild(this.removingChild);
|
|
52
|
+
}
|
|
53
|
+
this.removingChild = child;
|
|
54
|
+
AnimationHelper.beginRemove(this.container, child, function () {
|
|
55
|
+
_this.removingChild = undefined;
|
|
56
|
+
});
|
|
57
|
+
};
|
|
42
58
|
/**
|
|
43
59
|
* Removes the previous child immediately with no animation.
|
|
44
60
|
*/
|
|
@@ -54,7 +70,7 @@ var AnimationHelper = /** @class */ (function () {
|
|
|
54
70
|
AnimationHelper.prototype.slide = function (delta, horizontal) {
|
|
55
71
|
if (this.previousChild) {
|
|
56
72
|
AnimationHelper.beginSlide(this.previousChild, this.animationClassName, horizontal, 0, this.container.offsetWidth * -delta);
|
|
57
|
-
|
|
73
|
+
this.beginRemove(this.previousChild);
|
|
58
74
|
}
|
|
59
75
|
AnimationHelper.beginSlide(this.currentChild, this.animationClassName, horizontal, this.container.offsetWidth * delta, 0);
|
|
60
76
|
};
|
|
@@ -64,7 +80,7 @@ var AnimationHelper = /** @class */ (function () {
|
|
|
64
80
|
AnimationHelper.prototype.fade = function () {
|
|
65
81
|
if (this.previousChild) {
|
|
66
82
|
AnimationHelper.fade(this.previousChild, this.animationClassName, false);
|
|
67
|
-
|
|
83
|
+
this.beginRemove(this.previousChild);
|
|
68
84
|
}
|
|
69
85
|
AnimationHelper.fade(this.currentChild, this.animationClassName, true);
|
|
70
86
|
};
|
|
@@ -75,7 +91,7 @@ var AnimationHelper = /** @class */ (function () {
|
|
|
75
91
|
AnimationHelper.prototype.fadeAndScale = function (fromAbove) {
|
|
76
92
|
if (this.previousChild) {
|
|
77
93
|
AnimationHelper.fade(this.previousChild, this.animationClassName, false);
|
|
78
|
-
|
|
94
|
+
this.beginRemove(this.previousChild);
|
|
79
95
|
}
|
|
80
96
|
AnimationHelper.scale(this.currentChild, this.animationClassName, fromAbove ? 1.5 : 0.2, 1);
|
|
81
97
|
};
|
|
@@ -3,6 +3,7 @@ export type columnWidth = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
|
3
3
|
export type columnCount = 1 | 2 | 3 | 4 | 6 | 12;
|
|
4
4
|
export type gutterSize = 1 | 2 | 3 | 4 | 5;
|
|
5
5
|
export type flexItemAlign = "start" | "end" | "center";
|
|
6
|
+
export type flexJustifyContent = "start" | "end" | "center" | "between";
|
|
6
7
|
export type breakpoint = "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
|
|
7
8
|
export type ElementOrText = any;
|
|
8
9
|
export interface IColumnWidthBreakpoints {
|
|
@@ -56,6 +56,8 @@ export interface IButtonOptions {
|
|
|
56
56
|
export interface IButtonDropDownItem {
|
|
57
57
|
/** Menu item text or component */
|
|
58
58
|
text?: ElementOrText;
|
|
59
|
+
/** Muted text to display below the menu item text. */
|
|
60
|
+
subText?: string;
|
|
59
61
|
/** Specify a string name if using font-awesome. No need to specify fa- */
|
|
60
62
|
icon?: any;
|
|
61
63
|
/** Make this a non clickable header item. */
|
|
@@ -22,6 +22,7 @@ var DatePicker = /** @class */ (function () {
|
|
|
22
22
|
this.inputBlurred = this.inputBlurred.bind(this);
|
|
23
23
|
this.inputChanged = this.inputChanged.bind(this);
|
|
24
24
|
this.inputKeyDown = this.inputKeyDown.bind(this);
|
|
25
|
+
this.onMouseWheel = this.onMouseWheel.bind(this);
|
|
25
26
|
if (DatePicker.mustShowInput(options)) {
|
|
26
27
|
this.input = this.container.getElementsByTagName('input')[0];
|
|
27
28
|
this.input.addEventListener("focus", this.inputFocused);
|
|
@@ -113,6 +114,17 @@ var DatePicker = /** @class */ (function () {
|
|
|
113
114
|
}
|
|
114
115
|
}
|
|
115
116
|
};
|
|
117
|
+
DatePicker.prototype.onMouseWheel = function (e) {
|
|
118
|
+
if (e.deltaY !== 0) {
|
|
119
|
+
if (e.deltaY > 0) {
|
|
120
|
+
this.moveCurrent(1);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
this.moveCurrent(-1);
|
|
124
|
+
}
|
|
125
|
+
e.preventDefault();
|
|
126
|
+
}
|
|
127
|
+
};
|
|
116
128
|
DatePicker.prototype.removePopup = function (animate) {
|
|
117
129
|
var _a;
|
|
118
130
|
if (this.popup && !this.options.alwaysShow) {
|
|
@@ -240,6 +252,7 @@ var DatePicker = /** @class */ (function () {
|
|
|
240
252
|
this.popup.addEventListener("mouseenter", function () { return _this.positionPopup(false); });
|
|
241
253
|
this.popup.addEventListener("mouseleave", function () { return _this.positionPopup(true); });
|
|
242
254
|
}
|
|
255
|
+
this.popup.addEventListener("wheel", this.onMouseWheel);
|
|
243
256
|
this.createHeader(this.popup);
|
|
244
257
|
this.createContentContainer(this.popup);
|
|
245
258
|
}
|
|
@@ -23,6 +23,7 @@ export default class PositionHelper {
|
|
|
23
23
|
static positionElement(popup: HTMLElement, position: IRelativePosition, fromBottom?: boolean): void;
|
|
24
24
|
/**
|
|
25
25
|
* Ensures that a popup element is positioned so that it remains in the bounds of the screen by left/right/top/bottom aligning it relative to the anchor element.
|
|
26
|
+
* Note: the left and right values will be reset to ensure the width is accurately calculated.
|
|
26
27
|
* @param anchor The element to which the popup is anchored
|
|
27
28
|
* @param popup The element which pops up from the anchor.
|
|
28
29
|
* @param alignRight True if the popup must be aligned to the anchors right position.
|
|
@@ -45,6 +45,7 @@ var PositionHelper = /** @class */ (function () {
|
|
|
45
45
|
};
|
|
46
46
|
/**
|
|
47
47
|
* Ensures that a popup element is positioned so that it remains in the bounds of the screen by left/right/top/bottom aligning it relative to the anchor element.
|
|
48
|
+
* Note: the left and right values will be reset to ensure the width is accurately calculated.
|
|
48
49
|
* @param anchor The element to which the popup is anchored
|
|
49
50
|
* @param popup The element which pops up from the anchor.
|
|
50
51
|
* @param alignRight True if the popup must be aligned to the anchors right position.
|
|
@@ -52,6 +53,8 @@ var PositionHelper = /** @class */ (function () {
|
|
|
52
53
|
*/
|
|
53
54
|
PositionHelper.getRelativePosition = function (anchor, popup, alignRight, hAlign) {
|
|
54
55
|
if (alignRight === void 0) { alignRight = false; }
|
|
56
|
+
popup.style.left = "0";
|
|
57
|
+
popup.style.right = "";
|
|
55
58
|
var popupHeight = popup.offsetHeight;
|
|
56
59
|
var containerScreenRect = anchor.getBoundingClientRect();
|
|
57
60
|
var position = {
|
package/dist/Data/DataView.d.ts
CHANGED
|
@@ -6,7 +6,8 @@ export declare abstract class DataViewBase<T> {
|
|
|
6
6
|
private originalSource;
|
|
7
7
|
sortInfo: SortOperation[];
|
|
8
8
|
protected noSortSymbol: symbol;
|
|
9
|
-
|
|
9
|
+
/** Indicates whether the data source allows sorting by default. Can be overridden at a property level. */
|
|
10
|
+
allowSort?: boolean;
|
|
10
11
|
performsRemoteSorting: boolean;
|
|
11
12
|
constructor(originalSource: T[]);
|
|
12
13
|
/**
|
package/dist/Data/DataView.js
CHANGED
|
@@ -27,7 +27,7 @@ export interface IPageManagerOptions<TCriteria extends ValueObject, TModel> {
|
|
|
27
27
|
*/
|
|
28
28
|
sortAscending?: boolean | boolean[];
|
|
29
29
|
/**
|
|
30
|
-
* Set to false if you don't want to allow sorting.
|
|
30
|
+
* Set to false if you don't want to allow sorting by default.
|
|
31
31
|
*/
|
|
32
32
|
allowSort?: boolean;
|
|
33
33
|
/**
|
|
@@ -18,7 +18,7 @@ var PageManager = /** @class */ (function (_super) {
|
|
|
18
18
|
_this.initialFetchState = "none";
|
|
19
19
|
_this.isInvalidated = false;
|
|
20
20
|
_this.options = options || {};
|
|
21
|
-
_this.allowSort = _this.options.allowSort
|
|
21
|
+
_this.allowSort = _this.options.allowSort;
|
|
22
22
|
_this.performsRemoteSorting = true;
|
|
23
23
|
_this.pageRequest = new PageRequest(criteria);
|
|
24
24
|
_this.pageRequest.pageSize = _this.options.pageSize || 20;
|
|
@@ -18,7 +18,7 @@ export default class DateUtils {
|
|
|
18
18
|
* @param dateString The string to parse
|
|
19
19
|
* @param format The format string. This is only used to get the order of d/m/y
|
|
20
20
|
* @param requireAllParts True if day month and year must be specified
|
|
21
|
-
* @param refDate Reference date. E.g. if the year is
|
|
21
|
+
* @param refDate Reference date. E.g. if the year is omitted in the date string, then the year from the reference date will be used. Today is used if no reference date is supplied.
|
|
22
22
|
*/
|
|
23
23
|
static tryParse(dateString: string, format?: string, requireAllParts?: boolean, refDate?: Date): Date | null;
|
|
24
24
|
static min(date1: Date, date2: Date): Date;
|
package/dist/Dates/DateUtils.js
CHANGED
|
@@ -70,9 +70,10 @@ var DateUtils = /** @class */ (function () {
|
|
|
70
70
|
* @param dateString The string to parse
|
|
71
71
|
* @param format The format string. This is only used to get the order of d/m/y
|
|
72
72
|
* @param requireAllParts True if day month and year must be specified
|
|
73
|
-
* @param refDate Reference date. E.g. if the year is
|
|
73
|
+
* @param refDate Reference date. E.g. if the year is omitted in the date string, then the year from the reference date will be used. Today is used if no reference date is supplied.
|
|
74
74
|
*/
|
|
75
75
|
DateUtils.tryParse = function (dateString, format, requireAllParts, refDate) {
|
|
76
|
+
var _a;
|
|
76
77
|
if (format === void 0) { format = ""; }
|
|
77
78
|
if (requireAllParts === void 0) { requireAllParts = false; }
|
|
78
79
|
if (!dateString)
|
|
@@ -80,38 +81,36 @@ var DateUtils = /** @class */ (function () {
|
|
|
80
81
|
if (!format)
|
|
81
82
|
format = DateUtils.defaultFormatString;
|
|
82
83
|
var returnDate = !refDate ? new Date() : new Date(refDate);
|
|
84
|
+
var timeString = "", isPM = false;
|
|
83
85
|
// Find the position of d m and y in the format string.
|
|
84
|
-
var d = format.indexOf('d'), m = format.indexOf('M'), y = format.indexOf('y'),
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (
|
|
90
|
-
|
|
86
|
+
var d = format.indexOf('d'), m = format.indexOf('M'), y = format.indexOf('y'), h = format.indexOf("H"), extra = 100;
|
|
87
|
+
var expectedDateParts = (d < 0 ? 0 : 1) + (m < 0 ? 0 : 1) + (y < 0 ? 0 : 1);
|
|
88
|
+
// Replace common separators in the date string with /
|
|
89
|
+
dateString = dateString.replace(/-/g, '/').replace(/ /g, '/').replace(/\xA0/g, '/');
|
|
90
|
+
// If the user doesn't put in separators, e.g. 0103, then add them to make the string value 01/03
|
|
91
|
+
if ((d == 0 || m == 0) && dateString.indexOf('/') == -1 && dateString.length >= 4 && !isNaN(+dateString)) {
|
|
92
|
+
dateString = dateString.substring(0, 2) + '/' + dateString.substring(2, 4) + (dateString.length == 8 || dateString.length == 6 ? '/' + dateString.substring(4, dateString.length) : '');
|
|
91
93
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
var parts = dateString.split("/");
|
|
95
|
+
if (parts.length > expectedDateParts && (h >= 0)) {
|
|
96
|
+
timeString = parts.pop();
|
|
97
|
+
var pmPos = (_a = /[ap]m/i.exec(timeString)) === null || _a === void 0 ? void 0 : _a.index;
|
|
98
|
+
if (pmPos !== undefined) {
|
|
99
|
+
isPM = timeString.toUpperCase().indexOf("PM") >= 0;
|
|
100
|
+
if (pmPos === 0) {
|
|
101
|
+
timeString = parts.pop();
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
timeString = timeString.substring(0, pmPos);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
101
107
|
}
|
|
102
108
|
// Date component
|
|
103
|
-
if (
|
|
109
|
+
if (expectedDateParts > 0) {
|
|
104
110
|
// Add missing d/m/y on the end.
|
|
105
|
-
d = d == -1 ?
|
|
106
|
-
m = m == -1 ?
|
|
107
|
-
y = y == -1 ?
|
|
108
|
-
// Replace common separators in the date string with /
|
|
109
|
-
var str = dateString.replace(/-/g, '/').replace(/ /g, '/').replace(/\xA0/g, '/');
|
|
110
|
-
// If the user doesnt put in separators, e.g. 0103, then add them to make the string value 01/03
|
|
111
|
-
if ((d == 0 || m == 0) && str.indexOf('/') == -1 && str.length >= 4 && !isNaN(+str)) {
|
|
112
|
-
str = str.substring(0, 2) + '/' + str.substring(2, 4) + (str.length == 8 || str.length == 6 ? '/' + str.substring(4, str.length) : '');
|
|
113
|
-
}
|
|
114
|
-
var parts = str.split('/');
|
|
111
|
+
d = d == -1 ? extra++ : d;
|
|
112
|
+
m = m == -1 ? extra++ : m;
|
|
113
|
+
y = y == -1 ? extra++ : y;
|
|
115
114
|
if (requireAllParts && parts.length < 3)
|
|
116
115
|
return null;
|
|
117
116
|
// if format is dd mmm yyyy, and the user omits the dd, then add 1st day.
|
|
@@ -141,6 +140,14 @@ var DateUtils = /** @class */ (function () {
|
|
|
141
140
|
}
|
|
142
141
|
// Get time component.
|
|
143
142
|
if (timeString) {
|
|
143
|
+
if (timeString.indexOf(":") < 0) {
|
|
144
|
+
if (timeString.length >= 5) {
|
|
145
|
+
timeString = timeString.substring(0, timeString.length - 4) + ":" + timeString.substring(timeString.length - 4, timeString.length - 2) + ":" + timeString.substring(timeString.length - 2);
|
|
146
|
+
}
|
|
147
|
+
else if (timeString.length >= 3) {
|
|
148
|
+
timeString = timeString.substring(0, timeString.length - 2) + ":" + timeString.substring(timeString.length - 2);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
144
151
|
var time = new Date(0);
|
|
145
152
|
time.setHours.apply(time, timeString.split(":").map(function (s) { return parseInt(s); }));
|
|
146
153
|
if (isNaN(time)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@singularsystems/neo-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"description": "Core functionality for the Neo client library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,19 +15,19 @@
|
|
|
15
15
|
"author": "Singular Systems",
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/jest": "29.5.
|
|
18
|
+
"@types/jest": "29.5.13",
|
|
19
19
|
"@types/node": "20.11.24",
|
|
20
20
|
"@types/react": "18.2.4",
|
|
21
21
|
"decimal.js-light": "2.5.1",
|
|
22
|
-
"jest": "29.
|
|
22
|
+
"jest": "29.7.0",
|
|
23
23
|
"ts-jest": "29.1.0",
|
|
24
24
|
"typescript": "5.4.2"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@microsoft/signalr": "^6.0.1",
|
|
28
|
-
"axios": "1.7.
|
|
28
|
+
"axios": "1.7.7",
|
|
29
29
|
"inversify": "^6.0.2",
|
|
30
|
-
"reflect-metadata": "0.
|
|
30
|
+
"reflect-metadata": "0.2.2",
|
|
31
31
|
"tslib": "2.7.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|