-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #181 from qianmoQ/feature-components
feat: support date picker
- Loading branch information
Showing
13 changed files
with
1,034 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
--- | ||
title: Shadcn DatePicker | ||
--- | ||
|
||
# Introduction | ||
|
||
This document describes the features and usage of the ShadcnDatePicker component. | ||
|
||
## Usage | ||
|
||
::: raw | ||
|
||
<CodeRunner title="Usage"> | ||
<ShadcnDatePicker v-model="value" /> | ||
</CodeRunner> | ||
|
||
::: | ||
|
||
::: details Show code | ||
|
||
```vue | ||
<template> | ||
<ShadcnDatePicker v-model="value" /> | ||
</template> | ||
``` | ||
|
||
::: | ||
|
||
## Type | ||
|
||
::: raw | ||
|
||
<CodeRunner title="Type"> | ||
<ShadcnDatePicker v-model="value" type="date" /> | ||
<ShadcnDatePicker v-model="value" type="range" /> | ||
</CodeRunner> | ||
|
||
::: | ||
|
||
::: details Show code | ||
|
||
```vue | ||
<template> | ||
<ShadcnDatePicker v-model="value" type="date" /> | ||
<ShadcnDatePicker v-model="value" type="range" /> | ||
</template> | ||
``` | ||
|
||
::: | ||
|
||
## Placeholder | ||
|
||
::: raw | ||
|
||
<CodeRunner title="Placeholder"> | ||
<ShadcnDatePicker v-model="value" placeholder="Enter string" /> | ||
</CodeRunner> | ||
|
||
::: | ||
|
||
::: details Show code | ||
|
||
```vue | ||
<template> | ||
<ShadcnDatePicker v-model="value" placeholder="Enter string" /> | ||
</template> | ||
``` | ||
|
||
::: | ||
|
||
## Disabled | ||
|
||
::: raw | ||
|
||
<CodeRunner title="Disabled"> | ||
<ShadcnDatePicker v-model="value" disabled /> | ||
<ShadcnDatePicker v-model="value" :disabled="false" /> | ||
</CodeRunner> | ||
|
||
::: | ||
|
||
::: details Show code | ||
|
||
```vue | ||
<template> | ||
<ShadcnDatePicker v-model="value" disabled /> | ||
<ShadcnDatePicker v-model="value" :disabled="false" /> | ||
</template> | ||
``` | ||
|
||
::: | ||
|
||
## Readonly | ||
|
||
::: raw | ||
|
||
<CodeRunner title="Readonly"> | ||
<ShadcnDatePicker v-model="value" readonly /> | ||
<ShadcnDatePicker v-model="value" :readonly="false" /> | ||
</CodeRunner> | ||
|
||
::: | ||
|
||
::: details Show code | ||
|
||
```vue | ||
<template> | ||
<ShadcnDatePicker v-model="value" readonly /> | ||
<ShadcnDatePicker v-model="value" :readonly="false" /> | ||
</template> | ||
``` | ||
|
||
::: | ||
|
||
## Format | ||
|
||
::: raw | ||
|
||
<CodeRunner title="Format"> | ||
<ShadcnDatePicker v-model="value" format="YYYY-MM-DD" /> | ||
</CodeRunner> | ||
|
||
::: | ||
|
||
::: details Show code | ||
|
||
```vue | ||
<template> | ||
<ShadcnDatePicker v-model="value" format="YYYY-MM-DD" /> | ||
</template> | ||
``` | ||
|
||
::: | ||
|
||
## Clearable | ||
|
||
::: raw | ||
|
||
<CodeRunner title="Clearable"> | ||
<ShadcnDatePicker v-model="value" clearable /> | ||
<ShadcnDatePicker v-model="value" :clearable="false" /> | ||
</CodeRunner> | ||
|
||
::: | ||
|
||
::: details Show code | ||
|
||
```vue | ||
<template> | ||
<ShadcnDatePicker v-model="value" clearable /> | ||
<ShadcnDatePicker v-model="value" :clearable="false" /> | ||
</template> | ||
``` | ||
|
||
::: | ||
|
||
## Show shortcuts | ||
|
||
::: raw | ||
|
||
<CodeRunner title="Show shortcuts"> | ||
<ShadcnDatePicker v-model="value" showShortcuts /> | ||
<ShadcnDatePicker v-model="value" :showShortcuts="false" /> | ||
</CodeRunner> | ||
|
||
::: | ||
|
||
::: details Show code | ||
|
||
```vue | ||
<template> | ||
<ShadcnDatePicker v-model="value" showShortcuts /> | ||
<ShadcnDatePicker v-model="value" :showShortcuts="false" /> | ||
</template> | ||
``` | ||
|
||
::: | ||
## DatePicker Props | ||
|
||
<ApiTable title="Props" | ||
:headers="['Attribute', 'Description', 'Type', 'Default Value', 'List']" | ||
:columns="[ | ||
['modelValue', 'modelValue value', 'Date | string', '-', 'Date, string'], | ||
['type', 'type value', 'date | range', 'date', 'date, range'], | ||
['placeholder', 'placeholder value', 'string', '-', '-'], | ||
['disabled', 'disabled value', 'boolean', 'false', '-'], | ||
['readonly', 'readonly value', 'boolean', 'false', '-'], | ||
['format', 'format value', 'string', 'YYYY-MM-DD', '-'], | ||
['clearable', 'clearable value', 'boolean', 'true', '-'], | ||
['showShortcuts', 'showShortcuts value', 'boolean', 'true', '-'] | ||
]"> | ||
</ApiTable> | ||
|
||
## DatePicker Events | ||
|
||
<ApiTable title="Events" | ||
:headers="['Event', 'Description', 'Callback Parameters']" | ||
:columns="[ | ||
['update:modelValue', 'Triggered when update:modelValue', 'value: string | [string, string]'], | ||
['on-change', 'Triggered when on change', 'value: string | [string, string]'] | ||
]"> | ||
</ApiTable> | ||
|
||
|
||
<script setup lang="ts"> | ||
import { ref } from 'vue'; | ||
|
||
const value = ref('') | ||
</script> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
<template> | ||
<div class="space-y-4 p-12"> | ||
<div>Selected color: {{ selectedColor }}</div> | ||
<ShadcnColorPicker v-model="selectedColor" color="#000000" @change="onColorChange"/> | ||
<ShadcnColorPicker v-model="selectedColor" disabled/> | ||
<ShadcnColorPicker v-model="selectedColor" readonly/> | ||
<ShadcnColorPicker v-model="selectedColor" :preset-colors="['#ff0000', '#00ff00', '#0000ff']"/> | ||
<div>Selected date: {{ selectDate }}</div> | ||
<ShadcnDatePicker v-model="selectDate" @on-change="onChange"/> | ||
<ShadcnDatePicker v-model="selectDate" disabled @on-change="onChange"/> | ||
<ShadcnDatePicker v-model="selectDate" readonly @on-change="onChange"/> | ||
<ShadcnDatePicker v-model="selectDate" format="YYYY/MM/DD" @on-change="onChange"/> | ||
<ShadcnDatePicker v-model="selectDate" type="range" @on-change="onChange"/> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
const selectedColor = ref('#000000') | ||
const onColorChange = (color: string) => { | ||
console.log('Selected color:', color) | ||
const selectDate = ref(null) | ||
const onChange = (value: string) => { | ||
console.log('Selected date:', value) | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.