@qn-pandora/pandora-component 4.0.13 → 4.1.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.json +7 -7
- package/CHANGELOG.md +5 -5
- package/es/components/Descriptions/index.d.ts +13 -0
- package/es/components/Descriptions/index.js +57 -0
- package/es/components/Descriptions/style.css +337 -0
- package/es/components/Descriptions/style.less +15 -0
- package/es/components/Drawer/CloseIcon/index.d.ts +7 -0
- package/es/components/Drawer/CloseIcon/index.js +13 -0
- package/es/components/Drawer/CloseIcon/style.css +12 -0
- package/es/components/Drawer/CloseIcon/style.less +8 -0
- package/es/components/Drawer/index.d.ts +8 -4
- package/es/components/Drawer/index.js +35 -9
- package/es/components/Drawer/style.css +11 -3
- package/es/components/Drawer/style.less +12 -3
- package/es/components/Modal/index.js +3 -2
- package/es/components/Table/style.css +8 -0
- package/es/components/Table/style.less +6 -0
- package/es/constants/language/en.js +3 -1
- package/es/constants/language/modal/en.d.ts +2 -0
- package/es/constants/language/modal/en.js +3 -0
- package/es/constants/language/modal/type.d.ts +4 -0
- package/es/constants/language/modal/type.js +3 -0
- package/es/constants/language/modal/zh.d.ts +2 -0
- package/es/constants/language/modal/zh.js +3 -0
- package/es/constants/language/type.d.ts +2 -0
- package/es/constants/language/zh.js +3 -1
- package/es/hoc/modalPopupContainer.d.ts +1 -0
- package/es/hoc/modalPopupContainer.js +9 -4
- package/es/index.css +3942 -3911
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/index.less +16 -14
- package/es/style/theme.less +4 -0
- package/lib/components/Descriptions/index.d.ts +13 -0
- package/lib/components/Descriptions/index.js +69 -0
- package/lib/components/Descriptions/style.css +337 -0
- package/lib/components/Descriptions/style.less +15 -0
- package/lib/components/Drawer/CloseIcon/index.d.ts +7 -0
- package/lib/components/Drawer/CloseIcon/index.js +18 -0
- package/lib/components/Drawer/CloseIcon/style.css +12 -0
- package/lib/components/Drawer/CloseIcon/style.less +8 -0
- package/lib/components/Drawer/index.d.ts +8 -4
- package/lib/components/Drawer/index.js +35 -9
- package/lib/components/Drawer/style.css +11 -3
- package/lib/components/Drawer/style.less +12 -3
- package/lib/components/Modal/index.js +3 -2
- package/lib/components/Table/style.css +8 -0
- package/lib/components/Table/style.less +6 -0
- package/lib/constants/language/en.js +4 -2
- package/lib/constants/language/modal/en.d.ts +2 -0
- package/lib/constants/language/modal/en.js +5 -0
- package/lib/constants/language/modal/type.d.ts +4 -0
- package/lib/constants/language/modal/type.js +5 -0
- package/lib/constants/language/modal/zh.d.ts +2 -0
- package/lib/constants/language/modal/zh.js +5 -0
- package/lib/constants/language/type.d.ts +2 -0
- package/lib/constants/language/zh.js +4 -2
- package/lib/hoc/modalPopupContainer.d.ts +1 -0
- package/lib/hoc/modalPopupContainer.js +9 -4
- package/lib/index.css +2398 -2367
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -0
- package/lib/index.less +12 -10
- package/lib/style/theme.less +4 -0
- package/package.json +3 -3
@@ -48,11 +48,14 @@ import { throttle } from 'lodash';
|
|
48
48
|
import { observer } from 'mobx-react';
|
49
49
|
import { observable, action, computed } from 'mobx';
|
50
50
|
import { Drawer as BaseDrawer } from 'antd';
|
51
|
-
import { CloseOutlined } from '@ant-design/icons';
|
52
51
|
import { doesDOMMatchSelector } from '../../utils/dom';
|
53
52
|
import { SDK_PREFIX, ANT_PREFIX } from '../../constants/style';
|
54
53
|
import modalPopupContainerWrapper from '../../hoc/modalPopupContainer';
|
55
54
|
import bind from '../../utils/bind';
|
55
|
+
import CloseIcon from './CloseIcon';
|
56
|
+
var DEFAULT_WIDTH = 640;
|
57
|
+
var SMALL_WIDTH = 480;
|
58
|
+
var LARGE_WIDTH = 960;
|
56
59
|
var MAX_WIDTH = 6000;
|
57
60
|
var MIN_WIDTH = 300;
|
58
61
|
var Drawer = /** @class */ (function (_super) {
|
@@ -61,13 +64,13 @@ var Drawer = /** @class */ (function (_super) {
|
|
61
64
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
62
65
|
_this.drawerId = "drawer-id-" + Math.floor(Math.random() * 10000);
|
63
66
|
_this.isResizing = false;
|
64
|
-
_this.realWidth = _this.props.width;
|
67
|
+
_this.realWidth = _this.initWidth(_this.props.width, _this.props.size);
|
65
68
|
_this.throttleMouseMove = throttle(function (e) { return _this.onMouseMove(e); }, 100);
|
66
69
|
return _this;
|
67
70
|
}
|
68
71
|
Object.defineProperty(Drawer.prototype, "closable", {
|
69
72
|
get: function () {
|
70
|
-
if (this.props.closable &&
|
73
|
+
if (this.props.closable !== false &&
|
71
74
|
this.props.closeIconPlacement &&
|
72
75
|
this.props.closeIconPlacement === 'right') {
|
73
76
|
return false;
|
@@ -79,10 +82,11 @@ var Drawer = /** @class */ (function (_super) {
|
|
79
82
|
});
|
80
83
|
Object.defineProperty(Drawer.prototype, "extra", {
|
81
84
|
get: function () {
|
82
|
-
|
85
|
+
var _a = this.props, closable = _a.closable, closeIconPlacement = _a.closeIconPlacement, onClose = _a.onClose;
|
86
|
+
if (closable !== false && closeIconPlacement === 'right') {
|
83
87
|
return (React.createElement(React.Fragment, null,
|
84
88
|
this.props.extra,
|
85
|
-
React.createElement(
|
89
|
+
React.createElement(CloseIcon, { className: SDK_PREFIX + "-drawer-close-icon", onClick: onClose })));
|
86
90
|
}
|
87
91
|
return this.props.extra;
|
88
92
|
},
|
@@ -105,7 +109,10 @@ var Drawer = /** @class */ (function (_super) {
|
|
105
109
|
Drawer.prototype.onMouseMove = function (e) {
|
106
110
|
if (this.isResizing) {
|
107
111
|
var offsetRight = document.body.offsetWidth - (e.clientX - document.body.offsetLeft);
|
108
|
-
if (offsetRight > MIN_WIDTH &&
|
112
|
+
if (offsetRight > MIN_WIDTH &&
|
113
|
+
offsetRight < MAX_WIDTH &&
|
114
|
+
offsetRight < document.body.offsetWidth - 10 // 10表示宽度至少比body小10,防止出现把抽屉拖出body的情况
|
115
|
+
) {
|
109
116
|
this.setRealWidth(offsetRight);
|
110
117
|
}
|
111
118
|
}
|
@@ -123,7 +130,7 @@ var Drawer = /** @class */ (function (_super) {
|
|
123
130
|
}
|
124
131
|
}
|
125
132
|
if (doesDOMMatchSelector("." + this.drawerId, currentEl) ||
|
126
|
-
doesDOMMatchSelector("." + ANT_PREFIX + "-modal-root, .ant-modal-root", currentEl)) {
|
133
|
+
doesDOMMatchSelector("." + ANT_PREFIX + "-modal-root, .ant-modal-root, ." + ANT_PREFIX + "-drawer, .ant-drawer, ." + ANT_PREFIX + "-popover, .ant-popover", currentEl)) {
|
127
134
|
shouldClose = false;
|
128
135
|
break;
|
129
136
|
}
|
@@ -134,6 +141,16 @@ var Drawer = /** @class */ (function (_super) {
|
|
134
141
|
}
|
135
142
|
}
|
136
143
|
};
|
144
|
+
Drawer.prototype.initWidth = function (width, size) {
|
145
|
+
if (width) {
|
146
|
+
return width;
|
147
|
+
}
|
148
|
+
if (size && size === 'small')
|
149
|
+
return SMALL_WIDTH;
|
150
|
+
if (size && size === 'large')
|
151
|
+
return LARGE_WIDTH;
|
152
|
+
return DEFAULT_WIDTH;
|
153
|
+
};
|
137
154
|
Drawer.prototype.componentDidMount = function () {
|
138
155
|
if (this.props.canDrag) {
|
139
156
|
document.addEventListener('mousemove', this.throttleMouseMove);
|
@@ -154,10 +171,13 @@ var Drawer = /** @class */ (function (_super) {
|
|
154
171
|
};
|
155
172
|
Drawer.prototype.render = function () {
|
156
173
|
var _a;
|
157
|
-
var _b = this.props, width = _b.width, className = _b.className, children = _b.children, canDrag = _b.canDrag, visible = _b.visible, closable = _b.closable, extra = _b.extra, other = __rest(_b, ["width", "className", "children", "canDrag", "visible", "closable", "extra"]);
|
174
|
+
var _b = this.props, width = _b.width, className = _b.className, children = _b.children, canDrag = _b.canDrag, visible = _b.visible, closable = _b.closable, extra = _b.extra, size = _b.size, onClose = _b.onClose, other = __rest(_b, ["width", "className", "children", "canDrag", "visible", "closable", "extra", "size", "onClose"]);
|
158
175
|
return (React.createElement(BaseDrawer, __assign({ className: classnames(this.drawerId, SDK_PREFIX + "-drawer", className, (_a = {},
|
159
176
|
_a[SDK_PREFIX + "-drawer-no-mask"] = this.props.mask === false,
|
160
|
-
_a
|
177
|
+
_a[SDK_PREFIX + "-drawer-size-small"] = size === 'small',
|
178
|
+
_a[SDK_PREFIX + "-drawer-size-default"] = size === 'default',
|
179
|
+
_a[SDK_PREFIX + "-drawer-size-large"] = size === 'large',
|
180
|
+
_a)), width: this.realWidth || 800, zIndex: 1200, visible: visible, closable: this.closable, extra: this.extra, closeIcon: React.createElement(CloseIcon, { className: SDK_PREFIX + "-drawer-close-icon", onClick: onClose }), onClose: onClose }, other),
|
161
181
|
canDrag && (React.createElement("div", { className: SDK_PREFIX + "-scroll-handler", onMouseDown: this.onMouseDown })),
|
162
182
|
children));
|
163
183
|
};
|
@@ -217,6 +237,12 @@ var Drawer = /** @class */ (function (_super) {
|
|
217
237
|
__metadata("design:paramtypes", [MouseEvent]),
|
218
238
|
__metadata("design:returntype", void 0)
|
219
239
|
], Drawer.prototype, "onMouseClick", null);
|
240
|
+
__decorate([
|
241
|
+
bind,
|
242
|
+
__metadata("design:type", Function),
|
243
|
+
__metadata("design:paramtypes", [Object, String]),
|
244
|
+
__metadata("design:returntype", void 0)
|
245
|
+
], Drawer.prototype, "initWidth", null);
|
220
246
|
Drawer = __decorate([
|
221
247
|
observer
|
222
248
|
], Drawer);
|
@@ -269,6 +269,15 @@
|
|
269
269
|
height: 60px;
|
270
270
|
line-height: 60px;
|
271
271
|
}
|
272
|
+
.pandora-sdk-drawer-size-small {
|
273
|
+
max-width: 38%;
|
274
|
+
}
|
275
|
+
.pandora-sdk-drawer-size-default {
|
276
|
+
max-width: 50%;
|
277
|
+
}
|
278
|
+
.pandora-sdk-drawer-size-large {
|
279
|
+
max-width: 75%;
|
280
|
+
}
|
272
281
|
.pandora-sdk-drawer-no-mask .ant-drawer-content-wrapper {
|
273
282
|
width: 100%;
|
274
283
|
}
|
@@ -282,7 +291,6 @@
|
|
282
291
|
z-index: 100;
|
283
292
|
cursor: ew-resize;
|
284
293
|
}
|
285
|
-
.pandora-sdk-drawer-
|
286
|
-
margin-left:
|
287
|
-
font-size: 16px;
|
294
|
+
.pandora-sdk-drawer-close-icon {
|
295
|
+
margin-left: 24px;
|
288
296
|
}
|
@@ -16,6 +16,16 @@
|
|
16
16
|
}
|
17
17
|
}
|
18
18
|
|
19
|
+
.@{sdk-prefix}-drawer-size-small {
|
20
|
+
max-width: 38%;
|
21
|
+
}
|
22
|
+
.@{sdk-prefix}-drawer-size-default {
|
23
|
+
max-width: 50%;
|
24
|
+
}
|
25
|
+
.@{sdk-prefix}-drawer-size-large {
|
26
|
+
max-width: 75%;
|
27
|
+
}
|
28
|
+
|
19
29
|
.@{sdk-prefix}-drawer-no-mask {
|
20
30
|
.@{ant-prefix}-drawer-content-wrapper {
|
21
31
|
width: 100%;
|
@@ -33,7 +43,6 @@
|
|
33
43
|
cursor: ew-resize;
|
34
44
|
}
|
35
45
|
|
36
|
-
.@{sdk-prefix}-drawer-
|
37
|
-
margin-left:
|
38
|
-
font-size: 16px;
|
46
|
+
.@{sdk-prefix}-drawer-close-icon {
|
47
|
+
margin-left: 24px;
|
39
48
|
}
|
@@ -49,6 +49,7 @@ import { Modal as BaseModal, ConfigProvider } from 'antd';
|
|
49
49
|
import { ConfigConsumer } from 'antd/es/config-provider';
|
50
50
|
import { SDK_PREFIX } from '../../constants/style';
|
51
51
|
import bind from '../../utils/bind';
|
52
|
+
import CloseIcon from '../Drawer/CloseIcon';
|
52
53
|
/**
|
53
54
|
* 全局弹窗组件样式封装
|
54
55
|
*/
|
@@ -72,8 +73,8 @@ var Modal = /** @class */ (function (_super) {
|
|
72
73
|
};
|
73
74
|
Modal.prototype.render = function () {
|
74
75
|
var _this = this;
|
75
|
-
var _a = this.props, wrapClassName = _a.wrapClassName, children = _a.children, bodyStyle = _a.bodyStyle, title = _a.title, otherProps = __rest(_a, ["wrapClassName", "children", "bodyStyle", "title"]);
|
76
|
-
return (React.createElement(BaseModal, __assign({ wrapClassName: classnames(SDK_PREFIX + "-modal", wrapClassName), maskClosable: false, title: title }, otherProps),
|
76
|
+
var _a = this.props, wrapClassName = _a.wrapClassName, children = _a.children, bodyStyle = _a.bodyStyle, title = _a.title, onCancel = _a.onCancel, otherProps = __rest(_a, ["wrapClassName", "children", "bodyStyle", "title", "onCancel"]);
|
77
|
+
return (React.createElement(BaseModal, __assign({ wrapClassName: classnames(SDK_PREFIX + "-modal", wrapClassName), maskClosable: false, title: title, closeIcon: React.createElement(CloseIcon, { onClick: onCancel }), onCancel: onCancel }, otherProps),
|
77
78
|
React.createElement("div", { ref: this.setContainerRef, style: bodyStyle },
|
78
79
|
React.createElement(ConfigConsumer, null, function (config) { return (React.createElement(ConfigProvider, __assign({}, config, { getPopupContainer: _this.childrenGetPopupContainer }), children)); }))));
|
79
80
|
};
|
@@ -1572,10 +1572,18 @@ textarea.ant-pagination-options-quick-jumper input {
|
|
1572
1572
|
.pandora-sdk-table-wrapper .pandora-sdk-odd-table-row + .ant-table-expanded-row {
|
1573
1573
|
background: #fafafa;
|
1574
1574
|
}
|
1575
|
+
.pandora-sdk-table-wrapper .pandora-sdk-odd-table-row td,
|
1576
|
+
.pandora-sdk-table-wrapper .pandora-sdk-odd-table-row + .ant-table-expanded-row td {
|
1577
|
+
background-color: inherit;
|
1578
|
+
}
|
1575
1579
|
.pandora-sdk-table-wrapper .pandora-sdk-even-table-row,
|
1576
1580
|
.pandora-sdk-table-wrapper .pandora-sdk-even-table-row + .ant-table-expanded-row {
|
1577
1581
|
background: #ffffff;
|
1578
1582
|
}
|
1583
|
+
.pandora-sdk-table-wrapper .pandora-sdk-even-table-row td,
|
1584
|
+
.pandora-sdk-table-wrapper .pandora-sdk-even-table-row + .ant-table-expanded-row td {
|
1585
|
+
background-color: inherit;
|
1586
|
+
}
|
1579
1587
|
.pandora-sdk-table-wrapper .ant-table-row:hover {
|
1580
1588
|
background: #f3f7fd;
|
1581
1589
|
}
|
@@ -139,10 +139,16 @@
|
|
139
139
|
.@{sdk-prefix}-odd-table-row,
|
140
140
|
.@{sdk-prefix}-odd-table-row + .@{ant-prefix}-table-expanded-row {
|
141
141
|
background: @table-row-even-bg;
|
142
|
+
td {
|
143
|
+
background-color: inherit;
|
144
|
+
}
|
142
145
|
}
|
143
146
|
.@{sdk-prefix}-even-table-row,
|
144
147
|
.@{sdk-prefix}-even-table-row + .@{ant-prefix}-table-expanded-row {
|
145
148
|
background: @table-row-odd-bg;
|
149
|
+
td {
|
150
|
+
background-color: inherit;
|
151
|
+
}
|
146
152
|
}
|
147
153
|
|
148
154
|
.@{ant-prefix}-table-row {
|
@@ -4,6 +4,7 @@ import { range_input_en } from './range_input/en';
|
|
4
4
|
import { steps_en } from './steps/en';
|
5
5
|
import { table_en } from './table/en';
|
6
6
|
import { transfer_en } from './transfer/en';
|
7
|
+
import { modal_en } from './modal/en';
|
7
8
|
import upload_en from './upload/en';
|
8
9
|
export var component_en = {
|
9
10
|
check_transform_list: check_transform_list_en,
|
@@ -12,5 +13,6 @@ export var component_en = {
|
|
12
13
|
steps: steps_en,
|
13
14
|
table: table_en,
|
14
15
|
transfer: transfer_en,
|
15
|
-
upload: upload_en
|
16
|
+
upload: upload_en,
|
17
|
+
modal: modal_en
|
16
18
|
};
|
@@ -5,6 +5,7 @@ import { IStepsLocale } from './steps/type';
|
|
5
5
|
import { ITableLocale } from './table/type';
|
6
6
|
import { ITransferLocale } from './transfer/type';
|
7
7
|
import { IUploadLocale } from './upload/type';
|
8
|
+
import { IModalLocale } from './modal/type';
|
8
9
|
export interface IComponentLocal {
|
9
10
|
check_transform_list: ICheckTransformListLocale;
|
10
11
|
datetime: IDateTimeLocale;
|
@@ -13,5 +14,6 @@ export interface IComponentLocal {
|
|
13
14
|
table: ITableLocale;
|
14
15
|
transfer: ITransferLocale;
|
15
16
|
upload: IUploadLocale;
|
17
|
+
modal: IModalLocale;
|
16
18
|
}
|
17
19
|
export declare const ComponentLocale: IComponentLocal;
|
@@ -4,6 +4,7 @@ import { range_input_zh } from './range_input/zh';
|
|
4
4
|
import { steps_zh } from './steps/zh';
|
5
5
|
import { table_zh } from './table/zh';
|
6
6
|
import { transfer_zh } from './transfer/zh';
|
7
|
+
import { modal_zh } from './modal/zh';
|
7
8
|
import upload_zh from './upload/zh';
|
8
9
|
export var component_zh = {
|
9
10
|
check_transform_list: check_transform_list_zh,
|
@@ -12,5 +13,6 @@ export var component_zh = {
|
|
12
13
|
steps: steps_zh,
|
13
14
|
table: table_zh,
|
14
15
|
transfer: transfer_zh,
|
15
|
-
upload: upload_zh
|
16
|
+
upload: upload_zh,
|
17
|
+
modal: modal_zh
|
16
18
|
};
|
@@ -27,15 +27,20 @@ export default function modalPopupContainerWrapper(Comp) {
|
|
27
27
|
return function (props) {
|
28
28
|
var containerRef = useRef(null);
|
29
29
|
var titleRef = useRef(null);
|
30
|
-
var
|
30
|
+
var extraRef = useRef(null);
|
31
|
+
var _a = props.bodyStyle, bodyStyle = _a === void 0 ? {} : _a, children = props.children, title = props.title, extra = props.extra, rest = __rest(props, ["bodyStyle", "children", "title", "extra"]);
|
31
32
|
var childrenGetPopupContainer = useCallback(function () {
|
32
33
|
return (containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) || document.body;
|
33
34
|
}, []);
|
34
35
|
var titleGetPopupContainer = useCallback(function () {
|
35
|
-
return (
|
36
|
+
return (titleRef === null || titleRef === void 0 ? void 0 : titleRef.current) || document.body;
|
37
|
+
}, []);
|
38
|
+
var extraGetPopupContainer = useCallback(function () {
|
39
|
+
return (extraRef === null || extraRef === void 0 ? void 0 : extraRef.current) || document.body;
|
36
40
|
}, []);
|
37
|
-
return (React.createElement(Comp, __assign({}, rest, { title: React.createElement("div", { ref: titleRef },
|
38
|
-
React.createElement(ConfigConsumer, null, function (config) { return (React.createElement(ConfigProvider, __assign({}, config, { getPopupContainer: titleGetPopupContainer }), title)); })) }
|
41
|
+
return (React.createElement(Comp, __assign({}, rest, { title: title ? (React.createElement("div", { ref: titleRef },
|
42
|
+
React.createElement(ConfigConsumer, null, function (config) { return (React.createElement(ConfigProvider, __assign({}, config, { getPopupContainer: titleGetPopupContainer }), title)); }))) : undefined, extra: extra ? (React.createElement("div", { ref: extraRef },
|
43
|
+
React.createElement(ConfigConsumer, null, function (config) { return (React.createElement(ConfigProvider, __assign({}, config, { getPopupContainer: extraGetPopupContainer }), extra)); }))) : undefined }),
|
39
44
|
React.createElement("div", { className: SDK_PREFIX + "-drawer-container", ref: containerRef, style: bodyStyle },
|
40
45
|
React.createElement(ConfigConsumer, null, function (config) { return (React.createElement(ConfigProvider, __assign({}, config, { getPopupContainer: childrenGetPopupContainer }), children)); }))));
|
41
46
|
};
|