input_pill: Renamed removePillFunction to onPillRemove.

This commit is contained in:
adnan-td 2024-03-28 23:01:14 +05:30 committed by Tim Abbott
parent 6be511ed48
commit 97cbf4e075
1 changed files with 6 additions and 6 deletions

View File

@ -50,7 +50,7 @@ type InputPillStore<T> = {
create_item_from_text: InputPillCreateOptions<T>["create_item_from_text"]; create_item_from_text: InputPillCreateOptions<T>["create_item_from_text"];
get_text_from_item: InputPillCreateOptions<T>["get_text_from_item"]; get_text_from_item: InputPillCreateOptions<T>["get_text_from_item"];
onPillCreate?: () => void; onPillCreate?: () => void;
removePillFunction?: (pill: InputPill<T>) => void; onPillRemove?: (pill: InputPill<T>) => void;
createPillonPaste?: () => void; createPillonPaste?: () => void;
}; };
@ -214,8 +214,8 @@ export function create<T>(opts: InputPillCreateOptions<T>): InputPillContainer<T
if (idx !== undefined) { if (idx !== undefined) {
store.pills[idx].$element.remove(); store.pills[idx].$element.remove();
const pill = store.pills.splice(idx, 1); const pill = store.pills.splice(idx, 1);
if (store.removePillFunction !== undefined) { if (store.onPillRemove !== undefined) {
store.removePillFunction(pill[0]); store.onPillRemove(pill[0]);
} }
// This is needed to run the "change" event handler registered in // This is needed to run the "change" event handler registered in
@ -240,8 +240,8 @@ export function create<T>(opts: InputPillCreateOptions<T>): InputPillContainer<T
if (pill) { if (pill) {
pill.$element.remove(); pill.$element.remove();
if (!quiet && store.removePillFunction !== undefined) { if (!quiet && store.onPillRemove !== undefined) {
store.removePillFunction(pill); store.onPillRemove(pill);
} }
} }
}, },
@ -452,7 +452,7 @@ export function create<T>(opts: InputPillCreateOptions<T>): InputPillContainer<T
}, },
onPillRemove(callback) { onPillRemove(callback) {
store.removePillFunction = callback; store.onPillRemove = callback;
}, },
createPillonPaste(callback) { createPillonPaste(callback) {