es-grid-template 0.0.8 → 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.js → grid-component/CheckboxFilter.js} +0 -1
- package/es/{ColumnsChoose.js → grid-component/ColumnsChoose.js} +1 -1
- 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} +1 -1
- package/es/grid-component/GridStyle.d.ts +4 -0
- package/es/grid-component/GridStyle.js +5 -0
- package/es/{InternalTable.d.ts → grid-component/InternalTable.d.ts} +1 -2
- package/es/grid-component/InternalTable.js +283 -0
- package/es/{LoadingSpinner.js → grid-component/LoadingSpinner.js} +1 -1
- 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/{lib → es/grid-component}/TableGrid.d.ts +2 -2
- 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/{lib → es/grid-component}/hooks/constant.d.ts +14 -0
- package/es/{hooks → grid-component/hooks}/constant.js +16 -1
- 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 +124 -16
- 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.js → grid-component/CheckboxFilter.js} +0 -1
- package/lib/{ColumnsChoose.js → grid-component/ColumnsChoose.js} +1 -1
- 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} +1 -1
- package/lib/grid-component/GridStyle.d.ts +4 -0
- package/lib/grid-component/GridStyle.js +12 -0
- package/lib/{InternalTable.d.ts → grid-component/InternalTable.d.ts} +1 -2
- package/lib/grid-component/InternalTable.js +292 -0
- package/lib/{LoadingSpinner.js → grid-component/LoadingSpinner.js} +1 -1
- 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/{es → lib/grid-component}/TableGrid.d.ts +2 -2
- 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/{es → lib/grid-component}/hooks/constant.d.ts +14 -0
- package/lib/{hooks → grid-component/hooks}/constant.js +17 -2
- 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 +140 -19
- 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 +15 -6
- package/es/InternalTable.js +0 -185
- package/es/TableGrid.js +0 -1055
- package/es/hooks/useColumns/index.d.ts +0 -2
- package/es/hooks/useColumns/index.js +0 -25
- package/es/hooks/utils.d.ts +0 -19
- package/es/styles.scss +0 -296
- package/es/type.d.ts +0 -100
- package/lib/InternalTable.js +0 -194
- package/lib/TableGrid.js +0 -1063
- package/lib/hooks/useColumns/index.d.ts +0 -2
- package/lib/hooks/useColumns/index.js +0 -31
- package/lib/hooks/utils.d.ts +0 -19
- package/lib/styles.scss +0 -296
- package/lib/type.d.ts +0 -100
- /package/es/{CheckboxFilter.d.ts → grid-component/CheckboxFilter.d.ts} +0 -0
- /package/es/{ColumnsChoose.d.ts → grid-component/ColumnsChoose.d.ts} +0 -0
- /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/{LoadingSpinner.d.ts → grid-component/LoadingSpinner.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/{CheckboxFilter.d.ts → grid-component/CheckboxFilter.d.ts} +0 -0
- /package/lib/{ColumnsChoose.d.ts → grid-component/ColumnsChoose.d.ts} +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/{LoadingSpinner.d.ts → grid-component/LoadingSpinner.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
|
@@ -19,7 +19,7 @@ const FilterSearch = props => {
|
|
|
19
19
|
paddingRight: 0
|
|
20
20
|
}
|
|
21
21
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
22
|
-
|
|
22
|
+
suffix: /*#__PURE__*/React.createElement(SearchOutlined, null),
|
|
23
23
|
placeholder: locale.filterSearchPlaceholder,
|
|
24
24
|
onChange: onChange,
|
|
25
25
|
value: value,
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const GridStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
3
|
+
heightTable?: number | string;
|
|
4
|
+
}>> & string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
export const GridStyle = styled.div.withConfig({
|
|
3
|
+
displayName: "GridStyle",
|
|
4
|
+
componentId: "es-grid-template__sc-sueu2e-0"
|
|
5
|
+
})([".ui-rc-pagination{border-bottom:1px solid #e0e0e0;border-top:1px solid #e0e0e0;margin:0;padding:.75rem 1rem;.ui-rc-pagination-total-text{order:2;margin-left:auto;}&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:", ";bottom:0;left:0;z-index:-1;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:", ";bottom:0;visibility:visible;right:0;z-index:-1;}}"], props => props.heightTable ? typeof props.heightTable === 'string' ? props.heightTable : `${props.heightTable}px` : undefined, props => props.heightTable ? `${props.heightTable}px` : undefined);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { GridTableProps } from "./type";
|
|
2
3
|
import 'dayjs/locale/es';
|
|
3
4
|
import 'dayjs/locale/vi';
|
|
4
|
-
import './styles.scss';
|
|
5
|
-
import type { GridTableProps } from "./type";
|
|
6
5
|
declare const InternalTable: <RecordType extends object>(props: GridTableProps<RecordType>) => React.JSX.Element;
|
|
7
6
|
export default InternalTable;
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React, { Fragment, useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { Select, Table } from "rc-master-ui";
|
|
4
|
+
import { Button, Space } from "antd";
|
|
5
|
+
import { SearchOutlined } from "@ant-design/icons";
|
|
6
|
+
import styled from "styled-components";
|
|
7
|
+
import { Resizable } from "react-resizable";
|
|
8
|
+
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
9
|
+
import { numberOperator, translateOption, updateArrayByKey } from "./hooks";
|
|
10
|
+
import { FilterFill } from "becoxy-icons";
|
|
11
|
+
import { renderFilter } from "./hooks/useColumns";
|
|
12
|
+
import dayjs from "dayjs";
|
|
13
|
+
import 'dayjs/locale/es';
|
|
14
|
+
import 'dayjs/locale/vi';
|
|
15
|
+
import en from 'rc-master-ui/es/date-picker/locale/en_US';
|
|
16
|
+
import vi from 'rc-master-ui/es/date-picker/locale/vi_VN';
|
|
17
|
+
import GridEdit from "./rc-table/GridEdit";
|
|
18
|
+
import Grid from "./rc-table/Grid";
|
|
19
|
+
dayjs.extend(customParseFormat);
|
|
20
|
+
const ResizableTitle = props => {
|
|
21
|
+
const {
|
|
22
|
+
onResize,
|
|
23
|
+
width,
|
|
24
|
+
...restProps
|
|
25
|
+
} = props;
|
|
26
|
+
if (!width) {
|
|
27
|
+
return /*#__PURE__*/React.createElement("th", restProps);
|
|
28
|
+
}
|
|
29
|
+
return (
|
|
30
|
+
/*#__PURE__*/
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
React.createElement(Resizable, {
|
|
33
|
+
width: width,
|
|
34
|
+
height: 0,
|
|
35
|
+
handle: /*#__PURE__*/React.createElement("span", {
|
|
36
|
+
className: "react-resizable-handle",
|
|
37
|
+
onClick: e => {
|
|
38
|
+
e.stopPropagation();
|
|
39
|
+
}
|
|
40
|
+
}),
|
|
41
|
+
onResize: onResize,
|
|
42
|
+
draggableOpts: {
|
|
43
|
+
enableUserSelectHack: false
|
|
44
|
+
}
|
|
45
|
+
}, /*#__PURE__*/React.createElement("th", restProps))
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
const GridStyle = styled.div.withConfig({
|
|
49
|
+
displayName: "GridStyle",
|
|
50
|
+
componentId: "es-grid-template__sc-1awgu8w-0"
|
|
51
|
+
})([".ui-rc-pagination{border-bottom:1px solid #e0e0e0;border-top:1px solid #e0e0e0;margin:0;padding:.75rem 1rem;.ui-rc-pagination-total-text{order:2;margin-left:auto;}&::before{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:", ";bottom:0;left:0;}&::after{content:\"\";position:absolute;border-left:1px solid #e0e0e0;height:", ";bottom:0;visibility:visible;right:0;}}"], props => props.heightTable ? typeof props.heightTable === 'string' ? props.heightTable : `${props.heightTable}px` : undefined, props => props.heightTable ? `${props.heightTable}px` : undefined);
|
|
52
|
+
const InternalTable = props => {
|
|
53
|
+
const {
|
|
54
|
+
t,
|
|
55
|
+
columns: propsColumns,
|
|
56
|
+
lang,
|
|
57
|
+
dataSource,
|
|
58
|
+
allowResizing = true,
|
|
59
|
+
dataSourceFilter: propDataSourceFilter,
|
|
60
|
+
onFilterClick,
|
|
61
|
+
editAble,
|
|
62
|
+
...rest
|
|
63
|
+
} = props;
|
|
64
|
+
const locale = lang && lang === 'en' ? en : vi;
|
|
65
|
+
const buddhistLocale = {
|
|
66
|
+
...locale,
|
|
67
|
+
lang: {
|
|
68
|
+
...locale.lang
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const tableRef = useRef(null);
|
|
72
|
+
const [data, setData] = useState(dataSource);
|
|
73
|
+
const [columns, setColumns] = useState([]);
|
|
74
|
+
const [isManualUpdate, setIsManualUpdate] = useState(false);
|
|
75
|
+
const [dataSourceFilter, setDataSourceFilter] = useState(propDataSourceFilter ?? []);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
const rs = propsColumns ? [Table.SELECTION_COLUMN, ...propsColumns] : [];
|
|
78
|
+
setColumns(rs);
|
|
79
|
+
}, [propsColumns]);
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
if (!isManualUpdate) {
|
|
82
|
+
setData(dataSource || []);
|
|
83
|
+
}
|
|
84
|
+
setIsManualUpdate(false);
|
|
85
|
+
}, [dataSource]);
|
|
86
|
+
const handleSearch = (selectedKeys, confirm) => {
|
|
87
|
+
confirm();
|
|
88
|
+
};
|
|
89
|
+
const onFilterCallback = (key, filterDataCallback) => {
|
|
90
|
+
const find = dataSourceFilter.find(it => it.key === key);
|
|
91
|
+
if (find) {
|
|
92
|
+
const newData = updateArrayByKey(dataSourceFilter, {
|
|
93
|
+
key,
|
|
94
|
+
data: filterDataCallback
|
|
95
|
+
}, 'key');
|
|
96
|
+
setDataSourceFilter(newData);
|
|
97
|
+
} else {
|
|
98
|
+
const newData = [...dataSourceFilter, {
|
|
99
|
+
key,
|
|
100
|
+
data: filterDataCallback
|
|
101
|
+
}];
|
|
102
|
+
setDataSourceFilter(newData);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const getColumnSearchProps = useCallback(column => ({
|
|
106
|
+
filterDropdown: ({
|
|
107
|
+
setSelectedKeys,
|
|
108
|
+
selectedKeys,
|
|
109
|
+
confirm,
|
|
110
|
+
close,
|
|
111
|
+
setOperatorKey,
|
|
112
|
+
operatorKey,
|
|
113
|
+
visible,
|
|
114
|
+
searchValue,
|
|
115
|
+
setSearchValue
|
|
116
|
+
}) => {
|
|
117
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
118
|
+
style: {
|
|
119
|
+
padding: 8,
|
|
120
|
+
minWidth: 275
|
|
121
|
+
},
|
|
122
|
+
onKeyDown: e => e.stopPropagation()
|
|
123
|
+
}, (column?.showOperator !== false || column?.typeFilter !== 'DateRange' && column?.typeFilter !== 'NumberRange') && /*#__PURE__*/React.createElement("div", {
|
|
124
|
+
className: 'mb-1'
|
|
125
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
126
|
+
options: translateOption(numberOperator, t),
|
|
127
|
+
style: {
|
|
128
|
+
width: '100%',
|
|
129
|
+
marginBottom: 8
|
|
130
|
+
},
|
|
131
|
+
value: operatorKey,
|
|
132
|
+
onChange: val => {
|
|
133
|
+
setOperatorKey(val);
|
|
134
|
+
}
|
|
135
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
136
|
+
style: {
|
|
137
|
+
marginBottom: 8
|
|
138
|
+
}
|
|
139
|
+
}, renderFilter(column, selectedKeys, setSelectedKeys, confirm, visible, searchValue, setSearchValue, dataSourceFilter, buddhistLocale)), /*#__PURE__*/React.createElement(Space, {
|
|
140
|
+
style: {
|
|
141
|
+
justifyContent: 'end',
|
|
142
|
+
width: '100%'
|
|
143
|
+
}
|
|
144
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
145
|
+
type: "primary",
|
|
146
|
+
onClick: () => {
|
|
147
|
+
confirm({
|
|
148
|
+
closeDropdown: false
|
|
149
|
+
});
|
|
150
|
+
handleSearch(selectedKeys, confirm);
|
|
151
|
+
},
|
|
152
|
+
icon: /*#__PURE__*/React.createElement(SearchOutlined, null),
|
|
153
|
+
size: "small",
|
|
154
|
+
style: {
|
|
155
|
+
width: 90
|
|
156
|
+
}
|
|
157
|
+
}, "Filter"), /*#__PURE__*/React.createElement(Button, {
|
|
158
|
+
type: "link",
|
|
159
|
+
size: "small",
|
|
160
|
+
onClick: () => {
|
|
161
|
+
close();
|
|
162
|
+
}
|
|
163
|
+
}, "close")));
|
|
164
|
+
},
|
|
165
|
+
filterIcon: filtered => /*#__PURE__*/React.createElement(FilterFill, {
|
|
166
|
+
fontSize: 12,
|
|
167
|
+
onClick: () => {
|
|
168
|
+
onFilterClick?.(column, onFilterCallback);
|
|
169
|
+
},
|
|
170
|
+
style: {
|
|
171
|
+
color: filtered ? '#283046' : undefined
|
|
172
|
+
}
|
|
173
|
+
}),
|
|
174
|
+
filterDropdownProps: {
|
|
175
|
+
onOpenChange(open) {
|
|
176
|
+
if (open) {
|
|
177
|
+
// setTimeout(() => searchInput.current?.select(), 100)
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}), [onFilterCallback, onFilterClick, renderFilter, t]);
|
|
182
|
+
const handleResize = indexPath => (e, {
|
|
183
|
+
size
|
|
184
|
+
}) => {
|
|
185
|
+
const updateColumns = (cols, path) => {
|
|
186
|
+
const [currentIndex, ...restPath] = path;
|
|
187
|
+
return cols.map((col, idx) => {
|
|
188
|
+
if (idx === currentIndex) {
|
|
189
|
+
if (restPath.length === 0) {
|
|
190
|
+
// Cập nhật width của cột cuối cùng trong path
|
|
191
|
+
// return { ...col, width: size.width }
|
|
192
|
+
|
|
193
|
+
// Kiểm tra minWidth trước khi cập nhật width
|
|
194
|
+
if (col.minWidth && size.width < col.minWidth) {
|
|
195
|
+
e.preventDefault();
|
|
196
|
+
return col; // Không cập nhật nếu nhỏ hơn minWidth
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Kiểm tra minWidth trước khi cập nhật width
|
|
200
|
+
if (col.maxWidth && size.width > col.maxWidth) {
|
|
201
|
+
e.preventDefault();
|
|
202
|
+
return col; // Không cập nhật nếu nhỏ hơn minWidth
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
...col,
|
|
206
|
+
width: size.width
|
|
207
|
+
};
|
|
208
|
+
} else if (col.children) {
|
|
209
|
+
// Tiếp tục cập nhật các cấp con
|
|
210
|
+
return {
|
|
211
|
+
...col,
|
|
212
|
+
children: updateColumns(col.children, restPath)
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
// e.preventDefault()
|
|
217
|
+
return col;
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
setColumns(prevColumns => updateColumns(prevColumns, indexPath));
|
|
221
|
+
};
|
|
222
|
+
const transformColumns = React.useCallback((cols, parentPath = []) => {
|
|
223
|
+
return cols.map((col, index) => {
|
|
224
|
+
const currentPath = [...parentPath, index];
|
|
225
|
+
// @ts-ignore
|
|
226
|
+
if (!col?.dataIndex && !col.key) {
|
|
227
|
+
return col;
|
|
228
|
+
}
|
|
229
|
+
if (col.children) {
|
|
230
|
+
return {
|
|
231
|
+
...col,
|
|
232
|
+
title: col.headerText ?? col.title,
|
|
233
|
+
ellipsis: col.ellipsis !== false,
|
|
234
|
+
children: transformColumns(col.children, currentPath)
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
if (col.dataIndex === 'index' || col.field === 'index' || col.dataIndex === '#' || col.dataIndex === '#') {
|
|
238
|
+
return {
|
|
239
|
+
...col,
|
|
240
|
+
title: col.headerText ?? col.title,
|
|
241
|
+
ellipsis: col.ellipsis !== false
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
return {
|
|
245
|
+
...getColumnSearchProps(col),
|
|
246
|
+
...col,
|
|
247
|
+
title: col.headerText ?? col.title,
|
|
248
|
+
ellipsis: col.ellipsis !== false,
|
|
249
|
+
onFilter: (value, record) => {
|
|
250
|
+
// @ts-ignore
|
|
251
|
+
return record[column?.dataIndex];
|
|
252
|
+
},
|
|
253
|
+
onHeaderCell: () => ({
|
|
254
|
+
width: col.width,
|
|
255
|
+
onResize: handleResize(currentPath)
|
|
256
|
+
})
|
|
257
|
+
};
|
|
258
|
+
});
|
|
259
|
+
}, [getColumnSearchProps]);
|
|
260
|
+
const mergedColumns = React.useMemo(() => {
|
|
261
|
+
return transformColumns(columns);
|
|
262
|
+
}, [transformColumns, columns]);
|
|
263
|
+
const TableComponent = editAble ? GridEdit : Grid;
|
|
264
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(GridStyle, {
|
|
265
|
+
heightTable: props.style?.minHeight,
|
|
266
|
+
style: {
|
|
267
|
+
position: 'relative'
|
|
268
|
+
}
|
|
269
|
+
}, /*#__PURE__*/React.createElement(TableComponent, _extends({}, rest, {
|
|
270
|
+
tableRef: tableRef,
|
|
271
|
+
dataSource: data,
|
|
272
|
+
components: {
|
|
273
|
+
header: {
|
|
274
|
+
cell: allowResizing ? ResizableTitle : undefined
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
columns: mergedColumns,
|
|
278
|
+
showSorterTooltip: {
|
|
279
|
+
target: 'sorter-icon'
|
|
280
|
+
}
|
|
281
|
+
}))));
|
|
282
|
+
};
|
|
283
|
+
export default InternalTable;
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
const SpinnerStyle = styled.div.withConfig({
|
|
4
4
|
displayName: "SpinnerStyle",
|
|
5
|
-
componentId: "es-grid-template__sc-
|
|
5
|
+
componentId: "es-grid-template__sc-jrz5mo-0"
|
|
6
6
|
})(["width:1em;height:1em;font-size:20px;display:inline-block;transition:transform 0.3s ease,opacity 0.3s ease;transform-origin:50% 50%;line-height:1;.loading{position:absolute;top:50%;inset-inline-start:50%;margin:-10px;width:55px;height:55px;border-radius:50%;border:3px solid transparent;-webkit-box-sizing:border-box;box-sizing:border-box;.effect-1,.effect-2,.effect-3{width:36px;height:36px;border-radius:50%;border:3px solid transparent;border-left:3px solid #eb4619;-webkit-box-sizing:border-box;box-sizing:border-box;}.effect-1{position:absolute;animation:rotate 1s ease infinite;}.effect-2{position:absolute;animation:rotateOpacity 1s ease infinite 0.1s;}.effect-3{-webkit-animation:rotateOpacity 1s ease infinite 0.2s;animation:rotateOpacity 1s ease infinite 0.2s;}.loading .effects{transition:all 0.3s ease;}}@keyframes rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg);}100%{-webkit-transform:rotate(1turn);transform:rotate(1turn);}}@keyframes rotateOpacity{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg);opacity:0.1;}100%{-webkit-transform:rotate(1turn);transform:rotate(1turn);opacity:1;}}"]);
|
|
7
7
|
const ComponentSpinner = () => {
|
|
8
8
|
return /*#__PURE__*/React.createElement(SpinnerStyle, {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { Fragment } from "react";
|
|
2
|
+
import toast from "react-hot-toast";
|
|
3
|
+
const Message = param => {
|
|
4
|
+
return toast.success( /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
5
|
+
className: "toastify-header"
|
|
6
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
7
|
+
className: "title-wrapper"
|
|
8
|
+
}, /*#__PURE__*/React.createElement("h6", {
|
|
9
|
+
className: "toast-title"
|
|
10
|
+
}, param))), /*#__PURE__*/React.createElement("div", {
|
|
11
|
+
className: "toastify-body"
|
|
12
|
+
}, /*#__PURE__*/React.createElement("ul", {
|
|
13
|
+
className: "list-unstyled mb-0"
|
|
14
|
+
}, /*#__PURE__*/React.createElement("li", null)))));
|
|
15
|
+
};
|
|
16
|
+
export default Message;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Message";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Message";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import 'dayjs/locale/es';
|
|
3
3
|
import 'dayjs/locale/vi';
|
|
4
|
-
import './styles.scss';
|
|
5
4
|
import type { GridTableProps } from "./type";
|
|
6
5
|
type GridProps<T> = GridTableProps<T> & {
|
|
7
|
-
setColumns
|
|
6
|
+
setColumns?: any;
|
|
7
|
+
tableRef: any;
|
|
8
8
|
};
|
|
9
9
|
declare const TableGrid: <RecordType extends object>(props: GridProps<RecordType>) => React.JSX.Element;
|
|
10
10
|
export default TableGrid;
|