@singularsystems/neo-core 0.10.72 → 0.10.74

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.
@@ -27,6 +27,8 @@ export interface IModalOptionsBase {
27
27
  footerContent?: any;
28
28
  /** Callback to handle when the modal is closed / cancelled by the user. Not called on accept. */
29
29
  onClose?: (event: any) => void;
30
+ /** Called after the modal animation completes. */
31
+ afterClose?: () => void;
30
32
  }
31
33
  export default interface IModalOptions extends IModalOptionsBase {
32
34
  /** Controls the visibility of the modal. */
@@ -79,6 +79,10 @@ export interface IPageManager {
79
79
  * @param taskRunner Optional alternate task runner to use.
80
80
  */
81
81
  refreshData(getCount?: boolean, taskRunner?: ITaskRunner): Promise<void>;
82
+ /**
83
+ * Refresh the data only if the page manager has initialised.
84
+ */
85
+ resetData(taskRunner?: ITaskRunner): Promise<void>;
82
86
  /**
83
87
  * Refresh the data by calling the api endpoint with the current criteria.
84
88
  * This will not reset the page index, and will not update the total record count, therefore should only be called if your criteria has not changed since the last full fetch using refreshData().
@@ -128,6 +132,10 @@ export declare class PageManager<TCriteria extends ValueObject, TModel extends I
128
132
  * @param taskRunner Optional alternate task runner to use.
129
133
  */
130
134
  refreshData(getCount?: boolean, taskRunner?: ITaskRunner): Promise<void>;
135
+ /**
136
+ * Refresh the data only if the page manager has initialised.
137
+ */
138
+ resetData(taskRunner?: ITaskRunner): Promise<void>;
131
139
  /**
132
140
  * Refresh the data by calling the api endpoint with the current criteria.
133
141
  * This will not reset the page index, and will not update the total record count, therefore should only be called if your criteria has not changed since the last full fetch using refreshData().
@@ -166,13 +166,43 @@ var PageManager = /** @class */ (function (_super) {
166
166
  });
167
167
  });
168
168
  };
169
+ /**
170
+ * Refresh the data only if the page manager has initialised.
171
+ */
172
+ PageManager.prototype.resetData = function (taskRunner) {
173
+ return __awaiter(this, void 0, void 0, function () {
174
+ return __generator(this, function (_a) {
175
+ switch (_a.label) {
176
+ case 0:
177
+ if (!this.hasInitialised) return [3 /*break*/, 2];
178
+ return [4 /*yield*/, this.refreshData(true, taskRunner)];
179
+ case 1:
180
+ _a.sent();
181
+ _a.label = 2;
182
+ case 2: return [2 /*return*/];
183
+ }
184
+ });
185
+ });
186
+ };
169
187
  /**
170
188
  * Refresh the data by calling the api endpoint with the current criteria.
171
189
  * This will not reset the page index, and will not update the total record count, therefore should only be called if your criteria has not changed since the last full fetch using refreshData().
172
190
  * @param taskRunner Optional alternate task runner to use.
173
191
  */
174
192
  PageManager.prototype.refreshPage = function (taskRunner) {
175
- return this.refreshData(false, taskRunner);
193
+ return __awaiter(this, void 0, void 0, function () {
194
+ return __generator(this, function (_a) {
195
+ switch (_a.label) {
196
+ case 0:
197
+ if (!this.hasInitialised) return [3 /*break*/, 2];
198
+ return [4 /*yield*/, this.refreshData(false, taskRunner)];
199
+ case 1:
200
+ _a.sent();
201
+ _a.label = 2;
202
+ case 2: return [2 /*return*/];
203
+ }
204
+ });
205
+ });
176
206
  };
