Added methods in open and fix problems
This commit is contained in:
25
src/components/create-element/create-elementTs.ts
Normal file
25
src/components/create-element/create-elementTs.ts
Normal 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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user