mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
Remove props property in favor of $$restProps
This commit is contained in:
parent
f88b9d64d3
commit
4c273caedb
10 changed files with 18 additions and 27 deletions
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
export let id = "";
|
export let id = "";
|
||||||
export let className = "";
|
export let className = "";
|
||||||
export let props: Record<string, string> = {};
|
|
||||||
|
|
||||||
function extendClassName(className: string): string {
|
function extendClassName(className: string): string {
|
||||||
return `dropdown-menu bg-transparent border-0 ${className}`;
|
return `dropdown-menu bg-transparent border-0 ${className}`;
|
||||||
|
@ -13,4 +12,4 @@
|
||||||
export let buttons: DynamicSvelteComponent[];
|
export let buttons: DynamicSvelteComponent[];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ButtonGroup {id} className={extendClassName(className)} {props} {buttons} />
|
<ButtonGroup {id} className={extendClassName(className)} {buttons} {...$$restProps} />
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
export let id;
|
export let id;
|
||||||
export let className = "";
|
export let className = "";
|
||||||
export let props: Record<string, string> = {};
|
|
||||||
|
|
||||||
export let buttons: DynamicSvelteComponent[];
|
export let buttons: DynamicSvelteComponent[];
|
||||||
</script>
|
</script>
|
||||||
|
@ -50,7 +49,7 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<ul {id} class={className} {...props}>
|
<ul {id} class={className} {...$$restProps}>
|
||||||
{#each buttons as button}
|
{#each buttons as button}
|
||||||
<li>
|
<li>
|
||||||
<svelte:component this={button.component} {...button} />
|
<svelte:component this={button.component} {...button} />
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<script lang="typescript">
|
<script lang="typescript">
|
||||||
export let id = "";
|
export let id = "";
|
||||||
export let className = "";
|
export let className = "";
|
||||||
export let props: Record<string, string> = {};
|
|
||||||
export let tooltip: string;
|
export let tooltip: string;
|
||||||
|
|
||||||
export let onChange: (event: Event) => void;
|
export let onChange: (event: Event) => void;
|
||||||
|
@ -46,8 +45,8 @@
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
{id}
|
{id}
|
||||||
class={className}
|
class={className}
|
||||||
{...props}
|
|
||||||
title={tooltip}
|
title={tooltip}
|
||||||
|
{...$$restProps}
|
||||||
on:mousedown|preventDefault>
|
on:mousedown|preventDefault>
|
||||||
<span> <input type="color" on:change={onChange} /> </span>
|
<span> <input type="color" on:change={onChange} /> </span>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -38,7 +38,6 @@
|
||||||
|
|
||||||
export let id = "";
|
export let id = "";
|
||||||
export let className = "";
|
export let className = "";
|
||||||
export let props: Record<string, string> = {};
|
|
||||||
export let tooltip: string;
|
export let tooltip: string;
|
||||||
|
|
||||||
export let icon;
|
export let icon;
|
||||||
|
@ -62,6 +61,6 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<SquareButton {id} {className} {props} {tooltip} {active} {onClick} on:mount>
|
<SquareButton {id} {className} {tooltip} {active} {onClick} {...$$restProps} on:mount>
|
||||||
{@html icon}
|
{@html icon}
|
||||||
</SquareButton>
|
</SquareButton>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<script lang="typescript">
|
<script lang="typescript">
|
||||||
export let id = "";
|
export let id = "";
|
||||||
export let className = "";
|
export let className = "";
|
||||||
export let props: Record<string, string> = {};
|
|
||||||
export let tooltip: string;
|
export let tooltip: string;
|
||||||
|
|
||||||
export let onClick: (event: MouseEvent) => void;
|
export let onClick: (event: MouseEvent) => void;
|
||||||
|
@ -12,8 +11,8 @@
|
||||||
<button
|
<button
|
||||||
{id}
|
{id}
|
||||||
class={`dropdown-item ${className}`}
|
class={`dropdown-item ${className}`}
|
||||||
{...props}
|
|
||||||
title={tooltip}
|
title={tooltip}
|
||||||
|
{...$$restProps}
|
||||||
on:click={onClick}
|
on:click={onClick}
|
||||||
on:mousedown|preventDefault>
|
on:mousedown|preventDefault>
|
||||||
<span class="float-start">{label}</span>
|
<span class="float-start">{label}</span>
|
||||||
|
|
|
@ -3,13 +3,12 @@
|
||||||
|
|
||||||
export let id = "";
|
export let id = "";
|
||||||
export let className = "";
|
export let className = "";
|
||||||
export let props: Record<string, string> = {};
|
|
||||||
export let tooltip: string;
|
export let tooltip: string;
|
||||||
|
|
||||||
export let icon = "";
|
export let icon = "";
|
||||||
export let onClick: (event: MouseEvent) => void;
|
export let onClick: (event: MouseEvent) => void;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<SquareButton {id} {className} {props} {tooltip} {onClick} on:mount>
|
<SquareButton {id} {className} {tooltip} {onClick} {...$$restProps} on:mount>
|
||||||
{@html icon}
|
{@html icon}
|
||||||
</SquareButton>
|
</SquareButton>
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
export let id = "";
|
export let id = "";
|
||||||
export let className = "";
|
export let className = "";
|
||||||
export let props: Record<string, string> = {};
|
|
||||||
|
|
||||||
export let label: string;
|
export let label: string;
|
||||||
export let tooltip: string;
|
export let tooltip: string;
|
||||||
|
@ -57,9 +56,9 @@
|
||||||
disabled={_disabled}
|
disabled={_disabled}
|
||||||
{id}
|
{id}
|
||||||
class={extendClassName(className)}
|
class={extendClassName(className)}
|
||||||
{...props}
|
title={tooltip}
|
||||||
|
{...$$restProps}
|
||||||
on:click={onClick}
|
on:click={onClick}
|
||||||
on:mousedown|preventDefault
|
on:mousedown|preventDefault>
|
||||||
title={tooltip}>
|
|
||||||
{label}
|
{label}
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
export let id = "";
|
export let id = "";
|
||||||
export let className = "";
|
export let className = "";
|
||||||
export let props: Record<string, string> = {};
|
|
||||||
export let tooltip: string;
|
export let tooltip: string;
|
||||||
|
|
||||||
function extendClassName(classes: string) {
|
function extendClassName(classes: string) {
|
||||||
|
@ -59,8 +58,8 @@
|
||||||
disabled={_disabled}
|
disabled={_disabled}
|
||||||
{id}
|
{id}
|
||||||
class={extendClassName(className)}
|
class={extendClassName(className)}
|
||||||
{...props}
|
title={tooltip}
|
||||||
title={tooltip}>
|
{...$$restProps}>
|
||||||
{#each options as option}
|
{#each options as option}
|
||||||
<SelectOption {...option} />
|
<SelectOption {...option} />
|
||||||
{/each}
|
{/each}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
export let id = "";
|
export let id = "";
|
||||||
export let className = "";
|
export let className = "";
|
||||||
export let props: Record<string, string> = {};
|
|
||||||
export let tooltip: string;
|
export let tooltip: string;
|
||||||
|
|
||||||
export let onClick: (event: MouseEvent) => void;
|
export let onClick: (event: MouseEvent) => void;
|
||||||
|
@ -85,11 +84,11 @@
|
||||||
bind:this={buttonRef}
|
bind:this={buttonRef}
|
||||||
{id}
|
{id}
|
||||||
class={className}
|
class={className}
|
||||||
{...props}
|
|
||||||
title={tooltip}
|
title={tooltip}
|
||||||
class:active
|
class:active
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
disabled={_disabled}
|
disabled={_disabled}
|
||||||
|
{...$$restProps}
|
||||||
on:click={onClick}
|
on:click={onClick}
|
||||||
on:mousedown|preventDefault>
|
on:mousedown|preventDefault>
|
||||||
<span class="p-1"><slot /></span>
|
<span class="p-1"><slot /></span>
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
export let button: DynamicSvelteComponent;
|
export let button: DynamicSvelteComponent;
|
||||||
export let menuId: string;
|
export let menuId: string;
|
||||||
|
|
||||||
function extend({ className, props, ...rest }: DynamicSvelteComponent): DynamicSvelteComponent {
|
function extend({
|
||||||
|
className,
|
||||||
|
...rest
|
||||||
|
}: DynamicSvelteComponent): DynamicSvelteComponent {
|
||||||
return {
|
return {
|
||||||
className: `${className} dropdown-toggle`,
|
className: `${className} dropdown-toggle`,
|
||||||
props: {
|
"data-bs-toggle": "dropdown",
|
||||||
"data-bs-toggle": "dropdown",
|
"aria-expanded": "false",
|
||||||
"aria-expanded": "false",
|
|
||||||
...props,
|
|
||||||
},
|
|
||||||
...rest,
|
...rest,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue