es-grid-template 0.0.7 → 0.0.13
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/LICENSE +21 -19
- package/es/{CheckboxFilter.d.ts → grid-component/CheckboxFilter.d.ts} +1 -1
- package/es/{CheckboxFilter.js → grid-component/CheckboxFilter.js} +7 -11
- package/es/grid-component/ColumnsChoose.d.ts +9 -0
- package/es/{ColumnsChoose.js → grid-component/ColumnsChoose.js} +66 -70
- package/es/grid-component/EditableCell.d.ts +19 -0
- package/es/grid-component/EditableCell.js +842 -0
- package/es/{FilterSearch.js → grid-component/FilterSearch.js} +2 -2
- package/es/grid-component/GridStyle.d.ts +4 -0
- package/es/grid-component/GridStyle.js +5 -0
- package/es/grid-component/InternalTable.d.ts +6 -0
- package/es/grid-component/InternalTable.js +283 -0
- package/es/grid-component/LoadingSpinner.d.ts +3 -0
- package/es/grid-component/LoadingSpinner.js +20 -0
- package/es/grid-component/Message/Message.d.ts +2 -0
- package/es/grid-component/Message/Message.js +16 -0
- package/es/grid-component/Message/index.d.ts +1 -0
- package/es/grid-component/Message/index.js +1 -0
- package/es/grid-component/TableGrid.d.ts +10 -0
- package/es/grid-component/TableGrid.js +375 -0
- package/es/grid-component/async-table-select/index.d.ts +9 -0
- package/es/grid-component/async-table-select/index.js +37 -0
- package/es/{hooks → grid-component/hooks}/constant.d.ts +14 -0
- package/es/{hooks → grid-component/hooks}/constant.js +17 -2
- package/es/grid-component/hooks/useColumns/index.d.ts +6 -0
- package/es/grid-component/hooks/useColumns/index.js +422 -0
- package/es/grid-component/hooks/utils.d.ts +35 -0
- package/es/{hooks → grid-component/hooks}/utils.js +147 -19
- package/es/grid-component/index.d.ts +2 -0
- package/es/grid-component/index.js +2 -0
- package/es/grid-component/rc-table/Grid.d.ts +8 -0
- package/es/grid-component/rc-table/Grid.js +99 -0
- package/es/grid-component/rc-table/GridEdit.d.ts +9 -0
- package/es/grid-component/rc-table/GridEdit.js +706 -0
- package/es/grid-component/type.d.ts +225 -0
- package/es/grid-component/useContext.d.ts +27 -0
- package/es/grid-component/useContext.js +4 -0
- package/es/index.d.ts +1 -2
- package/es/index.js +2 -2
- package/es/table-grid/styles.scss +551 -0
- package/lib/{CheckboxFilter.d.ts → grid-component/CheckboxFilter.d.ts} +1 -1
- package/lib/{CheckboxFilter.js → grid-component/CheckboxFilter.js} +11 -14
- package/lib/grid-component/ColumnsChoose.d.ts +9 -0
- package/lib/{ColumnsChoose.js → grid-component/ColumnsChoose.js} +66 -70
- package/lib/grid-component/EditableCell.d.ts +19 -0
- package/lib/grid-component/EditableCell.js +844 -0
- package/lib/{FilterSearch.js → grid-component/FilterSearch.js} +3 -3
- package/lib/grid-component/GridStyle.d.ts +4 -0
- package/lib/grid-component/GridStyle.js +12 -0
- package/lib/grid-component/InternalTable.d.ts +6 -0
- package/lib/grid-component/InternalTable.js +292 -0
- package/lib/grid-component/LoadingSpinner.d.ts +3 -0
- package/lib/grid-component/LoadingSpinner.js +29 -0
- package/lib/grid-component/Message/Message.d.ts +2 -0
- package/lib/grid-component/Message/Message.js +25 -0
- package/lib/grid-component/Message/index.d.ts +1 -0
- package/lib/grid-component/Message/index.js +16 -0
- package/lib/grid-component/TableGrid.d.ts +10 -0
- package/lib/grid-component/TableGrid.js +382 -0
- package/lib/grid-component/async-table-select/index.d.ts +9 -0
- package/lib/grid-component/async-table-select/index.js +46 -0
- package/lib/{hooks → grid-component/hooks}/constant.d.ts +14 -0
- package/lib/{hooks → grid-component/hooks}/constant.js +18 -3
- package/lib/grid-component/hooks/useColumns/index.d.ts +6 -0
- package/lib/grid-component/hooks/useColumns/index.js +435 -0
- package/lib/grid-component/hooks/utils.d.ts +35 -0
- package/lib/{hooks → grid-component/hooks}/utils.js +164 -22
- package/lib/grid-component/index.d.ts +2 -0
- package/lib/grid-component/index.js +9 -0
- package/lib/grid-component/rc-table/Grid.d.ts +8 -0
- package/lib/grid-component/rc-table/Grid.js +108 -0
- package/lib/grid-component/rc-table/GridEdit.d.ts +9 -0
- package/lib/grid-component/rc-table/GridEdit.js +715 -0
- package/lib/grid-component/type.d.ts +225 -0
- package/lib/grid-component/useContext.d.ts +27 -0
- package/lib/grid-component/useContext.js +10 -0
- package/lib/index.d.ts +1 -2
- package/lib/index.js +7 -3
- package/lib/table-grid/styles.scss +551 -0
- package/package.json +17 -6
- package/es/ColumnsChoose.d.ts +0 -10
- package/es/GridTable.d.ts +0 -7
- package/es/GridTable.js +0 -927
- package/es/hooks/useColumns/index.d.ts +0 -2
- package/es/hooks/useColumns/index.js +0 -25
- package/es/hooks/utils.d.ts +0 -18
- package/es/styles.scss +0 -30
- package/es/type.d.ts +0 -88
- package/lib/ColumnsChoose.d.ts +0 -10
- package/lib/GridTable.d.ts +0 -7
- package/lib/GridTable.js +0 -936
- package/lib/hooks/useColumns/index.d.ts +0 -2
- package/lib/hooks/useColumns/index.js +0 -31
- package/lib/hooks/utils.d.ts +0 -18
- package/lib/styles.scss +0 -30
- package/lib/type.d.ts +0 -88
- /package/es/{ContextMenu.d.ts → grid-component/ContextMenu.d.ts} +0 -0
- /package/es/{ContextMenu.js → grid-component/ContextMenu.js} +0 -0
- /package/es/{FilterSearch.d.ts → grid-component/FilterSearch.d.ts} +0 -0
- /package/es/{hooks → grid-component/hooks}/index.d.ts +0 -0
- /package/es/{hooks → grid-component/hooks}/index.js +0 -0
- /package/es/{hooks → grid-component/hooks}/useIsOverflow.d.ts +0 -0
- /package/es/{hooks → grid-component/hooks}/useIsOverflow.js +0 -0
- /package/es/{hooks → grid-component/hooks}/useOnClickOutside.d.ts +0 -0
- /package/es/{hooks → grid-component/hooks}/useOnClickOutside.js +0 -0
- /package/es/{type.js → grid-component/type.js} +0 -0
- /package/lib/{ContextMenu.d.ts → grid-component/ContextMenu.d.ts} +0 -0
- /package/lib/{ContextMenu.js → grid-component/ContextMenu.js} +0 -0
- /package/lib/{FilterSearch.d.ts → grid-component/FilterSearch.d.ts} +0 -0
- /package/lib/{hooks → grid-component/hooks}/index.d.ts +0 -0
- /package/lib/{hooks → grid-component/hooks}/index.js +0 -0
- /package/lib/{hooks → grid-component/hooks}/useIsOverflow.d.ts +0 -0
- /package/lib/{hooks → grid-component/hooks}/useIsOverflow.js +0 -0
- /package/lib/{hooks → grid-component/hooks}/useOnClickOutside.d.ts +0 -0
- /package/lib/{hooks → grid-component/hooks}/useOnClickOutside.js +0 -0
- /package/lib/{type.js → grid-component/type.js} +0 -0
|
@@ -4,97 +4,90 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.ColumnsChoose =
|
|
7
|
+
exports.ColumnsChoose = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
10
|
var _antd = require("antd");
|
|
11
11
|
var _icons = require("@ant-design/icons");
|
|
12
12
|
var _hooks = require("./hooks");
|
|
13
|
+
var _tree = _interopRequireDefault(require("rc-master-ui/es/tree"));
|
|
14
|
+
var _SearchOutlined = _interopRequireDefault(require("@ant-design/icons/SearchOutlined"));
|
|
13
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
|
-
|
|
16
|
-
Search
|
|
17
|
-
} = _antd.Input;
|
|
17
|
+
// import type { TreeDataNode} from "antd";
|
|
18
18
|
|
|
19
|
-
// const
|
|
20
|
-
// padding: 6px 0;
|
|
21
|
-
//
|
|
22
|
-
// height: 35px;
|
|
23
|
-
//
|
|
24
|
-
// .ellipsis {
|
|
25
|
-
// overflow: hidden;
|
|
26
|
-
// white-space: nowrap;
|
|
27
|
-
// text-overflow: ellipsis;
|
|
28
|
-
// word-break: keep-all;
|
|
29
|
-
// }
|
|
30
|
-
// `
|
|
19
|
+
// const { Search } = Input;
|
|
31
20
|
|
|
32
21
|
const BoxAction = _styledComponents.default.div.withConfig({
|
|
33
22
|
displayName: "BoxAction",
|
|
34
|
-
componentId: "es-grid-template__sc-
|
|
23
|
+
componentId: "es-grid-template__sc-1ix8yky-0"
|
|
35
24
|
})(["border-top:1px solid #c4c4c4;padding-top:.75rem;display:flex;justify-content:end;gap:10px;.btn-action{background:none !important;border:none !important;&.btn-action-submit{color:#df4318;&:disabled{background-color:#f0f0f0 !important;}&:hover{color:#df4318 !important;}}&:hover{background-color:#f0f0f0 !important;}}"]);
|
|
36
|
-
const BoxInputFilterColumn = exports.BoxInputFilterColumn = _styledComponents.default.div.withConfig({
|
|
37
|
-
displayName: "BoxInputFilterColumn",
|
|
38
|
-
componentId: "es-grid-template__sc-1k89i9w-1"
|
|
39
|
-
})(["display:flex;position:relative;align-items:center;.input__value{z-index:1;border-radius:0;border-top:0;border-left:0;border-right:0;&:focus{box-shadow:none !important;}&.is-clearable{padding-right:25px !important;}}.input__clear-icon{cursor:pointer;position:absolute;right:5px;z-index:10;}"]);
|
|
40
25
|
const ColumnsChoose = props => {
|
|
41
26
|
const {
|
|
42
27
|
columns: propsColumns,
|
|
43
28
|
setColumns: changeHiddenColumn
|
|
44
29
|
// t,
|
|
45
|
-
// columnsGrouped,
|
|
46
|
-
// onChangeDisplay
|
|
47
|
-
// frozen
|
|
48
30
|
} = props;
|
|
49
31
|
|
|
50
32
|
// const dataList: { key: React.Key; title: string }[] = [];
|
|
51
33
|
|
|
52
|
-
const defaultColumns =
|
|
53
|
-
|
|
54
|
-
|
|
34
|
+
// const defaultColumns = useMemo(() => {
|
|
35
|
+
// return propsColumns.filter((it) => it.key || it.dataIndex && it.showColumnChoose !== false)
|
|
36
|
+
// }, [propsColumns])
|
|
37
|
+
|
|
38
|
+
// const columnsChooseRef: any = useRef()
|
|
39
|
+
// const searchRef: any = useRef()
|
|
40
|
+
|
|
41
|
+
const [columns, setColumns] = (0, _react.useState)([]);
|
|
42
|
+
const [selectedKeys, setSelectedKeys] = (0, _react.useState)([]);
|
|
43
|
+
(0, _react.useEffect)(() => {
|
|
44
|
+
const defaultColumns = propsColumns.filter(it => it.key || it.dataIndex && it.showColumnChoose !== false);
|
|
45
|
+
const defaultSelectedKeys = (0, _hooks.getVisibleColumnKeys)(propsColumns);
|
|
46
|
+
setSelectedKeys(defaultSelectedKeys);
|
|
47
|
+
setColumns(defaultColumns);
|
|
55
48
|
}, [propsColumns]);
|
|
56
49
|
const defaultSelectedKeys = (0, _react.useMemo)(() => {
|
|
57
50
|
return (0, _hooks.getVisibleColumnKeys)(propsColumns);
|
|
58
51
|
}, [propsColumns]);
|
|
59
52
|
|
|
60
|
-
//
|
|
61
|
-
// const searchRef: any = useRef()
|
|
53
|
+
// console.log('defaultSelectedKeys', defaultSelectedKeys)
|
|
62
54
|
|
|
63
|
-
const [columns] = (0, _react.useState)(defaultColumns);
|
|
64
55
|
const [clicked, setClicked] = (0, _react.useState)(false);
|
|
65
56
|
const [autoExpandParent, setAutoExpandParent] = (0, _react.useState)(true);
|
|
66
57
|
// const [expandedKeys, setExpandedKeys] = useState<React.Key[]>([]);
|
|
67
|
-
const [searchValue, setSearchValue] =
|
|
68
|
-
|
|
69
|
-
const treeData =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
58
|
+
// const [searchValue, setSearchValue] = useState('');
|
|
59
|
+
|
|
60
|
+
// const treeData = useMemo(() => {
|
|
61
|
+
// const loop = (data: TreeDataNode[]): TreeDataNode[] =>
|
|
62
|
+
// data.map((item) => {
|
|
63
|
+
// const strTitle = item.title as string;
|
|
64
|
+
// const index = strTitle.indexOf(searchValue);
|
|
65
|
+
// const beforeStr = strTitle.substring(0, index);
|
|
66
|
+
// const afterStr = strTitle.slice(index + searchValue.length);
|
|
67
|
+
// const title =
|
|
68
|
+
// index > -1 ? (
|
|
69
|
+
// <span key={item.key}>
|
|
70
|
+
// {beforeStr}
|
|
71
|
+
// <span className="site-tree-search-value">{searchValue}</span>
|
|
72
|
+
// {afterStr}
|
|
73
|
+
// </span>
|
|
74
|
+
// ) : (
|
|
75
|
+
// <span key={item.key}>{strTitle}</span>
|
|
76
|
+
// );
|
|
77
|
+
// if (item.children) {
|
|
78
|
+
// return { title, key: item.key, children: loop(item.children) };
|
|
79
|
+
// }
|
|
80
|
+
//
|
|
81
|
+
// return {
|
|
82
|
+
// title,
|
|
83
|
+
// key: item.key,
|
|
84
|
+
// };
|
|
85
|
+
// });
|
|
86
|
+
//
|
|
87
|
+
// // return loop(defaultData);
|
|
88
|
+
// return loop(columns as any);
|
|
89
|
+
// }, [searchValue, columns]);
|
|
94
90
|
|
|
95
|
-
// return loop(defaultData);
|
|
96
|
-
return loop(columns);
|
|
97
|
-
}, [searchValue]);
|
|
98
91
|
const hide = () => {
|
|
99
92
|
setClicked(false);
|
|
100
93
|
};
|
|
@@ -121,10 +114,9 @@ const ColumnsChoose = props => {
|
|
|
121
114
|
// return parentKey!
|
|
122
115
|
// }
|
|
123
116
|
|
|
124
|
-
const onChange = e => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
} = e.target;
|
|
117
|
+
// const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
118
|
+
const onChange = () => {
|
|
119
|
+
// const { value } = e.target
|
|
128
120
|
// const newExpandedKeys = dataList
|
|
129
121
|
// .map((item) => {
|
|
130
122
|
// if (item.title.indexOf(value) > -1) {
|
|
@@ -134,14 +126,15 @@ const ColumnsChoose = props => {
|
|
|
134
126
|
// })
|
|
135
127
|
// .filter((item, i, self): item is React.Key => !!(item && self.indexOf(item) === i))
|
|
136
128
|
// setExpandedKeys(newExpandedKeys)
|
|
137
|
-
|
|
129
|
+
|
|
130
|
+
// setSearchValue(value)
|
|
138
131
|
setAutoExpandParent(true);
|
|
139
132
|
};
|
|
140
133
|
const onCheck = keys => {
|
|
141
134
|
setSelectedKeys(keys);
|
|
142
135
|
};
|
|
143
136
|
const handleAccept = () => {
|
|
144
|
-
const rs1 = (0, _hooks.updateColumns)(
|
|
137
|
+
const rs1 = (0, _hooks.updateColumns)(propsColumns, selectedKeys);
|
|
145
138
|
changeHiddenColumn(rs1);
|
|
146
139
|
hide();
|
|
147
140
|
};
|
|
@@ -155,18 +148,21 @@ const ColumnsChoose = props => {
|
|
|
155
148
|
style: {
|
|
156
149
|
minWidth: 250
|
|
157
150
|
}
|
|
158
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
151
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Input, {
|
|
159
152
|
style: {
|
|
160
153
|
marginBottom: 8
|
|
161
154
|
},
|
|
162
155
|
placeholder: "Search",
|
|
156
|
+
prefix: /*#__PURE__*/_react.default.createElement(_SearchOutlined.default, null),
|
|
163
157
|
onChange: onChange
|
|
164
|
-
}), /*#__PURE__*/_react.default.createElement(
|
|
158
|
+
}), /*#__PURE__*/_react.default.createElement(_tree.default, {
|
|
165
159
|
onExpand: onExpand
|
|
166
160
|
// expandedKeys={expandedKeys}
|
|
167
161
|
,
|
|
168
|
-
autoExpandParent: autoExpandParent
|
|
169
|
-
|
|
162
|
+
autoExpandParent: autoExpandParent
|
|
163
|
+
// treeData={treeData}
|
|
164
|
+
,
|
|
165
|
+
treeData: columns,
|
|
170
166
|
defaultExpandAll: true,
|
|
171
167
|
checkable: true
|
|
172
168
|
// onSelect={(keys, info) => {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ColumnEditType, IFormat } from "./type";
|
|
3
|
+
import type { EditType } from "rc-master-ui";
|
|
4
|
+
interface EditableCellProps<DataType> extends React.HTMLAttributes<HTMLElement> {
|
|
5
|
+
t?: any;
|
|
6
|
+
editing: boolean;
|
|
7
|
+
dataIndex: string;
|
|
8
|
+
title: any;
|
|
9
|
+
editType: EditType;
|
|
10
|
+
record: DataType;
|
|
11
|
+
index: number;
|
|
12
|
+
format?: IFormat;
|
|
13
|
+
column: ColumnEditType<DataType>;
|
|
14
|
+
indexRow: number;
|
|
15
|
+
indexCol: number;
|
|
16
|
+
rowKey: any;
|
|
17
|
+
}
|
|
18
|
+
declare const EditableCell: <T>(props: React.PropsWithChildren<EditableCellProps<T>>) => React.JSX.Element;
|
|
19
|
+
export default EditableCell;
|