es-grid-template 0.1.1 → 0.1.2-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.
- package/es/grid-component/ColumnsChoose.js +25 -8
- package/es/grid-component/Command.js +6 -5
- package/es/grid-component/ContextMenu.d.ts +2 -2
- package/es/grid-component/ContextMenu.js +1 -0
- package/es/grid-component/EditableCell.js +265 -248
- package/es/grid-component/GridStyle.js +1 -1
- package/es/grid-component/InternalTable.js +24 -16
- package/es/grid-component/TableGrid.js +4 -2
- package/es/grid-component/async-select/index.d.ts +9 -0
- package/es/grid-component/async-select/index.js +35 -0
- package/es/grid-component/hooks/constant.d.ts +10 -0
- package/es/grid-component/hooks/constant.js +11 -1
- package/es/grid-component/hooks/useColumns/index.js +11 -7
- package/es/grid-component/hooks/utils.d.ts +2 -0
- package/es/grid-component/hooks/utils.js +11 -0
- package/es/grid-component/index.d.ts +3 -2
- package/es/grid-component/styles.scss +101 -30
- package/es/grid-component/table/Grid.js +7 -7
- package/es/grid-component/table/GridEdit.d.ts +1 -1
- package/es/grid-component/table/GridEdit.js +21 -16
- package/es/grid-component/type.d.ts +6 -3
- package/es/grid-component/useContext.d.ts +2 -1
- package/es/index.d.ts +1 -1
- package/lib/grid-component/ColumnsChoose.js +25 -8
- package/lib/grid-component/Command.js +7 -5
- package/lib/grid-component/ContextMenu.d.ts +2 -2
- package/lib/grid-component/ContextMenu.js +2 -0
- package/lib/grid-component/EditableCell.js +262 -245
- package/lib/grid-component/GridStyle.js +1 -1
- package/lib/grid-component/InternalTable.js +24 -16
- package/lib/grid-component/TableGrid.js +4 -2
- package/lib/grid-component/async-select/index.d.ts +9 -0
- package/lib/grid-component/async-select/index.js +44 -0
- package/lib/grid-component/hooks/constant.d.ts +10 -0
- package/lib/grid-component/hooks/constant.js +12 -2
- package/lib/grid-component/hooks/useColumns/index.js +11 -7
- package/lib/grid-component/hooks/utils.d.ts +2 -0
- package/lib/grid-component/hooks/utils.js +16 -3
- package/lib/grid-component/index.d.ts +3 -2
- package/lib/grid-component/styles.scss +101 -30
- package/lib/grid-component/table/Grid.js +7 -7
- package/lib/grid-component/table/GridEdit.d.ts +1 -1
- package/lib/grid-component/table/GridEdit.js +21 -16
- package/lib/grid-component/type.d.ts +6 -3
- package/lib/grid-component/useContext.d.ts +2 -1
- package/lib/index.d.ts +1 -1
- package/package.json +4 -15
|
@@ -3,6 +3,8 @@ import styled from "styled-components";
|
|
|
3
3
|
import { Button, Input, Popover, Tooltip } from "antd";
|
|
4
4
|
import { SettingOutlined } from "@ant-design/icons";
|
|
5
5
|
import { getVisibleColumnKeys, updateColumns } from "./hooks";
|
|
6
|
+
|
|
7
|
+
// import type {TableColumnsType} from "rc-master-ui";
|
|
6
8
|
import Tree from "rc-master-ui/es/tree";
|
|
7
9
|
import SearchOutlined from "@ant-design/icons/SearchOutlined";
|
|
8
10
|
const BoxAction = styled.div.withConfig({
|
|
@@ -25,20 +27,32 @@ export const ColumnsChoose = props => {
|
|
|
25
27
|
// const columnsChooseRef: any = useRef()
|
|
26
28
|
// const searchRef: any = useRef()
|
|
27
29
|
|
|
28
|
-
const [columns, setColumns] = useState([])
|
|
30
|
+
// const [columns, setColumns] = useState<TableColumnsType>([])
|
|
29
31
|
const [selectedKeys, setSelectedKeys] = useState([]);
|
|
32
|
+
const [isManualUpdate, setIsManualUpdate] = useState(false);
|
|
33
|
+
|
|
34
|
+
// useEffect(() => {
|
|
35
|
+
//
|
|
36
|
+
// const defaultColumns = propsColumns.filter((it) => it.key || it.dataIndex && it.showInColumnChoose !== false)
|
|
37
|
+
// setColumns(defaultColumns as TableColumnsType)
|
|
38
|
+
//
|
|
39
|
+
// }, [propsColumns])
|
|
40
|
+
|
|
41
|
+
const columns = useMemo(() => {
|
|
42
|
+
return propsColumns.filter(it => it.key || it.dataIndex && it.showInColumnChoose !== false);
|
|
43
|
+
// setColumns(defaultColumns as TableColumnsType)
|
|
44
|
+
}, [propsColumns]);
|
|
30
45
|
useEffect(() => {
|
|
31
46
|
const defaultColumns = propsColumns.filter(it => it.key || it.dataIndex && it.showInColumnChoose !== false);
|
|
32
|
-
const defaultSelectedKeys = getVisibleColumnKeys(
|
|
33
|
-
|
|
34
|
-
|
|
47
|
+
const defaultSelectedKeys = getVisibleColumnKeys(defaultColumns);
|
|
48
|
+
if (!isManualUpdate) {
|
|
49
|
+
setSelectedKeys(defaultSelectedKeys);
|
|
50
|
+
}
|
|
51
|
+
setIsManualUpdate(false);
|
|
35
52
|
}, [propsColumns]);
|
|
36
53
|
const defaultSelectedKeys = useMemo(() => {
|
|
37
54
|
return getVisibleColumnKeys(propsColumns);
|
|
38
55
|
}, [propsColumns]);
|
|
39
|
-
|
|
40
|
-
// console.log('defaultSelectedKeys', defaultSelectedKeys)
|
|
41
|
-
|
|
42
56
|
const [clicked, setClicked] = useState(false);
|
|
43
57
|
const [autoExpandParent, setAutoExpandParent] = useState(true);
|
|
44
58
|
// const [expandedKeys, setExpandedKeys] = useState<React.Key[]>([]);
|
|
@@ -119,6 +133,7 @@ export const ColumnsChoose = props => {
|
|
|
119
133
|
};
|
|
120
134
|
const onCheck = keys => {
|
|
121
135
|
setSelectedKeys(keys);
|
|
136
|
+
setIsManualUpdate(true);
|
|
122
137
|
};
|
|
123
138
|
const handleAccept = () => {
|
|
124
139
|
const rs1 = updateColumns(propsColumns, selectedKeys);
|
|
@@ -178,7 +193,9 @@ export const ColumnsChoose = props => {
|
|
|
178
193
|
onCheck: keys => onCheck(keys),
|
|
179
194
|
multiple: true,
|
|
180
195
|
checkedKeys: selectedKeys,
|
|
181
|
-
defaultCheckedKeys: selectedKeys
|
|
196
|
+
defaultCheckedKeys: selectedKeys
|
|
197
|
+
// defaultCheckedKeys={defaultSelectedKeys}
|
|
198
|
+
,
|
|
182
199
|
selectedKeys: [],
|
|
183
200
|
height: window.innerHeight - 200
|
|
184
201
|
}), /*#__PURE__*/React.createElement(BoxAction, {
|
|
@@ -5,7 +5,7 @@ import classnames from "classnames";
|
|
|
5
5
|
import { useFloating, autoUpdate, offset, flip, shift, useHover, useFocus, useDismiss, useRole, useInteractions, FloatingPortal
|
|
6
6
|
// useClick
|
|
7
7
|
} from "@floating-ui/react";
|
|
8
|
-
import {
|
|
8
|
+
// import {Button} from "antd";
|
|
9
9
|
import styled from "styled-components";
|
|
10
10
|
import { getTemplate } from "./hooks";
|
|
11
11
|
const TooltipStyle = styled.div.withConfig({
|
|
@@ -50,20 +50,21 @@ const Command = props => {
|
|
|
50
50
|
onClick: onClick
|
|
51
51
|
}), getTemplate(item.template)) : /*#__PURE__*/React.createElement("div", _extends({
|
|
52
52
|
ref: refs.setReference
|
|
53
|
-
}, getReferenceProps()
|
|
54
|
-
id: 'tooltip',
|
|
53
|
+
}, getReferenceProps(), {
|
|
55
54
|
tabIndex: -1,
|
|
56
55
|
style: {
|
|
57
56
|
padding: '3px',
|
|
58
57
|
maxWidth: 45,
|
|
59
|
-
height: '100%'
|
|
58
|
+
height: '100%',
|
|
59
|
+
display: 'flex',
|
|
60
|
+
cursor: 'pointer'
|
|
60
61
|
},
|
|
61
62
|
className: classnames('command-item', {
|
|
62
63
|
'btn-icon': item.title === ''
|
|
63
64
|
}),
|
|
64
65
|
color: item.color ? item.color : 'primary',
|
|
65
66
|
onClick: onClick
|
|
66
|
-
}, item.icon ? getTemplate(item.icon) : item.title)
|
|
67
|
+
}), item.icon ? getTemplate(item.icon) : item.title)
|
|
67
68
|
|
|
68
69
|
// <span>{item.title}</span>
|
|
69
70
|
, isOpen && item.tooltip && /*#__PURE__*/React.createElement(FloatingPortal, {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type { MenuProps } from "antd";
|
|
3
2
|
import type { ContextInfo } from "./type";
|
|
3
|
+
import type { ContextMenuItem } from "./type";
|
|
4
4
|
export declare const findItemByKey: (array: any[], key: string, value: any) => any;
|
|
5
5
|
type Props<RecordType> = {
|
|
6
6
|
rowData: RecordType | null;
|
|
7
|
-
contextMenuItems:
|
|
7
|
+
contextMenuItems: ContextMenuItem[];
|
|
8
8
|
contextMenuClick?: (args: ContextInfo<RecordType>) => void;
|
|
9
9
|
open: boolean;
|
|
10
10
|
menuRef?: any;
|