hc-busin-components 1.0.2 → 1.0.4

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.
@@ -0,0 +1,307 @@
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 = ["footer", "showFooter", "onOk", "onClose", "okText", "cancelText", "resizable", "minWidth", "maxWidth", "width", "size", "placement", "rootClassName", "open", "styles", "classNames"];
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ 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; }
5
+ 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; }
6
+ 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; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
8
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
12
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
13
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
14
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
16
+ 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; }
17
+ import classNames from 'classnames';
18
+ import { Button, Drawer, Space } from 'antd';
19
+ import React, { useEffect, useMemo, useRef, useState } from 'react';
20
+ import "./index.less";
21
+ var DEFAULT_WIDTH = 378;
22
+ var DEFAULT_LARGE_WIDTH = 736;
23
+ var RESIZE_EDGE_WIDTH = 8;
24
+ var drawerId = 0;
25
+ function getDefaultWidth(size) {
26
+ return size === 'large' ? DEFAULT_LARGE_WIDTH : DEFAULT_WIDTH;
27
+ }
28
+ function getDefaultMaxWidth(minWidth) {
29
+ if (typeof window === 'undefined') {
30
+ return minWidth;
31
+ }
32
+ return Math.max(minWidth, window.innerWidth - 48);
33
+ }
34
+ function clampWidth(width, minWidth, maxWidth) {
35
+ return Math.min(Math.max(width, minWidth), Math.max(minWidth, maxWidth));
36
+ }
37
+ var HCDrawer = function HCDrawer(props) {
38
+ var footer = props.footer,
39
+ _props$showFooter = props.showFooter,
40
+ showFooter = _props$showFooter === void 0 ? true : _props$showFooter,
41
+ onOk = props.onOk,
42
+ onClose = props.onClose,
43
+ _props$okText = props.okText,
44
+ okText = _props$okText === void 0 ? '确认' : _props$okText,
45
+ _props$cancelText = props.cancelText,
46
+ cancelText = _props$cancelText === void 0 ? '取消' : _props$cancelText,
47
+ _props$resizable = props.resizable,
48
+ resizable = _props$resizable === void 0 ? false : _props$resizable,
49
+ _props$minWidth = props.minWidth,
50
+ minWidth = _props$minWidth === void 0 ? DEFAULT_WIDTH : _props$minWidth,
51
+ maxWidth = props.maxWidth,
52
+ width = props.width,
53
+ _props$size = props.size,
54
+ size = _props$size === void 0 ? 'default' : _props$size,
55
+ _props$placement = props.placement,
56
+ placement = _props$placement === void 0 ? 'right' : _props$placement,
57
+ rootClassName = props.rootClassName,
58
+ open = props.open,
59
+ styles = props.styles,
60
+ drawerClassNames = props.classNames,
61
+ restProps = _objectWithoutProperties(props, _excluded);
62
+ var supportsResize = resizable && (placement === 'left' || placement === 'right');
63
+ var resolvedMinWidth = Math.max(0, minWidth);
64
+ var resolvedMaxWidth = maxWidth === undefined ? getDefaultMaxWidth(resolvedMinWidth) : Math.max(resolvedMinWidth, maxWidth);
65
+ var hasCustomFooter = Object.prototype.hasOwnProperty.call(props, 'footer');
66
+ var instanceClassNameRef = useRef('');
67
+ var dragStateRef = useRef(null);
68
+ var innerWidthRef = useRef(null);
69
+ var _useState = useState(null),
70
+ _useState2 = _slicedToArray(_useState, 2),
71
+ innerWidth = _useState2[0],
72
+ setInnerWidth = _useState2[1];
73
+ var _useState3 = useState(false),
74
+ _useState4 = _slicedToArray(_useState3, 2),
75
+ okLoading = _useState4[0],
76
+ setOkLoading = _useState4[1];
77
+ var _useState5 = useState(false),
78
+ _useState6 = _slicedToArray(_useState5, 2),
79
+ edgeHovered = _useState6[0],
80
+ setEdgeHovered = _useState6[1];
81
+ var _useState7 = useState(false),
82
+ _useState8 = _slicedToArray(_useState7, 2),
83
+ isResizing = _useState8[0],
84
+ setIsResizing = _useState8[1];
85
+ var _useState9 = useState(false),
86
+ _useState10 = _slicedToArray(_useState9, 2),
87
+ footerDividerVisible = _useState10[0],
88
+ setFooterDividerVisible = _useState10[1];
89
+ if (!instanceClassNameRef.current) {
90
+ drawerId += 1;
91
+ instanceClassNameRef.current = "hc-drawer-instance-".concat(drawerId);
92
+ }
93
+ var syncInnerWidth = function syncInnerWidth() {
94
+ if (!supportsResize) {
95
+ setInnerWidth(null);
96
+ return;
97
+ }
98
+ if (typeof width === 'number') {
99
+ setInnerWidth(clampWidth(width, resolvedMinWidth, resolvedMaxWidth));
100
+ return;
101
+ }
102
+ if (width === undefined) {
103
+ setInnerWidth(clampWidth(getDefaultWidth(size), resolvedMinWidth, resolvedMaxWidth));
104
+ return;
105
+ }
106
+ setInnerWidth(null);
107
+ };
108
+ useEffect(function () {
109
+ innerWidthRef.current = innerWidth;
110
+ }, [innerWidth]);
111
+ useEffect(function () {
112
+ syncInnerWidth();
113
+ }, [width, size, supportsResize, resolvedMinWidth, resolvedMaxWidth]);
114
+ useEffect(function () {
115
+ if (!supportsResize || !open || typeof width !== 'string' || typeof document === 'undefined') {
116
+ return;
117
+ }
118
+ var frameId = window.requestAnimationFrame(function () {
119
+ var rootElement = document.querySelector(".".concat(instanceClassNameRef.current));
120
+ var contentElement = rootElement === null || rootElement === void 0 ? void 0 : rootElement.querySelector('.ant-drawer-content');
121
+ if (!contentElement) {
122
+ return;
123
+ }
124
+ var nextWidth = clampWidth(Math.round(contentElement.getBoundingClientRect().width), resolvedMinWidth, resolvedMaxWidth);
125
+ setInnerWidth(nextWidth);
126
+ });
127
+ return function () {
128
+ window.cancelAnimationFrame(frameId);
129
+ };
130
+ }, [width, open, resolvedMinWidth, resolvedMaxWidth, supportsResize]);
131
+ useEffect(function () {
132
+ if (!open || hasCustomFooter || !showFooter || typeof document === 'undefined') {
133
+ setFooterDividerVisible(false);
134
+ return;
135
+ }
136
+ var rootElement = document.querySelector(".".concat(instanceClassNameRef.current));
137
+ var bodyElement = rootElement === null || rootElement === void 0 ? void 0 : rootElement.querySelector('.ant-drawer-body');
138
+ if (!bodyElement) {
139
+ return;
140
+ }
141
+ var updateFooterDivider = function updateFooterDivider() {
142
+ setFooterDividerVisible(bodyElement.scrollHeight > bodyElement.clientHeight);
143
+ };
144
+ updateFooterDivider();
145
+ var resizeObserver = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(function () {
146
+ updateFooterDivider();
147
+ });
148
+ resizeObserver === null || resizeObserver === void 0 || resizeObserver.observe(bodyElement);
149
+ if (bodyElement.firstElementChild instanceof HTMLElement) {
150
+ resizeObserver === null || resizeObserver === void 0 || resizeObserver.observe(bodyElement.firstElementChild);
151
+ }
152
+ bodyElement.addEventListener('scroll', updateFooterDivider);
153
+ window.addEventListener('resize', updateFooterDivider);
154
+ return function () {
155
+ resizeObserver === null || resizeObserver === void 0 || resizeObserver.disconnect();
156
+ bodyElement.removeEventListener('scroll', updateFooterDivider);
157
+ window.removeEventListener('resize', updateFooterDivider);
158
+ };
159
+ }, [hasCustomFooter, open, showFooter, innerWidth]);
160
+ useEffect(function () {
161
+ if (!supportsResize || !open || typeof document === 'undefined') {
162
+ setEdgeHovered(false);
163
+ return;
164
+ }
165
+ var rootElement = document.querySelector(".".concat(instanceClassNameRef.current));
166
+ var contentElement = rootElement === null || rootElement === void 0 ? void 0 : rootElement.querySelector('.ant-drawer-content');
167
+ if (!contentElement) {
168
+ return;
169
+ }
170
+ var isInResizeEdge = function isInResizeEdge(clientX) {
171
+ var rect = contentElement.getBoundingClientRect();
172
+ if (placement === 'right') {
173
+ return clientX >= rect.left && clientX <= rect.left + RESIZE_EDGE_WIDTH;
174
+ }
175
+ return clientX <= rect.right && clientX >= rect.right - RESIZE_EDGE_WIDTH;
176
+ };
177
+ var handleMouseMove = function handleMouseMove(event) {
178
+ if (dragStateRef.current) {
179
+ return;
180
+ }
181
+ setEdgeHovered(isInResizeEdge(event.clientX));
182
+ };
183
+ var handleMouseLeave = function handleMouseLeave() {
184
+ if (!dragStateRef.current) {
185
+ setEdgeHovered(false);
186
+ }
187
+ };
188
+ var cleanupDraggingStyle = function cleanupDraggingStyle() {
189
+ document.body.style.userSelect = '';
190
+ document.body.style.cursor = '';
191
+ };
192
+ var handleMouseUp = function handleMouseUp() {
193
+ dragStateRef.current = null;
194
+ setIsResizing(false);
195
+ setEdgeHovered(false);
196
+ cleanupDraggingStyle();
197
+ window.removeEventListener('mousemove', handleWindowMouseMove);
198
+ window.removeEventListener('mouseup', handleMouseUp);
199
+ };
200
+ var handleWindowMouseMove = function handleWindowMouseMove(event) {
201
+ var dragState = dragStateRef.current;
202
+ if (!dragState) {
203
+ return;
204
+ }
205
+ var delta = event.clientX - dragState.startX;
206
+ var nextWidth = placement === 'right' ? dragState.startWidth - delta : dragState.startWidth + delta;
207
+ setInnerWidth(clampWidth(nextWidth, resolvedMinWidth, resolvedMaxWidth));
208
+ };
209
+ var handleMouseDown = function handleMouseDown(event) {
210
+ var _ref, _innerWidthRef$curren;
211
+ if (event.button !== 0 || !isInResizeEdge(event.clientX)) {
212
+ return;
213
+ }
214
+ var currentWidth = (_ref = (_innerWidthRef$curren = innerWidthRef.current) !== null && _innerWidthRef$curren !== void 0 ? _innerWidthRef$curren : Math.round(contentElement.getBoundingClientRect().width)) !== null && _ref !== void 0 ? _ref : getDefaultWidth(size);
215
+ dragStateRef.current = {
216
+ startX: event.clientX,
217
+ startWidth: currentWidth
218
+ };
219
+ document.body.style.userSelect = 'none';
220
+ document.body.style.cursor = 'col-resize';
221
+ setIsResizing(true);
222
+ setEdgeHovered(true);
223
+ window.addEventListener('mousemove', handleWindowMouseMove);
224
+ window.addEventListener('mouseup', handleMouseUp);
225
+ event.preventDefault();
226
+ };
227
+ contentElement.addEventListener('mousemove', handleMouseMove);
228
+ contentElement.addEventListener('mouseleave', handleMouseLeave);
229
+ contentElement.addEventListener('mousedown', handleMouseDown);
230
+ return function () {
231
+ contentElement.removeEventListener('mousemove', handleMouseMove);
232
+ contentElement.removeEventListener('mouseleave', handleMouseLeave);
233
+ contentElement.removeEventListener('mousedown', handleMouseDown);
234
+ cleanupDraggingStyle();
235
+ window.removeEventListener('mousemove', handleWindowMouseMove);
236
+ window.removeEventListener('mouseup', handleMouseUp);
237
+ dragStateRef.current = null;
238
+ setIsResizing(false);
239
+ };
240
+ }, [open, resolvedMinWidth, placement, resolvedMaxWidth, size, supportsResize]);
241
+ var mergedFooter = useMemo(function () {
242
+ if (hasCustomFooter) {
243
+ return footer;
244
+ }
245
+ if (!showFooter) {
246
+ return null;
247
+ }
248
+ return /*#__PURE__*/React.createElement("div", {
249
+ className: classNames('hc-drawer-footer', {
250
+ 'hc-drawer-footer-divider': footerDividerVisible
251
+ })
252
+ }, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Button, {
253
+ onClick: function onClick(event) {
254
+ return onClose === null || onClose === void 0 ? void 0 : onClose(event);
255
+ }
256
+ }, cancelText), /*#__PURE__*/React.createElement(Button, {
257
+ type: "primary",
258
+ loading: okLoading,
259
+ onClick: function onClick() {
260
+ if (!onOk) {
261
+ return;
262
+ }
263
+ var result = onOk();
264
+ if (result && typeof result.then === 'function') {
265
+ setOkLoading(true);
266
+ void result.catch(function () {
267
+ return undefined;
268
+ }).finally(function () {
269
+ setOkLoading(false);
270
+ });
271
+ }
272
+ }
273
+ }, okText)));
274
+ }, [cancelText, footer, footerDividerVisible, hasCustomFooter, okLoading, okText, onClose, onOk, showFooter]);
275
+ var mergedRootClassName = classNames('hc-drawer', instanceClassNameRef.current, {
276
+ 'hc-drawer-resizable': supportsResize,
277
+ 'hc-drawer-resize-hover': supportsResize && edgeHovered,
278
+ 'hc-drawer-resizing': supportsResize && isResizing,
279
+ 'hc-drawer-resizable-left': supportsResize && placement === 'left',
280
+ 'hc-drawer-resizable-right': supportsResize && placement === 'right',
281
+ 'hc-drawer-footer-divider-visible': footerDividerVisible && !hasCustomFooter && showFooter
282
+ }, rootClassName);
283
+ var mergedWidth = supportsResize ? innerWidth !== null && innerWidth !== void 0 ? innerWidth : width : width;
284
+ var mergedStyles = useMemo(function () {
285
+ if (!supportsResize) {
286
+ return styles;
287
+ }
288
+ return _objectSpread(_objectSpread({}, styles), {}, {
289
+ wrapper: _objectSpread(_objectSpread({}, styles === null || styles === void 0 ? void 0 : styles.wrapper), {}, {
290
+ minWidth: resolvedMinWidth,
291
+ maxWidth: resolvedMaxWidth
292
+ })
293
+ });
294
+ }, [resolvedMaxWidth, resolvedMinWidth, styles, supportsResize]);
295
+ return /*#__PURE__*/React.createElement(Drawer, _extends({}, restProps, {
296
+ open: open,
297
+ onClose: onClose,
298
+ placement: placement,
299
+ size: size,
300
+ width: mergedWidth,
301
+ footer: mergedFooter,
302
+ rootClassName: mergedRootClassName,
303
+ classNames: drawerClassNames,
304
+ styles: mergedStyles
305
+ }));
306
+ };
307
+ export default HCDrawer;
@@ -0,0 +1,30 @@
1
+ :root {
2
+ .hc-drawer-footer {
3
+ display: flex;
4
+ justify-content: flex-end;
5
+ width: 100%;
6
+ border-top: 0;
7
+ }
8
+
9
+ .hc-drawer .ant-drawer-footer {
10
+ border-top: 0;
11
+ }
12
+
13
+ .hc-drawer-footer-divider-visible .ant-drawer-footer {
14
+ border-top: 1px solid #f0f0f0;
15
+ }
16
+
17
+ .hc-drawer-resizable-right .ant-drawer-content,
18
+ .hc-drawer-resizable-left .ant-drawer-content {
19
+ position: relative;
20
+ }
21
+
22
+ .hc-drawer-resize-hover.hc-drawer-resizable-right .ant-drawer-content,
23
+ .hc-drawer-resize-hover.hc-drawer-resizable-left .ant-drawer-content {
24
+ cursor: col-resize;
25
+ }
26
+
27
+ .hc-drawer-resizing .ant-drawer-content-wrapper {
28
+ transition: none;
29
+ }
30
+ }
@@ -0,0 +1,9 @@
1
+ import { Modal } from 'antd';
2
+ import type { ModalProps } from 'antd';
3
+ import React from 'react';
4
+ import './index.less';
5
+ export interface HCModalProps extends ModalProps {
6
+ }
7
+ type HCModalType = React.FC<HCModalProps> & Pick<typeof Modal, 'useModal' | 'destroyAll' | 'config' | 'info' | 'success' | 'error' | 'warning' | 'warn' | 'confirm' | '_InternalPanelDoNotUseOrYouWillBeFired'>;
8
+ declare const HCModal: HCModalType;
9
+ export default HCModal;
@@ -0,0 +1,50 @@
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 = ["rootClassName"];
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
+ 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
+ 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; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
9
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
+ 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; }
11
+ import classNames from 'classnames';
12
+ import { Modal } from 'antd';
13
+ import React from 'react';
14
+ import "./index.less";
15
+ var HCModalBase = function HCModalBase(_ref) {
16
+ var rootClassName = _ref.rootClassName,
17
+ restProps = _objectWithoutProperties(_ref, _excluded);
18
+ return /*#__PURE__*/React.createElement(Modal, _extends({}, restProps, {
19
+ rootClassName: classNames('hc-modal', rootClassName)
20
+ }));
21
+ };
22
+ var withStaticClassName = function withStaticClassName(config) {
23
+ return _objectSpread(_objectSpread({}, config), {}, {
24
+ className: classNames('hc-modal', config.className)
25
+ });
26
+ };
27
+ var HCModal = HCModalBase;
28
+ HCModal.useModal = Modal.useModal;
29
+ HCModal.destroyAll = Modal.destroyAll;
30
+ HCModal.config = Modal.config;
31
+ HCModal.info = function (config) {
32
+ return Modal.info(withStaticClassName(config));
33
+ };
34
+ HCModal.success = function (config) {
35
+ return Modal.success(withStaticClassName(config));
36
+ };
37
+ HCModal.error = function (config) {
38
+ return Modal.error(withStaticClassName(config));
39
+ };
40
+ HCModal.warning = function (config) {
41
+ return Modal.warning(withStaticClassName(config));
42
+ };
43
+ HCModal.warn = function (config) {
44
+ return Modal.warn(withStaticClassName(config));
45
+ };
46
+ HCModal.confirm = function (config) {
47
+ return Modal.confirm(withStaticClassName(config));
48
+ };
49
+ HCModal._InternalPanelDoNotUseOrYouWillBeFired = Modal._InternalPanelDoNotUseOrYouWillBeFired;
50
+ export default HCModal;
@@ -0,0 +1,29 @@
1
+ :root {
2
+ .hc-modal {
3
+ .ant-modal-content {
4
+ padding: 0;
5
+ overflow: hidden;
6
+ border-radius: 4px;
7
+ }
8
+
9
+ .ant-modal-header {
10
+ margin-bottom: 0;
11
+ padding: 16px 24px;
12
+ background: #fff;
13
+ border-bottom: 1px solid #f0f0f0;
14
+ border-radius: 4px 4px 0 0;
15
+ }
16
+
17
+ .ant-modal-body {
18
+ padding: 24px;
19
+ }
20
+
21
+ .ant-modal-footer {
22
+ margin-top: 0;
23
+ padding: 10px 16px;
24
+ background: #fff;
25
+ border-top: 1px solid #f0f0f0;
26
+ border-radius: 0 0 4px 4px;
27
+ }
28
+ }
29
+ }
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@ export type { ResourceProgressProps } from './ResourceProgress';
10
10
  export { default as ShowMore } from './showMore';
