File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
java/com/flowingcode/vaadin/addons/chipfield
resources/META-INF/frontend Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -306,6 +306,12 @@ public boolean isReadonly() {
306306 return this .isReadonly ();
307307 }
308308
309+ @ Override
310+ public void setReadOnly (boolean readOnly ) {
311+ super .setReadOnly (readOnly );
312+ getElement ().callJsFunction ("toggleReadonly" );
313+ }
314+
309315 /** @deprecated use {@link #setRequiredIndicatorVisible(boolean)} */
310316 @ Deprecated
311317 public void setRequired (boolean required ) {
Original file line number Diff line number Diff line change @@ -287,7 +287,7 @@ class PaperChipInputAutocomplete extends PolymerElement {
287287 [[item.name]]
288288 < paper-chip id ="paper-chip-[[item]]-[[index]] "
289289 label ="[[item]] "
290- closable$ ="[[closable]] "
290+ closable ="[[_isClosable( closable,readonly) ]] "
291291 on-chip-removed ="_removeChip ">
292292 </ paper-chip >
293293 </ template >
@@ -318,6 +318,7 @@ class PaperChipInputAutocomplete extends PolymerElement {
318318 this . _autoValidate = this . autoValidate ;
319319 this . _required = this . required ;
320320 this . _paperInputElement = this . $ . paperInput ;
321+ this . toggleReadonly ( ) ;
321322 }
322323
323324 _isEmpty ( item ) {
@@ -457,6 +458,18 @@ class PaperChipInputAutocomplete extends PolymerElement {
457458 } ) ) ;
458459 }
459460
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+
460473}
461474
462475window . customElements . define ( PaperChipInputAutocomplete . is , PaperChipInputAutocomplete ) ;
You can’t perform that action at this time.
0 commit comments