177
207
  PageManager.prototype.fetchAndSetData = function (request) {
178
208
  var _a;
@@ -187,6 +187,14 @@ var DateUtils = /** @class */ (function () {
187
187
  var newDate = new Date();
188
188
  newDate.setFullYear(date.getFullYear() + ((_a = timeSpan.years) !== null && _a !== void 0 ? _a : 0), date.getMonth() + ((_b = timeSpan.months) !== null && _b !== void 0 ? _b : 0), date.getDate() + ((_c = timeSpan.days) !== null && _c !== void 0 ? _c : 0));
189
189
  newDate.setHours(date.getHours() + ((_d = timeSpan.hours) !== null && _d !== void 0 ? _d : 0), date.getMinutes() + ((_e = timeSpan.minutes) !== null && _e !== void 0 ? _e : 0), date.getSeconds() + ((_f = timeSpan.seconds) !== null && _f !== void 0 ? _f : 0), date.getMilliseconds() + ((_g = timeSpan.milliseconds) !== null && _g !== void 0 ? _g : 0));
190
+ if (timeSpan.months && !timeSpan.days) {
191
+ // 31 May - 1 month == 31 April == 1 May, this will fix that:
192
+ var newMonth = newDate.getMonth();
193
+ var oldMonth = date.getMonth();
194
+ if (newMonth !== oldMonth + (timeSpan.months % 12)) {
195
+ newDate.setDate(0);
196
+ }
197
+ }
190
198
  return newDate;
191
199
  };
192
200
  /**
@@ -177,6 +177,6 @@ export function Computed(isComputed) {
177
177
  export function DisplayMember() {
178
178
  return function (type, propertyKey) {
179
179
  var pi = getOrAddPropertyInfo(type, propertyKey);
180
- type.constructor.neo.displayMember = pi;
180
+ ensureTypeInfo(type.constructor).neo.displayMember = pi;
181
181
  };
182
182
  }
@@ -2,6 +2,8 @@ import { ValidationDisplayMode } from './Validation/Misc';
2
2
  import { IButtonOptions } from './Components/ButtonOptions';
3
3
  import { DataType } from './Model/Misc';
4
4
  export declare const Settings: {
5
+ /** Specify this if your app has a header that is fixed to the top of the screen. */
6
+ fixedAppHeaderElement: (() => HTMLElement | null) | null;
5
7
  /**
6
8
  * Time the css animation takes to show / hide a modal. Note: This must match the css animation time.
7
9
  */
@@ -38,6 +40,11 @@ export declare const Settings: {
38
40
  expandButton: IButtonOptions;
39
41
  boolTrueClass: string;
40
42
  boolFalseClass: string;
43
+ /**
44
+ * Will cause headers to stick to the top of the screen / scroll element when scrolling.
45
+ * This will apply to all NeoGrids, but can be overridden per grid.
46
+ */
47
+ useStickyHeaders: boolean;
41
48
  };
42
49
  modal: {
43
50
  acceptButton: IButtonOptions;
package/dist/Settings.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import { ValidationDisplayMode } from './Validation/Misc';
2
2
  import { DataType } from './Model/Misc';
3
3
  export var Settings = {
4
+ /** Specify this if your app has a header that is fixed to the top of the screen. */
5
+ fixedAppHeaderElement: null,
4
6
  /**
5
7
  * Time the css animation takes to show / hide a modal. Note: This must match the css animation time.
6
8
  */
@@ -60,7 +62,12 @@ export var Settings = {
60
62
  tabIndex: -1
61
63
  },
62
64
  boolTrueClass: "far fa-lg fa-check-square",
63
- boolFalseClass: "far fa-lg fa-square text-light"
65
+ boolFalseClass: "far fa-lg fa-square text-light",
66
+ /**
67
+ * Will cause headers to stick to the top of the screen / scroll element when scrolling.
68
+ * This will apply to all NeoGrids, but can be overridden per grid.
69
+ */
70
+ useStickyHeaders: false,
64
71
  },
65
72
  modal: {
66
73
  acceptButton: {
@@ -2,6 +2,7 @@ import * as signalR from '@microsoft/signalr';
2
2
  import { IHubReceiver } from "./HubReceiver";
3
3
  import { AppServices } from '../';
4
4
  import { IConnection, ConnectionState } from '../ConnectionManager';
5
+ import { IDisposable } from '../Misc';
5
6
  export interface IHubBase extends IConnection {
6
7
  /**
7
8
  * Connects to the server hub if the connection state is disconnected.
@@ -31,7 +32,7 @@ export interface IHubOptions {
31
32
  /** Log level in production. Defaults to Error. */
32
33
  releaseLogLevel: signalR.LogLevel;
33
34
  }
34
- export declare class HubBase implements IHubBase {
35
+ export declare class HubBase implements IHubBase, IDisposable {
35
36
  private url;
36
37
  private authenticationService;
37
38
  private connection;
@@ -53,6 +54,8 @@ export declare class HubBase implements IHubBase {
53
54
  connect(): Promise<boolean>;
54
55
  connectIfAuthenticated(): Promise<boolean>;
55
56
  disconnect(): Promise<void>;
57
+ /** Disconnects the hub client from the hub. Subscriptions are not disposed. */
58
+ dispose(): void;
56
59
  /**
57
60
  * Invokes a method on the server hub, returning a promise.
58
61
  * The Promise is resolved with the return value (if any) when the method on the server returns.
@@ -119,6 +119,10 @@ var HubBase = /** @class */ (function () {
119
119
  HubBase.prototype.disconnect = function () {
120
120
  return this.connection.stop();
121
121
  };
122
+ /** Disconnects the hub client from the hub. Subscriptions are not disposed. */
123
+ HubBase.prototype.dispose = function () {
124
+ this.disconnect();
125
+ };
122
126
  /**
123
127
  * Invokes a method on the server hub, returning a promise.
124
128
  * The Promise is resolved with the return value (if any) when the method on the server returns.
package/dist/Utils.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { __spreadArray } from "tslib";
2
2
  import { DebounceHelper } from './DebounceHelper';
3
+ import { ensureTypeInfo } from './Model/NeoTypeInfo';
3
4
  var lut = [];
4
5
  for (var i = 0; i < 256; i++) {
5
6
  lut[i] = (i < 16 ? '0' : '') + (i).toString(16);
@@ -76,7 +77,7 @@ var Utils = /** @class */ (function () {
76
77
  args[_i - 1] = arguments[_i];
77
78
  }
78
79
  if (type.prototype.constructor.neo) {
79
- return type.prototype.constructor.neo.createInstance(args);
80
+ return ensureTypeInfo(type).neo.createInstance(args);
80
81
  }
81
82
  else {
82
83
  throw "Cannot instantiate '".concat(type.name, "' because it does not have an @NeoModel attribute.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-core",
3
- "version": "0.10.72",
3
+ "version": "0.10.74",
4
4
  "description": "Core functionality for the Neo client library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",