@canlooks/can-ui 0.0.42 → 0.0.43
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/alert/alert.style.js +1 -0
- package/dist/cjs/components/checkboxBase/checkboxBase.js +1 -2
- package/dist/cjs/components/checkboxBaseGroup/checkboxBaseGroup.d.ts +0 -2
- package/dist/cjs/components/checkboxBaseGroup/checkboxBaseGroup.js +3 -3
- package/dist/cjs/components/clickAway/clickAway.d.ts +285 -1
- package/dist/cjs/components/clickAway/clickAway.js +1 -2
- package/dist/cjs/components/dataGrid/columnResize.js +5 -5
- package/dist/cjs/components/dataGrid/dataGrid.js +1 -1
- package/dist/cjs/components/dataGrid/dataGridRows.js +3 -1
- package/dist/cjs/components/descriptions/descriptionItem.d.ts +3 -3
- package/dist/cjs/components/draggable/draggable.d.ts +6 -6
- package/dist/cjs/components/draggable/draggable.js +13 -18
- package/dist/cjs/components/{image/imagePreview.d.ts → gallery/gallery.d.ts} +7 -3
- package/dist/cjs/components/gallery/gallery.js +165 -0
- package/dist/{esm/components/image/imagePreview.style.d.ts → cjs/components/gallery/gallery.style.d.ts} +3 -1
- package/dist/cjs/components/{image/imagePreview.style.js → gallery/gallery.style.js} +49 -13
- package/dist/cjs/components/gallery/imageItem.d.ts +14 -0
- package/dist/cjs/components/gallery/imageItem.js +51 -0
- package/dist/cjs/components/gallery/index.d.ts +1 -0
- package/dist/cjs/components/gallery/index.js +4 -0
- package/dist/cjs/components/image/image.d.ts +2 -2
- package/dist/cjs/components/image/image.js +3 -3
- package/dist/cjs/components/image/index.d.ts +0 -1
- package/dist/cjs/components/image/index.js +0 -1
- package/dist/cjs/components/overlayBase/overlayBase.js +1 -1
- package/dist/cjs/components/palette/palette.d.ts +3 -3
- package/dist/cjs/components/palette/palette.js +9 -9
- package/dist/cjs/components/pickerDialog/pickerDialog.style.js +6 -0
- package/dist/cjs/components/pinchable/index.d.ts +1 -0
- package/dist/cjs/components/pinchable/index.js +4 -0
- package/dist/cjs/components/pinchable/pinchable.d.ts +33 -0
- package/dist/cjs/components/pinchable/pinchable.js +160 -0
- package/dist/cjs/components/pinchable/pinchable.style.d.ts +6 -0
- package/dist/cjs/components/pinchable/pinchable.style.js +21 -0
- package/dist/cjs/components/placeholder/placeholder.style.js +1 -0
- package/dist/cjs/components/progress/progress.d.ts +1 -1
- package/dist/cjs/components/rating/rating.d.ts +2 -2
- package/dist/cjs/components/rating/rating.js +2 -5
- package/dist/cjs/components/rating/rating.style.js +1 -2
- package/dist/cjs/components/resizable/resizable.d.ts +2 -2
- package/dist/cjs/components/resizable/resizable.js +12 -12
- package/dist/cjs/components/scrollbar/scrollbar.d.ts +1 -1
- package/dist/cjs/components/scrollbar/scrollbar.js +6 -6
- package/dist/cjs/components/segmented/SegmentedOption.d.ts +1 -1
- package/dist/cjs/components/selectedList/selectedItem.js +1 -1
- package/dist/cjs/components/selectedList/selectedList.style.js +1 -1
- package/dist/cjs/components/skeleton/skeleton.d.ts +1 -1
- package/dist/cjs/components/slidableActions/slidableActions.d.ts +9 -5
- package/dist/cjs/components/slidableActions/slidableActions.js +21 -25
- package/dist/cjs/components/slidableActions/slidableActions.style.d.ts +1 -1
- package/dist/cjs/components/slidableActions/slidableActions.style.js +14 -13
- package/dist/cjs/components/slidableActions/slidableActionsAction.d.ts +4 -2
- package/dist/cjs/components/slidableActions/slidableActionsAction.js +6 -2
- package/dist/cjs/components/slider/slider.d.ts +3 -3
- package/dist/cjs/components/slider/slider.js +8 -8
- package/dist/cjs/components/tabs/tabs.js +1 -1
- package/dist/cjs/components/theme/themeVariables.js +1 -1
- package/dist/cjs/components/upload/itemStatus.d.ts +1 -1
- package/dist/cjs/components/upload/itemStatus.js +3 -0
- package/dist/cjs/components/upload/upload.d.ts +3 -3
- package/dist/cjs/components/upload/upload.js +1 -1
- package/dist/cjs/extensions/documentViewer/documentViewer.js +1 -2
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/utils/dnd.d.ts +0 -42
- package/dist/cjs/utils/dnd.js +0 -121
- package/dist/cjs/utils/gesture.d.ts +69 -0
- package/dist/cjs/utils/gesture.js +250 -0
- package/dist/cjs/utils/index.d.ts +1 -0
- package/dist/cjs/utils/index.js +1 -0
- package/dist/cjs/utils/style.js +1 -1
- package/dist/cjs/utils/utils.d.ts +0 -2
- package/dist/cjs/utils/utils.js +0 -2
- package/dist/esm/components/alert/alert.style.js +1 -0
- package/dist/esm/components/checkboxBase/checkboxBase.js +1 -2
- package/dist/esm/components/checkboxBaseGroup/checkboxBaseGroup.d.ts +0 -2
- package/dist/esm/components/checkboxBaseGroup/checkboxBaseGroup.js +4 -4
- package/dist/esm/components/clickAway/clickAway.d.ts +285 -1
- package/dist/esm/components/clickAway/clickAway.js +2 -3
- package/dist/esm/components/dataGrid/columnResize.js +6 -6
- package/dist/esm/components/dataGrid/dataGrid.js +1 -1
- package/dist/esm/components/dataGrid/dataGridRows.js +3 -1
- package/dist/esm/components/descriptions/descriptionItem.d.ts +3 -3
- package/dist/esm/components/draggable/draggable.d.ts +6 -6
- package/dist/esm/components/draggable/draggable.js +14 -19
- package/dist/esm/components/{image/imagePreview.d.ts → gallery/gallery.d.ts} +7 -3
- package/dist/esm/components/gallery/gallery.js +162 -0
- package/dist/{cjs/components/image/imagePreview.style.d.ts → esm/components/gallery/gallery.style.d.ts} +3 -1
- package/dist/esm/components/{image/imagePreview.style.js → gallery/gallery.style.js} +49 -13
- package/dist/esm/components/gallery/imageItem.d.ts +14 -0
- package/dist/esm/components/gallery/imageItem.js +48 -0
- package/dist/esm/components/gallery/index.d.ts +1 -0
- package/dist/esm/components/gallery/index.js +1 -0
- package/dist/esm/components/image/image.d.ts +2 -2
- package/dist/esm/components/image/image.js +3 -3
- package/dist/esm/components/image/index.d.ts +0 -1
- package/dist/esm/components/image/index.js +0 -1
- package/dist/esm/components/overlayBase/overlayBase.js +1 -1
- package/dist/esm/components/palette/palette.d.ts +3 -3
- package/dist/esm/components/palette/palette.js +10 -10
- package/dist/esm/components/pickerDialog/pickerDialog.style.js +6 -0
- package/dist/esm/components/pinchable/index.d.ts +1 -0
- package/dist/esm/components/pinchable/index.js +1 -0
- package/dist/esm/components/pinchable/pinchable.d.ts +33 -0
- package/dist/esm/components/pinchable/pinchable.js +157 -0
- package/dist/esm/components/pinchable/pinchable.style.d.ts +6 -0
- package/dist/esm/components/pinchable/pinchable.style.js +18 -0
- package/dist/esm/components/placeholder/placeholder.style.js +1 -0
- package/dist/esm/components/progress/progress.d.ts +1 -1
- package/dist/esm/components/rating/rating.d.ts +2 -2
- package/dist/esm/components/rating/rating.js +2 -5
- package/dist/esm/components/rating/rating.style.js +1 -2
- package/dist/esm/components/resizable/resizable.d.ts +2 -2
- package/dist/esm/components/resizable/resizable.js +13 -13
- package/dist/esm/components/scrollbar/scrollbar.d.ts +1 -1
- package/dist/esm/components/scrollbar/scrollbar.js +7 -7
- package/dist/esm/components/segmented/SegmentedOption.d.ts +1 -1
- package/dist/esm/components/selectedList/selectedItem.js +1 -1
- package/dist/esm/components/selectedList/selectedList.style.js +1 -1
- package/dist/esm/components/skeleton/skeleton.d.ts +1 -1
- package/dist/esm/components/slidableActions/slidableActions.d.ts +9 -5
- package/dist/esm/components/slidableActions/slidableActions.js +22 -26
- package/dist/esm/components/slidableActions/slidableActions.style.d.ts +1 -1
- package/dist/esm/components/slidableActions/slidableActions.style.js +14 -13
- package/dist/esm/components/slidableActions/slidableActionsAction.d.ts +4 -2
- package/dist/esm/components/slidableActions/slidableActionsAction.js +6 -2
- package/dist/esm/components/slider/slider.d.ts +3 -3
- package/dist/esm/components/slider/slider.js +9 -9
- package/dist/esm/components/tabs/tabs.js +1 -1
- package/dist/esm/components/theme/themeVariables.js +1 -1
- package/dist/esm/components/upload/itemStatus.d.ts +1 -1
- package/dist/esm/components/upload/itemStatus.js +3 -0
- package/dist/esm/components/upload/upload.d.ts +3 -3
- package/dist/esm/components/upload/upload.js +1 -1
- package/dist/esm/extensions/documentViewer/documentViewer.js +2 -3
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/utils/dnd.d.ts +0 -42
- package/dist/esm/utils/dnd.js +0 -120
- package/dist/esm/utils/gesture.d.ts +69 -0
- package/dist/esm/utils/gesture.js +245 -0
- package/dist/esm/utils/index.d.ts +1 -0
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/style.js +1 -1
- package/dist/esm/utils/utils.d.ts +0 -2
- package/dist/esm/utils/utils.js +0 -2
- package/documentation/dist/assets/{index-B6FOULC1.js → index-DXo4Z-bc.js} +1281 -1271
- package/documentation/dist/components/actionSheet.md +3 -3
- package/documentation/dist/components/autocomplete.md +10 -10
- package/documentation/dist/components/breadcrumb.md +1 -1
- package/documentation/dist/components/checkbox.md +24 -1
- package/documentation/dist/components/contextMenu.md +1 -1
- package/documentation/dist/components/counter.md +13 -13
- package/documentation/dist/components/dialog.md +3 -3
- package/documentation/dist/components/formDialog.md +6 -6
- package/documentation/dist/components/image.md +5 -3
- package/documentation/dist/components/menu.md +1 -1
- package/documentation/dist/components/pagination.md +15 -1
- 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 +56 -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/globalMethods.md +6 -6
- package/documentation/dist/index.html +1 -1
- package/package.json +6 -6
- package/dist/cjs/components/image/imagePreview.js +0 -63
- package/dist/esm/components/image/imagePreview.js +0 -60
|
@@ -30,7 +30,7 @@ export default function Index() {
|
|
|
30
30
|
| 属性 | 类型 | 默认值 | 说明 |
|
|
31
31
|
|----------------|-----------------------------------------|-------|---------------------|
|
|
32
32
|
| title | ReactNode | - | 标题 |
|
|
33
|
-
| actions | [MenuItemProps](/components/menuItem)[] | - | 菜单 |
|
|
33
|
+
| actions | [MenuItemProps](/components/menuItem#MenuItemProps)[] | - | 菜单 |
|
|
34
34
|
| placement | 'top' \| 'bottom' | - | 弹出菜单的位置 |
|
|
35
35
|
| maskClosable | boolean | false | 是否可通过点击遮罩层关闭对话框 |
|
|
36
36
|
| escapeClosable | boolean | true | 是否可通过键盘的【ESC】键关闭对话框 |
|
|
@@ -42,8 +42,8 @@ export default function Index() {
|
|
|
42
42
|
| onClose | (reason) => void | - | 关闭回调 |
|
|
43
43
|
| showConfirm | boolean | false | 是否显示确定选项 |
|
|
44
44
|
| confirmText | ReactNode | '确定' | |
|
|
45
|
-
| confirmProps | [MenuItemProps](/components/menuItem) | - | |
|
|
45
|
+
| confirmProps | [MenuItemProps](/components/menuItem#MenuItemProps) | - | |
|
|
46
46
|
| showCancel | boolean | true | 是否显示取消选项 |
|
|
47
47
|
| cancelText | ReactNode | '取消' | |
|
|
48
|
-
| cancelProps | [MenuItemProps](/components/menuItem) | - | |
|
|
48
|
+
| cancelProps | [MenuItemProps](/components/menuItem#MenuItemProps) | - | |
|
|
49
49
|
| slideProps | TransitionBaseProps | - | 传递给<Slide/>动画组件的属性 |
|
|
@@ -56,13 +56,13 @@ export default function Index() {
|
|
|
56
56
|
|
|
57
57
|
`<Autocomplete/>`组件继承了`<Input/>`组件的所有属性外,还有如下属性:
|
|
58
58
|
|
|
59
|
-
| 属性 | 类型
|
|
60
|
-
|
|
61
|
-
| options | [MenuItemProps](/components/menuItem)[]
|
|
62
|
-
| loadOptions | (inputValue) => options \| Promise\<options>
|
|
63
|
-
| primaryKey | string \| number
|
|
64
|
-
| labelKey | string \| number
|
|
65
|
-
| onSelect | (selectedValue, option) => void
|
|
66
|
-
| renderInput | (inputProps) => ReactElement
|
|
67
|
-
| popperProps | [PopperProps](/components/popper)
|
|
68
|
-
| popperRef | [PopperRef](/components/popper)
|
|
59
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
60
|
+
|-------------|-------------------------------------------------------|---------|------------------|
|
|
61
|
+
| options | [MenuItemProps](/components/menuItem#MenuItemProps)[] | - | 选项 |
|
|
62
|
+
| loadOptions | (inputValue) => options \| Promise\<options> | - | 动态加载的选项 |
|
|
63
|
+
| primaryKey | string \| number | 'value' | 指定选项中的主键名 |
|
|
64
|
+
| labelKey | string \| number | 'label' | 指定选项中用于当作label的键 |
|
|
65
|
+
| onSelect | (selectedValue, option) => void | - | 选中回调 |
|
|
66
|
+
| renderInput | (inputProps) => ReactElement | - | 自定义渲染输入框 |
|
|
67
|
+
| popperProps | [PopperProps](/components/popper) | - | 传递给`Popper`组件的属性 |
|
|
68
|
+
| popperRef | [PopperRef](/components/popper) | - | |
|
|
@@ -23,6 +23,6 @@ export default function Index() {
|
|
|
23
23
|
|
|
24
24
|
| 属性 | 类型 | 默认值 | 说明 |
|
|
25
25
|
|-----------|-------------------------------------|-------|-----|
|
|
26
|
-
| items | [ButtonProps](/components/button)[] | - | |
|
|
26
|
+
| items | [ButtonProps](/components/button#Props)[] | - | |
|
|
27
27
|
| separator | ReactNode | '/' | 分隔符 |
|
|
28
28
|
| readOnly | boolean | false | |
|
|
@@ -3,11 +3,34 @@
|
|
|
3
3
|
## 示例
|
|
4
4
|
|
|
5
5
|
```tsx
|
|
6
|
-
import {Checkbox
|
|
6
|
+
import {Checkbox} from '@canlooks/can-ui'
|
|
7
7
|
|
|
8
8
|
export default function Index() {
|
|
9
9
|
return (
|
|
10
10
|
<Checkbox label="选择"/>
|
|
11
11
|
)
|
|
12
12
|
}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### CheckboxGroup
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import {CheckboxGroup} from '@canlooks/can-ui'
|
|
19
|
+
|
|
20
|
+
export default function Index() {
|
|
21
|
+
return (
|
|
22
|
+
<CheckboxGroup
|
|
23
|
+
items={[
|
|
24
|
+
{
|
|
25
|
+
label: '选项1',
|
|
26
|
+
value: 1
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: '选项2',
|
|
30
|
+
value: 2
|
|
31
|
+
}
|
|
32
|
+
]}
|
|
33
|
+
/>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
13
36
|
```
|
|
@@ -24,4 +24,4 @@ export default function Index() {
|
|
|
24
24
|
|
|
25
25
|
| 属性 | 类型 | 默认值 | 说明 |
|
|
26
26
|
|-------|--------------------------------------------------------|-----|----|
|
|
27
|
-
| items | ([MenuItemProps](/components/menuItem) \| ReactNode)[] | - | |
|
|
27
|
+
| items | ([MenuItemProps](/components/menuItem#MenuItemProps) \| ReactNode)[] | - | |
|
|
@@ -14,16 +14,16 @@ export default function Index() {
|
|
|
14
14
|
|
|
15
15
|
## Props
|
|
16
16
|
|
|
17
|
-
| 属性 | 类型
|
|
18
|
-
|
|
19
|
-
| size | 'small' \| 'medium' \| 'large'
|
|
20
|
-
| min | number
|
|
21
|
-
| max | number
|
|
22
|
-
| step | number
|
|
23
|
-
| precision | number
|
|
24
|
-
| defaultValue | number
|
|
25
|
-
| value | number
|
|
26
|
-
| onChange | (value) => void
|
|
27
|
-
| decreaseProps | [ButtonProps](/components/button) | - | 减少按钮的属性 |
|
|
28
|
-
| increaseProps | [ButtonProps](/components/button) | - | 增加按钮的属性 |
|
|
29
|
-
| inputProps | [InputProps](/components/input) | - | `<Input/>`组件的属性 |
|
|
17
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
18
|
+
|---------------|-----------------------------------------|----------|-----------------|
|
|
19
|
+
| size | 'small' \| 'medium' \| 'large' | 'medium' | |
|
|
20
|
+
| min | number | - | |
|
|
21
|
+
| max | number | - | |
|
|
22
|
+
| step | number | 1 | 每次减少或增加的步长 |
|
|
23
|
+
| precision | number | 0 | 数值精度 |
|
|
24
|
+
| defaultValue | number | - | |
|
|
25
|
+
| value | number | - | |
|
|
26
|
+
| onChange | (value) => void | - | |
|
|
27
|
+
| decreaseProps | [ButtonProps](/components/button#Props) | - | 减少按钮的属性 |
|
|
28
|
+
| increaseProps | [ButtonProps](/components/button#Props) | - | 增加按钮的属性 |
|
|
29
|
+
| inputProps | [InputProps](/components/input#Props) | - | `<Input/>`组件的属性 |
|
|
@@ -38,15 +38,15 @@ export default function Index() {
|
|
|
38
38
|
| minWidth | number | - | |
|
|
39
39
|
| maxWidth | number | - | |
|
|
40
40
|
| showClose | boolean | true | |_
|
|
41
|
-
| closeProps | [ButtonProps](/components/button) | - | |_
|
|
41
|
+
| closeProps | [ButtonProps](/components/button#Props) | - | |_
|
|
42
42
|
| showConfirm | boolean | true | |
|
|
43
43
|
| confirmText | ReactNode | '确定' | |
|
|
44
|
-
| confirmProps | [ButtonProps](/components/button) | - | |
|
|
44
|
+
| confirmProps | [ButtonProps](/components/button#Props) | - | |
|
|
45
45
|
| onConfirm | (e) => void | - | |
|
|
46
46
|
| confirmLoading | boolean | false | 确定按钮的loading状态 |
|
|
47
47
|
| showCancel | boolean | true | |
|
|
48
48
|
| cancelText | ReactNode | '确定' | |
|
|
49
|
-
| cancelProps | [ButtonProps](/components/button) | - | |
|
|
49
|
+
| cancelProps | [ButtonProps](/components/button#Props) | - | |
|
|
50
50
|
| onCancel | (e) => void | - | |
|
|
51
51
|
| draggable | boolean | true | 对话框是否可拖拽 |
|
|
52
52
|
| maskClosable | boolean | true | 点击遮罩层是否可关闭对话框 |
|
|
@@ -28,9 +28,9 @@ export default function Index() {
|
|
|
28
28
|
|
|
29
29
|
`<FormDialog/>`组件继承了`<Dialog/>`组件的所有属性,此外还有如下属性:
|
|
30
30
|
|
|
31
|
-
| 属性 | 类型
|
|
32
|
-
|
|
33
|
-
| formProps | [FormProps](/components/form)
|
|
34
|
-
| formRef | [FormRef](/components/form)
|
|
35
|
-
| items | [FormItemProps](/components/form)[] | - | |
|
|
36
|
-
| onFinish | (formValue) => void
|
|
31
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
32
|
+
|-----------|---------------------------------------------------|-----|-------------------|
|
|
33
|
+
| formProps | [FormProps](/components/form#FormProps) | - | 传递给`<Form/>`组件的属性 |
|
|
34
|
+
| formRef | [FormRef](/components/form#FormRef) | - | |
|
|
35
|
+
| items | [FormItemProps](/components/form#FormItemProps)[] | - | |
|
|
36
|
+
| onFinish | (formValue) => void | - | |
|
|
@@ -15,11 +15,12 @@ export default function Index() {
|
|
|
15
15
|
## 相册预览示例
|
|
16
16
|
|
|
17
17
|
```tsx
|
|
18
|
-
import {Flex, Image} from '@canlooks/can-ui'
|
|
18
|
+
import {Flex, Gallery, Image} from '@canlooks/can-ui'
|
|
19
19
|
|
|
20
20
|
export default function Index() {
|
|
21
21
|
const src1 = 'https://picsum.photos/seed/seed1/100'
|
|
22
22
|
const src2 = 'https://picsum.photos/seed/seed2/100'
|
|
23
|
+
const src3 = 'https://files.codelife.cc/wallhaven/full/gj/wallhaven-gj8v93.png'
|
|
23
24
|
|
|
24
25
|
const [open, setOpen] = React.useState(false)
|
|
25
26
|
const [index, setIndex] = React.useState(0)
|
|
@@ -35,14 +36,15 @@ export default function Index() {
|
|
|
35
36
|
<Flex gap={12}>
|
|
36
37
|
<Image src={src1} style={{width: 100, height: 100}} onPreview={e => previewHandler(e, 0)}/>
|
|
37
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)}/>
|
|
38
40
|
</Flex>
|
|
39
41
|
|
|
40
|
-
<
|
|
42
|
+
<Gallery
|
|
41
43
|
open={open}
|
|
42
44
|
onOpenChange={setOpen}
|
|
43
45
|
index={index}
|
|
44
46
|
onIndexChange={setIndex}
|
|
45
|
-
src={[src1, src2]}
|
|
47
|
+
src={[src1, src2, src3]}
|
|
46
48
|
/>
|
|
47
49
|
</>
|
|
48
50
|
)
|
|
@@ -21,4 +21,18 @@ export default function Index() {
|
|
|
21
21
|
</Flex>
|
|
22
22
|
)
|
|
23
23
|
}
|
|
24
|
-
```
|
|
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' | 是否自动隐藏滚动条 |
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Segmented 段落选择器
|
|
2
|
+
|
|
3
|
+
## 示例
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import {Segmented} from '@canlooks/can-ui'
|
|
7
|
+
|
|
8
|
+
export default function Index() {
|
|
9
|
+
return (
|
|
10
|
+
<Segmented
|
|
11
|
+
options={[
|
|
12
|
+
{
|
|
13
|
+
label: '选项1',
|
|
14
|
+
value: 1
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
label: '选项2',
|
|
18
|
+
value: 2
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: '选项3',
|
|
22
|
+
value: 3
|
|
23
|
+
}
|
|
24
|
+
]}
|
|
25
|
+
defaultValue={1}
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## SegmentedProps
|
|
32
|
+
|
|
33
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
34
|
+
|--------------|------------------------------------------------------------------------|--------------|----------------------|
|
|
35
|
+
| options | [SegmentedOptionProps](#SegmentedOptionProps)[] | - | |
|
|
36
|
+
| orientation | 'horizontal' \| 'vertical' | 'horizontal' | |
|
|
37
|
+
| size | 'small' \| 'medium' \| 'large' | 'medium' | |
|
|
38
|
+
| labelKey | string | 'label' | `option`中用做`label`的键 |
|
|
39
|
+
| primaryKey | string | 'value' | `option`中用做主键的键 |
|
|
40
|
+
| fullWidth | boolean | false | 是否占满整行 |
|
|
41
|
+
| defaultValue | | - | |
|
|
42
|
+
| value | | - | |
|
|
43
|
+
| onChange | (value) => void | - | |
|
|
44
|
+
| readOnly | boolean | false | |
|
|
45
|
+
| disabled | boolean | false | |
|
|
46
|
+
|
|
47
|
+
## SegmentedOptionProps
|
|
48
|
+
|
|
49
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
50
|
+
|-------------|------------------------------------------------------------------------|-------|-------------|
|
|
51
|
+
| orientation | 'horizontal' \| 'vertical' | - | |
|
|
52
|
+
| prefix | ReactNode | - | 前缀,通常用于渲染图标 |
|
|
53
|
+
| suffix | ReactNode | - | 后缀 |
|
|
54
|
+
| value | string \| number | - | |
|
|
55
|
+
| label | ReactNode | - | |
|
|
56
|
+
| disabled | boolean | false | |
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Select 选择器
|
|
2
|
+
|
|
3
|
+
## 示例
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import {Select} from '@canlooks/can-ui'
|
|
7
|
+
|
|
8
|
+
export default function Index() {
|
|
9
|
+
return (
|
|
10
|
+
<Select
|
|
11
|
+
style={{width: 200}}
|
|
12
|
+
options={[
|
|
13
|
+
{
|
|
14
|
+
label: '选项1',
|
|
15
|
+
value: 1
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
label: '选项2',
|
|
19
|
+
value: 2
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
label: '选项3',
|
|
23
|
+
value: 3
|
|
24
|
+
}
|
|
25
|
+
]}
|
|
26
|
+
defaultValue={1}
|
|
27
|
+
/>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Skeleton 骨架屏
|
|
2
|
+
|
|
3
|
+
## 示例
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import {Flex, Skeleton} from '@canlooks/can-ui'
|
|
7
|
+
|
|
8
|
+
export default function Index() {
|
|
9
|
+
return (
|
|
10
|
+
<Flex width="100%" direction="column" gap={24}>
|
|
11
|
+
<Skeleton/>
|
|
12
|
+
<Skeleton.Card/>
|
|
13
|
+
<Skeleton.Table/>
|
|
14
|
+
</Flex>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
22
|
+
|-----------|------------------------------------------|-----------|-----------------|
|
|
23
|
+
| variant | 'circular' \| 'rectangular' \| 'rounded' | 'rounded' | |
|
|
24
|
+
| animation | boolean | true | 是否播放动画 |
|
|
25
|
+
| width | string \| number | - | 同`style.width` |
|
|
26
|
+
| height | string \| number | - | 同`style.height` |
|