Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
633d867
Migrated examples
dukefirehawk Oct 15, 2021
1fd831e
Fixed to work with gallery
dukefirehawk Oct 15, 2021
0e1aa2e
Fixed to work with gallery
dukefirehawk Oct 15, 2021
0e1bfc5
Merge pull request #16 from angulardart-community/compatible
GZGavinZhao Oct 15, 2021
23e7db3
Fixed examples
dukefirehawk Oct 16, 2021
c45d7a7
Updated pubspec
dukefirehawk Oct 16, 2021
8e155ca
Fixed gallery code generator
dukefirehawk Oct 17, 2021
54fb0cd
Merge pull request #17 from dukefirehawk/migrated/gallery
GZGavinZhao Oct 18, 2021
43cb83a
Fixed onPush issue
dukefirehawk Oct 18, 2021
44d721f
Fixed incorrect attributes
dukefirehawk Oct 18, 2021
53c5495
Updated displayNameRendererDirective
dukefirehawk Oct 18, 2021
8926804
Fixed null-safety issues
dukefirehawk Oct 19, 2021
079e91d
Update changelog
dukefirehawk Oct 19, 2021
46a6625
Fixed null-safety issues
dukefirehawk Oct 21, 2021
41182da
Sass deprecated division operator
GZGavinZhao Oct 22, 2021
2e334e0
Reverted deprecated componentType
dukefirehawk Oct 23, 2021
dce2468
Fixed menu example
dukefirehawk Oct 23, 2021
79210c8
Merge branch 'dev' into migrated/bug-fix-1
dukefirehawk Oct 23, 2021
f576bbe
Merge branch 'migrated/bug-fix-2' into migrated/bug-fix-1
dukefirehawk Oct 23, 2021
ea9c2ed
Fixed all build issues in angular_gallery_section
dukefirehawk Oct 27, 2021
a2f5aa9
Fixed type issues with HostBinding and 'attr.xxx`
dukefirehawk Oct 29, 2021
60b5902
Fixed null safety in examples
dukefirehawk Oct 30, 2021
d592e60
Fixed null safety issues in examples
dukefirehawk Oct 30, 2021
852564f
Replaced DomSanitizer with sanitize_html
dukefirehawk Nov 2, 2021
20f2f48
Fixed late initializer
dukefirehawk Nov 2, 2021
b94a123
Fixed material input
dukefirehawk Nov 2, 2021
f798011
Fixed popup
dukefirehawk Nov 3, 2021
9ca4740
Removed deprecated
dukefirehawk Nov 7, 2021
691786c
Fixed material tab
dukefirehawk Nov 7, 2021
a8379c3
Removed deprecated componentType
dukefirehawk Nov 8, 2021
ddb2e90
Regenerate CI files
GZGavinZhao Nov 8, 2021
1a1ef5d
Refactored NNBD in material tree
dukefirehawk Nov 8, 2021
9f375b3
Merge branch 'dev' into migrated/bug-fix-1
dukefirehawk Nov 8, 2021
1aa827b
Fixed display name in material select
dukefirehawk Nov 8, 2021
06e451d
Fixed CI warnings
dukefirehawk Nov 9, 2021
2d879fe
Fixed CI warning
dukefirehawk Nov 9, 2021
8a965db
Fixed CI warning
dukefirehawk Nov 9, 2021
a968fe9
Fixed CI proto warning
dukefirehawk Nov 10, 2021
ac7b0eb
Merge pull request #30 from dukefirehawk/migrated/bug-fix-1
dukefirehawk Nov 10, 2021
2f1ba08
utilities
jodinathan Nov 12, 2021
4038460
Fixed popup throwing null exception
dukefirehawk Dec 5, 2021
d2be0c9
Merge pull request #62 from dukefirehawk/migrated/bug-fix-4
dukefirehawk Dec 6, 2021
9cfe168
Fixed material tree runtime error
dukefirehawk Dec 6, 2021
2d5c203
Merge pull request #63 from dukefirehawk/migrated/bug-fix-5
dukefirehawk Dec 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,073 changes: 1,057 additions & 16 deletions .github/workflows/dart.yml

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ doc/api/
# VsCode
.vscode/
!.vscode/settings.json
.metals
.metals

testing/
gen_app/
17 changes: 16 additions & 1 deletion angular_components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,22 @@
## 2.0.0

* Migrated using `dart migrate`
* `Denomination` class throws ArguementError for incorrect suffix
* Migrated `angular_gallery`
* Migrated `angular_gallery_section`
* Migrated `examples`
* Replaced `pkg:mustache` with `pkg:mustache_template`
* Changed `Denomination` class to throws ArgumentError for incorrect suffix
* Removed deprecated `componentRenderer`
* Changed parameters of method with `@ViewChild` annotation to be nullable
* Changed parameters of component factory with `@Optional` annotation to be nullable
* Changed parameters of component factory without `@Optional` annotation be non-nullable
* Changed parameters of component constructor with `@Attribute` annotation to be nullable
* Added `ChangeDetectionStrategy.OnPush` to `material_tree_dropdown`
* Added `ChangeDetectionStrategy.OnPush` to `material_tree_filter`
* Added `ChangeDetectionStrategy.OnPush` to `material_tree_impl`
* Updated `disabled` to be non nullable
* Replaced `DomSanitizationService` with `pkg:sanitizer_html`


## 1.0.3

Expand Down
2 changes: 1 addition & 1 deletion angular_components/lib/angular_components.dart
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ const List<dynamic> materialDirectives = [
DateRangeEditorComponent,
DateRangeInputComponent,
DeferredContentDirective,
displayNameRendererDirective,
DisplayNameRendererDirective,
DropdownSelectValueAccessor,
DropdownButtonComponent,
DropdownMenuComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import 'package:angular_components/content/deferred_content_aware.dart';
)
class MaterialStackableDrawerComponent
extends MaterialTemporaryDrawerComponent {
final MaterialStackableDrawerComponent parent;
final MaterialStackableDrawerComponent? parent;

MaterialStackableDrawerComponent(@Optional() @SkipSelf() this.parent)
: super();
Expand All @@ -36,7 +36,7 @@ class MaterialStackableDrawerComponent
set visible(bool newVisible) {
super.visible = newVisible;

parent.isExpanded = newVisible;
parent?.isExpanded = newVisible;
}

@HostBinding('class.mat-drawer-collapsed')
Expand Down
15 changes: 8 additions & 7 deletions angular_components/lib/button_decorator/button_decorator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ButtonDirective extends RootFocusable

final _trigger = StreamController<UIEvent>.broadcast(sync: true);

String _hostTabIndex = '0';
String? _hostTabIndex = '0';
final String? _nonTabbableIndex;
bool _shouldHandleSpaceKey;

Expand All @@ -60,34 +60,35 @@ class ButtonDirective extends RootFocusable
/// Is the component disabled.
@HostBinding('class.is-disabled')
@Input()
bool? disabled = false;
bool disabled = false;

/// Is the component tabbable.
@Input()
bool tabbable = true;

String? get hostTabIndex =>
tabbable && !disabled! ? _hostTabIndex : _nonTabbableIndex;
String? get hostTabIndex {
return tabbable && !disabled ? _hostTabIndex : _nonTabbableIndex;
}

/// The tab index of the component.
///
/// The value is used if [tabbable] is `true` and [disabled] is `false`.
@Input()
set tabindex(String value) {
set tabindex(String? value) {
_hostTabIndex = value;
}

/// Triggers if not disabled.
@HostListener('click')
void handleClick(MouseEvent mouseEvent) {
if (disabled!) return;
if (disabled) return;
_trigger.add(mouseEvent);
}

/// Triggers on enter and space if not disabled.
@HostListener('keypress')
void handleKeyPress(KeyboardEvent keyboardEvent) {
if (disabled!) return;
if (disabled) return;
if (isSpaceKey(keyboardEvent) && !_shouldHandleSpaceKey) return;
int keyCode = keyboardEvent.keyCode;
if (keyCode == KeyCode.ENTER || isSpaceKey(keyboardEvent)) {
Expand Down
24 changes: 12 additions & 12 deletions angular_components/lib/content/deferred_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class DeferredContentDirective implements OnDestroy {
final _disposer = Disposer.oneShot();
final _placeholder = DivElement();

ViewContainerRef? _viewContainer;
ViewContainerRef _viewContainer;
EmbeddedViewRef? _viewRef;
TemplateRef? _template;
TemplateRef _template;

/// Create a placeholder element to maintain content size when hidden.
///
Expand Down Expand Up @@ -59,7 +59,7 @@ class DeferredContentDirective implements OnDestroy {
// Remove the placeholder and add the deferred content.
_placeholder.remove();
}
_viewRef = _viewContainer!.createEmbeddedView(_template!);
_viewRef = _viewContainer.createEmbeddedView(_template);
} else {
if (preserveDimensions) {
// Save the dimensions of the deferred content.
Expand All @@ -76,11 +76,11 @@ class DeferredContentDirective implements OnDestroy {
}

// Remove the deferred content.
_viewContainer!.clear();
_viewContainer.clear();

if (preserveDimensions) {
// Add the placeholder so the parent's size doesn't change.
var container = _viewContainer!.element.nativeElement;
var container = _viewContainer.element.nativeElement;
if (container?.parentNode != null) {
container.parentNode.insertBefore(_placeholder, container);
}
Expand All @@ -105,8 +105,8 @@ class DeferredContentDirective implements OnDestroy {
@override
void ngOnDestroy() {
_disposer.dispose();
_viewContainer = null;
_template = null;
//_viewContainer = null;
//_template = null;
}
}

Expand All @@ -120,8 +120,8 @@ class DeferredContentDirective implements OnDestroy {
selector: '[cachedDeferredContent]',
)
class CachingDeferredContentDirective implements OnDestroy {
ViewContainerRef? _viewContainer;
TemplateRef? _template;
ViewContainerRef _viewContainer;
TemplateRef _template;
final _disposer = Disposer.oneShot();
ViewRef? _view;

Expand All @@ -131,7 +131,7 @@ class CachingDeferredContentDirective implements OnDestroy {
void _setVisible(bool value) {
if (value == _visible) return;
if (value && _view == null) {
_view = _viewContainer!.createEmbeddedView(_template!);
_view = _viewContainer.createEmbeddedView(_template);
}
_visible = value;
}
Expand All @@ -151,7 +151,7 @@ class CachingDeferredContentDirective implements OnDestroy {
@override
void ngOnDestroy() {
_disposer.dispose();
_viewContainer = null;
_template = null;
//_viewContainer = null;
//_template = null;
}
}
44 changes: 22 additions & 22 deletions angular_components/lib/dynamic_component/dynamic_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DynamicComponent implements OnDestroy, AfterChanges {
bool _loadDeferred = false;

@ViewChild('marker', read: ViewContainerRef)
set viewContainerRef(ViewContainerRef value) {
set viewContainerRef(ViewContainerRef? value) {
_viewContainerRef = value;
if (_loadDeferred) {
_initialize();
Expand Down Expand Up @@ -65,14 +65,14 @@ class DynamicComponent implements OnDestroy, AfterChanges {
/// The type of component to dynamically render.
@Deprecated('Use componentFactory instead as it is more tree-shakable')
@Input()
set componentType(Type dartType) {
set componentType(Type? dartType) {
if (_componentType != dartType) _typeChanged = true;
_componentType = dartType;
}

/// The component factory of the component to dynamically render.
@Input()
set componentFactory(ComponentFactory component) {
set componentFactory(ComponentFactory? component) {
if (_componentFactory != component) _factoryChanged = true;
_componentFactory = component;
}
Expand Down Expand Up @@ -112,25 +112,25 @@ class DynamicComponent implements OnDestroy, AfterChanges {
_componentFactory!, _viewContainerRef!);
_onLoadController.add(_childComponent);
_updateChildComponent();
// } else if (_componentType != null) {
// // TODO(google): Remove this code once componentType is no longer used.
// Type loadType = _componentType;
// _slowComponentLoader
// .loadNextToLocation(loadType, _viewContainerRef)
// .then((ComponentRef componentRef) {
// if (loadType != _componentType) {
// // During the load time, the component type has changed,
// // and the type we just loaded is no longer valid.
// componentRef.destroy();
// return;
// }
// if (_childComponent != null) {
// throw 'Attempting to overwrite a dynamic component';
// }
// _childComponent = componentRef;
// _onLoadController.add(componentRef);
// _updateChildComponent();
// });
// } else if (_componentType != null) {
// // TODO(google): Remove this code once componentType is no longer used.
// Type loadType = _componentType;
// _slowComponentLoader
// .loadNextToLocation(loadType, _viewContainerRef)
// .then((ComponentRef componentRef) {
// if (loadType != _componentType) {
// // During the load time, the component type has changed,
// // and the type we just loaded is no longer valid.
// componentRef.destroy();
// return;
// }
// if (_childComponent != null) {
// throw 'Attempting to overwrite a dynamic component';
// }
// _childComponent = componentRef;
// _onLoadController.add(componentRef);
// _updateChildComponent();
// });
}
}

Expand Down
12 changes: 6 additions & 6 deletions angular_components/lib/focus/focus.dart
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class AutoFocusDirective extends RootFocusable implements OnInit, OnDestroy {
// These fields are not final to support nulling them out for easier memory
// leak detection.
Focusable? _focusable;
DomService? _domService;
DomService _domService;
ModalComponent? _modal;
PopupRef? _popupRef;

Expand Down Expand Up @@ -222,7 +222,7 @@ class AutoFocusDirective extends RootFocusable implements OnInit, OnDestroy {
_disposer.addStreamSubscription(
onVisibleChanged.listen(_onModalOrPopupVisibleChanged));
} else {
_domService!.scheduleWrite(focus);
_domService.scheduleWrite(focus);
}
}

Expand All @@ -231,8 +231,8 @@ class AutoFocusDirective extends RootFocusable implements OnInit, OnDestroy {
/// This value should not change during the component's life.
// TODO(google): Change to an attribute.
@Input()
set autoFocus(bool value) {
_autoFocus = value;
set autoFocus(bool? value) {
_autoFocus = value ?? false;
}

@override
Expand All @@ -251,13 +251,13 @@ class AutoFocusDirective extends RootFocusable implements OnInit, OnDestroy {
super.dispose();
_disposer.dispose();
_focusable = null;
_domService = null;
//_domService = null;
_modal = null;
_popupRef = null;
}

void _onModalOrPopupVisibleChanged(bool isVisible) {
if (isVisible) _domService!.scheduleWrite(focus);
if (isVisible) _domService.scheduleWrite(focus);
}
}

Expand Down
11 changes: 8 additions & 3 deletions angular_components/lib/focus/focus_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,21 @@ class FocusListDirective implements OnDestroy {

@HostBinding('attr.role')
final String role;

@HostBinding('attr.ignoreUpAndDown')
final bool ignoreUpAndDown;
String get ignoreUpAndDownStr => '$ignoreUpAndDown';

bool ignoreUpAndDown = false;

final _disposer = Disposer.multi();
final _children = <FocusableItem>[];
int get _length => _children.length;

FocusListDirective(this._ngZone, @Attribute('role') String? role,
@Attribute('ignoreUpAndDown') String ignoreUpAndDown)
@Attribute('ignoreUpAndDown') String? ignoreUpAndDown)
: this.role = role ?? 'list',
this.ignoreUpAndDown = attributeToBool(ignoreUpAndDown);
this.ignoreUpAndDown =
attributeToBool(ignoreUpAndDown, defaultValue: false);

/// Whether focus movement loops from the end of the list to the beginning of
/// the list. Default is `false`.
Expand Down
16 changes: 9 additions & 7 deletions angular_components/lib/focus/focus_trap.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ class FocusTrapComponent implements OnDestroy {

AutoFocusDirective? _autoFocusDirective;
@ContentChild(AutoFocusDirective)
set autoFocus(AutoFocusDirective value) {
set autoFocus(AutoFocusDirective? value) {
_autoFocusDirective = value;
}

FocusContentWrapper? _content;
@ViewChild(FocusContentWrapper)
set content(FocusContentWrapper value) {
set content(FocusContentWrapper? value) {
_content = value;
if (_content != null && _autoFocusDirective == null) {
_content!._element.focus();
Expand All @@ -43,19 +43,21 @@ class FocusTrapComponent implements OnDestroy {
}

void focusFirst() {
_focusFirstInOrder(
DomTreeIterator(_content!.element, scope: _content!.element));
if (_content != null) {
_focusFirstInOrder(
DomTreeIterator(_content!.element, scope: _content!.element));
}
}

void focusLast() {
_focusFirstInOrder(DomTreeIterator(_content!.element,
scope: _content!.element, reverse: true, wraps: true));
}

void _focusFirstInOrder(Iterator<Element?> iterator) {
void _focusFirstInOrder(Iterator<Element> iterator) {
while (iterator.moveNext()) {
if (iterator.current!.tabIndex == 0 && _visible(iterator.current!)) {
iterator.current!.focus();
if (iterator.current.tabIndex == 0 && _visible(iterator.current)) {
iterator.current.focus();
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion angular_components/lib/interfaces/has_disabled.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

/// Interface for classes accepting a disabled setting.
abstract class HasDisabled {
bool? disabled;
bool disabled = false;
}
Loading