adminforth 2.19.0-next.1 → 2.19.0-next.2

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.
@@ -12,7 +12,9 @@
12
12
  ref="input"
13
13
  v-bind="$attrs"
14
14
  :type="type"
15
- @input="$emit('update:modelValue', type === 'number' ? Number(($event.target as HTMLInputElement)?.value) : ($event.target as HTMLInputElement)?.value)"
15
+ :min="min"
16
+ :max="max"
17
+ @input="onInput"
16
18
  :value="modelValue"
17
19
  aria-describedby="helper-text-explanation"
18
20
  class="afcl-input inline-flex bg-lightInputBackground text-lightInputText dark:text-darkInputText border border-lightInputBorder rounded-0 focus:ring-lightPrimary focus:border-lightPrimary dark:focus:ring-darkPrimary dark:focus:border-darkPrimary
@@ -48,8 +50,31 @@ const props = defineProps<{
48
50
  suffix?: string,
49
51
  prefix?: string,
50
52
  readonly?: boolean,
53
+ min?: number | null,
54
+ max?: number | null,
51
55
  }>()
52
56
 
57
+ const emit = defineEmits<{
58
+ (e: 'update:modelValue', value: number | null): void
59
+ }>();
60
+
61
+ const onInput = (e: Event) => {
62
+ const el = e.target as HTMLInputElement;
63
+
64
+ if (props.type === 'number') {
65
+ let val = Number(el.value);
66
+
67
+ if (props.min != null && val < props.min) val = props.min;
68
+ if (props.max != null && val > props.max) val = props.max;
69
+
70
+ el.value = String(val);
71
+ emit('update:modelValue', val);
72
+ } else {
73
+ emit('update:modelValue', el.value);
74
+ }
75
+ };
76
+
77
+
53
78
  const input = ref<HTMLInputElement | null>(null)
54
79
 
55
80
  defineExpose({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "2.19.0-next.1",
3
+ "version": "2.19.0-next.2",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",