@qn-pandora/pandora-component 4.0.13 → 4.0.14

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.
Files changed (59) hide show
  1. package/CHANGELOG.json +323 -323
  2. package/CHANGELOG.md +123 -123
  3. package/es/components/Descriptions/index.d.ts +13 -0
  4. package/es/components/Descriptions/index.js +57 -0
  5. package/es/components/Descriptions/style.css +337 -0
  6. package/es/components/Descriptions/style.less +15 -0
  7. package/es/components/Drawer/CloseIcon/index.d.ts +7 -0
  8. package/es/components/Drawer/CloseIcon/index.js +13 -0
  9. package/es/components/Drawer/CloseIcon/style.css +12 -0
  10. package/es/components/Drawer/CloseIcon/style.less +8 -0
  11. package/es/components/Drawer/index.d.ts +4 -1
  12. package/es/components/Drawer/index.js +36 -8
  13. package/es/components/Drawer/style.css +11 -3
  14. package/es/components/Drawer/style.less +12 -3
  15. package/es/components/Modal/index.js +3 -2
  16. package/es/constants/language/en.js +3 -1
  17. package/es/constants/language/modal/en.d.ts +2 -0
  18. package/es/constants/language/modal/en.js +3 -0
  19. package/es/constants/language/modal/type.d.ts +4 -0
  20. package/es/constants/language/modal/type.js +3 -0
  21. package/es/constants/language/modal/zh.d.ts +2 -0
  22. package/es/constants/language/modal/zh.js +3 -0
  23. package/es/constants/language/type.d.ts +2 -0
  24. package/es/constants/language/zh.js +3 -1
  25. package/es/hoc/modalPopupContainer.js +2 -2
  26. package/es/index.css +8158 -8135
  27. package/es/index.d.ts +1 -0
  28. package/es/index.js +1 -0
  29. package/es/index.less +18 -16
  30. package/es/style/theme.less +4 -0
  31. package/lib/components/Descriptions/index.d.ts +13 -0
  32. package/lib/components/Descriptions/index.js +69 -0
  33. package/lib/components/Descriptions/style.css +337 -0
  34. package/lib/components/Descriptions/style.less +15 -0
  35. package/lib/components/Drawer/CloseIcon/index.d.ts +7 -0
  36. package/lib/components/Drawer/CloseIcon/index.js +18 -0
  37. package/lib/components/Drawer/CloseIcon/style.css +12 -0
  38. package/lib/components/Drawer/CloseIcon/style.less +8 -0
  39. package/lib/components/Drawer/index.d.ts +4 -1
  40. package/lib/components/Drawer/index.js +36 -8
  41. package/lib/components/Drawer/style.css +11 -3
  42. package/lib/components/Drawer/style.less +12 -3
  43. package/lib/components/Modal/index.js +3 -2
  44. package/lib/constants/language/en.js +4 -2
  45. package/lib/constants/language/modal/en.d.ts +2 -0
  46. package/lib/constants/language/modal/en.js +5 -0
  47. package/lib/constants/language/modal/type.d.ts +4 -0
  48. package/lib/constants/language/modal/type.js +5 -0
  49. package/lib/constants/language/modal/zh.d.ts +2 -0
  50. package/lib/constants/language/modal/zh.js +5 -0
  51. package/lib/constants/language/type.d.ts +2 -0
  52. package/lib/constants/language/zh.js +4 -2
  53. package/lib/hoc/modalPopupContainer.js +2 -2
  54. package/lib/index.css +12774 -12751
  55. package/lib/index.d.ts +1 -0
  56. package/lib/index.js +2 -0
  57. package/lib/index.less +21 -19
  58. package/lib/style/theme.less +4 -0
  59. package/package.json +3 -3
@@ -0,0 +1,8 @@
1
+ @import '../../../style/theme.less';
2
+
3
+ .@{sdk-prefix}-close-icon {
4
+ font-size: 20px;
5
+ &:hover {
6
+ background: @close-icon-hover-color;
7
+ }
8
+ }
@@ -62,6 +62,7 @@ export declare type IDrawerProps = Overwrite<DrawerProps, {
62
62
  * 无遮罩时点击空白处中的哪些元素不关闭
63
63
  */
64
64
  nonCloseSelector?: string;
65
+ size?: 'small' | 'default' | 'large';
65
66
  }>;
