@arim-aisdc/public-components 2.3.1-8.1 → 2.3.1-9.2
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["open", "title", "okText", "hasfooter", "footer", "width", "size", "renderContent", "handleConfirm", "handleCancel", "confirmLoading", "maskClosable", "bodyStyle", "afterClose", "enableResizing", "enableDragging", "minResizeWidth", "minResizeHeight"];
|
|
2
|
+
var _excluded = ["open", "title", "okText", "hasfooter", "footer", "width", "size", "renderContent", "handleConfirm", "handleCancel", "confirmLoading", "maskClosable", "bodyStyle", "afterClose", "enableResizing", "enableDragging", "minResizeWidth", "minResizeHeight", "maxResizeWidth", "maxResizeHeight"];
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -55,6 +55,8 @@ var CenterModal = function CenterModal(_ref) {
|
|
|
55
55
|
minResizeWidth = _ref$minResizeWidth === void 0 ? 200 : _ref$minResizeWidth,
|
|
56
56
|
_ref$minResizeHeight = _ref.minResizeHeight,
|
|
57
57
|
minResizeHeight = _ref$minResizeHeight === void 0 ? 200 : _ref$minResizeHeight,
|
|
58
|
+
maxResizeWidth = _ref.maxResizeWidth,
|
|
59
|
+
maxResizeHeight = _ref.maxResizeHeight,
|
|
58
60
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
59
61
|
var modalRef = useRef(null);
|
|
60
62
|
var modalBodyRef = useRef(null);
|
|
@@ -81,6 +83,21 @@ var CenterModal = function CenterModal(_ref) {
|
|
|
81
83
|
};
|
|
82
84
|
}
|
|
83
85
|
}, [modalBodyRef.current]);
|
|
86
|
+
var adjustResize = function adjustResize(e, direction, ref, delta, position) {
|
|
87
|
+
var _ref$querySelector, _ref$style$height, _ref$style$width;
|
|
88
|
+
var modalContent = (_ref$querySelector = ref.querySelector('.ant-modal-content')) === null || _ref$querySelector === void 0 ? void 0 : _ref$querySelector.getBoundingClientRect();
|
|
89
|
+
var modalContentHeight = Math.ceil(modalContent.height);
|
|
90
|
+
var modalContentWidth = Math.ceil(modalContent.width);
|
|
91
|
+
console.log(ref.style.height, modalContentHeight, 'onResize');
|
|
92
|
+
var refHeight = Number((_ref$style$height = ref.style.height) === null || _ref$style$height === void 0 || (_ref$style$height = _ref$style$height.split('px')) === null || _ref$style$height === void 0 ? void 0 : _ref$style$height[0]);
|
|
93
|
+
var refWidth = Number((_ref$style$width = ref.style.width) === null || _ref$style$width === void 0 || (_ref$style$width = _ref$style$width.split('px')) === null || _ref$style$width === void 0 ? void 0 : _ref$style$width[0]);
|
|
94
|
+
if ((direction === 'left' || direction === 'right') && modalContentHeight !== refHeight) {
|
|
95
|
+
ref.style.height = modalContentHeight + 'px';
|
|
96
|
+
}
|
|
97
|
+
if ((direction === 'top' || direction === 'bottom') && modalContentWidth !== refWidth) {
|
|
98
|
+
ref.style.width = modalContentWidth + 'px';
|
|
99
|
+
}
|
|
100
|
+
};
|
|
84
101
|
return /*#__PURE__*/_jsx(Modal, _objectSpread(_objectSpread({
|
|
85
102
|
className: "centerModal".concat(size),
|
|
86
103
|
wrapClassName: 'wrapClassName',
|
|
@@ -126,22 +143,18 @@ var CenterModal = function CenterModal(_ref) {
|
|
|
126
143
|
width: 'fit-content',
|
|
127
144
|
height: 'fit-content'
|
|
128
145
|
},
|
|
129
|
-
onResizeStop:
|
|
130
|
-
|
|
131
|
-
var modalContent = (_ref$querySelector = ref.querySelector('.ant-modal-content')) === null || _ref$querySelector === void 0 ? void 0 : _ref$querySelector.getBoundingClientRect();
|
|
132
|
-
var resizeContent = ref === null || ref === void 0 ? void 0 : ref.getBoundingClientRect();
|
|
133
|
-
var height = modalContent.height;
|
|
134
|
-
if (modalContent.height !== resizeContent.height) {
|
|
135
|
-
ref.style.height = height + "px";
|
|
136
|
-
}
|
|
137
|
-
},
|
|
146
|
+
onResizeStop: adjustResize,
|
|
147
|
+
onResize: adjustResize,
|
|
138
148
|
style: {
|
|
139
149
|
display: 'flex',
|
|
140
150
|
flexDirection: 'column',
|
|
141
151
|
overflow: 'hidden' // 添加overflow隐藏
|
|
142
152
|
},
|
|
143
153
|
minWidth: minResizeWidth,
|
|
144
|
-
minHeight: minResizeHeight
|
|
154
|
+
minHeight: minResizeHeight
|
|
155
|
+
// maxWidth={maxResizeWidth}
|
|
156
|
+
// maxHeight={maxResizeHeight}
|
|
157
|
+
,
|
|
145
158
|
children: modal
|
|
146
159
|
});
|
|
147
160
|
}
|
|
@@ -25,6 +25,8 @@ export interface CenterModalPropsType extends ModalProps {
|
|
|
25
25
|
enableDragging?: boolean;
|
|
26
26
|
minResizeWidth?: string | number;
|
|
27
27
|
minResizeHeight?: string | number;
|
|
28
|
+
maxResizeWidth?: string | number;
|
|
29
|
+
maxResizeHeight?: string | number;
|
|
28
30
|
}
|
|
29
31
|
export type ModalSizeType = {
|
|
30
32
|
width: number | string;
|