From 66a54318241d4a0e52aaf95166054163ac41941e Mon Sep 17 00:00:00 2001
From: srawlins
Date: Thu, 13 Dec 2018 21:39:15 -0800
Subject: [PATCH 001/503] Automated g4 rollback of changelist 225276100.
*** Reason for rollback ***
Breaks code that does not exercise MaterialDropdownSelectComponent's itemRenderer.
*** Original change description ***
Fix the type of MaterialDropdownSelectComponent's itemRenderer.
***
PiperOrigin-RevId: 225486540
---
.../material_time_picker.dart | 7 ++-----
.../material_dropdown_select.dart | 17 ++++++++++++++---
.../lib/builder/template/main.dart.mustache | 2 +-
.../gallery_component/gallery_component.dart | 11 -----------
4 files changed, 17 insertions(+), 20 deletions(-)
diff --git a/angular_components/lib/material_datepicker/material_time_picker.dart b/angular_components/lib/material_datepicker/material_time_picker.dart
index 88bad41f6..9e5aab90f 100644
--- a/angular_components/lib/material_datepicker/material_time_picker.dart
+++ b/angular_components/lib/material_datepicker/material_time_picker.dart
@@ -27,9 +27,6 @@ import 'package:angular_components/utils/disposer/disposer.dart';
materialInputDirectives,
NgStyle,
],
- directiveTypes: [
- Typed>(),
- ],
providers: [
Provider(HasDisabled, useExisting: MaterialTimePickerComponent),
],
@@ -356,7 +353,7 @@ class MaterialTimePickerComponent extends KeyboardHandlerMixin
///
/// Only options between [minTime] and [maxTime] are selectable.
class TimeSelectionOptions extends StringSelectionOptions
- implements Selectable {
+ implements Selectable {
DateTime _minTime;
DateTime _maxTime;
@@ -366,7 +363,7 @@ class TimeSelectionOptions extends StringSelectionOptions
set maxTime(DateTime time) => _maxTime = time;
@override
- SelectableOption getSelectable(DateTime item) {
+ SelectableOption getSelectable(item) {
return item is DateTime &&
((_minTime != null && item.isBefore(_minTime)) ||
(_maxTime != null && item.isAfter(_maxTime)))
diff --git a/angular_components/lib/material_select/material_dropdown_select.dart b/angular_components/lib/material_select/material_dropdown_select.dart
index 3bdc3ef4c..0d1871a92 100644
--- a/angular_components/lib/material_select/material_dropdown_select.dart
+++ b/angular_components/lib/material_select/material_dropdown_select.dart
@@ -232,10 +232,22 @@ class MaterialDropdownSelectComponent extends MaterialSelectBase
}
/// Function to convert an option object to string.
+ ///
+ // TODO(google): Fix this now that generics are supported.
+ // Ideally, [value] would be a [ItemRenderer], where T is also the type
+ // parameter of the SelectionOptions and the SelectionModel, as parent
+ // components typically use a function that accepts a specific type (T).
+ //
+ // However, we don't have a T. Angular doesn't support injecting a
+ // type-annotated component yet, and setters, like [itemRenderer], cannot
+ // be type-annotated. This forces us to accept a plain old [Function] as
+ // [value], in order to avoid uses_dynamic_as_bottom errors. (Basically, a
+ // function like [MaterialTimePicker]'s `String renderTime(DateTime time)`
+ // cannot work as a [ItemRenderer], since it expects DateTime, not dynamic.)
@Input()
@override
- set itemRenderer(ItemRenderer value) {
- super.itemRenderer = value;
+ set itemRenderer(Function value) {
+ super.itemRenderer = (item) => value(item);
}
/// Width of the dropdown/list, default none, valid values are 0-5.
@@ -256,7 +268,6 @@ class MaterialDropdownSelectComponent extends MaterialSelectBase
// Note we don't allow deactivation because some teams incorrectly use
// activeItemLabel instead of selectedItemLabel, and this breaks them.
// TODO(google): remove allowDeactivate when client tests are fixed.
- // https://test.corp.google.com/ui#id=OCL:219567674:BASE:219582901:1541045481973:dd9a971c
_setInitialActiveItem(allowDeactivate: false);
}
}
diff --git a/angular_gallery/lib/builder/template/main.dart.mustache b/angular_gallery/lib/builder/template/main.dart.mustache
index 1a07315da..77075127d 100644
--- a/angular_gallery/lib/builder/template/main.dart.mustache
+++ b/angular_gallery/lib/builder/template/main.dart.mustache
@@ -10,7 +10,7 @@ import '{{{ galleryImportUri }}}' as app;
import 'main.template.dart' as ng;
-Logger _logger = Logger("ads.acx2.demo");
+Logger _logger = Logger("angular_dart_gallery");
void main() {
Logger.root.onRecord.listen((x) => print("${x.level}: ${x.message}"));
diff --git a/angular_gallery_section/lib/components/gallery_component/gallery_component.dart b/angular_gallery_section/lib/components/gallery_component/gallery_component.dart
index 3d6eab334..855d892d0 100644
--- a/angular_gallery_section/lib/components/gallery_component/gallery_component.dart
+++ b/angular_gallery_section/lib/components/gallery_component/gallery_component.dart
@@ -58,17 +58,6 @@ class GalleryComponent {
String getTeamsLink(String ldap) => 'http://who/$ldap';
- String getBuganizerLink(Doc doc) {
- var params = [];
- if (doc.path.startsWith('ads/acx2') ||
- doc.path.startsWith('third_party/dart_src/acx')) {
- params.add('component=105665');
- params.add('template=38109');
- }
- params.add('title=${doc.name} bug:');
- return 'http://b/issues/new?' + params.join('&');
- }
-
/// Reformats a library path name to a link path that can be used by
/// CodeSearch.
String getCodeSearchLink(String componentPath) {
From 92179294396687e33226b2082be8f75eca051437 Mon Sep 17 00:00:00 2001
From: cissyshi
Date: Thu, 13 Dec 2018 23:12:18 -0800
Subject: [PATCH 002/503] Do not create new SafeHtml in each change detection
cycle in gallery component.
PiperOrigin-RevId: 225493032
---
.../gallery_component/gallery_component.dart | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/angular_gallery_section/lib/components/gallery_component/gallery_component.dart b/angular_gallery_section/lib/components/gallery_component/gallery_component.dart
index 855d892d0..ab2a86d91 100644
--- a/angular_gallery_section/lib/components/gallery_component/gallery_component.dart
+++ b/angular_gallery_section/lib/components/gallery_component/gallery_component.dart
@@ -37,6 +37,8 @@ class GalleryComponent {
DomSanitizationService _santizationService;
+ final _sanitizedHtml = {};
+
/// Used to disable latency charts in testing environments where they can't
/// load successfully.
final latencyChartsEnabled =
@@ -47,8 +49,14 @@ class GalleryComponent {
bool get showToc =>
(model.docs.length + model.demos.length + model.benchmarks.length) > 1;
- SafeHtml getSafeHtml(String value) =>
- _santizationService.bypassSecurityTrustHtml(value);
+ SafeHtml getSafeHtml(String value) {
+ var html = _sanitizedHtml[value];
+ if (html == null) {
+ html = _santizationService.bypassSecurityTrustHtml(value);
+ _sanitizedHtml[value] = html;
+ }
+ return html;
+ }
String getDocId(Doc doc) => '${doc.name}Doc';
From b4438474bcbfa5487a98d77afdbbc4716330e537 Mon Sep 17 00:00:00 2001
From: tsander
Date: Fri, 14 Dec 2018 10:00:19 -0800
Subject: [PATCH 003/503] Add home/end key modifiers to focus_list to focus the
first or last value.
PiperOrigin-RevId: 225558808
---
angular_components/lib/focus/focus.dart | 41 +++++++++++++++++---
angular_components/lib/focus/focus_list.dart | 12 ++++--
2 files changed, 45 insertions(+), 8 deletions(-)
diff --git a/angular_components/lib/focus/focus.dart b/angular_components/lib/focus/focus.dart
index beb1b4de8..b43b02e18 100644
--- a/angular_components/lib/focus/focus.dart
+++ b/angular_components/lib/focus/focus.dart
@@ -6,6 +6,7 @@ import 'dart:async';
import 'dart:html' show KeyCode, KeyboardEvent, Element, HtmlElement;
import 'package:angular/angular.dart';
+import 'package:meta/meta.dart';
import 'package:angular_components/laminate/components/modal/modal.dart';
import 'package:angular_components/laminate/popup/popup.dart';
import 'package:angular_components/utils/browser/dom_service/dom_service.dart';
@@ -85,6 +86,12 @@ class FocusMoveEvent {
/// The position, relative the item, of where to set focus.
final int offset;
+ /// Home key was pressed.
+ final bool home;
+
+ /// End key was pressed.
+ final bool end;
+
/// Prevent Default action for occuring. When the `FocusMoveEvent` is created
/// from a KeyboardEvent, this method delegates to the `preventDefault` method
/// of the `KeyboardEvent`, allowing consumers of this event to control the
@@ -95,18 +102,40 @@ class FocusMoveEvent {
final Function _preventDefaultDelegate;
- FocusMoveEvent(this.focusItem, this.offset, [this._preventDefaultDelegate]);
+ @visibleForTesting
+ FocusMoveEvent(this.focusItem, this.offset, [this._preventDefaultDelegate])
+ : home = false,
+ end = false;
+
+ @visibleForTesting
+ FocusMoveEvent.homeKey(this.focusItem, [this._preventDefaultDelegate])
+ : offset = 0,
+ home = true,
+ end = false;
+
+ @visibleForTesting
+ FocusMoveEvent.endKey(this.focusItem, [this._preventDefaultDelegate])
+ : offset = 0,
+ home = false,
+ end = true;
/// Builds a `FocusMoveEvent` instance from a keyboard event, iff the keycode
- /// is a next or previous key (i.e. up/down/left/right).
+ /// is a next, previous, home or end key (i.e. up/down/left/right/home/end).
factory FocusMoveEvent.fromKeyboardEvent(
FocusableItem item, KeyboardEvent kbEvent) {
int keyCode = kbEvent.keyCode;
+ final preventDefaultFn = () {
+ kbEvent.preventDefault();
+ };
+ if (_isHomeKey(keyCode)) {
+ return FocusMoveEvent.homeKey(item, preventDefaultFn);
+ }
+ if (_isEndKey(keyCode)) {
+ return FocusMoveEvent.endKey(item, preventDefaultFn);
+ }
if (!_isNextKey(keyCode) && !_isPrevKey(keyCode)) return null;
int offset = _isNextKey(keyCode) ? 1 : -1;
- return FocusMoveEvent(item, offset, () {
- kbEvent.preventDefault();
- });
+ return FocusMoveEvent(item, offset, preventDefaultFn);
}
// TODO(google): account for RTL.
@@ -114,6 +143,8 @@ class FocusMoveEvent {
keyCode == KeyCode.RIGHT || keyCode == KeyCode.DOWN;
static bool _isPrevKey(int keyCode) =>
keyCode == KeyCode.LEFT || keyCode == KeyCode.UP;
+ static bool _isHomeKey(int keyCode) => keyCode == KeyCode.HOME;
+ static bool _isEndKey(int keyCode) => keyCode == KeyCode.END;
}
/// The element will be focused as soon as directive is initialized.
diff --git a/angular_components/lib/focus/focus_list.dart b/angular_components/lib/focus/focus_list.dart
index 563a3c9e3..5d55a0e64 100644
--- a/angular_components/lib/focus/focus_list.dart
+++ b/angular_components/lib/focus/focus_list.dart
@@ -62,9 +62,15 @@ class FocusListDirective implements OnDestroy {
}
void _moveFocus(FocusMoveEvent event) {
- var i = _children.indexOf(event.focusItem);
- if (i != -1) {
- focus(i + event.offset);
+ if (event.home) {
+ focus(0);
+ } else if (event.end) {
+ focus(_length - 1);
+ } else {
+ var i = _children.indexOf(event.focusItem);
+ if (i != -1) {
+ focus(i + event.offset);
+ }
}
event.preventDefault();
}
From 0743abaf3c10f412f6fca1bb54b3bbca612990a0 Mon Sep 17 00:00:00 2001
From: tsander
Date: Fri, 14 Dec 2018 15:13:54 -0800
Subject: [PATCH 004/503] Passthrough initPopupAriaAttributes to all the
tooltip variations so teams can choose to drop those attributes for certain
instances if they would like.
PiperOrigin-RevId: 225612074
---
.../lib/src/material_tooltip/tooltip.dart | 6 +++--
.../src/material_tooltip/tooltip_source.dart | 6 +++--
.../src/material_tooltip/tooltip_target.dart | 24 +++++++++++--------
3 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/angular_components/lib/src/material_tooltip/tooltip.dart b/angular_components/lib/src/material_tooltip/tooltip.dart
index fbd38acb5..f19791cad 100644
--- a/angular_components/lib/src/material_tooltip/tooltip.dart
+++ b/angular_components/lib/src/material_tooltip/tooltip.dart
@@ -50,9 +50,11 @@ class MaterialTooltipDirective extends TooltipTarget
HtmlElement element,
this._viewLoader,
this._changeDetector,
- this._window)
+ this._window,
+ @Attribute('initPopupAriaAttributes') String initAriaAttributes)
: this.element = element,
- super(domPopupSourceFactory, viewContainerRef, element) {
+ super(domPopupSourceFactory, viewContainerRef, element,
+ initAriaAttributes) {
inLongPress = false;
_delayedActivate = DelayedAction(tooltipShowDelay, _activate);
}
diff --git a/angular_components/lib/src/material_tooltip/tooltip_source.dart b/angular_components/lib/src/material_tooltip/tooltip_source.dart
index 8c19cca57..4ea86623d 100644
--- a/angular_components/lib/src/material_tooltip/tooltip_source.dart
+++ b/angular_components/lib/src/material_tooltip/tooltip_source.dart
@@ -49,14 +49,16 @@ class MaterialTooltipSourceDirective extends PopupSourceDirective
bool _isMouseInside = false;
MaterialTooltipSourceDirective(
- DomPopupSourceFactory domPopupSourceFactory, HtmlElement element)
+ DomPopupSourceFactory domPopupSourceFactory,
+ HtmlElement element,
+ @Attribute('initPopupAriaAttributes') String initAriaAttributes)
: this.element = element,
super(
domPopupSourceFactory,
element,
/* referenceDirective */ null,
/* focusable */ null,
- /* initAriaAttributes */ null) {
+ initAriaAttributes) {
_show = DelayedAction(tooltipShowDelay, activate);
}
diff --git a/angular_components/lib/src/material_tooltip/tooltip_target.dart b/angular_components/lib/src/material_tooltip/tooltip_target.dart
index cdf422cd9..4b91f825c 100644
--- a/angular_components/lib/src/material_tooltip/tooltip_target.dart
+++ b/angular_components/lib/src/material_tooltip/tooltip_target.dart
@@ -34,9 +34,10 @@ class MaterialTooltipTargetDirective extends TooltipBehavior
DomPopupSourceFactory domPopupSourceFactory,
ViewContainerRef viewContainerRef,
HtmlElement element,
- ChangeDetectorRef changeDetector)
- : super(
- domPopupSourceFactory, viewContainerRef, element, changeDetector) {
+ ChangeDetectorRef changeDetector,
+ @Attribute('initPopupAriaAttributes') String initAriaAttributes)
+ : super(domPopupSourceFactory, viewContainerRef, element, changeDetector,
+ initAriaAttributes) {
this.element = element;
}
@@ -71,8 +72,10 @@ abstract class TooltipBehavior extends TooltipTarget {
DomPopupSourceFactory domPopupSourceFactory,
ViewContainerRef viewContainerRef,
HtmlElement element,
- this._changeDetector)
- : super(domPopupSourceFactory, viewContainerRef, element) {
+ this._changeDetector,
+ String initAriaAttributes)
+ : super(domPopupSourceFactory, viewContainerRef, element,
+ initAriaAttributes) {
_show = DelayedAction(tooltipShowDelay, showTooltip);
}
@@ -147,9 +150,10 @@ class ClickableTooltipTargetDirective extends TooltipBehavior
DomPopupSourceFactory domPopupSourceFactory,
ViewContainerRef viewContainerRef,
HtmlElement element,
- ChangeDetectorRef changeDetector)
- : super(
- domPopupSourceFactory, viewContainerRef, element, changeDetector) {
+ ChangeDetectorRef changeDetector,
+ @Attribute('initPopupAriaAttributes') String initAriaAttributes)
+ : super(domPopupSourceFactory, viewContainerRef, element, changeDetector,
+ initAriaAttributes) {
this.element = element;
_tooltipSubscription = tooltipActivate.listen((visible) {
_tooltipVisible = visible;
@@ -209,13 +213,13 @@ abstract class TooltipTarget extends PopupSourceDirective {
final HtmlElement _element;
TooltipTarget(DomPopupSourceFactory domPopupSourceFactory,
- this.viewContainerRef, this._element)
+ this.viewContainerRef, this._element, String initAriaAttributes)
: super(
domPopupSourceFactory,
_element,
/* referenceDirective */ null,
/* focusable */ null,
- /* initAriaAttributes */ null);
+ initAriaAttributes);
/// Sets the tooltip associated with this target.
void setTooltip(Tooltip component) {
From 7e6d68b97c25159d7b50d2f280584edda18175d2 Mon Sep 17 00:00:00 2001
From: Googler
Date: Mon, 17 Dec 2018 06:45:55 -0800
Subject: [PATCH 005/503] Make material-icon using SVG correctly stretch icon.
PiperOrigin-RevId: 225818293
---
angular_components/lib/material_icon/_mixins.scss | 1 +
examples/material_icon_example/lib/material_icon_demo.html | 1 +
2 files changed, 2 insertions(+)
diff --git a/angular_components/lib/material_icon/_mixins.scss b/angular_components/lib/material_icon/_mixins.scss
index c1da4dac3..fd078c470 100644
--- a/angular_components/lib/material_icon/_mixins.scss
+++ b/angular_components/lib/material_icon/_mixins.scss
@@ -49,5 +49,6 @@
@mixin svg-icon($svg-icon) {
::ng-deep .material-icon-i {
background-image: $svg-icon;
+ background-size: cover;
}
}
diff --git a/examples/material_icon_example/lib/material_icon_demo.html b/examples/material_icon_example/lib/material_icon_demo.html
index e973fb662..fadb7001f 100644
--- a/examples/material_icon_example/lib/material_icon_demo.html
+++ b/examples/material_icon_example/lib/material_icon_demo.html
@@ -89,6 +89,7 @@ SVG Icon
Note: This requires setting the "icon" to the material-icon as blank so that it is not shown.
+
From c5ba91c0a76a87cd0e73852db841f63fced6c0cf Mon Sep 17 00:00:00 2001
From: cissyshi
Date: Mon, 17 Dec 2018 13:36:49 -0800
Subject: [PATCH 006/503] Fix gallery title not updating.
PiperOrigin-RevId: 225880739
---
angular_gallery/lib/builder/template/gallery.dart.mustache | 4 +++-
angular_gallery/lib/builder/template/gallery.scss.mustache | 4 ++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/angular_gallery/lib/builder/template/gallery.dart.mustache b/angular_gallery/lib/builder/template/gallery.dart.mustache
index d73aca18b..4e5763d46 100644
--- a/angular_gallery/lib/builder/template/gallery.dart.mustache
+++ b/angular_gallery/lib/builder/template/gallery.dart.mustache
@@ -67,7 +67,9 @@ class GalleryComponent implements HighlightProvider {
GalleryComponent(this.focusIndicatorController, Router router) {
router.stream.listen((newRoute) {
- _breadcrumb = breadcrumbs[newRoute.path];
+ var example = newRoute.path;
+ if (example.startsWith('/')) example = example.substring(1);
+ _breadcrumb = breadcrumbs[example];
querySelector('material-content').scrollTop = 0;
});
exampleOptions = StringSelectionOptions<_Example>(allExamples,
diff --git a/angular_gallery/lib/builder/template/gallery.scss.mustache b/angular_gallery/lib/builder/template/gallery.scss.mustache
index 3a8ed4f9a..8d162b24a 100644
--- a/angular_gallery/lib/builder/template/gallery.scss.mustache
+++ b/angular_gallery/lib/builder/template/gallery.scss.mustache
@@ -70,4 +70,8 @@ material-content {
@include material-checkbox-color($mat-orange-500);
}
+
+ .material-header-row {
+ flex-grow: 1;
+ }
}
From c741ef6bf0356fef919dd37d622964e4436c18df Mon Sep 17 00:00:00 2001
From: hcameron
Date: Tue, 18 Dec 2018 12:42:20 -0800
Subject: [PATCH 007/503] `mat-gray` was provided as an alias for `mat-grey`
but is being removed
PiperOrigin-RevId: 226041951
---
angular_components/lib/material_chips/_mixins.scss | 6 +++---
.../lib/material_chips/material_chip.scss | 10 +++++-----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/angular_components/lib/material_chips/_mixins.scss b/angular_components/lib/material_chips/_mixins.scss
index 5c91d64d9..ed3b5ecf7 100644
--- a/angular_components/lib/material_chips/_mixins.scss
+++ b/angular_components/lib/material_chips/_mixins.scss
@@ -100,8 +100,8 @@ $left-icon-width: $mat-grid * 4;
}
}
-$main-hover-bg-color: $mat-gray-400;
-$main-selected-bg-color: $mat-gray-600;
+$main-hover-bg-color: $mat-grey-400;
+$main-selected-bg-color: $mat-grey-600;
$emphasis-hover-bg-color: $mat-blue-700;
$emphasis-selected-bg-color: $mat-blue-900;
@@ -182,7 +182,7 @@ $emphasis-selected-bg-color: $mat-blue-900;
}
::ng-deep .delete-icon:focus {
- fill: $mat-gray-300;
+ fill: $mat-grey-300;
}
}
}
diff --git a/angular_components/lib/material_chips/material_chip.scss b/angular_components/lib/material_chips/material_chip.scss
index 0c690965c..9bd8ed54f 100644
--- a/angular_components/lib/material_chips/material_chip.scss
+++ b/angular_components/lib/material_chips/material_chip.scss
@@ -9,7 +9,7 @@ $mat-option-inline-icons: true;
$chip-height: $mat-grid * 4;
$chip-border-radius: $chip-height / 2;
-$main-bg-color: $mat-gray-300;
+$main-bg-color: $mat-grey-300;
$emphasis-bg-color: $mat-blue-500;
@@ -40,8 +40,8 @@ $delete-icon-padding: ($clickable-size - $delete-icon-size) / 2;
.left-icon {
// make it easy to use either