vue2server7 7.0.9 → 7.0.12

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.
@@ -29,9 +29,30 @@
29
29
  <script lang="ts">
30
30
  import type { FormItemRule } from 'element-plus'
31
31
 
32
- type RangeValue = [number | null, number | null]
32
+ export type RangeValue = [number | null, number | null]
33
33
  type ValidatorCb = (error?: Error) => void
34
34
 
35
+ export interface NumberRangeProps {
36
+ /** 数组模式绑定值 [min, max],与 start/end 二选一 */
37
+ modelValue?: RangeValue
38
+ /** 双字段模式 - 起始值 */
39
+ start?: number | null
40
+ /** 双字段模式 - 结束值 */
41
+ end?: number | null
42
+ minPlaceholder?: string
43
+ maxPlaceholder?: string
44
+ /** 两个输入框之间的分隔文字 */
45
+ separator?: string
46
+ /** 允许输入的最小边界 */
47
+ min?: number
48
+ /** 允许输入的最大边界 */
49
+ max?: number
50
+ step?: number
51
+ /** 小数位数限制,如 2 表示最多两位小数 */
52
+ precision?: number
53
+ disabled?: boolean
54
+ }
55
+
35
56
  /**
36
57
  * NumberRange 数字区间输入组件
37
58
  *
@@ -91,30 +112,7 @@ export function rangeRule(
91
112
  <script setup lang="ts">
92
113
  import { ref, watch, computed } from 'vue'
93
114
 
94
- type Nullable<T> = T | null | undefined
95
-
96
- interface Props {
97
- /** 数组模式绑定值 [min, max],与 start/end 二选一 */
98
- modelValue?: RangeValue
99
- /** 双字段模式 - 起始值 */
100
- start?: number | null
101
- /** 双字段模式 - 结束值 */
102
- end?: number | null
103
- minPlaceholder?: string
104
- maxPlaceholder?: string
105
- /** 两个输入框之间的分隔文字 */
106
- separator?: string
107
- /** 允许输入的最小边界 */
108
- min?: number
109
- /** 允许输入的最大边界 */
110
- max?: number
111
- step?: number
112
- /** 小数位数限制,如 2 表示最多两位小数 */
113
- precision?: number
114
- disabled?: boolean
115
- }
116
-
117
- const props = withDefaults(defineProps<Props>(), {
115
+ const props = withDefaults(defineProps<NumberRangeProps>(), {
118
116
  modelValue: undefined,
119
117
  start: undefined,
120
118
  end: undefined,
@@ -138,14 +136,14 @@ const emit = defineEmits<{
138
136
  /** 根据是否传入 modelValue 自动判断绑定模式 */
139
137
  const isArrayMode = computed(() => props.modelValue !== undefined)
140
138
 
141
- function getInitMin(): Nullable<number> {
139
+ function getInitMin(): number | null | undefined {
142
140
  return isArrayMode.value ? props.modelValue?.[0] : props.start
143
141
  }
144
- function getInitMax(): Nullable<number> {
142
+ function getInitMax(): number | null | undefined {
145
143
  return isArrayMode.value ? props.modelValue?.[1] : props.end
146
144
  }
147
145
 
148
- function toDisplay(val: Nullable<number>): string {
146
+ function toDisplay(val: number | null | undefined): string {
149
147
  if (val === null || val === undefined) return ''
150
148
  return String(val)
151
149
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2server7",
3
- "version": "7.0.9",
3
+ "version": "7.0.12",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "dev": "nodemon --watch src --ext ts --exec \"ts-node src/app.ts\"",