@kep-platform/basic-component 0.0.2 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/@types/index.d.ts +61 -0
- package/dist/@types/styled-components.d.ts +9 -0
- package/dist/@types/theme.d.ts +38 -0
- package/dist/BoxShadowBox/BoxShadowBox.d.ts +8 -0
- package/dist/BoxShadowBox/BoxShadowBox.js +14 -0
- package/dist/BoxShadowBox/index.d.ts +1 -0
- package/dist/BoxShadowBox/index.js +1 -0
- package/dist/Button/Button.d.ts +12 -0
- package/dist/Button/Button.js +86 -0
- package/dist/Button/index.d.ts +1 -0
- package/dist/Button/index.js +1 -0
- package/dist/Columns/Columns.d.ts +24 -0
- package/dist/Columns/Columns.js +126 -0
- package/dist/Columns/index.d.ts +1 -0
- package/dist/Columns/index.js +1 -0
- package/dist/Flex/flex.d.ts +14 -0
- package/dist/Flex/flex.js +29 -0
- package/dist/Flex/index.d.ts +1 -0
- package/dist/Flex/index.js +1 -0
- package/dist/Grid/Col.d.ts +8 -0
- package/dist/Grid/Col.js +12 -0
- package/dist/Grid/Row.d.ts +6 -0
- package/dist/Grid/Row.js +55 -0
- package/dist/Grid/index.d.ts +2 -0
- package/dist/Grid/index.js +2 -0
- package/dist/Indent/Indent.d.ts +7 -0
- package/dist/Indent/Indent.js +25 -0
- package/dist/Indent/index.d.ts +1 -0
- package/dist/Indent/index.js +1 -0
- package/dist/List/List.d.ts +19 -0
- package/dist/List/List.js +41 -0
- package/dist/List/index.d.ts +1 -0
- package/dist/List/index.js +1 -0
- package/dist/Menu/Menu.d.ts +14 -0
- package/dist/Menu/Menu.js +107 -0
- package/dist/Menu/index.d.ts +3 -0
- package/dist/Menu/index.js +2 -0
- package/dist/Pagination/Pagination.d.ts +7 -0
- package/dist/Pagination/Pagination.js +44 -0
- package/dist/Pagination/index.d.ts +1 -0
- package/dist/Pagination/index.js +1 -0
- package/dist/PopupBox/PopupBox.d.ts +12 -0
- package/dist/PopupBox/PopupBox.js +12 -0
- package/dist/PopupBox/index.d.ts +1 -0
- package/dist/PopupBox/index.js +1 -0
- package/dist/Select/Select.d.ts +13 -0
- package/dist/Select/Select.js +121 -0
- package/dist/Select/index.d.ts +1 -0
- package/dist/Select/index.js +1 -0
- package/dist/Space/Space.d.ts +11 -0
- package/dist/Space/Space.js +39 -0
- package/dist/Space/index.d.ts +1 -0
- package/dist/Space/index.js +1 -0
- package/dist/Spin/Spin.d.ts +6 -0
- package/dist/Spin/Spin.js +16 -0
- package/dist/Spin/index.d.ts +1 -0
- package/dist/Spin/index.js +1 -0
- package/dist/Table/Table.d.ts +17 -0
- package/dist/Table/Table.js +243 -0
- package/dist/Table/index.d.ts +1 -0
- package/dist/Table/index.js +1 -0
- package/dist/Tag/Tag.d.ts +7 -0
- package/dist/Tag/Tag.js +16 -0
- package/dist/Tree/BOMTree.d.ts +3 -0
- package/dist/Tree/BOMTree.js +111 -0
- package/dist/Tree/MainProperties.d.ts +12 -0
- package/dist/Tree/MainProperties.js +23 -0
- package/dist/Tree/Tree.d.ts +20 -0
- package/dist/Tree/Tree.js +253 -0
- package/dist/Tree/TreeNode.d.ts +20 -0
- package/dist/Tree/TreeNode.js +147 -0
- package/dist/Tree/index.d.ts +3 -0
- package/dist/Tree/index.js +3 -0
- package/dist/__consts/theme.d.ts +81 -0
- package/dist/__consts/theme.js +88 -0
- package/dist/__consts/unit.d.ts +1 -0
- package/dist/__consts/unit.js +1 -0
- package/dist/__styles/GlobalStyles.d.ts +6 -0
- package/dist/__styles/GlobalStyles.js +6 -0
- package/dist/__styles/index.d.ts +1 -0
- package/dist/__styles/index.js +1 -0
- package/dist/index.d.ts +14 -1
- package/dist/index.js +14 -1
- package/package.json +11 -2
- package/dist/Foo/index.d.ts +0 -5
- package/dist/Foo/index.js +0 -5
@@ -0,0 +1,41 @@
|
|
1
|
+
var _excluded = ["items", "direction", "itemRender", "children"],
|
2
|
+
_excluded2 = ["key", "title"];
|
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 _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; }
|
5
|
+
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; }
|
6
|
+
import React from 'react';
|
7
|
+
import styled from 'styled-components';
|
8
|
+
|
9
|
+
//因为UL自带有title属性
|
10
|
+
|
11
|
+
var StyledUL = styled.ul.withConfig({
|
12
|
+
displayName: "StyledUL",
|
13
|
+
componentId: "basic-component-347b__sc-1ombcxm-0"
|
14
|
+
})(["display:flex;flex-direction:", ";"], function (props) {
|
15
|
+
return props.direction || 'row';
|
16
|
+
});
|
17
|
+
export var ListItem = styled.li.withConfig({
|
18
|
+
displayName: "ListItem",
|
19
|
+
componentId: "basic-component-347b__sc-1ombcxm-1"
|
20
|
+
})(["flex:0 0 auto;"]);
|
21
|
+
|
22
|
+
/* 理论上来说所有list相关的数据结构都应该交给List组件来完成,但是List组件只处理List结构不处理任何其他样式问题 */
|
23
|
+
var List = function List(_ref) {
|
24
|
+
var items = _ref.items,
|
25
|
+
_ref$direction = _ref.direction,
|
26
|
+
direction = _ref$direction === void 0 ? 'row' : _ref$direction,
|
27
|
+
itemRender = _ref.itemRender,
|
28
|
+
children = _ref.children,
|
29
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
30
|
+
return /*#__PURE__*/React.createElement(StyledUL, _extends({
|
31
|
+
direction: direction
|
32
|
+
}, rest), items && Array.isArray(items) ? items.map(function (item, index) {
|
33
|
+
var key = item.key,
|
34
|
+
title = item.title,
|
35
|
+
rest = _objectWithoutProperties(item, _excluded2);
|
36
|
+
return /*#__PURE__*/React.createElement(ListItem, _extends({
|
37
|
+
key: key
|
38
|
+
}, rest), itemRender ? itemRender(item, index) : title);
|
39
|
+
}) : children);
|
40
|
+
};
|
41
|
+
export default List;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as List, ListItem, type ListProps } from './List';
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as List, ListItem } from "./List";
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import React, { ReactNode } from 'react';
|
2
|
+
export type MenuProps = {
|
3
|
+
items: MenuItem[];
|
4
|
+
direction?: Direction;
|
5
|
+
};
|
6
|
+
declare function Menu({ items, direction }: MenuProps): React.JSX.Element;
|
7
|
+
declare namespace Menu {
|
8
|
+
var Popup: typeof PopupMenu;
|
9
|
+
}
|
10
|
+
export declare function PopupMenu(props: MenuProps & {
|
11
|
+
children: ReactNode;
|
12
|
+
trigger?: TriggerType;
|
13
|
+
}): React.JSX.Element | undefined;
|
14
|
+
export default Menu;
|
@@ -0,0 +1,107 @@
|
|
1
|
+
var _excluded = ["children", "trigger"];
|
2
|
+
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); }
|
3
|
+
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; }
|
4
|
+
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; }
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
6
|
+
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."); }
|
7
|
+
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); }
|
8
|
+
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; }
|
9
|
+
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; } }
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
11
|
+
import { useClickOutsize } from '@kep-platform/hooks';
|
12
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
13
|
+
import styled, { css } from 'styled-components';
|
14
|
+
import { List, ListItem } from "../List";
|
15
|
+
import { PopupBox } from "../PopupBox";
|
16
|
+
var MenuList = styled(List).withConfig({
|
17
|
+
displayName: "MenuList",
|
18
|
+
componentId: "basic-component-347b__sc-d665dh-0"
|
19
|
+
})([""]);
|
20
|
+
var MenuListItem = styled(ListItem).withConfig({
|
21
|
+
displayName: "MenuListItem",
|
22
|
+
componentId: "basic-component-347b__sc-d665dh-1"
|
23
|
+
})(["background-color:var(--kep-platform-color-bg-base);border-radius:var(--kep-platform-border-radius-sm);margin:var(--kep-platform-margin-xxxs);padding:0 var(--kep-platform-padding-xs);height:var(--kep-platform-menu-item-height);line-height:var(--kep-platform-menu-item-line-height);&:hover{background-color:var(--kep-platform-color-bg-hover);}", ""], function (props) {
|
24
|
+
if (props.active) {
|
25
|
+
return css(["background-color:var(--kep-platform-color-bg-active) !important;color:var(--kep-platform-color-text-active) !important;"]);
|
26
|
+
}
|
27
|
+
});
|
28
|
+
function Menu(_ref) {
|
29
|
+
var items = _ref.items,
|
30
|
+
_ref$direction = _ref.direction,
|
31
|
+
direction = _ref$direction === void 0 ? 'row' : _ref$direction;
|
32
|
+
var _useState = useState(null),
|
33
|
+
_useState2 = _slicedToArray(_useState, 2),
|
34
|
+
activeKey = _useState2[0],
|
35
|
+
setActiveKey = _useState2[1];
|
36
|
+
var menuClickHandler = useCallback(function (e) {
|
37
|
+
var dataKey = e.target.getAttribute('data-key');
|
38
|
+
setActiveKey(dataKey);
|
39
|
+
}, []);
|
40
|
+
return /*#__PURE__*/React.createElement(MenuList, {
|
41
|
+
direction: direction
|
42
|
+
}, items.map(function (item) {
|
43
|
+
return /*#__PURE__*/React.createElement(MenuListItem, {
|
44
|
+
key: item.key,
|
45
|
+
active: activeKey === item.key,
|
46
|
+
onClick: menuClickHandler,
|
47
|
+
"data-key": item.key
|
48
|
+
}, item.label);
|
49
|
+
}));
|
50
|
+
}
|
51
|
+
export function PopupMenu(props) {
|
52
|
+
var children = props.children,
|
53
|
+
_props$trigger = props.trigger,
|
54
|
+
trigger = _props$trigger === void 0 ? 'click' : _props$trigger,
|
55
|
+
rest = _objectWithoutProperties(props, _excluded);
|
56
|
+
var _useState3 = useState({
|
57
|
+
left: 0,
|
58
|
+
top: 0
|
59
|
+
}),
|
60
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
61
|
+
pos = _useState4[0],
|
62
|
+
setPos = _useState4[1];
|
63
|
+
var triggerController = useRef(null);
|
64
|
+
var popupBox = useRef(null);
|
65
|
+
var mergeProps = useMemo(function () {
|
66
|
+
return {
|
67
|
+
ref: triggerController
|
68
|
+
};
|
69
|
+
}, []);
|
70
|
+
var showPopupMenu = useCallback(function (e) {
|
71
|
+
e.stopPropagation();
|
72
|
+
e.preventDefault();
|
73
|
+
var _ref2 = e,
|
74
|
+
clientX = _ref2.clientX,
|
75
|
+
clientY = _ref2.clientY;
|
76
|
+
setPos({
|
77
|
+
left: clientX,
|
78
|
+
top: clientY
|
79
|
+
});
|
80
|
+
}, []);
|
81
|
+
var hidePopupMenu = useCallback(function () {
|
82
|
+
setPos({
|
83
|
+
left: -999,
|
84
|
+
top: -999
|
85
|
+
});
|
86
|
+
}, []);
|
87
|
+
useClickOutsize('mousedown', popupBox, hidePopupMenu);
|
88
|
+
useClickOutsize('scroll', popupBox, hidePopupMenu);
|
89
|
+
useEffect(function () {
|
90
|
+
var triggerTarget = triggerController.current;
|
91
|
+
if (trigger) triggerTarget === null || triggerTarget === void 0 || triggerTarget.addEventListener(trigger, showPopupMenu);
|
92
|
+
return function () {
|
93
|
+
triggerTarget === null || triggerTarget === void 0 || triggerTarget.removeEventListener(trigger, showPopupMenu);
|
94
|
+
};
|
95
|
+
}, [trigger, showPopupMenu]);
|
96
|
+
if ( /*#__PURE__*/React.isValidElement(children)) {
|
97
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PopupBox, {
|
98
|
+
left: pos.left,
|
99
|
+
top: pos.top,
|
100
|
+
ref: popupBox
|
101
|
+
}, /*#__PURE__*/React.createElement(Menu, _extends({}, rest, {
|
102
|
+
direction: "column"
|
103
|
+
}))), /*#__PURE__*/React.cloneElement(children, mergeProps));
|
104
|
+
} else console.warn('PopupMenu需要一个触发元素!');
|
105
|
+
}
|
106
|
+
Menu.Popup = PopupMenu;
|
107
|
+
export default Menu;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { type PaginationProps as RCPaginationProps } from 'rc-pagination';
|
2
|
+
import React from 'react';
|
3
|
+
declare const Pagination: ({ justifyContent, ...rest }: PaginationProps) => React.JSX.Element;
|
4
|
+
export default Pagination;
|
5
|
+
export type PaginationProps = {
|
6
|
+
justifyContent?: string;
|
7
|
+
} & RCPaginationProps;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
var _excluded = ["justifyContent"];
|
2
|
+
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); }
|
3
|
+
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; }
|
4
|
+
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; }
|
5
|
+
import RCPagination from 'rc-pagination';
|
6
|
+
import React from 'react';
|
7
|
+
import styled from 'styled-components';
|
8
|
+
import { Button } from "../Button";
|
9
|
+
import { Select } from "../Select";
|
10
|
+
var StyledRCPagination = styled(RCPagination).withConfig({
|
11
|
+
displayName: "StyledRCPagination",
|
12
|
+
componentId: "basic-component-347b__sc-11dkd3-0"
|
13
|
+
})(["list-style:none;display:flex;justify-content:", ";align-items:center;& > *{margin:0 var(--kep-platform-margin-xxs);}& .rc-pagination-item{cursor:pointer;padding:var(--kep-platform-padding-xxs) var(--kep-platform-padding-xs);border:1px solid transparent;border-radius:var(--kep-platform-border-radius-sm);& a{color:var(--kep-platform-color-text);}&:hover{background-color:var(--kep-platform-color-bg-hover);}&.rc-pagination-item-active{border:1px solid var(--kep-platform-color-primary);a{color:var(--kep-platform-color-primary);}}}& .rc-pagination-prev{}& .rc-pagination-disabled{}& .rc-pagination-next{}& .rc-pagintaion-options{}& .rc-pagination-jump-next{}& .rc-pagination-options-quick-jumper{& input{margin:0 var(--kep-platform-margin-xs);border-radius:var(--kep-platform-border-radius-sm);border:1px solid var(--kep-platform-color-border);padding:var(--kep-platform-padding-xxs) var(--kep-platform-padding-xs);&:active,&:focus{border-color:var(--kep-platform-color-primary);}}}"], function (props) {
|
14
|
+
return props.justifyContent;
|
15
|
+
});
|
16
|
+
var Pagination = function Pagination(_ref) {
|
17
|
+
var _ref$justifyContent = _ref.justifyContent,
|
18
|
+
justifyContent = _ref$justifyContent === void 0 ? 'left' : _ref$justifyContent,
|
19
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
20
|
+
return /*#__PURE__*/React.createElement(StyledRCPagination, _extends({
|
21
|
+
justifyContent: justifyContent
|
22
|
+
}, rest, {
|
23
|
+
nextIcon: function nextIcon() {
|
24
|
+
return /*#__PURE__*/React.createElement(Button, null, "\u4E0B\u4E00\u9875");
|
25
|
+
},
|
26
|
+
prevIcon: function prevIcon() {
|
27
|
+
return /*#__PURE__*/React.createElement(Button, null, "\u4E0A\u4E00\u9875");
|
28
|
+
},
|
29
|
+
jumpNextIcon: function jumpNextIcon() {
|
30
|
+
return /*#__PURE__*/React.createElement("span", {
|
31
|
+
className: "rc-pagination-item"
|
32
|
+
}, "...");
|
33
|
+
},
|
34
|
+
jumpPrevIcon: function jumpPrevIcon() {
|
35
|
+
return /*#__PURE__*/React.createElement("span", {
|
36
|
+
className: "rc-pagination-item"
|
37
|
+
}, "...");
|
38
|
+
},
|
39
|
+
totalBoundaryShowSizeChanger: 1,
|
40
|
+
showSizeChanger: true,
|
41
|
+
selectComponentClass: Select
|
42
|
+
}));
|
43
|
+
};
|
44
|
+
export default Pagination;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as Pagination, type PaginationProps } from './Pagination';
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as Pagination } from "./Pagination";
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { HtmlHTMLAttributes, type ReactNode } from 'react';
|
2
|
+
export type PopupBoxProps = {
|
3
|
+
children?: ReactNode;
|
4
|
+
left?: number;
|
5
|
+
top?: number;
|
6
|
+
right?: number;
|
7
|
+
bottom?: number;
|
8
|
+
} & HtmlHTMLAttributes<HTMLDivElement>;
|
9
|
+
declare const PopupBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
10
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
11
|
+
}, Omit<PopupBoxProps, "children">>> & string;
|
12
|
+
export default PopupBox;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import styled, { css } from 'styled-components';
|
2
|
+
var PopupBox = styled('div').withConfig({
|
3
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
4
|
+
return !['left', 'right', 'top', 'bottom'].includes(prop);
|
5
|
+
}
|
6
|
+
}).withConfig({
|
7
|
+
displayName: "PopupBox",
|
8
|
+
componentId: "basic-component-347b__sc-80rdwc-0"
|
9
|
+
})(["background-color:var(--kep-platform-color-bg-base);padding:var(--kep-platform-padding-xs);border-radius:var(--kep-platform-border-radius-sm);position:fixed;box-shadow:var(--kep-platform-box-shadow);z-index:var(--kep-platform-z-index-popup-base);", ";"], function (props) {
|
10
|
+
return css(["left:", "px;top:", "px;"], props.left || -999, props.top || -999);
|
11
|
+
});
|
12
|
+
export default PopupBox;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as PopupBox } from './PopupBox';
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as PopupBox } from "./PopupBox";
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import React, { ReactNode } from 'react';
|
2
|
+
export type SelectOption = {
|
3
|
+
label: ReactNode;
|
4
|
+
value: string;
|
5
|
+
};
|
6
|
+
export type SelectProps = {
|
7
|
+
multiple?: boolean;
|
8
|
+
options?: SelectOption[];
|
9
|
+
value?: string;
|
10
|
+
onChange?: (value: string) => void;
|
11
|
+
children?: ReactNode;
|
12
|
+
};
|
13
|
+
export default function Select(props: SelectProps): React.JSX.Element;
|
@@ -0,0 +1,121 @@
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2
|
+
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."); }
|
3
|
+
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); }
|
4
|
+
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; }
|
5
|
+
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; } }
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
7
|
+
import { useClickOutsize } from '@kep-platform/hooks';
|
8
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
9
|
+
import styled, { css, keyframes } from 'styled-components';
|
10
|
+
import { List, ListItem } from "../List";
|
11
|
+
var SelectContainer = styled.div.withConfig({
|
12
|
+
displayName: "SelectContainer",
|
13
|
+
componentId: "basic-component-347b__sc-z3izsh-0"
|
14
|
+
})(["width:200px;position:relative;"]);
|
15
|
+
var SelectTrigger = styled.div.withConfig({
|
16
|
+
displayName: "SelectTrigger",
|
17
|
+
componentId: "basic-component-347b__sc-z3izsh-1"
|
18
|
+
})(["display:flex;height:40px;line-height:calc(40px - 2 * var(--kep-platform-padding-xxs));border:1px solid var(--kep-platform-color-border);border-radius:var(--kep-platform-border-radius);padding:var(--kep-platform-padding-xxs) var(--kep-platform-padding-xs);"]);
|
19
|
+
var SelectInput = styled.input.withConfig({
|
20
|
+
displayName: "SelectInput",
|
21
|
+
componentId: "basic-component-347b__sc-z3izsh-2"
|
22
|
+
})(["border-width:0;"]);
|
23
|
+
var fadeIn = keyframes(["0%{opacity:0;}100%{opacity:1;}"]);
|
24
|
+
var SelectPannel = styled.div.withConfig({
|
25
|
+
displayName: "SelectPannel",
|
26
|
+
componentId: "basic-component-347b__sc-z3izsh-3"
|
27
|
+
})(["position:absolute;left:0;top:40px;width:100%;box-shadow:var(--kep-platform-box-shadow);border-radius:var(--kep-platform-border-radius);z-index:var(--kep-platform-z-index-popup-base);", ""], function (props) {
|
28
|
+
if (props.visible) {
|
29
|
+
return css(["animation:", " 0.3s ease-in;"], fadeIn);
|
30
|
+
} else {
|
31
|
+
return css(["visibility:hidden;"]);
|
32
|
+
}
|
33
|
+
});
|
34
|
+
var SelectList = styled(List).withConfig({
|
35
|
+
displayName: "SelectList",
|
36
|
+
componentId: "basic-component-347b__sc-z3izsh-4"
|
37
|
+
})([""]);
|
38
|
+
var SelectListItem = styled(ListItem).withConfig({
|
39
|
+
displayName: "SelectListItem",
|
40
|
+
componentId: "basic-component-347b__sc-z3izsh-5"
|
41
|
+
})(["background-color:var(--kep-platform-color-bg-base);border-radius:var(--kep-platform-border-radius-sm);margin:var(--kep-platform-margin-xxxs);padding:0 var(--kep-platform-padding-xs);height:var(--kep-platform-menu-item-height);line-height:var(--kep-platform-menu-item-line-height);&:hover{background-color:var(--kep-platform-color-bg-hover);}", ""], function (props) {
|
42
|
+
if (props.active) {
|
43
|
+
return css(["background-color:var(--kep-platform-color-bg-active) !important;color:var(--kep-platform-color-text-active) !important;"]);
|
44
|
+
}
|
45
|
+
});
|
46
|
+
export default function Select(props) {
|
47
|
+
var options = props.options,
|
48
|
+
value = props.value,
|
49
|
+
onChange = props.onChange,
|
50
|
+
children = props.children;
|
51
|
+
var _useState = useState(value),
|
52
|
+
_useState2 = _slicedToArray(_useState, 2),
|
53
|
+
localValue = _useState2[0],
|
54
|
+
setLocalValue = _useState2[1];
|
55
|
+
var _useState3 = useState(value),
|
56
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
57
|
+
inputValue = _useState4[0],
|
58
|
+
setInputValue = _useState4[1];
|
59
|
+
var _useState5 = useState(false),
|
60
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
61
|
+
pannelVisible = _useState6[0],
|
62
|
+
setPannelVisible = _useState6[1];
|
63
|
+
var pannel = useRef(null);
|
64
|
+
var mergeValue = useMemo(function () {
|
65
|
+
if (value === undefined) {
|
66
|
+
return localValue;
|
67
|
+
} else {
|
68
|
+
return value;
|
69
|
+
}
|
70
|
+
}, [value, localValue]);
|
71
|
+
useEffect(function () {
|
72
|
+
setInputValue(mergeValue);
|
73
|
+
}, [mergeValue]);
|
74
|
+
var selectListItemClickHandler = useCallback(function (e) {
|
75
|
+
var dataKey = e.target.getAttribute('data-key');
|
76
|
+
setLocalValue(dataKey);
|
77
|
+
onChange === null || onChange === void 0 || onChange(dataKey);
|
78
|
+
setPannelVisible(false);
|
79
|
+
}, []);
|
80
|
+
useClickOutsize('click', pannel, function () {
|
81
|
+
setPannelVisible(false);
|
82
|
+
setInputValue(mergeValue);
|
83
|
+
});
|
84
|
+
var selectItems = useMemo(function () {
|
85
|
+
if (options) {
|
86
|
+
return options === null || options === void 0 ? void 0 : options.map(function (option) {
|
87
|
+
return /*#__PURE__*/React.createElement(SelectListItem, {
|
88
|
+
key: option.value,
|
89
|
+
active: option.value === mergeValue,
|
90
|
+
"data-key": option.value,
|
91
|
+
onClick: selectListItemClickHandler
|
92
|
+
}, option.label);
|
93
|
+
});
|
94
|
+
} else {
|
95
|
+
return React.Children.map(children, function (child) {
|
96
|
+
return /*#__PURE__*/React.createElement(SelectListItem, {
|
97
|
+
key: child.props.value,
|
98
|
+
"data-key": child.props.value,
|
99
|
+
active: child.props.value === mergeValue,
|
100
|
+
onClick: selectListItemClickHandler
|
101
|
+
}, child.props.children);
|
102
|
+
});
|
103
|
+
}
|
104
|
+
}, [options, children, mergeValue]);
|
105
|
+
return /*#__PURE__*/React.createElement(SelectContainer, null, /*#__PURE__*/React.createElement(SelectTrigger, {
|
106
|
+
onClick: function onClick(e) {
|
107
|
+
e.stopPropagation();
|
108
|
+
setPannelVisible(true);
|
109
|
+
}
|
110
|
+
}, /*#__PURE__*/React.createElement(SelectInput, {
|
111
|
+
onChange: function onChange(e) {
|
112
|
+
setInputValue(e.target.value);
|
113
|
+
},
|
114
|
+
value: inputValue
|
115
|
+
})), /*#__PURE__*/React.createElement(SelectPannel, {
|
116
|
+
visible: pannelVisible,
|
117
|
+
ref: pannel
|
118
|
+
}, /*#__PURE__*/React.createElement(SelectList, {
|
119
|
+
direction: "column"
|
120
|
+
}, selectItems)));
|
121
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as Select, type SelectProps } from './Select';
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as Select } from "./Select";
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import React, { CSSProperties, HtmlHTMLAttributes, ReactNode } from 'react';
|
2
|
+
export type SpaceProps = {
|
3
|
+
children?: ReactNode;
|
4
|
+
className?: string;
|
5
|
+
style?: CSSProperties;
|
6
|
+
size?: SizeType;
|
7
|
+
direction?: Direction;
|
8
|
+
} & HtmlHTMLAttributes<HTMLUListElement>;
|
9
|
+
export declare const SpaceItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, never>> & string;
|
10
|
+
declare const Space: React.FC<SpaceProps>;
|
11
|
+
export default Space;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
var _excluded = ["size"];
|
2
|
+
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); }
|
3
|
+
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; }
|
4
|
+
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; }
|
5
|
+
import React from 'react';
|
6
|
+
import styled from 'styled-components';
|
7
|
+
var StyledSpace = styled.ul.withConfig({
|
8
|
+
displayName: "StyledSpace",
|
9
|
+
componentId: "basic-component-347b__sc-90tegf-0"
|
10
|
+
})(["list-style:none;display:inline-flex;align-items:center;flex-direction:", ";gap:", ";"], function (props) {
|
11
|
+
return props.direction;
|
12
|
+
}, function (props) {
|
13
|
+
switch (props.size) {
|
14
|
+
case 'small':
|
15
|
+
return 'var(--kep-platform-padding-xxs)';
|
16
|
+
case 'large':
|
17
|
+
return 'var(--kep-platform-padding-s)';
|
18
|
+
case 'middle':
|
19
|
+
default:
|
20
|
+
return 'var(--kep-platform-padding-xs)';
|
21
|
+
}
|
22
|
+
});
|
23
|
+
export var SpaceItem = styled.li.withConfig({
|
24
|
+
displayName: "SpaceItem",
|
25
|
+
componentId: "basic-component-347b__sc-90tegf-1"
|
26
|
+
})(["margin:0;padding:0;"]);
|
27
|
+
var Space = function Space(_ref) {
|
28
|
+
var _ref$size = _ref.size,
|
29
|
+
size = _ref$size === void 0 ? 'middle' : _ref$size,
|
30
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
31
|
+
return /*#__PURE__*/React.createElement(StyledSpace, _extends({}, rest, {
|
32
|
+
size: size
|
33
|
+
}), React.Children.map(rest.children, function (child, index) {
|
34
|
+
return /*#__PURE__*/React.createElement(SpaceItem, {
|
35
|
+
key: index
|
36
|
+
}, child);
|
37
|
+
}));
|
38
|
+
};
|
39
|
+
export default Space;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as Space, SpaceItem, type SpaceProps } from './Space';
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as Space, SpaceItem } from "./Space";
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import LoadingOutlined from '@ant-design/icons/LoadingOutlined';
|
2
|
+
import React from 'react';
|
3
|
+
import styled from 'styled-components';
|
4
|
+
var SpinContainer = styled.div.withConfig({
|
5
|
+
displayName: "SpinContainer",
|
6
|
+
componentId: "basic-component-347b__sc-1s1g2fa-0"
|
7
|
+
})(["position:relative;display:flex;"]);
|
8
|
+
var SpinMark = styled.div.withConfig({
|
9
|
+
displayName: "SpinMark",
|
10
|
+
componentId: "basic-component-347b__sc-1s1g2fa-1"
|
11
|
+
})(["position:absolute;content:'';inset:0 0 0 0;background-color:rgba(255,255,255,0.5);display:flex;justify-content:center;align-items:center;"]);
|
12
|
+
export default function Spin(props) {
|
13
|
+
return /*#__PURE__*/React.createElement(SpinContainer, null, props.children, /*#__PURE__*/React.createElement(SpinMark, {
|
14
|
+
spinning: props.spinning
|
15
|
+
}, /*#__PURE__*/React.createElement(LoadingOutlined, null)));
|
16
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as Spin, type SpinProps } from './Spin';
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as Spin } from "./Spin";
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import React, { ReactNode } from 'react';
|
2
|
+
type SorterDesc = Record<string, Sorter>;
|
3
|
+
type FilterDesc = Record<string, string>;
|
4
|
+
export type TableProps = {
|
5
|
+
dataSource: Record<string, any>[];
|
6
|
+
columns: ColumnType[];
|
7
|
+
rowKey: string;
|
8
|
+
actions?: ReactNode[];
|
9
|
+
title?: ReactNode;
|
10
|
+
scroll?: boolean;
|
11
|
+
onChange?: (pagination?: Pagination, sorter?: SorterDesc, fitler?: FilterDesc) => void;
|
12
|
+
headerRender?: (column: ColumnType) => ReactNode;
|
13
|
+
groupBy?: string;
|
14
|
+
pagination?: Pagination;
|
15
|
+
};
|
16
|
+
export default function Table({ columns, dataSource, rowKey, actions, title, scroll, onChange, headerRender, pagination, }: TableProps): React.JSX.Element;
|
17
|
+
export {};
|