@fjyueke/bify-mcp 1.0.0
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/LICENSE +21 -0
- package/README.md +34 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +248 -0
- package/metaData/components/action-sheet/api.md +74 -0
- package/metaData/components/action-sheet/doc.md +243 -0
- package/metaData/components/action-sheet/example/index.tsx +116 -0
- package/metaData/components/area-picker/api.md +25 -0
- package/metaData/components/area-picker/doc.md +132 -0
- package/metaData/components/area-picker/example/index.tsx +60 -0
- package/metaData/components/avatar/api.md +19 -0
- package/metaData/components/avatar/doc.md +170 -0
- package/metaData/components/avatar/example/index.tsx +76 -0
- package/metaData/components/back-top/api.md +21 -0
- package/metaData/components/back-top/doc.md +142 -0
- package/metaData/components/back-top/example/index.tsx +96 -0
- package/metaData/components/backdrop/api.md +20 -0
- package/metaData/components/backdrop/doc.md +98 -0
- package/metaData/components/backdrop/example/index.tsx +33 -0
- package/metaData/components/badge/api.md +10 -0
- package/metaData/components/badge/doc.md +169 -0
- package/metaData/components/badge/example/index.tsx +81 -0
- package/metaData/components/button/api.md +31 -0
- package/metaData/components/button/doc.md +235 -0
- package/metaData/components/button/example/index.tsx +235 -0
- package/metaData/components/calendar/api.md +62 -0
- package/metaData/components/calendar/doc.md +516 -0
- package/metaData/components/calendar/example/index.tsx +501 -0
- package/metaData/components/cascader/api.md +55 -0
- package/metaData/components/cascader/doc.md +358 -0
- package/metaData/components/cascader/example/index.tsx +159 -0
- package/metaData/components/cell/api.md +37 -0
- package/metaData/components/cell/doc.md +158 -0
- package/metaData/components/cell/example/index.tsx +44 -0
- package/metaData/components/checkbox/api.md +35 -0
- package/metaData/components/checkbox/doc.md +203 -0
- package/metaData/components/checkbox/example/index.tsx +94 -0
- package/metaData/components/circle/api.md +17 -0
- package/metaData/components/circle/doc.md +123 -0
- package/metaData/components/circle/example/index.tsx +81 -0
- package/metaData/components/collapse/api.md +31 -0
- package/metaData/components/collapse/doc.md +142 -0
- package/metaData/components/collapse/example/index.tsx +81 -0
- package/metaData/components/config-provider/api.md +7 -0
- package/metaData/components/config-provider/doc.md +193 -0
- package/metaData/components/config-provider/example/index.tsx +54 -0
- package/metaData/components/countdown/api.md +46 -0
- package/metaData/components/countdown/doc.md +167 -0
- package/metaData/components/countdown/example/index.tsx +70 -0
- package/metaData/components/datetime-picker/api.md +25 -0
- package/metaData/components/datetime-picker/doc.md +317 -0
- package/metaData/components/datetime-picker/example/index.tsx +265 -0
- package/metaData/components/dialog/api.md +66 -0
- package/metaData/components/dialog/doc.md +292 -0
- package/metaData/components/dialog/example/index.tsx +138 -0
- package/metaData/components/divider/api.md +15 -0
- package/metaData/components/divider/doc.md +108 -0
- package/metaData/components/divider/example/index.tsx +45 -0
- package/metaData/components/dropdown-menu/api.md +37 -0
- package/metaData/components/dropdown-menu/doc.md +279 -0
- package/metaData/components/dropdown-menu/example/index.tsx +182 -0
- package/metaData/components/empty/api.md +20 -0
- package/metaData/components/empty/doc.md +126 -0
- package/metaData/components/empty/example/index.tsx +66 -0
- package/metaData/components/field/api.md +10 -0
- package/metaData/components/field/doc.md +274 -0
- package/metaData/components/field/example/index.tsx +203 -0
- package/metaData/components/fixed-nav/api.md +21 -0
- package/metaData/components/fixed-nav/doc.md +196 -0
- package/metaData/components/fixed-nav/example/index.tsx +80 -0
- package/metaData/components/fixed-view/api.md +10 -0
- package/metaData/components/fixed-view/doc.md +25 -0
- package/metaData/components/fixed-view/example/index.tsx +12 -0
- package/metaData/components/flex/api.md +18 -0
- package/metaData/components/flex/doc.md +103 -0
- package/metaData/components/flex/example/index.tsx +58 -0
- package/metaData/components/floating-bubble/api.md +18 -0
- package/metaData/components/floating-bubble/doc.md +94 -0
- package/metaData/components/floating-bubble/example/index.tsx +55 -0
- package/metaData/components/floating-panel/api.md +19 -0
- package/metaData/components/floating-panel/doc.md +174 -0
- package/metaData/components/floating-panel/example/index.tsx +131 -0
- package/metaData/components/form/api.md +124 -0
- package/metaData/components/form/doc.md +759 -0
- package/metaData/components/form/example/index.tsx +222 -0
- package/metaData/components/grid/api.md +28 -0
- package/metaData/components/grid/doc.md +167 -0
- package/metaData/components/grid/example/index.tsx +80 -0
- package/metaData/components/image/api.md +42 -0
- package/metaData/components/image/doc.md +117 -0
- package/metaData/components/image/example/index.tsx +76 -0
- package/metaData/components/index-list/api.md +39 -0
- package/metaData/components/index-list/doc.md +176 -0
- package/metaData/components/index-list/example/index.tsx +110 -0
- package/metaData/components/list/api.md +30 -0
- package/metaData/components/list/doc.md +317 -0
- package/metaData/components/list/example/index.tsx +218 -0
- package/metaData/components/loading/api.md +10 -0
- package/metaData/components/loading/doc.md +113 -0
- package/metaData/components/loading/example/index.tsx +47 -0
- package/metaData/components/navbar/api.md +26 -0
- package/metaData/components/navbar/doc.md +85 -0
- package/metaData/components/navbar/example/index.tsx +28 -0
- package/metaData/components/notice-bar/api.md +28 -0
- package/metaData/components/notice-bar/doc.md +154 -0
- package/metaData/components/notice-bar/example/index.tsx +107 -0
- package/metaData/components/notify/api.md +28 -0
- package/metaData/components/notify/doc.md +140 -0
- package/metaData/components/notify/example/index.tsx +89 -0
- package/metaData/components/number-keyboard/api.md +21 -0
- package/metaData/components/number-keyboard/doc.md +247 -0
- package/metaData/components/number-keyboard/example/index.tsx +201 -0
- package/metaData/components/pagination/api.md +18 -0
- package/metaData/components/pagination/doc.md +113 -0
- package/metaData/components/pagination/example/index.tsx +73 -0
- package/metaData/components/password-input/api.md +25 -0
- package/metaData/components/password-input/doc.md +126 -0
- package/metaData/components/password-input/example/index.tsx +124 -0
- package/metaData/components/picker/api.md +61 -0
- package/metaData/components/picker/doc.md +336 -0
- package/metaData/components/picker/example/index.tsx +232 -0
- package/metaData/components/popup/api.md +48 -0
- package/metaData/components/popup/doc.md +150 -0
- package/metaData/components/popup/example/index.tsx +214 -0
- package/metaData/components/progress/api.md +11 -0
- package/metaData/components/progress/doc.md +105 -0
- package/metaData/components/progress/example/index.tsx +58 -0
- package/metaData/components/pull-refresh/api.md +18 -0
- package/metaData/components/pull-refresh/doc.md +198 -0
- package/metaData/components/pull-refresh/example/index.tsx +153 -0
- package/metaData/components/radio/api.md +26 -0
- package/metaData/components/radio/doc.md +201 -0
- package/metaData/components/radio/example/index.tsx +103 -0
- package/metaData/components/rate/api.md +23 -0
- package/metaData/components/rate/doc.md +122 -0
- package/metaData/components/rate/example/index.tsx +36 -0
- package/metaData/components/rolling-text/api.md +23 -0
- package/metaData/components/rolling-text/doc.md +153 -0
- package/metaData/components/rolling-text/example/index.tsx +150 -0
- package/metaData/components/safe-area/api.md +8 -0
- package/metaData/components/safe-area/doc.md +30 -0
- package/metaData/components/safe-area/example/index.tsx +16 -0
- package/metaData/components/search/api.md +35 -0
- package/metaData/components/search/doc.md +185 -0
- package/metaData/components/search/example/index.tsx +101 -0
- package/metaData/components/share-sheet/api.md +48 -0
- package/metaData/components/share-sheet/doc.md +215 -0
- package/metaData/components/share-sheet/example/index.tsx +143 -0
- package/metaData/components/sidebar/api.md +28 -0
- package/metaData/components/sidebar/doc.md +122 -0
- package/metaData/components/sidebar/example/index.tsx +58 -0
- package/metaData/components/signature/api.md +19 -0
- package/metaData/components/signature/doc.md +115 -0
- package/metaData/components/signature/example/index.tsx +56 -0
- package/metaData/components/skeleton/api.md +45 -0
- package/metaData/components/skeleton/doc.md +131 -0
- package/metaData/components/skeleton/example/index.tsx +80 -0
- package/metaData/components/slider/api.md +28 -0
- package/metaData/components/slider/doc.md +151 -0
- package/metaData/components/slider/example/index.tsx +54 -0
- package/metaData/components/space/api.md +12 -0
- package/metaData/components/space/doc.md +125 -0
- package/metaData/components/space/example/index.tsx +75 -0
- package/metaData/components/stepper/api.md +37 -0
- package/metaData/components/stepper/doc.md +152 -0
- package/metaData/components/stepper/example/index.tsx +45 -0
- package/metaData/components/steps/api.md +9 -0
- package/metaData/components/steps/doc.md +143 -0
- package/metaData/components/steps/example/index.tsx +93 -0
- package/metaData/components/sticky/api.md +16 -0
- package/metaData/components/sticky/doc.md +87 -0
- package/metaData/components/sticky/example/index.tsx +62 -0
- package/metaData/components/swipe-cell/api.md +19 -0
- package/metaData/components/swipe-cell/doc.md +105 -0
- package/metaData/components/swipe-cell/example/index.tsx +62 -0
- package/metaData/components/swiper/api.md +22 -0
- package/metaData/components/swiper/doc.md +228 -0
- package/metaData/components/swiper/example/index.tsx +118 -0
- package/metaData/components/switch/api.md +17 -0
- package/metaData/components/switch/doc.md +110 -0
- package/metaData/components/switch/example/index.tsx +57 -0
- package/metaData/components/tabbar/api.md +27 -0
- package/metaData/components/tabbar/doc.md +160 -0
- package/metaData/components/tabbar/example/index.tsx +99 -0
- package/metaData/components/tabs/api.md +36 -0
- package/metaData/components/tabs/doc.md +307 -0
- package/metaData/components/tabs/example/index.tsx +231 -0
- package/metaData/components/tag/api.md +17 -0
- package/metaData/components/tag/doc.md +162 -0
- package/metaData/components/tag/example/index.tsx +84 -0
- package/metaData/components/text-ellipsis/api.md +26 -0
- package/metaData/components/text-ellipsis/doc.md +135 -0
- package/metaData/components/text-ellipsis/example/index.tsx +44 -0
- package/metaData/components/timeline/api.md +20 -0
- package/metaData/components/timeline/doc.md +210 -0
- package/metaData/components/timeline/example/index.tsx +145 -0
- package/metaData/components/toast/api.md +39 -0
- package/metaData/components/toast/doc.md +256 -0
- package/metaData/components/toast/example/index.tsx +136 -0
- package/metaData/components/tree-select/api.md +19 -0
- package/metaData/components/tree-select/doc.md +185 -0
- package/metaData/components/tree-select/example/index.tsx +112 -0
- package/metaData/components/uploader/api.md +32 -0
- package/metaData/components/uploader/doc.md +340 -0
- package/metaData/components/uploader/example/index.tsx +222 -0
- package/metaData/components/watermark/api.md +18 -0
- package/metaData/components/watermark/doc.md +97 -0
- package/metaData/components/watermark/example/index.tsx +62 -0
- package/metaData/components-index.json +274 -0
- package/package.json +56 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { Field, Input, Picker, Popup, Toast } from "@fjyueke/bify-core"
|
|
2
|
+
import { ArrowRight } from "@fjyueke/bify-icons"
|
|
3
|
+
import { useMemo, useState } from "react"
|
|
4
|
+
import Block from "../../../components/block"
|
|
5
|
+
import CustomWrapper from "../../../components/custom-wrapper"
|
|
6
|
+
import Page from "../../../components/page"
|
|
7
|
+
import "./index.scss"
|
|
8
|
+
|
|
9
|
+
function BasicPicker() {
|
|
10
|
+
const columns = useMemo(() => [
|
|
11
|
+
{ label2: "杭州", value: "Hangzhou" },
|
|
12
|
+
{ label2: "宁波", value: "Ningbo" },
|
|
13
|
+
{ label2: "温州", value: "Wenzhou" },
|
|
14
|
+
{ label2: "绍兴", value: "Shaoxing" },
|
|
15
|
+
{ label2: "湖州", value: "Huzhou" }
|
|
16
|
+
], [])
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<Toast id="toast" />
|
|
21
|
+
<Picker
|
|
22
|
+
title="标题"
|
|
23
|
+
columns={columns}
|
|
24
|
+
columnsFieldNames={{ label: "label2" }}
|
|
25
|
+
onChange={(value) => Toast.open(`当前值:${value}`)}
|
|
26
|
+
onConfirm={(value) => Toast.open(`当前值:${value}`)}
|
|
27
|
+
>
|
|
28
|
+
</Picker>
|
|
29
|
+
</>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function DefaultPicker() {
|
|
34
|
+
const columns = useMemo(() => [
|
|
35
|
+
{ label: "杭州", value: "Hangzhou" },
|
|
36
|
+
{ label: "宁波", value: "Ningbo" },
|
|
37
|
+
{ label: "温州", value: "Wenzhou" },
|
|
38
|
+
{ label: "绍兴", value: "Shaoxing" },
|
|
39
|
+
{ label: "湖州", value: "Huzhou" }
|
|
40
|
+
], [])
|
|
41
|
+
return (
|
|
42
|
+
<>
|
|
43
|
+
<Toast id="toast" />
|
|
44
|
+
<Picker
|
|
45
|
+
defaultValue="Wenzhou"
|
|
46
|
+
title="标题"
|
|
47
|
+
columns={columns}
|
|
48
|
+
onChange={(value) => Toast.open(`当前值:${value}`)}
|
|
49
|
+
onConfirm={(value) => Toast.open(`当前值:${value}`)}
|
|
50
|
+
>
|
|
51
|
+
</Picker>
|
|
52
|
+
</>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function PickerWithMultiColumns() {
|
|
57
|
+
const columns = useMemo(() => [
|
|
58
|
+
[
|
|
59
|
+
{ label: "周一", value: "Monday" },
|
|
60
|
+
{ label: "周二", value: "Tuesday" },
|
|
61
|
+
{ label: "周三", value: "Wednesday" },
|
|
62
|
+
{ label: "周四", value: "Thursday" },
|
|
63
|
+
{ label: "周五", value: "Friday" }
|
|
64
|
+
],
|
|
65
|
+
[
|
|
66
|
+
{ label: "上午", value: "morning" },
|
|
67
|
+
{ label: "下午", value: "afternoon"},
|
|
68
|
+
{ label: "晚上", value: "evening"}
|
|
69
|
+
]
|
|
70
|
+
], [])
|
|
71
|
+
return (
|
|
72
|
+
<>
|
|
73
|
+
<Toast id="toast" />
|
|
74
|
+
<Picker
|
|
75
|
+
defaultValue={["Monday", "evening"]}
|
|
76
|
+
title="标题"
|
|
77
|
+
columns={columns}
|
|
78
|
+
onChange={(value) => Toast.open(`当前值:${value}`)}
|
|
79
|
+
onConfirm={(value) => Toast.open(`当前值:${value}`)}
|
|
80
|
+
>
|
|
81
|
+
</Picker>
|
|
82
|
+
</>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function DisabledPicker() {
|
|
87
|
+
const columns = useMemo(() => [
|
|
88
|
+
{ label: "杭州", value: "Hangzhou" },
|
|
89
|
+
{ label: "宁波", value: "Ningbo" },
|
|
90
|
+
{ label: "温州", value: "Wenzhou", disabled: true },
|
|
91
|
+
{ label: "绍兴", value: "Shaoxing" },
|
|
92
|
+
{ label: "湖州", value: "Huzhou" }
|
|
93
|
+
], [])
|
|
94
|
+
return (
|
|
95
|
+
<Picker
|
|
96
|
+
columns={columns}
|
|
97
|
+
onChange={(value) => Toast.open(`当前值:${value}`)}
|
|
98
|
+
onConfirm={(value) => Toast.open(`当前值:${value}`)}
|
|
99
|
+
>
|
|
100
|
+
</Picker>
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function LoadingPicker() {
|
|
105
|
+
const columns = useMemo(() => [
|
|
106
|
+
{ label: "杭州", value: "Hangzhou" },
|
|
107
|
+
{ label: "宁波", value: "Ningbo" },
|
|
108
|
+
{ label: "温州", value: "Wenzhou" },
|
|
109
|
+
{ label: "绍兴", value: "Shaoxing" },
|
|
110
|
+
{ label: "湖州", value: "Huzhou" }
|
|
111
|
+
], [])
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<>
|
|
115
|
+
<Toast id="toast" />
|
|
116
|
+
<Picker
|
|
117
|
+
loading
|
|
118
|
+
title="标题"
|
|
119
|
+
columns={columns}
|
|
120
|
+
onChange={(value) => Toast.open(`当前值:${value}`)}
|
|
121
|
+
onConfirm={(value) => Toast.open(`当前值:${value}`)}
|
|
122
|
+
>
|
|
123
|
+
</Picker>
|
|
124
|
+
</>
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function PickerPopup() {
|
|
129
|
+
const [value, setValue] = useState("")
|
|
130
|
+
const [openPicker, setOpenPicker] = useState(false)
|
|
131
|
+
const columns = useMemo(() => [
|
|
132
|
+
{ label: "杭州", value: "Hangzhou" },
|
|
133
|
+
{ label: "宁波", value: "Ningbo" },
|
|
134
|
+
{ label: "温州", value: "Wenzhou" },
|
|
135
|
+
{ label: "绍兴", value: "Shaoxing" },
|
|
136
|
+
{ label: "湖州", value: "Huzhou" }
|
|
137
|
+
], [])
|
|
138
|
+
return (
|
|
139
|
+
<>
|
|
140
|
+
<Field label="城市" isLink onClick={() => setOpenPicker(true)}>
|
|
141
|
+
<Input readonly placeholder="选择城市" value={value} />
|
|
142
|
+
</Field>
|
|
143
|
+
<Popup open={openPicker} rounded placement="bottom" onClose={setOpenPicker}>
|
|
144
|
+
<Popup.Backdrop />
|
|
145
|
+
<Picker
|
|
146
|
+
title="搭配弹出层使用"
|
|
147
|
+
cancelText="取消"
|
|
148
|
+
confirmText="确认"
|
|
149
|
+
columns={columns}
|
|
150
|
+
onCancel={() => setOpenPicker(false)}
|
|
151
|
+
onConfirm={(values) => {
|
|
152
|
+
setValue(values as string)
|
|
153
|
+
setOpenPicker(false)
|
|
154
|
+
}}
|
|
155
|
+
>
|
|
156
|
+
</Picker>
|
|
157
|
+
</Popup>
|
|
158
|
+
</>
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function ManualPicker() {
|
|
163
|
+
return (
|
|
164
|
+
<>
|
|
165
|
+
<Toast id="toast" />
|
|
166
|
+
<Picker
|
|
167
|
+
onChange={(value) => Toast.open(`当前值:${value}`)}
|
|
168
|
+
onConfirm={(value) => Toast.open(`当前值:${value}`)}
|
|
169
|
+
>
|
|
170
|
+
<Picker.Toolbar>
|
|
171
|
+
<Picker.Button>取消</Picker.Button>
|
|
172
|
+
<Picker.Title>标题</Picker.Title>
|
|
173
|
+
<Picker.Button>确认</Picker.Button>
|
|
174
|
+
</Picker.Toolbar>
|
|
175
|
+
<Picker.Column>
|
|
176
|
+
<Picker.Option>周一</Picker.Option>
|
|
177
|
+
<Picker.Option>周二</Picker.Option>
|
|
178
|
+
<Picker.Option>周三</Picker.Option>
|
|
179
|
+
<Picker.Option>周四</Picker.Option>
|
|
180
|
+
<Picker.Option>周五</Picker.Option>
|
|
181
|
+
</Picker.Column>
|
|
182
|
+
<Picker.Column>
|
|
183
|
+
<Picker.Option>上午</Picker.Option>
|
|
184
|
+
<Picker.Option>下午</Picker.Option>
|
|
185
|
+
<Picker.Option>晚上</Picker.Option>
|
|
186
|
+
</Picker.Column>
|
|
187
|
+
</Picker>
|
|
188
|
+
</>
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export default function PickerDemo() {
|
|
193
|
+
return (
|
|
194
|
+
<Page title="Picker 选择器" className="picker-demo">
|
|
195
|
+
<Block variant="card" title="基础用法">
|
|
196
|
+
<CustomWrapper>
|
|
197
|
+
<BasicPicker />
|
|
198
|
+
</CustomWrapper>
|
|
199
|
+
</Block>
|
|
200
|
+
<Block variant="card" title="默认选中项">
|
|
201
|
+
<CustomWrapper>
|
|
202
|
+
<DefaultPicker />
|
|
203
|
+
</CustomWrapper>
|
|
204
|
+
</Block>
|
|
205
|
+
<Block variant="card" title="多列选择">
|
|
206
|
+
<CustomWrapper>
|
|
207
|
+
<PickerWithMultiColumns />
|
|
208
|
+
</CustomWrapper>
|
|
209
|
+
</Block>
|
|
210
|
+
<Block variant="card" title="禁用选项">
|
|
211
|
+
<CustomWrapper>
|
|
212
|
+
<DisabledPicker />
|
|
213
|
+
</CustomWrapper>
|
|
214
|
+
</Block>
|
|
215
|
+
<Block variant="card" title="加载状态">
|
|
216
|
+
<CustomWrapper>
|
|
217
|
+
<LoadingPicker />
|
|
218
|
+
</CustomWrapper>
|
|
219
|
+
</Block>
|
|
220
|
+
<Block variant="card" title="搭配弹出层使用">
|
|
221
|
+
<CustomWrapper>
|
|
222
|
+
<PickerPopup />
|
|
223
|
+
</CustomWrapper>
|
|
224
|
+
</Block>
|
|
225
|
+
<Block variant="card" title="手动控制DOM">
|
|
226
|
+
<CustomWrapper>
|
|
227
|
+
<ManualPicker />
|
|
228
|
+
</CustomWrapper>
|
|
229
|
+
</Block>
|
|
230
|
+
</Page>
|
|
231
|
+
)
|
|
232
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
## API
|
|
2
|
+
|
|
3
|
+
### Popup Props
|
|
4
|
+
|
|
5
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
6
|
+
| --------------------- | --------------------------------------------------------- | ------------------ | -------- |
|
|
7
|
+
| defaultOpen | 默认是否显示弹出层 | _boolean_ | `false` |
|
|
8
|
+
| open | 是否显示弹出层 | _boolean_ | `false` |
|
|
9
|
+
| placement | 弹出位置,可选值为 `top` `bottom` `right` `left` `center` | _string_ | `center` |
|
|
10
|
+
| duration | 动画时长,单位毫秒 | _number \| string_ | `300` |
|
|
11
|
+
| rounded | 是否显示圆角 | _boolean_ | `false` |
|
|
12
|
+
| lock `v0.1.4-alpha.0` | 是否锁定背景滚动 | _boolean_ | `true` |
|
|
13
|
+
|
|
14
|
+
动画相关参数继承自 `Transition` 组件,详细属性参见:[Transition 组件](/components/style/#动画)
|
|
15
|
+
| Popup 参数 | Transition 对应参数 |
|
|
16
|
+
| --------- | ---------------------- |
|
|
17
|
+
| mountOnEnter | mountOnEnter |
|
|
18
|
+
| transactionName | name |
|
|
19
|
+
| transitionAppear | appear |
|
|
20
|
+
| transactionTimeout | timeout |
|
|
21
|
+
| onTransitionEnter | onEnter |
|
|
22
|
+
| onTransitionEntered | onEntered |
|
|
23
|
+
| onTransitionExit | onExit |
|
|
24
|
+
| onTransitionExited | onExited |
|
|
25
|
+
|
|
26
|
+
### Popup.Backdrop Props
|
|
27
|
+
|
|
28
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
29
|
+
| --------- | ---------------------- | ------------------ | ------- |
|
|
30
|
+
| className | 背景板类名 | _string_ | `false` |
|
|
31
|
+
| style | 背景板样式 | _CSSProperties_ | `false` |
|
|
32
|
+
| open | 是否显示背景板 | _boolean_ | `false` |
|
|
33
|
+
| closeable | 是否在点击遮罩层后关闭 | _boolean_ | `true` |
|
|
34
|
+
| duration | 动画时长,单位毫秒 | _number \| string_ | `300` |
|
|
35
|
+
|
|
36
|
+
### Popup.Close Props
|
|
37
|
+
|
|
38
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
39
|
+
| --------- | ------------------------------------------------------------ | ----------- | ----------- |
|
|
40
|
+
| placement | 关闭图标位置,可选值 `top-left` `bottom-left` `bottom-right` | _string_ | `top-right` |
|
|
41
|
+
| children | 图标内容 | _ReactNode_ | `<Cross />` |
|
|
42
|
+
|
|
43
|
+
### Events
|
|
44
|
+
|
|
45
|
+
| 事件名 | 说明 | 回调参数 |
|
|
46
|
+
| ------- | ---------------- | -------------------- |
|
|
47
|
+
| onClick | 点击弹出层时触发 | _event: ITouchEvent_ |
|
|
48
|
+
| onClose | 关闭弹出层时触发 | - |
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Popup 弹出层
|
|
2
|
+
|
|
3
|
+
### 介绍
|
|
4
|
+
|
|
5
|
+
弹出层容器,用于展示弹窗、信息提示等内容,支持多个弹出层叠加展示。
|
|
6
|
+
|
|
7
|
+
### 引入
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Popup } from "@fjyueke/bify-core"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 代码演示
|
|
14
|
+
|
|
15
|
+
### 基础用法
|
|
16
|
+
|
|
17
|
+
通过 `open` 控制弹出层是否展示。
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
<Popup open>内容</Popup>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 弹出位置
|
|
24
|
+
|
|
25
|
+
通过 `placement` 属性设置弹出位置,默认居中弹出,可以设置为 `top`、`bottom`、`left`、`right`。
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
<Popup defaultOpen placement="top" style={{ height: "30%" }} />
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 关闭图标
|
|
32
|
+
|
|
33
|
+
设置 `Popup.Close` 属性后,会在弹出层的右上角显示关闭图标,并且可以通过 `closeIcon` 属性自定义图标。
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
<Popup defaultOpen placement="bottom" style={{ height: '30%' }}>
|
|
37
|
+
<Popup.Close />
|
|
38
|
+
</Popup>
|
|
39
|
+
|
|
40
|
+
<!-- 自定义图标 -->
|
|
41
|
+
<Popup defaultOpen placement="bottom" style={{ height: '30%' }}>
|
|
42
|
+
<Popup.Close>
|
|
43
|
+
<Close />
|
|
44
|
+
</Popup.Close>
|
|
45
|
+
</Popup>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 圆角弹窗
|
|
49
|
+
|
|
50
|
+
设置 `rounded` 属性后,弹窗会根据弹出位置添加不同的圆角样式。
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
<!-- 圆角弹窗(居中) -->
|
|
54
|
+
<Popup
|
|
55
|
+
open
|
|
56
|
+
style={{
|
|
57
|
+
padding: "64px",
|
|
58
|
+
}}
|
|
59
|
+
rounded
|
|
60
|
+
lock={false}
|
|
61
|
+
>
|
|
62
|
+
内容
|
|
63
|
+
</Popup>
|
|
64
|
+
|
|
65
|
+
<!-- 圆角弹窗(底部) -->
|
|
66
|
+
<Popup open rounded placement="bottom" style={{ height: '30%' }} />
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 禁止滚动穿透
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
<Popup lock>
|
|
73
|
+
<View>无法滑动</View>
|
|
74
|
+
</Popup>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
如果需要内容支持溢出滚动,则需要包裹一层 ScrollView 组件。
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
<Popup lock>
|
|
81
|
+
<ScrollView>可以滑动</ScrollView>
|
|
82
|
+
</Popup>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## API
|
|
86
|
+
|
|
87
|
+
### Popup Props
|
|
88
|
+
|
|
89
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
90
|
+
| --------------------- | --------------------------------------------------------- | ------------------ | -------- |
|
|
91
|
+
| defaultOpen | 默认是否显示弹出层 | _boolean_ | `false` |
|
|
92
|
+
| open | 是否显示弹出层 | _boolean_ | `false` |
|
|
93
|
+
| placement | 弹出位置,可选值为 `top` `bottom` `right` `left` `center` | _string_ | `center` |
|
|
94
|
+
| duration | 动画时长,单位毫秒 | _number \| string_ | `300` |
|
|
95
|
+
| rounded | 是否显示圆角 | _boolean_ | `false` |
|
|
96
|
+
| lock `v0.1.4-alpha.0` | 是否锁定背景滚动 | _boolean_ | `true` |
|
|
97
|
+
|
|
98
|
+
动画相关参数继承自 `Transition` 组件,详细属性参见:[Transition 组件](/components/style/#动画)
|
|
99
|
+
| Popup 参数 | Transition 对应参数 |
|
|
100
|
+
| --------- | ---------------------- |
|
|
101
|
+
| mountOnEnter | mountOnEnter |
|
|
102
|
+
| transactionName | name |
|
|
103
|
+
| transitionAppear | appear |
|
|
104
|
+
| transactionTimeout | timeout |
|
|
105
|
+
| onTransitionEnter | onEnter |
|
|
106
|
+
| onTransitionEntered | onEntered |
|
|
107
|
+
| onTransitionExit | onExit |
|
|
108
|
+
| onTransitionExited | onExited |
|
|
109
|
+
|
|
110
|
+
### Popup.Backdrop Props
|
|
111
|
+
|
|
112
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
113
|
+
| --------- | ---------------------- | ------------------ | ------- |
|
|
114
|
+
| className | 背景板类名 | _string_ | `false` |
|
|
115
|
+
| style | 背景板样式 | _CSSProperties_ | `false` |
|
|
116
|
+
| open | 是否显示背景板 | _boolean_ | `false` |
|
|
117
|
+
| closeable | 是否在点击遮罩层后关闭 | _boolean_ | `true` |
|
|
118
|
+
| duration | 动画时长,单位毫秒 | _number \| string_ | `300` |
|
|
119
|
+
|
|
120
|
+
### Popup.Close Props
|
|
121
|
+
|
|
122
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
123
|
+
| --------- | ------------------------------------------------------------ | ----------- | ----------- |
|
|
124
|
+
| placement | 关闭图标位置,可选值 `top-left` `bottom-left` `bottom-right` | _string_ | `top-right` |
|
|
125
|
+
| children | 图标内容 | _ReactNode_ | `<Cross />` |
|
|
126
|
+
|
|
127
|
+
### Events
|
|
128
|
+
|
|
129
|
+
| 事件名 | 说明 | 回调参数 |
|
|
130
|
+
| ------- | ---------------- | -------------------- |
|
|
131
|
+
| onClick | 点击弹出层时触发 | _event: ITouchEvent_ |
|
|
132
|
+
| onClose | 关闭弹出层时触发 | - |
|
|
133
|
+
|
|
134
|
+
## 主题定制
|
|
135
|
+
|
|
136
|
+
### 样式变量
|
|
137
|
+
|
|
138
|
+
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/) 组件。
|
|
139
|
+
|
|
140
|
+
| 名称 | 默认值 | 描述 |
|
|
141
|
+
| ------------------------------- | -------------------------------- | ---- |
|
|
142
|
+
| --popup-z-index | _1010_ | - |
|
|
143
|
+
| --popup-background-color | _var(--background-color-light)_ | - |
|
|
144
|
+
| --popup-animation-duration | _var(--animation-duration-base)_ | - |
|
|
145
|
+
| --popup-rounded-border-radius | _16px \* $hd_ | - |
|
|
146
|
+
| --popup-close-icon-z-index | _1_ | - |
|
|
147
|
+
| --popup-close-icon-size | _22px \* $hd_ | - |
|
|
148
|
+
| --popup-close-icon-color | _var(--gray-5)_ | - |
|
|
149
|
+
| --popup-close-icon-active-color | _var(--gray-6)_ | - |
|
|
150
|
+
| --popup-close-icon-margin | _16px \* $hd_ | - |
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { ScrollView } from "@tarojs/components"
|
|
2
|
+
import { Cell, Popup } from "@fjyueke/bify-core"
|
|
3
|
+
import { PopupPlacement } from "@fjyueke/bify-core/popup"
|
|
4
|
+
import { Close } from "@fjyueke/bify-icons"
|
|
5
|
+
import { CSSProperties, useState } from "react"
|
|
6
|
+
import Block from "../../../components/block"
|
|
7
|
+
import Page from "../../../components/page"
|
|
8
|
+
import "./index.scss"
|
|
9
|
+
|
|
10
|
+
function BasicPopup() {
|
|
11
|
+
const [open, setOpen] = useState(false)
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<Cell clickable title="显示遮盖层" isLink onClick={() => setOpen(true)} />
|
|
15
|
+
<Popup
|
|
16
|
+
open={open}
|
|
17
|
+
style={{
|
|
18
|
+
padding: "30px 50px",
|
|
19
|
+
}}
|
|
20
|
+
onClose={setOpen}
|
|
21
|
+
>
|
|
22
|
+
内容
|
|
23
|
+
</Popup>
|
|
24
|
+
</>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function CenterRoundPopup() {
|
|
29
|
+
const [open, setOpen] = useState(false)
|
|
30
|
+
return (
|
|
31
|
+
<>
|
|
32
|
+
<Cell
|
|
33
|
+
clickable
|
|
34
|
+
title="圆角弹窗(居中)"
|
|
35
|
+
isLink
|
|
36
|
+
onClick={() => setOpen(true)}
|
|
37
|
+
/>
|
|
38
|
+
<Popup
|
|
39
|
+
open={open}
|
|
40
|
+
style={{
|
|
41
|
+
padding: "64px",
|
|
42
|
+
}}
|
|
43
|
+
onClose={setOpen}
|
|
44
|
+
rounded
|
|
45
|
+
>
|
|
46
|
+
内容
|
|
47
|
+
</Popup>
|
|
48
|
+
</>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function LockPopup() {
|
|
53
|
+
const [open, setOpen] = useState(false)
|
|
54
|
+
const [data] = useState(new Array(30).fill(0))
|
|
55
|
+
return (
|
|
56
|
+
<>
|
|
57
|
+
<Cell
|
|
58
|
+
clickable
|
|
59
|
+
title="弹窗(禁止滚动穿透)"
|
|
60
|
+
isLink
|
|
61
|
+
onClick={() => setOpen(true)}
|
|
62
|
+
/>
|
|
63
|
+
<Popup
|
|
64
|
+
open={open}
|
|
65
|
+
style={{
|
|
66
|
+
height: "30%",
|
|
67
|
+
}}
|
|
68
|
+
rounded
|
|
69
|
+
lock
|
|
70
|
+
placement="bottom"
|
|
71
|
+
onClose={setOpen}
|
|
72
|
+
>
|
|
73
|
+
<ScrollView className="popup-demo-scroll" scrollY>
|
|
74
|
+
{data.map((_, index) => (
|
|
75
|
+
<Cell key={index}>内容-{index}</Cell>
|
|
76
|
+
))}
|
|
77
|
+
</ScrollView>
|
|
78
|
+
</Popup>
|
|
79
|
+
</>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface OpenOptions {
|
|
84
|
+
open?: boolean
|
|
85
|
+
closeable?: boolean
|
|
86
|
+
customer?: boolean
|
|
87
|
+
style?: CSSProperties
|
|
88
|
+
placement?: PopupPlacement
|
|
89
|
+
rounded?: boolean
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export default function PopupDemo() {
|
|
93
|
+
const [options, setOptions] = useState<OpenOptions>({})
|
|
94
|
+
|
|
95
|
+
function handleOpen({ placement, rounded, closeable, customer }: OpenOptions) {
|
|
96
|
+
const openOptions: OpenOptions = {
|
|
97
|
+
open: true,
|
|
98
|
+
placement,
|
|
99
|
+
rounded,
|
|
100
|
+
closeable,
|
|
101
|
+
customer,
|
|
102
|
+
}
|
|
103
|
+
if (placement === "left" || placement === "right") {
|
|
104
|
+
openOptions.style = {
|
|
105
|
+
height: "100%",
|
|
106
|
+
width: "40%",
|
|
107
|
+
}
|
|
108
|
+
} else if (placement) {
|
|
109
|
+
openOptions.style = { height: "30%" }
|
|
110
|
+
}
|
|
111
|
+
setOptions({
|
|
112
|
+
...options,
|
|
113
|
+
...openOptions,
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<Page title="Popup 弹出层" className="popup-demo">
|
|
119
|
+
<Block variant="card" title="基础用法">
|
|
120
|
+
<BasicPopup />
|
|
121
|
+
</Block>
|
|
122
|
+
<Block variant="card" title="弹出位置">
|
|
123
|
+
<Cell
|
|
124
|
+
clickable
|
|
125
|
+
title="顶部弹出"
|
|
126
|
+
isLink
|
|
127
|
+
onClick={() => handleOpen({ placement: "top" })}
|
|
128
|
+
/>
|
|
129
|
+
<Cell
|
|
130
|
+
clickable
|
|
131
|
+
title="底部弹出"
|
|
132
|
+
isLink
|
|
133
|
+
onClick={() => handleOpen({ placement: "bottom" })}
|
|
134
|
+
/>
|
|
135
|
+
<Cell
|
|
136
|
+
clickable
|
|
137
|
+
title="左侧弹出"
|
|
138
|
+
isLink
|
|
139
|
+
onClick={() => handleOpen({ placement: "left" })}
|
|
140
|
+
/>
|
|
141
|
+
<Cell
|
|
142
|
+
clickable
|
|
143
|
+
title="右侧弹出"
|
|
144
|
+
isLink
|
|
145
|
+
onClick={() => handleOpen({ placement: "right" })}
|
|
146
|
+
/>
|
|
147
|
+
</Block>
|
|
148
|
+
<Block variant="card" title="关闭按钮">
|
|
149
|
+
<Cell
|
|
150
|
+
clickable
|
|
151
|
+
title="顶部弹出"
|
|
152
|
+
isLink
|
|
153
|
+
onClick={() => handleOpen({ placement: "top", closeable: true })}
|
|
154
|
+
/>
|
|
155
|
+
<Cell
|
|
156
|
+
clickable
|
|
157
|
+
title="底部弹出"
|
|
158
|
+
isLink
|
|
159
|
+
onClick={() => handleOpen({ placement: "bottom", closeable: true })}
|
|
160
|
+
/>
|
|
161
|
+
<Cell
|
|
162
|
+
clickable
|
|
163
|
+
title="左侧弹出"
|
|
164
|
+
isLink
|
|
165
|
+
onClick={() => handleOpen({ placement: "left", closeable: true })}
|
|
166
|
+
/>
|
|
167
|
+
<Cell
|
|
168
|
+
clickable
|
|
169
|
+
title="右侧弹出"
|
|
170
|
+
isLink
|
|
171
|
+
onClick={() => handleOpen({ placement: "right", closeable: true })}
|
|
172
|
+
/>
|
|
173
|
+
<Cell
|
|
174
|
+
clickable
|
|
175
|
+
title="自定义图标"
|
|
176
|
+
isLink
|
|
177
|
+
onClick={() => handleOpen({ placement: "bottom", closeable: true, customer: true })}
|
|
178
|
+
/>
|
|
179
|
+
</Block>
|
|
180
|
+
<Block variant="card" title="圆角弹窗">
|
|
181
|
+
<CenterRoundPopup />
|
|
182
|
+
<Cell
|
|
183
|
+
clickable
|
|
184
|
+
title="圆角弹窗(底部)"
|
|
185
|
+
isLink
|
|
186
|
+
onClick={() => handleOpen({ placement: "bottom", rounded: true })}
|
|
187
|
+
/>
|
|
188
|
+
</Block>
|
|
189
|
+
<Block variant="card" title="禁止滚动穿透">
|
|
190
|
+
<LockPopup />
|
|
191
|
+
</Block>
|
|
192
|
+
<Popup
|
|
193
|
+
open={options.open}
|
|
194
|
+
placement={options.placement}
|
|
195
|
+
rounded={options.rounded}
|
|
196
|
+
style={options.style}
|
|
197
|
+
onClose={() =>
|
|
198
|
+
setOptions({
|
|
199
|
+
...options,
|
|
200
|
+
open: false,
|
|
201
|
+
})
|
|
202
|
+
}
|
|
203
|
+
>
|
|
204
|
+
<Popup.Backdrop />
|
|
205
|
+
{options.closeable && !options.customer && <Popup.Close />}
|
|
206
|
+
{options.closeable && options.customer && (
|
|
207
|
+
<Popup.Close>
|
|
208
|
+
<Close />
|
|
209
|
+
</Popup.Close>
|
|
210
|
+
)}
|
|
211
|
+
</Popup>
|
|
212
|
+
</Page>
|
|
213
|
+
)
|
|
214
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
## API
|
|
2
|
+
|
|
3
|
+
### Props
|
|
4
|
+
|
|
5
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
6
|
+
| ----------- | -------------------------- | ---------------------- | --------- |
|
|
7
|
+
| percent | 进度百分比 | _number \| string_ | `0` |
|
|
8
|
+
| strokeWidth | 进度条粗细,默认单位为`px` | _number \| string_ | `4px` |
|
|
9
|
+
| color | 进度条颜色 | _string_ | `primary` |
|
|
10
|
+
| inactive | 是否置灰 | _boolean_ | `false` |
|
|
11
|
+
| label | 进度文字 | _boolean \| ReactNode_ | `true` |
|