diff --git a/example/indexTs.ts b/example/indexTs.ts index 73a18a7..22b9db4 100644 --- a/example/indexTs.ts +++ b/example/indexTs.ts @@ -1,17 +1,17 @@ -import { SGSelect } from "../src/cg-selectTS"; +import { CGSelect } from '../src/cg-selectTS'; -const dropdn = new SGSelect({ - selector: '.cg-dropdown_one', - placeholder: 'Выберите авто', - items: [ - 'BMW', - { - id: '213sade', - title: 'Opel', - value: 'ds', - }, - 'Mersedes', - 'MAN', - 'Ferari', - ] -}) \ No newline at end of file +const dropdn = new CGSelect({ + selector: '.cg-dropdown_one', + placeholder: 'Выберите авто', + items: [ + 'BMW', + { + id: '213sade', + title: 'Opel', + value: 'ds', + }, + 'Mersedes', + 'MAN', + 'Ferari', + ], +}); diff --git a/src/cg-selectTS.ts b/src/cg-selectTS.ts index fd02f20..f29a439 100644 --- a/src/cg-selectTS.ts +++ b/src/cg-selectTS.ts @@ -4,11 +4,11 @@ import { } from './components/create-element/create-elementTs'; import { IDataItem } from './components/utils/urils.interface'; import { createSelected, getFormatItem } from './components/utils/utilsTs'; -import { ISgSelect } from './interfaces/cg-select.interface'; +import { ICgSelect } from './interfaces/cg-select.interface'; import { IItems } from './interfaces/items.interface'; import './main.scss'; -export class SGSelect implements ISgSelect { +export class CGSelect implements ICgSelect { selector: string; selected?: string; placeholder?: string; @@ -28,7 +28,7 @@ export class SGSelect implements ISgSelect { private element: Element | null; private list: Element | null | undefined; - private options: ISgSelect; + private options: ICgSelect; private randomId: string; private caret: Element | null | undefined; private category: string; @@ -36,7 +36,7 @@ export class SGSelect implements ISgSelect { private itemsSelect: IItems[] | string[] | any; private indexes: number[] = []; - constructor(setting: ISgSelect) { + constructor(setting: ICgSelect) { this.init(setting); this.render(); this.closeSelectClick(); @@ -69,7 +69,7 @@ export class SGSelect implements ISgSelect { multiselectTag: true, } */ - private init(setting: ISgSelect): void { + private init(setting: ICgSelect): void { const { items, multiselect, url, selector } = setting; this.options = setting; @@ -240,7 +240,7 @@ export class SGSelect implements ISgSelect { * Приватный метод экземпляра класса DropDown * @protected * @description Закрывает список по клику вне элемента - * @method #closeSelectClick + * @method closeSelectClick */ private closeSelectClick() { const dropdown = document.querySelector(`${this.options.selector}`); diff --git a/src/interfaces/cg-select.interface.ts b/src/interfaces/cg-select.interface.ts index fd3190c..fe0d651 100644 --- a/src/interfaces/cg-select.interface.ts +++ b/src/interfaces/cg-select.interface.ts @@ -1,20 +1,20 @@ -import { IItems } from "./items.interface"; +import { IItems } from './items.interface'; -export interface ISgSelect { - selector: string; - selected?: string; - placeholder?: string; - items?: IItems[]| string[] | any; - darkTheme?: boolean; - searchMode?: boolean; - closeOnSelect?: boolean; - nativeSelectMode?: boolean; - listDisplayMode?: boolean; - language?: string; - lable?:string; - styles?: object; - event?: string; - url?: string; - multiselect?: boolean; - multiselectTag?: boolean; -} \ No newline at end of file +export interface ICgSelect { + selector: string; + selected?: string; + placeholder?: string; + items?: IItems[] | string[] | any; + darkTheme?: boolean; + searchMode?: boolean; + closeOnSelect?: boolean; + nativeSelectMode?: boolean; + listDisplayMode?: boolean; + language?: string; + lable?: string; + styles?: object; + event?: string; + url?: string; + multiselect?: boolean; + multiselectTag?: boolean; +}