@aloudata/aloudata-design 1.0.2 → 1.0.3
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 +210 -22
- package/dist/Dropdown/index.d.ts +6 -0
- package/dist/Select/components/MultipleOption.js +1 -1
- package/dist/Select/index.d.ts +5 -1
- package/dist/Select/index.js +62 -13
- package/dist/Select/style/status.less +17 -16
- package/dist/style/themes/default/themeColor.module.less +72 -68
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,40 +1,228 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 组件库开发规范
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://npmjs.org/package/@aloudata/aloudata-design)
|
|
3
|
+
## 简介
|
|
5
4
|
|
|
5
|
+
本文档用于介绍组件库开发相关的规范以及组件库开发过程中的注意事项。
|
|
6
6
|
|
|
7
|
+
## 环境配置
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
组件库开发过程中,需要满足以下条件:
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
Node version >= 16.0.0
|
|
11
12
|
|
|
12
|
-
##
|
|
13
|
+
## 组件库介绍
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
### 1 快速开始
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
#### 安装和启动
|
|
17
18
|
|
|
18
19
|
```bash
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
git clone https://codeup.aliyun.com/60dd34bf4690c27532d3d021/fe/aloudata-design.git
|
|
21
|
+
cd aloudata-design
|
|
22
|
+
yarn install
|
|
23
|
+
yarn start
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
#### 创建组件模板
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
yarn run cmt //根据指令输入组件名称,创建组件开发模板
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
#### 组件校验
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
yarn run lint //stylelint、eslint 校验
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
#### 组件测试
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
yarn run test //单元测试
|
|
42
|
+
```
|
|
21
43
|
|
|
22
|
-
|
|
23
|
-
$ yarn start
|
|
44
|
+
#### 组件打包
|
|
24
45
|
|
|
25
|
-
|
|
26
|
-
|
|
46
|
+
```bash
|
|
47
|
+
yarn run build //打包
|
|
48
|
+
```
|
|
27
49
|
|
|
28
|
-
|
|
29
|
-
$ yarn run build:watch
|
|
50
|
+
#### 组件本地link
|
|
30
51
|
|
|
31
|
-
|
|
32
|
-
|
|
52
|
+
```bash
|
|
53
|
+
npm link //将组件库link到本地npm
|
|
54
|
+
// 切换到业务项目目录,·引入组件库
|
|
55
|
+
npm link @aloudata/aloudata-design // 业务项目中引入组件库
|
|
56
|
+
```
|
|
33
57
|
|
|
34
|
-
|
|
35
|
-
|
|
58
|
+
### 2 目录结构
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
.
|
|
62
|
+
├── README.md --> readme
|
|
63
|
+
├── docs --> 文档目录
|
|
64
|
+
│ └── index.md
|
|
65
|
+
├── scripts --> 自定义脚本目录
|
|
66
|
+
│ └── createComponentTemplate.mjs
|
|
67
|
+
├── dist --> 组件打包生成的组件目录
|
|
68
|
+
├── src --> 组件目录
|
|
69
|
+
├── tsconfig.json --> tsconfig ts配置文件
|
|
70
|
+
├── .editorconfig
|
|
71
|
+
├── .eslintrc.js --> eslint ts等校验规则配置
|
|
72
|
+
├── .fatherrc.ts ---> father组件打包配置
|
|
73
|
+
├── .prettierrc.js ---> prettier 代码格式化配置
|
|
74
|
+
├── .stylelintrc.json ---> less 校验规则配置
|
|
75
|
+
├── .umirc.js ---> 脚手架配置
|
|
76
|
+
├── commitlint.config.js --> commit 配置规则
|
|
77
|
+
├── typings.d.ts
|
|
78
|
+
├── package-lock.json
|
|
79
|
+
├── package.json
|
|
80
|
+
├── yarn-error.log
|
|
81
|
+
└── yarn.lock
|
|
36
82
|
```
|
|
37
83
|
|
|
38
|
-
|
|
84
|
+
### 3 代码风格
|
|
85
|
+
|
|
86
|
+
我们使用eslint+stylelint+prettier 来统一代码风格,同时**需要对vscode做一定的配置**,具体[配置参考](https://docs.dingtalk.com/i/nodes/mM3zoYAw1Rr8D5Nong2XWnZ07y9NpXxD?dontjump=true&iframeQuery=utm_source%3Dportal%26utm_medium%3Dportal_space_file_tree&navQuery=spaceId%3Da0gX104nML97WzeJ&nav=spaces)
|
|
87
|
+
|
|
88
|
+
ts文件使用 *eslint* 校验, 配置文件 .eslintrc.js [查看规则](https://cn.eslint.org/docs/rules/)
|
|
89
|
+
less文件使用 *stylelint* 校验, 配置文件 .stylelintrc.json [查看规则](https://stylelint.bootcss.com/user-guide/rules/list)
|
|
90
|
+
使用 *prettier* 格式化代码,配置文件 .prettierrc.js
|
|
91
|
+
|
|
92
|
+
## 组件开发指南(必读)
|
|
93
|
+
|
|
94
|
+
### 了解组件分类
|
|
95
|
+
|
|
96
|
+
1. 毛坯组件
|
|
97
|
+
原始的未做任何修改的antd组件
|
|
98
|
+
2. 简装组件
|
|
99
|
+
是指在毛坯组件的基础上,只简单了修改了一些颜色、样式等的组件
|
|
100
|
+
3. 精装组件
|
|
101
|
+
所谓精装组件,是指设计师精心设计过组件应用场景和UI的组件,可能基于antd,也可以完全自定义
|
|
102
|
+
|
|
103
|
+
### 单元测试
|
|
104
|
+
|
|
105
|
+
组件开发过程中需要写单测的,建议先写单测,然后进行开发。[了解TDD](https://baike.baidu.com/item/TDD/9064369)
|
|
106
|
+
|
|
107
|
+
哪些情况需要写单元测试:
|
|
108
|
+
|
|
109
|
+
1. 如果是基于antd的组件,但凡组件有api接口变动,必须要写单元测试
|
|
110
|
+
2. 非基于antd的组件,必须要写单元测试
|
|
111
|
+
3. 单元测试需要覆盖组件每一个api接口的各个状态
|
|
112
|
+
4. 单元测试文件以 *.test.tsx* 结尾
|
|
113
|
+
|
|
114
|
+
单元测试参考资料:
|
|
115
|
+
|
|
116
|
+
- [jestjs](https://jestjs.io/zh-Hans/docs/getting-started)
|
|
117
|
+
- [jest-dom](https://testing-library.com/docs/ecosystem-jest-dom/)
|
|
118
|
+
|
|
119
|
+
### 组件开发注意事项
|
|
120
|
+
|
|
121
|
+
组件开发支持两种模式,基于antd开发和其它自定义开发。
|
|
122
|
+
|
|
123
|
+
**基于antd开发:** 在业务满足的情况下,建议基于antd开发或者rc组件开发。方式是把antd组件引用过来,然后做升级修改之后,再作为ald组件暴露出去
|
|
124
|
+
|
|
125
|
+
**自定义开发:** 当antd组件不满足业务的时候,可以自定义开发,允许引用其它基础组件进行二次开发或者完全自定义组件进行开发。通常是精装组件。
|
|
126
|
+
|
|
127
|
+
组件开发有以下几个**必须要注意**的点
|
|
128
|
+
|
|
129
|
+
1. 组件样式要和组件类进行分离,即在组件开发的过程中,不允许引用css、less等样式组件。样式单独写在style文件夹下。
|
|
130
|
+
2. 组件文档内的api接口展示,是获取组件属性props的接口interface定义来实现的(自定义md表格除外)。组件库脚手架对于组件接口interface有处理,即凡是接口来自于外部库引入的部分,不会被文档api识别,即无法展示。interface接口的每一个想要暴露的属性,都必须要写注释,主要包括类型、描述、默认值等。
|
|
131
|
+
3. 组件简装及以上,必须要写demo样例,用于展示已经支持的样式及功能
|
|
132
|
+
4. 精装组件必须要写单元测试。每一个组件的属性,都要在测例中进行测试,保证在组件的的维护修改过程中,不会出现bug。
|
|
133
|
+
5. 组件由ts编写,必须对外暴露所有可能在业务使用过程中需要的ts类型。
|
|
134
|
+
6. 组件库不使用css-module,请考虑权重问题,禁止出现 **!important** 这样的样式
|
|
135
|
+
|
|
136
|
+
### 组件库文档编写注意事项
|
|
137
|
+
|
|
138
|
+
#### 文档前文frontMatter编写
|
|
139
|
+
|
|
140
|
+
在组件库官网展示的时候,会根据文档头部的信息,对文档进行分类,我们当前的计划是分成三类:设计、文档、组件;
|
|
141
|
+
|
|
142
|
+
在文档头部,使用YAML预发进行编写,用于描述组件的文档的信息,如:
|
|
143
|
+
|
|
144
|
+
```yaml
|
|
145
|
+
---
|
|
146
|
+
nav:
|
|
147
|
+
title: 组件
|
|
148
|
+
path: /components
|
|
149
|
+
title: Select 选择器
|
|
150
|
+
group:
|
|
151
|
+
title: 组件
|
|
152
|
+
---
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
具体参考:[FrontMatter](https://d.umijs.org/zh-CN/config/frontmatter)
|
|
156
|
+
|
|
157
|
+
#### 组件场景用例demo展示
|
|
158
|
+
|
|
159
|
+
每个简装以上组件都需要展示场景用例,写在src/**/demos/文件夹下
|
|
160
|
+
demo项目中,像在业务中使用aloudata-design一样,脚手架会自动关联项目到node-modules下。(建议先build一下,然后再进行demo展示)
|
|
161
|
+
在组件的md文档中使用code引入用例,在文档中展示用例,如:
|
|
162
|
+
|
|
163
|
+
```jsx
|
|
164
|
+
<code src="./demos/single/index.tsx" title="单项选择"/>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
关于demo的配置,即code的用法,请参考[demo配置](https://d.umijs.org/zh-CN/config/frontmatter#demo-%E9%85%8D%E7%BD%AE%E9%A1%B9)
|
|
168
|
+
|
|
169
|
+
#### 组件api展示
|
|
170
|
+
|
|
171
|
+
api展示为表格形势,可以使用**API**标签,如:
|
|
172
|
+
|
|
173
|
+
```jsx
|
|
174
|
+
<API src="/path/to/your/component.tsx" hideTitle></API>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
参考文档:[API](https://d.umijs.org/zh-CN/guide/advanced#%E5%9C%A8%E6%96%87%E6%A1%A3%E4%B8%AD%E5%B1%95%E7%A4%BA-api)
|
|
178
|
+
|
|
179
|
+
也可以自己使用md语法写表格
|
|
180
|
+
|
|
181
|
+
```md
|
|
182
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
183
|
+
| ---- | ---- | ---- | ---- |
|
|
184
|
+
| value | 某个值 | string | 当前选中的值 |
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### 关于组件模板创建
|
|
188
|
+
|
|
189
|
+
使用 *npm run cmt* 创建的组件模板只是做一个参考,需要自己根据实际需求进行修改
|
|
190
|
+
|
|
191
|
+
## 关于组件库打包
|
|
192
|
+
|
|
193
|
+
### 一、组件打包
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
npm run build
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
组件打包的入口在src/index.tsx,必须在文件总暴露出来,组件才会被打包。
|
|
200
|
+
组件打包使用umi框架的 [falter](https://github.com/umijs/father) 打包工具, 具体配置在 .fatherrc.ts中。打包后会生成lib目录,es目录。
|
|
201
|
+
|
|
202
|
+
### 二、官方网站打包
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
npm run docs:build
|
|
206
|
+
```
|
|
39
207
|
|
|
40
|
-
|
|
208
|
+
官网打包我们默认使用dumi站点模式,会分为设计、文档、组件三个版块,其中设计和文档版块的内容在docs目录下,组件版块的内容在src/**/*.test.md文件中。
|
|
209
|
+
|
|
210
|
+
1. 设计部分用于描述组件的设计理念,内容由设计师提供,可以是链接,也可以是资料等。
|
|
211
|
+
2. 文档用于描述组件库开发的一些信息等。
|
|
212
|
+
3. 组件用于展示组件的使用场景用例,组件的一些信息,组件的api接口等
|
|
213
|
+
|
|
214
|
+
## 按需引用
|
|
215
|
+
|
|
216
|
+
```js
|
|
217
|
+
[
|
|
218
|
+
'import',
|
|
219
|
+
{
|
|
220
|
+
libraryName: '@aloudata/aloudata-design',
|
|
221
|
+
libraryDirectory: 'dist',
|
|
222
|
+
style:(name)=>{
|
|
223
|
+
return `${name}/style/index.less`
|
|
224
|
+
},
|
|
225
|
+
camel2DashComponentName: false,
|
|
226
|
+
},
|
|
227
|
+
]
|
|
228
|
+
```
|
package/dist/Dropdown/index.d.ts
CHANGED
|
@@ -36,6 +36,12 @@ export interface IDropdownProps {
|
|
|
36
36
|
* @default -
|
|
37
37
|
*/
|
|
38
38
|
overlay: ReactElement | (() => ReactElement);
|
|
39
|
+
/**
|
|
40
|
+
* @description 菜单
|
|
41
|
+
* @type Menu | () => Menu
|
|
42
|
+
* @default -
|
|
43
|
+
*/
|
|
44
|
+
menu: ReactElement | (() => ReactElement);
|
|
39
45
|
/**
|
|
40
46
|
* @description 下拉根元素的类名称
|
|
41
47
|
* @default -
|
package/dist/Select/index.d.ts
CHANGED
|
@@ -5,5 +5,9 @@ export interface ISelectProps extends Omit<SelectProps, 'mode'> {
|
|
|
5
5
|
mode?: 'multiple';
|
|
6
6
|
}
|
|
7
7
|
export declare type IRefSelectProps = RefSelectProps;
|
|
8
|
-
declare
|
|
8
|
+
export declare type IAldRefSelectProps = IRefSelectProps & {
|
|
9
|
+
open: () => void;
|
|
10
|
+
close: () => void;
|
|
11
|
+
};
|
|
12
|
+
declare const Select: React.ForwardRefExoticComponent<ISelectProps & React.RefAttributes<IAldRefSelectProps>>;
|
|
9
13
|
export default Select;
|
package/dist/Select/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["mode", "options", "dropdownRender", "onDropdownVisibleChange", "defaultValue", "onChange", "open", "defaultOpen", "prefix", "className", "popupClassName", "listHeight", "listItemHeight", "notFoundContent", "value", "tagRender", "style"];
|
|
1
|
+
var _excluded = ["mode", "options", "dropdownRender", "onDropdownVisibleChange", "defaultValue", "onChange", "open", "defaultOpen", "prefix", "className", "popupClassName", "listHeight", "listItemHeight", "notFoundContent", "value", "tagRender", "style", "autoFocus"];
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
@@ -32,11 +32,11 @@ import { FoldDownFill } from '@aloudata/icons-react';
|
|
|
32
32
|
import { Select as AntdSelect } from 'antd';
|
|
33
33
|
import classNames from 'classnames';
|
|
34
34
|
import List from 'rc-virtual-list';
|
|
35
|
-
import React, { forwardRef, useEffect, useMemo, useRef } from 'react';
|
|
35
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
36
36
|
import Empty from "../Empty";
|
|
37
|
+
import theme from "../style/themes/default/themeColor.module.less";
|
|
37
38
|
import MultipleOption from "./components/MultipleOption";
|
|
38
39
|
import SingleOption from "./components/SingleOption";
|
|
39
|
-
import theme from "../style/themes/default/themeColor.module.less";
|
|
40
40
|
var suffixIconSizeMap = {
|
|
41
41
|
large: 20,
|
|
42
42
|
middle: 16,
|
|
@@ -93,7 +93,7 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
93
93
|
_onDropdownVisibleChange = props.onDropdownVisibleChange,
|
|
94
94
|
defaultValue = props.defaultValue,
|
|
95
95
|
onChange = props.onChange,
|
|
96
|
-
|
|
96
|
+
_open = props.open,
|
|
97
97
|
defaultOpen = props.defaultOpen,
|
|
98
98
|
prefix = props.prefix,
|
|
99
99
|
className = props.className,
|
|
@@ -111,6 +111,7 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
111
111
|
tagRender = props.tagRender,
|
|
112
112
|
_props$style = props.style,
|
|
113
113
|
style = _props$style === void 0 ? {} : _props$style,
|
|
114
|
+
autoFocus = props.autoFocus,
|
|
114
115
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
115
116
|
|
|
116
117
|
var isMultiple = mode === 'multiple';
|
|
@@ -122,19 +123,59 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
122
123
|
|
|
123
124
|
var dropDownTimeRef = React.useRef(0);
|
|
124
125
|
|
|
125
|
-
var _React$useState3 = React.useState(typeof
|
|
126
|
+
var _React$useState3 = React.useState(typeof _open === 'boolean' ? _open : defaultOpen),
|
|
126
127
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
127
128
|
isOpen = _React$useState4[0],
|
|
128
129
|
setIsOpen = _React$useState4[1];
|
|
129
130
|
|
|
131
|
+
var _React$useState5 = React.useState(typeof autoFocus === 'boolean' ? autoFocus : false),
|
|
132
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
133
|
+
isFocus = _React$useState6[0],
|
|
134
|
+
setIsFocus = _React$useState6[1];
|
|
135
|
+
|
|
130
136
|
var prefixRef = React.useRef(null);
|
|
131
137
|
|
|
132
|
-
var _React$
|
|
133
|
-
_React$
|
|
134
|
-
prefixWidth = _React$
|
|
135
|
-
setPrefixWidth = _React$
|
|
138
|
+
var _React$useState7 = React.useState(0),
|
|
139
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
140
|
+
prefixWidth = _React$useState8[0],
|
|
141
|
+
setPrefixWidth = _React$useState8[1];
|
|
136
142
|
|
|
137
143
|
var updatedRef = useRef(false);
|
|
144
|
+
var selectRef = useRef(null); // 处理 ref 方法
|
|
145
|
+
|
|
146
|
+
useImperativeHandle(ref, function () {
|
|
147
|
+
return {
|
|
148
|
+
focus: function focus() {
|
|
149
|
+
var _selectRef$current;
|
|
150
|
+
|
|
151
|
+
(_selectRef$current = selectRef.current) === null || _selectRef$current === void 0 ? void 0 : _selectRef$current.focus();
|
|
152
|
+
},
|
|
153
|
+
blur: function blur() {
|
|
154
|
+
var _selectRef$current2;
|
|
155
|
+
|
|
156
|
+
(_selectRef$current2 = selectRef.current) === null || _selectRef$current2 === void 0 ? void 0 : _selectRef$current2.blur();
|
|
157
|
+
},
|
|
158
|
+
scrollTo: function scrollTo(index) {
|
|
159
|
+
var _selectRef$current3;
|
|
160
|
+
|
|
161
|
+
(_selectRef$current3 = selectRef.current) === null || _selectRef$current3 === void 0 ? void 0 : _selectRef$current3.scrollTo(index);
|
|
162
|
+
},
|
|
163
|
+
open: function open() {
|
|
164
|
+
var _selectRef$current4;
|
|
165
|
+
|
|
166
|
+
if (_open) return;
|
|
167
|
+
setIsOpen(true);
|
|
168
|
+
(_selectRef$current4 = selectRef.current) === null || _selectRef$current4 === void 0 ? void 0 : _selectRef$current4.focus();
|
|
169
|
+
},
|
|
170
|
+
close: function close() {
|
|
171
|
+
var _selectRef$current5;
|
|
172
|
+
|
|
173
|
+
if (!_open) return;
|
|
174
|
+
setIsOpen(false);
|
|
175
|
+
(_selectRef$current5 = selectRef.current) === null || _selectRef$current5 === void 0 ? void 0 : _selectRef$current5.blur();
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
});
|
|
138
179
|
|
|
139
180
|
var onMultipleOptionChange = function onMultipleOptionChange(option, selected) {
|
|
140
181
|
var newOptions = [];
|
|
@@ -313,7 +354,8 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
313
354
|
'ald-select-small': props.size === 'small',
|
|
314
355
|
'ald-select-disabled': props.disabled,
|
|
315
356
|
'ald-select-middle': props.size !== 'large' && props.size !== 'small',
|
|
316
|
-
'ald-select-open': isOpen
|
|
357
|
+
'ald-select-open': isOpen,
|
|
358
|
+
'ald-select-focus': isFocus
|
|
317
359
|
}),
|
|
318
360
|
style: Object.assign(styleVar, style)
|
|
319
361
|
}, !!prefix && /*#__PURE__*/React.createElement("span", {
|
|
@@ -328,9 +370,9 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
328
370
|
options: options,
|
|
329
371
|
mode: isMultiple ? 'multiple' : undefined,
|
|
330
372
|
bordered: false,
|
|
331
|
-
open: typeof
|
|
373
|
+
open: typeof _open === 'boolean' ? _open : isOpen,
|
|
332
374
|
maxTagCount: "responsive",
|
|
333
|
-
ref:
|
|
375
|
+
ref: selectRef,
|
|
334
376
|
tagRender: tagRender || defaultTagRender,
|
|
335
377
|
onChange: onChange,
|
|
336
378
|
popupClassName: classNames('ald-select-popup', popupClassName),
|
|
@@ -355,7 +397,14 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
355
397
|
_onDropdownVisibleChange === null || _onDropdownVisibleChange === void 0 ? void 0 : _onDropdownVisibleChange(open);
|
|
356
398
|
},
|
|
357
399
|
value: value !== null && value !== void 0 ? value : currentValue,
|
|
358
|
-
dropdownRender: getDropdownRender()
|
|
400
|
+
dropdownRender: getDropdownRender(),
|
|
401
|
+
autoFocus: isFocus,
|
|
402
|
+
onFocus: function onFocus() {
|
|
403
|
+
setIsFocus(true);
|
|
404
|
+
},
|
|
405
|
+
onBlur: function onBlur() {
|
|
406
|
+
setIsFocus(false);
|
|
407
|
+
}
|
|
359
408
|
})));
|
|
360
409
|
});
|
|
361
410
|
export default Select;
|
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @file focused状态
|
|
1
|
+
.ald-select {
|
|
2
|
+
/**
|
|
3
|
+
* @file focused状态
|
|
6
4
|
*/
|
|
7
|
-
&:hover
|
|
8
|
-
|
|
5
|
+
&:hover,
|
|
6
|
+
&.ald-select-open,
|
|
7
|
+
&.ald-select-focus {
|
|
8
|
+
border-color: @B40;
|
|
9
9
|
// box-shadow: @shadow-drop;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* @file disabled状态
|
|
12
|
+
/**
|
|
13
|
+
* @file disabled状态
|
|
14
14
|
*/
|
|
15
|
-
&.ald-select-disabled{
|
|
16
|
-
border-color
|
|
17
|
-
background-color
|
|
15
|
+
&.ald-select-disabled {
|
|
16
|
+
border-color: @BG60;
|
|
17
|
+
background-color: @BG90;
|
|
18
18
|
box-shadow: none;
|
|
19
19
|
cursor: default;
|
|
20
20
|
|
|
21
|
-
.ant-select .ant-select-selector{
|
|
21
|
+
.ant-select .ant-select-selector {
|
|
22
22
|
cursor: default;
|
|
23
23
|
|
|
24
|
-
.ant-select-selection-search input{
|
|
24
|
+
.ant-select-selection-search input {
|
|
25
25
|
cursor: default;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.ant-select-selection-placeholder
|
|
29
|
-
|
|
28
|
+
.ant-select-selection-placeholder,
|
|
29
|
+
.ant-select-selection-item {
|
|
30
|
+
color: @NL40;
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
}
|
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
*中性浅色背景 Neutral Light
|
|
3
3
|
* 中性色是色彩系统的基础。 UI 设计中的几乎所有东西:文本、表单、背景、分隔线等等通常都是中性的。
|
|
4
4
|
**/
|
|
5
|
-
@NL0: #
|
|
5
|
+
@NL0: #171717;
|
|
6
6
|
@NL97: fade(@NL0, 3%); //TODO: 版本升级后,删除NL97;新版无此色号
|
|
7
7
|
@NL95: #fcfcfd;
|
|
8
8
|
@NL90: #f9fafb;
|
|
9
9
|
@NL80: #f2f4f7;
|
|
10
10
|
@NL70: #eaecf0;
|
|
11
|
-
@NL60: #
|
|
12
|
-
@NL50: #
|
|
13
|
-
@NL40: #
|
|
11
|
+
@NL60: #dbdbdb;
|
|
12
|
+
@NL50: #858585;
|
|
13
|
+
@NL40: #575757;
|
|
14
14
|
@NL30: #475467;
|
|
15
|
-
@NL20: #
|
|
16
|
-
@NL10: #
|
|
15
|
+
@NL20: #171717;
|
|
16
|
+
@NL10: #171717;
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
*中性深色背景 Neutral Dark
|
|
20
20
|
* 中性色是色彩系统的基础。 UI 设计中的几乎所有东西:文本、表单、背景、分隔线等等通常都是中性的。
|
|
21
21
|
**/
|
|
22
|
-
@ND0: #
|
|
22
|
+
@ND0: #ffffff;
|
|
23
23
|
@ND97: fade(@ND0, 3%); //TODO: 版本升级后,删除ND97;新版无此色号
|
|
24
24
|
@ND95: #101828;
|
|
25
25
|
@ND90: #1d2939;
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
@ND70: #475467;
|
|
28
28
|
@ND60: #667085;
|
|
29
29
|
@ND50: #98a2b3;
|
|
30
|
-
@ND40: #
|
|
30
|
+
@ND40: #d5d5d5;
|
|
31
31
|
@ND30: #eaecf0;
|
|
32
32
|
@ND20: #f2f4f7;
|
|
33
33
|
@ND10: #f9fafb;
|
|
@@ -36,97 +36,101 @@
|
|
|
36
36
|
* 品牌色 Brand
|
|
37
37
|
* 主色调是你的 "品牌 "颜色,用于所有互动元素,如按钮、链接、输入等。这种颜色可以定义整体感觉,并能引起人们的情感。
|
|
38
38
|
**/
|
|
39
|
-
@B10: #
|
|
40
|
-
@B20: #
|
|
41
|
-
@B30: #
|
|
42
|
-
@B40: #
|
|
43
|
-
@B50: #
|
|
44
|
-
@B60: #
|
|
45
|
-
@B70: #
|
|
46
|
-
@B80: #
|
|
47
|
-
@B90: #
|
|
48
|
-
@B95: #
|
|
49
|
-
@B98: #
|
|
39
|
+
@B10: #15325b;
|
|
40
|
+
@B20: #1e4479;
|
|
41
|
+
@B30: #3769ad;
|
|
42
|
+
@B40: #3271c9;
|
|
43
|
+
@B50: #3271c9;
|
|
44
|
+
@B60: #84aadf;
|
|
45
|
+
@B70: #adc6e9;
|
|
46
|
+
@B80: #d6e3f4;
|
|
47
|
+
@B90: #f0f6ff;
|
|
48
|
+
@B95: #f2f5fa;
|
|
49
|
+
@B98: #f2f5fa;
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* 辅助A Secondary A
|
|
53
53
|
* 绿色传达了一个积极的行动,积极的趋势,或成功的确认。
|
|
54
54
|
**/
|
|
55
|
-
@SA10: #
|
|
56
|
-
@SA20: #
|
|
57
|
-
@SA30: #
|
|
58
|
-
@SA40: #
|
|
59
|
-
@SA50: #
|
|
60
|
-
@SA60: #
|
|
61
|
-
@SA70: #
|
|
62
|
-
@SA80: #
|
|
63
|
-
@SA90: #
|
|
64
|
-
@SA95: #
|
|
65
|
-
@SA98: #
|
|
55
|
+
@SA10: #084c2b;
|
|
56
|
+
@SA20: #0d7240;
|
|
57
|
+
@SA30: #0a9953;
|
|
58
|
+
@SA40: #16b667;
|
|
59
|
+
@SA50: #44cb89;
|
|
60
|
+
@SA60: #73d8a6;
|
|
61
|
+
@SA70: #a1e5c4;
|
|
62
|
+
@SA80: #d0f2e1;
|
|
63
|
+
@SA90: #e8f9f0;
|
|
64
|
+
@SA95: #f0faf5;
|
|
65
|
+
@SA98: #f0faf5;
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* 辅助B Secondary B
|
|
69
69
|
* 橙色可以传达一个警示信号。这些颜色通常被用于提醒,以抓住用户的注意力。
|
|
70
70
|
**/
|
|
71
|
-
@SB10: #
|
|
72
|
-
@SB20: #
|
|
73
|
-
@SB30: #
|
|
74
|
-
@SB40: #
|
|
75
|
-
@SB50: #
|
|
76
|
-
@SB60: #
|
|
77
|
-
@SB70: #
|
|
78
|
-
@SB80: #
|
|
79
|
-
@SB90: #
|
|
80
|
-
@SB95: #
|
|
81
|
-
@SB98: #
|
|
71
|
+
@SB10: #7b341e;
|
|
72
|
+
@SB20: #ad5c0b;
|
|
73
|
+
@SB30: #f28e2c;
|
|
74
|
+
@SB40: #ffb01f;
|
|
75
|
+
@SB50: #ffc04d;
|
|
76
|
+
@SB60: #ffd180;
|
|
77
|
+
@SB70: #fbd99d;
|
|
78
|
+
@SB80: #feebc8;
|
|
79
|
+
@SB90: #fffaf0;
|
|
80
|
+
@SB95: #fefaf1;
|
|
81
|
+
@SB98: #fefaf1;
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
84
|
* 辅助C Secondary C
|
|
85
85
|
* 红色在错误状态和 "破坏性 "行动中使用。它们传达了一种破坏性/负面消极的行动,例如将一个用户从你的团队中删除。
|
|
86
86
|
**/
|
|
87
|
-
@SC10: #
|
|
88
|
-
@SC20: #
|
|
89
|
-
@SC30: #
|
|
90
|
-
@SC40: #
|
|
91
|
-
@SC50: #
|
|
92
|
-
@SC60: #
|
|
93
|
-
@SC70: #
|
|
94
|
-
@SC80: #
|
|
95
|
-
@SC90: #
|
|
96
|
-
@SC95: #
|
|
97
|
-
@SC98: #
|
|
87
|
+
@SC10: #6b1a1a;
|
|
88
|
+
@SC20: #832525;
|
|
89
|
+
@SC30: #b82828;
|
|
90
|
+
@SC40: #d64343;
|
|
91
|
+
@SC50: #e26464;
|
|
92
|
+
@SC60: #e98b8b;
|
|
93
|
+
@SC70: #f1b1b1;
|
|
94
|
+
@SC80: #f8d8d8;
|
|
95
|
+
@SC90: #fbecec;
|
|
96
|
+
@SC95: #fcf3f3;
|
|
97
|
+
@SC98: #fcf3f3;
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
100
|
* 背景色 Background
|
|
101
101
|
* 中性色是色彩系统的基础。 UI 设计中的几乎所有东西:文本、表单、背景、分隔线等等通常都是中性的。
|
|
102
102
|
**/
|
|
103
103
|
@BG0: #000000;
|
|
104
|
-
@BG10: #
|
|
105
|
-
@BG20: #
|
|
104
|
+
@BG10: #171717;
|
|
105
|
+
@BG20: #575757;
|
|
106
106
|
@BG30: #475467;
|
|
107
107
|
@BG40: #667085;
|
|
108
108
|
@BG50: #98a2b3;
|
|
109
|
-
@BG60: #
|
|
110
|
-
@BG70: #
|
|
111
|
-
@BG80: #
|
|
112
|
-
@BG90: #
|
|
113
|
-
@BG95: #
|
|
114
|
-
@BG97: #
|
|
109
|
+
@BG60: #dbdbdb;
|
|
110
|
+
@BG70: #d5d5d5;
|
|
111
|
+
@BG80: #f1f1f1;
|
|
112
|
+
@BG90: #f8f8f8;
|
|
113
|
+
@BG95: #ffffff;
|
|
114
|
+
@BG97: #ffffff;
|
|
115
115
|
@BG100: #ffffff;
|
|
116
116
|
|
|
117
117
|
/***
|
|
118
118
|
* 投影
|
|
119
119
|
***/
|
|
120
|
-
@shadow-L: 0px 11px 15px rgba(0, 26, 51, 0.1),
|
|
121
|
-
0px 24px 38px rgba(0, 26, 51, 0.03);
|
|
122
|
-
@shadow-xl: 0px 20px 24px -4px rgba(16, 24, 40, 0.08),
|
|
123
|
-
|
|
124
|
-
@shadow-
|
|
125
|
-
|
|
120
|
+
@shadow-L: 0px 11px 15px rgba(0, 26, 51, 0.1),
|
|
121
|
+
0px 9px 46px rgba(0, 26, 51, 0.05), 0px 24px 38px rgba(0, 26, 51, 0.03);
|
|
122
|
+
@shadow-xl: 0px 20px 24px -4px rgba(16, 24, 40, 0.08),
|
|
123
|
+
0px 8px 8px -4px rgba(16, 24, 40, 0.03);
|
|
124
|
+
@shadow-lg: 0px 12px 16px -4px rgba(16, 24, 40, 0.08),
|
|
125
|
+
0px 4px 6px -2px rgba(16, 24, 40, 0.03);
|
|
126
|
+
@shadow-md: 0px 4px 6px -2px rgba(16, 24, 40, 0.08),
|
|
127
|
+
0px 2px 4px -2px rgba(16, 24, 40, 0.03);
|
|
128
|
+
@shadow-sm: 0px 1px 4px rgba(16, 24, 40, 0.06),
|
|
129
|
+
0px 1px 2px rgba(16, 24, 40, 0.04);
|
|
126
130
|
@shadow-xs: 0px 1px 2px rgba(16, 24, 40, 0.05);
|
|
127
131
|
@shadow-body-top-left: -4px -4px 2px rgba(0, 0, 0, 0.05);
|
|
128
|
-
@shadow-primary:0 0 0 4px rgba(21, 111, 238, 0.12);
|
|
129
|
-
@shadow-drop:0 0 0 4px #
|
|
132
|
+
@shadow-primary: 0 0 0 4px rgba(21, 111, 238, 0.12);
|
|
133
|
+
@shadow-drop: 0 0 0 4px #1570ef1f;
|
|
130
134
|
// 业务颜色
|
|
131
135
|
// 除了原色之外,在业务、提示和标签等组件中使用一些次要颜色也很有帮助。这些次要颜色应该少用或作为重点使用,而主要颜色应该占优先地位。
|
|
132
136
|
|