Skip to content
This repository was archived by the owner on May 20, 2023. It is now read-only.

Commit b154fb0

Browse files
TedSandernshahan
authored andcommitted
Add generated documentation for material_tree component.
PiperOrigin-RevId: 202701038
1 parent f11febb commit b154fb0

File tree

3 files changed

+34
-17
lines changed

3 files changed

+34
-17
lines changed

lib/model/selection/selection_container.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ abstract class SelectionItem<T> implements HasRenderer<T> {
7474
}
7575

7676
/// A simple function to render the item to string.
77-
/// @override
7877
ItemRenderer<T> _itemRenderer;
7978
@override
8079
ItemRenderer<T> get itemRenderer => _itemRenderer;

lib/src/material_tree/material_tree_dropdown.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import 'package:angular_components/model/selection/selection_container.dart';
1919
import 'package:angular_components/model/selection/selection_model.dart';
2020
import 'package:angular_components/model/selection/selection_options.dart';
2121
import 'package:angular_components/model/ui/has_renderer.dart';
22+
import 'package:angular_components/model/ui/has_factory.dart';
2223
import 'package:angular_components/utils/browser/dom_service/dom_service.dart';
2324

2425
import 'material_tree_impl.dart';
@@ -70,14 +71,17 @@ class MaterialTreeDropdownComponent extends SelectionContainer
7071
@ViewChild(MaterialTreeFilterComponent)
7172
MaterialTreeFilterComponent materialTreeFilterComponent;
7273

74+
/// Whether to always expand an option group.
7375
@Input()
7476
set expandAll(bool value) {
7577
_expandAll = value;
7678
}
7779

80+
/// Place the filter input inside of the popup.
7881
@Input()
7982
bool showFilterInsidePopup = false;
8083

84+
/// When `true` expand all items when the tree is being filtered.
8185
@Input()
8286
bool shouldExpandAllWhenFiltered = true;
8387

@@ -107,30 +111,43 @@ class MaterialTreeDropdownComponent extends SelectionContainer
107111
selection = const SelectionModel.empty();
108112
}
109113

114+
@Deprecated('Use [factoryRenderer] instead')
110115
@Input()
111116
@override
112117
set componentRenderer(ComponentRenderer value) {
113118
super.componentRenderer = value;
114119
}
115120

121+
/// Specifies the factoryRenderer to use to determine the factory for
122+
/// rendering an item.
123+
@Input()
124+
@override
125+
set factoryRenderer(FactoryRenderer value) {
126+
super.factoryRenderer = value;
127+
}
128+
129+
/// A simple function to render the item to string.
116130
@Input()
117131
@override
118132
set itemRenderer(ItemRenderer value) {
119133
super.itemRenderer = value;
120134
}
121135

136+
/// The available options for this contianer.
122137
@Input()
123138
@override
124139
set options(SelectionOptions value) {
125140
super.options = value;
126141
}
127142

143+
/// The selection model this container represents.
128144
@Input()
129145
@override
130146
set selection(SelectionModel value) {
131147
super.selection = value;
132148
}
133149

150+
/// Placeholder to be used for the dropdown text when nothing is selected.
134151
@Input()
135152
set placeholder(String placeholder) {
136153
_placeholder = placeholder ?? _DEFAULT_PLACEHOLDER;
@@ -144,6 +161,7 @@ class MaterialTreeDropdownComponent extends SelectionContainer
144161

145162
bool get visible => _visible;
146163

164+
/// Whether to show the dropdown or not.
147165
@Input()
148166
set visible(bool val) {
149167
if (_visible != val) {

lib/src/material_tree/material_tree_impl.dart

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ import 'package:angular_components/model/ui/has_factory.dart';
1515

1616
/// A material selection component that supports a tree of options.
1717
///
18-
/// To use, simply pass in a minimum of [options] to see items:
19-
/// <material-tree [options]="selectionOptions"></material-tree>
18+
/// To use, simply pass in a minimum of [options] to see items.
2019
///
2120
/// If [SelectionOptions] implements the [Parent] interface, a handle is shown
2221
/// for each option that [Parent.hasChildren] is set for, and toggling the
@@ -26,21 +25,8 @@ import 'package:angular_components/model/ui/has_factory.dart';
2625
/// If [SelectionOptions] implements the [Filterable] interface.
2726
///
2827
/// To receive feedback from the component, a [selection] model is required.
29-
/// <material-tree
30-
/// [options]="selectionOptions"
31-
/// [selection]="selectionModel">
32-
/// </material-tree>
3328
///
34-
/// To customize, specify an [itemRenderer] and/or [componentRenderer].
35-
///
36-
/// You may add an HTML attribute 'in-dropdown' to optimize use in a dropdown;
37-
/// for example, this will hide checks in a single selection since the selection
38-
/// state is already known:
39-
/// <material-tree
40-
/// dropdown
41-
/// [options]="selectionOptions"
42-
/// [selection]="selectionModel">
43-
/// </material-tree>
29+
/// To customize, specify an [itemRenderer] and/or [factoryRenderer].
4430
@Component(
4531
selector: 'material-tree',
4632
directives: const [
@@ -57,6 +43,7 @@ import 'package:angular_components/model/ui/has_factory.dart';
5743
templateUrl: 'material_tree_impl.html',
5844
)
5945
class MaterialTreeComponent extends SelectionContainer with MaterialTreeRoot {
46+
/// Whether to hide check-marks in a single select dropdown
6047
@Input()
6148
@override
6249
bool optimizeForDropdown;
@@ -69,39 +56,52 @@ class MaterialTreeComponent extends SelectionContainer with MaterialTreeRoot {
6956
selection = const SelectionModel.empty();
7057
}
7158

59+
@Deprecated('Use [factoryRenderer] instead')
7260
@Input()
7361
@override
7462
set componentRenderer(ComponentRenderer value) {
7563
super.componentRenderer = value;
7664
}
7765

66+
/// Specifies the factoryRenderer to use to determine the factory for
67+
/// rendering an item.
7868
@Input()
7969
@override
8070
set factoryRenderer(FactoryRenderer value) {
8171
super.factoryRenderer = value;
8272
}
8373

74+
/// A simple function to render the item to string.
8475
@Input()
8576
@override
8677
set itemRenderer(ItemRenderer value) {
8778
super.itemRenderer = value;
8879
}
8980

81+
/// The available options for this contianer.
9082
@Input()
9183
@override
9284
set options(SelectionOptions value) {
9385
super.options = value;
9486
}
9587

88+
/// The selection model this container represents.
9689
@Input()
9790
@override
9891
set selection(SelectionModel value) {
9992
super.selection = value;
10093
}
10194

95+
/// Whether to always expand an option group.
10296
@Input()
10397
bool expandAll = false;
10498

99+
/// Whether the widgets supports the selection of non-leaf nodes
100+
///
101+
/// When `false`, and the widget is using a single selection model clicking
102+
/// the widget should toggle expansion when a non-leaf node is clicked. When
103+
/// `true` the widget should select non-leaf nodes when clicked and only
104+
/// toggle expansion when the expansion icon is clicked.
105105
@Input()
106106
@override
107107
bool allowParentSingleSelection = false;

0 commit comments

Comments
 (0)