igniteui-angular 15.1.19 → 15.1.20

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.
@@ -4108,7 +4108,14 @@ class IgxBaseExporter {
4108
4108
  let startIndex = 0;
4109
4109
  const key = keys[0];
4110
4110
  const records = this.flatRecords.map(r => r.data);
4111
- const groupedRecords = records.reduce((hash, obj) => ({ ...hash, [obj[key.name]]: (hash[obj[key.name]] || []).concat(obj) }), {});
4111
+ const groupedRecords = {};
4112
+ records.forEach(obj => {
4113
+ const keyValue = obj[key.name];
4114
+ if (!groupedRecords[keyValue]) {
4115
+ groupedRecords[keyValue] = [];
4116
+ }
4117
+ groupedRecords[keyValue].push(obj);
4118
+ });
4112
4119
  if (columnGroupParent) {
4113
4120
  const mapKeys = [...this.pivotGridKeyValueMap.keys()];
4114
4121
  const mapValues = [...this.pivotGridKeyValueMap.values()];
@@ -30584,12 +30591,39 @@ class Calendar {
30584
30591
  getPrevYear(date) {
30585
30592
  return this.timedelta(date, TimeDeltaInterval.Year, -1);
30586
30593
  }
30587
- getWeekNumber(date) {
30588
- const firstJan = new Date(date.getFullYear(), 0, 1).getTime();
30589
- const today = new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
30594
+ getWeekNumber(date, weekStart) {
30595
+ // current year
30596
+ const yearStart = new Date(date.getFullYear(), 0, 1);
30597
+ // first day number of the current year
30598
+ let firstDayOfTheYear = yearStart.getDay() - weekStart;
30599
+ firstDayOfTheYear = firstDayOfTheYear >= 0 ? firstDayOfTheYear : firstDayOfTheYear + 7;
30590
30600
  const dayInMilSeconds = 86400000;
30591
- const dayOfYear = ((today - firstJan + 1) / dayInMilSeconds);
30592
- return Math.ceil(dayOfYear / 7);
30601
+ // day number in the year
30602
+ const dayNumber = Math.floor((date.getTime() - yearStart.getTime() -
30603
+ (date.getTimezoneOffset() - yearStart.getTimezoneOffset()) * 60000) / dayInMilSeconds) + 1;
30604
+ let weekNumber;
30605
+ // if 01 Jan is Monday to Thursday, is considered 1st week of the year
30606
+ // if 01 Jan starts Friday to Sunday, is considered last week of previous year
30607
+ if (firstDayOfTheYear < 4) {
30608
+ // when calculating the week number we add 1 for the 1st week
30609
+ weekNumber = Math.floor((dayNumber + firstDayOfTheYear - 1) / 7) + 1;
30610
+ }
30611
+ else {
30612
+ // calculating the week number
30613
+ weekNumber = Math.floor((dayNumber + firstDayOfTheYear - 1) / 7);
30614
+ }
30615
+ // if the week number is greater than week 52
30616
+ if (weekNumber > 52) {
30617
+ // next year
30618
+ let nextYear = new Date(date.getFullYear() + 1, 0, 1);
30619
+ // first day of the next year
30620
+ let nextYearFirstDay = nextYear.getDay() - weekStart;
30621
+ nextYearFirstDay = nextYearFirstDay >= 0 ? nextYearFirstDay : nextYearFirstDay + 7;
30622
+ // if 01 Jan of the next year is Monday to Thursday, is considered 1st week of the next year
30623
+ // if 01 Jan is Friday to Sunday, is considered 53rd week of the current year
30624
+ weekNumber = nextYearFirstDay < 4 ? 1 : 53;
30625
+ }
30626
+ return weekNumber;
30593
30627
  }
30594
30628
  generateICalendarDate(date, year, month) {
30595
30629
  return {
@@ -32800,7 +32834,7 @@ class IgxDaysViewComponent extends IgxCalendarBaseDirective {
32800
32834
  * @hidden
32801
32835
  */
32802
32836
  getWeekNumber(date) {
32803
- return this.calendarModel.getWeekNumber(date);
32837
+ return this.calendarModel.getWeekNumber(date, this.weekStart);
32804
32838
  }
32805
32839
  /**
32806
32840
  * Returns the locale representation of the date in the days view.
@@ -88914,9 +88948,8 @@ class IgxSplitterPaneComponent {
88914
88948
  * Gets the `flex` property of the current `IgxSplitterPaneComponent`.
88915
88949
  */
88916
88950
  get flex() {
88917
- const isAuto = this.size === 'auto' && !this.dragSize;
88918
- const grow = !isAuto ? 0 : 1;
88919
88951
  const size = this.dragSize || this.size;
88952
+ const grow = this.isPercentageSize && !this.dragSize ? 1 : 0;
88920
88953
  return `${grow} ${grow} ${size}`;
88921
88954
  }
88922
88955
  /**
@@ -89216,30 +89249,14 @@ class IgxSplitterComponent {
89216
89249
  * @param delta - The difference along the X (or Y) axis between the initial and the current point when dragging the bar.
89217
89250
  */
89218
89251
  onMoving(delta) {
89219
- const min = parseInt(this.pane.minSize, 10) || 0;
89220
- const max = parseInt(this.pane.maxSize, 10) || this.initialPaneSize + this.initialSiblingSize;
89221
- const minSibling = parseInt(this.sibling.minSize, 10) || 0;
89222
- const maxSibling = parseInt(this.sibling.maxSize, 10) || this.initialPaneSize + this.initialSiblingSize;
89223
- const paneSize = this.initialPaneSize - delta;
89224
- const siblingSize = this.initialSiblingSize + delta;
89225
- if (paneSize < min || paneSize > max || siblingSize < minSibling || siblingSize > maxSibling) {
89226
- return;
89227
- }
89252
+ const [paneSize, siblingSize] = this.calcNewSizes(delta);
89228
89253
  this.pane.dragSize = paneSize + 'px';
89229
89254
  this.sibling.dragSize = siblingSize + 'px';
89230
89255
  const args = { pane: this.pane, sibling: this.sibling };
89231
89256
  this.resizing.emit(args);
89232
89257
  }
89233
89258
  onMoveEnd(delta) {
89234
- const min = parseInt(this.pane.minSize, 10) || 0;
89235
- const max = parseInt(this.pane.maxSize, 10) || this.initialPaneSize + this.initialSiblingSize;
89236
- const minSibling = parseInt(this.sibling.minSize, 10) || 0;
89237
- const maxSibling = parseInt(this.sibling.maxSize, 10) || this.initialPaneSize + this.initialSiblingSize;
89238
- const paneSize = this.initialPaneSize - delta;
89239
- const siblingSize = this.initialSiblingSize + delta;
89240
- if (paneSize < min || paneSize > max || siblingSize < minSibling || siblingSize > maxSibling) {
89241
- return;
89242
- }
89259
+ const [paneSize, siblingSize] = this.calcNewSizes(delta);
89243
89260
  if (this.pane.isPercentageSize) {
89244
89261
  // handle % resizes
89245
89262
  const totalSize = this.getTotalSize();
@@ -89327,6 +89344,25 @@ class IgxSplitterComponent {
89327
89344
  k += 2;
89328
89345
  });
89329
89346
  }
89347
+ /**
89348
+ * @hidden @internal
89349
+ * Calculates new sizes for the panes based on move delta and initial sizes
89350
+ */
89351
+ calcNewSizes(delta) {
89352
+ const min = parseInt(this.pane.minSize, 10) || 0;
89353
+ const minSibling = parseInt(this.sibling.minSize, 10) || 0;
89354
+ const max = parseInt(this.pane.maxSize, 10) || this.initialPaneSize + this.initialSiblingSize - minSibling;
89355
+ const maxSibling = parseInt(this.sibling.maxSize, 10) || this.initialPaneSize + this.initialSiblingSize - min;
89356
+ if (delta < 0) {
89357
+ const maxPossibleDelta = Math.min(max - this.initialPaneSize, this.initialSiblingSize - minSibling);
89358
+ delta = Math.min(maxPossibleDelta, Math.abs(delta)) * -1;
89359
+ }
89360
+ else {
89361
+ const maxPossibleDelta = Math.min(this.initialPaneSize - min, maxSibling - this.initialSiblingSize);
89362
+ delta = Math.min(maxPossibleDelta, Math.abs(delta));
89363
+ }
89364
+ return [this.initialPaneSize - delta, this.initialSiblingSize + delta];
89365
+ }
89330
89366
  }
89331
89367
  IgxSplitterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0", ngImport: i0, type: IgxSplitterComponent, deps: [{ token: DOCUMENT }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
89332
89368
  IgxSplitterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.0", type: IgxSplitterComponent, selector: "igx-splitter", inputs: { type: "type" }, outputs: { resizeStart: "resizeStart", resizing: "resizing", resizeEnd: "resizeEnd" }, host: { properties: { "class.igx-splitter": "this.cssClass", "style.overflow": "this.overflow", "style.display": "this.display", "attr.aria-orientation": "this.orientation", "style.flex-direction": "this.direction" } }, queries: [{ propertyName: "panes", predicate: IgxSplitterPaneComponent, read: IgxSplitterPaneComponent }], ngImport: i0, template: "<ng-content select=\"igx-splitter-pane\"></ng-content>\n<ng-container *ngFor=\"let pane of panes; let last = last; let index= index;\">\n <igx-splitter-bar *ngIf=\"!last\" [order]='pane.order + 1' role='separator'\n [type]=\"type\"\n [pane]=\"pane\"\n [siblings]='getPaneSiblingsByOrder(pane.order + 1, index)'\n (moveStart)=\"onMoveStart($event)\"\n (moving)=\"onMoving($event)\"\n (movingEnd)='onMoveEnd($event)'>\n </igx-splitter-bar>\n</ng-container>\n", dependencies: [{ kind: "directive", type: i0.forwardRef(function () { return i1$1.NgForOf; }), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i0.forwardRef(function () { return i1$1.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i0.forwardRef(function () { return IgxSplitBarComponent; }), selector: "igx-splitter-bar", inputs: ["type", "order", "pane", "siblings"], outputs: ["moveStart", "moving", "movingEnd"] }] });