mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-23 00:06:15 -04:00
refactor(ui): replaced some n-input with c-input-text
This commit is contained in:
parent
b3b6b7c46b
commit
f7fc779e63
10 changed files with 189 additions and 226 deletions
|
@ -1,26 +1,27 @@
|
|||
<template>
|
||||
<n-form-item :label="inputLabel" v-bind="validationAttrs as any">
|
||||
<n-input
|
||||
ref="inputElement"
|
||||
v-model:value="input"
|
||||
:placeholder="inputPlaceholder"
|
||||
type="textarea"
|
||||
rows="20"
|
||||
autocomplete="off"
|
||||
autocorrect="off"
|
||||
autocapitalize="off"
|
||||
spellcheck="false"
|
||||
:input-props="{ 'data-test-id': 'input' } as any"
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item :label="outputLabel">
|
||||
<textarea-copyable :value="output" :language="outputLanguage" :follow-height-of="inputElement" />
|
||||
</n-form-item>
|
||||
<c-input-text
|
||||
ref="inputElement"
|
||||
v-model:value="input"
|
||||
:placeholder="inputPlaceholder"
|
||||
:label="inputLabel"
|
||||
multiline
|
||||
autosize
|
||||
rows="20"
|
||||
raw-text
|
||||
test-id="input"
|
||||
:validation-rules="inputValidationRules"
|
||||
/>
|
||||
|
||||
<div>
|
||||
<div mb-5px>{{ outputLabel }}</div>
|
||||
<textarea-copyable :value="output" :language="outputLanguage" :follow-height-of="inputElement?.inputWrapperRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useValidation, type UseValidationRule } from '@/composable/validation';
|
||||
import type { UseValidationRule } from '@/composable/validation';
|
||||
import _ from 'lodash';
|
||||
import CInputText from '@/ui/c-input-text/c-input-text.vue';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
|
@ -46,12 +47,10 @@ const props = withDefaults(
|
|||
const { transformer, inputValidationRules, inputLabel, outputLabel, outputLanguage, inputPlaceholder, inputDefault } =
|
||||
toRefs(props);
|
||||
|
||||
const inputElement = ref();
|
||||
const inputElement = ref<typeof CInputText>();
|
||||
|
||||
const input = ref(inputDefault.value);
|
||||
const output = computed(() => transformer.value(input.value));
|
||||
|
||||
const { attrs: validationAttrs } = useValidation({ source: input, rules: inputValidationRules.value });
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue