File tree 2 files changed +20
-1
lines changed
java/com/flowingcode/vaadin/addons/chipfield
resources/META-INF/frontend
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -306,6 +306,12 @@ public boolean isReadonly() {
306
306
return this .isReadonly ();
307
307
}
308
308
309
+ @ Override
310
+ public void setReadOnly (boolean readOnly ) {
311
+ super .setReadOnly (readOnly );
312
+ getElement ().callJsFunction ("toggleReadonly" );
313
+ }
314
+
309
315
/** @deprecated use {@link #setRequiredIndicatorVisible(boolean)} */
310
316
@ Deprecated
311
317
public void setRequired (boolean required ) {
Original file line number Diff line number Diff line change @@ -287,7 +287,7 @@ class PaperChipInputAutocomplete extends PolymerElement {
287
287
[[item.name]]
288
288
< paper-chip id ="paper-chip-[[item]]-[[index]] "
289
289
label ="[[item]] "
290
- closable$ ="[[closable]] "
290
+ closable ="[[_isClosable( closable,readonly) ]] "
291
291
on-chip-removed ="_removeChip ">
292
292
</ paper-chip >
293
293
</ template >
@@ -318,6 +318,7 @@ class PaperChipInputAutocomplete extends PolymerElement {
318
318
this . _autoValidate = this . autoValidate ;
319
319
this . _required = this . required ;
320
320
this . _paperInputElement = this . $ . paperInput ;
321
+ this . toggleReadonly ( ) ;
321
322
}
322
323
323
324
_isEmpty ( item ) {
@@ -457,6 +458,18 @@ class PaperChipInputAutocomplete extends PolymerElement {
457
458
} ) ) ;
458
459
}
459
460
461
+ _isClosable ( closable , readonly ) {
462
+ return closable && ! readonly ;
463
+ }
464
+
465
+ toggleReadonly ( ) {
466
+ if ( this . readonly ) {
467
+ this . $ . paperInput . style . pointerEvents = "none" ;
468
+ } else {
469
+ this . $ . paperInput . style . removeProperty ( "pointer-events" ) ;
470
+ }
471
+ }
472
+
460
473
}
461
474
462
475
window . customElements . define ( PaperChipInputAutocomplete . is , PaperChipInputAutocomplete ) ;
You can’t perform that action at this time.
0 commit comments