/
label.js
106 lines (95 loc) · 2.03 KB
/
label.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import Component from '@glimmer/component';
import deprecateSubclassing from 'ember-bootstrap/utils/deprecate-subclassing';
import arg from 'ember-bootstrap/utils/decorators/arg';
/**
@class FormElementLabel
@namespace Components
@extends Ember.Component
@private
*/
@deprecateSubclassing
export default class FormElementLabel extends Component {
/**
* @property label
* @type string
* @public
*/
/**
* @property invisibleLabel
* @type boolean
* @public
*/
get isHorizontalAndNotCheckbox() {
return this.isHorizontal && !this.isCheckbox;
}
/**
* [BS4 only] Property for size styling, set to 'lg', 'sm'
*
* @property size
* @type String
* @public
*/
/**
* @property formElementId
* @type {String}
* @public
*/
/**
* @property labelClass
* @type {String}
* @public
*/
/**
* The form layout used for the markup generation (see http://getbootstrap.com/css/#forms):
*
* * 'horizontal'
* * 'vertical'
* * 'inline'
*
* Defaults to the parent `form`'s `formLayout` property.
*
* @property formLayout
* @type string
* @default 'vertical'
* @public
*/
@arg
formLayout = 'vertical';
/**
* The type of the control widget.
* Supported types:
*
* * 'text'
* * 'checkbox'
* * 'textarea'
* * any other type will use an input tag with the `controlType` value as the type attribute (for e.g. HTML5 input
* types like 'email'), and the same layout as the 'text' type
*
* @property controlType
* @type string
* @default 'text'
* @public
*/
@arg
controlType = 'text';
/**
* Indicates whether the type of the control widget equals `checkbox`
*
* @property isCheckbox
* @type boolean
* @private
*/
get isCheckbox() {
return this.args.controlType === 'checkbox';
}
/**
* Indicates whether the form type equals `horizontal`
*
* @property isHorizontal
* @type boolean
* @private
*/
get isHorizontal() {
return this.args.formLayout === 'horizontal';
}
}