Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

4.1.2 #55

Merged
merged 4 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
.eslintrc.json
.prettierrc.json
jsconfig.json
/src
/examples
/config
/public
postcss.config.js
/src
/web
/dev
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,23 @@

```html

<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/viivue/easy-select@4.1.1/dist/easy-select.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/viivue/easy-select@4.1.2/dist/easy-select.min.css">

<script src="https://cdn.jsdelivr.net/gh/viivue/easy-select@4.1.1/dist/easy-select.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/viivue/easy-select@4.1.2/dist/easy-select.min.js"></script>
```

### NPM Package

Install NPM package

```shell
npm i @viivue/easy-select
```

Import

```js
import "@viivue/easy-select";
```

## Initialize
Expand Down
6 changes: 3 additions & 3 deletions dist/easy-select.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/easy-select.module.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "easy-select",
"name": "@viivue/easy-select",
"prettyName": "Easy Select",
"codeName": "EasySelect",
"version": "4.1.1",
"version": "4.1.2",
"description": "Customizing select is easier than ever.",
"homepage": "https://github.com/viivue/easy-select",
"repository": {
Expand Down
27 changes: 20 additions & 7 deletions src/_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,32 @@ class EasySelect{


/**
* Refresh
* Remove all options and refresh
*/
removeAllOptions(){
this.selectTag.innerHTML = '';
this.refresh();
}


/**
* Refresh based on the select tag options
*/
refresh(){
if(this.isDisabled) return;
this.selectTagData = getSelectData(this);

// update current
this.current.innerHTML = getOptionHTML(this);
if(this.selectTagData.length){
// update current
this.current.innerHTML = getOptionHTML(this);

// if not native select
if(!this.options.nativeSelect){
// update dropdown
updateDropdownHTML(this);
// if not native select
if(!this.options.nativeSelect){
// update dropdown
updateDropdownHTML(this);
}
}else{
// select with no option
}

// Event: on refresh
Expand Down