@hsu-react/ui 0.0.1 → 0.0.2
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/es/components/ChainGraph/index.module.less +1 -1
- package/es/components/Chat/ChatInput/_components/SendButton/index.module.less +1 -1
- package/es/components/Chat/ChatInput/_components/UploadButton/index.module.less +1 -1
- package/es/components/Chat/ChatInput/index.module.less +2 -2
- package/es/components/Chat/ChatList/_components/Assistant/AssistantItem/index.module.less +1 -1
- package/es/components/Checkbox/CheckboxGroup/index.module.less +16 -16
- package/es/components/Checkbox/index.module.less +13 -13
- package/es/components/CodeMirror/index.module.less +4 -4
- package/es/components/DatePicker/RangePicker/index.module.less +1 -1
- package/es/components/DatePicker/StepPicker/index.module.less +1 -1
- package/es/components/DatePicker/index.module.less +1 -1
- package/es/components/Form/DrawerForm/index.module.less +2 -2
- package/es/components/FormItem/FormRadio/index.module.less +9 -9
- package/es/components/FormItem/FormSegmented/index.module.less +2 -2
- package/es/components/FormItem/FormUpload/index.module.less +4 -4
- package/es/components/FormItem/ItemContainer/index.module.less +22 -22
- package/es/components/Icon/index.js +9 -24
- package/es/components/Input/Number/index.module.less +9 -9
- package/es/components/Input/Password/index.module.less +3 -3
- package/es/components/Input/Search/index.module.less +5 -5
- package/es/components/Input/TextArea/index.module.less +5 -5
- package/es/components/Input/index.module.less +4 -4
- package/es/components/Modal/index.module.less +2 -2
- package/es/components/Operate/index.module.less +2 -2
- package/es/components/Panel/IframePanel/index.module.less +1 -1
- package/es/components/Panel/ListPanel/_components/ColumnMgt/index.module.less +1 -1
- package/es/components/Search/index.module.less +2 -2
- package/es/components/Select/AutoCompleteSelect/index.module.less +35 -35
- package/es/components/Select/IconSelect/index.module.less +3 -3
- package/es/components/Select/TreeSelect/index.module.less +17 -17
- package/es/components/Select/index.module.less +34 -34
- package/es/components/Slider/index.module.less +4 -4
- package/es/components/Spreadsheet/index.module.less +4 -4
- package/es/components/Table/_components/Pagination/index.module.less +23 -23
- package/es/components/Table/index.module.less +61 -61
- package/es/components/Tree/index.module.less +11 -11
- package/es/components/Upload/index.module.less +3 -3
- package/es/styles/antd-overload.less +1 -1
- package/lib/components/ChainGraph/index.module.less +1 -1
- package/lib/components/Chat/ChatInput/_components/SendButton/index.module.less +1 -1
- package/lib/components/Chat/ChatInput/_components/UploadButton/index.module.less +1 -1
- package/lib/components/Chat/ChatInput/index.module.less +2 -2
- package/lib/components/Chat/ChatList/_components/Assistant/AssistantItem/index.module.less +1 -1
- package/lib/components/Checkbox/CheckboxGroup/index.module.less +16 -16
- package/lib/components/Checkbox/index.module.less +13 -13
- package/lib/components/CodeMirror/index.module.less +4 -4
- package/lib/components/DatePicker/RangePicker/index.module.less +1 -1
- package/lib/components/DatePicker/StepPicker/index.module.less +1 -1
- package/lib/components/DatePicker/index.module.less +1 -1
- package/lib/components/Form/DrawerForm/index.module.less +2 -2
- package/lib/components/FormItem/FormRadio/index.module.less +9 -9
- package/lib/components/FormItem/FormSegmented/index.module.less +2 -2
- package/lib/components/FormItem/FormUpload/index.module.less +4 -4
- package/lib/components/FormItem/ItemContainer/index.module.less +22 -22
- package/lib/components/Icon/index.js +9 -27
- package/lib/components/Input/Number/index.module.less +9 -9
- package/lib/components/Input/Password/index.module.less +3 -3
- package/lib/components/Input/Search/index.module.less +5 -5
- package/lib/components/Input/TextArea/index.module.less +5 -5
- package/lib/components/Input/index.module.less +4 -4
- package/lib/components/Modal/index.module.less +2 -2
- package/lib/components/Operate/index.module.less +2 -2
- package/lib/components/Panel/IframePanel/index.module.less +1 -1
- package/lib/components/Panel/ListPanel/_components/ColumnMgt/index.module.less +1 -1
- package/lib/components/Search/index.module.less +2 -2
- package/lib/components/Select/AutoCompleteSelect/index.module.less +35 -35
- package/lib/components/Select/IconSelect/index.module.less +3 -3
- package/lib/components/Select/TreeSelect/index.module.less +17 -17
- package/lib/components/Select/index.module.less +34 -34
- package/lib/components/Slider/index.module.less +4 -4
- package/lib/components/Spreadsheet/index.module.less +4 -4
- package/lib/components/Table/_components/Pagination/index.module.less +23 -23
- package/lib/components/Table/index.module.less +61 -61
- package/lib/components/Tree/index.module.less +11 -11
- package/lib/components/Upload/index.module.less +3 -3
- package/lib/styles/antd-overload.less +1 -1
- package/package.json +1 -1
- package/src/components/Button/index.md +2 -3
- package/src/components/ChainGraph/index.md +66 -1
- package/src/components/ChainGraph/index.module.less +1 -1
- package/src/components/Chart/index.md +78 -1
- package/src/components/Chat/ChatInput/_components/SendButton/index.module.less +1 -1
- package/src/components/Chat/ChatInput/_components/UploadButton/index.module.less +1 -1
- package/src/components/Chat/ChatInput/index.module.less +2 -2
- package/src/components/Chat/ChatList/_components/Assistant/AssistantItem/index.module.less +1 -1
- package/src/components/Chat/index.md +97 -1
- package/src/components/Checkbox/CheckboxGroup/index.module.less +16 -16
- package/src/components/Checkbox/index.md +53 -1
- package/src/components/Checkbox/index.module.less +13 -13
- package/src/components/CodeMirror/index.md +41 -1
- package/src/components/CodeMirror/index.module.less +4 -4
- package/src/components/DatePicker/RangePicker/index.module.less +1 -1
- package/src/components/DatePicker/StepPicker/index.module.less +1 -1
- package/src/components/DatePicker/index.md +43 -1
- package/src/components/DatePicker/index.module.less +1 -1
- package/src/components/Descriptions/index.md +45 -1
- package/src/components/Editor/index.md +40 -1
- package/src/components/FileCol/index.md +24 -1
- package/src/components/FilePreview/index.md +45 -1
- package/src/components/FlexFill/index.md +46 -1
- package/src/components/Form/DrawerForm/index.module.less +2 -2
- package/src/components/Form/index.md +92 -1
- package/src/components/FormItem/FormRadio/index.module.less +9 -9
- package/src/components/FormItem/FormSegmented/index.module.less +2 -2
- package/src/components/FormItem/FormUpload/index.module.less +4 -4
- package/src/components/FormItem/ItemContainer/index.module.less +22 -22
- package/src/components/FormItem/index.md +459 -1
- package/src/components/Icon/index.md +21 -3
- package/src/components/Icon/index.tsx +9 -37
- package/src/components/Input/Number/index.module.less +9 -9
- package/src/components/Input/Password/index.module.less +3 -3
- package/src/components/Input/Search/index.module.less +5 -5
- package/src/components/Input/TextArea/index.module.less +5 -5
- package/src/components/Input/index.md +35 -1
- package/src/components/Input/index.module.less +4 -4
- package/src/components/Markdown/index.md +71 -1
- package/src/components/Modal/index.md +43 -1
- package/src/components/Modal/index.module.less +2 -2
- package/src/components/Operate/index.md +43 -1
- package/src/components/Operate/index.module.less +2 -2
- package/src/components/Panel/IframePanel/index.module.less +1 -1
- package/src/components/Panel/ListPanel/_components/ColumnMgt/index.module.less +1 -1
- package/src/components/Panel/index.md +146 -1
- package/src/components/Search/index.md +73 -1
- package/src/components/Search/index.module.less +2 -2
- package/src/components/SecondConf/index.md +39 -1
- package/src/components/Select/AutoCompleteSelect/index.module.less +35 -35
- package/src/components/Select/IconSelect/index.module.less +3 -3
- package/src/components/Select/TreeSelect/index.module.less +17 -17
- package/src/components/Select/index.md +47 -1
- package/src/components/Select/index.module.less +34 -34
- package/src/components/Slider/index.md +29 -1
- package/src/components/Slider/index.module.less +4 -4
- package/src/components/Spreadsheet/index.md +42 -1
- package/src/components/Spreadsheet/index.module.less +4 -4
- package/src/components/Switch/index.md +33 -1
- package/src/components/TabBar/index.md +53 -1
- package/src/components/Table/_components/Pagination/index.module.less +23 -23
- package/src/components/Table/index.md +60 -1
- package/src/components/Table/index.module.less +61 -61
- package/src/components/Tags/index.md +23 -1
- package/src/components/TextEllipsis/index.md +29 -1
- package/src/components/Tree/index.md +66 -1
- package/src/components/Tree/index.module.less +11 -11
- package/src/components/Upload/index.md +72 -1
- package/src/components/Upload/index.module.less +3 -3
- package/src/styles/antd-overload.less +1 -1
|
@@ -8,10 +8,155 @@ title: Panel 页面容器
|
|
|
8
8
|
|
|
9
9
|
# Panel 页面容器
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
页面级容器集合,封装了「左侧树 + 顶部搜索 + 表格」的列表页、内嵌 iframe 页以及通用内容页等常见布局形态。
|
|
12
12
|
|
|
13
13
|
## 引入
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import { Panel } from "@hsu-react/ui";
|
|
17
17
|
```
|
|
18
|
+
|
|
19
|
+
## 子组件
|
|
20
|
+
|
|
21
|
+
| 组件 | 说明 |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| `Panel.List` | 列表页容器,集成 `Search`、`Table`、`TabBar`、`Tree`、列管理与工具栏 |
|
|
24
|
+
| `Panel.List.Modal` | 弹窗内的列表页容器,用于在 `Modal` 中复用列表布局 |
|
|
25
|
+
| `Panel.Iframe` | iframe 内容容器,带加载态与全屏按钮 |
|
|
26
|
+
| `Panel.Default` | 通用内容容器,可选左侧树与面包屑 |
|
|
27
|
+
|
|
28
|
+
## 基础用法
|
|
29
|
+
|
|
30
|
+
### Panel.List 列表页
|
|
31
|
+
|
|
32
|
+
`Panel.List` 通过 `searchProps`(搜索区)、`tableProps`(表格区)组合出标准增删改查列表页。下方为可交互示例:输入姓名搜索会实时过滤行,点击「新增」「编辑」有反馈。
|
|
33
|
+
|
|
34
|
+
> 注意:`Panel.List` / `Search` 内部用到 `Button.Chakra`,需要在外层包一层 `ChakraProvider`(真实项目通常在入口统一提供)。
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import React, { useState } from "react";
|
|
38
|
+
import { Panel, Button } from "@hsu-react/ui";
|
|
39
|
+
import { message } from "antd";
|
|
40
|
+
import { ChakraProvider, createSystem, defaultConfig } from "@chakra-ui/react";
|
|
41
|
+
|
|
42
|
+
const system = createSystem(defaultConfig, {
|
|
43
|
+
disableLayers: true,
|
|
44
|
+
preflight: false,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const ALL = [
|
|
48
|
+
{ id: 1, name: "张三", role: "管理员", status: "启用" },
|
|
49
|
+
{ id: 2, name: "李四", role: "成员", status: "启用" },
|
|
50
|
+
{ id: 3, name: "王五", role: "成员", status: "禁用" },
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
export default () => {
|
|
54
|
+
const [data, setData] = useState(ALL);
|
|
55
|
+
|
|
56
|
+
const columns = [
|
|
57
|
+
{ title: "姓名", dataIndex: "name" },
|
|
58
|
+
{ title: "角色", dataIndex: "role" },
|
|
59
|
+
{ title: "状态", dataIndex: "status" },
|
|
60
|
+
{
|
|
61
|
+
title: "操作",
|
|
62
|
+
dataIndex: "op",
|
|
63
|
+
render: (_, row) => (
|
|
64
|
+
<Button type="link" onClick={() => message.info("编辑:" + row.name)}>
|
|
65
|
+
编辑
|
|
66
|
+
</Button>
|
|
67
|
+
),
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<ChakraProvider value={system}>
|
|
73
|
+
<div style={{ height: 380 }}>
|
|
74
|
+
<Panel.List
|
|
75
|
+
searchProps={{
|
|
76
|
+
searchItems: [{ type: "INPUT", name: "name", label: "姓名" }],
|
|
77
|
+
onSearch: (v) =>
|
|
78
|
+
setData(ALL.filter((x) => !v.name || x.name.includes(v.name))),
|
|
79
|
+
onReset: () => setData(ALL),
|
|
80
|
+
beforeButtonGroup: [
|
|
81
|
+
{
|
|
82
|
+
title: "新增",
|
|
83
|
+
colorPalette: "blue",
|
|
84
|
+
onClick: () => message.success("点击了新增"),
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
}}
|
|
88
|
+
tableProps={{
|
|
89
|
+
columns,
|
|
90
|
+
dataSource: data,
|
|
91
|
+
rowKey: "id",
|
|
92
|
+
pagination: false,
|
|
93
|
+
}}
|
|
94
|
+
/>
|
|
95
|
+
</div>
|
|
96
|
+
</ChakraProvider>
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Panel.Default 内容页
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
import React from "react";
|
|
105
|
+
import { Panel } from "@hsu-react/ui";
|
|
106
|
+
|
|
107
|
+
export default () => (
|
|
108
|
+
<div style={{ height: 200 }}>
|
|
109
|
+
<Panel.Default>
|
|
110
|
+
<div style={{ padding: 16 }}>这里是通用内容区域</div>
|
|
111
|
+
</Panel.Default>
|
|
112
|
+
</div>
|
|
113
|
+
);
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Panel.Iframe 内嵌页
|
|
117
|
+
|
|
118
|
+
`Panel.Iframe` 用于内嵌外部页面,带加载态与全屏按钮(外部站点受 X-Frame-Options 限制,此处仅示意用法):
|
|
119
|
+
|
|
120
|
+
```tsx | pure
|
|
121
|
+
import React from "react";
|
|
122
|
+
import { Panel } from "@hsu-react/ui";
|
|
123
|
+
|
|
124
|
+
export default () => <Panel.Iframe src="https://example.com" fullBtn />;
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## API
|
|
128
|
+
|
|
129
|
+
### Panel.List(ListPanelProps)
|
|
130
|
+
|
|
131
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
132
|
+
| --- | --- | --- | --- |
|
|
133
|
+
| searchMode | Search 组件模式:`Default` / `Advanced` / `Collapsible` / `WithFilter` / `WithMore` / `Card` | `SearchModeKeys` | `'Default'` |
|
|
134
|
+
| searchProps | 搜索区配置(随 `searchMode` 变化) | `SearchModePropsMap[T]` | - |
|
|
135
|
+
| tableProps | 表格区配置,含 `title`、`buttonGroup`、`tabBarProps`、`tableTools` 等 | `ListPanelTabelProps` | - |
|
|
136
|
+
| treeProps | 左侧树配置 | `TreeProps` | - |
|
|
137
|
+
| headerTabBarProps | 顶部页签配置 | `TabBarProps` | - |
|
|
138
|
+
| headerTabBarChildren | 顶部页签区自定义内容 | `ReactNode` | - |
|
|
139
|
+
| hasPermi | 权限码,无权限时不渲染 | `string[]` | - |
|
|
140
|
+
| baseTreeBreadcrumb | 树面包屑的基础项 | `BreadcrumbProps['items']` | - |
|
|
141
|
+
| showTreeBreadcrumb | 是否展示树面包屑 | `boolean` | `true` |
|
|
142
|
+
| treeResize | 左侧树可拖拽调宽配置(`enabled`/`defaultWidth`/`minWidth`/`maxWidth`/`minContentWidth`) | `object` | - |
|
|
143
|
+
| className / wrapperClassName | 自定义类名 | `string` | - |
|
|
144
|
+
|
|
145
|
+
### Panel.Iframe(IframePanelProps)
|
|
146
|
+
|
|
147
|
+
继承原生 `<iframe>` 属性,并扩展:
|
|
148
|
+
|
|
149
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
150
|
+
| --- | --- | --- | --- |
|
|
151
|
+
| fullBtn | 是否显示全屏按钮 | `boolean` | - |
|
|
152
|
+
| children | 自定义内容(传入后替代 iframe 渲染) | `ReactNode` | - |
|
|
153
|
+
|
|
154
|
+
### Panel.Default(DefaultPanelProps)
|
|
155
|
+
|
|
156
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
157
|
+
| --- | --- | --- | --- |
|
|
158
|
+
| children | 内容区 | `ReactNode` | - |
|
|
159
|
+
| treeProps | 左侧树配置(传入即展示树) | `TreeProps` | - |
|
|
160
|
+
| baseTreeBreadcrumb | 树面包屑的基础项 | `BreadcrumbProps['items']` | - |
|
|
161
|
+
| showTreeBreadcrumb | 是否展示树面包屑 | `boolean` | `true` |
|
|
162
|
+
| className / contentClassName / wrapperClassName | 自定义类名 | `string` | - |
|
|
@@ -8,10 +8,82 @@ title: Search 搜索
|
|
|
8
8
|
|
|
9
9
|
# Search 搜索
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
配置驱动的搜索栏组件,通过 `searchItems` 描述搜索项,内置查询 / 重置按钮、列自适应与展开收起能力。
|
|
12
12
|
|
|
13
13
|
## 引入
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import { Search } from "@hsu-react/ui";
|
|
17
17
|
```
|
|
18
|
+
|
|
19
|
+
## 基础用法
|
|
20
|
+
|
|
21
|
+
`Search` 通过 `searchItems`(复用 `FormItem` 的配置)定义搜索项,`onSearch` / `onReset` 接收回调:
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import React from "react";
|
|
25
|
+
import { Search } from "@hsu-react/ui";
|
|
26
|
+
import { ChakraProvider, createSystem, defaultConfig } from "@chakra-ui/react";
|
|
27
|
+
|
|
28
|
+
const system = createSystem(defaultConfig, {
|
|
29
|
+
disableLayers: true,
|
|
30
|
+
preflight: false,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export default () => {
|
|
34
|
+
return (
|
|
35
|
+
<ChakraProvider value={system}>
|
|
36
|
+
<Search
|
|
37
|
+
columnNum={3}
|
|
38
|
+
searchItems={[
|
|
39
|
+
{ type: "INPUT", name: "keyword", label: "关键字" },
|
|
40
|
+
{
|
|
41
|
+
type: "SELECT",
|
|
42
|
+
name: "status",
|
|
43
|
+
label: "状态",
|
|
44
|
+
componentProps: {
|
|
45
|
+
options: [
|
|
46
|
+
{ label: "启用", value: 1 },
|
|
47
|
+
{ label: "停用", value: 0 },
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{ type: "RANGEPICKER", name: "date", label: "时间范围" },
|
|
52
|
+
]}
|
|
53
|
+
onSearch={(data) => console.log("search", data)}
|
|
54
|
+
onReset={() => console.log("reset")}
|
|
55
|
+
/>
|
|
56
|
+
</ChakraProvider>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## API
|
|
62
|
+
|
|
63
|
+
`SearchProps` 继承自 `BaseSearchProps`:
|
|
64
|
+
|
|
65
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
66
|
+
| --- | --- | --- | --- |
|
|
67
|
+
| searchItems | 搜索项配置(复用 `FormItemProps`) | `FormItemProps[]` | `[]` |
|
|
68
|
+
| moreSearchItems | 展开后显示的更多搜索项 | `FormItemProps[]` | `[]` |
|
|
69
|
+
| onSearch | 点击查询的回调,返回收集到的表单值 | `(data?: Partial<T>) => void` | - |
|
|
70
|
+
| onReset | 点击重置的回调 | `() => void` | - |
|
|
71
|
+
| externalForm | 外部传入的表单实例 | `FormInstance` | - |
|
|
72
|
+
| hasPermi | 权限码;无权限时不渲染 | `string[]` | - |
|
|
73
|
+
| columnNum | 搜索项列数(按钮组额外占一列) | `number` | `4` |
|
|
74
|
+
| beforeButtonGroup | 查询 / 重置按钮前的附加按钮 | `ChakraButtonProps[]` | - |
|
|
75
|
+
| affterButtonGroup | 查询 / 重置按钮后的附加按钮 | `ChakraButtonProps[]` | - |
|
|
76
|
+
| searchData | 搜索项的初始值 | `Record<string, unknown>` | - |
|
|
77
|
+
| minLabelWidth | 标签最小宽度,或是否启用最小宽度 | `boolean \| number` | - |
|
|
78
|
+
| defaultExpanded | 默认是否展开 | `boolean` | `false` |
|
|
79
|
+
| onExpandChange | 展开状态变化回调 | `(expand: boolean) => void` | - |
|
|
80
|
+
| autoAdaptWidth | 是否启用基于宽度的自适应布局 | `boolean` | `true` |
|
|
81
|
+
| baseWidth | 自适应布局的基准宽度 | `number` | - |
|
|
82
|
+
| onValuesChange | 表单值变化回调 | `(value, values) => void` | - |
|
|
83
|
+
| searchDisabled | 是否禁用查询按钮 | `boolean` | `false` |
|
|
84
|
+
| showAllSearchItems | 是否一次性展示全部搜索项 | `boolean` | `false` |
|
|
85
|
+
| searchText | 查询按钮文本 | `ReactNode` | - |
|
|
86
|
+
| resetText | 重置按钮文本 | `ReactNode` | - |
|
|
87
|
+
| columnOffsetWidth | 列宽计算的偏移量 | `number` | `0` |
|
|
88
|
+
|
|
89
|
+
> 另提供多种搜索形态:`Search.Card`、`Search.Advanced`、`Search.Collapsible`、`Search.WithFilter`(带筛选下拉)、`Search.WithMore`。
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
justify-content: flex-start;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
.ant-btn-icon {
|
|
51
|
+
:global(.ant-btn-icon) {
|
|
52
52
|
font-size: 16px;
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
.filterDropdown {
|
|
169
|
-
.ant-dropdown-menu {
|
|
169
|
+
:global(.ant-dropdown-menu) {
|
|
170
170
|
height: max-content;
|
|
171
171
|
max-height: 500px;
|
|
172
172
|
|
|
@@ -8,10 +8,48 @@ title: SecondConf 二次确认
|
|
|
8
8
|
|
|
9
9
|
# SecondConf 二次确认
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
基于 `Modal` 封装的二次确认弹窗,内置问号图标,自动拼接「确认{contentTitle}吗?」标题与说明文案。
|
|
12
12
|
|
|
13
13
|
## 引入
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import { SecondConf } from "@hsu-react/ui";
|
|
17
17
|
```
|
|
18
|
+
|
|
19
|
+
## 基础用法
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import React, { useState } from "react";
|
|
23
|
+
import { SecondConf } from "@hsu-react/ui";
|
|
24
|
+
import { Button } from "antd";
|
|
25
|
+
|
|
26
|
+
export default () => {
|
|
27
|
+
const [open, setOpen] = useState(false);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<>
|
|
31
|
+
<Button danger onClick={() => setOpen(true)}>
|
|
32
|
+
删除
|
|
33
|
+
</Button>
|
|
34
|
+
<SecondConf
|
|
35
|
+
open={open}
|
|
36
|
+
contentTitle="删除该条数据"
|
|
37
|
+
contentText="删除后将无法恢复,请谨慎操作。"
|
|
38
|
+
onOk={() => setOpen(false)}
|
|
39
|
+
onCancel={() => setOpen(false)}
|
|
40
|
+
/>
|
|
41
|
+
</>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## API
|
|
47
|
+
|
|
48
|
+
在 `Modal`(即 antd `ModalProps`)基础上扩展(`title` 已被内部接管):
|
|
49
|
+
|
|
50
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
51
|
+
| --- | --- | --- | --- |
|
|
52
|
+
| contentTitle | 标题中「确认 … 吗?」的中间内容 | `ReactNode` | - |
|
|
53
|
+
| contentText | 标题下方的补充说明文案 | `ReactNode` | - |
|
|
54
|
+
|
|
55
|
+
> 其余属性(`open`、`onOk`、`onCancel`、`width`、`confirmLoading` 等)与 `Modal` 一致;组件内部默认 `width={800}`、`centered`、`maskClosable={false}`、`mask={false}`。
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
.antdAutoComplete {
|
|
29
29
|
cursor: not-allowed;
|
|
30
30
|
|
|
31
|
-
.ant-select-selection-item {
|
|
31
|
+
:global(.ant-select-selection-item) {
|
|
32
32
|
color: var(--cf-text-3);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
.ant-select-arrow {
|
|
35
|
+
:global(.ant-select-arrow) {
|
|
36
36
|
cursor: not-allowed;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
margin-inline-start: 4px;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
&:has(.ant-select-status-error) {
|
|
78
|
+
&:has(:global(.ant-select-status-error)) {
|
|
79
79
|
border: 1px solid #ff4d4f;
|
|
80
80
|
|
|
81
81
|
.prefix,
|
|
@@ -108,24 +108,24 @@
|
|
|
108
108
|
font-weight: inherit;
|
|
109
109
|
color: inherit !important;
|
|
110
110
|
|
|
111
|
-
&:has(> .ant-select-arrow),
|
|
112
|
-
&:has(> .ant-select-clear) {
|
|
113
|
-
.ant-select-selector {
|
|
111
|
+
&:has(> :global(.ant-select-arrow)),
|
|
112
|
+
&:has(> :global(.ant-select-clear)) {
|
|
113
|
+
:global(.ant-select-selector) {
|
|
114
114
|
padding-right: 20px;
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
&.legacyHasArrowOrClear {
|
|
119
|
-
.ant-select-selector {
|
|
119
|
+
:global(.ant-select-selector) {
|
|
120
120
|
padding-right: 20px;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
&:global(.ant-select) {
|
|
125
125
|
width: 100%;
|
|
126
126
|
height: 100%;
|
|
127
127
|
|
|
128
|
-
.ant-select-selector {
|
|
128
|
+
:global(.ant-select-selector) {
|
|
129
129
|
width: 100%;
|
|
130
130
|
height: 100%;
|
|
131
131
|
padding: 0;
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
content: none;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
.ant-select-selection-wrap {
|
|
146
|
+
:global(.ant-select-selection-wrap) {
|
|
147
147
|
height: 100%;
|
|
148
148
|
|
|
149
149
|
font-family: inherit;
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
color: inherit;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
.ant-select-selection-search {
|
|
155
|
+
:global(.ant-select-selection-search) {
|
|
156
156
|
inset-inline-start: 0px;
|
|
157
157
|
inset-inline-end: 0px;
|
|
158
158
|
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
.ant-select-selection-placeholder {
|
|
174
|
+
:global(.ant-select-selection-placeholder) {
|
|
175
175
|
display: inline-flex;
|
|
176
176
|
align-items: center;
|
|
177
177
|
|
|
@@ -183,7 +183,7 @@
|
|
|
183
183
|
font-weight: inherit;
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
.ant-select-selection-item {
|
|
186
|
+
:global(.ant-select-selection-item) {
|
|
187
187
|
padding-inline-end: 0px;
|
|
188
188
|
|
|
189
189
|
font-family: inherit;
|
|
@@ -192,8 +192,8 @@
|
|
|
192
192
|
color: inherit;
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
.ant-select-selection-overflow-item {
|
|
196
|
-
.ant-select-selection-item {
|
|
195
|
+
:global(.ant-select-selection-overflow-item) {
|
|
196
|
+
:global(.ant-select-selection-item) {
|
|
197
197
|
line-height: normal;
|
|
198
198
|
|
|
199
199
|
padding-inline-end: 4px;
|
|
@@ -201,50 +201,50 @@
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
|
|
205
|
-
.ant-select-selector {
|
|
204
|
+
&:global(.ant-select-focused) {
|
|
205
|
+
:global(.ant-select-selector) {
|
|
206
206
|
border: none !important;
|
|
207
207
|
|
|
208
208
|
box-shadow: none !important;
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
|
|
213
|
-
.ant-select-arrow {
|
|
212
|
+
&:global(.ant-select-open) {
|
|
213
|
+
:global(.ant-select-arrow) {
|
|
214
214
|
transform: rotate(-180deg) translateY(50%);
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
&.noArrowAnimation {
|
|
218
|
-
.ant-select-arrow {
|
|
218
|
+
:global(.ant-select-arrow) {
|
|
219
219
|
transform: translateY(-50%);
|
|
220
220
|
transition: none !important;
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
|
|
226
|
-
.ant-select-selector {
|
|
225
|
+
&:global(.ant-select-status-error) {
|
|
226
|
+
:global(.ant-select-selector) {
|
|
227
227
|
border: none !important;
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
|
|
232
|
-
> .ant-select-selector {
|
|
233
|
-
> .ant-select-selection-overflow {
|
|
234
|
-
.ant-select-selection-search {
|
|
231
|
+
&:global(.ant-select-multiple) {
|
|
232
|
+
> :global(.ant-select-selector) {
|
|
233
|
+
> :global(.ant-select-selection-overflow) {
|
|
234
|
+
:global(.ant-select-selection-search) {
|
|
235
235
|
width: 0px !important;
|
|
236
236
|
|
|
237
237
|
margin-inline-start: 0px;
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
> .ant-select-selection-placeholder {
|
|
241
|
+
> :global(.ant-select-selection-placeholder) {
|
|
242
242
|
inset-inline-start: 0px;
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
.ant-select-arrow {
|
|
247
|
+
:global(.ant-select-arrow) {
|
|
248
248
|
width: 14px;
|
|
249
249
|
height: 14px;
|
|
250
250
|
margin-top: 0px;
|
|
@@ -258,7 +258,7 @@
|
|
|
258
258
|
pointer-events: all;
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
-
.ant-select-clear {
|
|
261
|
+
:global(.ant-select-clear) {
|
|
262
262
|
width: 14px;
|
|
263
263
|
height: 14px;
|
|
264
264
|
margin-top: 0px;
|
|
@@ -273,14 +273,14 @@
|
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
&.popupMatchContentWidth {
|
|
276
|
-
.ant-select-dropdown {
|
|
276
|
+
:global(.ant-select-dropdown) {
|
|
277
277
|
[class="rc-virtual-list-holder-inner"] {
|
|
278
278
|
position: relative !important;
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
.ant-select-dropdown {
|
|
283
|
+
:global(.ant-select-dropdown) {
|
|
284
284
|
position: fixed;
|
|
285
285
|
|
|
286
286
|
font-family: inherit;
|
|
@@ -288,16 +288,16 @@
|
|
|
288
288
|
font-weight: inherit;
|
|
289
289
|
color: inherit;
|
|
290
290
|
|
|
291
|
-
.ant-select-item {
|
|
291
|
+
:global(.ant-select-item) {
|
|
292
292
|
font-family: inherit;
|
|
293
293
|
font-size: inherit;
|
|
294
294
|
font-weight: inherit;
|
|
295
295
|
color: inherit;
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
.ant-select-item-empty,
|
|
299
|
-
.ant-empty,
|
|
300
|
-
.ant-empty-description {
|
|
298
|
+
:global(.ant-select-item-empty),
|
|
299
|
+
:global(.ant-empty),
|
|
300
|
+
:global(.ant-empty-description) {
|
|
301
301
|
font-family: inherit;
|
|
302
302
|
font-size: inherit;
|
|
303
303
|
font-weight: inherit;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
cursor: pointer;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
.ant-input-group-addon {
|
|
13
|
+
:global(.ant-input-group-addon) {
|
|
14
14
|
padding: 0;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
.tabs {
|
|
27
27
|
max-width: min-content;
|
|
28
28
|
|
|
29
|
-
.ant-tabs-nav {
|
|
29
|
+
:global(.ant-tabs-nav) {
|
|
30
30
|
margin-bottom: 10px;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
.ant-tabs-tab {
|
|
33
|
+
:global(.ant-tabs-tab) {
|
|
34
34
|
padding: 4px 0px 6px;
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
border: 1px solid var(--cf-border);
|
|
12
12
|
border-radius: 6px;
|
|
13
13
|
|
|
14
|
-
.ant-select-selector {
|
|
14
|
+
:global(.ant-select-selector) {
|
|
15
15
|
font-family: inherit;
|
|
16
16
|
font-size: inherit;
|
|
17
17
|
font-weight: inherit;
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
border: none !important;
|
|
22
22
|
border-radius: inherit !important;
|
|
23
23
|
|
|
24
|
-
.ant-select-selection-wrap {
|
|
24
|
+
:global(.ant-select-selection-wrap) {
|
|
25
25
|
font-family: inherit;
|
|
26
26
|
font-size: inherit;
|
|
27
27
|
font-weight: inherit;
|
|
28
28
|
color: inherit;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.ant-select-selection-search {
|
|
31
|
+
:global(.ant-select-selection-search) {
|
|
32
32
|
font-family: inherit;
|
|
33
33
|
font-size: inherit;
|
|
34
34
|
font-weight: inherit;
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
.ant-select-selection-placeholder {
|
|
45
|
+
:global(.ant-select-selection-placeholder) {
|
|
46
46
|
font-family: inherit;
|
|
47
47
|
font-size: inherit;
|
|
48
48
|
font-weight: inherit;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
.ant-select-selection-item {
|
|
51
|
+
:global(.ant-select-selection-item) {
|
|
52
52
|
font-family: inherit;
|
|
53
53
|
font-size: inherit;
|
|
54
54
|
font-weight: inherit;
|
|
@@ -56,21 +56,21 @@
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
.ant-select-arrow {
|
|
59
|
+
:global(.ant-select-arrow) {
|
|
60
60
|
width: 14px;
|
|
61
61
|
height: 14px;
|
|
62
62
|
|
|
63
63
|
font-size: 14px;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
.ant-select-clear {
|
|
66
|
+
:global(.ant-select-clear) {
|
|
67
67
|
width: 14px;
|
|
68
68
|
height: 14px;
|
|
69
69
|
|
|
70
70
|
font-size: 14px;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
.ant-tree-select-dropdown {
|
|
73
|
+
:global(.ant-tree-select-dropdown) {
|
|
74
74
|
position: fixed;
|
|
75
75
|
|
|
76
76
|
font-family: inherit;
|
|
@@ -78,17 +78,17 @@
|
|
|
78
78
|
font-weight: inherit;
|
|
79
79
|
color: inherit;
|
|
80
80
|
|
|
81
|
-
.ant-select-tree,
|
|
82
|
-
.ant-select-tree-treenode,
|
|
83
|
-
.ant-select-tree-node-content-wrapper,
|
|
84
|
-
.ant-select-tree-title {
|
|
81
|
+
:global(.ant-select-tree),
|
|
82
|
+
:global(.ant-select-tree-treenode),
|
|
83
|
+
:global(.ant-select-tree-node-content-wrapper),
|
|
84
|
+
:global(.ant-select-tree-title) {
|
|
85
85
|
font-family: inherit;
|
|
86
86
|
font-size: inherit;
|
|
87
87
|
font-weight: inherit;
|
|
88
88
|
color: inherit;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
.ant-select-tree-switcher {
|
|
91
|
+
:global(.ant-select-tree-switcher) {
|
|
92
92
|
display: inline-flex;
|
|
93
93
|
align-items: center;
|
|
94
94
|
justify-content: center;
|
|
@@ -103,19 +103,19 @@
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
.ant-select-tree-indent-unit {
|
|
106
|
+
:global(.ant-select-tree-indent-unit) {
|
|
107
107
|
width: var(--tree-indent-unit-width);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
.ant-empty,
|
|
111
|
-
.ant-empty-description {
|
|
110
|
+
:global(.ant-empty),
|
|
111
|
+
:global(.ant-empty-description) {
|
|
112
112
|
font-family: inherit;
|
|
113
113
|
font-size: inherit;
|
|
114
114
|
font-weight: inherit;
|
|
115
115
|
color: inherit;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
.ant-select-tree-list-scrollbar {
|
|
118
|
+
:global(.ant-select-tree-list-scrollbar) {
|
|
119
119
|
width: 5px !important;
|
|
120
120
|
|
|
121
121
|
> div {
|