@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
@@ -2144,10 +2144,6 @@ class MatDatepickerContent extends _MatDatepickerContentBase {
2144
2144
  this._closeButtonText = intl.closeCalendarLabel;
2145
2145
  }
2146
2146
  ngOnInit() {
2147
- // If we have actions, clone the model so that we have the ability to cancel the selection,
2148
- // otherwise update the global model directly. Note that we want to assign this as soon as
2149
- // possible, but `_actionsPortal` isn't available in the constructor so we do it in `ngOnInit`.
2150
- this._model = this._actionsPortal ? this._globalModel.clone() : this._globalModel;
2151
2147
  this._animationState = this.datepicker.touchUi ? 'enter-dialog' : 'enter-dropdown';
2152
2148
  }
2153
2149
  ngAfterViewInit() {
@@ -2195,6 +2191,23 @@ class MatDatepickerContent extends _MatDatepickerContentBase {
2195
2191
  this._globalModel.updateSelection(this._model.selection, this);
2196
2192
  }
2197
2193
  }
2194
+ /**
2195
+ * Assigns a new portal containing the datepicker actions.
2196
+ * @param portal Portal with the actions to be assigned.
2197
+ * @param forceRerender Whether a re-render of the portal should be triggered. This isn't
2198
+ * necessary if the portal is assigned during initialization, but it may be required if it's
2199
+ * added at a later point.
2200
+ */
2201
+ _assignActions(portal, forceRerender) {
2202
+ // If we have actions, clone the model so that we have the ability to cancel the selection,
2203
+ // otherwise update the global model directly. Note that we want to assign this as soon as
2204
+ // possible, but `_actionsPortal` isn't available in the constructor so we do it in `ngOnInit`.
2205
+ this._model = portal ? this._globalModel.clone() : this._globalModel;
2206
+ this._actionsPortal = portal;
2207
+ if (forceRerender) {
2208
+ this._changeDetectorRef.detectChanges();
2209
+ }
2210
+ }
2198
2211
  }
2199
2212
  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 });
2200
2213
  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 });
@@ -2399,18 +2412,22 @@ class MatDatepickerBase {
2399
2412
  * @param portal Portal to be registered.
2400
2413
  */
2401
2414
  registerActions(portal) {
2415
+ var _a;
2402
2416
  if (this._actionsPortal && (typeof ngDevMode === 'undefined' || ngDevMode)) {
2403
2417
  throw Error('A MatDatepicker can only be associated with a single actions row.');
2404
2418
  }
2405
2419
  this._actionsPortal = portal;
2420
+ (_a = this._componentRef) === null || _a === void 0 ? void 0 : _a.instance._assignActions(portal, true);
2406
2421
  }
2407
2422
  /**
2408
2423
  * Removes a portal containing action buttons from the datepicker.
2409
2424
  * @param portal Portal to be removed.
2410
2425
  */
2411
2426
  removeActions(portal) {
2427
+ var _a;
2412
2428
  if (portal === this._actionsPortal) {
2413
2429
  this._actionsPortal = null;
2430
+ (_a = this._componentRef) === null || _a === void 0 ? void 0 : _a.instance._assignActions(null, true);
2414
2431
  }
2415
2432
  }
2416
2433
  /** Open the calendar. */
@@ -2469,8 +2486,8 @@ class MatDatepickerBase {
2469
2486
  _forwardContentValues(instance) {
2470
2487
  instance.datepicker = this;
2471
2488
  instance.color = this.color;
2472
- instance._actionsPortal = this._actionsPortal;
2473
2489
  instance._dialogLabelId = this.datepickerInput.getOverlayLabelId();
2490
+ instance._assignActions(this._actionsPortal, false);
2474
2491
  }
2475
2492
  /** Opens the overlay with the calendar. */
2476
2493
  _openOverlay() {