mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-22 07:46:15 -04:00
fix(sql-prettifier): better responsiveness
This commit is contained in:
parent
328fda65b3
commit
560fcf3f78
1 changed files with 44 additions and 51 deletions
|
@ -1,55 +1,47 @@
|
||||||
<template>
|
<template>
|
||||||
<div style="flex: 0 0 100%">
|
<div style="flex: 0 0 100%">
|
||||||
<div style="margin: 0 auto; width: 600px">
|
<n-space item-style="flex:1 1 0" style="margin: 0 auto; max-width: 600px" :vertical="styleStore.isSmallScreen">
|
||||||
<n-space n-space item-style="flex: 1 1 0">
|
<n-form-item label="Dialect" label-width="500">
|
||||||
<div>
|
<n-select
|
||||||
<n-form-item label="Dialect">
|
v-model:value="config.language"
|
||||||
<n-select
|
:options="[
|
||||||
v-model:value="config.language"
|
{ label: 'GCP BigQuery', value: 'bigquery' },
|
||||||
:options="[
|
{ label: 'IBM DB2', value: 'db2' },
|
||||||
{ label: 'GCP BigQuery', value: 'bigquery' },
|
{ label: 'Apache Hive', value: 'hive' },
|
||||||
{ label: 'IBM DB2', value: 'db2' },
|
{ label: 'MariaDB', value: 'mariadb' },
|
||||||
{ label: 'Apache Hive', value: 'hive' },
|
{ label: 'MySQL', value: 'mysql' },
|
||||||
{ label: 'MariaDB', value: 'mariadb' },
|
{ label: 'Couchbase N1QL', value: 'n1ql' },
|
||||||
{ label: 'MySQL', value: 'mysql' },
|
{ label: 'Oracle PL/SQL', value: 'plsql' },
|
||||||
{ label: 'Couchbase N1QL', value: 'n1ql' },
|
{ label: 'PostgreSQL', value: 'postgresql' },
|
||||||
{ label: 'Oracle PL/SQL', value: 'plsql' },
|
{ label: 'Amazon Redshift', value: 'redshift' },
|
||||||
{ label: 'PostgreSQL', value: 'postgresql' },
|
{ label: 'Spark', value: 'spark' },
|
||||||
{ label: 'Amazon Redshift', value: 'redshift' },
|
{ label: 'Standard SQL', value: 'sql' },
|
||||||
{ label: 'Spark', value: 'spark' },
|
{ label: 'sqlite', value: 'sqlite' },
|
||||||
{ label: 'Standard SQL', value: 'sql' },
|
{ label: 'SQL Server Transact-SQL', value: 'tsql' },
|
||||||
{ label: 'sqlite', value: 'sqlite' },
|
]"
|
||||||
{ label: 'SQL Server Transact-SQL', value: 'tsql' },
|
/>
|
||||||
]"
|
</n-form-item>
|
||||||
/>
|
<n-form-item label="Keyword case">
|
||||||
</n-form-item>
|
<n-select
|
||||||
</div>
|
v-model:value="config.keywordCase"
|
||||||
<div>
|
:options="[
|
||||||
<n-form-item label="Keyword case">
|
{ label: 'UPPERCASE', value: 'upper' },
|
||||||
<n-select
|
{ label: 'lowercase', value: 'lower' },
|
||||||
v-model:value="config.keywordCase"
|
{ label: 'Preserve', value: 'preserve' },
|
||||||
:options="[
|
]"
|
||||||
{ label: 'UPPERCASE', value: 'upper' },
|
/>
|
||||||
{ label: 'lowercase', value: 'lower' },
|
</n-form-item>
|
||||||
{ label: 'Preserve', value: 'preserve' },
|
<n-form-item label="Indent style">
|
||||||
]"
|
<n-select
|
||||||
/>
|
v-model:value="config.indentStyle"
|
||||||
</n-form-item>
|
:options="[
|
||||||
</div>
|
{ label: 'Standard', value: 'standard' },
|
||||||
<div>
|
{ label: 'Tabular left', value: 'tabularLeft' },
|
||||||
<n-form-item label="Indent style">
|
{ label: 'Tabular right', value: 'tabularRight' },
|
||||||
<n-select
|
]"
|
||||||
v-model:value="config.indentStyle"
|
/>
|
||||||
:options="[
|
</n-form-item>
|
||||||
{ label: 'Standard', value: 'standard' },
|
</n-space>
|
||||||
{ label: 'Tabular left', value: 'tabularLeft' },
|
|
||||||
{ label: 'Tabular right', value: 'tabularRight' },
|
|
||||||
]"
|
|
||||||
/>
|
|
||||||
</n-form-item>
|
|
||||||
</div>
|
|
||||||
</n-space>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<n-form-item label="Your SQL query">
|
<n-form-item label="Your SQL query">
|
||||||
|
@ -77,6 +69,7 @@
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useCopy } from '@/composable/copy';
|
import { useCopy } from '@/composable/copy';
|
||||||
|
import { useStyleStore } from '@/stores/style.store';
|
||||||
import { useElementSize } from '@vueuse/core';
|
import { useElementSize } from '@vueuse/core';
|
||||||
import hljs from 'highlight.js/lib/core';
|
import hljs from 'highlight.js/lib/core';
|
||||||
import sqlHljs from 'highlight.js/lib/languages/sql';
|
import sqlHljs from 'highlight.js/lib/languages/sql';
|
||||||
|
@ -86,7 +79,7 @@ hljs.registerLanguage('sql', sqlHljs);
|
||||||
|
|
||||||
const inputElement = ref<HTMLElement>();
|
const inputElement = ref<HTMLElement>();
|
||||||
const { height: inputElementHeight } = useElementSize(inputElement);
|
const { height: inputElementHeight } = useElementSize(inputElement);
|
||||||
|
const styleStore = useStyleStore();
|
||||||
const config = reactive<Partial<FormatFnOptions>>({
|
const config = reactive<Partial<FormatFnOptions>>({
|
||||||
keywordCase: 'upper',
|
keywordCase: 'upper',
|
||||||
useTabs: false,
|
useTabs: false,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue