@goweekdays/layer-common 1.6.4 → 1.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/components/Input/SnakeCase.vue +22 -0
- package/composables/useUtils.ts +5 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-text-field
|
|
3
|
+
type="text"
|
|
4
|
+
:model-value="model"
|
|
5
|
+
@update:model-value="onInput"
|
|
6
|
+
v-bind="$attrs"
|
|
7
|
+
>
|
|
8
|
+
<template v-for="(_, name) in $slots" #[name]="slotProps">
|
|
9
|
+
<slot :name="name" v-bind="slotProps" />
|
|
10
|
+
</template>
|
|
11
|
+
</v-text-field>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup lang="ts">
|
|
15
|
+
const model = defineModel<string>({ default: "" });
|
|
16
|
+
|
|
17
|
+
const { toSnakeUpperCase } = useUtils();
|
|
18
|
+
|
|
19
|
+
function onInput(val: string) {
|
|
20
|
+
model.value = toSnakeUpperCase(val);
|
|
21
|
+
}
|
|
22
|
+
</script>
|
package/composables/useUtils.ts
CHANGED
|
@@ -502,6 +502,10 @@ export default function useUtils() {
|
|
|
502
502
|
},
|
|
503
503
|
];
|
|
504
504
|
|
|
505
|
+
function toSnakeUpperCase(value: string) {
|
|
506
|
+
return value.replace(/\s+/g, "_").toUpperCase();
|
|
507
|
+
}
|
|
508
|
+
|
|
505
509
|
function generateYears(
|
|
506
510
|
generation = 0,
|
|
507
511
|
mode = "past",
|
|
@@ -559,5 +563,6 @@ export default function useUtils() {
|
|
|
559
563
|
copyToClipboard,
|
|
560
564
|
months,
|
|
561
565
|
generateYears,
|
|
566
|
+
toSnakeUpperCase,
|
|
562
567
|
};
|
|
563
568
|
}
|