iglooform 2.3.3 → 2.3.7
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/admin-upload/modal.js +1 -1
- package/es/card-detail/card-group.js +2 -1
- package/es/card-detail/card-item.js +7 -0
- package/es/card-detail/card.d.ts +2 -2
- package/es/card-detail/card.js +3 -3
- package/es/card-detail/style/index.less +28 -2
- package/es/card-detail/utils.d.ts +2 -2
- package/es/card-detail/utils.js +24 -11
- package/es/detail-panel/style/index.less +3 -2
- package/es/filter/customize.d.ts +9 -0
- package/es/filter/customize.js +21 -0
- package/es/filter/index.d.ts +6 -4
- package/es/filter/index.js +82 -42
- package/es/filter/style/index.less +1 -1
- package/es/form/context.d.ts +2 -0
- package/es/form/context.js +2 -1
- package/es/form/element/index.js +54 -2
- package/es/form/index.js +63 -13
- package/es/form/page/index.js +31 -2
- package/es/form/pages/index.js +46 -26
- package/es/form/render/index.js +3 -2
- package/es/form/steps/index.js +47 -30
- package/es/free-form/context.d.ts +19 -0
- package/es/free-form/context.js +7 -0
- package/es/free-form/element/index.d.ts +11 -0
- package/es/free-form/element/index.js +262 -0
- package/es/free-form/element/style/index.d.ts +1 -0
- package/es/free-form/element/style/index.js +1 -0
- package/es/free-form/element/style/index.less +116 -0
- package/es/free-form/index.d.ts +7 -0
- package/es/free-form/index.js +203 -0
- package/es/free-form/messages.d.ts +48 -0
- package/es/free-form/messages.js +49 -0
- package/es/free-form/page/index.d.ts +11 -0
- package/es/free-form/page/index.js +144 -0
- package/es/free-form/page/style/index.d.ts +1 -0
- package/es/free-form/page/style/index.js +1 -0
- package/es/free-form/page/style/index.less +55 -0
- package/es/free-form/style/index.d.ts +1 -0
- package/es/free-form/style/index.js +1 -0
- package/es/free-form/style/index.less +40 -0
- package/es/free-form/utils.d.ts +73 -0
- package/es/free-form/utils.js +370 -0
- package/es/global-message/style/index.less +30 -0
- package/es/index.d.ts +3 -0
- package/es/index.js +4 -1
- package/es/input/input-date.js +18 -9
- package/es/input/phone-number.js +9 -9
- package/es/input/style/index.less +17 -14
- package/es/layout/index.js +10 -2
- package/es/layout/style/index.less +2 -0
- package/es/locale/en-US/messages.json +1 -1
- package/es/locale/id-ID/messages.json +1 -1
- package/es/locale/th-TH/messages.json +1 -1
- package/es/locale/vi-VN/messages.json +1 -1
- package/es/locale/zh-CN/messages.json +1 -1
- package/es/media/media.js +0 -1
- package/es/media/preview.js +0 -1
- package/es/select/attached-select.js +2 -2
- package/es/table/index.js +33 -9
- package/es/typography/index.js +2 -2
- package/es/typography/style/index.less +4 -1
- package/es/upload/index.d.ts +3 -3
- package/es/upload/index.js +2 -2
- package/es/upload-photo/index.d.ts +2 -2
- package/es/upload-photo/index.js +2 -2
- package/es/upload-photo/media.js +0 -1
- package/es/upload-preview/media.js +0 -1
- package/lib/admin-upload/modal.js +1 -1
- package/lib/card-detail/card-group.js +2 -1
- package/lib/card-detail/card-item.js +7 -0
- package/lib/card-detail/card.d.ts +2 -2
- package/lib/card-detail/card.js +3 -3
- package/lib/card-detail/style/index.less +28 -2
- package/lib/card-detail/utils.d.ts +2 -2
- package/lib/card-detail/utils.js +25 -12
- package/lib/detail-panel/style/index.less +3 -2
- package/lib/filter/customize.d.ts +9 -0
- package/lib/filter/customize.js +33 -0
- package/lib/filter/index.d.ts +6 -4
- package/lib/filter/index.js +83 -42
- package/lib/filter/style/index.less +1 -1
- package/lib/form/context.d.ts +2 -0
- package/lib/form/context.js +2 -1
- package/lib/form/element/index.js +53 -1
- package/lib/form/index.js +62 -12
- package/lib/form/page/index.js +29 -1
- package/lib/form/pages/index.js +45 -25
- package/lib/form/render/index.js +2 -1
- package/lib/form/steps/index.js +46 -29
- package/lib/free-form/context.d.ts +19 -0
- package/lib/free-form/context.js +19 -0
- package/lib/free-form/element/index.d.ts +11 -0
- package/lib/free-form/element/index.js +288 -0
- package/lib/free-form/element/style/index.d.ts +1 -0
- package/lib/free-form/element/style/index.js +3 -0
- package/lib/free-form/element/style/index.less +116 -0
- package/lib/free-form/index.d.ts +7 -0
- package/lib/free-form/index.js +220 -0
- package/lib/free-form/messages.d.ts +48 -0
- package/lib/free-form/messages.js +56 -0
- package/lib/free-form/page/index.d.ts +11 -0
- package/lib/free-form/page/index.js +164 -0
- package/lib/free-form/page/style/index.d.ts +1 -0
- package/lib/free-form/page/style/index.js +3 -0
- package/lib/free-form/page/style/index.less +55 -0
- package/lib/free-form/style/index.d.ts +1 -0
- package/lib/free-form/style/index.js +3 -0
- package/lib/free-form/style/index.less +40 -0
- package/lib/free-form/utils.d.ts +73 -0
- package/lib/free-form/utils.js +403 -0
- package/lib/global-message/style/index.less +30 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +28 -1
- package/lib/input/input-date.js +18 -9
- package/lib/input/phone-number.js +9 -9
- package/lib/input/style/index.less +17 -14
- package/lib/layout/index.js +10 -2
- package/lib/layout/style/index.less +2 -0
- package/lib/locale/en-US/messages.json +1 -1
- package/lib/locale/id-ID/messages.json +1 -1
- package/lib/locale/th-TH/messages.json +1 -1
- package/lib/locale/vi-VN/messages.json +1 -1
- package/lib/locale/zh-CN/messages.json +1 -1
- package/lib/media/media.js +0 -1
- package/lib/media/preview.js +0 -1
- package/lib/select/attached-select.js +2 -2
- package/lib/table/index.js +32 -8
- package/lib/typography/index.js +2 -2
- package/lib/typography/style/index.less +4 -1
- package/lib/upload/index.d.ts +3 -3
- package/lib/upload/index.js +2 -2
- package/lib/upload-photo/index.d.ts +2 -2
- package/lib/upload-photo/index.js +2 -2
- package/lib/upload-photo/media.js +0 -1
- package/lib/upload-preview/media.js +0 -1
- package/package.json +1 -1
package/es/admin-upload/modal.js
CHANGED
|
@@ -39,7 +39,7 @@ var IglooCardGroup = function IglooCardGroup(props) {
|
|
|
39
39
|
style: _objectSpread({
|
|
40
40
|
marginBottom: 32
|
|
41
41
|
}, style),
|
|
42
|
-
className: classnames(className)
|
|
42
|
+
className: classnames('igloo-form-card-container-group', className)
|
|
43
43
|
}, {
|
|
44
44
|
children: [(subHeading || subStatus) && subTitle, _jsx(_Row, Object.assign({
|
|
45
45
|
gutter: [32, 16]
|
|
@@ -55,4 +55,5 @@ var IglooCardGroup = function IglooCardGroup(props) {
|
|
|
55
55
|
}), void 0);
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
+
IglooCardGroup.displayName = 'IglooCardGroup';
|
|
58
59
|
export default IglooCardGroup;
|
|
@@ -28,6 +28,13 @@ var IglooCardItem = function IglooCardItem(props) {
|
|
|
28
28
|
children: children
|
|
29
29
|
}), void 0);
|
|
30
30
|
|
|
31
|
+
case 'number':
|
|
32
|
+
return _jsx(Typography, Object.assign({
|
|
33
|
+
level: "body1"
|
|
34
|
+
}, {
|
|
35
|
+
children: children
|
|
36
|
+
}), void 0);
|
|
37
|
+
|
|
31
38
|
case 'object':
|
|
32
39
|
return children;
|
|
33
40
|
|
package/es/card-detail/card.d.ts
CHANGED
package/es/card-detail/card.js
CHANGED
|
@@ -14,7 +14,7 @@ import { DealWithCardItem } from './utils';
|
|
|
14
14
|
import Typography from '../typography';
|
|
15
15
|
import './style/index';
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var IglooCard = function IglooCard(props) {
|
|
18
18
|
var children = props.children;
|
|
19
19
|
|
|
20
20
|
var title = props.title,
|
|
@@ -59,5 +59,5 @@ var IglooCardGroup = function IglooCardGroup(props) {
|
|
|
59
59
|
}), void 0);
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
export default
|
|
62
|
+
IglooCard.displayName = 'IglooCard';
|
|
63
|
+
export default IglooCard;
|
|
@@ -26,6 +26,32 @@
|
|
|
26
26
|
padding-top: 0px;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
.igloo-card-detail-top-group-no-head {
|
|
30
|
+
position: relative;
|
|
31
|
+
&::before {
|
|
32
|
+
position: absolute;
|
|
33
|
+
content: '';
|
|
34
|
+
width: calc(100% - 80px); //(24+26)*2
|
|
35
|
+
right: 40px;
|
|
36
|
+
height: 1px;
|
|
37
|
+
top: 0px;
|
|
38
|
+
background-color: #eeeeee;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.igloo-card-detail-top-group-with-head {
|
|
43
|
+
position: relative;
|
|
44
|
+
&::before {
|
|
45
|
+
position: absolute;
|
|
46
|
+
content: '';
|
|
47
|
+
width: calc(100% - 48px); //(24)*2
|
|
48
|
+
right: 24px;
|
|
49
|
+
height: 1px;
|
|
50
|
+
top: 0px;
|
|
51
|
+
background-color: #eeeeee;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
29
55
|
.igloo-card-detail-customize-content-wraper {
|
|
30
56
|
margin: 0px 24px;
|
|
31
57
|
}
|
|
@@ -63,10 +89,10 @@
|
|
|
63
89
|
|
|
64
90
|
&::before {
|
|
65
91
|
content: '';
|
|
66
|
-
width: calc(100%
|
|
92
|
+
width: calc(100% - 32px);
|
|
67
93
|
height: 1px;
|
|
68
94
|
top: 0px;
|
|
69
|
-
right:
|
|
95
|
+
right: 16px;
|
|
70
96
|
background-color: #eeeeee;
|
|
71
97
|
position: absolute;
|
|
72
98
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactComponentElement } from 'react';
|
|
2
2
|
import './style/index';
|
|
3
3
|
export declare function findCardItem(children?: ReactComponentElement<any>[]): any[];
|
|
4
|
-
export declare function wrapCardItem(children?: ReactComponentElement<any>[],
|
|
5
|
-
export declare function DealWithCardItem(children: any,
|
|
4
|
+
export declare function wrapCardItem(children?: ReactComponentElement<any>[], hasCustomizeWrap?: boolean): (JSX.Element | null)[];
|
|
5
|
+
export declare function DealWithCardItem(children: any, hasCustomizeWrap?: boolean): (JSX.Element | null)[];
|
package/es/card-detail/utils.js
CHANGED
|
@@ -15,9 +15,9 @@ export function findCardItem() {
|
|
|
15
15
|
var children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
16
16
|
var tempArr = [];
|
|
17
17
|
var tempIndex = -1;
|
|
18
|
-
var
|
|
19
|
-
Array.isArray(children) ?
|
|
20
|
-
var filterBoolean =
|
|
18
|
+
var childrenArr = [];
|
|
19
|
+
Array.isArray(children) ? childrenArr = children : childrenArr = [children];
|
|
20
|
+
var filterBoolean = childrenArr.filter(function (dom) {
|
|
21
21
|
if (_typeof(dom) === 'object') {
|
|
22
22
|
return dom;
|
|
23
23
|
}
|
|
@@ -46,15 +46,15 @@ export function findCardItem() {
|
|
|
46
46
|
|
|
47
47
|
return finalDom;
|
|
48
48
|
}, []);
|
|
49
|
-
} //
|
|
49
|
+
} //hasCustomizeWrap 存在的情况都是针对 page中出现 cardItem来处理的
|
|
50
50
|
|
|
51
51
|
export function wrapCardItem() {
|
|
52
52
|
var children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
53
|
-
var
|
|
53
|
+
var hasCustomizeWrap = arguments.length > 1 ? arguments[1] : undefined;
|
|
54
54
|
return children.map(function (item, index) {
|
|
55
55
|
if (Array.isArray(item)) {
|
|
56
56
|
if (!item.length) return null;
|
|
57
|
-
var padding =
|
|
57
|
+
var padding = hasCustomizeWrap ? "24px 24px 32px 24px" : "".concat(index ? 24 : 0, "px 0px 24px 0px");
|
|
58
58
|
return item[0].type.displayName === 'IglooCardItem' ? _jsx(CardGroup, Object.assign({
|
|
59
59
|
style: {
|
|
60
60
|
padding: padding
|
|
@@ -62,11 +62,24 @@ export function wrapCardItem() {
|
|
|
62
62
|
}, {
|
|
63
63
|
children: item
|
|
64
64
|
}), index) : item;
|
|
65
|
-
} //
|
|
65
|
+
} // 对齐样式
|
|
66
66
|
|
|
67
67
|
|
|
68
|
-
if (item.type.displayName !== '
|
|
69
|
-
var className = item.props.className;
|
|
68
|
+
if (item.type.displayName !== 'IglooCard' && hasCustomizeWrap) {
|
|
69
|
+
var className = item.props.className; // 因为group的样式也分了两种这里统一处理
|
|
70
|
+
|
|
71
|
+
if (item.type.displayName === 'IglooCardGroup') {
|
|
72
|
+
var subHeading = item.props.subHeading;
|
|
73
|
+
return /*#__PURE__*/React.cloneElement(item, _objectSpread(_objectSpread({}, item.props), {}, {
|
|
74
|
+
key: index,
|
|
75
|
+
style: {
|
|
76
|
+
padding: '32px 24px',
|
|
77
|
+
marginBottom: 0
|
|
78
|
+
},
|
|
79
|
+
className: classnames(className, subHeading ? 'igloo-card-detail-top-group-with-head' : 'igloo-card-detail-top-group-no-head')
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
|
|
70
83
|
return /*#__PURE__*/React.cloneElement(item, _objectSpread(_objectSpread({}, item.props), {}, {
|
|
71
84
|
key: index,
|
|
72
85
|
className: classnames(className, 'igloo-card-detail-customize-content-wraper')
|
|
@@ -76,6 +89,6 @@ export function wrapCardItem() {
|
|
|
76
89
|
return item;
|
|
77
90
|
});
|
|
78
91
|
}
|
|
79
|
-
export function DealWithCardItem(children,
|
|
80
|
-
return wrapCardItem(findCardItem(children),
|
|
92
|
+
export function DealWithCardItem(children, hasCustomizeWrap) {
|
|
93
|
+
return wrapCardItem(findCardItem(children), hasCustomizeWrap);
|
|
81
94
|
}
|
|
@@ -49,14 +49,13 @@
|
|
|
49
49
|
.igloo-detail-panel-mobile {
|
|
50
50
|
position: fixed;
|
|
51
51
|
width: 100vw;
|
|
52
|
-
max-height:
|
|
52
|
+
max-height: 100vh;
|
|
53
53
|
bottom: 0;
|
|
54
54
|
left: 0;
|
|
55
55
|
background: #fff;
|
|
56
56
|
transition: height 0.3s ease;
|
|
57
57
|
box-shadow: inset 0px 3px 0px #5858ff;
|
|
58
58
|
z-index: 999;
|
|
59
|
-
overflow: auto;
|
|
60
59
|
|
|
61
60
|
.igloo-detail-panel-title {
|
|
62
61
|
position: relative;
|
|
@@ -76,6 +75,8 @@
|
|
|
76
75
|
padding: 16px;
|
|
77
76
|
box-shadow: none;
|
|
78
77
|
border-top: 1px solid #eeeeee;
|
|
78
|
+
overflow: auto;
|
|
79
|
+
max-height: calc(100vh - 48px);
|
|
79
80
|
|
|
80
81
|
.igloo-detail-panel-sub-title {
|
|
81
82
|
padding-bottom: 16px;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
declare type IRadioBoxProps = {
|
|
3
|
+
value: any;
|
|
4
|
+
onChange: any;
|
|
5
|
+
optionKey: string;
|
|
6
|
+
render: (value: any, onChange: any) => ReactNode;
|
|
7
|
+
};
|
|
8
|
+
declare const CustomizeFilter: (props: IRadioBoxProps) => JSX.Element;
|
|
9
|
+
export default CustomizeFilter;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import "antd/es/divider/style";
|
|
2
|
+
import _Divider from "antd/es/divider";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
var CustomizeFilter = function CustomizeFilter(props) {
|
|
6
|
+
var optionKey = props.optionKey,
|
|
7
|
+
value = props.value,
|
|
8
|
+
onChange = props.onChange,
|
|
9
|
+
render = props.render;
|
|
10
|
+
return _jsxs("div", Object.assign({
|
|
11
|
+
className: "igloo-form-filter-drop-down-container-content-group"
|
|
12
|
+
}, {
|
|
13
|
+
children: [render(value, onChange), _jsx(_Divider, {
|
|
14
|
+
style: {
|
|
15
|
+
margin: '16px 0px'
|
|
16
|
+
}
|
|
17
|
+
}, void 0)]
|
|
18
|
+
}), optionKey);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default CustomizeFilter;
|
package/es/filter/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import './style/index';
|
|
3
3
|
export interface IFrameConfig {
|
|
4
|
-
type: 'date' | 'mult' | 'single';
|
|
5
|
-
filterItemTitle
|
|
6
|
-
default?: any[] |
|
|
4
|
+
type: 'date' | 'mult' | 'single' | 'customize';
|
|
5
|
+
filterItemTitle?: ReactNode;
|
|
6
|
+
default?: any[] | any;
|
|
7
7
|
key: string;
|
|
8
8
|
disabled?: string[];
|
|
9
9
|
disabledDate?: (p: any) => any;
|
|
10
10
|
format?: string;
|
|
11
|
-
options?:
|
|
11
|
+
options?: {
|
|
12
12
|
label: any;
|
|
13
13
|
value: any;
|
|
14
14
|
span?: 8 | 12 | 16 | 24;
|
|
@@ -21,6 +21,8 @@ export interface IFrameConfig {
|
|
|
21
21
|
thisMonth?: any[];
|
|
22
22
|
};
|
|
23
23
|
canNotDelete?: boolean;
|
|
24
|
+
tagTitle?: (value?: any) => string;
|
|
25
|
+
render?: (value: any, onChange: any) => ReactNode;
|
|
24
26
|
}
|
|
25
27
|
export interface IFilterProps {
|
|
26
28
|
initValue?: {
|
package/es/filter/index.js
CHANGED
|
@@ -50,6 +50,7 @@ import { LocaleContext } from '../locale';
|
|
|
50
50
|
import RangePicker from './rangePicker';
|
|
51
51
|
import CreateCheckBoxFilter from './checkBox';
|
|
52
52
|
import CreteRadioBoxFilter from './radioBox';
|
|
53
|
+
import CustomizeFilter from './customize';
|
|
53
54
|
import Typography from '../typography';
|
|
54
55
|
import Select from '../select';
|
|
55
56
|
var defaultFormat = 'DD / MM / YYYY';
|
|
@@ -94,8 +95,8 @@ function getDefaultOptions(params) {
|
|
|
94
95
|
} // 在getDefaultOptions之后执行 就不用再判断 默认时间不合法的问题了
|
|
95
96
|
|
|
96
97
|
|
|
97
|
-
function getChoosedTags(
|
|
98
|
-
return
|
|
98
|
+
function getChoosedTags(params, choosed) {
|
|
99
|
+
return params.reduce(function (res, item) {
|
|
99
100
|
var key = item.key,
|
|
100
101
|
type = item.type,
|
|
101
102
|
_item$format = item.format,
|
|
@@ -103,7 +104,8 @@ function getChoosedTags(parmas, choosed) {
|
|
|
103
104
|
options = item.options,
|
|
104
105
|
_item$canNotDelete = item.canNotDelete,
|
|
105
106
|
canNotDelete = _item$canNotDelete === void 0 ? false : _item$canNotDelete,
|
|
106
|
-
filterItemTitle = item.filterItemTitle
|
|
107
|
+
filterItemTitle = item.filterItemTitle,
|
|
108
|
+
tagTitle = item.tagTitle;
|
|
107
109
|
var choosedOption = {
|
|
108
110
|
label: '',
|
|
109
111
|
key: '',
|
|
@@ -113,6 +115,15 @@ function getChoosedTags(parmas, choosed) {
|
|
|
113
115
|
|
|
114
116
|
if (choosed[key]) {
|
|
115
117
|
switch (type) {
|
|
118
|
+
case 'customize':
|
|
119
|
+
invariant(typeof tagTitle === 'function', 'customize option must has a tagTitle function');
|
|
120
|
+
choosedOption.label = tagTitle(choosed[key]);
|
|
121
|
+
choosedOption.optionValue = choosed[key];
|
|
122
|
+
choosedOption.key = key;
|
|
123
|
+
choosedOption.type = type;
|
|
124
|
+
res.push(choosedOption);
|
|
125
|
+
break;
|
|
126
|
+
|
|
116
127
|
case 'date':
|
|
117
128
|
var beginTime = moment(choosed[key][0]).format(format);
|
|
118
129
|
var endTime = moment(choosed[key][1]).format(format);
|
|
@@ -126,6 +137,7 @@ function getChoosedTags(parmas, choosed) {
|
|
|
126
137
|
}
|
|
127
138
|
|
|
128
139
|
res.push(choosedOption);
|
|
140
|
+
break;
|
|
129
141
|
|
|
130
142
|
case 'mult':
|
|
131
143
|
options === null || options === void 0 ? void 0 : options.map(function (item) {
|
|
@@ -142,14 +154,11 @@ function getChoosedTags(parmas, choosed) {
|
|
|
142
154
|
multChoosed.key = key;
|
|
143
155
|
multChoosed.label = label;
|
|
144
156
|
multChoosed.type = type;
|
|
145
|
-
multChoosed.optionValue = value;
|
|
146
|
-
// if (canNotDelete) {
|
|
147
|
-
// choosedOption.canNotDelete = canNotDelete;
|
|
148
|
-
// }
|
|
149
|
-
|
|
157
|
+
multChoosed.optionValue = value;
|
|
150
158
|
res.push(multChoosed);
|
|
151
159
|
}
|
|
152
160
|
});
|
|
161
|
+
break;
|
|
153
162
|
|
|
154
163
|
case 'single':
|
|
155
164
|
options === null || options === void 0 ? void 0 : options.map(function (item) {
|
|
@@ -160,7 +169,7 @@ function getChoosedTags(parmas, choosed) {
|
|
|
160
169
|
choosedOption.key = key;
|
|
161
170
|
choosedOption.label = label;
|
|
162
171
|
choosedOption.type = type;
|
|
163
|
-
choosedOption.optionValue = value;
|
|
172
|
+
choosedOption.optionValue = value;
|
|
164
173
|
|
|
165
174
|
if (canNotDelete) {
|
|
166
175
|
choosedOption.canNotDelete = canNotDelete;
|
|
@@ -169,6 +178,7 @@ function getChoosedTags(parmas, choosed) {
|
|
|
169
178
|
res.push(choosedOption);
|
|
170
179
|
}
|
|
171
180
|
});
|
|
181
|
+
break;
|
|
172
182
|
|
|
173
183
|
default:
|
|
174
184
|
break;
|
|
@@ -250,6 +260,10 @@ function deleteSomeOne(optionsConfirmed, optionItem, cbFucs) {
|
|
|
250
260
|
case 'single':
|
|
251
261
|
delete optionsConfirmed[key];
|
|
252
262
|
break;
|
|
263
|
+
|
|
264
|
+
case 'customize':
|
|
265
|
+
delete optionsConfirmed[key];
|
|
266
|
+
break;
|
|
253
267
|
}
|
|
254
268
|
|
|
255
269
|
var cbArr = typeof cbFucs === 'function' ? [cbFucs] : cbFucs;
|
|
@@ -355,10 +369,10 @@ var FilterComponent = function FilterComponent(props) {
|
|
|
355
369
|
idName = _useState2[0],
|
|
356
370
|
setIdName = _useState2[1];
|
|
357
371
|
|
|
358
|
-
invariant(!showIdSelect ||
|
|
372
|
+
invariant(!showIdSelect || idKeyTypes.length !== 0, 'must set idKeyTypes while showIdSelect is true');
|
|
359
373
|
invariant(typeof onFilter === 'function', 'filterCallBack must be a function'); // option controller
|
|
360
374
|
|
|
361
|
-
var
|
|
375
|
+
var dropDownContainerRef = useRef(); // 处理antd日期组件选择完还有高亮问题
|
|
362
376
|
|
|
363
377
|
var invisibleRef = useRef(); // 控制 展开框的关闭
|
|
364
378
|
|
|
@@ -380,11 +394,10 @@ var FilterComponent = function FilterComponent(props) {
|
|
|
380
394
|
_useState6 = _slicedToArray(_useState5, 1),
|
|
381
395
|
defaultOptions = _useState6[0];
|
|
382
396
|
|
|
383
|
-
var _useState7 = useState(
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
optionsAllSelected = _useState8[0];
|
|
397
|
+
var _useState7 = useState({}),
|
|
398
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
399
|
+
optionsAllSelected = _useState8[0],
|
|
400
|
+
setOptionsAllSelected = _useState8[1];
|
|
388
401
|
|
|
389
402
|
var _useReducer = useReducer(optionsChange, initValue ? _objectSpread({}, initValue) : _objectSpread({}, defaultOptions)),
|
|
390
403
|
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
@@ -488,8 +501,12 @@ var FilterComponent = function FilterComponent(props) {
|
|
|
488
501
|
var _useState39 = useState(searchInputDefault !== undefined ? true : false),
|
|
489
502
|
_useState40 = _slicedToArray(_useState39, 2),
|
|
490
503
|
showSearchInputDefault = _useState40[0],
|
|
491
|
-
setShowSearchInputDefault = _useState40[1]; //
|
|
504
|
+
setShowSearchInputDefault = _useState40[1]; // 处理options 中 data?.map data 初始化为[] 没有数据的情况
|
|
505
|
+
|
|
492
506
|
|
|
507
|
+
useEffect(function () {
|
|
508
|
+
setOptionsAllSelected(getCheckBoxSelectedAll(filterItems));
|
|
509
|
+
}, [JSON.stringify(filterItems)]); // 设置tag框 高度改变动效
|
|
493
510
|
|
|
494
511
|
useLayoutEffect(function () {
|
|
495
512
|
setTimeout(function () {
|
|
@@ -614,31 +631,49 @@ var FilterComponent = function FilterComponent(props) {
|
|
|
614
631
|
disabledDate = item.disabledDate,
|
|
615
632
|
_item$format2 = item.format,
|
|
616
633
|
format = _item$format2 === void 0 ? defaultFormat : _item$format2,
|
|
617
|
-
dateRangeConfig = item.dateRangeConfig
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
return _jsx(RangePicker, {
|
|
621
|
-
title: filterItemTitle || formatMessage({
|
|
622
|
-
id: 'Date'
|
|
623
|
-
}),
|
|
624
|
-
optionKey: key,
|
|
625
|
-
format: format,
|
|
626
|
-
choosed: optionsChanged[key],
|
|
627
|
-
disabledDate: disabledDate,
|
|
628
|
-
valueConfirm: dispatchOptionsChange,
|
|
629
|
-
setRangeType: setTimeRangeType,
|
|
630
|
-
tiemRange: timeRangeType,
|
|
631
|
-
onFocus: invisibleRef.current,
|
|
632
|
-
dateRangeConfig: dateRangeConfig,
|
|
633
|
-
pickerOpenStatus: dataPickerOpenStatus[key],
|
|
634
|
-
setPickerOpenStatus: setPickerOpenStatus
|
|
635
|
-
}, key);
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
invariant(Array.isArray(options), 'options is required');
|
|
634
|
+
dateRangeConfig = item.dateRangeConfig,
|
|
635
|
+
render = item.render,
|
|
636
|
+
tagTitle = item.tagTitle;
|
|
639
637
|
|
|
640
638
|
switch (type) {
|
|
639
|
+
case 'customize':
|
|
640
|
+
invariant(typeof render === 'function', 'render is required of customize filter option');
|
|
641
|
+
invariant(typeof tagTitle === 'function', 'tagTitle is required of customize filter option');
|
|
642
|
+
|
|
643
|
+
var onChange = function onChange(value) {
|
|
644
|
+
return dispatchOptionsChange({
|
|
645
|
+
type: key,
|
|
646
|
+
value: value
|
|
647
|
+
});
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
return _jsx(CustomizeFilter, {
|
|
651
|
+
optionKey: key,
|
|
652
|
+
value: optionsChanged[key],
|
|
653
|
+
onChange: onChange,
|
|
654
|
+
render: render
|
|
655
|
+
}, key);
|
|
656
|
+
|
|
657
|
+
case 'date':
|
|
658
|
+
return _jsx(RangePicker, {
|
|
659
|
+
title: filterItemTitle || formatMessage({
|
|
660
|
+
id: 'Date'
|
|
661
|
+
}),
|
|
662
|
+
optionKey: key,
|
|
663
|
+
format: format,
|
|
664
|
+
choosed: optionsChanged[key],
|
|
665
|
+
disabledDate: disabledDate,
|
|
666
|
+
valueConfirm: dispatchOptionsChange,
|
|
667
|
+
setRangeType: setTimeRangeType,
|
|
668
|
+
tiemRange: timeRangeType,
|
|
669
|
+
onFocus: invisibleRef.current,
|
|
670
|
+
dateRangeConfig: dateRangeConfig,
|
|
671
|
+
pickerOpenStatus: dataPickerOpenStatus[key],
|
|
672
|
+
setPickerOpenStatus: setPickerOpenStatus
|
|
673
|
+
}, key);
|
|
674
|
+
|
|
641
675
|
case 'mult':
|
|
676
|
+
invariant(Array.isArray(options), 'options is required');
|
|
642
677
|
return _jsx(CreateCheckBoxFilter, {
|
|
643
678
|
title: filterItemTitle,
|
|
644
679
|
configList: options,
|
|
@@ -650,6 +685,7 @@ var FilterComponent = function FilterComponent(props) {
|
|
|
650
685
|
}, key);
|
|
651
686
|
|
|
652
687
|
case 'single':
|
|
688
|
+
invariant(Array.isArray(options), 'options is required');
|
|
653
689
|
return _jsx(CreteRadioBoxFilter, {
|
|
654
690
|
title: filterItemTitle,
|
|
655
691
|
configList: options,
|
|
@@ -1016,9 +1052,13 @@ var FilterComponent = function FilterComponent(props) {
|
|
|
1016
1052
|
}
|
|
1017
1053
|
}, void 0), _jsx(_Dropdown, Object.assign({
|
|
1018
1054
|
getPopupContainer: function getPopupContainer() {
|
|
1019
|
-
return
|
|
1055
|
+
return dropDownContainerRef.current;
|
|
1020
1056
|
},
|
|
1021
|
-
overlay: menu,
|
|
1057
|
+
overlay: dropVisible ? menu : _jsx(_Menu, {
|
|
1058
|
+
style: {
|
|
1059
|
+
display: 'none'
|
|
1060
|
+
}
|
|
1061
|
+
}, void 0),
|
|
1022
1062
|
placement: 'bottomLeft',
|
|
1023
1063
|
overlayClassName: "igloo-form-filter-drop-down-container",
|
|
1024
1064
|
visible: dropVisible,
|
|
@@ -1068,7 +1108,7 @@ var FilterComponent = function FilterComponent(props) {
|
|
|
1068
1108
|
}), void 0)
|
|
1069
1109
|
}), void 0), _jsx("div", {
|
|
1070
1110
|
className: "igloo-form-filter-drop-down",
|
|
1071
|
-
ref:
|
|
1111
|
+
ref: dropDownContainerRef
|
|
1072
1112
|
}, void 0)]
|
|
1073
1113
|
}), void 0);
|
|
1074
1114
|
};
|