@angular/material 14.1.0-next.1 → 14.1.0-rc.0

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.
Files changed (47) hide show
  1. package/_index.scss +1 -1
  2. package/core/index.d.ts +1 -1
  3. package/core/style/_variables.scss +1 -1
  4. package/core/style/_vendor-prefixes.scss +5 -0
  5. package/datepicker/index.d.ts +8 -0
  6. package/esm2020/button-toggle/button-toggle.mjs +2 -2
  7. package/esm2020/checkbox/checkbox.mjs +2 -2
  8. package/esm2020/core/common-behaviors/error-state.mjs +1 -1
  9. package/esm2020/core/datetime/native-date-adapter.mjs +2 -2
  10. package/esm2020/core/option/option.mjs +2 -2
  11. package/esm2020/core/version.mjs +1 -1
  12. package/esm2020/datepicker/datepicker-base.mjs +21 -6
  13. package/esm2020/icon/icon-registry.mjs +19 -6
  14. package/esm2020/icon/icon.mjs +14 -8
  15. package/esm2020/stepper/stepper.mjs +1 -1
  16. package/esm2020/tabs/ink-bar.mjs +10 -6
  17. package/fesm2015/button-toggle.mjs +2 -2
  18. package/fesm2015/button-toggle.mjs.map +1 -1
  19. package/fesm2015/checkbox.mjs +2 -2
  20. package/fesm2015/checkbox.mjs.map +1 -1
  21. package/fesm2015/core.mjs +4 -4
  22. package/fesm2015/core.mjs.map +1 -1
  23. package/fesm2015/datepicker.mjs +22 -5
  24. package/fesm2015/datepicker.mjs.map +1 -1
  25. package/fesm2015/icon.mjs +31 -12
  26. package/fesm2015/icon.mjs.map +1 -1
  27. package/fesm2015/stepper.mjs.map +1 -1
  28. package/fesm2015/tabs.mjs +9 -5
  29. package/fesm2015/tabs.mjs.map +1 -1
  30. package/fesm2020/button-toggle.mjs +2 -2
  31. package/fesm2020/button-toggle.mjs.map +1 -1
  32. package/fesm2020/checkbox.mjs +2 -2
  33. package/fesm2020/checkbox.mjs.map +1 -1
  34. package/fesm2020/core.mjs +4 -4
  35. package/fesm2020/core.mjs.map +1 -1
  36. package/fesm2020/datepicker.mjs +20 -5
  37. package/fesm2020/datepicker.mjs.map +1 -1
  38. package/fesm2020/icon.mjs +31 -12
  39. package/fesm2020/icon.mjs.map +1 -1
  40. package/fesm2020/stepper.mjs.map +1 -1
  41. package/fesm2020/tabs.mjs +9 -5
  42. package/fesm2020/tabs.mjs.map +1 -1
  43. package/icon/index.d.ts +24 -6
  44. package/package.json +2 -2
  45. package/schematics/ng-add/index.js +1 -1
  46. package/schematics/ng-add/index.mjs +1 -1
  47. package/stepper/index.d.ts +2 -2
@@ -2141,10 +2141,6 @@ class MatDatepickerContent extends _MatDatepickerContentBase {
2141
2141
  this._closeButtonText = intl.closeCalendarLabel;
2142
2142
  }
2143
2143
  ngOnInit() {
2144
- // If we have actions, clone the model so that we have the ability to cancel the selection,
2145
- // otherwise update the global model directly. Note that we want to assign this as soon as
2146
- // possible, but `_actionsPortal` isn't available in the constructor so we do it in `ngOnInit`.
2147
- this._model = this._actionsPortal ? this._globalModel.clone() : this._globalModel;
2148
2144
  this._animationState = this.datepicker.touchUi ? 'enter-dialog' : 'enter-dropdown';
2149
2145
  }
2150
2146
  ngAfterViewInit() {
@@ -2192,6 +2188,23 @@ class MatDatepickerContent extends _MatDatepickerContentBase {
2192
2188
  this._globalModel.updateSelection(this._model.selection, this);
2193
2189
  }
2194
2190
  }
2191
+ /**
2192
+ * Assigns a new portal containing the datepicker actions.
2193
+ * @param portal Portal with the actions to be assigned.
2194
+ * @param forceRerender Whether a re-render of the portal should be triggered. This isn't
2195
+ * necessary if the portal is assigned during initialization, but it may be required if it's
2196
+ * added at a later point.
2197
+ */
2198
+ _assignActions(portal, forceRerender) {
2199
+ // If we have actions, clone the model so that we have the ability to cancel the selection,
2200
+ // otherwise update the global model directly. Note that we want to assign this as soon as
2201
+ // possible, but `_actionsPortal` isn't available in the constructor so we do it in `ngOnInit`.
2202
+ this._model = portal ? this._globalModel.clone() : this._globalModel;
2203
+ this._actionsPortal = portal;
2204
+ if (forceRerender) {
2205
+ this._changeDetectorRef.detectChanges();
2206
+ }
2207
+ }
2195
2208
  }
2196
2209
  MatDatepickerContent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: MatDatepickerContent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: MatDateSelectionModel }, { token: i1$1.DateAdapter }, { token: MAT_DATE_RANGE_SELECTION_STRATEGY, optional: true }, { token: MatDatepickerIntl }], target: i0.ɵɵFactoryTarget.Component });