66
67
  export declare class Drawer extends React.Component<React.PropsWithChildren<IDrawerProps>, any> {
67
68
  drawerId: string;
@@ -76,6 +77,7 @@ export declare class Drawer extends React.Component<React.PropsWithChildren<IDra
76
77
  onMouseUp(): void;
77
78
  onMouseMove(e: any): void;
78
79
  onMouseClick(e: MouseEvent): void;
80
+ initWidth(width?: string | number, size?: string): string | number | undefined;
79
81
  componentDidMount(): void;
80
82
  UNSAFE_componentWillUpdate(nextProps: Readonly<React.PropsWithChildren<IDrawerProps>>): void;
81
83
  componentWillUnmount(): void;
@@ -139,7 +141,8 @@ declare const _default: (props: {
139
141
  * 无遮罩时点击空白处中的哪些元素不关闭
140
142
  */
141
143
  nonCloseSelector?: string | undefined;
142
- } & Pick<DrawerProps, "style" | "autoFocus" | "size" | "prefixCls" | "footer" | "extra" | "bodyStyle" | "forceRender" | "keyboard" | "destroyOnClose" | "closeIcon" | "drawerStyle" | "headerStyle" | "contentWrapperStyle" | "push" | "handler" | "footerStyle" | "level" | "levelMove"> & {
144
+ size?: "small" | "default" | "large" | undefined;
145
+ } & Pick<DrawerProps, "style" | "autoFocus" | "prefixCls" | "footer" | "extra" | "bodyStyle" | "forceRender" | "keyboard" | "destroyOnClose" | "closeIcon" | "drawerStyle" | "headerStyle" | "contentWrapperStyle" | "push" | "handler" | "footerStyle" | "level" | "levelMove"> & {
143
146
  children?: React.ReactNode;
144
147
  } & {
145
148
  bodyStyle?: React.CSSProperties | undefined;
@@ -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,7 +64,7 @@ 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
  }
@@ -79,10 +82,11 @@ var Drawer = /** @class */ (function (_super) {
79
82
  });
80
83
  Object.defineProperty(Drawer.prototype, "extra", {
81
84
  get: function () {
82
- if (this.props.closable && this.props.closeIconPlacement === 'right') {
85
+ var _a = this.props, closable = _a.closable, closeIconPlacement = _a.closeIconPlacement, onClose = _a.onClose;
86
+ if (closable && closeIconPlacement === 'right') {
83
87
  return (React.createElement(React.Fragment, null,
84
88
  this.props.extra,
85
- React.createElement(CloseOutlined, { onClick: this.props.onClose, className: SDK_PREFIX + "-drawer-right-close-icon" })));
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 && offsetRight < MAX_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,18 @@ 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 === 'default')
151
+ return DEFAULT_WIDTH;
152
+ if (size && size === 'large')
153
+ return LARGE_WIDTH;
154
+ return undefined;
155
+ };
137
156
  Drawer.prototype.componentDidMount = function () {
138
157
  if (this.props.canDrag) {
139
158
  document.addEventListener('mousemove', this.throttleMouseMove);
@@ -154,10 +173,13 @@ var Drawer = /** @class */ (function (_super) {
154
173
  };
155
174
  Drawer.prototype.render = function () {
156
175
  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"]);
176
+ 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
177
  return (React.createElement(BaseDrawer, __assign({ className: classnames(this.drawerId, SDK_PREFIX + "-drawer", className, (_a = {},
159
178
  _a[SDK_PREFIX + "-drawer-no-mask"] = this.props.mask === false,
160
- _a)), width: this.realWidth || 'auto', zIndex: 1200, visible: visible, closable: this.closable, extra: this.extra }, other),
179
+ _a[SDK_PREFIX + "-drawer-size-small"] = size === 'small',
180
+ _a[SDK_PREFIX + "-drawer-size-default"] = size === 'default',
181
+ _a[SDK_PREFIX + "-drawer-size-large"] = size === 'large',
182
+ _a)), width: this.realWidth || 'auto', 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
183
  canDrag && (React.createElement("div", { className: SDK_PREFIX + "-scroll-handler", onMouseDown: this.onMouseDown })),
162
184
  children));
163
185
  };
@@ -217,6 +239,12 @@ var Drawer = /** @class */ (function (_super) {
217
239
  __metadata("design:paramtypes", [MouseEvent]),
218
240
  __metadata("design:returntype", void 0)
219
241
  ], Drawer.prototype, "onMouseClick", null);
242
+ __decorate([
243
+ bind,
244
+ __metadata("design:type", Function),
245
+ __metadata("design:paramtypes", [Object, String]),
246
+ __metadata("design:returntype", void 0)
247
+ ], Drawer.prototype, "initWidth", null);
220
248
  Drawer = __decorate([
221
249
  observer
222
250
  ], 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-right-close-icon {
286
- margin-left: 8px;
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-right-close-icon {
37
- margin-left: 8px;
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
  };
@@ -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
  };
@@ -0,0 +1,2 @@
1
+ import { IModalLocale } from './type';
2
+ export declare const modal_en: IModalLocale;
@@ -0,0 +1,3 @@
1
+ export var modal_en = {
2
+ close_tooltip: 'close modal'
3
+ };
@@ -0,0 +1,4 @@
1
+ export interface IModalLocale {
2
+ close_tooltip: string;
3
+ }
4
+ export declare const ModalLocale: IModalLocale;
@@ -0,0 +1,3 @@
1
+ import { languageLocale } from '../../../utils/languageLocale';
2
+ import { modal_zh } from './zh';
3
+ export var ModalLocale = languageLocale('modal.', modal_zh);
@@ -0,0 +1,2 @@
1
+ import { IModalLocale } from './type';
2
+ export declare const modal_zh: IModalLocale;
@@ -0,0 +1,3 @@
1
+ export var modal_zh = {
2
+ close_tooltip: '关闭弹窗'
3
+ };
@@ -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
  };
@@ -34,8 +34,8 @@ export default function modalPopupContainerWrapper(Comp) {
34
34
  var titleGetPopupContainer = useCallback(function () {
35
35
  return (containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) || document.body;
36
36
  }, []);
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)); })) }),
37
+ return (React.createElement(Comp, __assign({}, rest, { title: title ? (React.createElement("div", { ref: titleRef },
38
+ React.createElement(ConfigConsumer, null, function (config) { return (React.createElement(ConfigProvider, __assign({}, config, { getPopupContainer: titleGetPopupContainer }), title)); }))) : undefined }),
39
39
  React.createElement("div", { className: SDK_PREFIX + "-drawer-container", ref: containerRef, style: bodyStyle },
40
40
  React.createElement(ConfigConsumer, null, function (config) { return (React.createElement(ConfigProvider, __assign({}, config, { getPopupContainer: childrenGetPopupContainer }), children)); }))));
41
41
  };