11
11
  export { default as BasicFilesRead } from './BasicFilesRead';
12
12
  export { default as DateRangePicker } from './DateRangePicker';
13
- export type { DateRangePickerProps, QuickTimeOption, TimeRangeInfo, } from './DateRangePicker';
13
+ export type { DateRangePickerLocale, DateRangePickerProps, DateRangePickerValue, QuickTimeOption, TimeRangeInfo, } from './DateRangePicker';
14
14
  export { Actions, LinkButton } from './Actions';
15
15
  export type { ActionElementProps, ActionsProps, LinkButtonProps, } from './Actions';
16
16
  export { default as TextCopy } from './TextCopy';
@@ -30,6 +30,10 @@ export { default as Yaml } from './Yaml';
30
30
  export type { YamlProps, YamlTexts, YamlValidateResult } from './Yaml';
31
31
  export { default as PageHeader } from './PageHeader';
32
32
  export type { PageHeaderProps } from './PageHeader';
33
+ export { default as HCModal } from './HCModal';
34
+ export type { HCModalProps } from './HCModal';
35
+ export { default as HCDrawer } from './HCDrawer';
36
+ export type { HCDrawerProps } from './HCDrawer';
33
37
  export { default as MetadataForm } from './MetadataForm';
34
38
  export type { MetadataFormProps, MetadataFormRef } from './MetadataForm';
35
39
  export { default as MetadataTags } from './MetadataTags';
package/dist/index.js CHANGED
@@ -19,6 +19,8 @@ export { logCenterLocaleZhCN, LOG_CENTER_API, createLogCenterServices } from "./
19
19
  export { default as Terminal } from "./Terminal";
20
20
  export { default as Yaml } from "./Yaml";
21
21
  export { default as PageHeader } from "./PageHeader";
22
+ export { default as HCModal } from "./HCModal";
23
+ export { default as HCDrawer } from "./HCDrawer";
22
24
  export { default as MetadataForm } from "./MetadataForm";
23
25
  export { default as MetadataTags } from "./MetadataTags";
24
26
  export { default as MetadataCount } from "./MetadataCount";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hc-busin-components",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",