es-grid-template 1.8.65 → 1.8.66
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/TempTable.d.ts +2 -2
- package/es/grid-component/TempTable.js +3 -3
- package/es/grid-component/hooks/index.js +0 -1
- package/es/grid-component/hooks/useLazyKVMap.d.ts +1 -1
- package/es/grid-component/hooks/useLazyKVMap.js +0 -4
- package/es/grid-component/hooks/utils.d.ts +3 -4
- package/es/grid-component/hooks/utils.js +2 -1
- package/es/grid-component/styles.scss +1394 -1394
- package/es/grid-component/type.d.ts +0 -414
- package/es/grid-component/type.js +490 -1
- package/es/table-component/type.d.ts +2 -0
- package/es/table-virtuoso/ColumnsGroup/ColumnsGroup.js +1 -3
- package/es/table-virtuoso/InternalTable.js +6 -28
- package/es/table-virtuoso/body/TableBodyCell.js +0 -9
- package/es/table-virtuoso/body/TableBodyRow.js +0 -4
- package/es/table-virtuoso/style.js +2 -1
- package/es/table-virtuoso/style.scss +2 -1
- package/es/table-virtuoso/table/Grid.js +0 -4
- package/es/table-virtuoso/table/TableContainer.js +31 -44
- package/es/table-virtuoso/table/TableWrapper.d.ts +2 -0
- package/es/table-virtuoso/table/TableWrapper.js +5 -2
- package/lib/grid-component/TempTable.d.ts +2 -2
- package/lib/grid-component/TempTable.js +3 -5
- package/lib/grid-component/hooks/useLazyKVMap.d.ts +1 -1
- package/lib/grid-component/hooks/useLazyKVMap.js +0 -3
- package/lib/grid-component/hooks/utils.d.ts +3 -4
- package/lib/grid-component/hooks/utils.js +3 -0
- package/lib/grid-component/styles.scss +1394 -1394
- package/lib/grid-component/type.d.ts +0 -414
- package/lib/grid-component/type.js +490 -4
- package/lib/table-component/type.d.ts +2 -0
- package/lib/table-virtuoso/ColumnsGroup/ColumnsGroup.js +1 -3
- package/lib/table-virtuoso/InternalTable.js +6 -28
- package/lib/table-virtuoso/body/TableBodyCell.js +0 -9
- package/lib/table-virtuoso/body/TableBodyRow.js +0 -5
- package/lib/table-virtuoso/style.js +2 -1
- package/lib/table-virtuoso/style.scss +2 -1
- package/lib/table-virtuoso/table/Grid.js +0 -4
- package/lib/table-virtuoso/table/TableContainer.js +29 -42
- package/lib/table-virtuoso/table/TableWrapper.d.ts +2 -0
- package/lib/table-virtuoso/table/TableWrapper.js +4 -2
- package/package.json +1 -1
- package/es/grid-component/AdvanceFilter.d.ts +0 -14
- package/es/grid-component/AdvanceFilter.js +0 -454
- package/es/grid-component/CheckboxFilter.d.ts +0 -20
- package/es/grid-component/CheckboxFilter.js +0 -244
- package/es/grid-component/CheckboxFilter2.d.ts +0 -20
- package/es/grid-component/CheckboxFilter2.js +0 -244
- package/es/grid-component/ColumnsChoose.d.ts +0 -10
- package/es/grid-component/ColumnsChoose.js +0 -230
- package/es/grid-component/ColumnsGroup/ColumnsGroup.d.ts +0 -12
- package/es/grid-component/ColumnsGroup/ColumnsGroup.js +0 -232
- package/es/grid-component/ColumnsGroup/index.d.ts +0 -1
- package/es/grid-component/ColumnsGroup/index.js +0 -1
- package/es/grid-component/Command.d.ts +0 -8
- package/es/grid-component/Command.js +0 -80
- package/es/grid-component/ContextMenu.d.ts +0 -20
- package/es/grid-component/ContextMenu.js +0 -130
- package/es/grid-component/EditForm/EditForm.d.ts +0 -27
- package/es/grid-component/EditForm/EditForm.js +0 -394
- package/es/grid-component/EditForm/index.d.ts +0 -1
- package/es/grid-component/EditForm/index.js +0 -1
- package/es/grid-component/EditableCell.d.ts +0 -20
- package/es/grid-component/EditableCell.js +0 -1030
- package/es/grid-component/FilterSearch.d.ts +0 -12
- package/es/grid-component/FilterSearch.js +0 -33
- package/es/grid-component/GridStyle.d.ts +0 -8
- package/es/grid-component/GridStyle.js +0 -5
- package/es/grid-component/TableGrid.d.ts +0 -21
- package/es/grid-component/TableGrid.js +0 -493
- package/es/grid-component/async-select/index.d.ts +0 -11
- package/es/grid-component/async-select/index.js +0 -38
- package/es/grid-component/async-table-select/index.d.ts +0 -11
- package/es/grid-component/async-table-select/index.js +0 -40
- package/es/grid-component/checkbox-control/index.d.ts +0 -13
- package/es/grid-component/checkbox-control/index.js +0 -40
- package/es/grid-component/hooks/columns/index.d.ts +0 -10
- package/es/grid-component/hooks/columns/index.js +0 -503
- package/es/grid-component/hooks/content/ControlCheckbox.d.ts +0 -13
- package/es/grid-component/hooks/content/ControlCheckbox.js +0 -87
- package/es/grid-component/hooks/content/HeaderContent.d.ts +0 -14
- package/es/grid-component/hooks/content/HeaderContent.js +0 -44
- package/es/grid-component/hooks/content/TooltipContent.d.ts +0 -13
- package/es/grid-component/hooks/content/TooltipContent.js +0 -74
- package/es/grid-component/hooks/useColumns.d.ts +0 -19
- package/es/grid-component/hooks/useColumns.js +0 -317
- package/es/grid-component/number/index.d.ts +0 -10
- package/es/grid-component/number/index.js +0 -39
- package/es/grid-component/number-range/index.d.ts +0 -11
- package/es/grid-component/number-range/index.js +0 -63
- package/es/grid-component/useContext.d.ts +0 -34
- package/es/grid-component/useContext.js +0 -8
- package/es/table-virtuoso/body/TableBody.d.ts +0 -14
- package/es/table-virtuoso/body/TableBody.js +0 -84
- package/lib/grid-component/AdvanceFilter.d.ts +0 -14
- package/lib/grid-component/AdvanceFilter.js +0 -463
- package/lib/grid-component/CheckboxFilter.d.ts +0 -20
- package/lib/grid-component/CheckboxFilter.js +0 -253
- package/lib/grid-component/CheckboxFilter2.d.ts +0 -20
- package/lib/grid-component/CheckboxFilter2.js +0 -253
- package/lib/grid-component/ColumnsChoose.d.ts +0 -10
- package/lib/grid-component/ColumnsChoose.js +0 -240
- package/lib/grid-component/ColumnsGroup/ColumnsGroup.d.ts +0 -12
- package/lib/grid-component/ColumnsGroup/ColumnsGroup.js +0 -243
- package/lib/grid-component/ColumnsGroup/index.d.ts +0 -1
- package/lib/grid-component/ColumnsGroup/index.js +0 -16
- package/lib/grid-component/Command.d.ts +0 -8
- package/lib/grid-component/Command.js +0 -88
- package/lib/grid-component/ContextMenu.d.ts +0 -20
- package/lib/grid-component/ContextMenu.js +0 -140
- package/lib/grid-component/EditForm/EditForm.d.ts +0 -27
- package/lib/grid-component/EditForm/EditForm.js +0 -404
- package/lib/grid-component/EditForm/index.d.ts +0 -1
- package/lib/grid-component/EditForm/index.js +0 -16
- package/lib/grid-component/EditableCell.d.ts +0 -20
- package/lib/grid-component/EditableCell.js +0 -1032
- package/lib/grid-component/FilterSearch.d.ts +0 -12
- package/lib/grid-component/FilterSearch.js +0 -42
- package/lib/grid-component/GridStyle.d.ts +0 -8
- package/lib/grid-component/GridStyle.js +0 -12
- package/lib/grid-component/TableGrid.d.ts +0 -21
- package/lib/grid-component/TableGrid.js +0 -493
- package/lib/grid-component/async-select/index.d.ts +0 -11
- package/lib/grid-component/async-select/index.js +0 -47
- package/lib/grid-component/async-table-select/index.d.ts +0 -11
- package/lib/grid-component/async-table-select/index.js +0 -49
- package/lib/grid-component/checkbox-control/index.d.ts +0 -13
- package/lib/grid-component/checkbox-control/index.js +0 -48
- package/lib/grid-component/hooks/columns/index.d.ts +0 -10
- package/lib/grid-component/hooks/columns/index.js +0 -518
- package/lib/grid-component/hooks/content/ControlCheckbox.d.ts +0 -13
- package/lib/grid-component/hooks/content/ControlCheckbox.js +0 -95
- package/lib/grid-component/hooks/content/HeaderContent.d.ts +0 -14
- package/lib/grid-component/hooks/content/HeaderContent.js +0 -53
- package/lib/grid-component/hooks/content/TooltipContent.d.ts +0 -13
- package/lib/grid-component/hooks/content/TooltipContent.js +0 -81
- package/lib/grid-component/hooks/useColumns.d.ts +0 -19
- package/lib/grid-component/hooks/useColumns.js +0 -328
- package/lib/grid-component/number/index.d.ts +0 -10
- package/lib/grid-component/number/index.js +0 -47
- package/lib/grid-component/number-range/index.d.ts +0 -11
- package/lib/grid-component/number-range/index.js +0 -71
- package/lib/grid-component/useContext.d.ts +0 -34
- package/lib/grid-component/useContext.js +0 -13
- package/lib/table-virtuoso/body/TableBody.d.ts +0 -14
- package/lib/table-virtuoso/body/TableBody.js +0 -95
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
// import type { MenuProps } from "antd";
|
|
3
|
-
import { Dropdown, Menu } from "rc-master-ui";
|
|
4
|
-
export const findItemByKey = (array, key, value) => {
|
|
5
|
-
for (let i = 0; i < array.length; i++) {
|
|
6
|
-
const item = array[i];
|
|
7
|
-
if (item[key] === value) {
|
|
8
|
-
return item;
|
|
9
|
-
}
|
|
10
|
-
if (item.children && item.children.length > 0) {
|
|
11
|
-
const foundInChildren = findItemByKey(item.children, key, value);
|
|
12
|
-
if (foundInChildren) {
|
|
13
|
-
return foundInChildren;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return null;
|
|
18
|
-
};
|
|
19
|
-
const ContextMenu = props => {
|
|
20
|
-
const {
|
|
21
|
-
menuRef,
|
|
22
|
-
open,
|
|
23
|
-
setOpen,
|
|
24
|
-
pos,
|
|
25
|
-
contextMenuClick,
|
|
26
|
-
contextMenuItems,
|
|
27
|
-
rowData
|
|
28
|
-
} = props;
|
|
29
|
-
|
|
30
|
-
// const addPopupOffset = (items: MenuProps["items"]) : any => {
|
|
31
|
-
// return items?.map(item =>
|
|
32
|
-
// item && "children" in item
|
|
33
|
-
// ? {
|
|
34
|
-
// ...item,
|
|
35
|
-
// // popupOffset: [0, 30],
|
|
36
|
-
// children: addPopupOffset(item.children) }
|
|
37
|
-
// : item
|
|
38
|
-
// );
|
|
39
|
-
// };
|
|
40
|
-
|
|
41
|
-
// const newItems = React.useMemo(() => {
|
|
42
|
-
// return addPopupOffset(items)
|
|
43
|
-
// }, [items])
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
/*#__PURE__*/
|
|
47
|
-
// <div>
|
|
48
|
-
// {open && (
|
|
49
|
-
// <div
|
|
50
|
-
// ref={menuRef}
|
|
51
|
-
// style={{
|
|
52
|
-
// position: "absolute",
|
|
53
|
-
// top: pos.y,
|
|
54
|
-
// left: pos.x,
|
|
55
|
-
// zIndex: 1000,
|
|
56
|
-
// background: "white",
|
|
57
|
-
// border: "1px solid #ddd",
|
|
58
|
-
// boxShadow: "2px 2px 5px rgba(0,0,0,0.2)",
|
|
59
|
-
// }}
|
|
60
|
-
// // onClick={() => setOpen(false)}
|
|
61
|
-
// >
|
|
62
|
-
// <Menu
|
|
63
|
-
// items={contextMenuItems}
|
|
64
|
-
// style={{ minWidth: 200, maxWidth: 400, maxHeight: pos.viewportHeight - 20 , width: 200 }}
|
|
65
|
-
// rootClassName={'popup-context-menu'}
|
|
66
|
-
//
|
|
67
|
-
// onClick={(e) => {
|
|
68
|
-
// contextMenuClick?.({
|
|
69
|
-
// rowInfo: {
|
|
70
|
-
// rowData
|
|
71
|
-
// },
|
|
72
|
-
// event: e.domEvent,
|
|
73
|
-
// item: {
|
|
74
|
-
// ...findItemByKey(contextMenuItems as any[], 'key', e.key ),
|
|
75
|
-
// id: e.key
|
|
76
|
-
// }
|
|
77
|
-
// })
|
|
78
|
-
// }} >
|
|
79
|
-
// </Menu>
|
|
80
|
-
// </div>
|
|
81
|
-
// )}
|
|
82
|
-
// </div>
|
|
83
|
-
React.createElement(Dropdown, {
|
|
84
|
-
placement: 'topRight',
|
|
85
|
-
open: open,
|
|
86
|
-
overlayClassName: 'be-popup-container',
|
|
87
|
-
overlayStyle: {
|
|
88
|
-
left: `${pos.x}px`,
|
|
89
|
-
top: `${pos.y}px`
|
|
90
|
-
},
|
|
91
|
-
dropdownRender: () => {
|
|
92
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
93
|
-
ref: menuRef
|
|
94
|
-
}, /*#__PURE__*/React.createElement(Menu, {
|
|
95
|
-
items: contextMenuItems,
|
|
96
|
-
style: {
|
|
97
|
-
minWidth: 200,
|
|
98
|
-
maxHeight: pos.viewportHeight - 20,
|
|
99
|
-
width: 'fit-content'
|
|
100
|
-
},
|
|
101
|
-
rootClassName: 'popup-context-menu'
|
|
102
|
-
// rootClassName={'be-popup-container'}
|
|
103
|
-
,
|
|
104
|
-
|
|
105
|
-
onClick: e => {
|
|
106
|
-
setOpen(false);
|
|
107
|
-
contextMenuClick?.({
|
|
108
|
-
rowInfo: {
|
|
109
|
-
rowData
|
|
110
|
-
},
|
|
111
|
-
event: e.domEvent,
|
|
112
|
-
item: {
|
|
113
|
-
...findItemByKey(contextMenuItems, 'key', e.key),
|
|
114
|
-
id: e.key
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
// if (!open) {
|
|
119
|
-
// document.addEventListener(`click`, function onClickOutside() {
|
|
120
|
-
// setOpen(false);
|
|
121
|
-
// document.removeEventListener(`click`, onClickOutside);
|
|
122
|
-
// });
|
|
123
|
-
// }
|
|
124
|
-
}
|
|
125
|
-
}));
|
|
126
|
-
}
|
|
127
|
-
}, /*#__PURE__*/React.createElement(React.Fragment, null))
|
|
128
|
-
);
|
|
129
|
-
};
|
|
130
|
-
export default ContextMenu;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
type Props = {
|
|
3
|
-
id?: string;
|
|
4
|
-
externalClick?: any;
|
|
5
|
-
menuPortalTarget?: any;
|
|
6
|
-
value: any;
|
|
7
|
-
onChange: (props: any) => void;
|
|
8
|
-
filterKey?: string;
|
|
9
|
-
customRender?: any;
|
|
10
|
-
filterHeaderKey?: string;
|
|
11
|
-
placeholder?: string;
|
|
12
|
-
invalid?: any;
|
|
13
|
-
menuHeight?: number;
|
|
14
|
-
menuWidth?: number;
|
|
15
|
-
classNamePrefix?: string;
|
|
16
|
-
cellFocus?: boolean;
|
|
17
|
-
t?: any;
|
|
18
|
-
column: any;
|
|
19
|
-
fieldKey?: any;
|
|
20
|
-
rowData: any;
|
|
21
|
-
indexRow: any;
|
|
22
|
-
template?: any;
|
|
23
|
-
onKeyDown?: (event: any) => void;
|
|
24
|
-
};
|
|
25
|
-
export declare const SelectStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
26
|
-
export declare const EditForm: (props: Props) => React.JSX.Element;
|
|
27
|
-
export {};
|
|
@@ -1,394 +0,0 @@
|
|
|
1
|
-
import React, { Fragment, useRef } from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
|
-
import { useForm } from "react-hook-form";
|
|
4
|
-
import { yupResolver } from "@hookform/resolvers/yup";
|
|
5
|
-
import { Col, Row } from "rc-master-ui/es/grid";
|
|
6
|
-
import InputControl from "../control/InputControl/InputControl";
|
|
7
|
-
import { isNullOrUndefined, isObjEmpty } from "../hooks";
|
|
8
|
-
import { Input } from "rc-master-ui";
|
|
9
|
-
import { Dropdown } from "antd";
|
|
10
|
-
import Divider from "rc-master-ui/es/divider";
|
|
11
|
-
import Button from "rc-master-ui/es/button";
|
|
12
|
-
export const SelectStyle = styled.div.withConfig({
|
|
13
|
-
displayName: "SelectStyle",
|
|
14
|
-
componentId: "es-grid-template__sc-7ba05m-0"
|
|
15
|
-
})(["width:100%;&.be-select{.input-group-merge{flex-wrap:nowrap;}}"]);
|
|
16
|
-
export const EditForm = props => {
|
|
17
|
-
const {
|
|
18
|
-
id,
|
|
19
|
-
// menuPortalTarget,
|
|
20
|
-
value,
|
|
21
|
-
fieldKey,
|
|
22
|
-
placeholder,
|
|
23
|
-
// invalid,
|
|
24
|
-
menuHeight,
|
|
25
|
-
menuWidth,
|
|
26
|
-
// classNamePrefix,
|
|
27
|
-
onChange,
|
|
28
|
-
rowData,
|
|
29
|
-
// onKeyDown,
|
|
30
|
-
t,
|
|
31
|
-
cellFocus,
|
|
32
|
-
column
|
|
33
|
-
} = props;
|
|
34
|
-
const formRef = useRef();
|
|
35
|
-
const divRef = useRef(null);
|
|
36
|
-
const inputRef = useRef(null);
|
|
37
|
-
const defaultValue = !isNullOrUndefined(value) ? column?.editFromSettings?.formatLabel ? column?.editFromSettings?.formatLabel(value) : value[fieldKey] : '';
|
|
38
|
-
const {
|
|
39
|
-
control,
|
|
40
|
-
handleSubmit,
|
|
41
|
-
getValues,
|
|
42
|
-
reset,
|
|
43
|
-
setValue,
|
|
44
|
-
setError,
|
|
45
|
-
formState: {
|
|
46
|
-
errors
|
|
47
|
-
}
|
|
48
|
-
} = useForm({
|
|
49
|
-
mode: 'onChange',
|
|
50
|
-
defaultValues: column.editFromSettings?.defaultValues,
|
|
51
|
-
resolver: column.editFromSettings?.schema ? yupResolver(column.editFromSettings?.schema) : undefined
|
|
52
|
-
});
|
|
53
|
-
const handleToggle = () => {
|
|
54
|
-
divRef?.current?.click(); // Giả lập click vào nút để mở dropdown
|
|
55
|
-
};
|
|
56
|
-
React.useEffect(() => {
|
|
57
|
-
if (cellFocus) {
|
|
58
|
-
handleToggle();
|
|
59
|
-
}
|
|
60
|
-
}, [cellFocus]);
|
|
61
|
-
const handleOnSubmit = val => {
|
|
62
|
-
handleToggle();
|
|
63
|
-
onChange(val);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// const handleOnKeyDown = (e: any) => {
|
|
67
|
-
//
|
|
68
|
-
// if (dropdownOpen) {
|
|
69
|
-
// e.preventDefault()
|
|
70
|
-
//
|
|
71
|
-
// if (e.code === 'Tab') {
|
|
72
|
-
// e.stopPropagation()
|
|
73
|
-
// const formElement = document.getElementById('edit-form')
|
|
74
|
-
//
|
|
75
|
-
// if (formElement) {
|
|
76
|
-
//
|
|
77
|
-
// formElement.getElementsByTagName('input')[0]?.focus()
|
|
78
|
-
//
|
|
79
|
-
// }
|
|
80
|
-
//
|
|
81
|
-
// }
|
|
82
|
-
//
|
|
83
|
-
// if (e.code === "Escape") {
|
|
84
|
-
// e.preventDefault()
|
|
85
|
-
// e.stopPropagation()
|
|
86
|
-
// return e
|
|
87
|
-
// }
|
|
88
|
-
//
|
|
89
|
-
// const formElement = document.getElementById('edit-form')
|
|
90
|
-
//
|
|
91
|
-
// if (formElement) {
|
|
92
|
-
//
|
|
93
|
-
// formElement.getElementsByTagName('input')[0]?.focus()
|
|
94
|
-
//
|
|
95
|
-
// }
|
|
96
|
-
// return e.code
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
// } else {
|
|
100
|
-
// if (e.code === 'ArrowDown') {
|
|
101
|
-
// e.preventDefault()
|
|
102
|
-
//
|
|
103
|
-
// setTimeout(() => {
|
|
104
|
-
// const formElement = document.getElementById('edit-form')
|
|
105
|
-
// if (formElement) {
|
|
106
|
-
// formElement.getElementsByTagName('input')[0]?.focus()
|
|
107
|
-
//
|
|
108
|
-
// }
|
|
109
|
-
//
|
|
110
|
-
// }, 100)
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
// }
|
|
114
|
-
// }
|
|
115
|
-
//
|
|
116
|
-
// if (onKeyDown) {
|
|
117
|
-
// onKeyDown(e)
|
|
118
|
-
// }
|
|
119
|
-
//
|
|
120
|
-
//
|
|
121
|
-
// }
|
|
122
|
-
//
|
|
123
|
-
|
|
124
|
-
const handleOnFocus = e => {
|
|
125
|
-
e.target.setSelectionRange(0, e.target.innerText.length - 1);
|
|
126
|
-
};
|
|
127
|
-
const formItemKeyDown = (e, index, length) => {
|
|
128
|
-
if (e.code === 'Tab' || e.code === 'ArrowDown') {
|
|
129
|
-
const itemElement = document.getElementById(`edit-form-${index + 1}`);
|
|
130
|
-
if (itemElement && index < length) {
|
|
131
|
-
if (itemElement.className.includes('be-select')) {
|
|
132
|
-
itemElement.getElementsByTagName('input')[0]?.focus();
|
|
133
|
-
} else {
|
|
134
|
-
itemElement.focus();
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
e.preventDefault();
|
|
138
|
-
}
|
|
139
|
-
if (e.code === 'ArrowUp') {
|
|
140
|
-
const itemElement = document.getElementById(`edit-form-${index - 1}`);
|
|
141
|
-
if (itemElement && index !== 0) {
|
|
142
|
-
if (itemElement.className.includes('be-select')) {
|
|
143
|
-
itemElement.getElementsByTagName('input')[0]?.focus();
|
|
144
|
-
} else {
|
|
145
|
-
itemElement.focus();
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
e.preventDefault();
|
|
149
|
-
}
|
|
150
|
-
if (e.code === 'Enter') {
|
|
151
|
-
if (isObjEmpty(errors)) {
|
|
152
|
-
const rs = getValues();
|
|
153
|
-
if (column.editFromSettings?.schema) {
|
|
154
|
-
column.editFromSettings?.schema.validate(rs, {
|
|
155
|
-
abortEarly: false
|
|
156
|
-
}).then(() => {
|
|
157
|
-
handleToggle();
|
|
158
|
-
onChange(rs);
|
|
159
|
-
if (column.editFromSettings && column?.editFromSettings?.formClose) {
|
|
160
|
-
column?.editFromSettings?.formClose({
|
|
161
|
-
value,
|
|
162
|
-
setValue,
|
|
163
|
-
getValues,
|
|
164
|
-
reset
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
if (inputRef) {
|
|
168
|
-
inputRef.current.focus();
|
|
169
|
-
}
|
|
170
|
-
}).catch(err => {
|
|
171
|
-
e.preventDefault();
|
|
172
|
-
e.stopPropagation();
|
|
173
|
-
err.inner.forEach(error => {
|
|
174
|
-
setError(error.path ? error.path : '', {
|
|
175
|
-
type: "manual",
|
|
176
|
-
message: error.message
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
} else {
|
|
182
|
-
e.preventDefault();
|
|
183
|
-
e.stopPropagation();
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
// const checkErrors = () => {
|
|
189
|
-
//
|
|
190
|
-
//
|
|
191
|
-
// if (isObjEmpty(errors)) {
|
|
192
|
-
// const rs = getValues()
|
|
193
|
-
// if (column.editFromSettings?.schema) {
|
|
194
|
-
// column.editFromSettings?.schema.validate(rs, { abortEarly: false })
|
|
195
|
-
// .then(() => {
|
|
196
|
-
// handleToggle()
|
|
197
|
-
// onChange(rs)
|
|
198
|
-
//
|
|
199
|
-
// if (column.editFromSettings && column?.editFromSettings?.formClose) {
|
|
200
|
-
// column?.editFromSettings?.formClose({value, setValue, getValues, reset})
|
|
201
|
-
// }
|
|
202
|
-
// if (inputRef) {
|
|
203
|
-
// inputRef.current.focus()
|
|
204
|
-
// }
|
|
205
|
-
// })
|
|
206
|
-
// .catch((err: ValidationError) => {
|
|
207
|
-
//
|
|
208
|
-
// err.inner.forEach((error: ValidationError) => {
|
|
209
|
-
//
|
|
210
|
-
// setError(error.path ? error.path : '', {
|
|
211
|
-
// type: "manual",
|
|
212
|
-
// message: error.message
|
|
213
|
-
// })
|
|
214
|
-
// })
|
|
215
|
-
// })
|
|
216
|
-
// }
|
|
217
|
-
//
|
|
218
|
-
//
|
|
219
|
-
// } else {
|
|
220
|
-
//
|
|
221
|
-
// }
|
|
222
|
-
// }
|
|
223
|
-
|
|
224
|
-
const handleFormKeydown = e => {
|
|
225
|
-
// if (dropdownOpen) {
|
|
226
|
-
|
|
227
|
-
if (e.code === 'Tab' || e.code === 'ArrowUp' || e.code === 'ArrowDown') {
|
|
228
|
-
e.preventDefault();
|
|
229
|
-
e.stopPropagation();
|
|
230
|
-
// if (formElement && indexRowForm <= totalRowFrom) {
|
|
231
|
-
// setIndexRowForm((prevState) => prevState + 1)
|
|
232
|
-
// formElement.getElementsByTagName('input')[indexRowForm + 1]?.focus()
|
|
233
|
-
// }
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
// if (e.code === 'Enter') {
|
|
237
|
-
// const rs = getValues()
|
|
238
|
-
//
|
|
239
|
-
//
|
|
240
|
-
// onChange(rs)
|
|
241
|
-
//
|
|
242
|
-
// if (column.editFromSettings && column?.editFromSettings?.formClose) {
|
|
243
|
-
// column?.editFromSettings?.formClose({value, setValue, getValues, reset})
|
|
244
|
-
// }
|
|
245
|
-
// if (inputRef) {
|
|
246
|
-
// inputRef.current.focus()
|
|
247
|
-
// }
|
|
248
|
-
//
|
|
249
|
-
// e.preventDefault()
|
|
250
|
-
// e.stopPropagation()
|
|
251
|
-
// }
|
|
252
|
-
|
|
253
|
-
if (e.code === "Escape") {
|
|
254
|
-
handleToggle();
|
|
255
|
-
if (inputRef) {
|
|
256
|
-
inputRef.current.focus();
|
|
257
|
-
}
|
|
258
|
-
e.preventDefault();
|
|
259
|
-
e.stopPropagation();
|
|
260
|
-
}
|
|
261
|
-
return e.code;
|
|
262
|
-
// }
|
|
263
|
-
};
|
|
264
|
-
const renderForm = rows => {
|
|
265
|
-
return /*#__PURE__*/React.createElement(Row, {
|
|
266
|
-
gutter: [0, 10]
|
|
267
|
-
}, rows.map((item, index) => {
|
|
268
|
-
return /*#__PURE__*/React.createElement(Col, {
|
|
269
|
-
key: `${index}`,
|
|
270
|
-
xl: column.editFromSettings?.layout?.xl ? column.editFromSettings?.layout?.xl : 24,
|
|
271
|
-
lg: column.editFromSettings?.layout?.lg ? column.editFromSettings?.layout?.lg : 24,
|
|
272
|
-
md: column.editFromSettings?.layout?.md ? column.editFromSettings?.layout?.md : 24,
|
|
273
|
-
sm: column.editFromSettings?.layout?.sm ? column.editFromSettings?.layout?.sm : 24,
|
|
274
|
-
xs: column.editFromSettings?.layout?.xs ? column.editFromSettings?.layout?.xs : 24,
|
|
275
|
-
className: 'mb-1'
|
|
276
|
-
}, /*#__PURE__*/React.createElement(InputControl, {
|
|
277
|
-
id: `edit-form-${index}`,
|
|
278
|
-
t: t,
|
|
279
|
-
control: control
|
|
280
|
-
// name={`specificationCode${index + 1}`}
|
|
281
|
-
,
|
|
282
|
-
name: item.name,
|
|
283
|
-
label: item.label ? item.label : '',
|
|
284
|
-
labelSize: "label-medium",
|
|
285
|
-
errors: errors[item.name],
|
|
286
|
-
onKeyDown: e => formItemKeyDown(e, index, column.editFromSettings?.items ? column.editFromSettings?.items.length : 0)
|
|
287
|
-
}));
|
|
288
|
-
}));
|
|
289
|
-
};
|
|
290
|
-
const contentStyle = {
|
|
291
|
-
padding: 6,
|
|
292
|
-
width: menuWidth,
|
|
293
|
-
backgroundColor: '#fff',
|
|
294
|
-
borderRadius: '6px',
|
|
295
|
-
boxShadow: '0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05)'
|
|
296
|
-
};
|
|
297
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(SelectStyle, {
|
|
298
|
-
ref: formRef,
|
|
299
|
-
id: id ? id : ''
|
|
300
|
-
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
301
|
-
menu: {
|
|
302
|
-
items: []
|
|
303
|
-
},
|
|
304
|
-
autoFocus: true,
|
|
305
|
-
onOpenChange: open => {
|
|
306
|
-
if (open) {
|
|
307
|
-
setTimeout(() => {
|
|
308
|
-
const formElement = document.getElementById('edit-form-0');
|
|
309
|
-
if (formElement) {
|
|
310
|
-
formElement.focus();
|
|
311
|
-
}
|
|
312
|
-
}, 10);
|
|
313
|
-
if (column.editFromSettings && column?.editFromSettings?.formOpen) {
|
|
314
|
-
column?.editFromSettings?.formOpen({
|
|
315
|
-
value,
|
|
316
|
-
setValue,
|
|
317
|
-
getValues,
|
|
318
|
-
reset,
|
|
319
|
-
rowData
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
} else {
|
|
323
|
-
if (column.editFromSettings && column?.editFromSettings?.formClose) {
|
|
324
|
-
column?.editFromSettings?.formClose({
|
|
325
|
-
value,
|
|
326
|
-
setValue,
|
|
327
|
-
getValues,
|
|
328
|
-
reset,
|
|
329
|
-
rowData
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
},
|
|
334
|
-
trigger: ['click'],
|
|
335
|
-
destroyPopupOnHide: true,
|
|
336
|
-
rootClassName: 'be-popup-container',
|
|
337
|
-
dropdownRender: () => /*#__PURE__*/React.createElement("div", {
|
|
338
|
-
style: contentStyle,
|
|
339
|
-
onKeyDown: e => handleFormKeydown(e),
|
|
340
|
-
onClick: e => {
|
|
341
|
-
e.preventDefault();
|
|
342
|
-
e.stopPropagation();
|
|
343
|
-
}
|
|
344
|
-
}, /*#__PURE__*/React.createElement("form", {
|
|
345
|
-
className: "todo-modal",
|
|
346
|
-
onSubmit: handleSubmit(handleOnSubmit)
|
|
347
|
-
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
348
|
-
className: 'p-1',
|
|
349
|
-
style: {
|
|
350
|
-
maxHeight: menuHeight ? menuHeight : 300,
|
|
351
|
-
overflow: "auto"
|
|
352
|
-
}
|
|
353
|
-
}, column.editFromSettings?.items ? renderForm(column.editFromSettings?.items) : ''), /*#__PURE__*/React.createElement(Divider, {
|
|
354
|
-
style: {
|
|
355
|
-
margin: 0
|
|
356
|
-
}
|
|
357
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
358
|
-
className: "d-flex justify-content-end p-1"
|
|
359
|
-
// style={{ boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" }}
|
|
360
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
361
|
-
variant: "solid",
|
|
362
|
-
className: ""
|
|
363
|
-
// onSubmit={handleSubmit(handleOnSubmit)}
|
|
364
|
-
,
|
|
365
|
-
onClick: handleSubmit(handleOnSubmit),
|
|
366
|
-
color: "primary",
|
|
367
|
-
style: {}
|
|
368
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
369
|
-
className: "d-flex "
|
|
370
|
-
}, t ? t('Save') : 'Save'))))))
|
|
371
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
372
|
-
ref: divRef,
|
|
373
|
-
style: {
|
|
374
|
-
height: '100%'
|
|
375
|
-
}
|
|
376
|
-
}, /*#__PURE__*/React.createElement(Input, {
|
|
377
|
-
style: {
|
|
378
|
-
borderRadius: 0,
|
|
379
|
-
height: '100%'
|
|
380
|
-
},
|
|
381
|
-
ref: inputRef,
|
|
382
|
-
defaultValue: defaultValue,
|
|
383
|
-
value: defaultValue,
|
|
384
|
-
placeholder: placeholder,
|
|
385
|
-
className: 'be-select__input'
|
|
386
|
-
// onChange={handleOnChange}
|
|
387
|
-
,
|
|
388
|
-
onFocus: handleOnFocus
|
|
389
|
-
// onClick={handleOnClick}
|
|
390
|
-
// onKeyDown={handleOnKeyDown}
|
|
391
|
-
,
|
|
392
|
-
readOnly: true
|
|
393
|
-
})))));
|
|
394
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './EditForm';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./EditForm";
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { ColumnTable, 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: ColumnTable<DataType>;
|
|
14
|
-
indexRow: number;
|
|
15
|
-
indexCol: number;
|
|
16
|
-
rowKey: any;
|
|
17
|
-
cellEditing: any;
|
|
18
|
-
}
|
|
19
|
-
declare const EditableCell: <T>(props: React.PropsWithChildren<EditableCellProps<T>>) => React.JSX.Element;
|
|
20
|
-
export default EditableCell;
|