@angular/material 14.0.2 → 14.0.5

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 (40) 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/stepper/stepper.mjs +1 -1
  14. package/esm2020/tabs/ink-bar.mjs +10 -6
  15. package/fesm2015/button-toggle.mjs +2 -2
  16. package/fesm2015/button-toggle.mjs.map +1 -1
  17. package/fesm2015/checkbox.mjs +2 -2
  18. package/fesm2015/checkbox.mjs.map +1 -1
  19. package/fesm2015/core.mjs +4 -4
  20. package/fesm2015/core.mjs.map +1 -1
  21. package/fesm2015/datepicker.mjs +22 -5
  22. package/fesm2015/datepicker.mjs.map +1 -1
  23. package/fesm2015/stepper.mjs.map +1 -1
  24. package/fesm2015/tabs.mjs +9 -5
  25. package/fesm2015/tabs.mjs.map +1 -1
  26. package/fesm2020/button-toggle.mjs +2 -2
  27. package/fesm2020/button-toggle.mjs.map +1 -1
  28. package/fesm2020/checkbox.mjs +2 -2
  29. package/fesm2020/checkbox.mjs.map +1 -1
  30. package/fesm2020/core.mjs +4 -4
  31. package/fesm2020/core.mjs.map +1 -1
  32. package/fesm2020/datepicker.mjs +20 -5
  33. package/fesm2020/datepicker.mjs.map +1 -1
  34. package/fesm2020/stepper.mjs.map +1 -1
  35. package/fesm2020/tabs.mjs +9 -5
  36. package/fesm2020/tabs.mjs.map +1 -1
  37. package/package.json +2 -2
  38. package/schematics/ng-add/index.js +1 -1
  39. package/schematics/ng-add/index.mjs +1 -1
  40. package/stepper/index.d.ts +2 -2
@@ -2136,10 +2136,6 @@ class MatDatepickerContent extends _MatDatepickerContentBase {
2136
2136
  this._closeButtonText = intl.closeCalendarLabel;
2137
2137
  }
2138
2138
  ngOnInit() {
2139
- // If we have actions, clone the model so that we have the ability to cancel the selection,
2140
- // otherwise update the global model directly. Note that we want to assign this as soon as
2141
- // possible, but `_actionsPortal` isn't available in the constructor so we do it in `ngOnInit`.
2142
- this._model = this._actionsPortal ? this._globalModel.clone() : this._globalModel;
2143
2139
  this._animationState = this.datepicker.touchUi ? 'enter-dialog' : 'enter-dropdown';
2144
2140
  }
2145
2141
  ngAfterViewInit() {
@@ -2187,6 +2183,23 @@ class MatDatepickerContent extends _MatDatepickerContentBase {
2187
2183
  this._globalModel.updateSelection(this._model.selection, this);
2188
2184
  }
2189
2185
  }
2186
+ /**
2187
+ * Assigns a new portal containing the datepicker actions.
2188
+ * @param portal Portal with the actions to be assigned.
2189
+ * @param forceRerender Whether a re-render of the portal should be triggered. This isn't
2190
+ * necessary if the portal is assigned during initialization, but it may be required if it's
2191
+ * added at a later point.
2192
+ */
2193
+ _assignActions(portal, forceRerender) {
2194
+ // If we have actions, clone the model so that we have the ability to cancel the selection,
2195
+ // otherwise update the global model directly. Note that we want to assign this as soon as
2196
+ // possible, but `_actionsPortal` isn't available in the constructor so we do it in `ngOnInit`.
2197
+ this._model = portal ? this._globalModel.clone() : this._globalModel;
2198
+ this._actionsPortal = portal;
2199
+ if (forceRerender) {
2200
+ this._changeDetectorRef.detectChanges();
2201
+ }
2202
+ }
2190
2203
  }
2191
2204
  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 });
2192
2205
  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 });
@@ -2391,18 +2404,22 @@ class MatDatepickerBase {
2391
2404
  * @param portal Portal to be registered.
2392
2405
  */
2393
2406
  registerActions(portal) {
2407
+ var _a;
2394
2408
  if (this._actionsPortal && (typeof ngDevMode === 'undefined' || ngDevMode)) {
2395
2409
  throw Error('A MatDatepicker can only be associated with a single actions row.');
2396
2410
  }
2397
2411
  this._actionsPortal = portal;
2412
+ (_a = this._componentRef) === null || _a === void 0 ? void 0 : _a.instance._assignActions(portal, true);
2398
2413
  }
2399
2414
  /**
2400
2415
  * Removes a portal containing action buttons from the datepicker.
2401
2416
  * @param portal Portal to be removed.
2402
2417
  */
2403
2418
  removeActions(portal) {
2419
+ var _a;
2404
2420
  if (portal === this._actionsPortal) {
2405
2421
  this._actionsPortal = null;
2422
+ (_a = this._componentRef) === null || _a === void 0 ? void 0 : _a.instance._assignActions(null, true);
2406
2423
  }
2407
2424
  }
2408
2425
  /** Open the calendar. */
@@ -2461,8 +2478,8 @@ class MatDatepickerBase {
2461
2478
  _forwardContentValues(instance) {
2462
2479
  instance.datepicker = this;
2463
2480
  instance.color = this.color;
2464
- instance._actionsPortal = this._actionsPortal;
2465
2481
  instance._dialogLabelId = this.datepickerInput.getOverlayLabelId();
2482
+ instance._assignActions(this._actionsPortal, false);
2466
2483
  }
2467
2484
  /** Opens the overlay with the calendar. */
2468
2485
  _openOverlay() {