Skip to content

Commit 8780147

Browse files
committed
feat(prop): size
size?: 'large' | 'default' | 'small' = 'default'
1 parent 2a3b6e0 commit 8780147

File tree

6 files changed

+34
-0
lines changed

6 files changed

+34
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
- clearIcon?: Component | null = CircleClose
3939
- disabledDate?: (date: Date) => boolean = () => false
4040
- teleported?: boolean = false
41+
- size?: 'large' | 'default' | 'small' = 'default'
4142
- style?: StyleValue = ''
4243
- *wantEnd?: boolean = false
4344
- *allowSame?: boolean = true

README_zhCN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
- clearIcon?: Component | null = CircleClose
3939
- disabledDate?: (date: Date) => boolean = () => false
4040
- teleported?: boolean = false
41+
- size?: 'large' | 'default' | 'small' = 'default'
4142
- style?: StyleValue = ''
4243
- *wantEnd?: boolean = false
4344
- *allowSame?: boolean = true

demo/App.vue

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,27 @@ const yearrangeProps = reactive({
113113
wantEnd: true,
114114
})
115115
116+
const yearrangeProps2 = reactive({
117+
_title: 'yearrange-input-small',
118+
type: 'yearrange',
119+
modelValue: ['2020', '2025'],
120+
disabledDate: disabledDateFn,
121+
valueFormat: 'YYYY-MM-DD',
122+
wantEnd: true,
123+
size: 'small',
124+
})
125+
126+
const yearrangeProps3 = reactive({
127+
_title: 'yearrange-input-large',
128+
type: 'yearrange',
129+
modelValue: ['2020', '2025'],
130+
disabledDate: disabledDateFn,
131+
valueFormat: 'YYYY-MM-DD',
132+
wantEnd: true,
133+
size: 'large',
134+
})
135+
136+
116137
const items: any[] = [
117138
quarteryearProps,
118139
quarteryearProps2,
@@ -126,6 +147,8 @@ const items: any[] = [
126147
halfyearrangeProps2,
127148
halfyearrangeProps3,
128149
yearrangeProps,
150+
yearrangeProps2,
151+
yearrangeProps3,
129152
]
130153
131154
const DatePickerEnhancedRef = ref(null)

src/DatePickerEnhanced.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ type DateType =
1818
1919
type DateModelType = string | number | Date
2020
21+
type Size = 'large' | 'default' | 'small'
22+
2123
interface Props {
2224
type: DateType
2325
modelValue: DateModelType | [DateModelType, DateModelType]
@@ -37,6 +39,7 @@ interface Props {
3739
disabledDate?: (date: Date) => boolean
3840
cellClassName?: (date: Date) => string
3941
teleported?: boolean
42+
size?: Size
4043
4144
style?: StyleValue
4245
@@ -59,6 +62,7 @@ const props = withDefaults(defineProps<Props>(), {
5962
clearIcon: CircleClose,
6063
disabledDate: () => false,
6164
teleported: false,
65+
size: 'default',
6266
style: '',
6367
wantEnd: false,
6468
allowSame: true,
@@ -105,6 +109,7 @@ provide('style', props.style)
105109
provide('editable', props.editable)
106110
provide('readonly', props.readonly) // 以及面板容器
107111
provide('disabled', props.disabled) // 以及面板容器
112+
provide('size', props.size)
108113
109114
type DatePickerRef = InstanceType<typeof DatePickerQuarterHalfYear> | InstanceType<typeof DatePickerQuarterHalfYearRange>
110115
const datepickerRef = ref<DatePickerRef | null>(null)

src/components/DatePickerInput.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const style = inject<StyleValue>('style')
1919
const editable = inject<boolean>('editable')
2020
const readonly = inject<boolean>('readonly')
2121
const disabled = inject<boolean>('disabled')
22+
const size = inject<boolean>('size')
2223
2324
const value = computed(() => props.modelValue)
2425
@@ -46,6 +47,7 @@ export default {
4647
class="el-input el-input--prefix el-input--suffix el-date-editor el-date-editor--month el-tooltip__trigger el-tooltip__trigger"
4748
:class="{
4849
'is-disabled': disabled,
50+
[`el-input--${size}`]: true,
4951
}"
5052
:style="style"
5153
@mouseenter="isMouseIn = true"

src/components/DatePickerInputRange.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const style = inject<StyleValue>('style')
2020
const editable = inject<boolean>('editable')
2121
const readonly = inject<boolean>('readonly')
2222
const disabled = inject<boolean>('disabled')
23+
const size = inject<boolean>('size')
2324
2425
const startValue = computed(() => props.modelValue[0])
2526
const endValue = computed(() => props.modelValue[1])
@@ -42,6 +43,7 @@ defineExpose({
4243
class="el-date-editor el-date-editor--monthrange el-input__wrapper el-range-editor el-tooltip__trigger el-tooltip__trigger"
4344
:class="{
4445
'is-disabled': disabled,
46+
[`el-input--${size}`]: true,
4547
}"
4648
:style="style"
4749
@mouseenter="isMouseIn = true"

0 commit comments

Comments
 (0)