@singularsystems/neo-core 1.2.0 → 1.2.2

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.
@@ -13,7 +13,7 @@ export interface IButtonOptions {
13
13
  /** Bootstrap outline */
14
14
  isOutline?: boolean;
15
15
  /** Causes the button to be rendered without a background or border. The variant will instead affect text color. */
16
- isFlat?: boolean;
16
+ inline?: boolean;
17
17
  onClick?: (event: any, data?: any) => void;
18
18
  /** Specify a string name if using font-awesome. No need to specify fa- */
19
19
  icon?: any;
@@ -352,7 +352,8 @@ var DatePicker = /** @class */ (function () {
352
352
  var cell = this.createAndAppend(trBody, "td");
353
353
  var date = currentDate.getDate();
354
354
  var month = currentDate.getMonth();
355
- this.setupCell(cell, date.toString(), currentDate.getFullYear() + "," + month + "," + date, currentDate.getTime() >= this.options.minDateNoTime.getTime() && currentDate.getTime() <= this.options.maxDateNoTime.getTime(), currentDate.getTime() == this.today.getTime(), this.boundDateNoTime != null && currentDate.getTime() == this.boundDateNoTime.getTime());
355
+ var canSelect = this.options.canSelectDate ? this.options.canSelectDate(currentDate) : true;
356
+ this.setupCell(cell, date.toString(), currentDate.getFullYear() + "," + month + "," + date, canSelect && currentDate.getTime() >= this.options.minDateNoTime.getTime() && currentDate.getTime() <= this.options.maxDateNoTime.getTime(), currentDate.getTime() == this.today.getTime(), this.boundDateNoTime != null && currentDate.getTime() == this.boundDateNoTime.getTime());
356
357
  if (month != this.currentViewDate.getMonth()) {
357
358
  cell.classList.add("outside-month");
358
359
  }
@@ -17,6 +17,11 @@ export default class DatePickerOptions {
17
17
  showInput: boolean;
18
18
  minDate: Date;
19
19
  maxDate: Date;
20
+ /**
21
+ * A function that returns true if the date can be selected in the date picker.
22
+ * **NOTE:** this will not prevent the date from being typed in. You must also add a validation rule to the bound property.
23
+ */
24
+ canSelectDate?: (date: Date) => boolean;
20
25
  /** Automatically sets the date to the start or end of the displayed month when scrolling through months. */
21
26
  autoChangeDate: AutoChangeType;
22
27
  /** The number of years to show before the current year when in the year view. 16 years are shown in total. */
@@ -64,6 +64,7 @@ var Deserialiser = /** @class */ (function () {
64
64
  });
65
65
  };
66
66
  Deserialiser.prototype.deserialiseArray = function (from, to, type, itemFactory) {
67
+ var _a;
67
68
  if (!to) {
68
69
  throw "Cannot deserialise array into a non initialised property.";
69
70
  }
@@ -72,6 +73,7 @@ var Deserialiser = /** @class */ (function () {
72
73
  }
73
74
  //create an index of the to objects
74
75
  var toIndex = {};
76
+ var deletedItems = [];
75
77
  for (var i = 0; i < to.length; i++) {
76
78
  toIndex[to[i].entityIdentifier] = to[i];
77
79
  }
@@ -113,7 +115,12 @@ var Deserialiser = /** @class */ (function () {
113
115
  if (deserialise)
114
116
  this.deserialiseObject(fromItem, toItem, addToList);
115
117
  if (addToList || this.options.removeOldItems) {
116
- to.push(toItem);
118
+ if (fromItem.trackingState === TrackingState.Deleted) {
119
+ deletedItems.push(toItem);
120
+ }
121
+ else {
122
+ to.push(toItem);
123
+ }
117
124
  if (hasIdentifier) {
118
125
  toIndex[fromItem.entityIdentifier] = toItem;
119
126
  }
@@ -123,6 +130,9 @@ var Deserialiser = /** @class */ (function () {
123
130
  if (list.deletedList) {
124
131
  list.clearDeletedList();
125
132
  }
133
+ if (deletedItems) {
134
+ (_a = list.deletedList).push.apply(_a, deletedItems);
135
+ }
126
136
  };
127
137
  Deserialiser.prototype.deserialiseDictionary = function (from, to, parentProperty) {
128
138
  for (var key in from) {
@@ -237,7 +247,7 @@ var Deserialiser = /** @class */ (function () {
237
247
  toModel.isNew = false;
238
248
  }
239
249
  else if (from.trackingState === TrackingState.Deleted) {
240
- //TODO: handle deleted objects coming from server?
250
+ toModel.isNew = false;
241
251
  }
242
252
  else {
243
253
  toModel.isSelfDirty = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-core",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Core functionality for the Neo client library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,23 +0,0 @@
1
- import { IViewBase } from '../Views/IViewBase';
2
- export declare enum NavigateLocation {
3
- /** Navigating within the app. */
4
- Internal = 0,
5
- /** Navigating to another site / closing the browser. */
6
- External = 1
7
- }
8
- export interface IPageLeaveHandler {
9
- /**
10
- * Called when the windows beforeunload event fires.
11
- * @param view The currently active view.
12
- * @param e beforeunload event.
13
- */
14
- onWindowUnload(view: IViewBase | null, e: BeforeUnloadEvent): void;
15
- /**
16
- * Called when the user tries to leave the page, and viewbase has returned a message prompting the user if they want to leave.
17
- * @param view The currently active view.
18
- * @param prompt The prompt to display to the user.
19
- * @param location If the user is nagivating within the app, or externally.
20
- * @returns A boolean promise with a value indicating whether the user wants to leave the page.
21
- */
22
- onLeavePage(view: IViewBase | null, prompt: string, location: NavigateLocation): Promise<boolean>;
23
- }
@@ -1,7 +0,0 @@
1
- export var NavigateLocation;
2
- (function (NavigateLocation) {
3
- /** Navigating within the app. */
4
- NavigateLocation[NavigateLocation["Internal"] = 0] = "Internal";
5
- /** Navigating to another site / closing the browser. */
6
- NavigateLocation[NavigateLocation["External"] = 1] = "External";
7
- })(NavigateLocation || (NavigateLocation = {}));