diff --git a/CHANGELOG.md b/CHANGELOG.md index 485cd16..6675a8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,13 +26,23 @@ Tested in JS and React. Errors in work in React applications are revealed. - All select rewritten to ts. - Fixed bugs and shortcomings. - 24.01.2023 - fix 0.2.2 - Fixed documentation etc. - 27.01.2023 - fix 0.2.3 +##### 24.01.2023 - fix 0.2.2 - Fixed documentation etc. + +### 27.01.2023 - update 0.2.3 - Changed the theme selection function. - Fixed documentation. - 31.01.2023 - fix 0.2.31 +##### 31.01.2023 - fix 0.2.31 - Adding a new method to track select actions. - Fixed documentation. + +##### 08.02.2023 - fix 0.2.32 + +- Fixing Methods and Variables. +- Updating how themes work. +- Fixed documentation. +- Fixing bugs related to the cleanup of the select. +- Documentation navigation update. +- Added icon for example page and documentation. diff --git a/docs/index.html b/docs/index.html index 78c0141..510c223 100644 --- a/docs/index.html +++ b/docs/index.html @@ -8,6 +8,7 @@ + diff --git a/example/index.html b/example/index.html index 31dfec4..b316ee7 100644 --- a/example/index.html +++ b/example/index.html @@ -14,6 +14,7 @@ Cg-Select + @@ -351,6 +352,7 @@ maxWidth: '500px ', }, }, + multiselect: true, }); diff --git a/example/index.js b/example/index.js index 853b3c0..c4a86d0 100644 --- a/example/index.js +++ b/example/index.js @@ -57,6 +57,7 @@ const dropdownNativeSelect = new CGSelect({ width: '824px', }, }, + theme: 'dark', }); // ------------------------------listDisplayMode-------------------- @@ -88,7 +89,7 @@ const dropdownlistDisplayMode = new CGSelect({ // --------------------------------Категории-------------------------- const dropdown4 = new CGSelect({ selector: '.cg-dropdown_categories', - placeholder: 'Выберите регион', + placeholder: 'Choose region', searchMode: true, items: [ { diff --git a/src/cg-select.ts b/src/cg-select.ts index 2aea3cb..d760654 100644 --- a/src/cg-select.ts +++ b/src/cg-select.ts @@ -32,7 +32,6 @@ import { changeTheme } from './components/theme/theme'; * @author Ovsyanikov Maxim */ export class CGSelect implements ICgSelect { - // Select settings selector?: string; selected?: string; placeholder?: string; @@ -466,10 +465,6 @@ export class CGSelect implements ICgSelect { * @method initEvent */ private initEvent() { - if (!this.event) { - return; - } - if (this.event) { if (this.event === 'mouseenter') { this.element!.addEventListener(this.event, () => { @@ -771,7 +766,7 @@ export class CGSelect implements ICgSelect { * @returns {HTMLElement} returns a reference to the selected HTML element. * @method getElement */ - public getElement(numberItem: number): IItems[] | string[] | any { + public getElement(numberItem: number): IItems[] | any { if (numberItem > this.items.length) { return; } diff --git a/src/components/theme/theme.ts b/src/components/theme/theme.ts index 3b4f393..cf2e58b 100644 --- a/src/components/theme/theme.ts +++ b/src/components/theme/theme.ts @@ -4,6 +4,7 @@ export function changeTheme(element: Element, theme: string) { const list = element!.querySelector('ul.list'); const search = element!.querySelector('.inputSearch'); const path = element.querySelectorAll('.pathWhite'); + const nativeSelect = element.querySelector('.nativeSelect'); select!.classList.remove('classicSelect'); list!.classList.remove('classicList'); @@ -12,10 +13,11 @@ export function changeTheme(element: Element, theme: string) { elem.classList.remove('pathWhite'); }); - switch (theme) { + switch (theme.toLowerCase()) { case 'dark': select!.classList.add('selectDark'); list!.classList.add('listDark'); + nativeSelect?.classList.add('listDark'); path.forEach((elem) => { elem.classList.add('pathWhite'); }); @@ -24,6 +26,7 @@ export function changeTheme(element: Element, theme: string) { select!.classList.add('selectWhite'); caret!.classList.add('caretWhite'); list!.classList.add('listWhite'); + nativeSelect?.classList.add('listWhite'); path.forEach((elem) => { elem.classList.add('pathBlack'); }); diff --git a/src/images/logoCG2.ico b/src/images/logoCG2.ico new file mode 100644 index 0000000..7c73de7 Binary files /dev/null and b/src/images/logoCG2.ico differ