1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
<script setup lang="ts">
import {
camelCase,
capitalCase,
constantCase,
dotCase,
headerCase,
noCase,
paramCase,
pascalCase,
pathCase,
sentenceCase,
snakeCase,
} from 'change-case';
import InputCopyable from '../../components/InputCopyable.vue';
const baseConfig = {
stripRegexp: /[^A-Za-zÀ-ÖØ-öø-ÿ]+/gi,
};
const input = ref('lorem ipsum dolor sit amet');
const formats = computed(() => [
{
label: 'Lowercase:',
value: noCase(input.value, baseConfig).toLocaleLowerCase(),
},
{
label: 'Uppercase:',
value: noCase(input.value, baseConfig).toLocaleUpperCase(),
},
{
label: 'Camelcase:',
value: camelCase(input.value, baseConfig),
},
{
label: 'Capitalcase:',
value: capitalCase(input.value, baseConfig),
},
{
label: 'Constantcase:',
value: constantCase(input.value, baseConfig),
},
{
label: 'Dotcase:',
value: dotCase(input.value, baseConfig),
},
{
label: 'Headercase:',
value: headerCase(input.value, baseConfig),
},
{
label: 'Nocase:',
value: noCase(input.value, baseConfig),
},
{
label: 'Paramcase:',
value: paramCase(input.value, baseConfig),
},
{
label: 'Pascalcase:',
value: pascalCase(input.value, baseConfig),
},
{
label: 'Pathcase:',
value: pathCase(input.value, baseConfig),
},
{
label: 'Sentencecase:',
value: sentenceCase(input.value, baseConfig),
},
{
label: 'Snakecase:',
value: snakeCase(input.value, baseConfig),
},
]);
const inputLabelAlignmentConfig = {
labelPosition: 'left',
labelWidth: '120px',
labelAlign: 'right',
};
</script>
<template>
<c-card>
<c-input-text
v-model:value="input"
label="Your string:"
placeholder="Your string..."
raw-text
v-bind="inputLabelAlignmentConfig"
/>
<div divider my-16px />
<InputCopyable
v-for="format in formats"
:key="format.label"
:value="format.value"
:label="format.label"
v-bind="inputLabelAlignmentConfig"
mb-1
/>
</c-card>
</template>
|