@singularsystems/neo-core 1.0.11 → 1.0.13
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/DatePicker/DatePicker.d.ts +2 -1
- package/dist/Components/DatePicker/DatePicker.js +28 -17
- package/dist/Components/PositionHelper.d.ts +38 -1
- package/dist/Components/PositionHelper.js +98 -10
- package/dist/Components/index.d.ts +1 -1
- package/dist/Components/index.js +1 -1
- package/dist/Data/Deserialiser.js +1 -1
- package/dist/Data/Paging/PageManager.d.ts +1 -1
- package/dist/Data/Paging/PageManager.js +5 -6
- package/dist/Model/ObservableValue.d.ts +8 -0
- package/dist/Model/ObservableValue.js +17 -0
- package/dist/Model/index.d.ts +1 -1
- package/dist/Model/index.js +1 -1
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ export default class DatePicker {
|
|
|
10
10
|
private headerAnimationHelper;
|
|
11
11
|
private inputHasChanged;
|
|
12
12
|
private input;
|
|
13
|
-
private popup
|
|
13
|
+
private popup?;
|
|
14
14
|
private headerContainer;
|
|
15
15
|
private currentHeaderLabel;
|
|
16
16
|
private prevButton;
|
|
@@ -22,6 +22,7 @@ export default class DatePicker {
|
|
|
22
22
|
private boundDateNoTime;
|
|
23
23
|
private today;
|
|
24
24
|
private currentViewDate;
|
|
25
|
+
private positionHelper?;
|
|
25
26
|
constructor(container: HTMLDivElement, options?: IPartialDateProps);
|
|
26
27
|
static mustShowInput(options?: IPartialDateProps): boolean | undefined;
|
|
27
28
|
inputFocused(e: FocusEvent): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import DateUtils from '../../Dates/DateUtils';
|
|
2
2
|
import AnimationHelper from '../AnimationHelper';
|
|
3
3
|
import { YearsInYearView, ProcessedDatePickerOptions } from './DatePickerOptions';
|
|
4
|
-
import
|
|
4
|
+
import { FixedPositionHelper } from '../PositionHelper';
|
|
5
5
|
// TODO: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
|
|
6
6
|
// TODO: Allow input to be shown with inline picker, and specify position.
|
|
7
7
|
var ViewType;
|
|
@@ -114,6 +114,7 @@ var DatePicker = /** @class */ (function () {
|
|
|
114
114
|
}
|
|
115
115
|
};
|
|
116
116
|
DatePicker.prototype.removePopup = function (animate) {
|
|
117
|
+
var _a;
|
|
117
118
|
if (this.popup && !this.options.alwaysShow) {
|
|
118
119
|
if (animate) {
|
|
119
120
|
AnimationHelper.scale(this.popup, DatePicker.AnimationClassName, 1, 0);
|
|
@@ -124,7 +125,9 @@ var DatePicker = /** @class */ (function () {
|
|
|
124
125
|
}
|
|
125
126
|
this.currentHeaderLabel = null;
|
|
126
127
|
this.currentContentTable = null;
|
|
127
|
-
this.popup =
|
|
128
|
+
this.popup = undefined;
|
|
129
|
+
(_a = this.positionHelper) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
130
|
+
this.positionHelper = undefined;
|
|
128
131
|
}
|
|
129
132
|
};
|
|
130
133
|
DatePicker.prototype.setBindValue = function (dateValue, options) {
|
|
@@ -140,7 +143,7 @@ var DatePicker = /** @class */ (function () {
|
|
|
140
143
|
if (options.close) {
|
|
141
144
|
this.removePopup(true);
|
|
142
145
|
}
|
|
143
|
-
if (!options.close ||
|
|
146
|
+
if (!options.close || options.forceDraw) {
|
|
144
147
|
this.resetCurrentViewDate();
|
|
145
148
|
this.populateContentContainer(true);
|
|
146
149
|
}
|
|
@@ -173,9 +176,12 @@ var DatePicker = /** @class */ (function () {
|
|
|
173
176
|
}
|
|
174
177
|
};
|
|
175
178
|
DatePicker.prototype.positionPopup = function (fromBottom) {
|
|
176
|
-
if (this.popup) {
|
|
179
|
+
if (this.popup && !this.options.alwaysShow) {
|
|
177
180
|
var textAlign = this.options.popupAlignRight ? undefined : window.getComputedStyle(this.input).textAlign;
|
|
178
|
-
|
|
181
|
+
if (!this.positionHelper) {
|
|
182
|
+
this.positionHelper = new FixedPositionHelper(this.container, this.popup);
|
|
183
|
+
}
|
|
184
|
+
this.positionHelper.positionPopup(this.options.popupAlignRight, textAlign, fromBottom);
|
|
179
185
|
}
|
|
180
186
|
};
|
|
181
187
|
/**
|
|
@@ -234,15 +240,15 @@ var DatePicker = /** @class */ (function () {
|
|
|
234
240
|
this.popup.addEventListener("mouseenter", function () { return _this.positionPopup(false); });
|
|
235
241
|
this.popup.addEventListener("mouseleave", function () { return _this.positionPopup(true); });
|
|
236
242
|
}
|
|
237
|
-
this.createHeader();
|
|
238
|
-
this.createContentContainer();
|
|
243
|
+
this.createHeader(this.popup);
|
|
244
|
+
this.createContentContainer(this.popup);
|
|
239
245
|
}
|
|
240
246
|
else {
|
|
241
247
|
this.populateContentContainer(true);
|
|
242
248
|
}
|
|
243
249
|
};
|
|
244
|
-
DatePicker.prototype.createHeader = function () {
|
|
245
|
-
var header = this.createAndAppend(
|
|
250
|
+
DatePicker.prototype.createHeader = function (parent) {
|
|
251
|
+
var header = this.createAndAppend(parent, "div", "neo-datepicker-header");
|
|
246
252
|
header.addEventListener("mousedown", function (e) { return e.preventDefault(); });
|
|
247
253
|
this.prevButton = this.createAndAppend(header, "button", "left-button");
|
|
248
254
|
this.prevButton.type = "button";
|
|
@@ -258,7 +264,7 @@ var DatePicker = /** @class */ (function () {
|
|
|
258
264
|
this.nextButton.tabIndex = -1;
|
|
259
265
|
this.nextButton.addEventListener("mousedown", this.nextClick.bind(this));
|
|
260
266
|
};
|
|
261
|
-
DatePicker.prototype.createHeaderLabel = function () {
|
|
267
|
+
DatePicker.prototype.createHeaderLabel = function (displayImmediately) {
|
|
262
268
|
this.currentHeaderLabel = this.createAndAppend(this.headerContainer, "div", "header-text");
|
|
263
269
|
if (this.currentViewType == ViewType.Days) {
|
|
264
270
|
this.currentHeaderLabel.innerText = DateUtils.format(this.currentViewDate, "MMMM yyyy");
|
|
@@ -273,10 +279,15 @@ var DatePicker = /** @class */ (function () {
|
|
|
273
279
|
this.currentHeaderLabel.className += " selectable";
|
|
274
280
|
}
|
|
275
281
|
this.headerAnimationHelper.addChild(this.currentHeaderLabel, false);
|
|
276
|
-
|
|
282
|
+
if (displayImmediately) {
|
|
283
|
+
this.headerAnimationHelper.replace();
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
this.headerAnimationHelper.fade();
|
|
287
|
+
}
|
|
277
288
|
};
|
|
278
|
-
DatePicker.prototype.createContentContainer = function () {
|
|
279
|
-
this.contentContainer = this.createAndAppend(
|
|
289
|
+
DatePicker.prototype.createContentContainer = function (parent) {
|
|
290
|
+
this.contentContainer = this.createAndAppend(parent, "div", "neo-datepicker-content");
|
|
280
291
|
this.contentContainer.addEventListener("mousedown", this.contentClick.bind(this));
|
|
281
292
|
this.contentAnimationHelper = new AnimationHelper(this.contentContainer, DatePicker.AnimationClassName);
|
|
282
293
|
this.populateContentContainer(!!this.options.alwaysShow);
|
|
@@ -298,7 +309,7 @@ var DatePicker = /** @class */ (function () {
|
|
|
298
309
|
this.currentViewDate.setFullYear(this.currentViewDate.getFullYear() - this.options.yearsBeforeInYearView);
|
|
299
310
|
this.createYearsView();
|
|
300
311
|
}
|
|
301
|
-
this.createHeaderLabel();
|
|
312
|
+
this.createHeaderLabel(displayImmediately);
|
|
302
313
|
this.contentAnimationHelper.addChild(this.currentContentTable, true);
|
|
303
314
|
if (displayImmediately) {
|
|
304
315
|
this.contentAnimationHelper.replace();
|
|
@@ -412,12 +423,12 @@ var DatePicker = /** @class */ (function () {
|
|
|
412
423
|
};
|
|
413
424
|
DatePicker.prototype.dayClicked = function (datePartsString) {
|
|
414
425
|
var dateParts = datePartsString.split(",");
|
|
415
|
-
this.setBindValue(new Date(parseInt(dateParts[0]), parseInt(dateParts[1]), parseInt(dateParts[2])), { preserveTime: true, close: true });
|
|
426
|
+
this.setBindValue(new Date(parseInt(dateParts[0]), parseInt(dateParts[1]), parseInt(dateParts[2])), { preserveTime: true, close: true, forceDraw: this.options.alwaysShow });
|
|
416
427
|
};
|
|
417
428
|
DatePicker.prototype.monthClicked = function (monthString) {
|
|
418
429
|
this.currentViewDate.setMonth(parseInt(monthString));
|
|
419
430
|
if (this.options.monthView) {
|
|
420
|
-
this.setBindValue(this.currentViewDate, { preserveTime: true, close: true });
|
|
431
|
+
this.setBindValue(this.currentViewDate, { preserveTime: true, close: true, forceDraw: this.options.alwaysShow });
|
|
421
432
|
}
|
|
422
433
|
else {
|
|
423
434
|
this.currentViewType = ViewType.Days;
|
|
@@ -428,7 +439,7 @@ var DatePicker = /** @class */ (function () {
|
|
|
428
439
|
DatePicker.prototype.yearClicked = function (yearString) {
|
|
429
440
|
this.currentViewDate.setFullYear(parseInt(yearString));
|
|
430
441
|
if (this.options.yearView) {
|
|
431
|
-
this.setBindValue(this.currentViewDate, { preserveTime: true, close: true });
|
|
442
|
+
this.setBindValue(this.currentViewDate, { preserveTime: true, close: true, forceDraw: this.options.alwaysShow });
|
|
432
443
|
}
|
|
433
444
|
else {
|
|
434
445
|
this.currentViewType = ViewType.Months;
|
|
@@ -1,11 +1,48 @@
|
|
|
1
|
+
import { IDisposable } from "../Misc";
|
|
2
|
+
interface IRelativePosition {
|
|
3
|
+
left?: number;
|
|
4
|
+
right?: number;
|
|
5
|
+
/** Indicates that there is not enough space at the bottom of the anchor. Popup should be displayed on top. */
|
|
6
|
+
onTop: boolean;
|
|
7
|
+
anchorHeight: number;
|
|
8
|
+
popupHeight: number;
|
|
9
|
+
}
|
|
1
10
|
export default class PositionHelper {
|
|
2
11
|
/**
|
|
3
12
|
* 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.
|
|
4
|
-
* @param
|
|
13
|
+
* @param anchor The element to which the popup is anchored
|
|
5
14
|
* @param popup The element which pops up from the anchor.
|
|
6
15
|
* @param fromBottom True if the popups bottom style property must be set. Set to false if there are buttons at the top of the popup and the popups height may change.
|
|
7
16
|
* @param alignRight True if the popup must be aligned to the anchors right position.
|
|
8
17
|
* @param hAlign Horizontal alignment of the popup edge relative to the anchor edge. Overrides alignRight
|
|
9
18
|
*/
|
|
10
19
|
static checkScreenBounds(anchor: HTMLElement, popup: HTMLElement, fromBottom?: boolean, alignRight?: boolean, hAlign?: "left" | "center" | "right"): void;
|
|
20
|
+
/**
|
|
21
|
+
* Used internally by neo. Use `checkScreenBounds` instead of this method.
|
|
22
|
+
*/
|
|
23
|
+
static positionElement(popup: HTMLElement, position: IRelativePosition, fromBottom?: boolean): void;
|
|
24
|
+
/**
|
|
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
|
+
* @param anchor The element to which the popup is anchored
|
|
27
|
+
* @param popup The element which pops up from the anchor.
|
|
28
|
+
* @param alignRight True if the popup must be aligned to the anchors right position.
|
|
29
|
+
* @param hAlign Horizontal alignment of the popup edge relative to the anchor edge. Overrides alignRight
|
|
30
|
+
*/
|
|
31
|
+
static getRelativePosition(anchor: HTMLElement, popup: HTMLElement, alignRight?: boolean, hAlign?: "left" | "center" | "right"): IRelativePosition;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Helper used to position elements with position: fixed relative to another element, while maintaining position on scroll.
|
|
35
|
+
* If popupElement has a display of 'absolute', then normal positioning is performed.
|
|
36
|
+
*/
|
|
37
|
+
export declare class FixedPositionHelper implements IDisposable {
|
|
38
|
+
private anchorElement;
|
|
39
|
+
private popupElement;
|
|
40
|
+
private isFixed;
|
|
41
|
+
private topOffset;
|
|
42
|
+
private positionInfo;
|
|
43
|
+
constructor(anchorElement: HTMLElement, popupElement: HTMLElement);
|
|
44
|
+
positionPopup(alignRight?: boolean, hAlign?: "left" | "center" | "right", fromBottom?: boolean): void;
|
|
45
|
+
private positionFixedPopup;
|
|
46
|
+
dispose(): void;
|
|
11
47
|
}
|
|
48
|
+
export {};
|
|
@@ -3,7 +3,7 @@ var PositionHelper = /** @class */ (function () {
|
|
|
3
3
|
}
|
|
4
4
|
/**
|
|
5
5
|
* 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.
|
|
6
|
-
* @param
|
|
6
|
+
* @param anchor The element to which the popup is anchored
|
|
7
7
|
* @param popup The element which pops up from the anchor.
|
|
8
8
|
* @param fromBottom True if the popups bottom style property must be set. Set to false if there are buttons at the top of the popup and the popups height may change.
|
|
9
9
|
* @param alignRight True if the popup must be aligned to the anchors right position.
|
|
@@ -12,23 +12,57 @@ var PositionHelper = /** @class */ (function () {
|
|
|
12
12
|
PositionHelper.checkScreenBounds = function (anchor, popup, fromBottom, alignRight, hAlign) {
|
|
13
13
|
if (fromBottom === void 0) { fromBottom = true; }
|
|
14
14
|
if (alignRight === void 0) { alignRight = false; }
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
var position = this.getRelativePosition(anchor, popup, alignRight, hAlign);
|
|
16
|
+
this.positionElement(popup, position, fromBottom);
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Used internally by neo. Use `checkScreenBounds` instead of this method.
|
|
20
|
+
*/
|
|
21
|
+
PositionHelper.positionElement = function (popup, position, fromBottom) {
|
|
22
|
+
if (fromBottom === void 0) { fromBottom = true; }
|
|
23
|
+
if (position.onTop) {
|
|
19
24
|
if (fromBottom) {
|
|
20
25
|
popup.style.top = "auto";
|
|
21
26
|
popup.style.bottom = "100%";
|
|
22
27
|
}
|
|
23
28
|
else {
|
|
24
29
|
popup.style.bottom = "";
|
|
25
|
-
popup.style.top = -(popupHeight) + "px";
|
|
30
|
+
popup.style.top = -(position.popupHeight) + "px";
|
|
26
31
|
}
|
|
27
32
|
}
|
|
28
33
|
else {
|
|
29
34
|
popup.style.top = "100%";
|
|
30
35
|
popup.style.bottom = "auto";
|
|
31
36
|
}
|
|
37
|
+
if (position.right) {
|
|
38
|
+
popup.style.left = "auto";
|
|
39
|
+
popup.style.right = position.right + "px";
|
|
40
|
+
}
|
|
41
|
+
else if (position.left) {
|
|
42
|
+
popup.style.left = position.left + "px";
|
|
43
|
+
popup.style.right = "";
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
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
|
+
* @param anchor The element to which the popup is anchored
|
|
49
|
+
* @param popup The element which pops up from the anchor.
|
|
50
|
+
* @param alignRight True if the popup must be aligned to the anchors right position.
|
|
51
|
+
* @param hAlign Horizontal alignment of the popup edge relative to the anchor edge. Overrides alignRight
|
|
52
|
+
*/
|
|
53
|
+
PositionHelper.getRelativePosition = function (anchor, popup, alignRight, hAlign) {
|
|
54
|
+
if (alignRight === void 0) { alignRight = false; }
|
|
55
|
+
var popupHeight = popup.offsetHeight;
|
|
56
|
+
var containerScreenRect = anchor.getBoundingClientRect();
|
|
57
|
+
var position = {
|
|
58
|
+
popupHeight: popupHeight,
|
|
59
|
+
anchorHeight: anchor.offsetHeight,
|
|
60
|
+
};
|
|
61
|
+
// Vertical
|
|
62
|
+
if (containerScreenRect.bottom + anchor.offsetHeight + popupHeight > window.innerHeight - 20 && containerScreenRect.top > popupHeight) {
|
|
63
|
+
position.onTop = true;
|
|
64
|
+
position.popupHeight = popupHeight;
|
|
65
|
+
}
|
|
32
66
|
// Horizontal
|
|
33
67
|
var popupWidth = popup.offsetWidth;
|
|
34
68
|
if (!hAlign) {
|
|
@@ -36,8 +70,7 @@ var PositionHelper = /** @class */ (function () {
|
|
|
36
70
|
}
|
|
37
71
|
var isRightAligned = hAlign === "right" && (containerScreenRect.right - popupWidth >= 0);
|
|
38
72
|
if (isRightAligned) {
|
|
39
|
-
|
|
40
|
-
popup.style.right = "0";
|
|
73
|
+
position.right = 0;
|
|
41
74
|
}
|
|
42
75
|
else {
|
|
43
76
|
var left = 0;
|
|
@@ -51,10 +84,65 @@ var PositionHelper = /** @class */ (function () {
|
|
|
51
84
|
else if (leftCheck + popup.offsetWidth > window.innerWidth - 20) {
|
|
52
85
|
left -= (leftCheck + popup.offsetWidth) - (window.innerWidth - 20);
|
|
53
86
|
}
|
|
54
|
-
|
|
55
|
-
popup.style.right = "";
|
|
87
|
+
position.left = left;
|
|
56
88
|
}
|
|
89
|
+
return position;
|
|
57
90
|
};
|
|
58
91
|
return PositionHelper;
|
|
59
92
|
}());
|
|
60
93
|
export default PositionHelper;
|
|
94
|
+
/**
|
|
95
|
+
* Helper used to position elements with position: fixed relative to another element, while maintaining position on scroll.
|
|
96
|
+
* If popupElement has a display of 'absolute', then normal positioning is performed.
|
|
97
|
+
*/
|
|
98
|
+
var FixedPositionHelper = /** @class */ (function () {
|
|
99
|
+
function FixedPositionHelper(anchorElement, popupElement) {
|
|
100
|
+
this.anchorElement = anchorElement;
|
|
101
|
+
this.popupElement = popupElement;
|
|
102
|
+
this.isFixed = false;
|
|
103
|
+
this.topOffset = 0;
|
|
104
|
+
if (window.getComputedStyle(popupElement).position === "fixed") {
|
|
105
|
+
this.isFixed = true;
|
|
106
|
+
window.addEventListener("scroll", this.positionFixedPopup.bind(this), { capture: true });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
FixedPositionHelper.prototype.positionPopup = function (alignRight, hAlign, fromBottom) {
|
|
110
|
+
if (alignRight === void 0) { alignRight = false; }
|
|
111
|
+
if (fromBottom === void 0) { fromBottom = true; }
|
|
112
|
+
this.positionInfo = PositionHelper.getRelativePosition(this.anchorElement, this.popupElement, alignRight, hAlign);
|
|
113
|
+
if (this.isFixed) {
|
|
114
|
+
// Fixed, need to add scroll listener.
|
|
115
|
+
if (this.positionInfo.onTop) {
|
|
116
|
+
var style = window.getComputedStyle(this.popupElement);
|
|
117
|
+
var marginHeight = parseFloat(style.marginBottom) + parseFloat(style.marginTop);
|
|
118
|
+
this.topOffset = -(this.positionInfo.popupHeight + marginHeight);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
this.topOffset = this.positionInfo.anchorHeight;
|
|
122
|
+
}
|
|
123
|
+
this.positionFixedPopup();
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
// Simple positioning relative to container.
|
|
127
|
+
PositionHelper.positionElement(this.popupElement, this.positionInfo, fromBottom);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
FixedPositionHelper.prototype.positionFixedPopup = function () {
|
|
131
|
+
var rect = this.anchorElement.getBoundingClientRect();
|
|
132
|
+
this.popupElement.style.top = (Math.floor(rect.top) + this.topOffset) + "px";
|
|
133
|
+
this.popupElement.style.right = "auto";
|
|
134
|
+
if (this.positionInfo.left !== undefined) {
|
|
135
|
+
this.popupElement.style.left = (rect.left + this.positionInfo.left) + "px";
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
this.popupElement.style.left = (rect.right - this.popupElement.offsetWidth) + "px";
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
FixedPositionHelper.prototype.dispose = function () {
|
|
142
|
+
if (this.isFixed) {
|
|
143
|
+
window.removeEventListener("scroll", this.positionFixedPopup);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
return FixedPositionHelper;
|
|
147
|
+
}());
|
|
148
|
+
export { FixedPositionHelper };
|
|
@@ -17,6 +17,6 @@ export { INotification, INotificationOptions } from './Notifications/Notificatio
|
|
|
17
17
|
export { INotificationStore } from './Notifications/NotificationStore';
|
|
18
18
|
export { INotificationHelper } from './Notifications/INotificationHelper';
|
|
19
19
|
export { ProgressState } from './TaskRunner/ProgressState';
|
|
20
|
-
export { default as PositionHelper } from './PositionHelper';
|
|
20
|
+
export { default as PositionHelper, FixedPositionHelper } from './PositionHelper';
|
|
21
21
|
import * as Tooltip from './TooltipOptions';
|
|
22
22
|
export { Tooltip };
|
package/dist/Components/index.js
CHANGED
|
@@ -8,6 +8,6 @@ export { default as FileManager } from './FileManager/FileManager';
|
|
|
8
8
|
export { default as BoundFileManager } from './FileManager/BoundFileManager';
|
|
9
9
|
export { FileUploadBatch } from './FileManager/FileUploadBatch';
|
|
10
10
|
export { ProgressState } from './TaskRunner/ProgressState';
|
|
11
|
-
export { default as PositionHelper } from './PositionHelper';
|
|
11
|
+
export { default as PositionHelper, FixedPositionHelper } from './PositionHelper';
|
|
12
12
|
import * as Tooltip from './TooltipOptions';
|
|
13
13
|
export { Tooltip };
|
|
@@ -227,7 +227,7 @@ var Deserialiser = /** @class */ (function () {
|
|
|
227
227
|
from.entityIdentifier && from.entityIdentifier.indexOf('000000000000') === -1) {
|
|
228
228
|
toModel.entityIdentifier = from.entityIdentifier;
|
|
229
229
|
}
|
|
230
|
-
if (!this.options.isMap) {
|
|
230
|
+
if (!this.options.isMap && to.isSelfDirty !== undefined) {
|
|
231
231
|
if (!from.trackingState) {
|
|
232
232
|
toModel.isSelfDirty = false;
|
|
233
233
|
toModel.isNew = false;
|
|
@@ -98,7 +98,7 @@ export declare class PageManager<TCriteria extends ValueObject, TModel extends I
|
|
|
98
98
|
taskRunner: ITaskRunner;
|
|
99
99
|
private hasInitialised;
|
|
100
100
|
private pageRequest;
|
|
101
|
-
private
|
|
101
|
+
private _totalExternalRecords;
|
|
102
102
|
private currentData;
|
|
103
103
|
private initialFetchState;
|
|
104
104
|
private isInvalidated;
|
|
@@ -13,7 +13,7 @@ var PageManager = /** @class */ (function (_super) {
|
|
|
13
13
|
_this.modelType = modelType;
|
|
14
14
|
_this.dataSource = dataSource;
|
|
15
15
|
_this.hasInitialised = false;
|
|
16
|
-
_this.
|
|
16
|
+
_this._totalExternalRecords = -1;
|
|
17
17
|
_this.currentData = new List(_this.modelType);
|
|
18
18
|
_this.initialFetchState = "none";
|
|
19
19
|
_this.isInvalidated = false;
|
|
@@ -104,7 +104,7 @@ var PageManager = /** @class */ (function (_super) {
|
|
|
104
104
|
});
|
|
105
105
|
Object.defineProperty(PageManager.prototype, "totalRecords", {
|
|
106
106
|
get: function () {
|
|
107
|
-
return this.
|
|
107
|
+
return this._totalExternalRecords + this.data.length;
|
|
108
108
|
},
|
|
109
109
|
enumerable: false,
|
|
110
110
|
configurable: true
|
|
@@ -239,7 +239,7 @@ var PageManager = /** @class */ (function (_super) {
|
|
|
239
239
|
switch (_a.label) {
|
|
240
240
|
case 0:
|
|
241
241
|
if (totalRecords >= 0) {
|
|
242
|
-
this.
|
|
242
|
+
this._totalExternalRecords = totalRecords - pageRecords.length;
|
|
243
243
|
}
|
|
244
244
|
newData = List.fromJSArray(this.modelType, pageRecords, this.options.deserialiseOptions);
|
|
245
245
|
if (!this.options.afterFetch) return [3 /*break*/, 2];
|
|
@@ -261,7 +261,6 @@ var PageManager = /** @class */ (function (_super) {
|
|
|
261
261
|
* Adds an item to the current page, and increments the total record count.
|
|
262
262
|
*/
|
|
263
263
|
PageManager.prototype.addRecord = function (item) {
|
|
264
|
-
this._totalRecords += 1;
|
|
265
264
|
if (item.meta) {
|
|
266
265
|
this.data.push(item);
|
|
267
266
|
}
|
|
@@ -275,7 +274,7 @@ var PageManager = /** @class */ (function (_super) {
|
|
|
275
274
|
PageManager.prototype.reset = function () {
|
|
276
275
|
this.initialFetchState = "none";
|
|
277
276
|
this.data.set([]);
|
|
278
|
-
this.
|
|
277
|
+
this._totalExternalRecords = 0;
|
|
279
278
|
};
|
|
280
279
|
/**
|
|
281
280
|
* Resets the sort properties. A new sort property can be provided.
|
|
@@ -351,7 +350,7 @@ var PageManager = /** @class */ (function (_super) {
|
|
|
351
350
|
__decorate([
|
|
352
351
|
Observable(),
|
|
353
352
|
__metadata("design:type", Number)
|
|
354
|
-
], PageManager.prototype, "
|
|
353
|
+
], PageManager.prototype, "_totalExternalRecords", void 0);
|
|
355
354
|
__decorate([
|
|
356
355
|
Observable(),
|
|
357
356
|
__metadata("design:type", Object)
|
|
@@ -7,3 +7,11 @@ export declare class ObservableValue<T> implements IObservableValue<T> {
|
|
|
7
7
|
constructor(initialValue: T);
|
|
8
8
|
get peek(): T;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Creates a wrapper around a value with a getter and setter for reading and writing the value.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ValueWrapper<T> implements IObservableValue<T> {
|
|
14
|
+
constructor(getter: () => T, setter: (value: T) => void);
|
|
15
|
+
value: T;
|
|
16
|
+
get peek(): T;
|
|
17
|
+
}
|
|
@@ -24,3 +24,20 @@ var ObservableValue = /** @class */ (function () {
|
|
|
24
24
|
return ObservableValue;
|
|
25
25
|
}());
|
|
26
26
|
export { ObservableValue };
|
|
27
|
+
/**
|
|
28
|
+
* Creates a wrapper around a value with a getter and setter for reading and writing the value.
|
|
29
|
+
*/
|
|
30
|
+
var ValueWrapper = /** @class */ (function () {
|
|
31
|
+
function ValueWrapper(getter, setter) {
|
|
32
|
+
Object.defineProperty(this, "value", { get: getter, set: setter });
|
|
33
|
+
}
|
|
34
|
+
Object.defineProperty(ValueWrapper.prototype, "peek", {
|
|
35
|
+
get: function () {
|
|
36
|
+
return this.value;
|
|
37
|
+
},
|
|
38
|
+
enumerable: false,
|
|
39
|
+
configurable: true
|
|
40
|
+
});
|
|
41
|
+
return ValueWrapper;
|
|
42
|
+
}());
|
|
43
|
+
export { ValueWrapper };
|
package/dist/Model/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { IBindableBase, IModelBase, NeoModelConstructor, PlainObject, PlainTrack
|
|
|
2
2
|
export { ILookupBase } from './LookupBase';
|
|
3
3
|
export { IPropertyInstance, PropertyAccessor } from './PropertyInstance';
|
|
4
4
|
import PropertyInfo from './PropertyInfo';
|
|
5
|
-
export { IObservableValue, ObservableValue } from './ObservableValue';
|
|
5
|
+
export { IObservableValue, ObservableValue, ValueWrapper } from './ObservableValue';
|
|
6
6
|
export { ObservableProperty } from './ObservableProperty';
|
|
7
7
|
export { ISelectedItem } from './Misc';
|
|
8
8
|
export { ModelFieldInfo, IModelFieldInfoContainer } from './ModelFieldInfo';
|
package/dist/Model/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { PropertyAccessor } from './PropertyInstance';
|
|
2
2
|
import PropertyInfo from './PropertyInfo';
|
|
3
|
-
export { ObservableValue } from './ObservableValue';
|
|
3
|
+
export { ObservableValue, ValueWrapper } from './ObservableValue';
|
|
4
4
|
export { ObservableProperty } from './ObservableProperty';
|
|
5
5
|
export { ModelFieldInfo } from './ModelFieldInfo';
|
|
6
6
|
import * as GraphTraverser from './ModelGraphTraverser';
|