2197
2210
  MatDatepickerContent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: MatDatepickerContent, selector: "mat-datepicker-content", inputs: { color: "color" }, host: { listeners: { "@transformPanel.done": "_animationDone.next()" }, properties: { "@transformPanel": "_animationState", "class.mat-datepicker-content-touch": "datepicker.touchUi" }, classAttribute: "mat-datepicker-content" }, viewQueries: [{ propertyName: "_calendar", first: true, predicate: MatCalendar, descendants: true }], exportAs: ["matDatepickerContent"], usesInheritance: true, ngImport: i0, template: "<div\n cdkTrapFocus\n role=\"dialog\"\n [attr.aria-modal]=\"true\"\n [attr.aria-labelledby]=\"_dialogLabelId ?? undefined\"\n class=\"mat-datepicker-content-container\"\n [class.mat-datepicker-content-container-with-custom-header]=\"datepicker.calendarHeaderComponent\"\n [class.mat-datepicker-content-container-with-actions]=\"_actionsPortal\">\n <mat-calendar\n [id]=\"datepicker.id\"\n [ngClass]=\"datepicker.panelClass\"\n [startAt]=\"datepicker.startAt\"\n [startView]=\"datepicker.startView\"\n [minDate]=\"datepicker._getMinDate()\"\n [maxDate]=\"datepicker._getMaxDate()\"\n [dateFilter]=\"datepicker._getDateFilter()\"\n [headerComponent]=\"datepicker.calendarHeaderComponent\"\n [selected]=\"_getSelected()\"\n [dateClass]=\"datepicker.dateClass\"\n [comparisonStart]=\"comparisonStart\"\n [comparisonEnd]=\"comparisonEnd\"\n [@fadeInCalendar]=\"'enter'\"\n (yearSelected)=\"datepicker._selectYear($event)\"\n (monthSelected)=\"datepicker._selectMonth($event)\"\n (viewChanged)=\"datepicker._viewChanged($event)\"\n (_userSelection)=\"_handleUserSelection($event)\"></mat-calendar>\n\n <ng-template [cdkPortalOutlet]=\"_actionsPortal\"></ng-template>\n\n <!-- Invisible close button for screen reader users. -->\n <button\n type=\"button\"\n mat-raised-button\n [color]=\"color || 'primary'\"\n class=\"mat-datepicker-close-button\"\n [class.cdk-visually-hidden]=\"!_closeButtonFocused\"\n (focus)=\"_closeButtonFocused = true\"\n (blur)=\"_closeButtonFocused = false\"\n (click)=\"datepicker.close()\">{{ _closeButtonText }}</button>\n</div>\n", styles: [".mat-datepicker-content{display:block;border-radius:4px}.mat-datepicker-content .mat-calendar{width:296px;height:354px}.mat-datepicker-content .mat-datepicker-content-container-with-custom-header .mat-calendar{height:auto}.mat-datepicker-content .mat-datepicker-close-button{position:absolute;top:100%;left:0;margin-top:8px}.ng-animating .mat-datepicker-content .mat-datepicker-close-button{display:none}.mat-datepicker-content-container{display:flex;flex-direction:column;justify-content:space-between}.mat-datepicker-content-touch{display:block;max-height:80vh;position:relative;overflow:visible}.mat-datepicker-content-touch .mat-datepicker-content-container{min-height:312px;max-height:788px;min-width:250px;max-width:750px}.mat-datepicker-content-touch .mat-calendar{width:100%;height:auto}@media all and (orientation: landscape){.mat-datepicker-content-touch .mat-datepicker-content-container{width:64vh;height:80vh}}@media all and (orientation: portrait){.mat-datepicker-content-touch .mat-datepicker-content-container{width:80vw;height:100vw}.mat-datepicker-content-touch .mat-datepicker-content-container-with-actions{height:115vw}}"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i5.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "directive", type: i6.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "component", type: MatCalendar, selector: "mat-calendar", inputs: ["headerComponent", "startAt", "startView", "selected", "minDate", "maxDate", "dateFilter", "dateClass", "comparisonStart", "comparisonEnd"], outputs: ["selectedChange", "yearSelected", "monthSelected", "viewChanged", "_userSelection"], exportAs: ["matCalendar"] }], animations: [matDatepickerAnimations.transformPanel, matDatepickerAnimations.fadeInCalendar], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
@@ -2398,6 +2411,7 @@ class MatDatepickerBase {
2398
2411
  throw Error('A MatDatepicker can only be associated with a single actions row.');
2399
2412
  }
2400
2413
  this._actionsPortal = portal;
2414
+ this._componentRef?.instance._assignActions(portal, true);
2401
2415
  }
2402
2416
  /**
2403
2417
  * Removes a portal containing action buttons from the datepicker.
@@ -2406,6 +2420,7 @@ class MatDatepickerBase {
2406
2420
  removeActions(portal) {
2407
2421
  if (portal === this._actionsPortal) {
2408
2422
  this._actionsPortal = null;
2423
+ this._componentRef?.instance._assignActions(null, true);
2409
2424
  }
2410
2425
  }
2411
2426
  /** Open the calendar. */
@@ -2463,8 +2478,8 @@ class MatDatepickerBase {
2463
2478
  _forwardContentValues(instance) {
2464
2479
  instance.datepicker = this;
2465
2480
  instance.color = this.color;
2466
- instance._actionsPortal = this._actionsPortal;
2467
2481
  instance._dialogLabelId = this.datepickerInput.getOverlayLabelId();
2482
+ instance._assignActions(this._actionsPortal, false);
2468
2483
  }
2469
2484
  /** Opens the overlay with the calendar. */
2470
2485
  _openOverlay() {