mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
fixed TS + code tidy
This commit is contained in:
parent
4e97f54bd4
commit
eb04f56662
@ -6,12 +6,8 @@ export * from './TableGridDisplay';
|
||||
export * from './ViewGridDisplay';
|
||||
export * from './JslGridDisplay';
|
||||
export * from './ChangeSet';
|
||||
export * from './FreeTableGridDisplay';
|
||||
export * from './FreeTableModel';
|
||||
export * from './MacroDefinition';
|
||||
export * from './runMacro';
|
||||
// export * from './FormViewDisplay';
|
||||
// export * from './TableFormViewDisplay';
|
||||
export * from './CollectionGridDisplay';
|
||||
export * from './deleteCascade';
|
||||
export * from './PerspectiveDisplay';
|
||||
|
@ -57,8 +57,8 @@
|
||||
import HorizontalSplitter from '../elements/HorizontalSplitter.svelte';
|
||||
import VerticalSplitter from '../elements/VerticalSplitter.svelte';
|
||||
import FormViewFilters from '../formview/FormViewFilters.svelte';
|
||||
import MacroDetail from '../freetable/MacroDetail.svelte';
|
||||
import MacroManager from '../freetable/MacroManager.svelte';
|
||||
import MacroDetail from '../macro/MacroDetail.svelte';
|
||||
import MacroManager from '../macro/MacroManager.svelte';
|
||||
import WidgetColumnBar from '../widgets/WidgetColumnBar.svelte';
|
||||
import WidgetColumnBarItem from '../widgets/WidgetColumnBarItem.svelte';
|
||||
import ColumnManager from './ColumnManager.svelte';
|
||||
|
@ -1,50 +0,0 @@
|
||||
<script lang="ts">
|
||||
import FontIcon from '../icons/FontIcon.svelte';
|
||||
|
||||
export let column;
|
||||
export let onEdit;
|
||||
export let onRemove;
|
||||
export let onUp;
|
||||
export let onDown;
|
||||
</script>
|
||||
|
||||
<div class="row">
|
||||
<div class="name">{column.columnName}</div>
|
||||
<div class="nowrap">
|
||||
<span class="icon" on:click={onEdit}>
|
||||
<FontIcon icon="icon edit" />
|
||||
</span>
|
||||
<span class="icon" on:click={onRemove}>
|
||||
<FontIcon icon="icon delete" />
|
||||
</span>
|
||||
<span class="icon" on:click={onUp}>
|
||||
<FontIcon icon="icon arrow-up" />
|
||||
</span>
|
||||
<span class="icon" on:click={onDown}>
|
||||
<FontIcon icon="icon arrow-down" />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
cursor: pointer;
|
||||
}
|
||||
.row:hover {
|
||||
background-color: var(--theme-bg-selected);
|
||||
}
|
||||
.name {
|
||||
white-space: nowrap;
|
||||
margin: 5px;
|
||||
}
|
||||
.icon {
|
||||
position: relative;
|
||||
top: 5px;
|
||||
padding: 5px;
|
||||
}
|
||||
.icon:hover {
|
||||
background-color: var(--theme-bg-3);
|
||||
}
|
||||
</style>
|
@ -1,55 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import keycodes from '../utility/keycodes';
|
||||
|
||||
export let onEnter;
|
||||
export let onBlur = undefined;
|
||||
export let focusOnCreate = false;
|
||||
export let blurOnEnter = false;
|
||||
export let existingNames;
|
||||
export let defaultValue = '';
|
||||
|
||||
let domEditor;
|
||||
let value = defaultValue || '';
|
||||
$: isError = value && existingNames && existingNames.includes(value);
|
||||
|
||||
const handleKeyDown = event => {
|
||||
if (value && event.keyCode == keycodes.enter && !isError) {
|
||||
onEnter(value);
|
||||
value = '';
|
||||
if (blurOnEnter) domEditor.blur();
|
||||
}
|
||||
if (event.keyCode == keycodes.escape) {
|
||||
value = '';
|
||||
domEditor.blur();
|
||||
}
|
||||
};
|
||||
const handleBlur = () => {
|
||||
if (value && !isError) {
|
||||
onEnter(value);
|
||||
value = '';
|
||||
}
|
||||
if (onBlur) onBlur();
|
||||
};
|
||||
if (focusOnCreate) onMount(() => domEditor.focus());
|
||||
</script>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
{...$$restProps}
|
||||
bind:value
|
||||
bind:this={domEditor}
|
||||
on:keydown={handleKeyDown}
|
||||
on:blur={handleBlur}
|
||||
class:isError
|
||||
/>
|
||||
|
||||
<style>
|
||||
input {
|
||||
width: calc(100% - 10px);
|
||||
}
|
||||
|
||||
input.isError {
|
||||
background: var(--theme-bg-red);
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user