@singularsystems/neo-core 1.3.0 → 1.3.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.
@@ -1,6 +1,7 @@
1
1
  import { IModelBase, IPropertyInstance } from '../Model/';
2
2
  import { ValidationDisplayMode } from '../Validation/Misc';
3
3
  import List from '../Model/List';
4
+ import { IColumnWidthBreakpoints } from "./BootstrapTypes";
4
5
  export interface IFormContextOptions {
5
6
  /** The validation display mode to apply to all controls. */
6
7
  validationDisplayMode?: ValidationDisplayMode;
@@ -10,6 +11,8 @@ export interface IFormContextOptions {
10
11
  allDisabled?: boolean;
11
12
  /** True if all labels should be hidden. */
12
13
  suppressLabels?: boolean;
14
+ /** Number of columns labels of InlineFormGroups should use. */
15
+ labelSizes?: IColumnWidthBreakpoints;
13
16
  }
14
17
  export interface IFormOptions<T extends IModelBase> extends IFormContextOptions {
15
18
  /** Model to use for validating. onSubmit will not be called if the model is invalid. */
@@ -152,7 +152,7 @@ var Serialiser = /** @class */ (function () {
152
152
  to[key] = NumberUtils.decimalService.toNumber(fromValue);
153
153
  }
154
154
  else if (propertyInfo.timeZoneSerialisation === TimeZoneFormat.None && fromValue instanceof Date) {
155
- to[key] = DateUtils.format(fromValue, "yyyy-MM-dd") + "T00:00:00";
155
+ to[key] = DateUtils.formatApi(fromValue, propertyInfo.timeZoneSerialisation);
156
156
  }
157
157
  else {
158
158
  to[key] = fromValue;
@@ -1,4 +1,5 @@
1
- import { Model } from "../";
1
+ import { IPropertyInstance } from "../Model/PropertyInstance";
2
+ import { TimeZoneFormat } from "../Misc";
2
3
  import { ITimeSpan, TimeSpan } from "./TimeSpan";
3
4
  export default class DateUtils {
4
5
  static defaultFormatString: string;
@@ -11,7 +12,11 @@ export default class DateUtils {
11
12
  monthNames: string[];
12
13
  };
13
14
  static format(date: Date, formatString?: string, utc?: boolean): string;
14
- static format(dateProperty: Model.IPropertyInstance<Date>): string;
15
+ static format(dateProperty: IPropertyInstance<Date>): string;
16
+ /**
17
+ * Formats a date using api standards.
18
+ */
19
+ static formatApi(date: Date, timezoneFormat: TimeZoneFormat): string;
15
20
  private static pad;
16
21
  /**
17
22
  * Tries to parse a date from a string using the supplied format string
@@ -1,4 +1,4 @@
1
- import { Misc } from "../";
1
+ import { TimeZoneFormat } from "../Misc";
2
2
  import { TimeSpan } from "./TimeSpan";
3
3
  var DateUtils = /** @class */ (function () {
4
4
  function DateUtils() {
@@ -9,7 +9,7 @@ var DateUtils = /** @class */ (function () {
9
9
  var dateProperty = dateOrDateProperty;
10
10
  if (dateProperty === null || dateProperty === void 0 ? void 0 : dateProperty.propertyInfo) {
11
11
  date = dateProperty.value;
12
- formatString = dateProperty.propertyInfo.timeZoneSerialisation === Misc.TimeZoneFormat.None ? DateUtils.defaultFormatString : DateUtils.defaultFormatStringWithTime;
12
+ formatString = dateProperty.propertyInfo.timeZoneSerialisation === TimeZoneFormat.None ? DateUtils.defaultFormatString : DateUtils.defaultFormatStringWithTime;
13
13
  }
14
14
  if (!date)
15
15
  return "";
@@ -57,6 +57,17 @@ var DateUtils = /** @class */ (function () {
57
57
  return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
58
58
  });
59
59
  };
60
+ /**
61
+ * Formats a date using api standards.
62
+ */
63
+ DateUtils.formatApi = function (date, timezoneFormat) {
64
+ if (timezoneFormat === TimeZoneFormat.UTC) {
65
+ return date.toISOString();
66
+ }
67
+ else {
68
+ return DateUtils.format(date, "yyyy-MM-dd") + "T00:00:00";
69
+ }
70
+ };
60
71
  DateUtils.pad = function (val, len) {
61
72
  if (len === void 0) { len = 2; }
62
73
  val = String(val);
@@ -14,6 +14,8 @@ export default class List<T> extends Array<T> {
14
14
  private _deletedList;
15
15
  get deletedList(): T[];
16
16
  get canDeserialise(): ObjectFactory | (new () => T) | undefined;
17
+ /** Returns items that are not marked for deletion */
18
+ get activeItems(): T[];
17
19
  /** Returns the count of non deleted items. */
18
20
  get activeLength(): number;
19
21
  private baseMethods;
@@ -40,6 +40,14 @@ var List = /** @class */ (function (_super) {
40
40
  enumerable: false,
41
41
  configurable: true
42
42
  });
43
+ Object.defineProperty(List.prototype, "activeItems", {
44
+ /** Returns items that are not marked for deletion */
45
+ get: function () {
46
+ return this.filter(function (item) { return !item.isSelfDeleting; });
47
+ },
48
+ enumerable: false,
49
+ configurable: true
50
+ });
43
51
  Object.defineProperty(List.prototype, "activeLength", {
44
52
  /** Returns the count of non deleted items. */
45
53
  get: function () {
@@ -29,7 +29,7 @@ export declare const Settings: {
29
29
  collapsed: any;
30
30
  sortAsc: any;
31
31
  sortDesc: any;
32
- /** @deprecated Use `Settings.buttons.backButton` instead. */
32
+ /** **Note:** also change the back icon in the `buttons.backButton` setting. */
33
33
  backIcon: any;
34
34
  unDelete: any;
35
35
  shouldSuppress: (context: {
package/dist/Settings.js CHANGED
@@ -27,7 +27,7 @@ export var Settings = {
27
27
  collapsed: "far-plus-square",
28
28
  sortAsc: "sort-up",
29
29
  sortDesc: "sort-down",
30
- /** @deprecated Use `Settings.buttons.backButton` instead. */
30
+ /** **Note:** also change the back icon in the `buttons.backButton` setting. */
31
31
  backIcon: "arrow-left",
32
32
  unDelete: "trash-restore",
33
33
  shouldSuppress: function (context) { return false; },
package/dist/Utils.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import { __spreadArray } from "tslib";
2
2
  import { DebounceHelper } from './DebounceHelper';
3
3
  import { ensureTypeInfo } from './Model/NeoTypeInfo';
4
+ import DateUtils from "./Dates/DateUtils";
5
+ import { TimeZoneFormat } from "./Misc";
4
6
  var lut = [];
5
7
  for (var i = 0; i < 256; i++) {
6
8
  lut[i] = (i < 16 ? '0' : '') + (i).toString(16);
@@ -233,6 +235,9 @@ var Utils = /** @class */ (function () {
233
235
  }
234
236
  return queryString;
235
237
  }
238
+ if (plainObject instanceof Date) {
239
+ return DateUtils.formatApi(plainObject, DateUtils.stripTime(plainObject).getTime() === plainObject.getTime() ? TimeZoneFormat.None : TimeZoneFormat.UTC);
240
+ }
236
241
  return buildQueryString.apply(void 0, __spreadArray([plainObject, ""], properties, false));
237
242
  };
238
243
  return Utils;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-core",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Core functionality for the Neo client library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",