Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix/search-input-clear-input #1335

Merged
merged 3 commits into from
Jul 2, 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: 6 additions & 0 deletions .changeset/sour-dogs-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@wizleap-inc/wiz-ui-react": patch
"@wizleap-inc/wiz-ui-next": patch
---

Fix(search-selector): 選択時に検索文字列をクリアする
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,16 @@ const emit = defineEmits<{
(e: "toggle", value: boolean): void;
}>();

const searchValue = ref("");

const checkValues = computed({
get: () => props.modelValue,
set: (value: number[]) => emit("update:modelValue", value),
set: (value: number[]) => {
emit("update:modelValue", value);
searchValue.value = "";
},
});

const searchValue = ref("");
const filteredOptions = ref<SearchInputOption[]>([]);
const selectedItem = ref<number[]>([]);
const activeItem = ref<number | null>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const SearchInput: FC<Props> = ({
});

return map;
}, [options]);
}, [options, showParentLabel]);

const IconComponent = icon;

Expand All @@ -128,6 +128,11 @@ const SearchInput: FC<Props> = ({

const displayingSelectedItems = showSelectedItem && values.length > 0;

const handleClickPanelItem = (value: number[]) => {
onChangeValues(value);
setFilteringText("");
};

return (
<>
<div
Expand Down Expand Up @@ -206,7 +211,7 @@ const SearchInput: FC<Props> = ({
width={popupWidth}
emptyMessage={emptyMessage}
singleSelect={singleSelect}
onChangeValues={(changed) => onChangeValues(changed)}
onChangeValues={handleClickPanelItem}
/>
</WizHStack>
</WizPopup>
Expand Down
Loading