@canlooks/can-ui 0.0.91 → 0.0.93
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.
- package/dist/cjs/components/calendar/calendar.style.js +124 -124
- package/dist/cjs/components/clickAway/clickAway.d.ts +1 -1
- package/dist/cjs/components/snackbarBase/snackbarBase.style.js +5 -0
- package/dist/cjs/components/status/status.d.ts +6 -6
- package/dist/cjs/components/treeSelect/treeSelect.js +1 -1
- package/dist/esm/components/calendar/calendar.style.js +124 -124
- package/dist/esm/components/clickAway/clickAway.d.ts +1 -1
- package/dist/esm/components/snackbarBase/snackbarBase.style.js +5 -0
- package/dist/esm/components/status/status.d.ts +6 -6
- package/dist/esm/components/treeSelect/treeSelect.js +1 -1
- package/documentation/dist/assets/index-DvrKS6Tv.js +7747 -0
- package/documentation/dist/atom-one-dark.min.css +1 -0
- package/documentation/dist/components/accordion.md +38 -0
- package/documentation/dist/components/actionSheet.md +49 -0
- package/documentation/dist/components/alert.md +38 -0
- package/documentation/dist/components/anchorList.md +36 -0
- package/documentation/dist/components/autocomplete.md +68 -0
- package/documentation/dist/components/avatar.md +79 -0
- package/documentation/dist/components/badge.md +33 -0
- package/documentation/dist/components/bottomNavigation.md +39 -0
- package/documentation/dist/components/breadcrumb.md +28 -0
- package/documentation/dist/components/bubbleConfirm.md +34 -0
- package/documentation/dist/components/button.md +62 -0
- package/documentation/dist/components/card.md +30 -0
- package/documentation/dist/components/cascade.md +48 -0
- package/documentation/dist/components/checkbox.md +36 -0
- package/documentation/dist/components/colorPicker.md +27 -0
- package/documentation/dist/components/contextMenu.md +27 -0
- package/documentation/dist/components/counter.md +29 -0
- package/documentation/dist/components/dataGrid.md +112 -0
- package/documentation/dist/components/dateTimePicker.md +35 -0
- package/documentation/dist/components/dateTimeRangePicker.md +36 -0
- package/documentation/dist/components/descriptions.md +35 -0
- package/documentation/dist/components/dialog.md +56 -0
- package/documentation/dist/components/divider.md +26 -0
- package/documentation/dist/components/drawer.md +40 -0
- package/documentation/dist/components/flex.md +20 -0
- package/documentation/dist/components/form.md +131 -0
- package/documentation/dist/components/formDialog.md +36 -0
- package/documentation/dist/components/grid.md +34 -0
- package/documentation/dist/components/highlight.md +26 -0
- package/documentation/dist/components/image.md +90 -0
- package/documentation/dist/components/input.md +39 -0
- package/documentation/dist/components/loading.md +46 -0
- package/documentation/dist/components/menu.md +85 -0
- package/documentation/dist/components/pagination.md +38 -0
- package/documentation/dist/components/pickerDialog.md +56 -0
- package/documentation/dist/components/placeholder.md +30 -0
- package/documentation/dist/components/progress.md +43 -0
- package/documentation/dist/components/radio.md +37 -0
- package/documentation/dist/components/rating.md +35 -0
- package/documentation/dist/components/resizable.md +41 -0
- package/documentation/dist/components/scrollbar.md +31 -0
- package/documentation/dist/components/segmented.md +57 -0
- package/documentation/dist/components/select.md +30 -0
- package/documentation/dist/components/skeleton.md +26 -0
- package/documentation/dist/components/slidableActions.md +53 -0
- package/documentation/dist/guide/appComponent.md +30 -0
- package/documentation/dist/guide/globalMethods.md +238 -0
- package/documentation/dist/guide/icon.md +57 -0
- package/documentation/dist/guide/introduction.md +2 -0
- package/documentation/dist/guide/overrideProps.md +0 -0
- package/documentation/dist/guide/startup.md +23 -0
- package/documentation/dist/guide/theme.md +249 -0
- package/documentation/dist/index.html +13 -0
- package/documentation/dist/logo.png +0 -0
- package/extensions/curd.cjs +5 -5
- package/extensions/documentViewer.cjs +5 -5
- package/extensions/textFormatter.cjs +5 -5
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Highlight 高亮文本
|
|
2
|
+
|
|
3
|
+
## 示例
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import {Highlight} from '@canlooks/can-ui'
|
|
7
|
+
|
|
8
|
+
export default function Index() {
|
|
9
|
+
return (
|
|
10
|
+
<div>
|
|
11
|
+
<Highlight keywords="高亮">高亮文本</Highlight>
|
|
12
|
+
</div>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
20
|
+
|--------------------|-----------------------------|-----|--------------------|
|
|
21
|
+
| keywords | string \| string[] | - | 高亮的关键词 |
|
|
22
|
+
| highlightClassName | string | - | 高亮元素的类名 |
|
|
23
|
+
| highlightStyle | CSSProperties | - | 高亮元素的样式 |
|
|
24
|
+
| renderHighlight | (text: string) => ReactNode | - | 自定义渲染高亮元素 |
|
|
25
|
+
| children | string | - | 文本,`content`属性的别名 |
|
|
26
|
+
| content | string | - | 文本,`children`属性的别名 |
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Image 图片
|
|
2
|
+
|
|
3
|
+
## 普通示例
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import {Image} from '@canlooks/can-ui'
|
|
7
|
+
|
|
8
|
+
export default function Index() {
|
|
9
|
+
return (
|
|
10
|
+
<Image src="/logo.png" style={{width: 100, height: 100}}/>
|
|
11
|
+
)
|
|
12
|
+
}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 相册预览示例
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import {Flex, Gallery, Image} from '@canlooks/can-ui'
|
|
19
|
+
|
|
20
|
+
export default function Index() {
|
|
21
|
+
const src1 = 'https://picsum.photos/seed/seed1/100'
|
|
22
|
+
const src2 = 'https://picsum.photos/seed/seed2/100'
|
|
23
|
+
const src3 = 'https://files.codelife.cc/wallhaven/full/gj/wallhaven-gj8v93.png'
|
|
24
|
+
|
|
25
|
+
const [open, setOpen] = React.useState(false)
|
|
26
|
+
const [index, setIndex] = React.useState(0)
|
|
27
|
+
|
|
28
|
+
const previewHandler = (e: React.MouseEvent<HTMLDivElement>, index: number) => {
|
|
29
|
+
e.preventDefault()
|
|
30
|
+
setOpen(true)
|
|
31
|
+
setIndex(index)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<>
|
|
36
|
+
<Flex gap={12}>
|
|
37
|
+
<Image src={src1} style={{width: 100, height: 100}} onPreview={e => previewHandler(e, 0)}/>
|
|
38
|
+
<Image src={src2} style={{width: 100, height: 100}} onPreview={e => previewHandler(e, 1)}/>
|
|
39
|
+
<Image src={src3} style={{width: 100, height: 100}} onPreview={e => previewHandler(e, 2)}/>
|
|
40
|
+
</Flex>
|
|
41
|
+
|
|
42
|
+
<Gallery
|
|
43
|
+
open={open}
|
|
44
|
+
onOpenChange={setOpen}
|
|
45
|
+
index={index}
|
|
46
|
+
onIndexChange={setIndex}
|
|
47
|
+
src={[src1, src2, src3]}
|
|
48
|
+
/>
|
|
49
|
+
</>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## ImageProps
|
|
55
|
+
|
|
56
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
57
|
+
|----------------|-----------------------------------------|------|------------------------------------------------|
|
|
58
|
+
| src | string | - | |
|
|
59
|
+
| fallback | string | - | 加载失败时会自动加载fallback |
|
|
60
|
+
| renderLoading | ReactNode | - | 自定义渲染loading展位符,若指定为`false`或`null`会禁用loading功能 |
|
|
61
|
+
| objectFit | CSSProperties['objectFit'] | - | |
|
|
62
|
+
| objectPosition | CSSProperties['objectPosition'] | - | |
|
|
63
|
+
| actions | ReactNode | - | 自定义渲染操作,默认为`预览`按钮 |
|
|
64
|
+
| previewable | boolean | true | 是否可预览 |
|
|
65
|
+
| previewProps | [ImagePreviewProps](#ImagePreviewProps) | - | 传递至`<ImagePreview/>`组件的属性 |
|
|
66
|
+
| onPreview | (event) => void | - | 点击预览按钮 |
|
|
67
|
+
| onLoad | ImgHTMLAttributes['onLoad'] | - | 传递至`<img/>`元素 |
|
|
68
|
+
| onError | ImgHTMLAttributes['onError'] | - | 传递至`<img/>`元素 |
|
|
69
|
+
| alt | ImgHTMLAttributes['alt'] | - | 传递至`<img/>`元素 |
|
|
70
|
+
| width | ImgHTMLAttributes['width'] | - | 传递至`<img/>`元素 |
|
|
71
|
+
| height | ImgHTMLAttributes['height'] | - | 传递至`<img/>`元素 |
|
|
72
|
+
| imgProps | ImgHTMLAttributes | - | 传递至`<img/>`元素 |
|
|
73
|
+
|
|
74
|
+
## ImagePreviewProps
|
|
75
|
+
|
|
76
|
+
`<ImagePreview/>`组件继承了`<Modal/>`组件的所有属性,此外还有如下属性:
|
|
77
|
+
|
|
78
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
79
|
+
|-----------------------|--------------------------------------------------------------------------------------|------|--------------------|
|
|
80
|
+
| src | string[] | - | |
|
|
81
|
+
| defaultIndex | number | 0 | 默认预览的图片下标(对应`src`) |
|
|
82
|
+
| index | number | - | 受控的预览下标 |
|
|
83
|
+
| onIndexChange | (index) => void | - | |
|
|
84
|
+
| defaultOpen | boolean | - | |
|
|
85
|
+
| onOpenChange | (open) => void | - | |
|
|
86
|
+
| showRotate | boolean | true | 是否渲染旋转按钮 |
|
|
87
|
+
| showZoom | boolean | true | 是否渲染放大缩小按钮 |
|
|
88
|
+
| showClose | boolean | true | 是否渲染关闭按钮 |
|
|
89
|
+
| renderControl | ReactNode | - | 自定义渲染控制按钮 |
|
|
90
|
+
| transformWrapperProps | [ReactZoomPanPinchProps](https://github.com/BetterTyped/react-zoom-pan-pinch#readme) | - | |
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Input 输入框
|
|
2
|
+
|
|
3
|
+
## 示例
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import {Input} from '@canlooks/can-ui'
|
|
7
|
+
|
|
8
|
+
export default function Index() {
|
|
9
|
+
return (
|
|
10
|
+
<Flex width={300} gap={15} direction="column">
|
|
11
|
+
<Input
|
|
12
|
+
prefix={<Icon icon={faUser}/>}
|
|
13
|
+
suffix="后缀"
|
|
14
|
+
placeholder="请输入内容"
|
|
15
|
+
/>
|
|
16
|
+
<Input variant="underlined" placeholder="请输入内容"/>
|
|
17
|
+
<Input variant="plain" placeholder="请输入内容"/>
|
|
18
|
+
<Input shape="rounded" placeholder="请输入内容"/>
|
|
19
|
+
</Flex>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Props
|
|
25
|
+
|
|
26
|
+
`<Input/>`组件继承了`<input/>`元素的全部属性,此外还有如下属性:
|
|
27
|
+
|
|
28
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
29
|
+
|----------------|--------------------------------------------------|------------|--------------------|
|
|
30
|
+
| inputProps | InputHTMLAttributes | - | 传递至`<input/>`元素的属性 |
|
|
31
|
+
| widthAdaptable | boolean | false | 是否根据内容自动调整宽度 |
|
|
32
|
+
| variant | 'outlined' \| 'underlined' \| 'plain' | 'outlined' | |
|
|
33
|
+
| size | 'small' \| 'medium' \| 'large' | | |
|
|
34
|
+
| color | string | - | |
|
|
35
|
+
| prefix | ReactNode | - | 前缀 |
|
|
36
|
+
| suffix | ReactNode | - | 后缀 |
|
|
37
|
+
| clearable | boolean | true | 是否显示清空按钮 |
|
|
38
|
+
| onClear | () => void | - | |
|
|
39
|
+
| loading | boolean | false | |
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Loading 加载中
|
|
2
|
+
|
|
3
|
+
## LoadingIndicator
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import {LoadingIndicator} from '@canlooks/can-ui'
|
|
7
|
+
|
|
8
|
+
export default function () {
|
|
9
|
+
return <LoadingIndicator/>
|
|
10
|
+
}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### LoadingIndicatorProps
|
|
14
|
+
|
|
15
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
16
|
+
|-------|--------|-----------|----|
|
|
17
|
+
| size | number | - | 尺寸 |
|
|
18
|
+
| width | number | - | 粗细 |
|
|
19
|
+
| color | string | 'primary' | |
|
|
20
|
+
|
|
21
|
+
## Loading
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import {Loading} from '@canlooks/can-ui'
|
|
25
|
+
|
|
26
|
+
export default function () {
|
|
27
|
+
return (
|
|
28
|
+
<Loading
|
|
29
|
+
open
|
|
30
|
+
progress={46}
|
|
31
|
+
>
|
|
32
|
+
<div style={{height: 150}}/>
|
|
33
|
+
</Loading>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### LoadingProps
|
|
39
|
+
|
|
40
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
41
|
+
|----------------|-------------------------------------------------|-----------|-----------------------|
|
|
42
|
+
| text | ReactNode | '加载中...' | |
|
|
43
|
+
| progress | number | - | 若指定该字段会显示进度条 |
|
|
44
|
+
| color | string | 'primary' | |
|
|
45
|
+
| indicatorProps | [LoadingIndicatorProps](#LoadingIndicatorProps) | - | |
|
|
46
|
+
| progressProps | [ProgressProps](/components/progress) | - | 传递至`<Progress/>`组件的属性 |
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Menu 菜单
|
|
2
|
+
|
|
3
|
+
## Menu示例
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import {Menu} from '@canlooks/can-ui'
|
|
7
|
+
|
|
8
|
+
export default function Index() {
|
|
9
|
+
return (
|
|
10
|
+
<Menu
|
|
11
|
+
style={{width: 300}}
|
|
12
|
+
items={[
|
|
13
|
+
{label: '选项1', value: 1},
|
|
14
|
+
{label: '选项2', value: 2},
|
|
15
|
+
]}
|
|
16
|
+
/>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## menuProps
|
|
22
|
+
|
|
23
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
24
|
+
|------------------|-----------------------------------------------------|---------|----------------------------------|
|
|
25
|
+
| items | [MenuItemProps](#menuItemProps)[] | - | |
|
|
26
|
+
| primaryKey | string \| number | 'value' | item中的主键 |
|
|
27
|
+
| labelKey | string \| number | 'value' | item中作为label的键 |
|
|
28
|
+
| childrenKey | string \| number | 'value' | item中作为children的键,若存在该字段,则会渲染子菜单 |
|
|
29
|
+
| defaultExpanded | (string \| number)[] | - | |
|
|
30
|
+
| expanded | (string \| number)[] | - | |
|
|
31
|
+
| onExpandedChange | (expanded) => void | - | |
|
|
32
|
+
| multiple | boolean | false | 是否支持多选 |
|
|
33
|
+
| defaultValue | string \| number \| (string \| number)[] | | |
|
|
34
|
+
| value | string \| number \| (string \| number)[] | | |
|
|
35
|
+
| onChange | (value) => void | | |
|
|
36
|
+
| size | 'small' \| 'medium' \| 'large' | 'large' | |
|
|
37
|
+
| showCheckbox | boolean | false | |
|
|
38
|
+
| ellipsis | boolean | false | |
|
|
39
|
+
| indent | number | 24 | |
|
|
40
|
+
|
|
41
|
+
## MenuItem可单独使用
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import {MenuItem} from '@canlooks/can-ui'
|
|
45
|
+
import {Icon} from '@canlooks/can-ui'
|
|
46
|
+
import {faUser} from '@fortawesome/free-solid-svg-icons'
|
|
47
|
+
|
|
48
|
+
export default function Index() {
|
|
49
|
+
return (
|
|
50
|
+
<div style={{width: 300}}>
|
|
51
|
+
<MenuItem
|
|
52
|
+
prefix={<Icon icon={faUser}/>}
|
|
53
|
+
label="选项1"
|
|
54
|
+
suffix="这是一个选项"
|
|
55
|
+
selected
|
|
56
|
+
defaultExpanded
|
|
57
|
+
>
|
|
58
|
+
<MenuItem label="选项1-1"/>
|
|
59
|
+
<MenuItem label="选项1-2"/>
|
|
60
|
+
</MenuItem>
|
|
61
|
+
</div>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## MenuItemProps
|
|
67
|
+
|
|
68
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
69
|
+
|------------------|-----------------------------------------------------|---------|----------------------------------------------|
|
|
70
|
+
| size | 'small' \| 'medium' \| 'large' | 'large' | |
|
|
71
|
+
| color | string | - | |
|
|
72
|
+
| emphasized | boolean | false | 是否强调颜色,如果指定了`color`建议同时指定`emphasized`为`true` |
|
|
73
|
+
| selected | boolean | false | 是否选中状态 |
|
|
74
|
+
| disabled | boolean | false | |
|
|
75
|
+
| showCheckbox | boolean | false | |
|
|
76
|
+
| checkboxProps | [checkboxProps](/components/checkbox) | - | |
|
|
77
|
+
| ellipsis | boolean | false | |
|
|
78
|
+
| prefix | ReactNode | - | |
|
|
79
|
+
| label | ReactNode | - | |
|
|
80
|
+
| suffix | ReactNode | - | |
|
|
81
|
+
| indent | number | 24 | |
|
|
82
|
+
| expandIcon | ReactNode | - | |
|
|
83
|
+
| defaultExpanded | boolean | - | |
|
|
84
|
+
| expanded | boolean | - | |
|
|
85
|
+
| onExpandedChange | (expanded) => void | - | |
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Pagination 分页器
|
|
2
|
+
|
|
3
|
+
## 示例
|
|
4
|
+
|
|
5
|
+
若不指定`children`默认会开启所有功能,或者通过`children`指定功能及顺序。
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import {Flex, Pagination} from '@canlooks/can-ui'
|
|
9
|
+
|
|
10
|
+
export default function Index() {
|
|
11
|
+
return (
|
|
12
|
+
<Flex direction="column" gap={24}>
|
|
13
|
+
<Pagination total={50}/>
|
|
14
|
+
|
|
15
|
+
<Pagination>
|
|
16
|
+
<Pagination.Counter/>
|
|
17
|
+
<Pagination.Pager/>
|
|
18
|
+
<Pagination.Sizer/>
|
|
19
|
+
<Pagination.Jumper/>
|
|
20
|
+
</Pagination>
|
|
21
|
+
</Flex>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Props
|
|
27
|
+
|
|
28
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
29
|
+
|------------------|--------------------------------|----------|---------|
|
|
30
|
+
| size | 'small' \| 'medium' \| 'large' | 'medium' | |
|
|
31
|
+
| total | number | | 数据的总条数 |
|
|
32
|
+
| defaultPage | number | | 页码,从1开始 |
|
|
33
|
+
| page | number | | |
|
|
34
|
+
| onPageChange | (page) => void | | |
|
|
35
|
+
| defaultPageSize | number | 10 | 每页的条数 |
|
|
36
|
+
| pageSize | number | | |
|
|
37
|
+
| onPageSizeChange | (pageSize) => void | | |
|
|
38
|
+
| onChange | (page, pageSize) => void | | |
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# PickerDialog 选择对话框
|
|
2
|
+
|
|
3
|
+
## 示例
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import {Button, DataGrid, PickerDialog} from '@canlooks/can-ui'
|
|
7
|
+
|
|
8
|
+
export default function Index() {
|
|
9
|
+
const [open, setOpen] = React.useState(false)
|
|
10
|
+
|
|
11
|
+
const rows = React.useMemo(() => [
|
|
12
|
+
{value: 1, label: '选项1', description: '这是选项1'},
|
|
13
|
+
{value: 2, label: '选项2', description: '这是选项2'},
|
|
14
|
+
{value: 3, label: '选项3', description: '这是选项3'},
|
|
15
|
+
{value: 4, label: '选项4', description: '这是选项4'},
|
|
16
|
+
{value: 5, label: '选项5', description: '这是选项5'},
|
|
17
|
+
{value: 6, label: '选项6', description: '这是选项6'},
|
|
18
|
+
{value: 7, label: '选项7', description: '这是选项7'},
|
|
19
|
+
{value: 8, label: '选项8', description: '这是选项8'}
|
|
20
|
+
], [])
|
|
21
|
+
|
|
22
|
+
const rowsGroup = React.useMemo(() => Map.groupBy(rows, item => item.value), [rows])
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<>
|
|
26
|
+
<Button onClick={() => setOpen(true)}>打开选择对话框</Button>
|
|
27
|
+
<PickerDialog
|
|
28
|
+
open={open}
|
|
29
|
+
onClose={() => setOpen(false)}
|
|
30
|
+
title="选择对话框"
|
|
31
|
+
options={rows}
|
|
32
|
+
multiple
|
|
33
|
+
primaryKey="value"
|
|
34
|
+
selectedItemProps={value => {
|
|
35
|
+
const item = rowsGroup.get(value)[0]
|
|
36
|
+
return {
|
|
37
|
+
title: item.label,
|
|
38
|
+
description: item.description
|
|
39
|
+
}
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
<DataGrid
|
|
43
|
+
primaryKey="value"
|
|
44
|
+
columns={[
|
|
45
|
+
{
|
|
46
|
+
title: 'Label',
|
|
47
|
+
field: 'label',
|
|
48
|
+
}
|
|
49
|
+
]}
|
|
50
|
+
rows={rows}
|
|
51
|
+
/>
|
|
52
|
+
</PickerDialog>
|
|
53
|
+
</>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Placeholder 占位符
|
|
2
|
+
|
|
3
|
+
## 示例
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import {Flex, Placeholder} from '@canlooks/can-ui'
|
|
7
|
+
|
|
8
|
+
export default function Index() {
|
|
9
|
+
return (
|
|
10
|
+
<Flex wrap="wrap" gap={12}>
|
|
11
|
+
<Placeholder/>
|
|
12
|
+
<Placeholder status="searching"/>
|
|
13
|
+
<Placeholder status="success"/>
|
|
14
|
+
<Placeholder status="error"/>
|
|
15
|
+
<Placeholder status="warning"/>
|
|
16
|
+
<Placeholder status="info" description="这是描述信息"/>
|
|
17
|
+
</Flex>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Props
|
|
23
|
+
|
|
24
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
25
|
+
|-------------|----------------------------------------------------------------------|---------|----|
|
|
26
|
+
| status | 'empty' \| 'searching' \|'success' \| 'error' \| 'warning' \| 'info' | 'empty' | |
|
|
27
|
+
| image | ReactNode | |
|
|
28
|
+
| title | ReactNode | |
|
|
29
|
+
| description | ReactNode | |
|
|
30
|
+
| extra | ReactNode | |
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Progress 进度条
|
|
2
|
+
|
|
3
|
+
## 示例
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import {Progress} from '@canlooks/can-ui'
|
|
7
|
+
|
|
8
|
+
export default function Index() {
|
|
9
|
+
return (
|
|
10
|
+
<Flex width="100%" direction="column" gap={24}>
|
|
11
|
+
<Progress value={23.45}/>
|
|
12
|
+
<Flex>
|
|
13
|
+
<Flex flex={1} justifyContent="center">
|
|
14
|
+
<Progress variant="circular" value={23.45}/>
|
|
15
|
+
</Flex>
|
|
16
|
+
<Flex flex={1} justifyContent="center">
|
|
17
|
+
<Progress variant="gauge" value={23.45}/>
|
|
18
|
+
</Flex>
|
|
19
|
+
<Flex flex={1} justifyContent="center">
|
|
20
|
+
<Progress variant="circular" indeterminate/>
|
|
21
|
+
</Flex>
|
|
22
|
+
</Flex>
|
|
23
|
+
<Progress indeterminate/>
|
|
24
|
+
</Flex>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Props
|
|
30
|
+
|
|
31
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
32
|
+
|---------------|-----------------------------------------------------------------|-----------|---------------------------------|
|
|
33
|
+
| showInfo | boolean | true | 是否显示文字 |
|
|
34
|
+
| renderInfo | (value: number) => ReactNode | - | |
|
|
35
|
+
| color | string | 'primary' | |
|
|
36
|
+
| status | 'default' \| 'processing' \| 'success' \| 'error' | 'default' | |
|
|
37
|
+
| variant | 'linear' \| 'circular' \| 'gauge' | 'linear' | |
|
|
38
|
+
| gapDegree | number | 90 | `variant`为`gauge`时有效,下方缺口的角度 |
|
|
39
|
+
| size | number | 60 | `variant`为`circular`时有效,表示圆圈的大小 |
|
|
40
|
+
| barWidth | number | 4 | 表示进度条粗细,或圆环的宽度 |
|
|
41
|
+
| indeterminate | boolean | false | 若为`true`,则会一直播放动画 |
|
|
42
|
+
| strokeLinecap | SVGAttributes<SVGCircleElement>['strokeLinecap'] | - | 传递至`<circle/>`元素的属性 |
|
|
43
|
+
| value | number | 0 | 百分比,0 - 100 |
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Radio 单选框
|
|
2
|
+
|
|
3
|
+
## 示例
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import {Radio} from '@canlooks/can-ui'
|
|
7
|
+
|
|
8
|
+
export default function Index() {
|
|
9
|
+
return (
|
|
10
|
+
<Radio label="选择"/>
|
|
11
|
+
)
|
|
12
|
+
}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## RadioGroup
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import {RadioGroup} from '@canlooks/can-ui'
|
|
19
|
+
|
|
20
|
+
export default function Index() {
|
|
21
|
+
return (
|
|
22
|
+
<RadioGroup
|
|
23
|
+
defaultValue={1}
|
|
24
|
+
items={[
|
|
25
|
+
{
|
|
26
|
+
label: '选项1',
|
|
27
|
+
value: 1
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: '选项2',
|
|
31
|
+
value: 2
|
|
32
|
+
}
|
|
33
|
+
]}
|
|
34
|
+
/>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Rating 评分
|
|
2
|
+
|
|
3
|
+
## 示例
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import {Flex, Rating} from '@canlooks/can-ui'
|
|
7
|
+
import React from 'react'
|
|
8
|
+
|
|
9
|
+
export default function Index() {
|
|
10
|
+
const [value, setValue] = React.useState(1.5)
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<Flex gap={24}>
|
|
14
|
+
<Rating value={value} onChange={setValue} allowHalf/>
|
|
15
|
+
<div>{value.toFixed(1)}分</div>
|
|
16
|
+
</Flex>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Props
|
|
22
|
+
|
|
23
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
24
|
+
|-----------------------|---------------------------------------------------|-----------|------------------------------------|
|
|
25
|
+
| color | string | '#FFCC00' | |
|
|
26
|
+
| size | 'small' \| 'medium' \| 'large' | 'medium' | |
|
|
27
|
+
| count | number | 5 | 星星的数量 |
|
|
28
|
+
| renderStar | ReactNode \| ({index, active, half}) => ReactNode | - | 自定义渲染星星 |
|
|
29
|
+
| allowHalf | boolean | false | 允许选中半颗星 |
|
|
30
|
+
| highlightSelectedOnly | boolean | false | 是否只高亮选中的星星,默认`false`表示从第一颗星开始高亮至选中 |
|
|
31
|
+
| defaultValue | number | - | |
|
|
32
|
+
| value | number | - | |
|
|
33
|
+
| onChange | (value) => void | - | |
|
|
34
|
+
| readOnly | boolean | | |
|
|
35
|
+
| disabled | boolean | | |
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Resizable 尺寸调整
|
|
2
|
+
|
|
3
|
+
## 示例
|
|
4
|
+
|
|
5
|
+
鼠标可拖拽`left`与`right`之间的边框调整尺寸
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import {Flex, Resizable} from '@canlooks/can-ui'
|
|
9
|
+
|
|
10
|
+
export default function Index() {
|
|
11
|
+
return (
|
|
12
|
+
<Flex width="100%">
|
|
13
|
+
<Resizable
|
|
14
|
+
handlers="r"
|
|
15
|
+
style={{padding: 24, background: 'pink'}}
|
|
16
|
+
>
|
|
17
|
+
left
|
|
18
|
+
</Resizable>
|
|
19
|
+
<Flex
|
|
20
|
+
flex={1}
|
|
21
|
+
style={{padding: 24, background: 'yellow'}}
|
|
22
|
+
>
|
|
23
|
+
right
|
|
24
|
+
</Flex>
|
|
25
|
+
</Flex>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Props
|
|
31
|
+
|
|
32
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
33
|
+
|----------------|-------------------------|----------------------------------------------|----------------------|
|
|
34
|
+
| variant | 'mouse' \| 'touch' | 'mouse' | 触屏端建议使用`touch` |
|
|
35
|
+
| handles | string \| string[] | ['t', 'r', 'b', 'l', 'tl', 'tr', 'br', 'bl'] | |
|
|
36
|
+
| handleSize | number | | |
|
|
37
|
+
| handleColor | string | | |
|
|
38
|
+
| handlePosition | 'outside' \| 'inside' | 'outside' | `variant`为`touch`时生效 |
|
|
39
|
+
| fixedRatio | boolean | false | 是否固定长宽比例 |
|
|
40
|
+
| onResize | (width, height) => void | - | |
|
|
41
|
+
| onResizeEnd | (width, height) => void | - | |
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Scrollbar 滚动条
|
|
2
|
+
|
|
3
|
+
## 示例
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import {Scrollbar} from '@canlooks/can-ui'
|
|
7
|
+
|
|
8
|
+
export default function Index() {
|
|
9
|
+
return (
|
|
10
|
+
<Scrollbar style={{height: 200}}>
|
|
11
|
+
<p>这里有很长很长的内容</p>
|
|
12
|
+
<p>这里有很长很长的内容</p>
|
|
13
|
+
<p>这里有很长很长的内容</p>
|
|
14
|
+
<p>这里有很长很长的内容</p>
|
|
15
|
+
<p>这里有很长很长的内容</p>
|
|
16
|
+
<p>这里有很长很长的内容</p>
|
|
17
|
+
<p>这里有很长很长的内容</p>
|
|
18
|
+
<p>这里有很长很长的内容</p>
|
|
19
|
+
<p>这里有很长很长的内容</p>
|
|
20
|
+
</Scrollbar>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Props
|
|
26
|
+
|
|
27
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
28
|
+
|----------|----------------------|-----------|----------------------------------------------|
|
|
29
|
+
| variant | 'contain' \| 'cover' | 'contain' | `contain`: 滚动条会挤压内容区域<br/>`cover` 滚动条会覆盖在内容上 |
|
|
30
|
+
| autoHide | boolean | true | 是否自动隐藏滚动条 |
|
|
31
|
+
| size | string \| number | '0.8em' | 是否自动隐藏滚动条 |
|