jb-select 2.0.3 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -1
- package/dist/JBSelect.d.ts +60 -0
- package/dist/JBSelect.js +459 -113
- package/dist/JBSelect.js.map +1 -1
- package/dist/Types.d.ts +23 -0
- package/lib/JBSelect.html +4 -1
- package/lib/JBSelect.scss +22 -4
- package/lib/{JBSelect.js → JBSelect.ts} +119 -91
- package/lib/Types.ts +23 -0
- package/lib/global.d.ts +11 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -17,6 +17,16 @@ use `<jb-select></jb-select>`
|
|
|
17
17
|
if ypu want to add option to jb-select set option list to DOM
|
|
18
18
|
`const dropDownElement = document.querySelector('jb-select').optionList = [your option array]`
|
|
19
19
|
|
|
20
|
+
### get value
|
|
21
|
+
|
|
22
|
+
its simple like any other form element use `.value` of dom
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
25
|
+
//get value
|
|
26
|
+
document.querySelector('jb-select').value;
|
|
27
|
+
// if you use a object in option list you can get selected option title beside value
|
|
28
|
+
document.querySelector('jb-select').selectedOptionTitle;
|
|
29
|
+
```
|
|
20
30
|
### set value
|
|
21
31
|
|
|
22
32
|
to select value in your code you have 2 option:
|
|
@@ -32,6 +42,20 @@ remember set value as attribute if your option is a plain string but in direct a
|
|
|
32
42
|
<jb-select placeholder="please select"></jb-select>
|
|
33
43
|
```
|
|
34
44
|
|
|
45
|
+
### change empty state shape
|
|
46
|
+
when the searched value in select is not found, there is an open dropdown with the not found message.
|
|
47
|
+
you can customize this entire section by adding a div with the `slot="empty-list"`
|
|
48
|
+
|
|
49
|
+
like the example the below:
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<jb-select>
|
|
53
|
+
<div slot="empty-list-message">
|
|
54
|
+
put your customize html here
|
|
55
|
+
</div>
|
|
56
|
+
</jb-select>
|
|
57
|
+
```
|
|
58
|
+
|
|
35
59
|
### callbacks
|
|
36
60
|
|
|
37
61
|
you can add callbacks to manage the way component works
|
|
@@ -89,7 +113,9 @@ if you want to set a custom style to this web-component all you need is to set c
|
|
|
89
113
|
| --jb-select-list-max-height | max height of option list |
|
|
90
114
|
| --jb-select-border-bottom-width | width of border bottom |
|
|
91
115
|
| --jb-select-border-width | width of border |
|
|
92
|
-
| --jb-select-label-color | color of label
|
|
116
|
+
| --jb-select-label-color | color of label default is `#1f1735` |
|
|
117
|
+
| --jb-input-label-font-size | label font size default is `0.8em` |
|
|
118
|
+
| --jb-input-label-font-weight | color of label defualt is `#1f1735` |
|
|
93
119
|
| --jb-select-option-color | change option text color |
|
|
94
120
|
| --jb-select-option-color-hover | change option text color on hover |
|
|
95
121
|
| --jb-select-option-background-color | background of options default is `#fff` |
|
|
@@ -97,4 +123,9 @@ if you want to set a custom style to this web-component all you need is to set c
|
|
|
97
123
|
| --jb-select-input-color | color of input value |
|
|
98
124
|
| --jb-select-bgcolor-selected | set background color for selected status |
|
|
99
125
|
| --jb-select-selected-value-color | selected value text color default is `#1f1735` |
|
|
126
|
+
| --jb-select-message-color | message text color default is `#929292` |
|
|
127
|
+
| --jb-select-message-font-size | font size of message default is `0.7em` |
|
|
128
|
+
| --jb-select-message-font-weight | font weight of message box default is `normal` |
|
|
129
|
+
| --jb-select-placeholder-color | placeholder color default is `initial` |
|
|
130
|
+
| --jb-select-placeholder-font-size | placeholder font-size default is `1.1em` |
|
|
100
131
|
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { JBSelectCallbacks, JBSelectElements, JBSelectOptionElement } from './Types';
|
|
2
|
+
export declare class JBSelectWebComponent extends HTMLElement {
|
|
3
|
+
#private;
|
|
4
|
+
required: boolean;
|
|
5
|
+
callbacks: JBSelectCallbacks;
|
|
6
|
+
elements: JBSelectElements;
|
|
7
|
+
get value(): any;
|
|
8
|
+
set value(value: any);
|
|
9
|
+
get textValue(): string;
|
|
10
|
+
set textValue(value: string);
|
|
11
|
+
get selectedOptionTitle(): string;
|
|
12
|
+
get optionList(): any[];
|
|
13
|
+
set optionList(value: any[]);
|
|
14
|
+
get placeholder(): string;
|
|
15
|
+
set placeholder(value: string);
|
|
16
|
+
get displayOptionList(): any[];
|
|
17
|
+
set displayOptionList(value: any[]);
|
|
18
|
+
get isMobileDevice(): boolean;
|
|
19
|
+
constructor();
|
|
20
|
+
connectedCallback(): void;
|
|
21
|
+
callOnInitEvent(): void;
|
|
22
|
+
callOnLoadEvent(): void;
|
|
23
|
+
initWebComponent(): void;
|
|
24
|
+
registerEventListener(): void;
|
|
25
|
+
initProp(): void;
|
|
26
|
+
static get observedAttributes(): string[];
|
|
27
|
+
attributeChangedCallback(name: any, oldValue: any, newValue: any): void;
|
|
28
|
+
onAttributeChange(name: any, value: any): void;
|
|
29
|
+
_setValueOnOptionListChanged(): void;
|
|
30
|
+
_setValue(value: any): void;
|
|
31
|
+
onArrowKeyClick(): void;
|
|
32
|
+
onInputKeyPress(): void;
|
|
33
|
+
onInputBeforeInput(e: InputEvent): void;
|
|
34
|
+
onInputInput(e: InputEvent): void;
|
|
35
|
+
onInputKeyup(e: KeyboardEvent): void;
|
|
36
|
+
handleSelectedValueDisplay(inputValue: string): void;
|
|
37
|
+
triggerOnInputKeyup(e: KeyboardEvent): void;
|
|
38
|
+
onInputChange(e: Event): void;
|
|
39
|
+
onInputFocus(): void;
|
|
40
|
+
onInputBlur(e: FocusEvent): void;
|
|
41
|
+
focus(): void;
|
|
42
|
+
blur(): void;
|
|
43
|
+
showOptionList(): void;
|
|
44
|
+
hideOptionList(): void;
|
|
45
|
+
updateOptionList(filterText: string): void;
|
|
46
|
+
updateOptionListDOM(): void;
|
|
47
|
+
createOptionDOM(item: any): JBSelectOptionElement;
|
|
48
|
+
_createOptionDom(item: any): JBSelectOptionElement;
|
|
49
|
+
onOptionClicked(e: MouseEvent): void;
|
|
50
|
+
selectOption(value: any): void;
|
|
51
|
+
filterOptionList(filterString: string): any[];
|
|
52
|
+
triggerInputValidation(showError?: boolean): {
|
|
53
|
+
isAllValid: boolean;
|
|
54
|
+
};
|
|
55
|
+
showValidationError(errorType: any): void;
|
|
56
|
+
clearValidationError(): void;
|
|
57
|
+
_triggerOnChangeEvent(): void;
|
|
58
|
+
setSelectedOptionDom(value: any): void;
|
|
59
|
+
private createSelectedValueDom;
|
|
60
|
+
}
|