@gmfe/react 2.14.30-alpha.0 → 2.14.30
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/README.md +179 -0
- package/package.json +4 -4
- package/src/component/affix/README.md +54 -0
- package/src/component/box/README.md +142 -0
- package/src/component/box/box_table.js +11 -18
- package/src/component/button/README.md +90 -0
- package/src/component/calendar/README.md +98 -0
- package/src/component/carousel/README.md +51 -0
- package/src/component/cascader/README.md +139 -0
- package/src/component/checkbox/README.md +120 -0
- package/src/component/collapse/README.md +80 -0
- package/src/component/color_picker/README.md +50 -0
- package/src/component/date_picker/README.md +144 -0
- package/src/component/date_range_picker/README.md +126 -0
- package/src/component/dialog/README.md +149 -0
- package/src/component/divider/README.md +41 -0
- package/src/component/drawer/README.md +83 -0
- package/src/component/drop_down/README.md +105 -0
- package/src/component/drop_select/README.md +146 -0
- package/src/component/dropper/README.md +55 -0
- package/src/component/editable_text/README.md +68 -0
- package/src/component/filter_select/README.md +104 -0
- package/src/component/flex/README.md +88 -0
- package/src/component/flip_number/README.md +53 -0
- package/src/component/form/README.md +199 -0
- package/src/component/function_set/README.md +93 -0
- package/src/component/grid/README.md +93 -0
- package/src/component/icon_down_up/README.md +43 -0
- package/src/component/image_preview/README.md +57 -0
- package/src/component/img_uploader/README.md +91 -0
- package/src/component/input/README.md +49 -0
- package/src/component/input_number/README.md +93 -0
- package/src/component/layout_root/README.md +181 -0
- package/src/component/lazy_img/README.md +59 -0
- package/src/component/level_list/README.md +75 -0
- package/src/component/level_select/README.md +78 -0
- package/src/component/list/README.md +96 -0
- package/src/component/loading/README.md +116 -0
- package/src/component/mask/README.md +62 -0
- package/src/component/modal/README.md +155 -0
- package/src/component/more_select/README.md +185 -0
- package/src/component/nav/README.md +101 -0
- package/src/component/nprogress/README.md +135 -0
- package/src/component/pagination/README.md +87 -0
- package/src/component/picture_preview/README.md +50 -0
- package/src/component/popover/README.md +146 -0
- package/src/component/popup/README.md +121 -0
- package/src/component/price/README.md +72 -0
- package/src/component/progress/README.md +98 -0
- package/src/component/progress_circle/README.md +92 -0
- package/src/component/radio/README.md +101 -0
- package/src/component/recommend_input/README.md +75 -0
- package/src/component/select/README.md +120 -0
- package/src/component/selection/README.md +87 -0
- package/src/component/sheet/README.md +176 -0
- package/src/component/steps/README.md +55 -0
- package/src/component/storage/README.md +83 -0
- package/src/component/switch/README.md +85 -0
- package/src/component/table_select/README.md +92 -0
- package/src/component/tabs/README.md +85 -0
- package/src/component/time_span/README.md +112 -0
- package/src/component/tip/README.md +105 -0
- package/src/component/tool_tip/README.md +84 -0
- package/src/component/transfer/README.md +98 -0
- package/src/component/transfer_v2/README.md +85 -0
- package/src/component/tree/README.md +99 -0
- package/src/component/tree/index.js +1 -1
- package/src/component/tree_v2/README.md +99 -0
- package/src/component/uploader/README.md +104 -0
- package/src/index.js +1 -3
- package/LICENSE +0 -16
- package/src/hoc/sticky_layout.js +0 -157
package/README.md
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# @gmfe/react
|
|
2
|
+
|
|
3
|
+
## 简介
|
|
4
|
+
|
|
5
|
+
`@gmfe/react` 是 gmfe 组件库的核心 UI 包,提供 70+ 个 React 组件,涵盖表单、布局、导航、反馈、数据展示等常用场景。是所有其他 gmfe 包的基础依赖。
|
|
6
|
+
|
|
7
|
+
## 安装
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @gmfe/react
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 快速使用
|
|
14
|
+
|
|
15
|
+
```jsx
|
|
16
|
+
import { Button, Dialog, Form, Input, Select, Table } from '@gmfe/react'
|
|
17
|
+
|
|
18
|
+
function App() {
|
|
19
|
+
return (
|
|
20
|
+
<Button type="primary" onClick={() => Dialog.alert('Hello!')}>
|
|
21
|
+
点击
|
|
22
|
+
</Button>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 组件列表
|
|
28
|
+
|
|
29
|
+
### 表单组件
|
|
30
|
+
|
|
31
|
+
| 组件 | 说明 |
|
|
32
|
+
|------|------|
|
|
33
|
+
| `Form` | 表单容器,支持校验、提交、重置 |
|
|
34
|
+
| `FormItem` | 表单项,配合 Form 使用 |
|
|
35
|
+
| `FormButton` | 表单按钮组 |
|
|
36
|
+
| `FormBlock` | 表单块 |
|
|
37
|
+
| `FormGroup` | 表单分组 |
|
|
38
|
+
| `FormPanel` | 表单面板 |
|
|
39
|
+
| `Input` | 文本输入框 |
|
|
40
|
+
| `InputNumber` | 数字输入框 |
|
|
41
|
+
| `InputNumberV2` | 数字输入框 V2 |
|
|
42
|
+
| `Select` | 下拉选择框 |
|
|
43
|
+
| `Option` | 选择框选项 |
|
|
44
|
+
| `Checkbox` | 复选框 |
|
|
45
|
+
| `CheckboxGroup` | 复选框组 |
|
|
46
|
+
| `Radio` | 单选框 |
|
|
47
|
+
| `RadioGroup` | 单选框组 |
|
|
48
|
+
| `Switch` | 开关 |
|
|
49
|
+
| `DatePicker` | 日期选择器 |
|
|
50
|
+
| `DateRangePicker` | 日期范围选择器 |
|
|
51
|
+
| `Calendar` | 日历 |
|
|
52
|
+
| `TimeSpan` | 时间段 |
|
|
53
|
+
| `TimeSpanPicker` | 时间段选择器 |
|
|
54
|
+
| `Cascader` | 级联选择器 |
|
|
55
|
+
| `CascaderSelect` | 级联选择(Select 形式) |
|
|
56
|
+
| `ColorPicker` | 颜色选择器 |
|
|
57
|
+
| `Uploader` | 文件上传器 |
|
|
58
|
+
| `ImgUploader` | 图片上传器 |
|
|
59
|
+
| `Validator` | 表单校验工具 |
|
|
60
|
+
|
|
61
|
+
### 布局组件
|
|
62
|
+
|
|
63
|
+
| 组件 | 说明 |
|
|
64
|
+
|------|------|
|
|
65
|
+
| `LayoutRoot` | 根布局容器 |
|
|
66
|
+
| `Flex` | 弹性布局 |
|
|
67
|
+
| `Col` | 栅格列 |
|
|
68
|
+
| `Row` | 栅格行 |
|
|
69
|
+
| `Divider` | 分割线 |
|
|
70
|
+
| `Collapse` | 折叠面板 |
|
|
71
|
+
|
|
72
|
+
### 导航组件
|
|
73
|
+
|
|
74
|
+
| 组件 | 说明 |
|
|
75
|
+
|------|------|
|
|
76
|
+
| `Nav` | 导航栏 |
|
|
77
|
+
| `Tabs` | 标签页 |
|
|
78
|
+
| `Steps` | 步骤条 |
|
|
79
|
+
| `Breadcrumb` | 面包屑(见 @gmfe/frame) |
|
|
80
|
+
| `Pagination` | 分页器 |
|
|
81
|
+
| `PaginationV2` | 分页器 V2 |
|
|
82
|
+
| `PaginationText` | 文本分页器 |
|
|
83
|
+
| `Dropper` | 下拉刷新 |
|
|
84
|
+
|
|
85
|
+
### 反馈组件
|
|
86
|
+
|
|
87
|
+
| 组件 | 说明 |
|
|
88
|
+
|------|------|
|
|
89
|
+
| `Dialog` | 对话框 |
|
|
90
|
+
| `Modal` | 模态框 |
|
|
91
|
+
| `RightSideModal` | 右侧模态框 |
|
|
92
|
+
| `CleanModal` | 简洁模态框 |
|
|
93
|
+
| `Drawer` | 抽屉 |
|
|
94
|
+
| `Tip` | 轻提示 |
|
|
95
|
+
| `ToolTip` | 文字提示 |
|
|
96
|
+
| `Popover` | 气泡卡片 |
|
|
97
|
+
| `Loading` | 加载中 |
|
|
98
|
+
| `LoadingFullScreen` | 全屏加载 |
|
|
99
|
+
| `LoadingChunk` | 区块加载 |
|
|
100
|
+
| `Mask` | 遮罩层 |
|
|
101
|
+
| `NProgress` | 顶部进度条 |
|
|
102
|
+
| `Progress` | 进度条 |
|
|
103
|
+
| `ProgressCircle` | 环形进度条 |
|
|
104
|
+
|
|
105
|
+
### 数据展示
|
|
106
|
+
|
|
107
|
+
| 组件 | 说明 |
|
|
108
|
+
|------|------|
|
|
109
|
+
| `Table` | 表格(见 @gmfe/table) |
|
|
110
|
+
| `List` | 列表 |
|
|
111
|
+
| `Tree` | 树形控件 |
|
|
112
|
+
| `TreeV2` | 树形控件 V2 |
|
|
113
|
+
| `Transfer` | 穿梭框 |
|
|
114
|
+
| `TransferGroup` | 分组穿梭框 |
|
|
115
|
+
| `TransferV2` | 穿梭框 V2 |
|
|
116
|
+
| `Carousel` | 轮播图 |
|
|
117
|
+
| `ImagePreview` | 图片预览 |
|
|
118
|
+
| `PicturePreview` | 图片预览 V2 |
|
|
119
|
+
| `LazyImg` | 图片懒加载 |
|
|
120
|
+
| `FlipNumber` | 翻牌数字 |
|
|
121
|
+
| `Price` | 价格展示 |
|
|
122
|
+
| `LevelList` | 层级列表 |
|
|
123
|
+
| `LevelSelect` | 层级选择 |
|
|
124
|
+
| `TableSelect` | 表格选择 |
|
|
125
|
+
| `Selection` | 选择组件 |
|
|
126
|
+
| `Sheet` | 底部弹出表格 |
|
|
127
|
+
| `SheetColumn` | Sheet 列 |
|
|
128
|
+
| `SheetAction` | Sheet 操作 |
|
|
129
|
+
| `SheetSelect` | Sheet 选择 |
|
|
130
|
+
| `SheetBatchAction` | Sheet 批量操作 |
|
|
131
|
+
| `Box` | 卡片容器 |
|
|
132
|
+
| `BoxForm` | 表单卡片 |
|
|
133
|
+
| `BoxTable` | 表格卡片 |
|
|
134
|
+
| `BoxPanel` | 面板卡片 |
|
|
135
|
+
| `Badge` | 标记 |
|
|
136
|
+
| `Tag` | 标签 |
|
|
137
|
+
| `EditableText` | 可编辑文本 |
|
|
138
|
+
|
|
139
|
+
### 操作组件
|
|
140
|
+
|
|
141
|
+
| 组件 | 说明 |
|
|
142
|
+
|------|------|
|
|
143
|
+
| `Button` | 按钮 |
|
|
144
|
+
| `DropDown` | 下拉菜单 |
|
|
145
|
+
| `DropDownItems` | 下拉菜单项组 |
|
|
146
|
+
| `DropDownItem` | 下拉菜单项 |
|
|
147
|
+
| `DropSelect` | 下拉选择 |
|
|
148
|
+
| `FilterSelect` | 筛选选择 |
|
|
149
|
+
| `MultipleFilterSelect` | 多选筛选 |
|
|
150
|
+
| `MoreSelect` | 多选组件 |
|
|
151
|
+
| `Affix` | 固定定位 |
|
|
152
|
+
| `FunctionSet` | 功能设置 |
|
|
153
|
+
| `IconDownUp` | 上下切换图标 |
|
|
154
|
+
| `PopupContentConfirm` | 弹窗确认内容 |
|
|
155
|
+
| `RecommendInput` | 推荐输入 |
|
|
156
|
+
| `Storage` | 本地存储 |
|
|
157
|
+
|
|
158
|
+
## 相关包
|
|
159
|
+
|
|
160
|
+
| 包名 | 说明 |
|
|
161
|
+
|------|------|
|
|
162
|
+
| `@gmfe/locales` | 国际化支持 |
|
|
163
|
+
| `@gmfe/table` | 基于 react-table-v6 的高级表格 |
|
|
164
|
+
| `@gmfe/table-x` | 基于 react-table v7 的高级表格 |
|
|
165
|
+
| `@gmfe/keyboard` | 表格键盘导航 |
|
|
166
|
+
| `@gmfe/frame` | 页面框架布局 |
|
|
167
|
+
| `@gmfe/business` | 业务组件 |
|
|
168
|
+
| `@gmfe/cropper` | 图片裁剪 |
|
|
169
|
+
| `@gmfe/sortable` | 拖拽排序 |
|
|
170
|
+
| `@gmfe/qiniu-image` | 七牛云图片处理 |
|
|
171
|
+
| `@gmfe/tour` | 引导式教程 |
|
|
172
|
+
| `@gmfe/react-deprecated` | 已废弃组件 |
|
|
173
|
+
|
|
174
|
+
## 注意事项
|
|
175
|
+
|
|
176
|
+
- 依赖 `@svgr/webpack ^4.3.2` 作为 peer dependency,确保 webpack 配置了 svgr loader。
|
|
177
|
+
- 组件支持 React >= 16.12.0。
|
|
178
|
+
- 国际化功能依赖 `@gmfe/locales`,组件内部已集成。
|
|
179
|
+
- 所有组件的详细 API 文档请查看各组件目录下的 README.md。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gmfe/react",
|
|
3
|
-
"version": "2.14.30
|
|
3
|
+
"version": "2.14.30",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "liyatang <liyatang@qq.com>",
|
|
6
6
|
"homepage": "https://github.com/gmfe/gmfe#readme",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"react-dom": "^16.12.0"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@gm-common/tool": "^
|
|
30
|
-
"@gmfe/locales": "^2.14.30
|
|
29
|
+
"@gm-common/tool": "^2.15.8",
|
|
30
|
+
"@gmfe/locales": "^2.14.30",
|
|
31
31
|
"big.js": "^5.2.2",
|
|
32
32
|
"classnames": "^2.2.5",
|
|
33
33
|
"lodash": "^4.17.14",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"prop-types": "^15.7.2",
|
|
36
36
|
"react-window": "^1.8.5"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "ecae7979e69fc5e3bb1185fe84f82f00dfca1159"
|
|
39
39
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Affix
|
|
2
|
+
|
|
3
|
+
## 简介
|
|
4
|
+
固钉组件 - 使用 CSS `position: sticky` 实现元素在滚动时的固定定位效果。
|
|
5
|
+
|
|
6
|
+
## 安装
|
|
7
|
+
已包含在 `@gmfe/react` 中,无需额外安装。
|
|
8
|
+
|
|
9
|
+
## 使用
|
|
10
|
+
```jsx
|
|
11
|
+
import Affix from '@gmfe/react/lib/affix'
|
|
12
|
+
|
|
13
|
+
<Affix top={0}>
|
|
14
|
+
<div>固定在顶部的内容</div>
|
|
15
|
+
</Affix>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
### Props
|
|
21
|
+
| 属性 | 说明 | 类型 | 默认值 | 必填 |
|
|
22
|
+
|------|------|------|--------|------|
|
|
23
|
+
| children | 需要固钉的子元素 | `any` | - | 否 |
|
|
24
|
+
| top | 距离窗口顶部达到指定偏移量后触发固定 | `number` | - | 否 |
|
|
25
|
+
| bottom | 距离窗口底部达到指定偏移量后触发固定 | `number` | - | 否 |
|
|
26
|
+
|
|
27
|
+
## 示例
|
|
28
|
+
|
|
29
|
+
### 固定在顶部
|
|
30
|
+
```jsx
|
|
31
|
+
<Affix top={0}>
|
|
32
|
+
<div>固定在顶部的内容</div>
|
|
33
|
+
</Affix>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 固定在底部
|
|
37
|
+
```jsx
|
|
38
|
+
<Affix bottom={0}>
|
|
39
|
+
<div>固定在底部的内容</div>
|
|
40
|
+
</Affix>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 同时设置顶部和底部
|
|
44
|
+
```jsx
|
|
45
|
+
<Affix top={0} bottom={0}>
|
|
46
|
+
<div>会被钉住在顶部和底部</div>
|
|
47
|
+
</Affix>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## 注意事项
|
|
51
|
+
- 底层使用 CSS `position: sticky` 实现,需要浏览器支持 sticky 定位
|
|
52
|
+
- 默认 `z-index` 为 950
|
|
53
|
+
- `top` 和 `bottom` 可以同时设置,也可以只设置其中一个
|
|
54
|
+
- `top` 和 `bottom` 的单位为像素(px),传入的是数字值
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Box / BoxForm / BoxTable / BoxPanel
|
|
2
|
+
|
|
3
|
+
## 简介
|
|
4
|
+
内容容器组件集 - 提供多种常用内容包裹容器,包括基础容器、表单容器、表格容器和面板容器
|
|
5
|
+
|
|
6
|
+
## 安装
|
|
7
|
+
已包含在 `@gmfe/react` 中,无需额外安装。
|
|
8
|
+
|
|
9
|
+
## 使用
|
|
10
|
+
```jsx
|
|
11
|
+
import { Box, BoxForm, BoxTable, BoxPanel } from '@gmfe/react'
|
|
12
|
+
|
|
13
|
+
// 基础容器
|
|
14
|
+
<Box hasGap>内容区域</Box>
|
|
15
|
+
|
|
16
|
+
// 表单容器
|
|
17
|
+
<BoxForm>表单内容</BoxForm>
|
|
18
|
+
|
|
19
|
+
// 表格容器
|
|
20
|
+
<BoxTable info={<BoxTable.Info>标题</BoxTable.Info>} action={<div>操作</div>}>
|
|
21
|
+
表格内容
|
|
22
|
+
</BoxTable>
|
|
23
|
+
|
|
24
|
+
// 面板容器
|
|
25
|
+
<BoxPanel title="商品明细">面板内容</BoxPanel>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## API
|
|
29
|
+
|
|
30
|
+
### Box Props
|
|
31
|
+
| 属性 | 说明 | 类型 | 默认值 | 必填 |
|
|
32
|
+
|------|------|------|--------|------|
|
|
33
|
+
| hasGap | 是否添加内边距 | `bool` | `false` | 否 |
|
|
34
|
+
| className | 自定义类名 | `string` | - | 否 |
|
|
35
|
+
| style | 自定义样式 | `object` | - | 否 |
|
|
36
|
+
|
|
37
|
+
### BoxForm Props
|
|
38
|
+
| 属性 | 说明 | 类型 | 默认值 | 必填 |
|
|
39
|
+
|------|------|------|--------|------|
|
|
40
|
+
| children | 表单内容(需用 `FormBlock` 包裹) | `node` | - | 否 |
|
|
41
|
+
|
|
42
|
+
### BoxForm.More
|
|
43
|
+
| 属性 | 说明 | 类型 | 必填 |
|
|
44
|
+
|------|------|------|------|
|
|
45
|
+
| children | 展开后的额外表单内容 | `node` | 否 |
|
|
46
|
+
|
|
47
|
+
`BoxForm.More` 可在表单区域和按钮区域重复使用,表示需要展开后才显示的内容。
|
|
48
|
+
|
|
49
|
+
### BoxTable Props
|
|
50
|
+
| 属性 | 说明 | 类型 | 默认值 | 必填 |
|
|
51
|
+
|------|------|------|--------|------|
|
|
52
|
+
| info | 左侧标题区域 | `element` | - | 否 |
|
|
53
|
+
| action | 右侧操作区域 | `element` | - | 否 |
|
|
54
|
+
| className | 自定义类名 | `string` | - | 否 |
|
|
55
|
+
| style | 自定义样式 | `object` | - | 否 |
|
|
56
|
+
| headerProps | 头部区域的自定义属性 | `object` | `{}` | 否 |
|
|
57
|
+
|
|
58
|
+
### BoxTable.Info
|
|
59
|
+
| 属性 | 说明 | 类型 | 必填 |
|
|
60
|
+
|------|------|------|------|
|
|
61
|
+
| children | 信息内容 | `node` | 否 |
|
|
62
|
+
| className | 自定义类名 | `string` | 否 |
|
|
63
|
+
| style | 自定义样式 | `object` | 否 |
|
|
64
|
+
|
|
65
|
+
### BoxPanel Props
|
|
66
|
+
| 属性 | 说明 | 类型 | 默认值 | 必填 |
|
|
67
|
+
|------|------|------|--------|------|
|
|
68
|
+
| title | 面板标题 | `string` | - | 是 |
|
|
69
|
+
| collapse | 折叠功能,`undefined` 为无此功能,`false` 默认收起,`true` 默认展开 | `bool` | - | 否 |
|
|
70
|
+
| summary | 汇总信息,数组格式:`[{text, value}]` 或 element | `array \| element` | - | 否 |
|
|
71
|
+
| right | 右侧内容区域 | `element` | - | 否 |
|
|
72
|
+
| className | 自定义类名 | `string` | - | 否 |
|
|
73
|
+
| style | 自定义样式 | `object` | - | 否 |
|
|
74
|
+
|
|
75
|
+
## 示例
|
|
76
|
+
|
|
77
|
+
### Box 基础容器
|
|
78
|
+
```jsx
|
|
79
|
+
<Box>带边框的内容区域</Box>
|
|
80
|
+
<Box hasGap>带内边距的内容区域</Box>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### BoxForm 表单容器
|
|
84
|
+
```jsx
|
|
85
|
+
<BoxForm btnPosition="left">
|
|
86
|
+
<FormBlock col={3}>
|
|
87
|
+
<FormItem label="商品">
|
|
88
|
+
<input type="text" />
|
|
89
|
+
</FormItem>
|
|
90
|
+
</FormBlock>
|
|
91
|
+
<BoxForm.More>
|
|
92
|
+
<FormBlock col={3}>
|
|
93
|
+
<FormItem label="额外字段">
|
|
94
|
+
<input type="text" />
|
|
95
|
+
</FormItem>
|
|
96
|
+
</FormBlock>
|
|
97
|
+
</BoxForm.More>
|
|
98
|
+
<FormButton>
|
|
99
|
+
<Button type="primary" htmlType="submit">搜索</Button>
|
|
100
|
+
<BoxForm.More>
|
|
101
|
+
<Button type="link">重置</Button>
|
|
102
|
+
</BoxForm.More>
|
|
103
|
+
</FormButton>
|
|
104
|
+
</BoxForm>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### BoxTable 表格容器
|
|
108
|
+
```jsx
|
|
109
|
+
<BoxTable
|
|
110
|
+
info={<BoxTable.Info>这是标题</BoxTable.Info>}
|
|
111
|
+
action={<div>操作按钮</div>}
|
|
112
|
+
>
|
|
113
|
+
<div>表格内容</div>
|
|
114
|
+
</BoxTable>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### BoxPanel 面板容器
|
|
118
|
+
```jsx
|
|
119
|
+
// 基础面板
|
|
120
|
+
<BoxPanel title="商品明细">
|
|
121
|
+
面板内容
|
|
122
|
+
</BoxPanel>
|
|
123
|
+
|
|
124
|
+
// 带折叠和汇总
|
|
125
|
+
<BoxPanel
|
|
126
|
+
title="商品明细"
|
|
127
|
+
collapse
|
|
128
|
+
summary={[
|
|
129
|
+
{ text: '共计', value: 2 },
|
|
130
|
+
{ text: '合计', value: '¥23,389.00' }
|
|
131
|
+
]}
|
|
132
|
+
right={<div>操作区域</div>}
|
|
133
|
+
>
|
|
134
|
+
面板内容
|
|
135
|
+
</BoxPanel>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## 注意事项
|
|
139
|
+
- 所有 Box 容器默认带边框样式
|
|
140
|
+
- `BoxForm` 中展开的内容需使用 `BoxForm.More` 包裹,内部使用 Context 通信
|
|
141
|
+
- `BoxForm.More` 可以在表单区域和按钮区域重复出现,表示"高级筛选"区域
|
|
142
|
+
- `BoxPanel` 的 `summary` 汇总信息以逗号分隔展示,最后一项后无逗号
|
|
@@ -2,7 +2,6 @@ import React from 'react'
|
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import classNames from 'classnames'
|
|
4
4
|
import Flex from '../flex'
|
|
5
|
-
import StickyLayout from '../../hoc/sticky_layout'
|
|
6
5
|
|
|
7
6
|
// 暂时没什么用
|
|
8
7
|
const Info = props => {
|
|
@@ -19,27 +18,21 @@ Info.propTypes = {
|
|
|
19
18
|
style: PropTypes.object
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
const BoxHeader = StickyLayout((props) => {
|
|
23
|
-
const { info, action, headerProps = {} } = props
|
|
24
|
-
const { className: headerClassName } = headerProps
|
|
25
|
-
|
|
26
|
-
return <Flex
|
|
27
|
-
{...headerProps}
|
|
28
|
-
className={classNames('gm-box-table-header common-sticky-header', headerClassName)}
|
|
29
|
-
alignCenter
|
|
30
|
-
>
|
|
31
|
-
<Flex>{info}</Flex>
|
|
32
|
-
<Flex flex />
|
|
33
|
-
<Flex>{action}</Flex>
|
|
34
|
-
</Flex>
|
|
35
|
-
});
|
|
36
|
-
|
|
37
21
|
const BoxTable = props => {
|
|
38
|
-
const { children, className, ...rest } = props
|
|
22
|
+
const { info, action, children, className, headerProps = {}, ...rest } = props
|
|
23
|
+
const { className: headerClassName } = headerProps
|
|
39
24
|
|
|
40
25
|
return (
|
|
41
26
|
<div {...rest} className={classNames('gm-box gm-box-table', className)}>
|
|
42
|
-
<
|
|
27
|
+
<Flex
|
|
28
|
+
{...headerProps}
|
|
29
|
+
className={classNames('gm-box-table-header', headerClassName)}
|
|
30
|
+
alignCenter
|
|
31
|
+
>
|
|
32
|
+
<Flex>{info}</Flex>
|
|
33
|
+
<Flex flex />
|
|
34
|
+
<Flex>{action}</Flex>
|
|
35
|
+
</Flex>
|
|
43
36
|
<div>{children}</div>
|
|
44
37
|
</div>
|
|
45
38
|
)
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Button
|
|
2
|
+
|
|
3
|
+
## 简介
|
|
4
|
+
按钮组件 - 封装了原生按钮的基本功能,支持多种类型、尺寸和自动 loading 状态。
|
|
5
|
+
|
|
6
|
+
## 安装
|
|
7
|
+
已包含在 `@gmfe/react` 中,无需额外安装。
|
|
8
|
+
|
|
9
|
+
## 使用
|
|
10
|
+
```jsx
|
|
11
|
+
import { Button } from '@gmfe/react'
|
|
12
|
+
|
|
13
|
+
// 基础按钮
|
|
14
|
+
<Button>默认按钮</Button>
|
|
15
|
+
<Button type='primary'>主色按钮</Button>
|
|
16
|
+
<Button type='success'>成功按钮</Button>
|
|
17
|
+
<Button type='danger'>危险按钮</Button>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## API
|
|
21
|
+
|
|
22
|
+
### Props
|
|
23
|
+
| 属性 | 说明 | 类型 | 默认值 | 必填 |
|
|
24
|
+
|------|------|------|--------|------|
|
|
25
|
+
| type | 按钮类型 | `'default' \| 'primary' \| 'success' \| 'danger' \| 'link'` | `'default'` | 否 |
|
|
26
|
+
| plain | 是否为朴素按钮(只有边框,无背景色) | `bool` | - | 否 |
|
|
27
|
+
| size | 按钮大小,目前支持 large | `'large'` | - | 否 |
|
|
28
|
+
| block | 是否为块级按钮(撑满父容器宽度) | `bool` | - | 否 |
|
|
29
|
+
| htmlType | 原生 type 属性 | `string` | `'button'` | 否 |
|
|
30
|
+
| loading | 是否显示 loading 状态 | `bool` | - | 否 |
|
|
31
|
+
| href | 链接地址,type 为 link 时有效 | `string` | - | 否 |
|
|
32
|
+
| onClick | 点击回调,返回 Promise 时自动显示 loading | `func` | `_.noop` | 否 |
|
|
33
|
+
| disabled | 是否禁用 | `bool` | - | 否 |
|
|
34
|
+
| className | 自定义类名 | `string` | - | 否 |
|
|
35
|
+
| style | 自定义样式 | `object` | - | 否 |
|
|
36
|
+
|
|
37
|
+
## 示例
|
|
38
|
+
|
|
39
|
+
### 基础用法
|
|
40
|
+
```jsx
|
|
41
|
+
<Button>默认</Button>
|
|
42
|
+
<Button type='primary'>主色</Button>
|
|
43
|
+
<Button type='success'>成功</Button>
|
|
44
|
+
<Button type='danger'>危险</Button>
|
|
45
|
+
<Button type='link'>Link</Button>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 朴素按钮
|
|
49
|
+
```jsx
|
|
50
|
+
<Button plain>默认</Button>
|
|
51
|
+
<Button plain type='primary'>主色</Button>
|
|
52
|
+
<Button plain type='success'>成功</Button>
|
|
53
|
+
<Button plain type='danger'>危险</Button>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 链接按钮
|
|
57
|
+
```jsx
|
|
58
|
+
<Button type='link' href='https://example.com' target='_blank'>
|
|
59
|
+
链接
|
|
60
|
+
</Button>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Loading 状态
|
|
64
|
+
```jsx
|
|
65
|
+
// 手动控制 loading
|
|
66
|
+
<Button loading>loading</Button>
|
|
67
|
+
|
|
68
|
+
// onClick 返回 Promise 时自动显示 loading
|
|
69
|
+
<Button onClick={async () => {
|
|
70
|
+
await new Promise(resolve => setTimeout(resolve, 2000))
|
|
71
|
+
}}>点击显示 loading</Button>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 大按钮
|
|
75
|
+
```jsx
|
|
76
|
+
<Button size='large'>大按钮</Button>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 禁用状态
|
|
80
|
+
```jsx
|
|
81
|
+
<Button disabled>禁用按钮</Button>
|
|
82
|
+
<Button disabled type='primary'>禁用主色</Button>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## 注意事项
|
|
86
|
+
- `type='link'` 配合 `href` 属性使用时,组件会渲染为 `<a>` 标签
|
|
87
|
+
- `htmlType` 控制的是原生 form type 属性(如 `submit`),与 `type` 属性不同
|
|
88
|
+
- 当 `onClick` 返回 `Promise` 时,按钮会自动显示 loading 状态,Promise resolve 后自动恢复
|
|
89
|
+
- `loading` 和 `disabled` 同时生效时,按钮都会被禁用
|
|
90
|
+
- `plain` 属性对 `type='link'` 类型的按钮无效
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Calendar
|
|
2
|
+
|
|
3
|
+
## 简介
|
|
4
|
+
日历组件 - 提供单日期选择和日期范围选择两种模式,通过 Calendar(单选)和 RangeCalendar(范围选择)两个组件实现。
|
|
5
|
+
|
|
6
|
+
## 安装
|
|
7
|
+
已包含在 `@gmfe/react` 中,无需额外安装。
|
|
8
|
+
|
|
9
|
+
## 使用
|
|
10
|
+
```jsx
|
|
11
|
+
import { Calendar } from '@gmfe/react'
|
|
12
|
+
|
|
13
|
+
<Calendar
|
|
14
|
+
selected={date}
|
|
15
|
+
onSelect={date => setDate(date)}
|
|
16
|
+
/>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## API
|
|
20
|
+
|
|
21
|
+
### Calendar Props(单选)
|
|
22
|
+
| 属性 | 说明 | 类型 | 默认值 | 必填 |
|
|
23
|
+
|------|------|------|--------|------|
|
|
24
|
+
| selected | 当前选中的日期,Date 对象 | `object` | - | 否 |
|
|
25
|
+
| onSelect | 日期选中回调,参数为 Date 对象 | `func` | `_.noop` | 否 |
|
|
26
|
+
| willActiveSelected | 键盘操作时的高亮日期 | `object` | - | 否 |
|
|
27
|
+
| onWillActiveSelected | 高亮日期变化回调,参数为 Date 对象 | `func` | - | 否 |
|
|
28
|
+
| min | 可选的最小日期,Date 对象 | `object` | - | 否 |
|
|
29
|
+
| max | 可选的最大日期,Date 对象 | `object` | - | 否 |
|
|
30
|
+
| disabledDate | 自定义日期是否可选,参数为 Date 对象,返回 bool。设置后 min/max 无效 | `func` | - | 否 |
|
|
31
|
+
| onKeyDown | 键盘事件回调 | `func` | - | 否 |
|
|
32
|
+
| className | 自定义类名 | `string` | - | 否 |
|
|
33
|
+
| style | 自定义样式 | `object` | - | 否 |
|
|
34
|
+
|
|
35
|
+
### RangeCalendar Props(范围选择)
|
|
36
|
+
RangeCalendar 继承自 Calendar,额外属性如下:
|
|
37
|
+
|
|
38
|
+
| 属性 | 说明 | 类型 | 默认值 | 必填 |
|
|
39
|
+
|------|------|------|--------|------|
|
|
40
|
+
| begin | 开始日期,Date 对象 | `object` | - | 否 |
|
|
41
|
+
| end | 结束日期,Date 对象 | `object` | - | 否 |
|
|
42
|
+
| onSelect | 选中回调,参数为 (begin, end) | `func` | - | 否 |
|
|
43
|
+
|
|
44
|
+
## 示例
|
|
45
|
+
|
|
46
|
+
### 基础日历
|
|
47
|
+
```jsx
|
|
48
|
+
<Calendar
|
|
49
|
+
selected={date}
|
|
50
|
+
onSelect={date => setDate(date)}
|
|
51
|
+
/>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 限制日期范围
|
|
55
|
+
```jsx
|
|
56
|
+
import moment from 'moment'
|
|
57
|
+
|
|
58
|
+
<Calendar
|
|
59
|
+
selected={date}
|
|
60
|
+
onSelect={date => setDate(date)}
|
|
61
|
+
min={moment().toDate()}
|
|
62
|
+
max={moment().add(10, 'd').toDate()}
|
|
63
|
+
/>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 自定义禁用日期
|
|
67
|
+
```jsx
|
|
68
|
+
import moment from 'moment'
|
|
69
|
+
|
|
70
|
+
// 只能选择非周五的日期
|
|
71
|
+
<Calendar
|
|
72
|
+
selected={date}
|
|
73
|
+
onSelect={date => setDate(date)}
|
|
74
|
+
disabledDate={d => moment(d).get('day') === 5}
|
|
75
|
+
/>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 日期范围选择
|
|
79
|
+
```jsx
|
|
80
|
+
import { RangeCalendar } from '@gmfe/react'
|
|
81
|
+
|
|
82
|
+
<RangeCalendar
|
|
83
|
+
begin={beginDate}
|
|
84
|
+
end={endDate}
|
|
85
|
+
onSelect={(begin, end) => {
|
|
86
|
+
setBeginDate(begin)
|
|
87
|
+
setEndDate(end)
|
|
88
|
+
}}
|
|
89
|
+
/>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## 注意事项
|
|
93
|
+
- Calendar 用于单日期选择,RangeCalendar 用于日期范围选择
|
|
94
|
+
- `selected`/`begin`/`end` 属性接收 JavaScript 原生 `Date` 对象
|
|
95
|
+
- `disabledDate` 设置后,`min` 和 `max` 将失效
|
|
96
|
+
- Calendar 组件内部基于 RangeCalendar 实现
|
|
97
|
+
- 该组件通常作为 DatePicker 和 DateRangePicker 的内部组件使用,一般不需要直接使用
|
|
98
|
+
- 支持键盘上下键切换日期
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Carousel
|
|
2
|
+
|
|
3
|
+
## 简介
|
|
4
|
+
轮播组件 - 支持淡入淡出切换、自动轮播、鼠标悬浮暂停的图片/内容轮播
|
|
5
|
+
|
|
6
|
+
## 安装
|
|
7
|
+
已包含在 `@gmfe/react` 中,无需额外安装。
|
|
8
|
+
|
|
9
|
+
## 使用
|
|
10
|
+
```jsx
|
|
11
|
+
import { Carousel } from '@gmfe/react'
|
|
12
|
+
|
|
13
|
+
<Carousel style={{ width: '1000px', height: '200px' }}>
|
|
14
|
+
<div style={{ backgroundColor: 'red', height: '100%', width: '100%' }}>内容1</div>
|
|
15
|
+
<div style={{ backgroundColor: 'green', height: '100%', width: '100%' }}>内容2</div>
|
|
16
|
+
<div style={{ backgroundColor: 'blue', height: '100%', width: '100%' }}>内容3</div>
|
|
17
|
+
</Carousel>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## API
|
|
21
|
+
|
|
22
|
+
### Props
|
|
23
|
+
| 属性 | 说明 | 类型 | 默认值 | 必填 |
|
|
24
|
+
|------|------|------|--------|------|
|
|
25
|
+
| children | 轮播内容,支持 element 元素数组 | `arrayOf(element)` | - | 否 |
|
|
26
|
+
| defaultIndex | 初始展示的索引 | `number` | `0` | 否 |
|
|
27
|
+
| delay | 轮播间隔时间(毫秒) | `number` | `3000` | 否 |
|
|
28
|
+
| transitionTime | 切换动画时长(毫秒) | `number` | `1000` | 否 |
|
|
29
|
+
| onIndexChange | 索引变化回调 | `function` | - | 否 |
|
|
30
|
+
| className | 自定义类名 | `string` | - | 否 |
|
|
31
|
+
| isStopByHoverContent | 鼠标悬浮在内容区域时是否暂停轮播 | `bool` | `true` | 否 |
|
|
32
|
+
|
|
33
|
+
## 示例
|
|
34
|
+
|
|
35
|
+
### 基础用法
|
|
36
|
+
```jsx
|
|
37
|
+
<Carousel
|
|
38
|
+
style={{ width: '1000px', height: '200px' }}
|
|
39
|
+
onIndexChange={index => console.log(index)}
|
|
40
|
+
>
|
|
41
|
+
<div style={{ backgroundColor: 'red', height: '100%', width: '100%' }}>内容1</div>
|
|
42
|
+
<div style={{ backgroundColor: 'green', height: '100%', width: '100%' }}>内容2</div>
|
|
43
|
+
<div style={{ backgroundColor: 'yellow', height: '100%', width: '100%' }}>内容3</div>
|
|
44
|
+
<div style={{ backgroundColor: 'blue', height: '100%', width: '100%' }}>内容4</div>
|
|
45
|
+
</Carousel>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 注意事项
|
|
49
|
+
- 子元素支持动态添加,组件会自动适应子元素数量变化
|
|
50
|
+
- 鼠标离开轮播区域后会自动恢复轮播
|
|
51
|
+
- 底部有圆点指示器,支持鼠标悬停切换
|