mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-23 16:16:02 +00:00
SYNC: renamed table cell view => form cell view
This commit is contained in:
committed by
Diflow
parent
6c317b6e64
commit
088dfcd4dc
@@ -14,6 +14,8 @@
|
|||||||
import CloseSearchButton from '../buttons/CloseSearchButton.svelte';
|
import CloseSearchButton from '../buttons/CloseSearchButton.svelte';
|
||||||
import { _t } from '../translations';
|
import { _t } from '../translations';
|
||||||
import ColumnLabel from '../elements/ColumnLabel.svelte';
|
import ColumnLabel from '../elements/ColumnLabel.svelte';
|
||||||
|
import CheckboxField from '../forms/CheckboxField.svelte';
|
||||||
|
import { getLocalStorage, setLocalStorage } from '../utility/storageCache';
|
||||||
|
|
||||||
export let selection;
|
export let selection;
|
||||||
|
|
||||||
@@ -46,6 +48,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let filter = '';
|
let filter = '';
|
||||||
|
let notNull = getLocalStorage('dataGridCellDataFormNotNull') === 'true';
|
||||||
|
|
||||||
$: orderedFields = realColumnUniqueNames
|
$: orderedFields = realColumnUniqueNames
|
||||||
.map(colName => {
|
.map(colName => {
|
||||||
@@ -65,7 +68,14 @@
|
|||||||
})
|
})
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
|
|
||||||
$: filteredFields = orderedFields.filter(field => filterName(filter, field.columnName));
|
$: filteredFields = orderedFields
|
||||||
|
.filter(field => filterName(filter, field.columnName))
|
||||||
|
.filter(field => {
|
||||||
|
if (notNull) {
|
||||||
|
return field.value != null;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
let editingColumn = null;
|
let editingColumn = null;
|
||||||
let editValue = '';
|
let editValue = '';
|
||||||
@@ -142,12 +152,8 @@
|
|||||||
case keycodes.upArrow:
|
case keycodes.upArrow:
|
||||||
case keycodes.downArrow:
|
case keycodes.downArrow:
|
||||||
const reverse = event.keyCode === keycodes.upArrow || (event.keyCode === keycodes.tab && event.shiftKey);
|
const reverse = event.keyCode === keycodes.upArrow || (event.keyCode === keycodes.tab && event.shiftKey);
|
||||||
if (isChangedRef.get()) {
|
|
||||||
saveValue(field);
|
|
||||||
}
|
|
||||||
editingColumn = null;
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
moveToNextField(field, reverse)
|
moveToNextField(field, reverse);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,10 +161,16 @@
|
|||||||
function moveToNextField(field, reverse) {
|
function moveToNextField(field, reverse) {
|
||||||
const currentIndex = filteredFields.findIndex(f => f.uniqueName === field.uniqueName);
|
const currentIndex = filteredFields.findIndex(f => f.uniqueName === field.uniqueName);
|
||||||
const nextIndex = reverse ? currentIndex - 1 : currentIndex + 1;
|
const nextIndex = reverse ? currentIndex - 1 : currentIndex + 1;
|
||||||
|
const nextField = filteredFields[nextIndex];
|
||||||
|
if (!nextField) return;
|
||||||
|
|
||||||
|
if (isChangedRef.get()) {
|
||||||
|
saveValue(field);
|
||||||
|
}
|
||||||
|
editingColumn = null;
|
||||||
if (nextIndex < 0 || nextIndex >= filteredFields.length) return;
|
if (nextIndex < 0 || nextIndex >= filteredFields.length) return;
|
||||||
|
|
||||||
tick().then(() => {
|
tick().then(() => {
|
||||||
const nextField = filteredFields[nextIndex];
|
|
||||||
if (isJsonValue(nextField.value)) {
|
if (isJsonValue(nextField.value)) {
|
||||||
openEditModal(nextField);
|
openEditModal(nextField);
|
||||||
} else {
|
} else {
|
||||||
@@ -234,6 +246,14 @@
|
|||||||
/>
|
/>
|
||||||
<CloseSearchButton bind:filter />
|
<CloseSearchButton bind:filter />
|
||||||
</SearchBoxWrapper>
|
</SearchBoxWrapper>
|
||||||
|
<CheckboxField
|
||||||
|
on:change={e => {
|
||||||
|
// @ts-ignore
|
||||||
|
notNull = e.target.checked;
|
||||||
|
setLocalStorage('dataGridCellDataFormNotNull', notNull ? 'true' : 'false');
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{_t('tableCell.notNull', { defaultMessage: 'Not null' })}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
@@ -307,6 +327,8 @@
|
|||||||
.search-wrapper {
|
.search-wrapper {
|
||||||
padding: 4px 4px 0 4px;
|
padding: 4px 4px 0 4px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
border: 1px solid var(--theme-border);
|
||||||
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.inner {
|
.inner {
|
||||||
@@ -13,9 +13,9 @@
|
|||||||
single: false,
|
single: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'table',
|
type: 'form',
|
||||||
title: 'Table - Row',
|
title: 'Form',
|
||||||
component: TableCellView,
|
component: FormCellView,
|
||||||
single: false,
|
single: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
|
|
||||||
function autodetect(selection) {
|
function autodetect(selection) {
|
||||||
if (selection[0]?.isSelectedFullRow) {
|
if (selection[0]?.isSelectedFullRow) {
|
||||||
return 'table';
|
return 'form';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectionCouldBeShownOnMap(selection)) {
|
if (selectionCouldBeShownOnMap(selection)) {
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
import JsonRowView from '../celldata/JsonRowView.svelte';
|
import JsonRowView from '../celldata/JsonRowView.svelte';
|
||||||
import MapCellView from '../celldata/MapCellView.svelte';
|
import MapCellView from '../celldata/MapCellView.svelte';
|
||||||
import PictureCellView from '../celldata/PictureCellView.svelte';
|
import PictureCellView from '../celldata/PictureCellView.svelte';
|
||||||
import TableCellView from '../celldata/TableCellView.svelte';
|
import FormCellView from '../celldata/FormCellView.svelte';
|
||||||
import TextCellViewNoWrap from '../celldata/TextCellViewNoWrap.svelte';
|
import TextCellViewNoWrap from '../celldata/TextCellViewNoWrap.svelte';
|
||||||
import TextCellViewWrap from '../celldata/TextCellViewWrap.svelte';
|
import TextCellViewWrap from '../celldata/TextCellViewWrap.svelte';
|
||||||
import ErrorInfo from '../elements/ErrorInfo.svelte';
|
import ErrorInfo from '../elements/ErrorInfo.svelte';
|
||||||
|
|||||||
Reference in New Issue
Block a user