feat(grid): allow disabling striped row background
This commit is contained in:
1 parent
e3ea4740c0
commit
1edbb7b935
23 files changed
+144
-6
No files matched your search
@@ -753,6 +753,7 @@ const editMultiStatementDefaultView = ref<MultiStatementDefaultView>(settingsSto
|
|||||||
const editDataGridAutoTransposeSingleRow = ref(settingsStore.editorSettings.dataGridAutoTransposeSingleRow);
|
const editDataGridAutoTransposeSingleRow = ref(settingsStore.editorSettings.dataGridAutoTransposeSingleRow);
|
||||||
const editDataGridCellDetailButtonVisible = ref(settingsStore.editorSettings.dataGridCellDetailButtonVisible);
|
const editDataGridCellDetailButtonVisible = ref(settingsStore.editorSettings.dataGridCellDetailButtonVisible);
|
||||||
const editDataGridCrosshairHighlight = ref(settingsStore.editorSettings.dataGridCrosshairHighlight);
|
const editDataGridCrosshairHighlight = ref(settingsStore.editorSettings.dataGridCrosshairHighlight);
|
||||||
|
const editDataGridStripedRows = ref(settingsStore.editorSettings.dataGridStripedRows);
|
||||||
const editPageSize = ref(settingsStore.editorSettings.pageSize);
|
const editPageSize = ref(settingsStore.editorSettings.pageSize);
|
||||||
const editTableOpenPageSize = ref(settingsStore.editorSettings.tableOpenPageSize);
|
const editTableOpenPageSize = ref(settingsStore.editorSettings.tableOpenPageSize);
|
||||||
const editTableOpenSortMode = ref(settingsStore.editorSettings.tableOpenSortMode);
|
const editTableOpenSortMode = ref(settingsStore.editorSettings.tableOpenSortMode);
|
||||||
@@ -1108,6 +1109,7 @@ function currentEditorSettingsDraft(): EditorSettingsDraft {
|
|||||||
dataGridAutoTransposeSingleRow: editDataGridAutoTransposeSingleRow.value,
|
dataGridAutoTransposeSingleRow: editDataGridAutoTransposeSingleRow.value,
|
||||||
dataGridCellDetailButtonVisible: editDataGridCellDetailButtonVisible.value,
|
dataGridCellDetailButtonVisible: editDataGridCellDetailButtonVisible.value,
|
||||||
dataGridCrosshairHighlight: editDataGridCrosshairHighlight.value,
|
dataGridCrosshairHighlight: editDataGridCrosshairHighlight.value,
|
||||||
|
dataGridStripedRows: editDataGridStripedRows.value,
|
||||||
flatteningMultiLineText: editFlatteningMultiLineText.value,
|
flatteningMultiLineText: editFlatteningMultiLineText.value,
|
||||||
dataGridShowWhitespace: editDataGridShowWhitespace.value,
|
dataGridShowWhitespace: editDataGridShowWhitespace.value,
|
||||||
pageSize: editPageSize.value,
|
pageSize: editPageSize.value,
|
||||||
@@ -1778,6 +1780,7 @@ function syncEditorSettingsDraftFromStore() {
|
|||||||
editDataGridAutoTransposeSingleRow.value = settingsStore.editorSettings.dataGridAutoTransposeSingleRow;
|
editDataGridAutoTransposeSingleRow.value = settingsStore.editorSettings.dataGridAutoTransposeSingleRow;
|
||||||
editDataGridCellDetailButtonVisible.value = settingsStore.editorSettings.dataGridCellDetailButtonVisible;
|
editDataGridCellDetailButtonVisible.value = settingsStore.editorSettings.dataGridCellDetailButtonVisible;
|
||||||
editDataGridCrosshairHighlight.value = settingsStore.editorSettings.dataGridCrosshairHighlight;
|
editDataGridCrosshairHighlight.value = settingsStore.editorSettings.dataGridCrosshairHighlight;
|
||||||
|
editDataGridStripedRows.value = settingsStore.editorSettings.dataGridStripedRows;
|
||||||
editFlatteningMultiLineText.value = settingsStore.editorSettings.flatteningMultiLineText;
|
editFlatteningMultiLineText.value = settingsStore.editorSettings.flatteningMultiLineText;
|
||||||
editDataGridShowWhitespace.value = settingsStore.editorSettings.dataGridShowWhitespace;
|
editDataGridShowWhitespace.value = settingsStore.editorSettings.dataGridShowWhitespace;
|
||||||
editPageSize.value = settingsStore.editorSettings.pageSize;
|
editPageSize.value = settingsStore.editorSettings.pageSize;
|
||||||
@@ -1923,6 +1926,7 @@ const editorSettingsDraftRefs: EditorSettingsDraftRefMap = {
|
|||||||
dataGridAutoTransposeSingleRow: editDataGridAutoTransposeSingleRow,
|
dataGridAutoTransposeSingleRow: editDataGridAutoTransposeSingleRow,
|
||||||
dataGridCellDetailButtonVisible: editDataGridCellDetailButtonVisible,
|
dataGridCellDetailButtonVisible: editDataGridCellDetailButtonVisible,
|
||||||
dataGridCrosshairHighlight: editDataGridCrosshairHighlight,
|
dataGridCrosshairHighlight: editDataGridCrosshairHighlight,
|
||||||
|
dataGridStripedRows: editDataGridStripedRows,
|
||||||
pageSize: editPageSize,
|
pageSize: editPageSize,
|
||||||
tableOpenPageSize: editTableOpenPageSize,
|
tableOpenPageSize: editTableOpenPageSize,
|
||||||
tableOpenSortMode: editTableOpenSortMode,
|
tableOpenSortMode: editTableOpenSortMode,
|
||||||
@@ -2503,6 +2507,7 @@ function resetDefaultsForTab(tab: SettingsCategory) {
|
|||||||
editDataGridAutoTransposeSingleRow.value = DEFAULT_EDITOR_SETTINGS.dataGridAutoTransposeSingleRow;
|
editDataGridAutoTransposeSingleRow.value = DEFAULT_EDITOR_SETTINGS.dataGridAutoTransposeSingleRow;
|
||||||
editDataGridCellDetailButtonVisible.value = DEFAULT_EDITOR_SETTINGS.dataGridCellDetailButtonVisible;
|
editDataGridCellDetailButtonVisible.value = DEFAULT_EDITOR_SETTINGS.dataGridCellDetailButtonVisible;
|
||||||
editDataGridCrosshairHighlight.value = DEFAULT_EDITOR_SETTINGS.dataGridCrosshairHighlight;
|
editDataGridCrosshairHighlight.value = DEFAULT_EDITOR_SETTINGS.dataGridCrosshairHighlight;
|
||||||
|
editDataGridStripedRows.value = DEFAULT_EDITOR_SETTINGS.dataGridStripedRows;
|
||||||
editFlatteningMultiLineText.value = DEFAULT_EDITOR_SETTINGS.flatteningMultiLineText;
|
editFlatteningMultiLineText.value = DEFAULT_EDITOR_SETTINGS.flatteningMultiLineText;
|
||||||
editDataGridShowWhitespace.value = DEFAULT_EDITOR_SETTINGS.dataGridShowWhitespace;
|
editDataGridShowWhitespace.value = DEFAULT_EDITOR_SETTINGS.dataGridShowWhitespace;
|
||||||
editPageSize.value = DEFAULT_EDITOR_SETTINGS.pageSize;
|
editPageSize.value = DEFAULT_EDITOR_SETTINGS.pageSize;
|
||||||
@@ -2616,6 +2621,7 @@ function resetAllDefaults() {
|
|||||||
editDataGridAutoTransposeSingleRow.value = DEFAULT_EDITOR_SETTINGS.dataGridAutoTransposeSingleRow;
|
editDataGridAutoTransposeSingleRow.value = DEFAULT_EDITOR_SETTINGS.dataGridAutoTransposeSingleRow;
|
||||||
editDataGridCellDetailButtonVisible.value = DEFAULT_EDITOR_SETTINGS.dataGridCellDetailButtonVisible;
|
editDataGridCellDetailButtonVisible.value = DEFAULT_EDITOR_SETTINGS.dataGridCellDetailButtonVisible;
|
||||||
editDataGridCrosshairHighlight.value = DEFAULT_EDITOR_SETTINGS.dataGridCrosshairHighlight;
|
editDataGridCrosshairHighlight.value = DEFAULT_EDITOR_SETTINGS.dataGridCrosshairHighlight;
|
||||||
|
editDataGridStripedRows.value = DEFAULT_EDITOR_SETTINGS.dataGridStripedRows;
|
||||||
editFlatteningMultiLineText.value = DEFAULT_EDITOR_SETTINGS.flatteningMultiLineText;
|
editFlatteningMultiLineText.value = DEFAULT_EDITOR_SETTINGS.flatteningMultiLineText;
|
||||||
editDataGridShowWhitespace.value = DEFAULT_EDITOR_SETTINGS.dataGridShowWhitespace;
|
editDataGridShowWhitespace.value = DEFAULT_EDITOR_SETTINGS.dataGridShowWhitespace;
|
||||||
editPageSize.value = DEFAULT_EDITOR_SETTINGS.pageSize;
|
editPageSize.value = DEFAULT_EDITOR_SETTINGS.pageSize;
|
||||||
@@ -8678,6 +8684,17 @@ onUnmounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
<Switch id="data-grid-crosshair-highlight" v-model="editDataGridCrosshairHighlight" />
|
<Switch id="data-grid-crosshair-highlight" v-model="editDataGridCrosshairHighlight" />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="settings-item flex items-center justify-between gap-4 rounded-md border bg-muted/20 px-3 py-2">
|
||||||
|
<div class="space-y-1">
|
||||||
|
<Label for="data-grid-striped-rows">
|
||||||
|
{{ t("settings.dataGridStripedRows") }}
|
||||||
|
</Label>
|
||||||
|
<p class="text-xs text-muted-foreground">
|
||||||
|
{{ t("settings.dataGridStripedRowsDescription") }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<Switch id="data-grid-striped-rows" v-model="editDataGridStripedRows" />
|
||||||
|
</div>
|
||||||
<div class="settings-item flex items-center justify-between gap-4 rounded-md border bg-muted/20 px-3 py-2">
|
<div class="settings-item flex items-center justify-between gap-4 rounded-md border bg-muted/20 px-3 py-2">
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<Label for="data-grid-show-whitespace">{{ t("settings.dataGridShowWhitespace") }}</Label>
|
<Label for="data-grid-show-whitespace">{{ t("settings.dataGridShowWhitespace") }}</Label>
|
||||||
|
|||||||
@@ -839,6 +839,7 @@ const paginationMaxRows = computed(() => (isResultsContext.value ? queryResultMa
|
|||||||
const infiniteScrollMaxRows = computed(() => continuousQueryResultMaxRows(settingsStore.editorSettings.queryResultMaxRowsEnabled, settingsStore.editorSettings.queryResultMaxRows));
|
const infiniteScrollMaxRows = computed(() => continuousQueryResultMaxRows(settingsStore.editorSettings.queryResultMaxRowsEnabled, settingsStore.editorSettings.queryResultMaxRows));
|
||||||
const showWhitespaceEnabled = computed(() => settingsStore.editorSettings.dataGridShowWhitespace);
|
const showWhitespaceEnabled = computed(() => settingsStore.editorSettings.dataGridShowWhitespace);
|
||||||
const flatteningMultiLineEnabled = computed(() => settingsStore.editorSettings.flatteningMultiLineText);
|
const flatteningMultiLineEnabled = computed(() => settingsStore.editorSettings.flatteningMultiLineText);
|
||||||
|
const dataGridStripedRows = computed(() => settingsStore.editorSettings.dataGridStripedRows);
|
||||||
const expandedCellEditor = ref<{ rowId: number; col: number } | null>(null);
|
const expandedCellEditor = ref<{ rowId: number; col: number } | null>(null);
|
||||||
const readonlyTextCell = ref<{
|
const readonlyTextCell = ref<{
|
||||||
rowId: number;
|
rowId: number;
|
||||||
@@ -7025,7 +7026,7 @@ function dataGridRowStyle(item: RowItem): CSSProperties {
|
|||||||
? dark
|
? dark
|
||||||
? "rgb(51, 51, 55)"
|
? "rgb(51, 51, 55)"
|
||||||
: "rgb(243, 243, 243)"
|
: "rgb(243, 243, 243)"
|
||||||
: item.displayIndex % 2 === 1
|
: dataGridStripedRows.value && item.displayIndex % 2 === 1
|
||||||
? `var(--data-grid-row-muted-bg, ${dark ? DATA_GRID_DARK_STRIPED_ROW_BG : DATA_GRID_LIGHT_STRIPED_ROW_BG})`
|
? `var(--data-grid-row-muted-bg, ${dark ? DATA_GRID_DARK_STRIPED_ROW_BG : DATA_GRID_LIGHT_STRIPED_ROW_BG})`
|
||||||
: "var(--data-grid-background)";
|
: "var(--data-grid-background)";
|
||||||
const rowNumberBg =
|
const rowNumberBg =
|
||||||
@@ -7102,7 +7103,9 @@ const dataGridTypeColorKey = computed(() => {
|
|||||||
const colors = resolveActiveDataGridTypeColors(settings.dataGridTypeColorSchemes, settings.activeDataGridTypeColorSchemeId);
|
const colors = resolveActiveDataGridTypeColors(settings.dataGridTypeColorSchemes, settings.activeDataGridTypeColorSchemeId);
|
||||||
return colors ? DATA_GRID_TYPE_COLOR_KEYS.map((key) => colors[key]).join(",") : "auto";
|
return colors ? DATA_GRID_TYPE_COLOR_KEYS.map((key) => colors[key]).join(",") : "auto";
|
||||||
});
|
});
|
||||||
const canvasRenderStyleKey = computed(() => `${settingsStore.editorSettings.theme}:${settingsStore.editorSettings.uiScale}:${canvasBackingPixelRatio.value}:${isDark.value}:${themePalette.value}:${tableFontFamily.value}:${tableFontSize.value}:${!!saveError.value}:${dataGridTypeColorKey.value}`);
|
const canvasRenderStyleKey = computed(
|
||||||
|
() => `${settingsStore.editorSettings.theme}:${settingsStore.editorSettings.uiScale}:${canvasBackingPixelRatio.value}:${isDark.value}:${themePalette.value}:${tableFontFamily.value}:${tableFontSize.value}:${!!saveError.value}:${dataGridTypeColorKey.value}:${dataGridStripedRows.value}`,
|
||||||
|
);
|
||||||
const CANVAS_MOUSE_WHEEL_SCROLL_MULTIPLIER = 1.5;
|
const CANVAS_MOUSE_WHEEL_SCROLL_MULTIPLIER = 1.5;
|
||||||
const CANVAS_TRACKPAD_DELTA_THRESHOLD = 40;
|
const CANVAS_TRACKPAD_DELTA_THRESHOLD = 40;
|
||||||
let canvasPixelRatioMediaQuery: MediaQueryList | null = null;
|
let canvasPixelRatioMediaQuery: MediaQueryList | null = null;
|
||||||
@@ -7877,6 +7880,7 @@ function drawCanvasGrid() {
|
|||||||
booleanDisplayMode: booleanDisplayMode.value,
|
booleanDisplayMode: booleanDisplayMode.value,
|
||||||
flatteningMultiLineEnabled: flatteningMultiLineEnabled.value,
|
flatteningMultiLineEnabled: flatteningMultiLineEnabled.value,
|
||||||
showWhitespace: showWhitespaceEnabled.value,
|
showWhitespace: showWhitespaceEnabled.value,
|
||||||
|
stripedRows: dataGridStripedRows.value,
|
||||||
rowNumberMode: dataGridRowNumberMode.value,
|
rowNumberMode: dataGridRowNumberMode.value,
|
||||||
});
|
});
|
||||||
if (!drawn) return;
|
if (!drawn) return;
|
||||||
@@ -7906,6 +7910,7 @@ watch(columnAligns, () => scheduleCanvasDraw());
|
|||||||
watch(booleanDisplayMode, () => scheduleCanvasDraw());
|
watch(booleanDisplayMode, () => scheduleCanvasDraw());
|
||||||
watch(flatteningMultiLineEnabled, () => scheduleCanvasDraw());
|
watch(flatteningMultiLineEnabled, () => scheduleCanvasDraw());
|
||||||
watch(showWhitespaceEnabled, () => scheduleCanvasDraw());
|
watch(showWhitespaceEnabled, () => scheduleCanvasDraw());
|
||||||
|
watch(dataGridStripedRows, () => scheduleCanvasDraw());
|
||||||
watch(colorizeDataGridCellTypes, () => scheduleCanvasDraw());
|
watch(colorizeDataGridCellTypes, () => scheduleCanvasDraw());
|
||||||
watch(
|
watch(
|
||||||
[
|
[
|
||||||
@@ -14064,7 +14069,7 @@ useUpdateBlocker(() => (hasPendingChanges.value || hasPendingDataEditorDraft.val
|
|||||||
'data-grid-row--deleted opacity-70': item.isDeleted,
|
'data-grid-row--deleted opacity-70': item.isDeleted,
|
||||||
'data-grid-row--new': item.isNew && !isRowActive(item.displayIndex),
|
'data-grid-row--new': item.isNew && !isRowActive(item.displayIndex),
|
||||||
'data-grid-row--draft': item.isDraft && !isRowActive(item.displayIndex),
|
'data-grid-row--draft': item.isDraft && !isRowActive(item.displayIndex),
|
||||||
'data-grid-row--striped': !item.isNew && !item.isDraft && !item.isDeleted && !isRowActive(item.displayIndex) && item.displayIndex % 2 === 1,
|
'data-grid-row--striped': dataGridStripedRows && !item.isNew && !item.isDraft && !item.isDeleted && !isRowActive(item.displayIndex) && item.displayIndex % 2 === 1,
|
||||||
'active-row': isRowActive(item.displayIndex) && !item.isDeleted,
|
'active-row': isRowActive(item.displayIndex) && !item.isDeleted,
|
||||||
'crosshair-row': !!crosshairTarget?.rowCrosshair && crosshairTarget.rowIndex === item.displayIndex && !item.isDeleted,
|
'crosshair-row': !!crosshairTarget?.rowCrosshair && crosshairTarget.rowIndex === item.displayIndex && !item.isDeleted,
|
||||||
'relative z-20 overflow-visible': editingCell?.rowId === item.id || readonlyTextCell?.rowId === item.id,
|
'relative z-20 overflow-visible': editingCell?.rowId === item.id || readonlyTextCell?.rowId === item.id,
|
||||||
|
|||||||
@@ -7254,6 +7254,8 @@ export default withEnglishFallback({
|
|||||||
infiniteScrollDescription: "Aşağıya sürüşdürdükdə növbəti toplunu avtomatik yüklə.",
|
infiniteScrollDescription: "Aşağıya sürüşdürdükdə növbəti toplunu avtomatik yüklə.",
|
||||||
dataGridShowWhitespace: "Boşluq simvollarını göstər",
|
dataGridShowWhitespace: "Boşluq simvollarını göstər",
|
||||||
dataGridShowWhitespaceDescription: "Verilənlər xanalarında boşluqları ·, tabulyasiyaları → kimi göstərir. Kopyalanan və redaktə edilən dəyərlər dəyişmir.",
|
dataGridShowWhitespaceDescription: "Verilənlər xanalarında boşluqları ·, tabulyasiyaları → kimi göstərir. Kopyalanan və redaktə edilən dəyərlər dəyişmir.",
|
||||||
|
dataGridStripedRows: "Zebra zolaqları",
|
||||||
|
dataGridStripedRowsDescription: "Aktiv olduqda verilənlər cədvəlində tək və cüt sətirlər fərqli fon rənglərində göstərilir.",
|
||||||
flatteningMultiLineText: "Çoxsətirli mətnin bir sətrə birləşdirilməsi",
|
flatteningMultiLineText: "Çoxsətirli mətnin bir sətrə birləşdirilməsi",
|
||||||
flatteningMultiLineTextDescription: "Çoxsətirli mətn bir sətirdə göstərilir, sətir keçidləri ¶ kimi göstərilir.",
|
flatteningMultiLineTextDescription: "Çoxsətirli mətn bir sətirdə göstərilir, sətir keçidləri ¶ kimi göstərilir.",
|
||||||
regexMaxMatchCount: "Hamısını seçmək üçün maksimum uyğunluq sayı",
|
regexMaxMatchCount: "Hamısını seçmək üçün maksimum uyğunluq sayı",
|
||||||
|
|||||||
@@ -8131,6 +8131,8 @@ export default {
|
|||||||
infiniteScrollDescription: "Automatically load the next batch when scrolling to the bottom.",
|
infiniteScrollDescription: "Automatically load the next batch when scrolling to the bottom.",
|
||||||
dataGridShowWhitespace: "Show whitespace",
|
dataGridShowWhitespace: "Show whitespace",
|
||||||
dataGridShowWhitespaceDescription: "Show spaces as · and tabs as → in data cells. Copied and edited values remain unchanged.",
|
dataGridShowWhitespaceDescription: "Show spaces as · and tabs as → in data cells. Copied and edited values remain unchanged.",
|
||||||
|
dataGridStripedRows: "Zebra stripes",
|
||||||
|
dataGridStripedRowsDescription: "When enabled, alternating rows in the data grid display different background colors.",
|
||||||
flatteningMultiLineText: "Flattening Multi-line Text",
|
flatteningMultiLineText: "Flattening Multi-line Text",
|
||||||
flatteningMultiLineTextDescription: "Multi-line text merged into single line display, with line breaks shown as ¶ .",
|
flatteningMultiLineTextDescription: "Multi-line text merged into single line display, with line breaks shown as ¶ .",
|
||||||
regexMaxMatchCount: "Maximum select-all matches",
|
regexMaxMatchCount: "Maximum select-all matches",
|
||||||
|
|||||||
@@ -7465,6 +7465,8 @@ export default withEnglishFallback({
|
|||||||
infiniteScrollDescription: "Carga automáticamente el siguiente lote al desplazarse hasta el final.",
|
infiniteScrollDescription: "Carga automáticamente el siguiente lote al desplazarse hasta el final.",
|
||||||
dataGridShowWhitespace: "Mostrar espacios en blanco",
|
dataGridShowWhitespace: "Mostrar espacios en blanco",
|
||||||
dataGridShowWhitespaceDescription: "Mostrar espacios como · y tabulaciones como → en las celdas. Los valores copiados y editados no cambian.",
|
dataGridShowWhitespaceDescription: "Mostrar espacios como · y tabulaciones como → en las celdas. Los valores copiados y editados no cambian.",
|
||||||
|
dataGridStripedRows: "Filas alternas (cebra)",
|
||||||
|
dataGridStripedRowsDescription: "Cuando esté activado, las filas pares e impares de la cuadrícula de datos muestran diferentes colores de fondo.",
|
||||||
flatteningMultiLineText: "Aplastar texto multilínea",
|
flatteningMultiLineText: "Aplastar texto multilínea",
|
||||||
flatteningMultiLineTextDescription: "El texto multilínea se fusiona en una sola línea de visualización, con los saltos de línea mostrados como ¶ .",
|
flatteningMultiLineTextDescription: "El texto multilínea se fusiona en una sola línea de visualización, con los saltos de línea mostrados como ¶ .",
|
||||||
regexMaxMatchCount: "Máximo de coincidencias al seleccionar todas",
|
regexMaxMatchCount: "Máximo de coincidencias al seleccionar todas",
|
||||||
|
|||||||
@@ -7924,6 +7924,8 @@ export default withEnglishFallback({
|
|||||||
infiniteScrollDescription: "Memuat batch berikutnya secara otomatis saat menggulir ke bawah.",
|
infiniteScrollDescription: "Memuat batch berikutnya secara otomatis saat menggulir ke bawah.",
|
||||||
dataGridShowWhitespace: "Tampilkan spasi putih",
|
dataGridShowWhitespace: "Tampilkan spasi putih",
|
||||||
dataGridShowWhitespaceDescription: "Tampilkan spasi sebagai · dan tab sebagai → pada sel data. Nilai yang disalin dan diedit tetap tidak berubah.",
|
dataGridShowWhitespaceDescription: "Tampilkan spasi sebagai · dan tab sebagai → pada sel data. Nilai yang disalin dan diedit tetap tidak berubah.",
|
||||||
|
dataGridStripedRows: "Garis zebra",
|
||||||
|
dataGridStripedRowsDescription: "Jika diaktifkan, baris ganjil dan genap pada kisi data akan menampilkan warna latar belakang yang berbeda.",
|
||||||
flatteningMultiLineText: "Meratakan Teks Multi-baris",
|
flatteningMultiLineText: "Meratakan Teks Multi-baris",
|
||||||
flatteningMultiLineTextDescription: "Teks multi-baris digabungkan menjadi tampilan satu baris, dengan pemutus baris ditampilkan sebagai ¶.",
|
flatteningMultiLineTextDescription: "Teks multi-baris digabungkan menjadi tampilan satu baris, dengan pemutus baris ditampilkan sebagai ¶.",
|
||||||
regexMaxMatchCount: "Jumlah maksimum hasil cocok pilih-semua",
|
regexMaxMatchCount: "Jumlah maksimum hasil cocok pilih-semua",
|
||||||
|
|||||||
@@ -7243,6 +7243,8 @@ export default withEnglishFallback({
|
|||||||
infiniteScrollDescription: "Carica automaticamente il blocco successivo quando scorri fino in fondo.",
|
infiniteScrollDescription: "Carica automaticamente il blocco successivo quando scorri fino in fondo.",
|
||||||
dataGridShowWhitespace: "Mostra spazi bianchi",
|
dataGridShowWhitespace: "Mostra spazi bianchi",
|
||||||
dataGridShowWhitespaceDescription: "Mostra gli spazi come · e le tabulazioni come → nelle celle. I valori copiati e modificati restano invariati.",
|
dataGridShowWhitespaceDescription: "Mostra gli spazi come · e le tabulazioni come → nelle celle. I valori copiati e modificati restano invariati.",
|
||||||
|
dataGridStripedRows: "Righe alternate (zebra)",
|
||||||
|
dataGridStripedRowsDescription: "Se attivato, le righe pari e dispari nella griglia dei dati mostrano colori di sfondo diversi.",
|
||||||
flatteningMultiLineText: "Pianifica automaticamente i testi multi-riga",
|
flatteningMultiLineText: "Pianifica automaticamente i testi multi-riga",
|
||||||
flatteningMultiLineTextDescription: "Se attivo, i testi multi-riga nei risultati vengono automaticamente pianificati in una singola colonna.",
|
flatteningMultiLineTextDescription: "Se attivo, i testi multi-riga nei risultati vengono automaticamente pianificati in una singola colonna.",
|
||||||
regexMaxMatchCount: "Numero massimo di corrispondenze per Seleziona tutte",
|
regexMaxMatchCount: "Numero massimo di corrispondenze per Seleziona tutte",
|
||||||
|
|||||||
@@ -8100,6 +8100,8 @@ export default withEnglishFallback({
|
|||||||
infiniteScrollDescription: "末尾までスクロールしたときに、次のデータを自動的に読み込みます。",
|
infiniteScrollDescription: "末尾までスクロールしたときに、次のデータを自動的に読み込みます。",
|
||||||
dataGridShowWhitespace: "空白文字を表示",
|
dataGridShowWhitespace: "空白文字を表示",
|
||||||
dataGridShowWhitespaceDescription: "データセルのスペースを ·、タブを → で表示します。コピーや編集する値は変わりません。",
|
dataGridShowWhitespaceDescription: "データセルのスペースを ·、タブを → で表示します。コピーや編集する値は変わりません。",
|
||||||
|
dataGridStripedRows: "ゼブラストライプ",
|
||||||
|
dataGridStripedRowsDescription: "有効にすると、データグリッドの奇数行と偶数行が異なる背景色で交互に表示されます。",
|
||||||
flatteningMultiLineText: "多行テキストを展開",
|
flatteningMultiLineText: "多行テキストを展開",
|
||||||
flatteningMultiLineTextDescription: "複数行のテキストを1行に結合して表示し、改行文字は¶として表示する。",
|
flatteningMultiLineTextDescription: "複数行のテキストを1行に結合して表示し、改行文字は¶として表示する。",
|
||||||
regexMaxMatchCount: "すべての一致を選択する最大数",
|
regexMaxMatchCount: "すべての一致を選択する最大数",
|
||||||
|
|||||||
@@ -7047,6 +7047,8 @@ export default withEnglishFallback({
|
|||||||
infiniteScrollDescription: "목록 하단으로 스크롤할 때 다음 데이터 묶음을 자동으로 불러옵니다.",
|
infiniteScrollDescription: "목록 하단으로 스크롤할 때 다음 데이터 묶음을 자동으로 불러옵니다.",
|
||||||
dataGridShowWhitespace: "공백 문자 표시",
|
dataGridShowWhitespace: "공백 문자 표시",
|
||||||
dataGridShowWhitespaceDescription: "데이터 셀의 공백을 ·, 탭을 →로 표시합니다. 복사하거나 편집하는 값은 변경되지 않습니다.",
|
dataGridShowWhitespaceDescription: "데이터 셀의 공백을 ·, 탭을 →로 표시합니다. 복사하거나 편집하는 값은 변경되지 않습니다.",
|
||||||
|
dataGridStripedRows: "줄무늬 행",
|
||||||
|
dataGridStripedRowsDescription: "활성화하면 데이터 그리드의 홀수 행과 짝수 행에 교차 배경색이 표시됩니다.",
|
||||||
flatteningMultiLineText: "멀티라인 텍스트 단순화",
|
flatteningMultiLineText: "멀티라인 텍스트 단순화",
|
||||||
flatteningMultiLineTextDescription: "다중 행 텍스트를 단일 행으로 병합하여 표시하고, 개행 문자는 ¶로 표시합니다.",
|
flatteningMultiLineTextDescription: "다중 행 텍스트를 단일 행으로 병합하여 표시하고, 개행 문자는 ¶로 표시합니다.",
|
||||||
tableColumnTemplateFields: "새 테이블 미리 정의된 필드",
|
tableColumnTemplateFields: "새 테이블 미리 정의된 필드",
|
||||||
|
|||||||
@@ -7245,6 +7245,8 @@ export default withEnglishFallback({
|
|||||||
infiniteScrollDescription: "Carregar automaticamente o próximo lote ao rolar até o final.",
|
infiniteScrollDescription: "Carregar automaticamente o próximo lote ao rolar até o final.",
|
||||||
dataGridShowWhitespace: "Mostrar espaços em branco",
|
dataGridShowWhitespace: "Mostrar espaços em branco",
|
||||||
dataGridShowWhitespaceDescription: "Mostrar espaços como · e tabulações como → nas células. Os valores copiados e editados permanecem inalterados.",
|
dataGridShowWhitespaceDescription: "Mostrar espaços como · e tabulações como → nas células. Os valores copiados e editados permanecem inalterados.",
|
||||||
|
dataGridStripedRows: "Linhas zebradas",
|
||||||
|
dataGridStripedRowsDescription: "Quando ativado, as linhas pares e ímpares na grade de dados exibem cores de fundo alternadas.",
|
||||||
flatteningMultiLineText: "Achatar texto multilinha",
|
flatteningMultiLineText: "Achatar texto multilinha",
|
||||||
flatteningMultiLineTextDescription: "Exibir texto multilinha em uma única linha.",
|
flatteningMultiLineTextDescription: "Exibir texto multilinha em uma única linha.",
|
||||||
regexMaxMatchCount: "Máximo de correspondências para selecionar todas",
|
regexMaxMatchCount: "Máximo de correspondências para selecionar todas",
|
||||||
|
|||||||
@@ -8449,6 +8449,8 @@ export default withEnglishFallback({
|
|||||||
infiniteScrollDescription: "Автоматически загружать следующую порцию при прокрутке до конца.",
|
infiniteScrollDescription: "Автоматически загружать следующую порцию при прокрутке до конца.",
|
||||||
dataGridShowWhitespace: "Показывать пробельные символы",
|
dataGridShowWhitespace: "Показывать пробельные символы",
|
||||||
dataGridShowWhitespaceDescription: "Показывать пробелы как ·, а табуляции как → в ячейках данных. Копируемые и редактируемые значения не меняются.",
|
dataGridShowWhitespaceDescription: "Показывать пробелы как ·, а табуляции как → в ячейках данных. Копируемые и редактируемые значения не меняются.",
|
||||||
|
dataGridStripedRows: "Чередование строк (зебра)",
|
||||||
|
dataGridStripedRowsDescription: "Если включено, четные и нечетные строки в таблице данных отображаются с чередующимся фоном.",
|
||||||
flatteningMultiLineText: "Объединение многострочного текста",
|
flatteningMultiLineText: "Объединение многострочного текста",
|
||||||
flatteningMultiLineTextDescription: "Многострочный текст отображается одной строкой, переносы строк показаны как ¶ .",
|
flatteningMultiLineTextDescription: "Многострочный текст отображается одной строкой, переносы строк показаны как ¶ .",
|
||||||
regexMaxMatchCount: "Максимум совпадений при выборе всех",
|
regexMaxMatchCount: "Максимум совпадений при выборе всех",
|
||||||
|
|||||||
@@ -7138,6 +7138,8 @@ export default withEnglishFallback({
|
|||||||
infiniteScrollDescription: "En alta kaydırıldığında sonraki grubu otomatik yükle.",
|
infiniteScrollDescription: "En alta kaydırıldığında sonraki grubu otomatik yükle.",
|
||||||
dataGridShowWhitespace: "Boşluk karakterlerini göster",
|
dataGridShowWhitespace: "Boşluk karakterlerini göster",
|
||||||
dataGridShowWhitespaceDescription: "Veri hücrelerinde boşlukları ·, sekmeleri → olarak gösterir. Kopyalanan ve düzenlenen değerler değişmez.",
|
dataGridShowWhitespaceDescription: "Veri hücrelerinde boşlukları ·, sekmeleri → olarak gösterir. Kopyalanan ve düzenlenen değerler değişmez.",
|
||||||
|
dataGridStripedRows: "Zebra çizgileri",
|
||||||
|
dataGridStripedRowsDescription: "Etkinleştirildiğinde veri tablosundaki tek ve çift satırlar farklı arka plan renkleriyle dönüşümlü olarak gösterilir.",
|
||||||
flatteningMultiLineText: "Çok Satırlı Metni Düzleştirme",
|
flatteningMultiLineText: "Çok Satırlı Metni Düzleştirme",
|
||||||
flatteningMultiLineTextDescription: "Çok satırlı metin, satır sonları ¶ ile gösterilerek tek satırda birleştirilir.",
|
flatteningMultiLineTextDescription: "Çok satırlı metin, satır sonları ¶ ile gösterilerek tek satırda birleştirilir.",
|
||||||
regexMaxMatchCount: 'En fazla "tümünü seç" eşleşmesi',
|
regexMaxMatchCount: 'En fazla "tümünü seç" eşleşmesi',
|
||||||
|
|||||||
@@ -8117,6 +8117,8 @@ export default withEnglishFallback({
|
|||||||
infiniteScrollDescription: "滚动到底部时自动加载下一批数据,无需手动翻页或加载。",
|
infiniteScrollDescription: "滚动到底部时自动加载下一批数据,无需手动翻页或加载。",
|
||||||
dataGridShowWhitespace: "显示空白字符",
|
dataGridShowWhitespace: "显示空白字符",
|
||||||
dataGridShowWhitespaceDescription: "在数据单元格中将空格显示为 ·,制表符显示为 →。复制和编辑的值保持不变。",
|
dataGridShowWhitespaceDescription: "在数据单元格中将空格显示为 ·,制表符显示为 →。复制和编辑的值保持不变。",
|
||||||
|
dataGridStripedRows: "数据表格斑马纹",
|
||||||
|
dataGridStripedRowsDescription: "开启后,数据表格奇偶行交替显示不同背景色,便于横向对齐浏览。",
|
||||||
flatteningMultiLineText: "扁平化多行文本",
|
flatteningMultiLineText: "扁平化多行文本",
|
||||||
flatteningMultiLineTextDescription: "多行文本合并为单行显示,换行符显示为 ¶ 。",
|
flatteningMultiLineTextDescription: "多行文本合并为单行显示,换行符显示为 ¶ 。",
|
||||||
regexMaxMatchCount: "全部选中最大数量",
|
regexMaxMatchCount: "全部选中最大数量",
|
||||||
|
|||||||
@@ -6593,6 +6593,8 @@ export default withEnglishFallback({
|
|||||||
infiniteScrollDescription: "滾動到底部時自動載入下一批資料,無需手動翻頁或載入。",
|
infiniteScrollDescription: "滾動到底部時自動載入下一批資料,無需手動翻頁或載入。",
|
||||||
dataGridShowWhitespace: "顯示空白字元",
|
dataGridShowWhitespace: "顯示空白字元",
|
||||||
dataGridShowWhitespaceDescription: "在資料儲存格中將空格顯示為 ·,定位字元顯示為 →。複製和編輯的值保持不變。",
|
dataGridShowWhitespaceDescription: "在資料儲存格中將空格顯示為 ·,定位字元顯示為 →。複製和編輯的值保持不變。",
|
||||||
|
dataGridStripedRows: "資料表格斑馬紋",
|
||||||
|
dataGridStripedRowsDescription: "開啟後,資料表格奇偶列交替顯示不同背景色,便於橫向對齊瀏覽。",
|
||||||
flatteningMultiLineText: "扁平多行文本",
|
flatteningMultiLineText: "扁平多行文本",
|
||||||
flatteningMultiLineTextDescription: "多行文本合併為單行顯示,換行符顯示為 ¶ 。",
|
flatteningMultiLineTextDescription: "多行文本合併為單行顯示,換行符顯示為 ¶ 。",
|
||||||
regexMaxMatchCount: "全部選取最大數量",
|
regexMaxMatchCount: "全部選取最大數量",
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ export interface DrawCanvasDataGridOptions {
|
|||||||
booleanDisplayMode?: "checkbox" | "dropdown";
|
booleanDisplayMode?: "checkbox" | "dropdown";
|
||||||
flatteningMultiLineEnabled: boolean;
|
flatteningMultiLineEnabled: boolean;
|
||||||
showWhitespace?: boolean;
|
showWhitespace?: boolean;
|
||||||
|
stripedRows?: boolean;
|
||||||
/** 行号栏取值:`view` = 当前视图序号(默认,与筛选前一致),`source` = 筛选前的原始行号 */
|
/** 行号栏取值:`view` = 当前视图序号(默认,与筛选前一致),`source` = 筛选前的原始行号 */
|
||||||
rowNumberMode?: "view" | "source";
|
rowNumberMode?: "view" | "source";
|
||||||
}
|
}
|
||||||
@@ -152,6 +153,15 @@ export function resolveCanvasBackingStoreMetrics(options: { width: number; heigh
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function resolveCanvasDataGridRowBase(theme: Pick<DataGridPaintTheme, "rowDeleted" | "rowNew" | "rowMuted" | "background">, item: Pick<CanvasDataGridRow, "isDeleted" | "isNew" | "isDraft" | "displayIndex">, options: { isActive: boolean; stripedRows?: boolean }): string {
|
||||||
|
const { isActive, stripedRows = true } = options;
|
||||||
|
if (item.isDeleted) return theme.rowDeleted;
|
||||||
|
if (item.isNew && !isActive) return theme.rowNew;
|
||||||
|
if (item.isDraft && !isActive) return theme.rowMuted;
|
||||||
|
if (stripedRows && item.displayIndex % 2 === 1 && !isActive) return theme.rowMuted;
|
||||||
|
return theme.background;
|
||||||
|
}
|
||||||
|
|
||||||
export function resolveCanvasDataGridRowFill(theme: Pick<DataGridPaintTheme, "cellActive" | "cellSelected">, rowBase: string, options: { isActive: boolean; isDeleted: boolean; isSelected: boolean }): string {
|
export function resolveCanvasDataGridRowFill(theme: Pick<DataGridPaintTheme, "cellActive" | "cellSelected">, rowBase: string, options: { isActive: boolean; isDeleted: boolean; isSelected: boolean }): string {
|
||||||
if (options.isSelected) return theme.cellSelected;
|
if (options.isSelected) return theme.cellSelected;
|
||||||
if (options.isActive && !options.isDeleted) return theme.cellActive;
|
if (options.isActive && !options.isDeleted) return theme.cellActive;
|
||||||
@@ -368,6 +378,7 @@ export function drawCanvasDataGrid(options: DrawCanvasDataGridOptions): boolean
|
|||||||
booleanDisplayMode = "dropdown",
|
booleanDisplayMode = "dropdown",
|
||||||
flatteningMultiLineEnabled,
|
flatteningMultiLineEnabled,
|
||||||
showWhitespace = false,
|
showWhitespace = false,
|
||||||
|
stripedRows = true,
|
||||||
rowNumberMode = "view",
|
rowNumberMode = "view",
|
||||||
} = options;
|
} = options;
|
||||||
// 框选热路径:整次绘制只判断一次。常见情况(单矩形 / 多列且每段都是多格)可跳过逐格 kind 查询
|
// 框选热路径:整次绘制只判断一次。常见情况(单矩形 / 多列且每段都是多格)可跳过逐格 kind 查询
|
||||||
@@ -430,7 +441,10 @@ export function drawCanvasDataGrid(options: DrawCanvasDataGridOptions): boolean
|
|||||||
const rowIsActive = isRowActive(item.displayIndex);
|
const rowIsActive = isRowActive(item.displayIndex);
|
||||||
const rowSelectionVisual = rowCellsUseSelectionVisual(item.id);
|
const rowSelectionVisual = rowCellsUseSelectionVisual(item.id);
|
||||||
|
|
||||||
const rowBase = item.isDeleted ? theme.rowDeleted : item.isNew && !rowIsActive ? theme.rowNew : item.isDraft && !rowIsActive ? theme.rowMuted : item.displayIndex % 2 === 1 && !rowIsActive ? theme.rowMuted : theme.background;
|
const rowBase = resolveCanvasDataGridRowBase(theme, item, {
|
||||||
|
isActive: rowIsActive,
|
||||||
|
stripedRows,
|
||||||
|
});
|
||||||
const rowFill = resolveCanvasDataGridRowFill(theme, rowBase, {
|
const rowFill = resolveCanvasDataGridRowFill(theme, rowBase, {
|
||||||
isActive: rowIsActive,
|
isActive: rowIsActive,
|
||||||
isDeleted: item.isDeleted,
|
isDeleted: item.isDeleted,
|
||||||
|
|||||||
@@ -114,4 +114,16 @@ describe("grid snapshot rendering", () => {
|
|||||||
expect(regular).not.toContain("integer");
|
expect(regular).not.toContain("integer");
|
||||||
expect(regular).not.toContain("Primary key");
|
expect(regular).not.toContain("Primary key");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("supports disabling striped row backgrounds", () => {
|
||||||
|
const source = {
|
||||||
|
columns: ["id"],
|
||||||
|
rows: [[1], [2]],
|
||||||
|
};
|
||||||
|
const defaultHtml = renderGridSnapshotHtml(source, { appearance: "light" });
|
||||||
|
expect(defaultHtml).toContain("background:rgb(240, 240, 240)");
|
||||||
|
|
||||||
|
const unstripedHtml = renderGridSnapshotHtml(source, { appearance: "light", stripedRows: false });
|
||||||
|
expect(unstripedHtml).not.toContain("background:rgb(240, 240, 240)");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
@@ -20,6 +20,7 @@ export interface GridSnapshotStyleOptions {
|
|||||||
showRowNumbers?: boolean;
|
showRowNumbers?: boolean;
|
||||||
wrapCells?: boolean;
|
wrapCells?: boolean;
|
||||||
transpose?: boolean;
|
transpose?: boolean;
|
||||||
|
stripedRows?: boolean;
|
||||||
fieldNameLabel?: string;
|
fieldNameLabel?: string;
|
||||||
compact?: boolean;
|
compact?: boolean;
|
||||||
}
|
}
|
||||||
@@ -152,7 +153,7 @@ export function renderGridSnapshotHtml(source: GridSnapshotSource, options: Grid
|
|||||||
const body = displayRows
|
const body = displayRows
|
||||||
.map(
|
.map(
|
||||||
(row, rowIndex) =>
|
(row, rowIndex) =>
|
||||||
`<tr style="background:${rowIndex % 2 === 1 ? GRID_SNAPSHOT_STRIPED_ROW[appearance] : GRID_SNAPSHOT_BACKGROUND[appearance]}">${showRowNumbers ? `<td class="dbx-grid-snapshot__cell dbx-grid-snapshot__cell--row-number" style="background:${GRID_SNAPSHOT_ROW_NUMBER[appearance]};color:${GRID_SNAPSHOT_MUTED[appearance]};padding:${cellPadding}">${rowIndex + 1}</td>` : ""}${transpose && showFieldNames ? renderFieldCell(source.columns[rowIndex] ?? "", rowIndex, "td") : ""}${row
|
`<tr style="background:${options.stripedRows !== false && rowIndex % 2 === 1 ? GRID_SNAPSHOT_STRIPED_ROW[appearance] : GRID_SNAPSHOT_BACKGROUND[appearance]}">${showRowNumbers ? `<td class="dbx-grid-snapshot__cell dbx-grid-snapshot__cell--row-number" style="background:${GRID_SNAPSHOT_ROW_NUMBER[appearance]};color:${GRID_SNAPSHOT_MUTED[appearance]};padding:${cellPadding}">${rowIndex + 1}</td>` : ""}${transpose && showFieldNames ? renderFieldCell(source.columns[rowIndex] ?? "", rowIndex, "td") : ""}${row
|
||||||
.map((value) => {
|
.map((value) => {
|
||||||
const nullClass = value === null ? " dbx-grid-snapshot__cell--null" : "";
|
const nullClass = value === null ? " dbx-grid-snapshot__cell--null" : "";
|
||||||
return `<td class="dbx-grid-snapshot__cell${wrapCells ? " dbx-grid-snapshot__cell--wrapped" : ""}${nullClass}" style="color:${value === null ? GRID_SNAPSHOT_MUTED[appearance] : GRID_SNAPSHOT_TEXT[appearance]};padding:${cellPadding}">${escapeHtml(formatGridSnapshotCell(value))}</td>`;
|
return `<td class="dbx-grid-snapshot__cell${wrapCells ? " dbx-grid-snapshot__cell--wrapped" : ""}${nullClass}" style="color:${value === null ? GRID_SNAPSHOT_MUTED[appearance] : GRID_SNAPSHOT_TEXT[appearance]};padding:${cellPadding}">${escapeHtml(formatGridSnapshotCell(value))}</td>`;
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ export const EDITOR_SETTINGS_DRAFT_KEYS = [
|
|||||||
"dataGridAutoTransposeSingleRow",
|
"dataGridAutoTransposeSingleRow",
|
||||||
"dataGridCellDetailButtonVisible",
|
"dataGridCellDetailButtonVisible",
|
||||||
"dataGridCrosshairHighlight",
|
"dataGridCrosshairHighlight",
|
||||||
|
"dataGridStripedRows",
|
||||||
"pageSize",
|
"pageSize",
|
||||||
"tableOpenPageSize",
|
"tableOpenPageSize",
|
||||||
"tableOpenSortMode",
|
"tableOpenSortMode",
|
||||||
|
|||||||
@@ -246,6 +246,7 @@ export const SETTINGS_SEARCH_DEFINITIONS: readonly SettingsSearchDefinition[] =
|
|||||||
{ id: "data-grid-filter-view", category: "data", titleKey: "settings.dataGridFilterView", descriptionKey: "settings.dataGridFilterViewDescription", targetId: "data-grid-filter-view" },
|
{ id: "data-grid-filter-view", category: "data", titleKey: "settings.dataGridFilterView", descriptionKey: "settings.dataGridFilterViewDescription", targetId: "data-grid-filter-view" },
|
||||||
{ id: "data-grid-flattening-multi-line", category: "data", titleKey: "settings.flatteningMultiLineText", descriptionKey: "settings.flatteningMultiLineTextDescription", targetId: "data" },
|
{ id: "data-grid-flattening-multi-line", category: "data", titleKey: "settings.flatteningMultiLineText", descriptionKey: "settings.flatteningMultiLineTextDescription", targetId: "data" },
|
||||||
{ id: "data-grid-show-whitespace", category: "data", titleKey: "settings.dataGridShowWhitespace", descriptionKey: "settings.dataGridShowWhitespaceDescription", targetId: "data" },
|
{ id: "data-grid-show-whitespace", category: "data", titleKey: "settings.dataGridShowWhitespace", descriptionKey: "settings.dataGridShowWhitespaceDescription", targetId: "data" },
|
||||||
|
{ id: "data-grid-striped-rows", category: "data", titleKey: "settings.dataGridStripedRows", descriptionKey: "settings.dataGridStripedRowsDescription", targetId: "data" },
|
||||||
{ id: "sql-file-editor-max-mb", category: "editor", titleKey: "settings.externalSqlEditorMaxMb", descriptionKey: "settings.externalSqlEditorMaxMbDescription", targetId: "editor-sql-file" },
|
{ id: "sql-file-editor-max-mb", category: "editor", titleKey: "settings.externalSqlEditorMaxMb", descriptionKey: "settings.externalSqlEditorMaxMbDescription", targetId: "editor-sql-file" },
|
||||||
{ id: "sql-file-web-upload-max-mb", category: "data", titleKey: "settings.webSqlFileUploadMaxMb", descriptionKey: "settings.webSqlFileUploadMaxMbDescription", targetId: "data-sql-file-upload", visible: (context) => context.isWeb },
|
{ id: "sql-file-web-upload-max-mb", category: "data", titleKey: "settings.webSqlFileUploadMaxMb", descriptionKey: "settings.webSqlFileUploadMaxMbDescription", targetId: "data-sql-file-upload", visible: (context) => context.isWeb },
|
||||||
{ id: "appearance-toolbar", category: "appearance", titleKey: "settings.toolbarTitle", descriptionKey: "settings.toolbarHiddenHint", targetId: "appearance" },
|
{ id: "appearance-toolbar", category: "appearance", titleKey: "settings.toolbarTitle", descriptionKey: "settings.toolbarHiddenHint", targetId: "appearance" },
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ const SETTINGS_TRANSFER_CATEGORY_KEYS: Record<SettingsTransferCategoryId, readon
|
|||||||
"dataGridAutoTransposeSingleRow",
|
"dataGridAutoTransposeSingleRow",
|
||||||
"dataGridCellDetailButtonVisible",
|
"dataGridCellDetailButtonVisible",
|
||||||
"dataGridCrosshairHighlight",
|
"dataGridCrosshairHighlight",
|
||||||
|
"dataGridStripedRows",
|
||||||
"flatteningMultiLineText",
|
"flatteningMultiLineText",
|
||||||
"dataGridShowWhitespace",
|
"dataGridShowWhitespace",
|
||||||
"pageSize",
|
"pageSize",
|
||||||
|
|||||||
@@ -207,6 +207,15 @@ describe("normalizeEditorSettings", () => {
|
|||||||
expect(normalizeEditorSettings({ generateSqlQuoteIdentifiers: "false" } as any).generateSqlQuoteIdentifiers).toBe(true);
|
expect(normalizeEditorSettings({ generateSqlQuoteIdentifiers: "false" } as any).generateSqlQuoteIdentifiers).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("enables data grid striped rows by default and permits opting out", () => {
|
||||||
|
expect(DEFAULT_EDITOR_SETTINGS.dataGridStripedRows).toBe(true);
|
||||||
|
expect(normalizeEditorSettings({}).dataGridStripedRows).toBe(true);
|
||||||
|
expect(normalizeEditorSettings({ dataGridStripedRows: true }).dataGridStripedRows).toBe(true);
|
||||||
|
expect(normalizeEditorSettings({ dataGridStripedRows: false }).dataGridStripedRows).toBe(false);
|
||||||
|
expect(normalizeEditorSettings({ dataGridStripedRows: "false" } as any).dataGridStripedRows).toBe(true);
|
||||||
|
expect(normalizeEditorSettings({ dataGridStripedRows: null } as any).dataGridStripedRows).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
it("keeps SQL-file save formatting disabled unless explicitly enabled", () => {
|
it("keeps SQL-file save formatting disabled unless explicitly enabled", () => {
|
||||||
expect(normalizeEditorSettings({}).formatSqlOnSqlFileSave).toBe(false);
|
expect(normalizeEditorSettings({}).formatSqlOnSqlFileSave).toBe(false);
|
||||||
expect(normalizeEditorSettings({ formatSqlOnSqlFileSave: true }).formatSqlOnSqlFileSave).toBe(true);
|
expect(normalizeEditorSettings({ formatSqlOnSqlFileSave: true }).formatSqlOnSqlFileSave).toBe(true);
|
||||||
@@ -1432,6 +1441,29 @@ describe("settingsStore persisted settings initialization", () => {
|
|||||||
expect(restartedStore.editorSettings.dataGridCrosshairHighlight).toBe(true);
|
expect(restartedStore.editorSettings.dataGridCrosshairHighlight).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("loads, persists, and reloads data grid striped rows preference", async () => {
|
||||||
|
let persistedSettings: Record<string, unknown> = {};
|
||||||
|
const loadEditorSettings = vi.fn(async () => JSON.parse(JSON.stringify(persistedSettings)));
|
||||||
|
const saveEditorSettings = vi.fn(async (settings: Record<string, unknown>) => {
|
||||||
|
persistedSettings = JSON.parse(JSON.stringify(settings));
|
||||||
|
});
|
||||||
|
vi.doMock("@/lib/backend/api", () => ({ loadEditorSettings, saveEditorSettings }));
|
||||||
|
|
||||||
|
const { useSettingsStore } = await import("@/stores/settingsStore");
|
||||||
|
const store = useSettingsStore();
|
||||||
|
await store.initEditorSettings();
|
||||||
|
|
||||||
|
expect(store.editorSettings.dataGridStripedRows).toBe(true);
|
||||||
|
|
||||||
|
await store.updateEditorSettingsAndPersist({ dataGridStripedRows: false });
|
||||||
|
expect(saveEditorSettings).toHaveBeenLastCalledWith(expect.objectContaining({ dataGridStripedRows: false }));
|
||||||
|
|
||||||
|
setActivePinia(createPinia());
|
||||||
|
const restartedStore = useSettingsStore();
|
||||||
|
await restartedStore.initEditorSettings();
|
||||||
|
expect(restartedStore.editorSettings.dataGridStripedRows).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
it("loads, persists, and reloads hidden query editor line numbers", async () => {
|
it("loads, persists, and reloads hidden query editor line numbers", async () => {
|
||||||
let persistedSettings: Record<string, unknown> = { showLineNumbers: true };
|
let persistedSettings: Record<string, unknown> = { showLineNumbers: true };
|
||||||
const loadEditorSettings = vi.fn(async () => JSON.parse(JSON.stringify(persistedSettings)));
|
const loadEditorSettings = vi.fn(async () => JSON.parse(JSON.stringify(persistedSettings)));
|
||||||
|
|||||||
@@ -963,6 +963,7 @@ export interface EditorSettings {
|
|||||||
dataGridAutoTransposeSingleRow: boolean;
|
dataGridAutoTransposeSingleRow: boolean;
|
||||||
dataGridCellDetailButtonVisible: boolean;
|
dataGridCellDetailButtonVisible: boolean;
|
||||||
dataGridCrosshairHighlight: boolean;
|
dataGridCrosshairHighlight: boolean;
|
||||||
|
dataGridStripedRows: boolean;
|
||||||
dataGridMultiRowTranspose: boolean;
|
dataGridMultiRowTranspose: boolean;
|
||||||
dataGridHideNullColumns: boolean;
|
dataGridHideNullColumns: boolean;
|
||||||
dataGridBooleanDisplayMode: "dropdown" | "checkbox";
|
dataGridBooleanDisplayMode: "dropdown" | "checkbox";
|
||||||
@@ -1259,6 +1260,7 @@ export const DEFAULT_EDITOR_SETTINGS: EditorSettings = {
|
|||||||
dataGridAutoTransposeSingleRow: false,
|
dataGridAutoTransposeSingleRow: false,
|
||||||
dataGridCellDetailButtonVisible: true,
|
dataGridCellDetailButtonVisible: true,
|
||||||
dataGridCrosshairHighlight: false,
|
dataGridCrosshairHighlight: false,
|
||||||
|
dataGridStripedRows: true,
|
||||||
dataGridMultiRowTranspose: false,
|
dataGridMultiRowTranspose: false,
|
||||||
dataGridHideNullColumns: false,
|
dataGridHideNullColumns: false,
|
||||||
dataGridBooleanDisplayMode: "dropdown",
|
dataGridBooleanDisplayMode: "dropdown",
|
||||||
@@ -1847,6 +1849,7 @@ export function normalizeEditorSettings(settings: Partial<EditorSettings>, exist
|
|||||||
dataGridAutoTransposeSingleRow: settings.dataGridAutoTransposeSingleRow === true,
|
dataGridAutoTransposeSingleRow: settings.dataGridAutoTransposeSingleRow === true,
|
||||||
dataGridCellDetailButtonVisible: typeof settings.dataGridCellDetailButtonVisible === "boolean" ? settings.dataGridCellDetailButtonVisible : DEFAULT_EDITOR_SETTINGS.dataGridCellDetailButtonVisible,
|
dataGridCellDetailButtonVisible: typeof settings.dataGridCellDetailButtonVisible === "boolean" ? settings.dataGridCellDetailButtonVisible : DEFAULT_EDITOR_SETTINGS.dataGridCellDetailButtonVisible,
|
||||||
dataGridCrosshairHighlight: typeof settings.dataGridCrosshairHighlight === "boolean" ? settings.dataGridCrosshairHighlight : DEFAULT_EDITOR_SETTINGS.dataGridCrosshairHighlight,
|
dataGridCrosshairHighlight: typeof settings.dataGridCrosshairHighlight === "boolean" ? settings.dataGridCrosshairHighlight : DEFAULT_EDITOR_SETTINGS.dataGridCrosshairHighlight,
|
||||||
|
dataGridStripedRows: typeof settings.dataGridStripedRows === "boolean" ? settings.dataGridStripedRows : DEFAULT_EDITOR_SETTINGS.dataGridStripedRows,
|
||||||
dataGridMultiRowTranspose: settings.dataGridMultiRowTranspose === true,
|
dataGridMultiRowTranspose: settings.dataGridMultiRowTranspose === true,
|
||||||
dataGridHideNullColumns: settings.dataGridHideNullColumns === true,
|
dataGridHideNullColumns: settings.dataGridHideNullColumns === true,
|
||||||
dataGridBooleanDisplayMode: settings.dataGridBooleanDisplayMode === "checkbox" ? "checkbox" : "dropdown",
|
dataGridBooleanDisplayMode: settings.dataGridBooleanDisplayMode === "checkbox" ? "checkbox" : "dropdown",
|
||||||
@@ -2702,6 +2705,7 @@ export const useSettingsStore = defineStore("settings", () => {
|
|||||||
if (partial.dataGridAutoTransposeSingleRow !== undefined) editorSettings.value.dataGridAutoTransposeSingleRow = partial.dataGridAutoTransposeSingleRow === true;
|
if (partial.dataGridAutoTransposeSingleRow !== undefined) editorSettings.value.dataGridAutoTransposeSingleRow = partial.dataGridAutoTransposeSingleRow === true;
|
||||||
if (partial.dataGridCellDetailButtonVisible !== undefined) editorSettings.value.dataGridCellDetailButtonVisible = typeof partial.dataGridCellDetailButtonVisible === "boolean" ? partial.dataGridCellDetailButtonVisible : DEFAULT_EDITOR_SETTINGS.dataGridCellDetailButtonVisible;
|
if (partial.dataGridCellDetailButtonVisible !== undefined) editorSettings.value.dataGridCellDetailButtonVisible = typeof partial.dataGridCellDetailButtonVisible === "boolean" ? partial.dataGridCellDetailButtonVisible : DEFAULT_EDITOR_SETTINGS.dataGridCellDetailButtonVisible;
|
||||||
if (partial.dataGridCrosshairHighlight !== undefined) editorSettings.value.dataGridCrosshairHighlight = typeof partial.dataGridCrosshairHighlight === "boolean" ? partial.dataGridCrosshairHighlight : DEFAULT_EDITOR_SETTINGS.dataGridCrosshairHighlight;
|
if (partial.dataGridCrosshairHighlight !== undefined) editorSettings.value.dataGridCrosshairHighlight = typeof partial.dataGridCrosshairHighlight === "boolean" ? partial.dataGridCrosshairHighlight : DEFAULT_EDITOR_SETTINGS.dataGridCrosshairHighlight;
|
||||||
|
if (partial.dataGridStripedRows !== undefined) editorSettings.value.dataGridStripedRows = typeof partial.dataGridStripedRows === "boolean" ? partial.dataGridStripedRows : DEFAULT_EDITOR_SETTINGS.dataGridStripedRows;
|
||||||
if (partial.dataGridMultiRowTranspose !== undefined) editorSettings.value.dataGridMultiRowTranspose = partial.dataGridMultiRowTranspose === true;
|
if (partial.dataGridMultiRowTranspose !== undefined) editorSettings.value.dataGridMultiRowTranspose = partial.dataGridMultiRowTranspose === true;
|
||||||
if (partial.dataGridHideNullColumns !== undefined) editorSettings.value.dataGridHideNullColumns = partial.dataGridHideNullColumns === true;
|
if (partial.dataGridHideNullColumns !== undefined) editorSettings.value.dataGridHideNullColumns = partial.dataGridHideNullColumns === true;
|
||||||
if (partial.dataGridBooleanDisplayMode !== undefined) editorSettings.value.dataGridBooleanDisplayMode = partial.dataGridBooleanDisplayMode === "dropdown" ? "dropdown" : "checkbox";
|
if (partial.dataGridBooleanDisplayMode !== undefined) editorSettings.value.dataGridBooleanDisplayMode = partial.dataGridBooleanDisplayMode === "dropdown" ? "dropdown" : "checkbox";
|
||||||
|
|||||||
+27
-1
@@ -1,6 +1,6 @@
|
|||||||
import { strict as assert } from "node:assert";
|
import { strict as assert } from "node:assert";
|
||||||
import { test } from "vitest";
|
import { test } from "vitest";
|
||||||
import { canvasDataGridActionReservedWidth, fitCanvasText, resolveCanvasCellTextLayout, resolveCanvasDataGridRowFill } from "../../apps/desktop/src/lib/dataGrid/canvasDataGridRenderer.ts";
|
import { canvasDataGridActionReservedWidth, fitCanvasText, resolveCanvasCellTextLayout, resolveCanvasDataGridRowBase, resolveCanvasDataGridRowFill } from "../../apps/desktop/src/lib/dataGrid/canvasDataGridRenderer.ts";
|
||||||
import { DATA_GRID_DARK_STRIPED_ROW_BG, DATA_GRID_LIGHT_STRIPED_ROW_BG, resolveDataGridPaintTheme } from "../../apps/desktop/src/lib/dataGrid/dataGridPaintTheme.ts";
|
import { DATA_GRID_DARK_STRIPED_ROW_BG, DATA_GRID_LIGHT_STRIPED_ROW_BG, resolveDataGridPaintTheme } from "../../apps/desktop/src/lib/dataGrid/dataGridPaintTheme.ts";
|
||||||
|
|
||||||
function measureContext(charWidth = 1): CanvasRenderingContext2D {
|
function measureContext(charWidth = 1): CanvasRenderingContext2D {
|
||||||
@@ -70,3 +70,29 @@ test("data grid paint theme resolves cellDirty token", () => {
|
|||||||
|
|
||||||
assert.equal(resolveDataGridPaintTheme({ getVar, isDark: false }).cellDirty, "rgb(166, 210, 255)");
|
assert.equal(resolveDataGridPaintTheme({ getVar, isDark: false }).cellDirty, "rgb(166, 210, 255)");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("canvas row base respects stripedRows option", () => {
|
||||||
|
const theme = {
|
||||||
|
background: "bg-base",
|
||||||
|
rowMuted: "row-muted",
|
||||||
|
rowNew: "row-new",
|
||||||
|
rowDeleted: "row-deleted",
|
||||||
|
};
|
||||||
|
|
||||||
|
const evenRow = { displayIndex: 0, isDeleted: false, isNew: false, isDraft: false };
|
||||||
|
const oddRow = { displayIndex: 1, isDeleted: false, isNew: false, isDraft: false };
|
||||||
|
const newRow = { displayIndex: 0, isDeleted: false, isNew: true, isDraft: false };
|
||||||
|
|
||||||
|
// With stripedRows enabled (default or explicit true)
|
||||||
|
assert.equal(resolveCanvasDataGridRowBase(theme, evenRow, { isActive: false }), "bg-base");
|
||||||
|
assert.equal(resolveCanvasDataGridRowBase(theme, oddRow, { isActive: false }), "row-muted");
|
||||||
|
assert.equal(resolveCanvasDataGridRowBase(theme, oddRow, { isActive: false, stripedRows: true }), "row-muted");
|
||||||
|
|
||||||
|
// With stripedRows disabled
|
||||||
|
assert.equal(resolveCanvasDataGridRowBase(theme, evenRow, { isActive: false, stripedRows: false }), "bg-base");
|
||||||
|
assert.equal(resolveCanvasDataGridRowBase(theme, oddRow, { isActive: false, stripedRows: false }), "bg-base");
|
||||||
|
|
||||||
|
// New row takes precedence when not active
|
||||||
|
assert.equal(resolveCanvasDataGridRowBase(theme, newRow, { isActive: false, stripedRows: false }), "row-new");
|
||||||
|
assert.equal(resolveCanvasDataGridRowBase(theme, newRow, { isActive: false, stripedRows: true }), "row-new");
|
||||||
|
});
|
||||||
Reference in new issue
Block a user