@hi-ui/query-filter 5.0.0-canary.3 → 5.0.0-experimental.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/CHANGELOG.md +59 -34
- package/lib/cjs/FilterButton/index.js +2 -1
- package/lib/cjs/FilterForm/index.js +9 -6
- package/lib/esm/FilterButton/index.js +2 -1
- package/lib/esm/FilterForm/index.js +10 -7
- package/lib/types/FilterForm/index.d.ts +69 -0
- package/lib/types/QueryFilter.d.ts +3 -0
- package/lib/types/SearchInput/index.d.ts +1 -1
- package/lib/types/context.d.ts +0 -1
- package/package.json +13 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,42 +1,67 @@
|
|
|
1
1
|
# @hi-ui/query-filter
|
|
2
2
|
|
|
3
|
-
## 5.0.0-
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- 86877b241: style: 修改样式问题 (5.0)
|
|
8
|
-
- Updated dependencies [86877b241]
|
|
9
|
-
- Updated dependencies [922686dcc]
|
|
10
|
-
- Updated dependencies [8e969ad73]
|
|
11
|
-
- @hi-ui/button@5.0.0-canary.11
|
|
12
|
-
- @hi-ui/drawer@5.0.0-canary.7
|
|
13
|
-
- @hi-ui/input@5.0.0-canary.14
|
|
14
|
-
- @hi-ui/tooltip@5.0.0-canary.5
|
|
15
|
-
- @hi-ui/form@5.0.0-canary.8
|
|
16
|
-
- @hi-ui/core@5.0.0-canary.5
|
|
17
|
-
- @hi-ui/icons@5.0.0-canary.5
|
|
18
|
-
|
|
19
|
-
## 5.0.0-canary.2
|
|
20
|
-
|
|
21
|
-
### Patch Changes
|
|
22
|
-
|
|
23
|
-
- chore(query-filter): 误将 5.0.0-canary.1 发布为 latest 版本,重新发布 5.0.0-canary.2
|
|
24
|
-
|
|
25
|
-
## 5.0.0-canary.1
|
|
26
|
-
|
|
27
|
-
### Patch Changes
|
|
28
|
-
|
|
29
|
-
- fix(query-filter): 修改依赖的组件版本为 5.0
|
|
30
|
-
|
|
31
|
-
## 5.0.0-canary.0
|
|
3
|
+
## 5.0.0-experimental.0
|
|
32
4
|
|
|
33
5
|
### Major Changes
|
|
34
6
|
|
|
35
|
-
-
|
|
7
|
+
- 95e868bed: feat(query-filter): 新增 QueryFilter 组件 (5.0)
|
|
36
8
|
|
|
37
9
|
### Patch Changes
|
|
38
10
|
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
|
|
42
|
-
|
|
11
|
+
- be5a59325: style: 修改样式问题 (5.0)
|
|
12
|
+
- 7f3abee55: style: fix ui bug (5.0)
|
|
13
|
+
- Updated dependencies [6fb223e3a]
|
|
14
|
+
- Updated dependencies [4a31cea53]
|
|
15
|
+
- Updated dependencies [da2e63a14]
|
|
16
|
+
- Updated dependencies [1e226cd66]
|
|
17
|
+
- Updated dependencies [eea29eade]
|
|
18
|
+
- Updated dependencies [1662753e0]
|
|
19
|
+
- Updated dependencies [122d1d859]
|
|
20
|
+
- Updated dependencies [f1ab51725]
|
|
21
|
+
- Updated dependencies [41552be0b]
|
|
22
|
+
- Updated dependencies [dd83a83bc]
|
|
23
|
+
- Updated dependencies [8c0ee78f0]
|
|
24
|
+
- Updated dependencies [9b34d99bc]
|
|
25
|
+
- Updated dependencies [8f3aa85e4]
|
|
26
|
+
- Updated dependencies [f4fc0ef30]
|
|
27
|
+
- Updated dependencies [c021539a3]
|
|
28
|
+
- Updated dependencies [ec4c7faa2]
|
|
29
|
+
- Updated dependencies [29cae09ea]
|
|
30
|
+
- Updated dependencies [dd5033f60]
|
|
31
|
+
- Updated dependencies [fd4c20bbd]
|
|
32
|
+
- Updated dependencies [08b9d0ecf]
|
|
33
|
+
- Updated dependencies [be5a59325]
|
|
34
|
+
- Updated dependencies [71fc15e5c]
|
|
35
|
+
- Updated dependencies [79ea480f3]
|
|
36
|
+
- Updated dependencies [2e56529f7]
|
|
37
|
+
- Updated dependencies [8a92ec660]
|
|
38
|
+
- Updated dependencies [539749951]
|
|
39
|
+
- Updated dependencies [1429eced2]
|
|
40
|
+
- Updated dependencies [9b34d99bc]
|
|
41
|
+
- Updated dependencies [976ec929d]
|
|
42
|
+
- Updated dependencies [d021b4fa6]
|
|
43
|
+
- Updated dependencies [f1ab51725]
|
|
44
|
+
- Updated dependencies [6dca7795c]
|
|
45
|
+
- Updated dependencies [77d969c2e]
|
|
46
|
+
- Updated dependencies [2f850ad84]
|
|
47
|
+
- Updated dependencies [3457a6f7d]
|
|
48
|
+
- Updated dependencies [4006b2c8c]
|
|
49
|
+
- Updated dependencies [e42e2badf]
|
|
50
|
+
- Updated dependencies [33da3144e]
|
|
51
|
+
- Updated dependencies [0a8cc07a7]
|
|
52
|
+
- Updated dependencies [7f3abee55]
|
|
53
|
+
- Updated dependencies [6fcda9bf2]
|
|
54
|
+
- Updated dependencies [58ad82e94]
|
|
55
|
+
- Updated dependencies [a0f0c9d6b]
|
|
56
|
+
- Updated dependencies [b12cd78a3]
|
|
57
|
+
- Updated dependencies [99801c2d1]
|
|
58
|
+
- Updated dependencies [86910f5e2]
|
|
59
|
+
- @hi-ui/tooltip@5.0.0-experimental.0
|
|
60
|
+
- @hi-ui/drawer@5.0.0-experimental.0
|
|
61
|
+
- @hi-ui/input@5.0.0-experimental.0
|
|
62
|
+
- @hi-ui/button@5.0.0-experimental.0
|
|
63
|
+
- @hi-ui/icons@5.0.0-experimental.0
|
|
64
|
+
- @hi-ui/form@5.0.0-experimental.0
|
|
65
|
+
- @hi-ui/core@5.0.0-experimental.0
|
|
66
|
+
- @hi-ui/classname@5.0.0-experimental.0
|
|
67
|
+
- @hi-ui/env@5.0.0-experimental.0
|
|
@@ -31,7 +31,8 @@ var FilterButton = function FilterButton(_a) {
|
|
|
31
31
|
children = _a.children,
|
|
32
32
|
restProps = tslib.__rest(_a, ["count", "children"]);
|
|
33
33
|
return /*#__PURE__*/React__default["default"].createElement(Button__default["default"], Object.assign({
|
|
34
|
-
className: prefixCls + " " + (count ? 'has-count' : '')
|
|
34
|
+
className: prefixCls + " " + (count ? 'has-count' : ''),
|
|
35
|
+
appearance: "filled"
|
|
35
36
|
}, restProps, {
|
|
36
37
|
type: count ? 'secondary' : 'default'
|
|
37
38
|
}), count ? ( /*#__PURE__*/React__default["default"].createElement("div", Object.assign({
|
|
@@ -32,7 +32,10 @@ var Tooltip__default = /*#__PURE__*/_interopDefaultCompat(Tooltip);
|
|
|
32
32
|
var Button__default = /*#__PURE__*/_interopDefaultCompat(Button);
|
|
33
33
|
var prefixCls = classname.getPrefixCls('query-filter-form');
|
|
34
34
|
var FilterForm = function FilterForm(_ref) {
|
|
35
|
-
var
|
|
35
|
+
var _ref$styles = _ref.styles,
|
|
36
|
+
styles = _ref$styles === void 0 ? {} : _ref$styles,
|
|
37
|
+
classNames = _ref.classNames,
|
|
38
|
+
filterFields = _ref.filterFields,
|
|
36
39
|
formData = _ref.formData,
|
|
37
40
|
onChange = _ref.onChange,
|
|
38
41
|
onPinChange = _ref.onPinChange,
|
|
@@ -65,16 +68,16 @@ var FilterForm = function FilterForm(_ref) {
|
|
|
65
68
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
66
69
|
className: prefixCls + "-wrapper"
|
|
67
70
|
}, /*#__PURE__*/React__default["default"].createElement(Form__default["default"], {
|
|
68
|
-
|
|
71
|
+
style: Object.assign({
|
|
72
|
+
'--filter-form-gap': gap + "px"
|
|
73
|
+
}, styles === null || styles === void 0 ? void 0 : styles.form),
|
|
74
|
+
className: classname.cx("" + prefixCls, classNames === null || classNames === void 0 ? void 0 : classNames.form),
|
|
69
75
|
innerRef: formRef,
|
|
70
76
|
initialValues: formData,
|
|
71
77
|
onValuesChange: onChange,
|
|
72
78
|
labelPlacement: "top",
|
|
73
79
|
placement: placement,
|
|
74
|
-
showValidateMessage: placement === 'vertical'
|
|
75
|
-
style: {
|
|
76
|
-
'--filter-form-gap': gap + "px"
|
|
77
|
-
}
|
|
80
|
+
showValidateMessage: placement === 'vertical'
|
|
78
81
|
}, prependList.map(function (item, index) {
|
|
79
82
|
return /*#__PURE__*/React__default["default"].createElement(Form__default["default"].Item, {
|
|
80
83
|
key: index
|
|
@@ -18,7 +18,8 @@ var FilterButton = function FilterButton(_a) {
|
|
|
18
18
|
children = _a.children,
|
|
19
19
|
restProps = __rest(_a, ["count", "children"]);
|
|
20
20
|
return /*#__PURE__*/React.createElement(Button, Object.assign({
|
|
21
|
-
className: prefixCls + " " + (count ? 'has-count' : '')
|
|
21
|
+
className: prefixCls + " " + (count ? 'has-count' : ''),
|
|
22
|
+
appearance: "filled"
|
|
22
23
|
}, restProps, {
|
|
23
24
|
type: count ? 'secondary' : 'default'
|
|
24
25
|
}), count ? ( /*#__PURE__*/React.createElement("div", Object.assign({
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import React, { useRef, useEffect } from 'react';
|
|
11
11
|
import { useLocaleContext } from '@hi-ui/core';
|
|
12
|
-
import { getPrefixCls } from '@hi-ui/classname';
|
|
12
|
+
import { getPrefixCls, cx } from '@hi-ui/classname';
|
|
13
13
|
import Form from '@hi-ui/form';
|
|
14
14
|
import Tooltip from '@hi-ui/tooltip';
|
|
15
15
|
import Button from '@hi-ui/button';
|
|
@@ -17,7 +17,10 @@ import { PinOutlined } from '@hi-ui/icons';
|
|
|
17
17
|
import { useFilterContext } from '../context.js';
|
|
18
18
|
var prefixCls = getPrefixCls('query-filter-form');
|
|
19
19
|
var FilterForm = function FilterForm(_ref) {
|
|
20
|
-
var
|
|
20
|
+
var _ref$styles = _ref.styles,
|
|
21
|
+
styles = _ref$styles === void 0 ? {} : _ref$styles,
|
|
22
|
+
classNames = _ref.classNames,
|
|
23
|
+
filterFields = _ref.filterFields,
|
|
21
24
|
formData = _ref.formData,
|
|
22
25
|
onChange = _ref.onChange,
|
|
23
26
|
onPinChange = _ref.onPinChange,
|
|
@@ -50,16 +53,16 @@ var FilterForm = function FilterForm(_ref) {
|
|
|
50
53
|
return /*#__PURE__*/React.createElement("div", {
|
|
51
54
|
className: prefixCls + "-wrapper"
|
|
52
55
|
}, /*#__PURE__*/React.createElement(Form, {
|
|
53
|
-
|
|
56
|
+
style: Object.assign({
|
|
57
|
+
'--filter-form-gap': gap + "px"
|
|
58
|
+
}, styles === null || styles === void 0 ? void 0 : styles.form),
|
|
59
|
+
className: cx("" + prefixCls, classNames === null || classNames === void 0 ? void 0 : classNames.form),
|
|
54
60
|
innerRef: formRef,
|
|
55
61
|
initialValues: formData,
|
|
56
62
|
onValuesChange: onChange,
|
|
57
63
|
labelPlacement: "top",
|
|
58
64
|
placement: placement,
|
|
59
|
-
showValidateMessage: placement === 'vertical'
|
|
60
|
-
style: {
|
|
61
|
-
'--filter-form-gap': gap + "px"
|
|
62
|
-
}
|
|
65
|
+
showValidateMessage: placement === 'vertical'
|
|
63
66
|
}, prependList.map(function (item, index) {
|
|
64
67
|
return /*#__PURE__*/React.createElement(Form.Item, {
|
|
65
68
|
key: index
|
|
@@ -2,32 +2,101 @@ import React, { ReactText } from 'react';
|
|
|
2
2
|
import { FormProps } from '@hi-ui/form';
|
|
3
3
|
export declare const FilterForm: React.FC<FilterFormProps>;
|
|
4
4
|
export interface FilterFieldProps {
|
|
5
|
+
/**
|
|
6
|
+
* 字段名
|
|
7
|
+
*/
|
|
5
8
|
field: string;
|
|
9
|
+
/**
|
|
10
|
+
* 标签
|
|
11
|
+
*/
|
|
6
12
|
label: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* 组件
|
|
15
|
+
*/
|
|
7
16
|
component: React.ReactElement;
|
|
17
|
+
/**
|
|
18
|
+
* 选项
|
|
19
|
+
*/
|
|
8
20
|
options?: {
|
|
9
21
|
id: ReactText;
|
|
10
22
|
title: string;
|
|
11
23
|
}[];
|
|
24
|
+
/**
|
|
25
|
+
* 是否可见
|
|
26
|
+
*/
|
|
12
27
|
visible?: boolean;
|
|
13
28
|
}
|
|
14
29
|
export interface FilterFormProps {
|
|
30
|
+
/**
|
|
31
|
+
* 语义化结构 style
|
|
32
|
+
*/
|
|
33
|
+
styles?: {
|
|
34
|
+
form?: React.CSSProperties;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* 语义化结构 class
|
|
38
|
+
*/
|
|
39
|
+
classNames?: {
|
|
40
|
+
form?: string;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* 筛选字段
|
|
44
|
+
*/
|
|
15
45
|
filterFields: FilterFieldProps[];
|
|
46
|
+
/**
|
|
47
|
+
* 表单数据
|
|
48
|
+
*/
|
|
16
49
|
formData: Record<string, unknown>;
|
|
50
|
+
/**
|
|
51
|
+
* 表单数据变化回调
|
|
52
|
+
*/
|
|
17
53
|
onChange?: FormProps['onValuesChange'];
|
|
54
|
+
/**
|
|
55
|
+
* 固定字段变化回调
|
|
56
|
+
*/
|
|
18
57
|
onPinChange?: (field: string, visible: boolean) => void;
|
|
58
|
+
/**
|
|
59
|
+
* 布局方式
|
|
60
|
+
*/
|
|
19
61
|
placement?: FormProps['placement'];
|
|
62
|
+
/**
|
|
63
|
+
* 是否显示标签
|
|
64
|
+
*/
|
|
20
65
|
showLabel?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* 是否显示固定字段
|
|
68
|
+
*/
|
|
21
69
|
showPin?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* 外观
|
|
72
|
+
*/
|
|
22
73
|
appearance?: 'line' | 'contained';
|
|
74
|
+
/**
|
|
75
|
+
* 间距
|
|
76
|
+
*/
|
|
23
77
|
gap?: number;
|
|
78
|
+
/**
|
|
79
|
+
* 前置内容
|
|
80
|
+
*/
|
|
24
81
|
prepend?: React.ReactNode | React.ReactNode[];
|
|
82
|
+
/**
|
|
83
|
+
* 后置内容
|
|
84
|
+
*/
|
|
25
85
|
append?: React.ReactNode | React.ReactNode[];
|
|
86
|
+
/**
|
|
87
|
+
* 固定字段文本
|
|
88
|
+
*/
|
|
26
89
|
pinTexts?: {
|
|
27
90
|
pin: string;
|
|
28
91
|
unpin: string;
|
|
29
92
|
};
|
|
93
|
+
/**
|
|
94
|
+
* 数据变化回调
|
|
95
|
+
*/
|
|
30
96
|
onDataChange?: (field: string, value: React.ReactText | React.ReactText[], item: unknown, items: unknown[]) => void;
|
|
97
|
+
/**
|
|
98
|
+
* 自定义字段属性
|
|
99
|
+
*/
|
|
31
100
|
customFieldProps?: (filterField: FilterFieldProps) => Record<string, unknown> | undefined;
|
|
32
101
|
}
|
|
33
102
|
export declare const updateSelectedCacheData: (selectedCacheData: Map<string, unknown[]>, field: string, value: React.ReactText | React.ReactText[], item: unknown, items: unknown[]) => Map<string, unknown[]>;
|
|
@@ -6,5 +6,8 @@ import { FilterFormProps } from './FilterForm';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const QueryFilter: React.ForwardRefExoticComponent<QueryFilterProps & React.RefAttributes<HTMLDivElement | null>>;
|
|
8
8
|
export interface QueryFilterProps extends HiBaseHTMLProps<'div'>, FilterFormProps {
|
|
9
|
+
/**
|
|
10
|
+
* 表单数据变化回调
|
|
11
|
+
*/
|
|
9
12
|
onChange?: (formData: Record<string, unknown>) => void;
|
|
10
13
|
}
|
package/lib/types/context.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hi-ui/query-filter",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-experimental.0",
|
|
4
4
|
"description": "A sub-package for @hi-ui/hiui.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "HiUI <mi-hiui@xiaomi.com>",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"typings": "lib/types/index.d.ts",
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
|
+
"types": "./lib/types/index.d.ts",
|
|
22
23
|
"require": "./lib/cjs/index.js",
|
|
23
24
|
"default": "./lib/esm/index.js"
|
|
24
25
|
}
|
|
@@ -43,23 +44,23 @@
|
|
|
43
44
|
"url": "https://github.com/XiaoMi/hiui/issues"
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
46
|
-
"@hi-ui/classname": "^5.0.0-
|
|
47
|
-
"@hi-ui/button": "^5.0.0-
|
|
48
|
-
"@hi-ui/drawer": "^5.0.0-
|
|
49
|
-
"@hi-ui/env": "^5.0.0-
|
|
50
|
-
"@hi-ui/form": "^5.0.0-
|
|
51
|
-
"@hi-ui/tooltip": "^5.0.0-
|
|
52
|
-
"@hi-ui/icons": "^5.0.0-
|
|
53
|
-
"@hi-ui/input": "^5.0.0-
|
|
47
|
+
"@hi-ui/classname": "^5.0.0-experimental.0",
|
|
48
|
+
"@hi-ui/button": "^5.0.0-experimental.0",
|
|
49
|
+
"@hi-ui/drawer": "^5.0.0-experimental.0",
|
|
50
|
+
"@hi-ui/env": "^5.0.0-experimental.0",
|
|
51
|
+
"@hi-ui/form": "^5.0.0-experimental.0",
|
|
52
|
+
"@hi-ui/tooltip": "^5.0.0-experimental.0",
|
|
53
|
+
"@hi-ui/icons": "^5.0.0-experimental.0",
|
|
54
|
+
"@hi-ui/input": "^5.0.0-experimental.0"
|
|
54
55
|
},
|
|
55
56
|
"peerDependencies": {
|
|
56
|
-
"@hi-ui/core": ">=5.0.0-
|
|
57
|
+
"@hi-ui/core": ">=5.0.0-experimental.0",
|
|
57
58
|
"react": ">=16.8.6",
|
|
58
59
|
"react-dom": ">=16.8.6"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
|
-
"@hi-ui/core": "^5.0.0-
|
|
62
|
-
"@hi-ui/core-css": "^5.0.0-
|
|
62
|
+
"@hi-ui/core": "^5.0.0-experimental.0",
|
|
63
|
+
"@hi-ui/core-css": "^5.0.0-experimental.0",
|
|
63
64
|
"react": "^17.0.1",
|
|
64
65
|
"react-dom": "^17.0.1"
|
|
65
66
|
}
|