Skip to content

Commit

Permalink
release(toolbar): v0.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
surunzi committed Aug 29, 2023
1 parent e744fd8 commit 12612e9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@
},
"toolbar": {
"react": true,
"version": "0.4.2",
"version": "0.4.3",
"style": true,
"icon": false,
"test": true,
Expand Down
4 changes: 4 additions & 0 deletions src/toolbar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ export class LunaToolbarSelect extends LunaToolbarItem {
this.setOptions(options)
$select.on('change', () => this.onChange($select.val()))
}
setValue(value: string) {
this.$select.val(value)
this.value = value
}
setOptions(options: types.PlainObj<string>) {
this.$select.html(
map(
Expand Down
2 changes: 1 addition & 1 deletion src/toolbar/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "toolbar",
"version": "0.4.2",
"version": "0.4.3",
"description": "Application toolbar",
"luna": {
"react": true
Expand Down
6 changes: 6 additions & 0 deletions src/toolbar/react.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ export const LunaToolbarSelect: FC<IToolbarSelectProps> = (props) => {
[props.disabled]
)

useEffect(() => {
if (toolbarSelect.current) {
toolbarSelect.current.setValue(props.value)
}
}, [props.value])

useEffect(() => {
if (toolbarSelect.current) {
toolbarSelect.current.setOptions(props.options)
Expand Down

0 comments on commit 12612e9

Please sign in to comment.