diff --git a/CHANGELOG.md b/CHANGELOG.md index 65f6dc4..eb9d0c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,3 +33,4 @@ Tested in JS and React. Errors in work in React applications are revealed. ### 27.01.2023 - fix 0.2.3 - Changed the theme selection function. +- Fixed documentation. diff --git a/docs/classes/cg_select.CGSelect.html b/docs/classes/cg_select.CGSelect.html index c90a720..32c4983 100644 --- a/docs/classes/cg_select.CGSelect.html +++ b/docs/classes/cg_select.CGSelect.html @@ -1,820 +1,4267 @@ -
Generated using TypeDoc
+This component allows you to create a custom select. It offers more flexible @@ -223,7 +223,7 @@
16.12.2022 - release version 0.1.0!
- 00.00.2023 - upgrade to version 0.2.1
+ 20.01.2023 - upgrade to version 0.2.1
Settings for select text, etc.
-Optional darkAn optional parameter that is responsible for enabling a light/dark theme by default, the dark theme is set.
-Optional indexesArray of indexes of selected elements.
-Optional multiselectAn optional parameter that is responsible for the behavior of the select, -for him, *** works only in a place with a multiselect connection.
-Optional placeholderPlaceholder optional parameter to which the text of the select placeholder is passed.
-Optional selectedAn optional parameter, which is passed the element that will be selected initially in the select.
-Optional selectedArray of selected items from the list.
-Generated using TypeDoc
Settings for select text, etc.
+Optional theme
+ + An optional parameter that is responsible for enabling a light/dark theme by + default, the dark theme is set. +
+Optional indexes
+ Array of indexes of selected elements.
+Optional
+ multiselect+ An optional parameter that is responsible for the behavior of the select, for him, + *** works only in a place with a multiselect connection. +
+Optional placeholder
+ + Placeholder optional parameter to which the text of the select placeholder is + passed. +
+Optional selected
+ + An optional parameter, which is passed the element that will be selected initially + in the select. +
+Optional selectedArray of selected items from the list.
+Generated using TypeDoc
+Select settings.
-Optional closeAn optional parameter that is responsible for the behavior of the select when opening, if closeOnSelect: false, -then when an element is selected in the selector, closing does not occur, -and you can select another element by default, closeOnSelect:true.
-Optional darkAn optional parameter that is responsible for enabling a light / dark theme by default, the dark theme is set (darkTheme == true).
-Optional eventAn optional parameter that is responsible for the behavior of the select, passing to this parameter an event of the 'mouseenter' type, -select will open on hover.
-Optional items*Required parameter (if no other way to get data (url) is specified), this is an array of elements, - which will be displayed in the select when selected.
-Optional lableAn optional parameter that adds a lable before the select.
-Optional languageOptional parameter responsible for the localization of some text elements.
-Optional listAn optional parameter that is responsible for the behavior of the select when opening.
-Optional multiselectAn optional parameter, which is responsible for the behavior of the select, adds the ability to select multiple elements. -Selected elements are rendered as plain text, separated by commas.
-Optional multiselectAn optional parameter that is responsible for the behavior of the select, -for him, *** works only in a place with a multiselect connection.
-Optional nativeAn optional parameter that is responsible for the behavior of the select when opened on mobile devices.
-Optional placeholderPlaceholder optional parameter to which the text of the select placeholder is passed.
-Optional searchAn optional parameter that adds a live search on the select elements.
-Optional selectedAn optional parameter, which is passed the element that will be selected initially in the select.
-Optional selectorUnique selector - *mandatory parameter (indicator) that is set when creating a select.
-Optional stylesAn optional parameter that is responsible for customizing the select elements, -objects with CSS properties for customizable elements are passed to it.
-Optional urlRequired parameter (if no other way to get data (items) is specified), -data that comes from the backend in the format { id: "", title: "", value: ""}.
-Generated using TypeDoc
Select settings.
+Optional
+ close+ An optional parameter that is responsible for the behavior of the select when + opening, if closeOnSelect: false, then when an element is selected in the selector, + closing does not occur, and you can select another element by default, + closeOnSelect:true. +
+Optional theme
+ + An optional parameter responsible for switching between different themes, the + classic theme is set by default. +
+Optional event
+ + An optional parameter that is responsible for the behavior of the select, passing to + this parameter an event of the 'mouseenter' type, select will open on hover. +
+Optional items
+ + *Required parameter (if no other way to get data (url) is specified), this is an + array of elements, which will be displayed in the select when selected. +
+Optional lable
+ An optional parameter that adds a lable before the select.
+Optional language
+ Optional parameter responsible for the localization of some text elements.
+Optional
+ list+ An optional parameter that is responsible for the behavior of the select when + opening. +
+Optional multiselect
+ + An optional parameter, which is responsible for the behavior of the select, adds the + ability to select multiple elements. Selected elements are rendered as plain text, + separated by commas. +
+Optional
+ multiselect+ An optional parameter that is responsible for the behavior of the select, for him, + *** works only in a place with a multiselect connection. +
+Optional
+ native+ An optional parameter that is responsible for the behavior of the select when opened + on mobile devices. +
+Optional placeholder
+ + Placeholder optional parameter to which the text of the select placeholder is + passed. +
+Optional searchAn optional parameter that adds a live search on the select elements.
+Optional selected
+ + An optional parameter, which is passed the element that will be selected initially + in the select. +
+Optional selector
+ + Unique selector - *mandatory parameter (indicator) that is set when creating a + select. +
+Optional styles
+ + An optional parameter that is responsible for customizing the select elements, + objects with CSS properties for customizable elements are passed to it. +
+Optional url
+ + Required parameter (if no other way to get data (items) is specified), data that + comes from the backend in the format { id: "", title: "", value: + ""}. +
+Generated using TypeDoc
+
Description
This class implements the functionality of a custom select, with customization capabilities.
+ + + + + ++- Preparing search index...
+ - The search index is not available
+
+ cg-select ++- cg-select
+ - cg-select
+ - CGSelect
+
+Class CGSelect
+Description
++ This class implements the functionality of a custom select, with customization + capabilities. +
-Author
Ovsyanikov Maxim
-Hierarchy
--- CGSelect
Implements
--- ICgSelect
-
-Index
Constructors
-Properties
-Accessors
-Methods
-Constructors
-constructor
--- new CGSelect(setting: ICgSelect): CGSelect
--
-
-
+
Description
The constructor takes an object and renders the select.
+Author
+Ovsyanikov Maxim
+Hierarchy
++- CGSelect
+
+Implements
++-
+ ICgSelect
+
+
++
++ + Index +
+Constructors
+Properties
+Accessors
+Methods
+Constructors
++ constructor +
++-
+ new CGSelect(setting: ICgSelect): CGSelect
+
+ -
+
+
-
-
-
Description
+The constructor takes an object and renders the select.
-Example
Parameters
---
-
setting: ICgSelect
-Object accepting select settings.
-Returns CGSelect
Properties
- Cntr
-PrivateOptionalbtnButton, to control the select.
-
-PrivatecaretVariable for carriage control.
-
-PrivateOptionalcategoryTransferred categories.
- On Select
-OptionalcloseAn optional parameter that is responsible for the behavior of the select when opening, if closeOnSelect: false, -then when an element is selected in the selector, closing does not occur, -and you can select another element by default, closeOnSelect:true.
- Theme
-OptionaldarkAn optional parameter that is responsible for enabling a light / dark theme by default, the dark theme is set (darkTheme == true).
-
-PrivateelementCreated HTML element.
-
-OptionaleventAn optional parameter that is responsible for the behavior of the select, passing to this parameter an event of the 'mouseenter' type, -select will open on hover.
-
-PrivateindexesArray of indexes of selected elements.
-
-Optionalitems*Required parameter (if no other way to get data (url) is specified), this is an array of elements, - which will be displayed in the select when selected.
-
-OptionallableAn optional parameter that adds a lable before the select.
-
-OptionallanguageOptional parameter responsible for the localization of some text elements.
-
-PrivatelistCreated list(ul), with class list.
- Display Mode
-OptionallistAn optional parameter that is responsible for the behavior of the select when opening.
-
-OptionalmultiselectAn optional parameter, which is responsible for the behavior of the select, adds the ability to select multiple elements. -Selected elements are rendered as plain text, separated by commas.
- Tag
-OptionalmultiselectAn optional parameter that is responsible for the behavior of the select, -for him, *** works only in a place with a multiselect connection.
- Select Mode
-OptionalnativeAn optional parameter that is responsible for the behavior of the select when opened on mobile devices.
-
-PrivateoptionsSelect settings passed when creating an instance of the class.
-
-OptionalplaceholderPlaceholder optional parameter to which the text of the select placeholder is passed.
- Id
-PrivaterandomUnique Id for elements.
- Mode
-OptionalsearchAn optional parameter that adds a live search on the select elements.
-
-OptionalselectedAn optional parameter, which is passed the element that will be selected initially in the select.
- Items
-PrivateselectedSelected or an array of selected items from a list.
-
-OptionalselectorUnique selector - *mandatory parameter (indicator) that is set when creating a select.
-
-OptionalstylesAn optional parameter that is responsible for customizing the select elements, -objects with CSS properties for customizable elements are passed to it.
-
-OptionalurlRequired parameter (if no other way to get data (items) is specified), -data that comes from the backend in the format { id: "", title: "", value: ""}.
-Accessors
-indexes Of
--- get indexesOf(): number | number[]
--
-
-
+
+
+
+
+Returns
Returns the indices of the selected element(s) as an array / empty array.
+Parameters
++-
+
+
+
+
++ setting: + ICgSelect +
+Object accepting select settings.
++ Returns + CGSelect +
+ +Properties
++ Cntr
+
+Private+OptionalbtnButton, to control the select.
+
+Privatecaret +Variable for carriage control.
+
+Private+Optionalcategory +Transferred categories.
+ On Select
+
+Optional+ close+ An optional parameter that is responsible for the behavior of the select when + opening, if closeOnSelect: false, then when an element is selected in the selector, + closing does not occur, and you can select another element by default, + closeOnSelect:true. +
++
+Optionaltheme ++ An optional parameter responsible for switching between different themes, the + classic theme is set by default. +
++
+Privateelement +Created HTML element.
+
+Optionalevent ++ An optional parameter that is responsible for the behavior of the select, passing to + this parameter an event of the 'mouseenter' type, select will open on hover. +
++
+Privateindexes +Array of indexes of selected elements.
++
+Optionalitems ++ *Required parameter (if no other way to get data (url) is specified), this is an + array of elements, which will be displayed in the select when selected. +
++
+Optionallable +An optional parameter that adds a lable before the select.
++
+Optionallanguage +Optional parameter responsible for the localization of some text elements.
++
+Privatelist +Created list(ul), with class list.
+ Display Mode
+
+Optional+ list+ An optional parameter that is responsible for the behavior of the select when + opening. +
++
+Optionalmultiselect ++ An optional parameter, which is responsible for the behavior of the select, adds the + ability to select multiple elements. Selected elements are rendered as plain text, + separated by commas. +
++ Tag
+
+Optional+ multiselect+ An optional parameter that is responsible for the behavior of the select, for him, + *** works only in a place with a multiselect connection. +
++ Select Mode
+
+Optional+ native+ An optional parameter that is responsible for the behavior of the select when opened + on mobile devices. +
++
+Privateoptions +Select settings passed when creating an instance of the class.
++
+Optionalplaceholder ++ Placeholder optional parameter to which the text of the select placeholder is + passed. +
++ Id
+
+PrivaterandomUnique Id for elements.
+ Mode
+
+OptionalsearchAn optional parameter that adds a live search on the select elements.
++
+Optionalselected ++ An optional parameter, which is passed the element that will be selected initially + in the select. +
++ Items
+
+PrivateselectedSelected or an array of selected items from a list.
++
+Optionalselector ++ Unique selector - *mandatory parameter (indicator) that is set when creating a + select. +
++
+Optionalstyles ++ An optional parameter that is responsible for customizing the select elements, + objects with CSS properties for customizable elements are passed to it. +
++
+Optionalurl ++ Required parameter (if no other way to get data (items) is specified), data that + comes from the backend in the format { id: "", title: "", value: + ""}. +
+Accessors
++ indexes Of
+
++-
+ get indexesOf(): number | number[]
+
+ -
+
+
-
Returns
+Returns the indices of the selected element(s) as an array / empty array.
-Description
A getter that returns the indexes of the selected element(s) of the select.
-Returns number | number[]
value
--- get value(): string | string[]
--
-
-
+
+
+Returns
Returns the selected element(s) as an array / element / null.
+Description
+A getter that returns the indexes of the selected element(s) of the select.
++ Returns number | number[] +
+ ++ value +
++-
+ get value(): string | string[]
+
+ -
+
+
-
Returns
+Returns the selected element(s) as an array / element / null.
-Description
Getter returning the selected element(s) of the select.
-Returns string | string[]
Methods
-add Item
--- add
Item(item: string | number | IItems): undefined | false
--
-
-
+
+
+Description
adds the given element to the end of the list and redraws the list. Cannot be used when passing elements with categories.
+Description
+Getter returning the selected element(s) of the select.
++ Returns string | string[] +
+ +Methods
++ add Item
+
++-
+ add
Item(item: string | number | IItems): undefined | false
+
+ -
+
+
-
-
-
Description
++ adds the given element to the end of the list and redraws the list. Cannot be + used when passing elements with categories. +
-Method
addItem
-Parameters
---
-
item: string | number | IItems
-added element.
-Returns undefined | false
add Language
--- add
Language(language: ILanguage): void
--
-
-
+
+
+
+
+Description
a method that allows you to change the placeholder in the search and the text that is displayed if there is no result.
+Method
+addItem
+Parameters
++-
+
+
+
++ item: string | number | IItems +
+added element.
+ Returns undefined | false +
+ ++ add Language
+
++-
+ add
Language(language: ILanguage): void
+
+ -
+
+
-
-
-
Description
++ a method that allows you to change the placeholder in the search and the text + that is displayed if there is no result. +
-Method
addLanguage
-Parameters
---
-
language: ILanguage
-the object in which the fields for connecting the language are located has two mandatory fields placeholder, textInListSearch, selectPlaceholder.
-Returns void
Options Behaviour
-Privateadd-- add
Options Behaviour(): void
-
-
+
+
+
+
+Private-Description
A method that implements the selection of elements in different modes.
+Method
+addLanguage
+Parameters
++-
+
+
+
+
++ language: + ILanguage +
++ the object in which the fields for connecting the language are located has + two mandatory fields placeholder, textInListSearch, selectPlaceholder. +
++ Returns void +
+ ++ Options Behaviour
+
+Private+ add+-
+ add
Options Behaviour(): void
+
+ -
+
+
-
Private+Description
+A method that implements the selection of elements in different modes.
-Method
addOptionsBehaviour
-Returns void
button Control
--- button
Control(button: Element, method: string): void
--
-
-
+
+
+Description
A method that allows you to open / close the select using buttons.
+Method
+addOptionsBehaviour
++ Returns void +
+ ++ button Control
+
++-
+ button
Control(button: Element, method: string): void
+
+ -
+
+
-
-
-
Description
+A method that allows you to open / close the select using buttons.
-Method
buttonControl
-Parameters
---
-
--
-
button: Element
-HTML button.
-method: string
-open/close method.
-Returns void
Theme
-Privatecheck-- check
Theme(): void
-
-
+
+
+
+
+Private-Method
checkTheme
+Method
+buttonControl
+Parameters
++-
+
+
+ -
+
+
+
+button: Element
+HTML button.
method: string
+open/close method.
+ Returns void +
+ ++ Theme
+
+Privatecheck+-
+ check
Theme(): void
+
+ -
+
+
-
Private+Method
+checkTheme
-Description
Changes the color scheme from dark to light.
-Returns void
-Privateclose-- close(): void
-
-
+
+
+Private-Description
Closes the list.
+Description
+Changes the color scheme from dark to light.
++ Returns void +
+ ++
+Privateclose ++-
+ close(): void
+
+ -
+
+
-
Private+Description
+Closes the list.
-Method
close
-Returns void
Select Click
-Privateclose-- close
Select Click(): void
-
-
+
+
+Private-Description
Closes the list on click outside of an element.
+Method
+close
++ Returns void +
+ ++ Select Click
+
+Private+ close+-
+ close
Select Click(): void
+
+ -
+
+
-
Private+Description
+Closes the list on click outside of an element.
-Method
closeSelectClick
-Returns void
delete Item
--- delete
Item(index: number): void
--
-
-
+
+
+Description
removes the element by index from the list and redraws it. Cannot be used when passing elements with categories.
+Method
+closeSelectClick
++ Returns void +
+ ++ delete Item
+
++-
+ delete
Item(index: number): void
+
+ -
+
+
-
-
-
Description
++ removes the element by index from the list and redraws it. Cannot be used when + passing elements with categories. +
-Method
deleteItem
-Parameters
---
-
index: number
-the index of the element to be removed.
-Returns void
delete Item All
--- delete
Item All(): void
--
-
-
+
+
+
+
+Description
removes all elements from the list and redraws it.
+Method
+deleteItem
+Parameters
++-
+
+
+
+
+index: number
+the index of the element to be removed.
++ Returns void +
+ ++ delete Item All
+
++-
+ delete
Item All(): void
+
+ -
+
+
-
Description
+removes all elements from the list and redraws it.
-Method
deleteItemAll
-Returns void
disabled
--- disabled(value: boolean): void
--
-
-
+
+
+Description
A method that allows you to toggle the state of the disabled select.
+Method
+deleteItemAll
++ Returns void +
+ ++ disabled +
++-
+ disabled(value: boolean): void
+
+ -
+
+
-
-
-
Description
+A method that allows you to toggle the state of the disabled select.
-Method
disabled
-Parameters
---
-
value: boolean
-Passed parameter to add the disabled attribute.
-Returns void
Mode
-Privatedisplay-- display
Mode(listDisplayMode: boolean): void
-
-
+
+
+
+
+Private-Description
Changes the display of a sheet with a selection as a modal window.
+Method
+disabled
+Parameters
++-
+
+
+
+
+value: boolean
+Passed parameter to add the disabled attribute.
++ Returns void +
+ ++ Mode
+
+Privatedisplay+-
+ display
Mode(listDisplayMode: boolean): void
+
+ -
+
+
-
-
-
Private+Description
+Changes the display of a sheet with a selection as a modal window.
-Method
displayMode
-Parameters
---
-
listDisplayMode: boolean
-parameter responsible for displaying the selection in the form of a modal window.
-Returns void
get Element
--- get
Element(numberItem: number): any
--
-
-
+
+
+
+
+Returns
returns a reference to the selected HTML element.
+Method
+displayMode
+Parameters
++-
+
+
+
+
+listDisplayMode: boolean
++ parameter responsible for displaying the selection in the form of a modal + window. +
++ Returns void +
+ ++ get Element
+
++-
+ get
Element(numberItem: number): any
+
+ -
+
+
-
-
-
Returns
+returns a reference to the selected HTML element.
-Method
getElement
-Parameters
---
-
numberItem: number
-returned element number.
-Returns any
-Privateinit-- init(setting: ICgSelect): void
-
+
+
+
+
+Private-Private method for initializing an instance of the ICgSelect class.
+Method
+getElement
+Parameters
++-
+
+
+
+numberItem: number
+returned element number.
+ Returns any +
+ ++
+Privateinit ++-
+ init(setting: ICgSelect): void
+
+ -
+
+
-
-
-
Private+Private method for initializing an instance of the ICgSelect class.
-Method
init
+Method
+init
-Member
-Description
Private method. General initialization of the select. Obtaining tinctures and converting select elements.
+Member
+Description
++ Private method. General initialization of the select. Obtaining tinctures and + converting select elements. +
-Example
Parameters
---
-
setting: ICgSelect
-passed select settings.
-Returns void
Event
-Privateinit-- init
Event(): void
-
-
+
+
+
+
+Private-Description
Opens and closes the list by the passed event.
+Parameters
++-
+
+
+
++ setting: + ICgSelect +
+passed select settings.
+ Returns void +
+ ++ Event
+
+Privateinit+-
+ init
Event(): void
+
+ -
+
+
-
Private+Description
+Opens and closes the list by the passed event.
-Method
initEvent
-Returns void
Selected
-Privateinit-- init
Selected(select?: string): void
-
-
+
+
+Private-Method
initSelected
+Method
+initEvent
++ Returns void +
+ ++ Selected
+
+Privateinit+-
+ init
Selected(select?: string): void
+
+ -
+
+
-
-
-
Private+Method
+initSelected
-Description
Renders and styles the select.
-Parameters
---
-
-Optionalselect: stringoptional element. Used in the selectedIndex method.
-Returns void
-Privateopen-- open(oneClick?: boolean): void
-
-
+
+
+
+
+Private-Description
Opens a list to select an element.
+Description
+Renders and styles the select.
+Parameters
++-
+
+
+
+
++
+Optionalselect: + string +optional element. Used in the selectedIndex method.
++ Returns void +
+ ++
+Privateopen ++-
+ open(oneClick?: boolean): void
+
+ -
+
+
-
-
-
Private+Description
+Opens a list to select an element.
-Method
open
-Parameters
---
-
-OptionaloneClick: booleanoptional parameter passed from the buttonControl function.
-Returns void
-Privaterender-- render(select?: string): void
-
-
+
+
+
+
+Private-Method
render
+Method
+open
+Parameters
++-
+
+
+
+
++
+OptionaloneClick: + boolean +optional parameter passed from the buttonControl function.
++ Returns void +
+ ++
+Privaterender ++-
+ render(select?: string): void
+
+ -
+
+
-
-
-
Private+Method
+render
-Description
Render elements in select.
-Parameters
---
-
-Optionalselect: stringoptional element. Passed to the initSelected.
-Returns void
Url
-Privaterender-- render
Url(): Promise<void>
-
-
+
+
+
+
+Private-Method
renderUrl
+Description
+Render elements in select.
+Parameters
++-
+
+
+
+
++
+Optionalselect: + string +optional element. Passed to the initSelected.
++ Returns void +
+ ++ Url
+
+Privaterender+-
+ render
Url(): Promise<void>
+
+ -
+
+
-
Private+Method
+renderUrl
-Description
Rendering elements in the select passed from the URL and setting them up.
-Returns Promise<void>
Mode Select
-Privatesearch-- search
Mode Select(random: string): void
-
-
+
+
+Private-Description
The method that implements the search for elements in the select.
+Description
+Rendering elements in the select passed from the URL and setting them up.
++ Returns Promise<void> +
+ ++ Mode Select
+
+Private+ search+-
+ search
Mode Select(random: string): void
+
+ -
+
+
-
-
-
Private+Description
+The method that implements the search for elements in the select.
-Method
searchMode
-Parameters
---
-
random: string
-unique value for input element.
-Returns void
select Index
--- select
Index(index: number): void
--
-
-
+
+
+
+
+Description
selects the element that will be initially rendered in the select.
+Method
+searchMode
+Parameters
++-
+
+
+
+
+random: string
+unique value for input element.
++ Returns void +
+ ++ select Index
+
++-
+ select
Index(index: number): void
+
+ -
+
+
-
-
-
Description
+selects the element that will be initially rendered in the select.
-Method
selectIndex
-Parameters
---
-
index: number
-the index of the selected element.
-Returns void
Mode
-Privateselect-- select
Mode(nativeSelectMode: boolean): void
-
-
+
+
+
+
+Private-Description
Changes the display of the select on mobile devices.
+Method
+selectIndex
+Parameters
++-
+
+
+
+
+index: number
+the index of the selected element.
++ Returns void +
+ ++ Mode
+
+Privateselect+-
+ select
Mode(nativeSelectMode: boolean): void
+
+ -
+
+
-
-
-
Private+Description
+Changes the display of the select on mobile devices.
-Method
selectMode
-Parameters
---
-
nativeSelectMode: boolean
-parameter responsible for adding native select.
-Returns void
-
-Settings
Member Visibility
Theme
Generated using TypeDoc
Method
+selectMode
+Parameters
++-
+
+
+
+
+nativeSelectMode: boolean
+parameter responsible for adding native select.
++ Returns void +
+ + + +