@singularsystems/neo-core 1.0.17 → 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.
@@ -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
- AnimationHelper.beginRemove(this.container, this.previousChild);
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
- AnimationHelper.beginRemove(this.container, this.previousChild);
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
- AnimationHelper.beginRemove(this.container, this.previousChild);
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. */
@@ -30,6 +30,7 @@ export default class DatePicker {
30
30
  onInputBlurred(closePopup: boolean): void;
31
31
  inputChanged(): void;
32
32
  inputKeyDown(e: KeyboardEvent): void;
33
+ onMouseWheel(e: WheelEvent): void;
33
34
  private removePopup;
34
35
  private setBindValue;
35
36
  private setBindProperty;
@@ -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 = {
@@ -6,7 +6,8 @@ export declare abstract class DataViewBase<T> {
6
6
  private originalSource;
7
7
  sortInfo: SortOperation[];
8
8
  protected noSortSymbol: symbol;
9
- allowSort: boolean;
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
  /**
@@ -8,7 +8,6 @@ var DataViewBase = /** @class */ (function () {
8
8
  this.originalSource = originalSource;
9
9
  this.sortInfo = [];
10
10
  this.noSortSymbol = Symbol("DataView.NoSort");
11
- this.allowSort = true;
12
11
  this.performsRemoteSorting = false;
13
12
  }
14
13
  /**
@@ -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 !== false;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-core",
3
- "version": "1.0.17",
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.1",
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.5.0",
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.5",
28
+ "axios": "1.7.7",
29
29
  "inversify": "^6.0.2",
30
- "reflect-metadata": "0.1.13",
30
+ "reflect-metadata": "0.2.2",
31
31
  "tslib": "2.7.0"
32
32
  },
33
33
  "peerDependencies": {