@kep-platform/basic-component 0.3.3 → 0.5.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/dist/Columns/Columns.d.ts +1 -1
- package/dist/PopupBox/PopupBox.js +16 -12
- package/package.json +3 -3
@@ -15,7 +15,7 @@ export declare const Column: import("styled-components/dist/types").IStyledCompo
|
|
15
15
|
title?: React.ReactNode;
|
16
16
|
index?: number | undefined;
|
17
17
|
itemRender?: import("../@types/type").ListItemRender | undefined;
|
18
|
-
} & Omit<React.HtmlHTMLAttributes<HTMLLIElement>, "title">, Omit<ColumnType, "
|
18
|
+
} & Omit<React.HtmlHTMLAttributes<HTMLLIElement>, "title">, Omit<ColumnType, "render" | "dataIndex"> & {
|
19
19
|
key: React.Key;
|
20
20
|
title?: React.ReactNode;
|
21
21
|
index?: number | undefined;
|
@@ -8,22 +8,15 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
8
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
9
9
|
import { useClickOutsize } from '@kep-platform/hooks';
|
10
10
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
11
|
-
import ReactDOM from 'react-dom';
|
12
11
|
import styled, { css } from 'styled-components';
|
12
|
+
import ReactDOM from 'react-dom';
|
13
13
|
var PopupBox = styled('div').withConfig({
|
14
14
|
shouldForwardProp: function shouldForwardProp(prop) {
|
15
15
|
return !['left', 'right', 'top', 'bottom', 'visible'].includes(prop);
|
16
16
|
}
|
17
|
-
})(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n
|
18
|
-
if (props.visible) return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n
|
17
|
+
})(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background-color: var(--kep-platform-color-bg-base);\n padding: var(--kep-platform-padding-xs);\n border-radius: var(--kep-platform-border-radius-sm);\n position: fixed;\n box-shadow: var(--kep-platform-box-shadow);\n z-index: 999;\n ", ";\n"])), function (props) {
|
18
|
+
if (props.visible) return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n left: ", "px;\n top: ", "px;\n "])), props.left || -999, props.top || -999);else return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n left: -9999px;\n top: -9999px;\n "])));
|
19
19
|
});
|
20
|
-
var popupContainerId = 'popupContainer';
|
21
|
-
var popupContainer = document.getElementById(popupContainerId);
|
22
|
-
if (!popupContainer) {
|
23
|
-
popupContainer = document.createElement('div');
|
24
|
-
popupContainer.id = popupContainerId;
|
25
|
-
document.body.appendChild(popupContainer);
|
26
|
-
}
|
27
20
|
export function Popup(props) {
|
28
21
|
var children = props.children,
|
29
22
|
_props$trigger = props.trigger,
|
@@ -49,6 +42,17 @@ export function Popup(props) {
|
|
49
42
|
ref: triggerController
|
50
43
|
};
|
51
44
|
}, []);
|
45
|
+
|
46
|
+
// useEffect(() => {
|
47
|
+
// const popupContainerId = 'popupContainer';
|
48
|
+
// let popupContainer = document.getElementById(popupContainerId);
|
49
|
+
// if (!popupContainer) {
|
50
|
+
// popupContainer = document.createElement('div');
|
51
|
+
// popupContainer.id = popupContainerId;
|
52
|
+
// document.body.appendChild(popupContainer);
|
53
|
+
// }
|
54
|
+
// }, []);
|
55
|
+
|
52
56
|
var showPopupMenu = useCallback(function (e) {
|
53
57
|
e.preventDefault();
|
54
58
|
var _ref = e,
|
@@ -78,12 +82,12 @@ export function Popup(props) {
|
|
78
82
|
if (typeof outerVisible === 'boolean') setVisible(outerVisible);
|
79
83
|
}, [outerVisible]);
|
80
84
|
if ( /*#__PURE__*/React.isValidElement(children)) {
|
81
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
85
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, window.document.body && /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(PopupBox, {
|
82
86
|
left: pos.left,
|
83
87
|
top: pos.top,
|
84
88
|
visible: visible,
|
85
89
|
ref: popupBox
|
86
|
-
}, content),
|
90
|
+
}, content), window.document.body), /*#__PURE__*/React.cloneElement(children, mergeProps));
|
87
91
|
} else {
|
88
92
|
return children;
|
89
93
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@kep-platform/basic-component",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.5.0",
|
4
4
|
"description": "A react library developed with dumi",
|
5
5
|
"license": "MIT",
|
6
6
|
"module": "dist/index.js",
|
@@ -47,7 +47,7 @@
|
|
47
47
|
},
|
48
48
|
"dependencies": {
|
49
49
|
"@ant-design/icons": "^5.3.7",
|
50
|
-
"@kep-platform/hooks": "^0.
|
50
|
+
"@kep-platform/hooks": "^0.5.0",
|
51
51
|
"color": "^4.2.3",
|
52
52
|
"rc-pagination": "^4.1.0"
|
53
53
|
},
|
@@ -87,5 +87,5 @@
|
|
87
87
|
"authors": [
|
88
88
|
"less-step-jss 1599925910@qq.com"
|
89
89
|
],
|
90
|
-
"gitHead": "
|
90
|
+
"gitHead": "195f0a61ad41fc052a3d273cc678ff92cab57c19"
|
91
91
|
}
|