Skip to content
This repository was archived by the owner on Jan 22, 2018. It is now read-only.

Commit 51b90f8

Browse files
author
Kamil Kisiela
committed
docs: add documentation of all types and wrappers
as separate files and just link to them in readme
1 parent 3849a48 commit 51b90f8

File tree

13 files changed

+341
-218
lines changed

13 files changed

+341
-218
lines changed

README.md

Lines changed: 32 additions & 218 deletions
Original file line numberDiff line numberDiff line change
@@ -45,233 +45,33 @@ angular.module('myAppName', [
4545

4646
Any requests? Add issue!
4747

48-
## Common properties
49-
50-
### label (string)
51-
52-
### theme (string)
53-
54-
md-theme attribute
55-
5648
## Fields
5749

58-
### input
59-
60-
```javascript
61-
{
62-
"type": "input",
63-
"key": "firstName",
64-
"templateOptions": {
65-
"type": "text",
66-
"label": "First name",
67-
"theme": "custom"
68-
}
69-
}
70-
```
71-
72-
### textarea
73-
74-
**rows (number, optional)**
75-
76-
```javascript
77-
{
78-
"type": "textarea",
79-
"key": "bio",
80-
"templateOptions": {
81-
"label": "Biography",
82-
"theme": "custom",
83-
"rows": 5
84-
}
85-
}
86-
```
87-
88-
### radio
89-
90-
**options (array, requred)**
91-
92-
**labelProp (string, optional)**
93-
94-
**valueProp (string, optional)**
95-
96-
```javascript
97-
{
98-
"type": "radio",
99-
"key": "name",
100-
"templateOptions": {
101-
"label": "Name",
102-
"theme": "custom",
103-
"labelProp": "firstName",
104-
"valueProp": "id",
105-
"options": [
106-
{"firstName": "Sarah", id: 1},
107-
{"firstName": "Jessica", id: 2},
108-
{"firstName": "Parker", id: 3}
109-
]
110-
}
111-
}
112-
```
113-
114-
### select
115-
116-
**options (array, requred)**
117-
118-
**labelProp (string, optional)**
119-
120-
**valueProp (string, optional)**
121-
122-
**multiple (boolean, optional)**
123-
124-
```javascript
125-
{
126-
"type": "select",
127-
"key": "name",
128-
"templateOptions": {
129-
"label": "Name",
130-
"theme": "custom",
131-
"multiple": true,
132-
"labelProp": "firstName",
133-
"valueProp": "id",
134-
"options": [
135-
{"firstName": "Sarah", id: 1},
136-
{"firstName": "Jessica", id: 2},
137-
{"firstName": "Parker", id: 3}
138-
]
139-
}
140-
}
141-
```
142-
143-
### checkbox
144-
145-
```javascript
146-
{
147-
"type": "checkbox",
148-
"key": "terms",
149-
"templateOptions": {
150-
"label": "Terms and Conditions",
151-
"theme": "custom"
152-
}
153-
}
154-
```
155-
156-
### switch
157-
158-
```javascript
159-
{
160-
"type": "switch",
161-
"key": "terms",
162-
"templateOptions": {
163-
"label": "Terms and Conditions",
164-
"theme": "custom"
165-
}
166-
}
167-
```
168-
169-
### datepicker
170-
171-
**placeholder (string, optional)**
172-
173-
md-placeholder
174-
175-
**minDate (Date, optional)**
176-
177-
md-min-date
178-
179-
**maxDate (Date, optional)**
180-
181-
md-max-date
182-
183-
**filterDate (function, optional)**
184-
185-
md-filter-date
186-
187-
```javascript
188-
{
189-
"type": "datepicker",
190-
"key": "start",
191-
"templateOptions": {
192-
"theme": "custom",
193-
"placeholder": "Start date",
194-
"minDate": minDate, // instance of Date
195-
"maxDate": maxDate, // instance of Date
196-
"filterDate": function(date) {
197-
// only weekends
198-
var day = date.getDay();
199-
return day === 0 || day === 6;
200-
}
201-
}
202-
}
203-
```
204-
205-
### chips
206-
207-
**placeholder (string, optional)**
208-
209-
placeholder attribute value
210-
211-
**secondaryPlaceholder (string, optional)**
212-
213-
secondary-placeholder attribute value
214-
215-
**deleteButtonLabel (string, optional)**
216-
217-
delete-button-label attribute value
50+
* [checkbox][types.checkbox]
51+
* [chips][types.chips]
52+
* [datepicker][types.datepicker]
53+
* [input][types.input]
54+
* [radio][types.radio]
55+
* [select][types.select]
56+
* [slider][types.slider]
57+
* [switch][types.switch]
58+
* [textarea][types.textarea]
21859

219-
**deleteHint (string, optional)**
220-
221-
delete-hint attribute value
222-
223-
```javascript
224-
{
225-
"type": "chips",
226-
"key": "tags",
227-
"templateOptions": {
228-
"theme": "custom",
229-
"placeholder": "+tags",
230-
"secondaryPlaceholder": "Add tag",
231-
"deleteButtonLabel": "Remove",
232-
"deleteHint": "Remove tag"
233-
}
234-
}
235-
```
236-
237-
### slider
238-
239-
**min (number, optional)**
240-
241-
default 1
242-
243-
**max (number, optional)**
244-
245-
default 100
246-
247-
**step (number, optional)**
248-
249-
default 1
60+
## Wrappers
25061

251-
**discrete (boolean, optional)**
62+
* [input-container][wrappers.input-container]
63+
* [label][wrappers.label]
64+
* [messages][wrappers.messages]
25265

253-
default false (md-discrete)
66+
## Common settings
25467

255-
```javascript
256-
{
257-
"type": "slider",
258-
"key": "rate",
259-
"templateOptions": {
260-
"theme": "custom",
261-
"min": 1,
262-
"max": 5,
263-
"step": 0.5,
264-
"discrete": true
265-
}
266-
}
267-
```
68+
### label (string)
26869

70+
Text used as a field's label
26971

270-
## Wrappers
72+
### theme (string)
27173

272-
- inputContainer (md-input-container)
273-
- label
274-
- messages (ng-messages)
74+
Value of md-theme used on field
27575

27676
## Roadmap
27777

@@ -289,3 +89,17 @@ default false (md-discrete)
28989
- [ ] e2e tests
29090

29191
Requests (?). Post an issue.
92+
93+
[types.checkbox]: docs/types/checkbox.md
94+
[types.chips]: docs/types/chips.md
95+
[types.datepicker]: docs/types/datepicker.md
96+
[types.input]: docs/types/input.md
97+
[types.radio]: docs/types/radio.md
98+
[types.select]: docs/types/select.md
99+
[types.slider]: docs/types/slider.md
100+
[types.switch]: docs/types/switch.md
101+
[types.textarea]: docs/types/textare.md
102+
103+
[wrappers.input-container]: docs/wrappers/input-container.md
104+
[wrappers.label]: docs/wrappers/label.md
105+
[wrappers.messages]: docs/wrappers/messages.md

docs/types/checkbox.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# checkbox
2+
## md-checkbox
3+
4+
### Example
5+
6+
```javascript
7+
{
8+
"type": "checkbox",
9+
"key": "terms",
10+
"templateOptions": {
11+
"label": "Terms and Conditions",
12+
"theme": "custom"
13+
}
14+
}
15+
```
16+
17+
### Configuration
18+
19+
#### templateOptions.label _: string_
20+
21+
#### templateOptions.theme _: string_

docs/types/chips.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# chips
2+
## md-chips
3+
4+
### Example
5+
6+
```javascript
7+
{
8+
"type": "chips",
9+
"key": "tags",
10+
"templateOptions": {
11+
"theme": "custom",
12+
"placeholder": "+tags",
13+
"secondaryPlaceholder": "Add tag",
14+
"deleteButtonLabel": "Remove",
15+
"deleteHint": "Remove tag"
16+
}
17+
}
18+
```
19+
20+
### Configuration
21+
22+
#### templateOptions.label _: string_
23+
24+
#### templateOptions.theme _: string_
25+
26+
#### templateOptions.placeholder _: string_
27+
Placeholder text that will be forwarded to the input.
28+
29+
#### templateOptions.secondaryPlaceholder _: string_
30+
Placeholder text that will be forwarded to the input, displayed when there is at least on item in the list.
31+
32+
#### templateOptions.deleteButtonLabel _: string_
33+
A label for the delete button. Also hidden and read by screen readers.
34+
35+
#### templateOptions.deleteHint _: string_
36+
A string read by screen readers instructing users that pressing the delete key will remove the chip.

docs/types/datepicker.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# datepicker
2+
## md-datepicker
3+
4+
**placeholder (string, optional)**
5+
6+
md-placeholder
7+
8+
**minDate (Date, optional)**
9+
10+
md-min-date
11+
12+
**maxDate (Date, optional)**
13+
14+
md-max-date
15+
16+
**filterDate (function, optional)**
17+
18+
md-filter-date
19+
20+
### Example
21+
22+
```javascript
23+
{
24+
"type": "datepicker",
25+
"key": "start",
26+
"templateOptions": {
27+
"theme": "custom",
28+
"placeholder": "Start date",
29+
"minDate": minDate, // instance of Date
30+
"maxDate": maxDate, // instance of Date
31+
"filterDate": function(date) {
32+
// only weekends
33+
var day = date.getDay();
34+
return day === 0 || day === 6;
35+
}
36+
}
37+
}
38+
```
39+
40+
### Configuration
41+
42+
#### templateOptions.label _: string_
43+
44+
#### templateOptions.theme _: string_
45+
46+
#### templateOptions.placeholder _: string_
47+
The date input placeholder value
48+
49+
#### templateOptions.minDate _: Date_
50+
Min date of choice
51+
52+
#### templateOptions.maxDate _: Date_
53+
Max date of choice
54+
55+
#### templateOptions.filterDate _: function_
56+
Function expecting a date and returning a boolean whether it can be selected or not.

0 commit comments

Comments
 (0)