]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | /**\r |
2 | * Creates a visual theme for checkboxes and radio buttons. Note this mixin only provides\r | |
3 | * styling for the checkbox/radio button and its {@link #boxLabel}, The {@link #fieldLabel}\r | |
4 | * and error icon/message are styled by {@link #extjs-label-ui}.\r | |
5 | *\r | |
6 | * @param {string} $ui\r | |
7 | * The name of the UI being created. Can not included spaces or special punctuation\r | |
8 | * (used in CSS class names).\r | |
9 | *\r | |
10 | * @param {number} [$ui-field-height=$form-field-height]\r | |
11 | * The height of the field body that the checkbox must fit within. This does not set the\r | |
12 | * height of the field, only allows the checkbox to be centered inside the field body.\r | |
13 | * (The height of the field body is determined by {@link #extjs-label-ui}).\r | |
14 | *\r | |
15 | * @param {number} [$ui-checkbox-size=$form-checkbox-size]\r | |
16 | * The size of the checkbox\r | |
17 | *\r | |
18 | * @param {string} [$ui-checkbox-background-image=$form-checkbox-background-image]\r | |
19 | * The background-image of the checkbox\r | |
20 | *\r | |
21 | * @param {string/list} [$ui-checkbox-glyph=$form-checkbox-glyph]\r | |
22 | * The glyph for the checkbox when {@link Global_CSS#$enable-font-icons} is `true`.\r | |
23 | *\r | |
24 | * @param {string/list} [$ui-checkbox-checked-glyph=$form-checkbox-checked-glyph]\r | |
25 | * The glyph for the checkbox in "checked" state when {@link Global_CSS#$enable-font-icons} is `true`.\r | |
26 | *\r | |
27 | * @param {color} [$ui-checkbox-glyph-color=$form-checkbox-glyph-color]\r | |
28 | * The color of the checkbox when {@link Global_CSS#$enable-font-icons} is `true`.\r | |
29 | *\r | |
30 | * @param {color} [$ui-checkbox-glyph-focus-color=$form-checkbox-glyph-focus-color]\r | |
31 | * The color of the checkbox in "focused" state when {@link Global_CSS#$enable-font-icons} is `true`.\r | |
32 | *\r | |
33 | * @param {string} [$ui-radio-background-image=$form-radio-background-image]\r | |
34 | * The background-image of the radio button\r | |
35 | *\r | |
36 | * @param {string/list} [$ui-radio-glyph=$form-radio-glyph]\r | |
37 | * The glyph for the radio button when {@link Global_CSS#$enable-font-icons} is `true`.\r | |
38 | *\r | |
39 | * @param {string/list} [$ui-radio-checked-glyph=$form-radio-checked-glyph]\r | |
40 | * The glyph for the radio button in "checked" state when {@link Global_CSS#$enable-font-icons} is `true`.\r | |
41 | *\r | |
42 | * @param {color} [$ui-radio-glyph-color=$form-radio-glyph-color]\r | |
43 | * The color of the radio button when {@link Global_CSS#$enable-font-icons} is `true`.\r | |
44 | *\r | |
45 | * @param {color} [$ui-radio-glyph-focus-color=$form-radio-glyph-focus-color]\r | |
46 | * The color of the radio button in "focused" state when {@link Global_CSS#$enable-font-icons} is `true`.\r | |
47 | *\r | |
48 | * @param {color} [$ui-label-color=$form-checkbox-label-color]\r | |
49 | * The color of the checkbox's {@link #boxLabel}\r | |
50 | *\r | |
51 | * @param {string} [$ui-label-font-weight=$form-checkbox-label-font-weight]\r | |
52 | * The font-weight of the checkbox's {@link #boxLabel}\r | |
53 | *\r | |
54 | * @param {string} [$ui-label-font-size=$form-checkbox-label-font-size]\r | |
55 | * The font-size of the checkbox's {@link #boxLabel}\r | |
56 | *\r | |
57 | * @param {string} [$ui-label-font-family=$form-checkbox-label-font-family]\r | |
58 | * The font-family of the checkbox's {@link #boxLabel}\r | |
59 | *\r | |
60 | * @param {string} [$ui-label-line-height=$form-checkbox-label-line-height]\r | |
61 | * The line-height of the checkbox's {@link #boxLabel}\r | |
62 | *\r | |
63 | * @param {number} [$ui-label-spacing=$form-checkbox-label-spacing]\r | |
64 | * The space between the boxLabel and the checkbox.\r | |
65 | *\r | |
66 | * @member Ext.form.field.Checkbox\r | |
67 | */\r | |
68 | @mixin extjs-checkbox-ui(\r | |
69 | $ui: null,\r | |
70 | $ui-field-height: $form-field-height,\r | |
71 | $ui-checkbox-size: $form-checkbox-size,\r | |
72 | $ui-checkbox-background-image: $form-checkbox-background-image,\r | |
73 | $ui-checkbox-glyph: $form-checkbox-glyph,\r | |
74 | $ui-checkbox-checked-glyph: $form-checkbox-checked-glyph,\r | |
75 | $ui-checkbox-glyph-color: $form-checkbox-glyph-color,\r | |
76 | $ui-checkbox-glyph-focus-color: $form-checkbox-glyph-focus-color,\r | |
77 | $ui-radio-background-image: $form-radio-background-image,\r | |
78 | $ui-radio-glyph: $form-radio-glyph,\r | |
79 | $ui-radio-checked-glyph: $form-radio-checked-glyph,\r | |
80 | $ui-radio-glyph-color: $form-radio-glyph-color,\r | |
81 | $ui-radio-glyph-focus-color: $form-radio-glyph-focus-color,\r | |
82 | $ui-label-color: $form-checkbox-label-color,\r | |
83 | $ui-label-font-weight: $form-checkbox-label-font-weight,\r | |
84 | $ui-label-font-size: $form-checkbox-label-font-size,\r | |
85 | $ui-label-font-family: $form-checkbox-label-font-family,\r | |
86 | $ui-label-line-height: $form-checkbox-label-line-height,\r | |
87 | $ui-label-spacing: $form-checkbox-label-spacing\r | |
88 | ) {\r | |
89 | .#{$prefix}form-cb-wrap-#{$ui} {\r | |
90 | height: $ui-field-height;\r | |
91 | // The checkbox field's body element must be at least the width of the checkbox.\r | |
92 | // This min-width prevents the width from collapsing to 0 when there is no boxLabel\r | |
93 | // since the checkbox-containing element itself is absolutely positioned.\r | |
94 | // See EXTJS-18430\r | |
95 | min-width: $ui-checkbox-size;\r | |
96 | }\r | |
97 | \r | |
98 | .#{$prefix}form-cb-#{$ui} {\r | |
99 | // vertically center the checkbox\r | |
100 | margin-top: round(($ui-field-height - $ui-checkbox-size) / 2);\r | |
101 | }\r | |
102 | \r | |
103 | .#{$prefix}form-checkbox-#{$ui},\r | |
104 | .#{$prefix}form-radio-#{$ui} {\r | |
105 | width: $ui-checkbox-size;\r | |
106 | height: $ui-checkbox-size;\r | |
107 | }\r | |
108 | \r | |
109 | .#{$prefix}form-radio-#{$ui} {\r | |
110 | @if $enable-font-icons and ($ui-radio-glyph != null) {\r | |
111 | @include font-icon($ui-radio-glyph);\r | |
112 | color: $ui-radio-glyph-color;\r | |
113 | \r | |
114 | .#{$prefix}form-cb-checked & {\r | |
115 | @include font-icon($ui-radio-checked-glyph);\r | |
116 | }\r | |
117 | } @else {\r | |
118 | background: theme-background-image($ui-radio-background-image) no-repeat;\r | |
119 | \r | |
120 | .#{$prefix}form-cb-checked & {\r | |
121 | background-position: 0 (0 - $ui-checkbox-size);\r | |
122 | }\r | |
123 | }\r | |
124 | }\r | |
125 | \r | |
126 | .#{$prefix}form-checkbox-#{$ui} {\r | |
127 | @if $enable-font-icons and ($ui-checkbox-glyph != null) {\r | |
128 | @include font-icon($ui-checkbox-glyph);\r | |
129 | color: $ui-checkbox-glyph-color;\r | |
130 | \r | |
131 | .#{$prefix}form-cb-checked & {\r | |
132 | @include font-icon($ui-checkbox-checked-glyph);\r | |
133 | }\r | |
134 | } @else {\r | |
135 | background: theme-background-image($ui-checkbox-background-image) no-repeat;\r | |
136 | \r | |
137 | .#{$prefix}form-cb-checked & {\r | |
138 | background-position: 0 (0 - $ui-checkbox-size);\r | |
139 | }\r | |
140 | }\r | |
141 | }\r | |
142 | \r | |
143 | .#{$prefix}form-checkbox-focus {\r | |
144 | &.#{$prefix}form-radio-#{$ui} {\r | |
145 | @if $enable-font-icons and ($ui-radio-glyph != null) {\r | |
146 | color: $ui-radio-glyph-focus-color;\r | |
147 | } @else {\r | |
148 | background-position: (0 - $ui-checkbox-size) 0;\r | |
149 | \r | |
150 | .#{$prefix}form-cb-checked & {\r | |
151 | background-position: (0 - $ui-checkbox-size) (0 - $ui-checkbox-size);\r | |
152 | }\r | |
153 | }\r | |
154 | }\r | |
155 | \r | |
156 | &.#{$prefix}form-checkbox-#{$ui} {\r | |
157 | @if $enable-font-icons and ($ui-checkbox-glyph != null) {\r | |
158 | color: $ui-checkbox-glyph-focus-color;\r | |
159 | } @else {\r | |
160 | background-position: (0 - $ui-checkbox-size) 0;\r | |
161 | \r | |
162 | .#{$prefix}form-cb-checked & {\r | |
163 | background-position: (0 - $ui-checkbox-size) (0 - $ui-checkbox-size);\r | |
164 | }\r | |
165 | }\r | |
166 | }\r | |
167 | }\r | |
168 | \r | |
169 | .#{$prefix}form-cb-label-#{$ui} {\r | |
170 | margin-top: round(($ui-field-height - $ui-label-line-height) / 2);\r | |
171 | font: $ui-label-font-weight #{$ui-label-font-size}/#{$ui-label-line-height} $ui-label-font-family;\r | |
172 | \r | |
173 | &.#{$prefix}form-cb-label-before {\r | |
174 | padding-right: $ui-label-spacing + $ui-checkbox-size;\r | |
175 | \r | |
176 | @if $include-rtl {\r | |
177 | &.#{$prefix}rtl {\r | |
178 | padding-right: 0;\r | |
179 | padding-left: $ui-label-spacing + $ui-checkbox-size;\r | |
180 | }\r | |
181 | }\r | |
182 | }\r | |
183 | \r | |
184 | &.#{$prefix}form-cb-label-after {\r | |
185 | padding-left: $ui-label-spacing + $ui-checkbox-size;\r | |
186 | }\r | |
187 | \r | |
188 | @if $include-rtl {\r | |
189 | &.#{$prefix}rtl {\r | |
190 | padding-left: 0;\r | |
191 | padding-right: $ui-label-spacing + $ui-checkbox-size;\r | |
192 | }\r | |
193 | }\r | |
194 | }\r | |
195 | \r | |
196 | // Checkbox field or subclass inside cell - calculate top/bottom padding to keep row height correct\r | |
197 | @if $include-ext-grid-column-widget or $include-ext-grid-plugin-editing {\r | |
198 | .#{$prefix}checkbox-#{$ui}-cell > .#{$prefix}grid-cell-inner {\r | |
199 | padding-top: max(ceil(($grid-row-height - $ui-field-height) / 2), 0);\r | |
200 | padding-bottom: max(floor(($grid-row-height - $ui-field-height) / 2), 0);\r | |
201 | }\r | |
202 | }\r | |
203 | }\r | |
204 | \r |