mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 02:06:01 +00:00
Add support for SVG icons in FontIcon component and update connection icon logic
This commit is contained in:
@@ -431,13 +431,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$: apps = useAllApps();
|
$: apps = useAllApps();
|
||||||
|
$: driver = $extensions.drivers.find(x => x.engine == data.engine);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<AppObjectCore
|
<AppObjectCore
|
||||||
{...$$restProps}
|
{...$$restProps}
|
||||||
{data}
|
{data}
|
||||||
title={getConnectionLabel(data, { showUnsaved: true })}
|
title={getConnectionLabel(data, { showUnsaved: true })}
|
||||||
icon={data._id.startsWith('cloud://') ? 'img cloud-connection' : data.singleDatabase ? 'img database' : 'img server'}
|
icon={driver?.icon || (data._id.startsWith('cloud://') ? 'img cloud-connection' : data.singleDatabase ? 'img database' : 'img server')}
|
||||||
isBold={data.singleDatabase
|
isBold={data.singleDatabase
|
||||||
? $currentDatabase?.connection?._id == data._id && $currentDatabase?.name == data.defaultDatabase
|
? $currentDatabase?.connection?._id == data._id && $currentDatabase?.name == data.defaultDatabase
|
||||||
: $currentDatabase?.connection?._id == data._id}
|
: $currentDatabase?.connection?._id == data._id}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
export let padRight = false;
|
export let padRight = false;
|
||||||
export let style = null;
|
export let style = null;
|
||||||
export let colorClass = null;
|
export let colorClass = null;
|
||||||
|
$: isSvgString = icon && icon.trim().startsWith('<svg');
|
||||||
|
|
||||||
const iconNames = {
|
const iconNames = {
|
||||||
'icon minus-box': 'mdi mdi-minus-box-outline',
|
'icon minus-box': 'mdi mdi-minus-box-outline',
|
||||||
@@ -357,6 +358,19 @@
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{#if isSvgString}
|
||||||
|
<span
|
||||||
|
class="svg-inline"
|
||||||
|
class:padLeft
|
||||||
|
class:padRight
|
||||||
|
{title}
|
||||||
|
{style}
|
||||||
|
on:click
|
||||||
|
data-testid={$$props['data-testid']}
|
||||||
|
>
|
||||||
|
{@html icon}
|
||||||
|
</span>
|
||||||
|
{:else}
|
||||||
<span
|
<span
|
||||||
class={`${iconNames[icon] || icon} ${colorClass || ''}`}
|
class={`${iconNames[icon] || icon} ${colorClass || ''}`}
|
||||||
{title}
|
{title}
|
||||||
@@ -366,8 +380,18 @@
|
|||||||
on:click
|
on:click
|
||||||
data-testid={$$props['data-testid']}
|
data-testid={$$props['data-testid']}
|
||||||
/>
|
/>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.svg-inline {
|
||||||
|
display: inline-block;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
.svg-inline :global(svg) {
|
||||||
|
width: 1.125em;
|
||||||
|
height: 1.125em;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
.padLeft {
|
.padLeft {
|
||||||
margin-left: 0.25rem;
|
margin-left: 0.25rem;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user