Skip to content

Commit

Permalink
Merge branch 'dev' into compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
GZGavinZhao authored Oct 15, 2021
2 parents 1b0cf8c + 1839ecc commit 2aa4968
Show file tree
Hide file tree
Showing 251 changed files with 3,947 additions and 4,660 deletions.
1,072 changes: 15 additions & 1,057 deletions .github/workflows/dart.yml

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Merge to dev

on:
push:
branches:
- compatible
# schedule:
# - cron: '0 0 * * *'

jobs:
create_pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
with:
commit-message: Merge compatible into dev, commit ${GITHUB_SHA}
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
branch: dev
delete-branch: false
title: '[BOT] Merge compatible into dev'
body: |
Automatically merge `compatible` branch into `dev` to make sure they're on the same page.
Initiated by commit ${GITHUB_SHA}.
Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
labels: |
automated
assignees: GZGavinZhao
reviewers: GZGavinZhao
draft: false

- name: Check outputs
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,12 @@ doc/api/
*.ipr
*.iws

.vscode
# Vim
*.yml~
*.yaml~
*.dart~

# VsCode
.vscode/
!.vscode/settings.json
.metals
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"files.watcherExclude": {
"**/target": true
}
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[![AngularDart Chat](https://img.shields.io/gitter/room/angulardart/community?color=blue&label=angulardart%2Fcommunity&logo=matrix)](https://gitter.im/angulardart/community)

> I attempt to migrate it to null-safety little by little, perhaps one `dart` file every day. ~~As the saying goes: a commit a day, keeps the doctor away.~~
[Material design] components for [AngularDart]. Powering some of Google's most
sophisticated and mission-critical [applications].

Expand Down
7 changes: 7 additions & 0 deletions angular_components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Change Log

## 2.0.0

* Migrated using `dart migrate`
* `Denomination` class throws ArguementError for incorrect suffix

## 1.0.3

* Roll observable dependency.
Expand Down
3 changes: 2 additions & 1 deletion angular_components/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ include: package:lints/recommended.yaml

analyzer:
errors:
todo: ignore
# Happen a lots with angular
uri_has_not_been_generated: ignore
###############
Expand All @@ -23,7 +24,7 @@ analyzer:
prefer_function_declarations_over_variables: ignore
unnecessary_string_interpolations: ignore
avoid_returning_null_for_void: ignore
prefer_if_null_operators: ignore
# prefer_if_null_operators: ignore
overridden_fields: ignore
prefer_for_elements_to_map_fromIterable: ignore
prefer_spread_collections: ignore
Expand Down
4 changes: 2 additions & 2 deletions angular_components/lib/annotations/rtl_annotation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ const rtlProvider =

@Injectable()
bool determineRtl(Document document) =>
document.documentElement.dir == 'rtl' ||
(document as HtmlDocument).body.dir == 'rtl';
document.documentElement?.dir == 'rtl' ||
(document as HtmlDocument).body?.dir == 'rtl';
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 10 additions & 10 deletions angular_components/lib/button_decorator/button_decorator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,24 @@ class ButtonDirective extends RootFocusable
final _trigger = StreamController<UIEvent>.broadcast(sync: true);

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

ButtonDirective(Element element, @Attribute('role') String role,
ButtonDirective(Element element, @Attribute('role') String? role,
{bool addTabIndexWhenNonTabbable = false, bool handleSpacePresses = true})
: this.role = (role ?? 'button'),
// Allow the subclass to define how the element should be made
// untabbable.
_nonTabbableIndex = addTabIndexWhenNonTabbable ? '-1' : null,
_shouldHandleSpaceKey = handleSpacePresses ?? true,
_shouldHandleSpaceKey = handleSpacePresses,
super(element);

/// Role of this component used for a11y.
@Input()
String role;
String? role;

@HostBinding('attr.role')
String get ariaRole => role;
String? get ariaRole => role;

/// String value to be passed to aria-disabled.
@HostBinding('attr.aria-disabled')
Expand All @@ -60,14 +60,14 @@ 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 =>
tabbable && !disabled! ? _hostTabIndex : _nonTabbableIndex;

/// The tab index of the component.
///
Expand All @@ -80,14 +80,14 @@ class ButtonDirective extends RootFocusable
/// 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
20 changes: 10 additions & 10 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;
EmbeddedViewRef _viewRef;
TemplateRef _template;
ViewContainerRef? _viewContainer;
EmbeddedViewRef? _viewRef;
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 Down Expand Up @@ -120,18 +120,18 @@ class DeferredContentDirective implements OnDestroy {
selector: '[cachedDeferredContent]',
)
class CachingDeferredContentDirective implements OnDestroy {
ViewContainerRef _viewContainer;
TemplateRef _template;
ViewContainerRef? _viewContainer;
TemplateRef? _template;
final _disposer = Disposer.oneShot();
ViewRef _view;
ViewRef? _view;

// Keep around the current state.
bool _visible = false;

void _setVisible(bool value) {
if (value == _visible) return;
if (value && _view == null) {
_view = _viewContainer.createEmbeddedView(_template);
_view = _viewContainer!.createEmbeddedView(_template!);
}
_visible = value;
}
Expand Down
20 changes: 10 additions & 10 deletions angular_components/lib/dynamic_component/dynamic_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import 'package:angular_components/model/ui/has_renderer.dart';
)
class DynamicComponent implements OnDestroy, AfterChanges {
final ComponentLoader _componentLoader;
final _onLoadController = StreamController<ComponentRef>();
final _onLoadController = StreamController<ComponentRef?>();

ViewContainerRef _viewContainerRef;
ViewContainerRef? _viewContainerRef;
bool _loadDeferred = false;

@ViewChild('marker', read: ViewContainerRef)
Expand All @@ -33,23 +33,23 @@ class DynamicComponent implements OnDestroy, AfterChanges {
}
}

ComponentRef _childComponent;
Type _componentType;
ComponentRef? _childComponent;
Type? _componentType;
bool _typeChanged = false;
ComponentFactory _componentFactory;
ComponentFactory? _componentFactory;
bool _factoryChanged = false;
Object _value;
Object? _value;
bool _valueChanged = false;

/// Fired when component is loaded allowing clients to get a handle on the
/// component loaded.
@Output()
Stream<ComponentRef> get onLoad => _onLoadController.stream;
Stream<ComponentRef?> get onLoad => _onLoadController.stream;

DynamicComponent(this._componentLoader);

/// Returns the loaded dynamic component reference.
ComponentRef get childComponent => _childComponent;
ComponentRef? get childComponent => _childComponent;

@override
void ngOnDestroy() {
Expand Down Expand Up @@ -109,7 +109,7 @@ class DynamicComponent implements OnDestroy, AfterChanges {
}

_childComponent = _componentLoader.loadNextToLocation(
_componentFactory, _viewContainerRef);
_componentFactory!, _viewContainerRef!);
_onLoadController.add(_childComponent);
_updateChildComponent();
// } else if (_componentType != null) {
Expand All @@ -136,7 +136,7 @@ class DynamicComponent implements OnDestroy, AfterChanges {

void _updateChildComponent() {
if (_childComponent != null) {
_childComponent.update((instance) {
_childComponent!.update((instance) {
if (instance is RendersValue) {
instance.value = _value;
}
Expand Down
Loading

0 comments on commit 2aa4968

Please sign in to comment.