1fb726d48Sopenharmony_ci/*
2fb726d48Sopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd.
3fb726d48Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4fb726d48Sopenharmony_ci * you may not use this file except in compliance with the License.
5fb726d48Sopenharmony_ci * You may obtain a copy of the License at
6fb726d48Sopenharmony_ci *
7fb726d48Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8fb726d48Sopenharmony_ci *
9fb726d48Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10fb726d48Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11fb726d48Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12fb726d48Sopenharmony_ci * See the License for the specific language governing permissions and
13fb726d48Sopenharmony_ci * limitations under the License.
14fb726d48Sopenharmony_ci */
15fb726d48Sopenharmony_ci
16fb726d48Sopenharmony_ciimport { BaseElement, element } from '../BaseElement';
17fb726d48Sopenharmony_ciimport { LitSelectOption } from './LitSelectOption';
18fb726d48Sopenharmony_ciimport { selectHtmlStr, selectVHtmlStr } from './LitSelectHtml';
19fb726d48Sopenharmony_ci
20fb726d48Sopenharmony_ci@element('lit-select-v')
21fb726d48Sopenharmony_ciexport class LitSelectV extends BaseElement {
22fb726d48Sopenharmony_ci  showItems: Array<string> = [];
23fb726d48Sopenharmony_ci  itemValue: Array<string> = [];
24fb726d48Sopenharmony_ci  customItem: Array<string> = [];
25fb726d48Sopenharmony_ci  private focused: unknown;
26fb726d48Sopenharmony_ci  private selectVInputEl: unknown;
27fb726d48Sopenharmony_ci  private selectVSearchInputEl: unknown;
28fb726d48Sopenharmony_ci  private selectVIconEl: unknown;
29fb726d48Sopenharmony_ci  private selectVOptions: HTMLDivElement | undefined;
30fb726d48Sopenharmony_ci  private selectVBody: HTMLDivElement | undefined;
31fb726d48Sopenharmony_ci
32fb726d48Sopenharmony_ci  private valueStr: string = '';
33fb726d48Sopenharmony_ci  private currentvalueStr: string = '';
34fb726d48Sopenharmony_ci
35fb726d48Sopenharmony_ci  static get observedAttributes(): string[] {
36fb726d48Sopenharmony_ci    return ['value', 'default-value', 'placeholder', 'disabled', 'show-search', 'border', 'mode'];
37fb726d48Sopenharmony_ci  }
38fb726d48Sopenharmony_ci
39fb726d48Sopenharmony_ci  get value(): string {
40fb726d48Sopenharmony_ci    // @ts-ignore
41fb726d48Sopenharmony_ci    return this.selectVInputEl!.value || this.defaultValue;
42fb726d48Sopenharmony_ci  }
43fb726d48Sopenharmony_ci
44fb726d48Sopenharmony_ci  get rounded(): boolean {
45fb726d48Sopenharmony_ci    return this.hasAttribute('rounded');
46fb726d48Sopenharmony_ci  }
47fb726d48Sopenharmony_ci
48fb726d48Sopenharmony_ci  set rounded(selectVRounded: boolean) {
49fb726d48Sopenharmony_ci    if (selectVRounded) {
50fb726d48Sopenharmony_ci      this.setAttribute('rounded', '');
51fb726d48Sopenharmony_ci    } else {
52fb726d48Sopenharmony_ci      this.removeAttribute('rounded');
53fb726d48Sopenharmony_ci    }
54fb726d48Sopenharmony_ci  }
55fb726d48Sopenharmony_ci
56fb726d48Sopenharmony_ci  get placement(): string {
57fb726d48Sopenharmony_ci    return this.getAttribute('placement') || '';
58fb726d48Sopenharmony_ci  }
59fb726d48Sopenharmony_ci
60fb726d48Sopenharmony_ci  set placement(selectVPlacement: string) {
61fb726d48Sopenharmony_ci    if (selectVPlacement) {
62fb726d48Sopenharmony_ci      this.setAttribute('placement', selectVPlacement);
63fb726d48Sopenharmony_ci    } else {
64fb726d48Sopenharmony_ci      this.removeAttribute('placement');
65fb726d48Sopenharmony_ci    }
66fb726d48Sopenharmony_ci  }
67fb726d48Sopenharmony_ci
68fb726d48Sopenharmony_ci  get border(): string {
69fb726d48Sopenharmony_ci    return this.getAttribute('border') || 'true';
70fb726d48Sopenharmony_ci  }
71fb726d48Sopenharmony_ci
72fb726d48Sopenharmony_ci  set border(selectVBorder) {
73fb726d48Sopenharmony_ci    if (selectVBorder) {
74fb726d48Sopenharmony_ci      this.setAttribute('border', 'true');
75fb726d48Sopenharmony_ci    } else {
76fb726d48Sopenharmony_ci      this.setAttribute('border', 'false');
77fb726d48Sopenharmony_ci    }
78fb726d48Sopenharmony_ci  }
79fb726d48Sopenharmony_ci
80fb726d48Sopenharmony_ci  get defaultPlaceholder(): string {
81fb726d48Sopenharmony_ci    return this.getAttribute('placeholder') || '';
82fb726d48Sopenharmony_ci  }
83fb726d48Sopenharmony_ci
84fb726d48Sopenharmony_ci  get defaultValue(): string {
85fb726d48Sopenharmony_ci    return this.getAttribute('default-value') || '';
86fb726d48Sopenharmony_ci  }
87fb726d48Sopenharmony_ci
88fb726d48Sopenharmony_ci  set defaultValue(selectVDefaultValue) {
89fb726d48Sopenharmony_ci    this.setAttribute('default-value', selectVDefaultValue);
90fb726d48Sopenharmony_ci  }
91fb726d48Sopenharmony_ci
92fb726d48Sopenharmony_ci  get placeholder(): string {
93fb726d48Sopenharmony_ci    return this.getAttribute('placeholder') || this.defaultPlaceholder;
94fb726d48Sopenharmony_ci  }
95fb726d48Sopenharmony_ci
96fb726d48Sopenharmony_ci  set placeholder(selectVPlaceholder) {
97fb726d48Sopenharmony_ci    this.setAttribute('placeholder', selectVPlaceholder);
98fb726d48Sopenharmony_ci  }
99fb726d48Sopenharmony_ci
100fb726d48Sopenharmony_ci  set all(isAll: boolean) {
101fb726d48Sopenharmony_ci    if (isAll) {
102fb726d48Sopenharmony_ci      this.setAttribute('is-all', '');
103fb726d48Sopenharmony_ci    } else {
104fb726d48Sopenharmony_ci      this.removeAttribute('is-all');
105fb726d48Sopenharmony_ci    }
106fb726d48Sopenharmony_ci  }
107fb726d48Sopenharmony_ci
108fb726d48Sopenharmony_ci  get all(): boolean {
109fb726d48Sopenharmony_ci    return this.hasAttribute('is-all');
110fb726d48Sopenharmony_ci  }
111fb726d48Sopenharmony_ci
112fb726d48Sopenharmony_ci  dataSource(selectVData: Array<string>, valueStr: string, isSingle?: boolean): void {
113fb726d48Sopenharmony_ci    this.selectVOptions!.innerHTML = '';
114fb726d48Sopenharmony_ci    if (selectVData.length > 0) {
115fb726d48Sopenharmony_ci      this.selectVBody!.style.display = 'block';
116fb726d48Sopenharmony_ci      this.valueStr = valueStr;
117fb726d48Sopenharmony_ci      this.itemValue = selectVData;
118fb726d48Sopenharmony_ci      if (valueStr !== '') {
119fb726d48Sopenharmony_ci        let option = document.createElement('lit-select-option');
120fb726d48Sopenharmony_ci        if (this.all) {
121fb726d48Sopenharmony_ci          option.setAttribute('selected', '');
122fb726d48Sopenharmony_ci          this.showItems = selectVData;
123fb726d48Sopenharmony_ci        }
124fb726d48Sopenharmony_ci        option.setAttribute('value', valueStr);
125fb726d48Sopenharmony_ci        option.textContent = valueStr;
126fb726d48Sopenharmony_ci        this.selectVOptions!.appendChild(option);
127fb726d48Sopenharmony_ci        this.initDataItem(selectVData);
128fb726d48Sopenharmony_ci        if (isSingle) {
129fb726d48Sopenharmony_ci          this.initSingleCustomOptions();
130fb726d48Sopenharmony_ci        } else {
131fb726d48Sopenharmony_ci          this.initCustomOptions();
132fb726d48Sopenharmony_ci        }
133fb726d48Sopenharmony_ci      } else {
134fb726d48Sopenharmony_ci        this.initDataItem(selectVData);
135fb726d48Sopenharmony_ci        if (isSingle) {
136fb726d48Sopenharmony_ci          this.initSingleCustomOptions();
137fb726d48Sopenharmony_ci        } else {
138fb726d48Sopenharmony_ci          this.initOptions();
139fb726d48Sopenharmony_ci        }
140fb726d48Sopenharmony_ci      }
141fb726d48Sopenharmony_ci    } else {
142fb726d48Sopenharmony_ci      this.selectVBody!.style.display = 'none';
143fb726d48Sopenharmony_ci    }
144fb726d48Sopenharmony_ci    if (this.title === 'Event List') {
145fb726d48Sopenharmony_ci      let inputElement = this.shadowRoot?.querySelector('input') as HTMLInputElement;
146fb726d48Sopenharmony_ci      inputElement.readOnly = false;
147fb726d48Sopenharmony_ci    }
148fb726d48Sopenharmony_ci  }
149fb726d48Sopenharmony_ci
150fb726d48Sopenharmony_ci  initDataItem(selectVDataItem: Array<string>): void {
151fb726d48Sopenharmony_ci    selectVDataItem.forEach((item) => {
152fb726d48Sopenharmony_ci      let selectVOption = document.createElement('lit-select-option');
153fb726d48Sopenharmony_ci      if (this.showItems.indexOf(item) > -1 || this.all) {
154fb726d48Sopenharmony_ci        selectVOption.setAttribute('selected', '');
155fb726d48Sopenharmony_ci      }
156fb726d48Sopenharmony_ci      selectVOption.className = 'option';
157fb726d48Sopenharmony_ci      selectVOption.setAttribute('value', item);
158fb726d48Sopenharmony_ci      selectVOption.textContent = item;
159fb726d48Sopenharmony_ci      this.selectVOptions!.appendChild(selectVOption);
160fb726d48Sopenharmony_ci    });
161fb726d48Sopenharmony_ci  }
162fb726d48Sopenharmony_ci
163fb726d48Sopenharmony_ci  initElements(): void {
164fb726d48Sopenharmony_ci    this.tabIndex = 0;
165fb726d48Sopenharmony_ci    this.focused = false;
166fb726d48Sopenharmony_ci    this.selectVInputEl = this.shadowRoot!.querySelector('#select-input') as HTMLInputElement;
167fb726d48Sopenharmony_ci    this.selectVSearchInputEl = this.shadowRoot!.querySelector('#search-input') as HTMLInputElement;
168fb726d48Sopenharmony_ci    this.selectVBody = this.shadowRoot!.querySelector('.body') as HTMLDivElement;
169fb726d48Sopenharmony_ci    this.selectVOptions = this.shadowRoot!.querySelector('.body-opt') as HTMLDivElement;
170fb726d48Sopenharmony_ci    this.selectVIconEl = this.shadowRoot!.querySelector('.icon'); // @ts-ignore
171fb726d48Sopenharmony_ci    this.selectVInputEl?.addEventListener('keyup', (e) => {
172fb726d48Sopenharmony_ci      if (e.code === 'Enter' || e.code === 'NumpadEnter') {// @ts-ignore
173fb726d48Sopenharmony_ci        this.selectVInputEl.blur();
174fb726d48Sopenharmony_ci      }
175fb726d48Sopenharmony_ci    });// @ts-ignore
176fb726d48Sopenharmony_ci    this.selectVInputEl!.oninput = (ev: InputEvent): void => {
177fb726d48Sopenharmony_ci      // @ts-ignore
178fb726d48Sopenharmony_ci      if (this.selectVInputEl!.value === '00') {
179fb726d48Sopenharmony_ci        // @ts-ignore
180fb726d48Sopenharmony_ci        this.selectVInputEl!.value = '0';
181fb726d48Sopenharmony_ci        ev.preventDefault();
182fb726d48Sopenharmony_ci      } // @ts-ignore
183fb726d48Sopenharmony_ci      if (this.selectVInputEl!.value === '') {
184fb726d48Sopenharmony_ci        this.shadowRoot?.querySelectorAll('lit-select-option').forEach((it) => {
185fb726d48Sopenharmony_ci          it.removeAttribute('selected');
186fb726d48Sopenharmony_ci          this.showItems = [];
187fb726d48Sopenharmony_ci          this.currentvalueStr = '';
188fb726d48Sopenharmony_ci        });
189fb726d48Sopenharmony_ci      }
190fb726d48Sopenharmony_ci    }; // @ts-ignore
191fb726d48Sopenharmony_ci    this.selectVSearchInputEl!.onkeydown = (ev: KeyboardEvent): void => {
192fb726d48Sopenharmony_ci      // @ts-ignore
193fb726d48Sopenharmony_ci      if (ev.key === '0' && ev.target.value.length === 1 && ev.target.value === '0') {
194fb726d48Sopenharmony_ci        ev.preventDefault();
195fb726d48Sopenharmony_ci      }
196fb726d48Sopenharmony_ci    };
197fb726d48Sopenharmony_ci    this.onclick = (ev: unknown): void => {
198fb726d48Sopenharmony_ci      if (this.focused === false) {
199fb726d48Sopenharmony_ci        this.focused = true;
200fb726d48Sopenharmony_ci      } else {
201fb726d48Sopenharmony_ci        this.focused = false;
202fb726d48Sopenharmony_ci      }
203fb726d48Sopenharmony_ci    }; // @ts-ignore
204fb726d48Sopenharmony_ci    this.selectVSearchInputEl?.addEventListener('keyup', () => {
205fb726d48Sopenharmony_ci      let options = [...this.shadowRoot!.querySelectorAll<LitSelectOption>('.option')];
206fb726d48Sopenharmony_ci      options.filter((a: LitSelectOption) => {
207fb726d48Sopenharmony_ci        // @ts-ignore
208fb726d48Sopenharmony_ci        if (a.textContent!.indexOf(this.selectVSearchInputEl!.value) <= -1) {
209fb726d48Sopenharmony_ci          a.style.display = 'none';
210fb726d48Sopenharmony_ci        } else {
211fb726d48Sopenharmony_ci          a.style.display = 'flex';
212fb726d48Sopenharmony_ci        }
213fb726d48Sopenharmony_ci      });
214fb726d48Sopenharmony_ci    });
215fb726d48Sopenharmony_ci    this.setEvent();
216fb726d48Sopenharmony_ci  }
217fb726d48Sopenharmony_ci
218fb726d48Sopenharmony_ci  setEvent(): void {
219fb726d48Sopenharmony_ci    this.onmouseout = this.onblur = (ev): void => {
220fb726d48Sopenharmony_ci      this.focused = false;
221fb726d48Sopenharmony_ci    }; // @ts-ignore
222fb726d48Sopenharmony_ci    this.selectVInputEl.onfocus = (ev: unknown): void => {
223fb726d48Sopenharmony_ci      if (this.hasAttribute('disabled')) {
224fb726d48Sopenharmony_ci        return;
225fb726d48Sopenharmony_ci      }
226fb726d48Sopenharmony_ci    }; // @ts-ignore
227fb726d48Sopenharmony_ci    this.selectVInputEl.onblur = (ev: unknown): void => {
228fb726d48Sopenharmony_ci      if (this.hasAttribute('disabled')) {
229fb726d48Sopenharmony_ci        return;
230fb726d48Sopenharmony_ci      }
231fb726d48Sopenharmony_ci    };
232fb726d48Sopenharmony_ci  }
233fb726d48Sopenharmony_ci
234fb726d48Sopenharmony_ci  initHtml(): string {
235fb726d48Sopenharmony_ci    return `
236fb726d48Sopenharmony_ci        ${selectVHtmlStr}
237fb726d48Sopenharmony_ci        <div class="root noSelect" tabindex="0" hidefocus="true">
238fb726d48Sopenharmony_ci            <input id="select-input" placeholder="${this.placeholder}" tabindex="0" readonly="readonly">
239fb726d48Sopenharmony_ci            <lit-icon class="icon" name='down' color="#c3c3c3"></lit-icon>
240fb726d48Sopenharmony_ci        </div>
241fb726d48Sopenharmony_ci        <div class="body">
242fb726d48Sopenharmony_ci            <div class="body-select">
243fb726d48Sopenharmony_ci             <input id="search-input" placeholder="Search">
244fb726d48Sopenharmony_ci           </div>
245fb726d48Sopenharmony_ci            <div class="body-opt">
246fb726d48Sopenharmony_ci               <slot></slot>
247fb726d48Sopenharmony_ci               <slot name="footer"></slot>
248fb726d48Sopenharmony_ci            </div>
249fb726d48Sopenharmony_ci        </div>     
250fb726d48Sopenharmony_ci        `;
251fb726d48Sopenharmony_ci  }
252fb726d48Sopenharmony_ci
253fb726d48Sopenharmony_ci  connectedCallback(): void { }
254fb726d48Sopenharmony_ci
255fb726d48Sopenharmony_ci  initCustomOptions(): void {
256fb726d48Sopenharmony_ci    let querySelector = this.shadowRoot?.querySelector(
257fb726d48Sopenharmony_ci      `lit-select-option[value="${this.valueStr}"]`
258fb726d48Sopenharmony_ci    ) as LitSelectOption;
259fb726d48Sopenharmony_ci    this.shadowRoot?.querySelectorAll('lit-select-option').forEach((a) => {
260fb726d48Sopenharmony_ci      a.setAttribute('check', '');
261fb726d48Sopenharmony_ci      a.addEventListener('onSelected', (e: unknown) => {
262fb726d48Sopenharmony_ci        if (a.hasAttribute('selected')) {
263fb726d48Sopenharmony_ci          let number = this.showItems.indexOf(a.textContent!);
264fb726d48Sopenharmony_ci          if (number > -1) {
265fb726d48Sopenharmony_ci            this.showItems!.splice(number, 1); // @ts-ignore
266fb726d48Sopenharmony_ci            this.selectVInputEl!.value = this.showItems;
267fb726d48Sopenharmony_ci          }
268fb726d48Sopenharmony_ci          this.all = false;
269fb726d48Sopenharmony_ci          querySelector.removeAttribute('selected');
270fb726d48Sopenharmony_ci          a.removeAttribute('selected');
271fb726d48Sopenharmony_ci          return;
272fb726d48Sopenharmony_ci        } else {
273fb726d48Sopenharmony_ci          let index = this.itemValue.indexOf(a.textContent!);
274fb726d48Sopenharmony_ci          let value = this.showItems.indexOf(a.textContent!);
275fb726d48Sopenharmony_ci          if (index > -1 && value === -1) {
276fb726d48Sopenharmony_ci            this.showItems.push(a.textContent!); // @ts-ignore
277fb726d48Sopenharmony_ci            this.selectVInputEl!.value = this.showItems;
278fb726d48Sopenharmony_ci          }
279fb726d48Sopenharmony_ci          if (this.showItems.length >= this.itemValue.length) {
280fb726d48Sopenharmony_ci            querySelector.setAttribute('selected', '');
281fb726d48Sopenharmony_ci            this.all = true;
282fb726d48Sopenharmony_ci          } else {
283fb726d48Sopenharmony_ci            querySelector.removeAttribute('selected');
284fb726d48Sopenharmony_ci            this.all = false;
285fb726d48Sopenharmony_ci          }
286fb726d48Sopenharmony_ci          a.setAttribute('selected', '');
287fb726d48Sopenharmony_ci        }
288fb726d48Sopenharmony_ci      });
289fb726d48Sopenharmony_ci    });
290fb726d48Sopenharmony_ci    this.selectAll(querySelector);
291fb726d48Sopenharmony_ci  }
292fb726d48Sopenharmony_ci
293fb726d48Sopenharmony_ci  initSingleCustomOptions(): void {
294fb726d48Sopenharmony_ci    let selectedOption = this.shadowRoot?.querySelector(
295fb726d48Sopenharmony_ci      `lit-select-option[value="${this.currentvalueStr}"]`
296fb726d48Sopenharmony_ci    ) as LitSelectOption | null;
297fb726d48Sopenharmony_ci    if (selectedOption) {
298fb726d48Sopenharmony_ci      selectedOption.setAttribute('selected', '');
299fb726d48Sopenharmony_ci    }
300fb726d48Sopenharmony_ci    this.shadowRoot?.querySelectorAll('lit-select-option').forEach((option) => {
301fb726d48Sopenharmony_ci      option.addEventListener('onSelected', () => {
302fb726d48Sopenharmony_ci        this.shadowRoot?.querySelectorAll('lit-select-option').forEach((o) => {
303fb726d48Sopenharmony_ci          o.removeAttribute('selected');
304fb726d48Sopenharmony_ci        });
305fb726d48Sopenharmony_ci        option.setAttribute('selected', '');
306fb726d48Sopenharmony_ci        //@ts-ignore
307fb726d48Sopenharmony_ci        this.selectVInputEl!.value = option.textContent!;
308fb726d48Sopenharmony_ci        this.currentvalueStr = option.textContent!;
309fb726d48Sopenharmony_ci      });
310fb726d48Sopenharmony_ci    });
311fb726d48Sopenharmony_ci  }
312fb726d48Sopenharmony_ci
313fb726d48Sopenharmony_ci  initOptions(): void {
314fb726d48Sopenharmony_ci    this.shadowRoot?.querySelectorAll('lit-select-option').forEach((a) => {
315fb726d48Sopenharmony_ci      a.setAttribute('check', '');
316fb726d48Sopenharmony_ci      a.addEventListener('onSelected', (e: unknown) => {
317fb726d48Sopenharmony_ci        if (a.hasAttribute('selected')) {
318fb726d48Sopenharmony_ci          let number = this.showItems.indexOf(a.textContent!);
319fb726d48Sopenharmony_ci          if (number > -1) {
320fb726d48Sopenharmony_ci            this.showItems.splice(number, 1);
321fb726d48Sopenharmony_ci          }
322fb726d48Sopenharmony_ci          a.removeAttribute('selected');
323fb726d48Sopenharmony_ci        } else {
324fb726d48Sopenharmony_ci          let index = this.itemValue.indexOf(a.textContent!);
325fb726d48Sopenharmony_ci          if (index > -1) {
326fb726d48Sopenharmony_ci            this.showItems.push(a.textContent!);
327fb726d48Sopenharmony_ci          }
328fb726d48Sopenharmony_ci          a.setAttribute('selected', '');
329fb726d48Sopenharmony_ci        } // @ts-ignore
330fb726d48Sopenharmony_ci        let items = this.selectVInputEl!.value.split(',');
331fb726d48Sopenharmony_ci        this.customItem = [];
332fb726d48Sopenharmony_ci        items.forEach((item: string) => {
333fb726d48Sopenharmony_ci          if (item.trim() !== '') {
334fb726d48Sopenharmony_ci            let indexItem = this.itemValue.indexOf(item.trim());
335fb726d48Sopenharmony_ci            if (indexItem === -1) {
336fb726d48Sopenharmony_ci              this.customItem.push(item.trim());
337fb726d48Sopenharmony_ci            }
338fb726d48Sopenharmony_ci          }
339fb726d48Sopenharmony_ci        });
340fb726d48Sopenharmony_ci        if (this.customItem.length > 0) {
341fb726d48Sopenharmony_ci          // @ts-ignore
342fb726d48Sopenharmony_ci          this.selectVInputEl.value = this.customItem.concat(this.showItems);
343fb726d48Sopenharmony_ci        } else {
344fb726d48Sopenharmony_ci          // @ts-ignore
345fb726d48Sopenharmony_ci          this.selectVInputEl.value = this.showItems;
346fb726d48Sopenharmony_ci        }
347fb726d48Sopenharmony_ci      });
348fb726d48Sopenharmony_ci    });
349fb726d48Sopenharmony_ci  }
350fb726d48Sopenharmony_ci
351fb726d48Sopenharmony_ci  selectAll(querySelector: LitSelectOption): void {
352fb726d48Sopenharmony_ci    querySelector?.addEventListener('click', (ev) => {
353fb726d48Sopenharmony_ci      if (querySelector.hasAttribute('selected')) {
354fb726d48Sopenharmony_ci        this.shadowRoot?.querySelectorAll('lit-select-option').forEach((a) => {
355fb726d48Sopenharmony_ci          a.setAttribute('selected', '');
356fb726d48Sopenharmony_ci          this.all = true;
357fb726d48Sopenharmony_ci        });
358fb726d48Sopenharmony_ci        this.itemValue.forEach((i) => {
359fb726d48Sopenharmony_ci          this.showItems.push(i);
360fb726d48Sopenharmony_ci        }); // @ts-ignore
361fb726d48Sopenharmony_ci        this.selectVInputEl.value = this.itemValue;
362fb726d48Sopenharmony_ci      } else {
363fb726d48Sopenharmony_ci        this.shadowRoot?.querySelectorAll('lit-select-option').forEach((i) => {
364fb726d48Sopenharmony_ci          i.removeAttribute('selected');
365fb726d48Sopenharmony_ci          this.all = false;
366fb726d48Sopenharmony_ci        });
367fb726d48Sopenharmony_ci        this.showItems = []; // @ts-ignore
368fb726d48Sopenharmony_ci        this.selectVInputEl.value = '';
369fb726d48Sopenharmony_ci      }
370fb726d48Sopenharmony_ci    });
371fb726d48Sopenharmony_ci  }
372fb726d48Sopenharmony_ci
373fb726d48Sopenharmony_ci  attributeChangedCallback(name: unknown, oldValue: unknown, newValue: unknown): void { }
374fb726d48Sopenharmony_ci}
375