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/typography/index.js
CHANGED
|
@@ -24,7 +24,7 @@ var IglooTypography = function IglooTypography(_ref) {
|
|
|
24
24
|
|
|
25
25
|
if (wrapElement === 'div') {
|
|
26
26
|
return _jsx("div", Object.assign({
|
|
27
|
-
className: classNames(classNameObj, className),
|
|
27
|
+
className: classNames(classNameObj, 'word-wrap', className),
|
|
28
28
|
style: style,
|
|
29
29
|
title: title,
|
|
30
30
|
onClick: onClick
|
|
@@ -34,7 +34,7 @@ var IglooTypography = function IglooTypography(_ref) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
return _jsx("span", Object.assign({
|
|
37
|
-
className: classNames(classNameObj, className),
|
|
37
|
+
className: classNames(classNameObj, 'word-wrap', className),
|
|
38
38
|
style: style,
|
|
39
39
|
title: title,
|
|
40
40
|
onClick: onClick
|
package/es/upload/index.d.ts
CHANGED
|
@@ -4,11 +4,11 @@ import './style/index.less';
|
|
|
4
4
|
export interface IglooUploadProps extends UploadProps, IglooComponentProps {
|
|
5
5
|
placeholder?: string;
|
|
6
6
|
handleUpload(file: RcFile): PromiseLike<string>;
|
|
7
|
-
value
|
|
8
|
-
onChange(value: any)
|
|
7
|
+
value?: string[];
|
|
8
|
+
onChange?: (value: any) => void;
|
|
9
9
|
limit?: number;
|
|
10
10
|
limitErrorMessage?: Function | string;
|
|
11
|
-
containerRef
|
|
11
|
+
containerRef?: any;
|
|
12
12
|
descriptions?: any;
|
|
13
13
|
}
|
|
14
14
|
declare const IglooUpload: FC<IglooUploadProps>;
|
package/es/upload/index.js
CHANGED
|
@@ -195,7 +195,7 @@ var IglooUpload = function IglooUpload(_ref) {
|
|
|
195
195
|
return f;
|
|
196
196
|
});
|
|
197
197
|
});
|
|
198
|
-
onChange(urls);
|
|
198
|
+
onChange && onChange(urls);
|
|
199
199
|
}, function (errorMsg) {
|
|
200
200
|
var fileList = [];
|
|
201
201
|
setFiles(function (files) {
|
|
@@ -398,7 +398,7 @@ var IglooUpload = function IglooUpload(_ref) {
|
|
|
398
398
|
|
|
399
399
|
return url;
|
|
400
400
|
});
|
|
401
|
-
onChange(fileListWithError);
|
|
401
|
+
onChange && onChange(fileListWithError);
|
|
402
402
|
_context4.next = 23;
|
|
403
403
|
break;
|
|
404
404
|
|
|
@@ -2,12 +2,12 @@ import { FC, IglooComponentProps } from '../types';
|
|
|
2
2
|
import './style/index.less';
|
|
3
3
|
export interface Props extends IglooComponentProps {
|
|
4
4
|
handleUpload(file: File): PromiseLike<string>;
|
|
5
|
-
value
|
|
5
|
+
value?: (string | {
|
|
6
6
|
name: string;
|
|
7
7
|
status: 'failed';
|
|
8
8
|
errorMsg: string;
|
|
9
9
|
})[];
|
|
10
|
-
onChange(value: any)
|
|
10
|
+
onChange?: (value: any) => void;
|
|
11
11
|
limit?: number;
|
|
12
12
|
limitErrorMessage?: Function | string;
|
|
13
13
|
descriptions?: any;
|
package/es/upload-photo/index.js
CHANGED
|
@@ -269,7 +269,7 @@ var UploadPhoto = function UploadPhoto(_ref) {
|
|
|
269
269
|
return f;
|
|
270
270
|
});
|
|
271
271
|
});
|
|
272
|
-
onChange(urls);
|
|
272
|
+
onChange && onChange(urls);
|
|
273
273
|
}, function (errorMsg) {
|
|
274
274
|
var fileList = [];
|
|
275
275
|
setFiles(function (files) {
|
|
@@ -479,7 +479,7 @@ var UploadPhoto = function UploadPhoto(_ref) {
|
|
|
479
479
|
|
|
480
480
|
return url;
|
|
481
481
|
});
|
|
482
|
-
onChange(fileListWithError);
|
|
482
|
+
onChange && onChange(fileListWithError);
|
|
483
483
|
_context4.next = 23;
|
|
484
484
|
break;
|
|
485
485
|
|
package/es/upload-photo/media.js
CHANGED
|
@@ -52,7 +52,7 @@ var IglooCardGroup = function IglooCardGroup(props) {
|
|
|
52
52
|
style: _objectSpread({
|
|
53
53
|
marginBottom: 32
|
|
54
54
|
}, style),
|
|
55
|
-
className: (0, _classnames.default)(className)
|
|
55
|
+
className: (0, _classnames.default)('igloo-form-card-container-group', className)
|
|
56
56
|
}, {
|
|
57
57
|
children: [(subHeading || subStatus) && subTitle, (0, _jsxRuntime.jsx)(_row.default, Object.assign({
|
|
58
58
|
gutter: [32, 16]
|
|
@@ -68,5 +68,6 @@ var IglooCardGroup = function IglooCardGroup(props) {
|
|
|
68
68
|
}), void 0);
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
+
IglooCardGroup.displayName = 'IglooCardGroup';
|
|
71
72
|
var _default = IglooCardGroup;
|
|
72
73
|
exports.default = _default;
|
|
@@ -41,6 +41,13 @@ var IglooCardItem = function IglooCardItem(props) {
|
|
|
41
41
|
children: children
|
|
42
42
|
}), void 0);
|
|
43
43
|
|
|
44
|
+
case 'number':
|
|
45
|
+
return (0, _jsxRuntime.jsx)(_index2.default, Object.assign({
|
|
46
|
+
level: "body1"
|
|
47
|
+
}, {
|
|
48
|
+
children: children
|
|
49
|
+
}), void 0);
|
|
50
|
+
|
|
44
51
|
case 'object':
|
|
45
52
|
return children;
|
|
46
53
|
|
package/lib/card-detail/card.js
CHANGED
|
@@ -31,7 +31,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
31
31
|
|
|
32
32
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
var IglooCard = function IglooCard(props) {
|
|
35
35
|
var children = props.children;
|
|
36
36
|
|
|
37
37
|
var title = props.title,
|
|
@@ -74,6 +74,6 @@ var IglooCardGroup = function IglooCardGroup(props) {
|
|
|
74
74
|
}), void 0);
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
var _default =
|
|
77
|
+
IglooCard.displayName = 'IglooCard';
|
|
78
|
+
var _default = IglooCard;
|
|
79
79
|
exports.default = _default;
|
|
@@ -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/lib/card-detail/utils.js
CHANGED
|
@@ -31,9 +31,9 @@ function findCardItem() {
|
|
|
31
31
|
var children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
32
32
|
var tempArr = [];
|
|
33
33
|
var tempIndex = -1;
|
|
34
|
-
var
|
|
35
|
-
Array.isArray(children) ?
|
|
36
|
-
var filterBoolean =
|
|
34
|
+
var childrenArr = [];
|
|
35
|
+
Array.isArray(children) ? childrenArr = children : childrenArr = [children];
|
|
36
|
+
var filterBoolean = childrenArr.filter(function (dom) {
|
|
37
37
|
if (_typeof(dom) === 'object') {
|
|
38
38
|
return dom;
|
|
39
39
|
}
|
|
@@ -62,16 +62,16 @@ function findCardItem() {
|
|
|
62
62
|
|
|
63
63
|
return finalDom;
|
|
64
64
|
}, []);
|
|
65
|
-
} //
|
|
65
|
+
} //hasCustomizeWrap 存在的情况都是针对 page中出现 cardItem来处理的
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
function wrapCardItem() {
|
|
69
69
|
var children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
70
|
-
var
|
|
70
|
+
var hasCustomizeWrap = arguments.length > 1 ? arguments[1] : undefined;
|
|
71
71
|
return children.map(function (item, index) {
|
|
72
72
|
if (Array.isArray(item)) {
|
|
73
73
|
if (!item.length) return null;
|
|
74
|
-
var padding =
|
|
74
|
+
var padding = hasCustomizeWrap ? "24px 24px 32px 24px" : "".concat(index ? 24 : 0, "px 0px 24px 0px");
|
|
75
75
|
return item[0].type.displayName === 'IglooCardItem' ? (0, _jsxRuntime.jsx)(_cardGroup.default, Object.assign({
|
|
76
76
|
style: {
|
|
77
77
|
padding: padding
|
|
@@ -79,11 +79,24 @@ function wrapCardItem() {
|
|
|
79
79
|
}, {
|
|
80
80
|
children: item
|
|
81
81
|
}), index) : item;
|
|
82
|
-
} //
|
|
83
|
-
|
|
82
|
+
} // 对齐样式
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
if (item.type.displayName !== 'IglooCard' && hasCustomizeWrap) {
|
|
86
|
+
var className = item.props.className; // 因为group的样式也分了两种这里统一处理
|
|
87
|
+
|
|
88
|
+
if (item.type.displayName === 'IglooCardGroup') {
|
|
89
|
+
var subHeading = item.props.subHeading;
|
|
90
|
+
return /*#__PURE__*/_react.default.cloneElement(item, _objectSpread(_objectSpread({}, item.props), {}, {
|
|
91
|
+
key: index,
|
|
92
|
+
style: {
|
|
93
|
+
padding: '32px 24px',
|
|
94
|
+
marginBottom: 0
|
|
95
|
+
},
|
|
96
|
+
className: (0, _classnames.default)(className, subHeading ? 'igloo-card-detail-top-group-with-head' : 'igloo-card-detail-top-group-no-head')
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
84
99
|
|
|
85
|
-
if (item.type.displayName !== 'IglooCardGroup' && hasCustomizeWrappr) {
|
|
86
|
-
var className = item.props.className;
|
|
87
100
|
return /*#__PURE__*/_react.default.cloneElement(item, _objectSpread(_objectSpread({}, item.props), {}, {
|
|
88
101
|
key: index,
|
|
89
102
|
className: (0, _classnames.default)(className, 'igloo-card-detail-customize-content-wraper')
|
|
@@ -94,6 +107,6 @@ function wrapCardItem() {
|
|
|
94
107
|
});
|
|
95
108
|
}
|
|
96
109
|
|
|
97
|
-
function DealWithCardItem(children,
|
|
98
|
-
return wrapCardItem(findCardItem(children),
|
|
110
|
+
function DealWithCardItem(children, hasCustomizeWrap) {
|
|
111
|
+
return wrapCardItem(findCardItem(children), hasCustomizeWrap);
|
|
99
112
|
}
|
|
@@ -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,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
require("antd/es/divider/style");
|
|
9
|
+
|
|
10
|
+
var _divider = _interopRequireDefault(require("antd/es/divider"));
|
|
11
|
+
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
var CustomizeFilter = function CustomizeFilter(props) {
|
|
17
|
+
var optionKey = props.optionKey,
|
|
18
|
+
value = props.value,
|
|
19
|
+
onChange = props.onChange,
|
|
20
|
+
render = props.render;
|
|
21
|
+
return (0, _jsxRuntime.jsxs)("div", Object.assign({
|
|
22
|
+
className: "igloo-form-filter-drop-down-container-content-group"
|
|
23
|
+
}, {
|
|
24
|
+
children: [render(value, onChange), (0, _jsxRuntime.jsx)(_divider.default, {
|
|
25
|
+
style: {
|
|
26
|
+
margin: '16px 0px'
|
|
27
|
+
}
|
|
28
|
+
}, void 0)]
|
|
29
|
+
}), optionKey);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
var _default = CustomizeFilter;
|
|
33
|
+
exports.default = _default;
|
package/lib/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/lib/filter/index.js
CHANGED
|
@@ -51,6 +51,8 @@ var _checkBox = _interopRequireDefault(require("./checkBox"));
|
|
|
51
51
|
|
|
52
52
|
var _radioBox = _interopRequireDefault(require("./radioBox"));
|
|
53
53
|
|
|
54
|
+
var _customize = _interopRequireDefault(require("./customize"));
|
|
55
|
+
|
|
54
56
|
var _typography = _interopRequireDefault(require("../typography"));
|
|
55
57
|
|
|
56
58
|
var _select = _interopRequireDefault(require("../select"));
|
|
@@ -127,8 +129,8 @@ function getDefaultOptions(params) {
|
|
|
127
129
|
} // 在getDefaultOptions之后执行 就不用再判断 默认时间不合法的问题了
|
|
128
130
|
|
|
129
131
|
|
|
130
|
-
function getChoosedTags(
|
|
131
|
-
return
|
|
132
|
+
function getChoosedTags(params, choosed) {
|
|
133
|
+
return params.reduce(function (res, item) {
|
|
132
134
|
var key = item.key,
|
|
133
135
|
type = item.type,
|
|
134
136
|
_item$format = item.format,
|
|
@@ -136,7 +138,8 @@ function getChoosedTags(parmas, choosed) {
|
|
|
136
138
|
options = item.options,
|
|
137
139
|
_item$canNotDelete = item.canNotDelete,
|
|
138
140
|
canNotDelete = _item$canNotDelete === void 0 ? false : _item$canNotDelete,
|
|
139
|
-
filterItemTitle = item.filterItemTitle
|
|
141
|
+
filterItemTitle = item.filterItemTitle,
|
|
142
|
+
tagTitle = item.tagTitle;
|
|
140
143
|
var choosedOption = {
|
|
141
144
|
label: '',
|
|
142
145
|
key: '',
|
|
@@ -146,6 +149,15 @@ function getChoosedTags(parmas, choosed) {
|
|
|
146
149
|
|
|
147
150
|
if (choosed[key]) {
|
|
148
151
|
switch (type) {
|
|
152
|
+
case 'customize':
|
|
153
|
+
(0, _invariant.default)(typeof tagTitle === 'function', 'customize option must has a tagTitle function');
|
|
154
|
+
choosedOption.label = tagTitle(choosed[key]);
|
|
155
|
+
choosedOption.optionValue = choosed[key];
|
|
156
|
+
choosedOption.key = key;
|
|
157
|
+
choosedOption.type = type;
|
|
158
|
+
res.push(choosedOption);
|
|
159
|
+
break;
|
|
160
|
+
|
|
149
161
|
case 'date':
|
|
150
162
|
var beginTime = (0, _moment.default)(choosed[key][0]).format(format);
|
|
151
163
|
var endTime = (0, _moment.default)(choosed[key][1]).format(format);
|
|
@@ -159,6 +171,7 @@ function getChoosedTags(parmas, choosed) {
|
|
|
159
171
|
}
|
|
160
172
|
|
|
161
173
|
res.push(choosedOption);
|
|
174
|
+
break;
|
|
162
175
|
|
|
163
176
|
case 'mult':
|
|
164
177
|
options === null || options === void 0 ? void 0 : options.map(function (item) {
|
|
@@ -175,14 +188,11 @@ function getChoosedTags(parmas, choosed) {
|
|
|
175
188
|
multChoosed.key = key;
|
|
176
189
|
multChoosed.label = label;
|
|
177
190
|
multChoosed.type = type;
|
|
178
|
-
multChoosed.optionValue = value;
|
|
179
|
-
// if (canNotDelete) {
|
|
180
|
-
// choosedOption.canNotDelete = canNotDelete;
|
|
181
|
-
// }
|
|
182
|
-
|
|
191
|
+
multChoosed.optionValue = value;
|
|
183
192
|
res.push(multChoosed);
|
|
184
193
|
}
|
|
185
194
|
});
|
|
195
|
+
break;
|
|
186
196
|
|
|
187
197
|
case 'single':
|
|
188
198
|
options === null || options === void 0 ? void 0 : options.map(function (item) {
|
|
@@ -193,7 +203,7 @@ function getChoosedTags(parmas, choosed) {
|
|
|
193
203
|
choosedOption.key = key;
|
|
194
204
|
choosedOption.label = label;
|
|
195
205
|
choosedOption.type = type;
|
|
196
|
-
choosedOption.optionValue = value;
|
|
206
|
+
choosedOption.optionValue = value;
|
|
197
207
|
|
|
198
208
|
if (canNotDelete) {
|
|
199
209
|
choosedOption.canNotDelete = canNotDelete;
|
|
@@ -202,6 +212,7 @@ function getChoosedTags(parmas, choosed) {
|
|
|
202
212
|
res.push(choosedOption);
|
|
203
213
|
}
|
|
204
214
|
});
|
|
215
|
+
break;
|
|
205
216
|
|
|
206
217
|
default:
|
|
207
218
|
break;
|
|
@@ -283,6 +294,10 @@ function deleteSomeOne(optionsConfirmed, optionItem, cbFucs) {
|
|
|
283
294
|
case 'single':
|
|
284
295
|
delete optionsConfirmed[key];
|
|
285
296
|
break;
|
|
297
|
+
|
|
298
|
+
case 'customize':
|
|
299
|
+
delete optionsConfirmed[key];
|
|
300
|
+
break;
|
|
286
301
|
}
|
|
287
302
|
|
|
288
303
|
var cbArr = typeof cbFucs === 'function' ? [cbFucs] : cbFucs;
|
|
@@ -388,10 +403,10 @@ var FilterComponent = function FilterComponent(props) {
|
|
|
388
403
|
idName = _useState2[0],
|
|
389
404
|
setIdName = _useState2[1];
|
|
390
405
|
|
|
391
|
-
(0, _invariant.default)(!showIdSelect ||
|
|
406
|
+
(0, _invariant.default)(!showIdSelect || idKeyTypes.length !== 0, 'must set idKeyTypes while showIdSelect is true');
|
|
392
407
|
(0, _invariant.default)(typeof onFilter === 'function', 'filterCallBack must be a function'); // option controller
|
|
393
408
|
|
|
394
|
-
var
|
|
409
|
+
var dropDownContainerRef = (0, _react.useRef)(); // 处理antd日期组件选择完还有高亮问题
|
|
395
410
|
|
|
396
411
|
var invisibleRef = (0, _react.useRef)(); // 控制 展开框的关闭
|
|
397
412
|
|
|
@@ -413,11 +428,10 @@ var FilterComponent = function FilterComponent(props) {
|
|
|
413
428
|
_useState6 = _slicedToArray(_useState5, 1),
|
|
414
429
|
defaultOptions = _useState6[0];
|
|
415
430
|
|
|
416
|
-
var _useState7 = (0, _react.useState)(
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
optionsAllSelected = _useState8[0];
|
|
431
|
+
var _useState7 = (0, _react.useState)({}),
|
|
432
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
433
|
+
optionsAllSelected = _useState8[0],
|
|
434
|
+
setOptionsAllSelected = _useState8[1];
|
|
421
435
|
|
|
422
436
|
var _useReducer = (0, _react.useReducer)(optionsChange, initValue ? _objectSpread({}, initValue) : _objectSpread({}, defaultOptions)),
|
|
423
437
|
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
@@ -521,8 +535,12 @@ var FilterComponent = function FilterComponent(props) {
|
|
|
521
535
|
var _useState39 = (0, _react.useState)(searchInputDefault !== undefined ? true : false),
|
|
522
536
|
_useState40 = _slicedToArray(_useState39, 2),
|
|
523
537
|
showSearchInputDefault = _useState40[0],
|
|
524
|
-
setShowSearchInputDefault = _useState40[1]; //
|
|
538
|
+
setShowSearchInputDefault = _useState40[1]; // 处理options 中 data?.map data 初始化为[] 没有数据的情况
|
|
539
|
+
|
|
525
540
|
|
|
541
|
+
(0, _react.useEffect)(function () {
|
|
542
|
+
setOptionsAllSelected(getCheckBoxSelectedAll(filterItems));
|
|
543
|
+
}, [JSON.stringify(filterItems)]); // 设置tag框 高度改变动效
|
|
526
544
|
|
|
527
545
|
(0, _react.useLayoutEffect)(function () {
|
|
528
546
|
setTimeout(function () {
|
|
@@ -646,31 +664,49 @@ var FilterComponent = function FilterComponent(props) {
|
|
|
646
664
|
disabledDate = item.disabledDate,
|
|
647
665
|
_item$format2 = item.format,
|
|
648
666
|
format = _item$format2 === void 0 ? defaultFormat : _item$format2,
|
|
649
|
-
dateRangeConfig = item.dateRangeConfig
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
return (0, _jsxRuntime.jsx)(_rangePicker.default, {
|
|
653
|
-
title: filterItemTitle || formatMessage({
|
|
654
|
-
id: 'Date'
|
|
655
|
-
}),
|
|
656
|
-
optionKey: key,
|
|
657
|
-
format: format,
|
|
658
|
-
choosed: optionsChanged[key],
|
|
659
|
-
disabledDate: disabledDate,
|
|
660
|
-
valueConfirm: dispatchOptionsChange,
|
|
661
|
-
setRangeType: setTimeRangeType,
|
|
662
|
-
tiemRange: timeRangeType,
|
|
663
|
-
onFocus: invisibleRef.current,
|
|
664
|
-
dateRangeConfig: dateRangeConfig,
|
|
665
|
-
pickerOpenStatus: dataPickerOpenStatus[key],
|
|
666
|
-
setPickerOpenStatus: setPickerOpenStatus
|
|
667
|
-
}, key);
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
(0, _invariant.default)(Array.isArray(options), 'options is required');
|
|
667
|
+
dateRangeConfig = item.dateRangeConfig,
|
|
668
|
+
render = item.render,
|
|
669
|
+
tagTitle = item.tagTitle;
|
|
671
670
|
|
|
672
671
|
switch (type) {
|
|
672
|
+
case 'customize':
|
|
673
|
+
(0, _invariant.default)(typeof render === 'function', 'render is required of customize filter option');
|
|
674
|
+
(0, _invariant.default)(typeof tagTitle === 'function', 'tagTitle is required of customize filter option');
|
|
675
|
+
|
|
676
|
+
var onChange = function onChange(value) {
|
|
677
|
+
return dispatchOptionsChange({
|
|
678
|
+
type: key,
|
|
679
|
+
value: value
|
|
680
|
+
});
|
|
681
|
+
};
|
|
682
|
+
|
|
683
|
+
return (0, _jsxRuntime.jsx)(_customize.default, {
|
|
684
|
+
optionKey: key,
|
|
685
|
+
value: optionsChanged[key],
|
|
686
|
+
onChange: onChange,
|
|
687
|
+
render: render
|
|
688
|
+
}, key);
|
|
689
|
+
|
|
690
|
+
case 'date':
|
|
691
|
+
return (0, _jsxRuntime.jsx)(_rangePicker.default, {
|
|
692
|
+
title: filterItemTitle || formatMessage({
|
|
693
|
+
id: 'Date'
|
|
694
|
+
}),
|
|
695
|
+
optionKey: key,
|
|
696
|
+
format: format,
|
|
697
|
+
choosed: optionsChanged[key],
|
|
698
|
+
disabledDate: disabledDate,
|
|
699
|
+
valueConfirm: dispatchOptionsChange,
|
|
700
|
+
setRangeType: setTimeRangeType,
|
|
701
|
+
tiemRange: timeRangeType,
|
|
702
|
+
onFocus: invisibleRef.current,
|
|
703
|
+
dateRangeConfig: dateRangeConfig,
|
|
704
|
+
pickerOpenStatus: dataPickerOpenStatus[key],
|
|
705
|
+
setPickerOpenStatus: setPickerOpenStatus
|
|
706
|
+
}, key);
|
|
707
|
+
|
|
673
708
|
case 'mult':
|
|
709
|
+
(0, _invariant.default)(Array.isArray(options), 'options is required');
|
|
674
710
|
return (0, _jsxRuntime.jsx)(_checkBox.default, {
|
|
675
711
|
title: filterItemTitle,
|
|
676
712
|
configList: options,
|
|
@@ -682,6 +718,7 @@ var FilterComponent = function FilterComponent(props) {
|
|
|
682
718
|
}, key);
|
|
683
719
|
|
|
684
720
|
case 'single':
|
|
721
|
+
(0, _invariant.default)(Array.isArray(options), 'options is required');
|
|
685
722
|
return (0, _jsxRuntime.jsx)(_radioBox.default, {
|
|
686
723
|
title: filterItemTitle,
|
|
687
724
|
configList: options,
|
|
@@ -1047,9 +1084,13 @@ var FilterComponent = function FilterComponent(props) {
|
|
|
1047
1084
|
}
|
|
1048
1085
|
}, void 0), (0, _jsxRuntime.jsx)(_dropdown.default, Object.assign({
|
|
1049
1086
|
getPopupContainer: function getPopupContainer() {
|
|
1050
|
-
return
|
|
1087
|
+
return dropDownContainerRef.current;
|
|
1051
1088
|
},
|
|
1052
|
-
overlay: menu,
|
|
1089
|
+
overlay: dropVisible ? menu : (0, _jsxRuntime.jsx)(_menu.default, {
|
|
1090
|
+
style: {
|
|
1091
|
+
display: 'none'
|
|
1092
|
+
}
|
|
1093
|
+
}, void 0),
|
|
1053
1094
|
placement: 'bottomLeft',
|
|
1054
1095
|
overlayClassName: "igloo-form-filter-drop-down-container",
|
|
1055
1096
|
visible: dropVisible,
|
|
@@ -1099,7 +1140,7 @@ var FilterComponent = function FilterComponent(props) {
|
|
|
1099
1140
|
}), void 0)
|
|
1100
1141
|
}), void 0), (0, _jsxRuntime.jsx)("div", {
|
|
1101
1142
|
className: "igloo-form-filter-drop-down",
|
|
1102
|
-
ref:
|
|
1143
|
+
ref: dropDownContainerRef
|
|
1103
1144
|
}, void 0)]
|
|
1104
1145
|
}), void 0);
|
|
1105
1146
|
};
|