Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(components): [time-select] use new display tag #12700

Merged
merged 1 commit into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 37 additions & 35 deletions docs/en-US/component/time-select.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,38 +53,40 @@ time-select/time-range

:::

## Attributes

| Name | Description | Type | Accepted Values | Default |
| --------------------- | -------------------------------------------------------- | --------------------- | -------------------------------------------------------------------------------------- | ----------- |
| model-value / v-model | binding value | string | — | — |
| disabled | whether TimeSelect is disabled | boolean | — | false |
| editable | whether the input is editable | boolean | — | true |
| clearable | whether to show clear button | boolean | — | true |
| size | size of Input | string | large / default / small | default |
| placeholder | placeholder in non-range mode | string | — | — |
| name | same as `name` in native input | string | — | — |
| effect | Tooltip theme, built-in theme: `dark` / `light` | string | string | light |
| prefix-icon | Custom prefix icon component | `string \| Component` | — | Clock |
| clear-icon | Custom clear icon component | `string \| Component` | — | CircleClose |
| start | start time | string | — | 09:00 |
| end | end time | string | — | 18:00 |
| step | time step | string | — | 00:30 |
| min-time | minimum time, any time before this time will be disabled | string | — | 00:00 |
| max-time | maximum time, any time after this time will be disabled | string | — | — |
| format | set format of time | string | see [formats](https://day.js.org/docs/en/display/format#list-of-all-available-formats) | HH:mm |

## Events

| Name | Description | Parameters |
| ------ | ------------------------------------- | ------------------------- |
| change | triggers when user confirms the value | component's binding value |
| blur | triggers when Input blurs | (event: FocusEvent) |
| focus | triggers when Input focuses | (event: FocusEvent) |

## Methods

| Method | Description | Parameters |
| ------ | ------------------------- | ---------- |
| focus | focus the Input component | — |
| blur | blur the Input component | — |
## API

### Attributes

| Name | Description | Type | Default |
| --------------------- | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ----------- |
| model-value / v-model | binding value | ^[string] | — |
| disabled | whether TimeSelect is disabled | ^[boolean] | false |
| editable | whether the input is editable | ^[boolean] | true |
| clearable | whether to show clear button | ^[boolean] | true |
| size | size of Input | ^[enum]`'large' \| 'default' \| 'small'` | default |
| placeholder | placeholder in non-range mode | ^[string] | — |
| name | same as `name` in native input | ^[string] | — |
| effect | Tooltip theme, built-in theme: `dark` / `light` | ^[string] / ^[enum]`'dark' \| 'light'` | light |
| prefix-icon | custom prefix icon component | ^[string] / ^[Component] | Clock |
| clear-icon | custom clear icon component | ^[string] / ^[Component] | CircleClose |
| start | start time | ^[string] | 09:00 |
| end | end time | ^[string] | 18:00 |
| step | time step | ^[string] | 00:30 |
| min-time | minimum time, any time before this time will be disabled | ^[string] | — |
| max-time | maximum time, any time after this time will be disabled | ^[string] | — |
| format | set format of time | ^[string] see [formats](https://day.js.org/docs/en/display/format#list-of-all-available-formats) | HH:mm |

### Events

| Name | Description | Type |
| ------ | ------------------------------------- | ---------------------------------------- |
| change | triggers when user confirms the value | ^[Function]`(value: string) => void` |
| blur | triggers when Input blurs | ^[Function]`(event: FocusEvent) => void` |
| focus | triggers when Input focuses | ^[Function]`(event: FocusEvent) => void` |

### Exposes

| Method | Description | Type |
| ------ | ------------------------- | ----------------------- |
| focus | focus the Input component | ^[Function]`() => void` |
| blur | blur the Input component | ^[Function]`() => void` |
48 changes: 48 additions & 0 deletions packages/components/time-select/src/time-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,93 @@ import type TimeSelect from './time-select.vue'
import type { Component, ExtractPropTypes, PropType } from 'vue'

export const timeSelectProps = buildProps({
/**
* @description set format of time
*/
format: {
type: String,
default: 'HH:mm',
},
/**
* @description binding value
*/
modelValue: String,
/**
* @description whether TimeSelect is disabled
*/
disabled: Boolean,
/**
* @description whether the input is editable
*/
editable: {
type: Boolean,
default: true,
},
/**
* @description Tooltip theme, built-in theme: `dark` / `light`
*/
effect: {
type: String as PropType<'light' | 'dark' | string>,
default: 'light',
},
/**
* @description whether to show clear button
*/
clearable: {
type: Boolean,
default: true,
},
/**
* @description size of Input
*/
size: useSizeProp,
/**
* @description placeholder in non-range mode
*/
placeholder: String,
/**
* @description start time
*/
start: {
type: String,
default: '09:00',
},
/**
* @description end time
*/
end: {
type: String,
default: '18:00',
},
/**
* @description time step
*/
step: {
type: String,
default: '00:30',
},
/**
* @description minimum time, any time before this time will be disabled
*/
minTime: String,
/**
* @description maximum time, any time after this time will be disabled
*/
maxTime: String,
/**
* @description same as `name` in native input
*/
name: String,
/**
* @description custom prefix icon component
*/
prefixIcon: {
type: definePropType<string | Component>([String, Object]),
default: () => Clock,
},
/**
* @description custom clear icon component
*/
clearIcon: {
type: definePropType<string | Component>([String, Object]),
default: () => CircleClose,
Expand Down
6 changes: 6 additions & 0 deletions packages/components/time-select/src/time-select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,13 @@ const focus = () => {
}

defineExpose({
/**
* @description focus the Input component
*/
blur,
/**
* @description blur the Input component
*/
focus,
})
</script>
Loading