@@ -110,15 +110,15 @@ class ApiPropertyFormItem extends ValidatableMixin(LitElement) {
110
110
}
111
111
112
112
_enumTemplate ( ) {
113
- const { model, name, readOnly, value, outlined, legacy } = this ;
113
+ const { model, name, readOnly, disabled , value, outlined, legacy } = this ;
114
114
const values = model . schema . enum || [ ] ;
115
115
return html `
116
116
< anypoint-dropdown-menu
117
117
name ="${ name } "
118
118
?required ="${ model . required } "
119
119
autovalidate
120
120
data-type ="enum "
121
- ?disabled ="${ readOnly } "
121
+ ?disabled ="${ readOnly || disabled } "
122
122
?outlined ="${ outlined } "
123
123
?legacy ="${ legacy } ">
124
124
< label slot ="label "> ${ model . schema . inputLabel } </ label >
@@ -134,14 +134,14 @@ class ApiPropertyFormItem extends ValidatableMixin(LitElement) {
134
134
}
135
135
136
136
_booleanTemplate ( ) {
137
- const { model, name, readOnly, value, outlined, legacy } = this ;
137
+ const { model, name, readOnly, disabled , value, outlined, legacy } = this ;
138
138
return html `
139
139
< anypoint-dropdown-menu
140
140
name ="${ name } "
141
141
?required ="${ model . required } "
142
142
autovalidate
143
143
data-type ="boolean "
144
- ?disabled ="${ readOnly } "
144
+ ?disabled ="${ readOnly || disabled } "
145
145
?outlined ="${ outlined } "
146
146
?legacy ="${ legacy } ">
147
147
< label slot ="label "> ${ model . schema . inputLabel } </ label >
@@ -158,7 +158,7 @@ class ApiPropertyFormItem extends ValidatableMixin(LitElement) {
158
158
}
159
159
160
160
_inputTemplate ( ) {
161
- const { model, name, noLabelFloat, readOnly, value, outlined, legacy } = this ;
161
+ const { model, name, noLabelFloat, readOnly, disabled , value, outlined, legacy } = this ;
162
162
if ( ! model ) {
163
163
return ;
164
164
}
@@ -179,6 +179,7 @@ class ApiPropertyFormItem extends ValidatableMixin(LitElement) {
179
179
.placeholder ="${ model . schema . inputPlaceholder } "
180
180
?nolabelfloat ="${ noLabelFloat } "
181
181
?readonly ="${ readOnly } "
182
+ ?disabled ="${ disabled } "
182
183
?outlined ="${ outlined } "
183
184
?legacy ="${ legacy } "
184
185
data-type ="input "
@@ -188,7 +189,7 @@ class ApiPropertyFormItem extends ValidatableMixin(LitElement) {
188
189
}
189
190
190
191
_arrayTemplate ( ) {
191
- const { model, name, readOnly, _arrayValue, outlined, legacy } = this ;
192
+ const { model, name, readOnly, disabled , _arrayValue, outlined, legacy } = this ;
192
193
const values = _arrayValue || [ ] ;
193
194
const itemLabel = model . schema . inputLabel || 'Parameter value' ;
194
195
return html `
@@ -209,6 +210,7 @@ class ApiPropertyFormItem extends ValidatableMixin(LitElement) {
209
210
.minLength ="${ model . schema . minLength } "
210
211
nolabelfloat
211
212
?readonly ="${ readOnly } "
213
+ ?disabled ="${ disabled } "
212
214
?outlined ="${ outlined } "
213
215
?legacy ="${ legacy } "
214
216
data-type ="array "
@@ -223,15 +225,15 @@ class ApiPropertyFormItem extends ValidatableMixin(LitElement) {
223
225
?legacy ="${ legacy } "
224
226
@click ="${ this . _removeArrayValue } "
225
227
title ="Remove array value "
226
- ?disabled ="${ this . readOnly } ">
228
+ ?disabled ="${ this . readOnly || disabled } ">
227
229
< iron-icon icon ="arc:remove-circle-outline "> </ iron-icon >
228
230
</ anypoint-icon-button > ` : undefined }
229
231
</ div > ` ) }
230
232
< div class ="add-action ">
231
233
< anypoint-button
232
234
@click ="${ this . addEmptyArrayValue } "
233
235
title ="Add array velue button "
234
- ?disabled ="${ readOnly } "
236
+ ?disabled ="${ readOnly || disabled } "
235
237
?outlined ="${ outlined } "
236
238
?legacy ="${ legacy } ">
237
239
< iron-icon class ="action-icon " icon ="arc:add-circle-outline " alt ="Add array value icon "> </ iron-icon >
@@ -242,7 +244,7 @@ class ApiPropertyFormItem extends ValidatableMixin(LitElement) {
242
244
}
243
245
244
246
render ( ) {
245
- const { readOnly, _isEnum, _isBoolean, _isInput, _isArray, _renderNillable } = this ;
247
+ const { readOnly, disabled , _isEnum, _isBoolean, _isInput, _isArray, _renderNillable } = this ;
246
248
return html `
247
249
< div class ="content ">
248
250
${ _isEnum ? this . _enumTemplate ( ) : undefined }
@@ -251,7 +253,7 @@ class ApiPropertyFormItem extends ValidatableMixin(LitElement) {
251
253
${ _isArray ? this . _arrayTemplate ( ) : undefined }
252
254
253
255
${ _renderNillable ? html `< anypoint-checkbox
254
- ?disabled ="${ readOnly } "
256
+ ?disabled ="${ readOnly || disabled } "
255
257
class ="nil-option "
256
258
@checked-changed ="${ this . _nillableChanged } "> Nil</ anypoint-checkbox > ` : undefined }
257
259
</ div > ` ;
@@ -308,6 +310,10 @@ class ApiPropertyFormItem extends ValidatableMixin(LitElement) {
308
310
* When set the editor is in read only mode.
309
311
*/
310
312
readOnly : { type : Boolean } ,
313
+ /**
314
+ * When set the editor renders form controls disabled.
315
+ */
316
+ disabled : { type : Boolean } ,
311
317
// Computed value, renders nillable switch when needed.
312
318
_renderNillable : { type : Boolean }
313
319
} ;
0 commit comments