mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-27 16:06:23 +00:00
secondary edit button
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import _ from 'lodash';
|
import _, { isPlainObject } from 'lodash';
|
||||||
import ShowFormButton from '../formview/ShowFormButton.svelte';
|
import ShowFormButton from '../formview/ShowFormButton.svelte';
|
||||||
import { detectTypeIcon, getConvertValueMenu, isJsonLikeLongString, safeJsonParse } from 'dbgate-tools';
|
import { detectTypeIcon, getConvertValueMenu, isJsonLikeLongString, safeJsonParse } from 'dbgate-tools';
|
||||||
import { openJsonDocument } from '../tabs/JsonTab.svelte';
|
import { openJsonDocument } from '../tabs/JsonTab.svelte';
|
||||||
@@ -84,6 +84,22 @@
|
|||||||
menu={() => getConvertValueMenu(value, onSetValue, editorTypes)}
|
menu={() => getConvertValueMenu(value, onSetValue, editorTypes)}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if _.isPlainObject(value)}
|
||||||
|
<ShowFormButton secondary icon="icon open-in-new" on:click={() => openJsonDocument(value, undefined, true)} />
|
||||||
|
{/if}
|
||||||
|
{#if _.isArray(value)}
|
||||||
|
<ShowFormButton
|
||||||
|
secondary
|
||||||
|
icon="icon open-in-new"
|
||||||
|
on:click={() => {
|
||||||
|
if (_.every(value, x => _.isPlainObject(x))) {
|
||||||
|
openJsonLinesData(value);
|
||||||
|
} else {
|
||||||
|
openJsonDocument(value, undefined, true);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
{:else if col.foreignKey && rowData && rowData[col.uniqueName] && !isCurrentCell}
|
{:else if col.foreignKey && rowData && rowData[col.uniqueName] && !isCurrentCell}
|
||||||
<ShowFormButton on:click={() => onSetFormView(rowData, col)} />
|
<ShowFormButton on:click={() => onSetFormView(rowData, col)} />
|
||||||
{:else if col.foreignKey && isCurrentCell && onDictionaryLookup}
|
{:else if col.foreignKey && isCurrentCell && onDictionaryLookup}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import FontIcon from '../icons/FontIcon.svelte';
|
import FontIcon from '../icons/FontIcon.svelte';
|
||||||
|
|
||||||
export let icon = 'icon form';
|
export let icon = 'icon form';
|
||||||
|
export let secondary = false;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
@@ -9,6 +10,7 @@
|
|||||||
on:mousedown|stopPropagation|preventDefault
|
on:mousedown|stopPropagation|preventDefault
|
||||||
on:mouseup|stopPropagation|preventDefault
|
on:mouseup|stopPropagation|preventDefault
|
||||||
class="showFormButtonMarker"
|
class="showFormButtonMarker"
|
||||||
|
class:secondary
|
||||||
>
|
>
|
||||||
<FontIcon {icon} />
|
<FontIcon {icon} />
|
||||||
</div>
|
</div>
|
||||||
@@ -23,6 +25,10 @@
|
|||||||
border: 1px solid var(--theme-bg-1);
|
border: 1px solid var(--theme-bg-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.secondary {
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
div:hover {
|
div:hover {
|
||||||
color: var(--theme-font-hover);
|
color: var(--theme-font-hover);
|
||||||
border: var(--theme-border);
|
border: var(--theme-border);
|
||||||
|
|||||||
Reference in New Issue
Block a user