Fix naming

This commit is contained in:
MaxOvs 2023-01-06 14:57:14 +03:00
parent f3f6d754df
commit ef832c60ae
3 changed files with 41 additions and 41 deletions

View File

@ -1,17 +1,17 @@
import { SGSelect } from "../src/cg-selectTS"; import { CGSelect } from '../src/cg-selectTS';
const dropdn = new SGSelect({ const dropdn = new CGSelect({
selector: '.cg-dropdown_one', selector: '.cg-dropdown_one',
placeholder: 'Выберите авто', placeholder: 'Выберите авто',
items: [ items: [
'BMW', 'BMW',
{ {
id: '213sade', id: '213sade',
title: 'Opel', title: 'Opel',
value: 'ds', value: 'ds',
}, },
'Mersedes', 'Mersedes',
'MAN', 'MAN',
'Ferari', 'Ferari',
] ],
}) });

View File

@ -4,11 +4,11 @@ import {
} from './components/create-element/create-elementTs'; } from './components/create-element/create-elementTs';
import { IDataItem } from './components/utils/urils.interface'; import { IDataItem } from './components/utils/urils.interface';
import { createSelected, getFormatItem } from './components/utils/utilsTs'; 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 { IItems } from './interfaces/items.interface';
import './main.scss'; import './main.scss';
export class SGSelect implements ISgSelect { export class CGSelect implements ICgSelect {
selector: string; selector: string;
selected?: string; selected?: string;
placeholder?: string; placeholder?: string;
@ -28,7 +28,7 @@ export class SGSelect implements ISgSelect {
private element: Element | null; private element: Element | null;
private list: Element | null | undefined; private list: Element | null | undefined;
private options: ISgSelect; private options: ICgSelect;
private randomId: string; private randomId: string;
private caret: Element | null | undefined; private caret: Element | null | undefined;
private category: string; private category: string;
@ -36,7 +36,7 @@ export class SGSelect implements ISgSelect {
private itemsSelect: IItems[] | string[] | any; private itemsSelect: IItems[] | string[] | any;
private indexes: number[] = []; private indexes: number[] = [];
constructor(setting: ISgSelect) { constructor(setting: ICgSelect) {
this.init(setting); this.init(setting);
this.render(); this.render();
this.closeSelectClick(); this.closeSelectClick();
@ -69,7 +69,7 @@ export class SGSelect implements ISgSelect {
multiselectTag: true, multiselectTag: true,
} }
*/ */
private init(setting: ISgSelect): void { private init(setting: ICgSelect): void {
const { items, multiselect, url, selector } = setting; const { items, multiselect, url, selector } = setting;
this.options = setting; this.options = setting;
@ -240,7 +240,7 @@ export class SGSelect implements ISgSelect {
* Приватный метод экземпляра класса DropDown * Приватный метод экземпляра класса DropDown
* @protected * @protected
* @description Закрывает список по клику вне элемента * @description Закрывает список по клику вне элемента
* @method #closeSelectClick * @method closeSelectClick
*/ */
private closeSelectClick() { private closeSelectClick() {
const dropdown = document.querySelector(`${this.options.selector}`); const dropdown = document.querySelector(`${this.options.selector}`);

View File

@ -1,20 +1,20 @@
import { IItems } from "./items.interface"; import { IItems } from './items.interface';
export interface ISgSelect { export interface ICgSelect {
selector: string; selector: string;
selected?: string; selected?: string;
placeholder?: string; placeholder?: string;
items?: IItems[]| string[] | any; items?: IItems[] | string[] | any;
darkTheme?: boolean; darkTheme?: boolean;
searchMode?: boolean; searchMode?: boolean;
closeOnSelect?: boolean; closeOnSelect?: boolean;
nativeSelectMode?: boolean; nativeSelectMode?: boolean;
listDisplayMode?: boolean; listDisplayMode?: boolean;
language?: string; language?: string;
lable?:string; lable?: string;
styles?: object; styles?: object;
event?: string; event?: string;
url?: string; url?: string;
multiselect?: boolean; multiselect?: boolean;
multiselectTag?: boolean; multiselectTag?: boolean;
} }