Added methods in open and fix problems

This commit is contained in:
MaxOvs
2023-01-06 13:40:18 +03:00
parent 55c4bfaa7c
commit 2f64f9f3a6
7 changed files with 185 additions and 24 deletions

View File

@ -0,0 +1,25 @@
/**
* Метод который создает нативный селект
* @returns {HTMLSelectElement} Возвращает созданный нативный селект
*/
export function createNativeSelect(): HTMLSelectElement {
const nativeSelect = document.createElement('select');
nativeSelect.setAttribute('name', 'dataSelect');
nativeSelect.classList.add('nativeSelect');
return nativeSelect;
}
/**
* Метод который создает Options для нативного селекта
* @returns {HTMLOptionElement} Возвращает созданные Options нативного селекта
*/
export function createNativeSelectOption(): HTMLOptionElement {
const nativeOption = document.createElement('option');
nativeOption.classList.add('nativeSelect__nativeOption');
return nativeOption;
}

View File

@ -1,5 +1,7 @@
import { IItems } from "../../interfaces/items.interface";
export interface IDataItem{
category?: string;
categoryItems?: string;
ItemValue: object | string | number;
ItemValue: string | IItems | number;
}

View File

@ -8,7 +8,7 @@ import { IDataItem } from './urils.interface';
* @returns {IDataItem | IItems} возвращает сформированный объект
*/
export function getFormatItem(dataItem:IDataItem , index: number):IDataItem | IItems {
export function getFormatItem(dataItem:any , index: number) : IItems {
const random = Math.random().toString(36).substring(2, 10);
let item: IItems;
@ -20,6 +20,7 @@ export function getFormatItem(dataItem:IDataItem , index: number):IDataItem | II
title: dataItem,
value: index
}
return item;
}
}