@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
@@ -53,11 +53,14 @@ var lodash_1 = require("lodash");
|
|
53
53
|
var mobx_react_1 = require("mobx-react");
|
54
54
|
var mobx_1 = require("mobx");
|
55
55
|
var antd_1 = require("antd");
|
56
|
-
var icons_1 = require("@ant-design/icons");
|
57
56
|
var dom_1 = require("../../utils/dom");
|
58
57
|
var style_1 = require("../../constants/style");
|
59
58
|
var modalPopupContainer_1 = __importDefault(require("../../hoc/modalPopupContainer"));
|
60
59
|
var bind_1 = __importDefault(require("../../utils/bind"));
|
60
|
+
var CloseIcon_1 = __importDefault(require("./CloseIcon"));
|
61
|
+
var DEFAULT_WIDTH = 640;
|
62
|
+
var SMALL_WIDTH = 480;
|
63
|
+
var LARGE_WIDTH = 960;
|
61
64
|
var MAX_WIDTH = 6000;
|
62
65
|
var MIN_WIDTH = 300;
|
63
66
|
var Drawer = /** @class */ (function (_super) {
|
@@ -66,13 +69,13 @@ var Drawer = /** @class */ (function (_super) {
|
|
66
69
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
67
70
|
_this.drawerId = "drawer-id-" + Math.floor(Math.random() * 10000);
|
68
71
|
_this.isResizing = false;
|
69
|
-
_this.realWidth = _this.props.width;
|
72
|
+
_this.realWidth = _this.initWidth(_this.props.width, _this.props.size);
|
70
73
|
_this.throttleMouseMove = lodash_1.throttle(function (e) { return _this.onMouseMove(e); }, 100);
|
71
74
|
return _this;
|
72
75
|
}
|
73
76
|
Object.defineProperty(Drawer.prototype, "closable", {
|
74
77
|
get: function () {
|
75
|
-
if (this.props.closable &&
|
78
|
+
if (this.props.closable !== false &&
|
76
79
|
this.props.closeIconPlacement &&
|
77
80
|
this.props.closeIconPlacement === 'right') {
|
78
81
|
return false;
|
@@ -84,10 +87,11 @@ var Drawer = /** @class */ (function (_super) {
|
|
84
87
|
});
|
85
88
|
Object.defineProperty(Drawer.prototype, "extra", {
|
86
89
|
get: function () {
|
87
|
-
|
90
|
+
var _a = this.props, closable = _a.closable, closeIconPlacement = _a.closeIconPlacement, onClose = _a.onClose;
|
91
|
+
if (closable !== false && closeIconPlacement === 'right') {
|
88
92
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
89
93
|
this.props.extra,
|
90
|
-
react_1.default.createElement(
|
94
|
+
react_1.default.createElement(CloseIcon_1.default, { className: style_1.SDK_PREFIX + "-drawer-close-icon", onClick: onClose })));
|
91
95
|
}
|
92
96
|
return this.props.extra;
|
93
97
|
},
|
@@ -110,7 +114,10 @@ var Drawer = /** @class */ (function (_super) {
|
|
110
114
|
Drawer.prototype.onMouseMove = function (e) {
|
111
115
|
if (this.isResizing) {
|
112
116
|
var offsetRight = document.body.offsetWidth - (e.clientX - document.body.offsetLeft);
|
113
|
-
if (offsetRight > MIN_WIDTH &&
|
117
|
+
if (offsetRight > MIN_WIDTH &&
|
118
|
+
offsetRight < MAX_WIDTH &&
|
119
|
+
offsetRight < document.body.offsetWidth - 10 // 10表示宽度至少比body小10,防止出现把抽屉拖出body的情况
|
120
|
+
) {
|
114
121
|
this.setRealWidth(offsetRight);
|
115
122
|
}
|
116
123
|
}
|
@@ -128,7 +135,7 @@ var Drawer = /** @class */ (function (_super) {
|
|
128
135
|
}
|
129
136
|
}
|
130
137
|
if (dom_1.doesDOMMatchSelector("." + this.drawerId, currentEl) ||
|
131
|
-
dom_1.doesDOMMatchSelector("." + style_1.ANT_PREFIX + "-modal-root, .ant-modal-root", currentEl)) {
|
138
|
+
dom_1.doesDOMMatchSelector("." + style_1.ANT_PREFIX + "-modal-root, .ant-modal-root, ." + style_1.ANT_PREFIX + "-drawer, .ant-drawer, ." + style_1.ANT_PREFIX + "-popover, .ant-popover", currentEl)) {
|
132
139
|
shouldClose = false;
|
133
140
|
break;
|
134
141
|
}
|
@@ -139,6 +146,16 @@ var Drawer = /** @class */ (function (_super) {
|
|
139
146
|
}
|
140
147
|
}
|
141
148
|
};
|
149
|
+
Drawer.prototype.initWidth = function (width, size) {
|
150
|
+
if (width) {
|
151
|
+
return width;
|
152
|
+
}
|
153
|
+
if (size && size === 'small')
|
154
|
+
return SMALL_WIDTH;
|
155
|
+
if (size && size === 'large')
|
156
|
+
return LARGE_WIDTH;
|
157
|
+
return DEFAULT_WIDTH;
|
158
|
+
};
|
142
159
|
Drawer.prototype.componentDidMount = function () {
|
143
160
|
if (this.props.canDrag) {
|
144
161
|
document.addEventListener('mousemove', this.throttleMouseMove);
|
@@ -159,10 +176,13 @@ var Drawer = /** @class */ (function (_super) {
|
|
159
176
|
};
|
160
177
|
Drawer.prototype.render = function () {
|
161
178
|
var _a;
|
162
|
-
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"]);
|
179
|
+
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"]);
|
163
180
|
return (react_1.default.createElement(antd_1.Drawer, __assign({ className: classnames_1.default(this.drawerId, style_1.SDK_PREFIX + "-drawer", className, (_a = {},
|
164
181
|
_a[style_1.SDK_PREFIX + "-drawer-no-mask"] = this.props.mask === false,
|
165
|
-
_a
|
182
|
+
_a[style_1.SDK_PREFIX + "-drawer-size-small"] = size === 'small',
|
183
|
+
_a[style_1.SDK_PREFIX + "-drawer-size-default"] = size === 'default',
|
184
|
+
_a[style_1.SDK_PREFIX + "-drawer-size-large"] = size === 'large',
|
185
|
+
_a)), width: this.realWidth || 800, zIndex: 1200, visible: visible, closable: this.closable, extra: this.extra, closeIcon: react_1.default.createElement(CloseIcon_1.default, { className: style_1.SDK_PREFIX + "-drawer-close-icon", onClick: onClose }), onClose: onClose }, other),
|
166
186
|
canDrag && (react_1.default.createElement("div", { className: style_1.SDK_PREFIX + "-scroll-handler", onMouseDown: this.onMouseDown })),
|
167
187
|
children));
|
168
188
|
};
|
@@ -222,6 +242,12 @@ var Drawer = /** @class */ (function (_super) {
|
|
222
242
|
__metadata("design:paramtypes", [MouseEvent]),
|
223
243
|
__metadata("design:returntype", void 0)
|
224
244
|
], Drawer.prototype, "onMouseClick", null);
|
245
|
+
__decorate([
|
246
|
+
bind_1.default,
|
247
|
+
__metadata("design:type", Function),
|
248
|
+
__metadata("design:paramtypes", [Object, String]),
|
249
|
+
__metadata("design:returntype", void 0)
|
250
|
+
], Drawer.prototype, "initWidth", null);
|
225
251
|
Drawer = __decorate([
|
226
252
|
mobx_react_1.observer
|
227
253
|
], 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
|
}
|
@@ -61,6 +61,7 @@ var antd_1 = require("antd");
|
|
61
61
|
var config_provider_1 = require("antd/es/config-provider");
|
62
62
|
var style_1 = require("../../constants/style");
|
63
63
|
var bind_1 = __importDefault(require("../../utils/bind"));
|
64
|
+
var CloseIcon_1 = __importDefault(require("../Drawer/CloseIcon"));
|
64
65
|
/**
|
65
66
|
* 全局弹窗组件样式封装
|
66
67
|
*/
|
@@ -84,8 +85,8 @@ var Modal = /** @class */ (function (_super) {
|
|
84
85
|
};
|
85
86
|
Modal.prototype.render = function () {
|
86
87
|
var _this = this;
|
87
|
-
var _a = this.props, wrapClassName = _a.wrapClassName, children = _a.children, bodyStyle = _a.bodyStyle, title = _a.title, otherProps = __rest(_a, ["wrapClassName", "children", "bodyStyle", "title"]);
|
88
|
-
return (React.createElement(antd_1.Modal, __assign({ wrapClassName: classnames_1.default(style_1.SDK_PREFIX + "-modal", wrapClassName), maskClosable: false, title: title }, otherProps),
|
88
|
+
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"]);
|
89
|
+
return (React.createElement(antd_1.Modal, __assign({ wrapClassName: classnames_1.default(style_1.SDK_PREFIX + "-modal", wrapClassName), maskClosable: false, title: title, closeIcon: React.createElement(CloseIcon_1.default, { onClick: onCancel }), onCancel: onCancel }, otherProps),
|
89
90
|
React.createElement("div", { ref: this.setContainerRef, style: bodyStyle },
|
90
91
|
React.createElement(config_provider_1.ConfigConsumer, null, function (config) { return (React.createElement(antd_1.ConfigProvider, __assign({}, config, { getPopupContainer: _this.childrenGetPopupContainer }), children)); }))));
|
91
92
|
};
|
@@ -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 {
|
@@ -9,7 +9,8 @@ var en_3 = require("./range_input/en");
|
|
9
9
|
var en_4 = require("./steps/en");
|
10
10
|
var en_5 = require("./table/en");
|
11
11
|
var en_6 = require("./transfer/en");
|
12
|
-
var en_7 =
|
12
|
+
var en_7 = require("./modal/en");
|
13
|
+
var en_8 = __importDefault(require("./upload/en"));
|
13
14
|
exports.component_en = {
|
14
15
|
check_transform_list: en_1.check_transform_list_en,
|
15
16
|
datetime: en_2.datetime_en,
|
@@ -17,5 +18,6 @@ exports.component_en = {
|
|
17
18
|
steps: en_4.steps_en,
|
18
19
|
table: en_5.table_en,
|
19
20
|
transfer: en_6.transfer_en,
|
20
|
-
upload:
|
21
|
+
upload: en_8.default,
|
22
|
+
modal: en_7.modal_en
|
21
23
|
};
|
@@ -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;
|
@@ -9,7 +9,8 @@ var zh_3 = require("./range_input/zh");
|
|
9
9
|
var zh_4 = require("./steps/zh");
|
10
10
|
var zh_5 = require("./table/zh");
|
11
11
|
var zh_6 = require("./transfer/zh");
|
12
|
-
var zh_7 =
|
12
|
+
var zh_7 = require("./modal/zh");
|
13
|
+
var zh_8 = __importDefault(require("./upload/zh"));
|
13
14
|
exports.component_zh = {
|
14
15
|
check_transform_list: zh_1.check_transform_list_zh,
|
15
16
|
datetime: zh_2.datetime_zh,
|
@@ -17,5 +18,6 @@ exports.component_zh = {
|
|
17
18
|
steps: zh_4.steps_zh,
|
18
19
|
table: zh_5.table_zh,
|
19
20
|
transfer: zh_6.transfer_zh,
|
20
|
-
upload:
|
21
|
+
upload: zh_8.default,
|
22
|
+
modal: zh_7.modal_zh
|
21
23
|
};
|
@@ -36,15 +36,20 @@ function modalPopupContainerWrapper(Comp) {
|
|
36
36
|
return function (props) {
|
37
37
|
var containerRef = react_1.useRef(null);
|
38
38
|
var titleRef = react_1.useRef(null);
|
39
|
-
var
|
39
|
+
var extraRef = react_1.useRef(null);
|
40
|
+
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"]);
|
40
41
|
var childrenGetPopupContainer = react_1.useCallback(function () {
|
41
42
|
return (containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) || document.body;
|
42
43
|
}, []);
|
43
44
|
var titleGetPopupContainer = react_1.useCallback(function () {
|
44
|
-
return (
|
45
|
+
return (titleRef === null || titleRef === void 0 ? void 0 : titleRef.current) || document.body;
|
46
|
+
}, []);
|
47
|
+
var extraGetPopupContainer = react_1.useCallback(function () {
|
48
|
+
return (extraRef === null || extraRef === void 0 ? void 0 : extraRef.current) || document.body;
|
45
49
|
}, []);
|
46
|
-
return (react_1.default.createElement(Comp, __assign({}, rest, { title: react_1.default.createElement("div", { ref: titleRef },
|
47
|
-
react_1.default.createElement(config_provider_1.ConfigConsumer, null, function (config) { return (react_1.default.createElement(config_provider_1.default, __assign({}, config, { getPopupContainer: titleGetPopupContainer }), title)); })) }
|
50
|
+
return (react_1.default.createElement(Comp, __assign({}, rest, { title: title ? (react_1.default.createElement("div", { ref: titleRef },
|
51
|
+
react_1.default.createElement(config_provider_1.ConfigConsumer, null, function (config) { return (react_1.default.createElement(config_provider_1.default, __assign({}, config, { getPopupContainer: titleGetPopupContainer }), title)); }))) : undefined, extra: extra ? (react_1.default.createElement("div", { ref: extraRef },
|
52
|
+
react_1.default.createElement(config_provider_1.ConfigConsumer, null, function (config) { return (react_1.default.createElement(config_provider_1.default, __assign({}, config, { getPopupContainer: extraGetPopupContainer }), extra)); }))) : undefined }),
|
48
53
|
react_1.default.createElement("div", { className: style_1.SDK_PREFIX + "-drawer-container", ref: containerRef, style: bodyStyle },
|
49
54
|
react_1.default.createElement(config_provider_1.ConfigConsumer, null, function (config) { return (react_1.default.createElement(config_provider_1.default, __assign({}, config, { getPopupContainer: childrenGetPopupContainer }), children)); }))));
|
50
55
|
};
|