@vaadin-component-factory/vcf-autocomplete 24.1.4 → 24.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin-component-factory/vcf-autocomplete",
3
- "version": "24.1.4",
3
+ "version": "24.1.5",
4
4
  "type": "module",
5
5
  "description": "Web Component with a text input that provides a panel of suggested options.",
6
6
  "author": "Vaadin Ltd",
@@ -46,56 +46,56 @@ import './vcf-autocomplete-overlay';
46
46
  registerStyles(
47
47
  'vaadin-item',
48
48
  css`
49
- :host(.vcf-autocomplete-no-checkmark) [part="checkmark"] {
50
- visibility: hidden;
51
- }
52
- `
49
+ :host(.vcf-autocomplete-no-checkmark) [part="checkmark"] {
50
+ visibility: hidden;
51
+ }
52
+ `
53
53
  );
54
54
  class VcfAutocomplete extends ElementMixin(ThemableMixin(PolylitMixin(LitElement))) {
55
55
  render() {
56
56
  return html`
57
- <style>
58
- :host {
59
- display: inline-block;
60
- }
61
-
62
- :host([opened]) {
63
- pointer-events: auto;
64
- }
65
- </style>
66
-
67
- <vaadin-text-field id="textField" @focus="${this._textFieldFocused}" .label="${this.label}" .placeholder="${this.placeholder}" theme="${this._theme}" value="${this.value}" ?readonly="${this.readonly}">
68
- ${this._hasValue(this.value) ? html`
69
- <vaadin-button part="clear" theme="icon tertiary small" aria-label="Add new item" slot="suffix" @click="${this.clear}">
70
- <vaadin-icon icon="lumo:cross"> </vaadin-icon>
71
- </vaadin-button>
72
- ` : ''}
73
- </vaadin-text-field>
74
-
75
- <vcf-autocomplete-overlay .opened="${this.opened}" theme="${this._theme}">
76
- <vaadin-list-box part="options-container" theme="${this._theme}">
77
- ${!this.loading ? html`
78
- ${map(this._limitedOptions, (option) => html`
79
- <vaadin-item @click="${this._optionClicked}" part="option" theme="${this._theme}" class="vcf-autocomplete-no-checkmark">
80
- ${this._getSuggestedStart(this.value, option)} <span part="bold" style="font-weight: 600;">${this._getInputtedPart(this.value, option)}</span>${this._getSuggestedEnd(this.value, option)}
81
- </vaadin-item>
82
- `)}
83
- ` : ''}
84
-
85
- ${this._noResultsShown(this.options, this.loading) ? html`
86
- <vaadin-item disabled part="option">
87
- <div part="no-results">No results</div>
88
- </vaadin-item>
89
- ` : ''}
90
-
91
- ${this.loading ? html`
92
- <vaadin-item disabled part="option">
93
- <div part="loading-indicator">Loading...</div>
94
- </vaadin-item>
95
- ` : ''}
96
- </vaadin-list-box>
97
- </vcf-autocomplete-overlay>
98
- `;
57
+ <style>
58
+ :host {
59
+ display: inline-block;
60
+ }
61
+
62
+ :host([opened]) {
63
+ pointer-events: auto;
64
+ }
65
+ </style>
66
+
67
+ <vaadin-text-field id="textField" @focus="${this._textFieldFocused}" .label="${this.label}" .placeholder="${this.placeholder}" theme="${this._theme}" value="${this.value}" ?readonly="${this.readonly}" ?disabled="${!this.enabled}">
68
+ ${this._hasValue(this.value) && !this.readonly && this.enabled ? html`
69
+ <vaadin-button part="clear" theme="icon tertiary small" aria-label="Add new item" slot="suffix" @click="${this.clear}">
70
+ <vaadin-icon icon="lumo:cross"> </vaadin-icon>
71
+ </vaadin-button>
72
+ ` : ''}
73
+ </vaadin-text-field>
74
+
75
+ <vcf-autocomplete-overlay .opened="${this.opened}" theme="${this._theme}">
76
+ <vaadin-list-box part="options-container" theme="${this._theme}">
77
+ ${!this.loading ? html`
78
+ ${map(this._limitedOptions, (option) => html`
79
+ <vaadin-item @click="${this._optionClicked}" part="option" theme="${this._theme}" class="vcf-autocomplete-no-checkmark">
80
+ ${this._getSuggestedStart(this.value, option)} <span part="bold" style="font-weight: 600;">${this._getInputtedPart(this.value, option)}</span>${this._getSuggestedEnd(this.value, option)}
81
+ </vaadin-item>
82
+ `)}
83
+ ` : ''}
84
+
85
+ ${this._noResultsShown(this.options, this.loading) ? html`
86
+ <vaadin-item disabled part="option">
87
+ <div part="no-results">No results</div>
88
+ </vaadin-item>
89
+ ` : ''}
90
+
91
+ ${this.loading ? html`
92
+ <vaadin-item disabled part="option">
93
+ <div part="loading-indicator">Loading...</div>
94
+ </vaadin-item>
95
+ ` : ''}
96
+ </vaadin-list-box>
97
+ </vcf-autocomplete-overlay>
98
+ `;
99
99
  }
100
100
 
101
101
  static get is() {
@@ -170,6 +170,12 @@ class VcfAutocomplete extends ElementMixin(ThemableMixin(PolylitMixin(LitElement
170
170
  reflectToAttribute: true
171
171
  },
172
172
 
173
+ enabled: {
174
+ type: Boolean,
175
+ value: true,
176
+ reflectToAttribute: true
177
+ },
178
+
173
179
  _overlayElement: Object,
174
180
  _optionsContainer: Object,
175
181
  _selectedOption: {