Skip to content

Commit

Permalink
Add events to callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaitanLyss committed Sep 9, 2024
1 parent 9162e3b commit af85d5c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@selenite/commons",
"version": "0.30.6",
"version": "0.30.7",
"repository": "github:ShaitanLyss/selenite-commons",
"license": "MIT",
"keywords": [
Expand Down
6 changes: 3 additions & 3 deletions src/lib/components/Browser.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
cols?: number;
itemWidth?: number;
itemProps?: HTMLAttributes<HTMLElement>;
itemDblClick?: (item: T) => void;
itemDragStart?: (item: T) => void;
itemDblClick?: (item: T, e: Event) => void;
itemDragStart?: (item: T, e: DragEvent) => void;
itemAfterUpdate?: (item: T) => void;
itemDelete?: (item: T) => void;
itemDelete?: (item: T, e: Event) => void;
query?: string;
queriedKeys?: Iterable<StringKeys<T> | StringArrayKeys<T>>;
searchBar?: boolean;
Expand Down
14 changes: 7 additions & 7 deletions src/lib/components/browser/DefaultItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
query?: string;
filters?: Iterable<Filter<T>>;
itemToId?: Map<T, string>;
itemDblClick?: (item: T) => void;
itemDragStart?: (item: T) => void;
itemDelete?: (item: T) => void;
itemDblClick?: (item: T, e: Event) => void;
itemDragStart?: (item: T, e: DragEvent) => void;
itemDelete?: (item: T, e: Event) => void;
}
let {
Expand Down Expand Up @@ -57,21 +57,21 @@
{...props}
ondblclick={(e) => {
props.ondblclick?.(e);
itemDblClick?.(o as T);
itemDblClick?.(o as T, e);
}}
ondragstart={(e) => {
ondragstart(e);
props.ondragstart?.(e);
itemDragStart?.(o as T);
itemDragStart?.(o as T, e);
}}
class="group relative transition-all flex flex-col items-center cursor-pointer bg-base-300 rounded-box p-4 border border-base-content border-opacity-15 overflow-clip {props.class}"
in:fade
out:fade={{ duration: 50 }}>
{#if itemDelete}
<Button
class="absolute opacity-0 group-hover:opacity-100 top-2 right-2 btn-xs btn-circle btn-ghost"
onclick={() => {
itemDelete?.(o as T);
onclick={(e) => {
itemDelete?.(o as T, e);
}}
>
<Fa icon={faTimes} />
Expand Down

0 comments on commit af85d5c

Please sign in to comment.