mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-21 15:26:15 -04:00
refacor(transformers): use monospace font for JSON and SQL text areas (#476)
* feat(c-input): Add monospace prop * feat: use monospace input for json and sql inputs
This commit is contained in:
parent
363c2e47e6
commit
ba4876d0d5
4 changed files with 15 additions and 3 deletions
|
@ -45,6 +45,7 @@ const output = computed(() => transformer.value(input.value));
|
||||||
multiline
|
multiline
|
||||||
test-id="input"
|
test-id="input"
|
||||||
:validation-rules="inputValidationRules"
|
:validation-rules="inputValidationRules"
|
||||||
|
monospace
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -29,6 +29,7 @@ const jsonValidationRules = [
|
||||||
multiline
|
multiline
|
||||||
test-id="leftJson"
|
test-id="leftJson"
|
||||||
raw-text
|
raw-text
|
||||||
|
monospace
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<c-input-text
|
<c-input-text
|
||||||
|
@ -40,6 +41,7 @@ const jsonValidationRules = [
|
||||||
multiline
|
multiline
|
||||||
test-id="rightJson"
|
test-id="rightJson"
|
||||||
raw-text
|
raw-text
|
||||||
|
monospace
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<DiffsViewer :left-json="leftJson" :right-json="rightJson" />
|
<DiffsViewer :left-json="leftJson" :right-json="rightJson" />
|
||||||
|
|
|
@ -64,16 +64,17 @@ const prettySQL = computed(() => formatSQL(rawSQL.value, config));
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<n-form-item label="Your SQL query">
|
<n-form-item label="Your SQL query">
|
||||||
<n-input
|
<c-input-text
|
||||||
ref="inputElement"
|
ref="inputElement"
|
||||||
v-model:value="rawSQL"
|
v-model:value="rawSQL"
|
||||||
placeholder="Put your SQL query here..."
|
placeholder="Put your SQL query here..."
|
||||||
type="textarea"
|
|
||||||
rows="20"
|
rows="20"
|
||||||
|
multiline
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
autocorrect="off"
|
autocorrect="off"
|
||||||
autocapitalize="off"
|
autocapitalize="off"
|
||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
|
monospace
|
||||||
/>
|
/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
<n-form-item label="Prettify version of your query">
|
<n-form-item label="Prettify version of your query">
|
||||||
|
|
|
@ -30,6 +30,7 @@ const props = withDefaults(
|
||||||
rows?: number | string
|
rows?: number | string
|
||||||
autosize?: boolean
|
autosize?: boolean
|
||||||
autofocus?: boolean
|
autofocus?: boolean
|
||||||
|
monospace?: boolean
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
value: '',
|
value: '',
|
||||||
|
@ -56,13 +57,14 @@ const props = withDefaults(
|
||||||
rows: 3,
|
rows: 3,
|
||||||
autosize: false,
|
autosize: false,
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
|
monospace: false,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
const emit = defineEmits(['update:value']);
|
const emit = defineEmits(['update:value']);
|
||||||
const value = useVModel(props, 'value', emit);
|
const value = useVModel(props, 'value', emit);
|
||||||
const showPassword = ref(false);
|
const showPassword = ref(false);
|
||||||
|
|
||||||
const { id, placeholder, label, validationRules, labelPosition, labelWidth, labelAlign, autosize, readonly, disabled, clearable, type, multiline, rows, rawText, autofocus } = toRefs(props);
|
const { id, placeholder, label, validationRules, labelPosition, labelWidth, labelAlign, autosize, readonly, disabled, clearable, type, multiline, rows, rawText, autofocus, monospace } = toRefs(props);
|
||||||
|
|
||||||
const validation
|
const validation
|
||||||
= props.validation
|
= props.validation
|
||||||
|
@ -157,6 +159,9 @@ defineExpose({
|
||||||
ref="textareaRef"
|
ref="textareaRef"
|
||||||
v-model="value"
|
v-model="value"
|
||||||
class="input"
|
class="input"
|
||||||
|
:class="{
|
||||||
|
'leading-5 !font-mono': monospace,
|
||||||
|
}"
|
||||||
:placeholder="placeholder"
|
:placeholder="placeholder"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
|
@ -175,6 +180,9 @@ defineExpose({
|
||||||
v-model="value"
|
v-model="value"
|
||||||
:type="htmlInputType"
|
:type="htmlInputType"
|
||||||
class="input"
|
class="input"
|
||||||
|
:class="{
|
||||||
|
'leading-5 !font-mono': monospace,
|
||||||
|
}"
|
||||||
size="1"
|
size="1"
|
||||||
:placeholder="placeholder"
|
:placeholder="placeholder"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue