@noraent/nora-datagrid 0.0.1
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/README.md +80 -0
- package/lib/cjs/App.d.ts +10 -0
- package/lib/cjs/App.js +142 -0
- package/lib/cjs/DataGrid.d.ts +3 -0
- package/lib/cjs/DataGrid.js +37 -0
- package/lib/cjs/buildPackage.json +59 -0
- package/lib/cjs/common/constants/defaultProps.d.ts +4 -0
- package/lib/cjs/common/constants/defaultProps.js +4 -0
- package/lib/cjs/common/constants/index.d.ts +1 -0
- package/lib/cjs/common/constants/index.js +1 -0
- package/lib/cjs/common/constants/path.d.ts +31 -0
- package/lib/cjs/common/constants/path.js +45 -0
- package/lib/cjs/common/constants/utils.d.ts +0 -0
- package/lib/cjs/common/constants/utils.js +1 -0
- package/lib/cjs/common/foundation/index.d.ts +4 -0
- package/lib/cjs/common/foundation/index.js +4 -0
- package/lib/cjs/common/foundation/scale/color/color.d.ts +44 -0
- package/lib/cjs/common/foundation/scale/color/color.js +46 -0
- package/lib/cjs/common/foundation/scale/color/index.d.ts +1 -0
- package/lib/cjs/common/foundation/scale/color/index.js +1 -0
- package/lib/cjs/common/foundation/scale/index.d.ts +2 -0
- package/lib/cjs/common/foundation/scale/index.js +2 -0
- package/lib/cjs/common/foundation/scale/layout/breakpoints.d.ts +4 -0
- package/lib/cjs/common/foundation/scale/layout/breakpoints.js +6 -0
- package/lib/cjs/common/foundation/scale/layout/index.d.ts +1 -0
- package/lib/cjs/common/foundation/scale/layout/index.js +1 -0
- package/lib/cjs/common/foundation/scale/layout/size.d.ts +6 -0
- package/lib/cjs/common/foundation/scale/layout/size.js +7 -0
- package/lib/cjs/common/styled/assets/components/index.d.ts +1 -0
- package/lib/cjs/common/styled/assets/components/index.js +1 -0
- package/lib/cjs/common/styled/assets/components/loading/Loading.d.ts +2 -0
- package/lib/cjs/common/styled/assets/components/loading/Loading.js +2 -0
- package/lib/cjs/common/styled/assets/index.d.ts +1 -0
- package/lib/cjs/common/styled/assets/index.js +1 -0
- package/lib/cjs/common/styled/index.d.ts +44 -0
- package/lib/cjs/common/styled/index.js +57 -0
- package/lib/cjs/components/GridBasicRows.d.ts +6 -0
- package/lib/cjs/components/GridBasicRows.js +88 -0
- package/lib/cjs/components/NoraDataGrid.d.ts +12 -0
- package/lib/cjs/components/NoraDataGrid.js +50 -0
- package/lib/cjs/components/TwoDimensionalVirtualizedList.d.ts +5 -0
- package/lib/cjs/components/TwoDimensionalVirtualizedList.js +538 -0
- package/lib/cjs/components/cell/CellMode.d.ts +10 -0
- package/lib/cjs/components/cell/CellMode.js +33 -0
- package/lib/cjs/components/header/VirtualHorizontalHeader.d.ts +5 -0
- package/lib/cjs/components/header/VirtualHorizontalHeader.js +13 -0
- package/lib/cjs/components/ime/IMEComponent.d.ts +5 -0
- package/lib/cjs/components/ime/IMEComponent.js +149 -0
- package/lib/cjs/components/virtualized/_components/VirtualHeader.d.ts +4 -0
- package/lib/cjs/components/virtualized/_components/VirtualHeader.js +25 -0
- package/lib/cjs/components/virtualized/_constants/virtualHeaderConstants.d.ts +9 -0
- package/lib/cjs/components/virtualized/_constants/virtualHeaderConstants.js +1 -0
- package/lib/cjs/components/virtualized/_styled/index.d.ts +34 -0
- package/lib/cjs/components/virtualized/_styled/index.js +108 -0
- package/lib/cjs/hooks/external/usePublicTest.d.ts +3 -0
- package/lib/cjs/hooks/external/usePublicTest.js +20 -0
- package/lib/cjs/hooks/internal/useCellRange.d.ts +8 -0
- package/lib/cjs/hooks/internal/useCellRange.js +275 -0
- package/lib/cjs/hooks/internal/useInternalPrivateApi.d.ts +3 -0
- package/lib/cjs/hooks/internal/useInternalPrivateApi.js +127 -0
- package/lib/cjs/hooks/useGridApiContext.d.ts +4 -0
- package/lib/cjs/hooks/useGridApiContext.js +10 -0
- package/lib/cjs/hooks/useGridApiMethod.d.ts +8 -0
- package/lib/cjs/hooks/useGridApiMethod.js +18 -0
- package/lib/cjs/hooks/useGridInitialization.d.ts +3 -0
- package/lib/cjs/hooks/useGridInitialization.js +62 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/main.d.ts +0 -0
- package/lib/cjs/main.js +9 -0
- package/lib/cjs/provider/GridApiContext.d.ts +2 -0
- package/lib/cjs/provider/GridApiContext.js +5 -0
- package/lib/cjs/provider/GridStoreContent.d.ts +10 -0
- package/lib/cjs/provider/GridStoreContent.js +140 -0
- package/lib/cjs/types/classes/index.d.ts +1 -0
- package/lib/cjs/types/classes/index.js +1 -0
- package/lib/cjs/types/classes/styled.d.ts +55 -0
- package/lib/cjs/types/classes/styled.js +56 -0
- package/lib/cjs/types/dataGridCoreEnum.d.ts +6 -0
- package/lib/cjs/types/dataGridCoreEnum.js +7 -0
- package/lib/cjs/types/dataGridCoreProps.d.ts +71 -0
- package/lib/cjs/types/dataGridCoreProps.js +1 -0
- package/lib/cjs/types/dataGridProps.d.ts +148 -0
- package/lib/cjs/types/dataGridProps.js +54 -0
- package/lib/esm/App.d.ts +10 -0
- package/lib/esm/App.js +142 -0
- package/lib/esm/DataGrid.d.ts +3 -0
- package/lib/esm/DataGrid.js +37 -0
- package/lib/esm/buildPackage.json +59 -0
- package/lib/esm/common/constants/defaultProps.d.ts +4 -0
- package/lib/esm/common/constants/defaultProps.js +4 -0
- package/lib/esm/common/constants/index.d.ts +1 -0
- package/lib/esm/common/constants/index.js +1 -0
- package/lib/esm/common/constants/path.d.ts +31 -0
- package/lib/esm/common/constants/path.js +45 -0
- package/lib/esm/common/constants/utils.d.ts +0 -0
- package/lib/esm/common/constants/utils.js +1 -0
- package/lib/esm/common/foundation/index.d.ts +4 -0
- package/lib/esm/common/foundation/index.js +4 -0
- package/lib/esm/common/foundation/scale/color/color.d.ts +44 -0
- package/lib/esm/common/foundation/scale/color/color.js +46 -0
- package/lib/esm/common/foundation/scale/color/index.d.ts +1 -0
- package/lib/esm/common/foundation/scale/color/index.js +1 -0
- package/lib/esm/common/foundation/scale/index.d.ts +2 -0
- package/lib/esm/common/foundation/scale/index.js +2 -0
- package/lib/esm/common/foundation/scale/layout/breakpoints.d.ts +4 -0
- package/lib/esm/common/foundation/scale/layout/breakpoints.js +6 -0
- package/lib/esm/common/foundation/scale/layout/index.d.ts +1 -0
- package/lib/esm/common/foundation/scale/layout/index.js +1 -0
- package/lib/esm/common/foundation/scale/layout/size.d.ts +6 -0
- package/lib/esm/common/foundation/scale/layout/size.js +7 -0
- package/lib/esm/common/styled/assets/components/index.d.ts +1 -0
- package/lib/esm/common/styled/assets/components/index.js +1 -0
- package/lib/esm/common/styled/assets/components/loading/Loading.d.ts +2 -0
- package/lib/esm/common/styled/assets/components/loading/Loading.js +2 -0
- package/lib/esm/common/styled/assets/index.d.ts +1 -0
- package/lib/esm/common/styled/assets/index.js +1 -0
- package/lib/esm/common/styled/index.d.ts +44 -0
- package/lib/esm/common/styled/index.js +57 -0
- package/lib/esm/components/GridBasicRows.d.ts +6 -0
- package/lib/esm/components/GridBasicRows.js +88 -0
- package/lib/esm/components/NoraDataGrid.d.ts +12 -0
- package/lib/esm/components/NoraDataGrid.js +50 -0
- package/lib/esm/components/TwoDimensionalVirtualizedList.d.ts +5 -0
- package/lib/esm/components/TwoDimensionalVirtualizedList.js +538 -0
- package/lib/esm/components/cell/CellMode.d.ts +10 -0
- package/lib/esm/components/cell/CellMode.js +33 -0
- package/lib/esm/components/header/VirtualHorizontalHeader.d.ts +5 -0
- package/lib/esm/components/header/VirtualHorizontalHeader.js +13 -0
- package/lib/esm/components/ime/IMEComponent.d.ts +5 -0
- package/lib/esm/components/ime/IMEComponent.js +149 -0
- package/lib/esm/components/virtualized/_components/VirtualHeader.d.ts +4 -0
- package/lib/esm/components/virtualized/_components/VirtualHeader.js +25 -0
- package/lib/esm/components/virtualized/_constants/virtualHeaderConstants.d.ts +9 -0
- package/lib/esm/components/virtualized/_constants/virtualHeaderConstants.js +1 -0
- package/lib/esm/components/virtualized/_styled/index.d.ts +34 -0
- package/lib/esm/components/virtualized/_styled/index.js +108 -0
- package/lib/esm/hooks/external/usePublicTest.d.ts +3 -0
- package/lib/esm/hooks/external/usePublicTest.js +20 -0
- package/lib/esm/hooks/internal/useCellRange.d.ts +8 -0
- package/lib/esm/hooks/internal/useCellRange.js +275 -0
- package/lib/esm/hooks/internal/useInternalPrivateApi.d.ts +3 -0
- package/lib/esm/hooks/internal/useInternalPrivateApi.js +127 -0
- package/lib/esm/hooks/useGridApiContext.d.ts +4 -0
- package/lib/esm/hooks/useGridApiContext.js +10 -0
- package/lib/esm/hooks/useGridApiMethod.d.ts +8 -0
- package/lib/esm/hooks/useGridApiMethod.js +18 -0
- package/lib/esm/hooks/useGridInitialization.d.ts +3 -0
- package/lib/esm/hooks/useGridInitialization.js +62 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/main.d.ts +0 -0
- package/lib/esm/main.js +9 -0
- package/lib/esm/provider/GridApiContext.d.ts +2 -0
- package/lib/esm/provider/GridApiContext.js +5 -0
- package/lib/esm/provider/GridStoreContent.d.ts +10 -0
- package/lib/esm/provider/GridStoreContent.js +140 -0
- package/lib/esm/types/classes/index.d.ts +1 -0
- package/lib/esm/types/classes/index.js +1 -0
- package/lib/esm/types/classes/styled.d.ts +55 -0
- package/lib/esm/types/classes/styled.js +56 -0
- package/lib/esm/types/dataGridCoreEnum.d.ts +6 -0
- package/lib/esm/types/dataGridCoreEnum.js +7 -0
- package/lib/esm/types/dataGridCoreProps.d.ts +71 -0
- package/lib/esm/types/dataGridCoreProps.js +1 -0
- package/lib/esm/types/dataGridProps.d.ts +148 -0
- package/lib/esm/types/dataGridProps.js +54 -0
- package/package.json +59 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { foundation } from "../foundation";
|
|
2
|
+
/**
|
|
3
|
+
* 💡 알림
|
|
4
|
+
* 본 섹션은 가이드의 가독성을 높이기 위해 추가되었습니다.
|
|
5
|
+
* 기능 개발에만 집중할 수 있도록 작성된 문서이며, UI 관련 가이드는 따로 제공되지 않습니다.
|
|
6
|
+
* 가이드가 아니므로 참고용으로만 활용해 주세요.
|
|
7
|
+
* 디자인 시스템을 개발할경우 색상이나 사이즈 처리 등 가이드로 사용하기에는 다소 부족한 부분이 있을 수 있습니다. 부득이하게 개발이 필요한 경우 해당부분을 고려하여 개발 해주세요.
|
|
8
|
+
*/
|
|
9
|
+
export declare const StyledButton: import("@emotion/styled").StyledComponent<{
|
|
10
|
+
theme?: import("@emotion/react").Theme;
|
|
11
|
+
as?: React.ElementType;
|
|
12
|
+
}, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
|
|
13
|
+
export declare const StyledSubTitle: import("@emotion/styled").StyledComponent<{
|
|
14
|
+
theme?: import("@emotion/react").Theme;
|
|
15
|
+
as?: React.ElementType;
|
|
16
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, {}>;
|
|
17
|
+
export declare const StyledNoneContent: import("@emotion/styled").StyledComponent<{
|
|
18
|
+
theme?: import("@emotion/react").Theme;
|
|
19
|
+
as?: React.ElementType;
|
|
20
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
21
|
+
export declare const Typography: import("@emotion/styled").StyledComponent<{
|
|
22
|
+
theme?: import("@emotion/react").Theme;
|
|
23
|
+
as?: React.ElementType;
|
|
24
|
+
} & TypographyProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {}>;
|
|
25
|
+
interface TypographyProps {
|
|
26
|
+
variant?: variantType;
|
|
27
|
+
color?: colorType;
|
|
28
|
+
}
|
|
29
|
+
type colorType = keyof typeof foundation.$scale.color;
|
|
30
|
+
/**
|
|
31
|
+
* 정리 필요
|
|
32
|
+
*/
|
|
33
|
+
type variantType = keyof typeof variantMapping;
|
|
34
|
+
declare const variantMapping: {
|
|
35
|
+
KR_TITLE_H1: {
|
|
36
|
+
fontSize: string;
|
|
37
|
+
fontWeight: string;
|
|
38
|
+
};
|
|
39
|
+
KR_TITLE_H2: {
|
|
40
|
+
fontSize: string;
|
|
41
|
+
fontWeight: number;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { foundation } from "../foundation";
|
|
3
|
+
import { initialWindowHeight } from "../../components/TwoDimensionalVirtualizedList";
|
|
4
|
+
/**
|
|
5
|
+
* 💡 알림
|
|
6
|
+
* 본 섹션은 가이드의 가독성을 높이기 위해 추가되었습니다.
|
|
7
|
+
* 기능 개발에만 집중할 수 있도록 작성된 문서이며, UI 관련 가이드는 따로 제공되지 않습니다.
|
|
8
|
+
* 가이드가 아니므로 참고용으로만 활용해 주세요.
|
|
9
|
+
* 디자인 시스템을 개발할경우 색상이나 사이즈 처리 등 가이드로 사용하기에는 다소 부족한 부분이 있을 수 있습니다. 부득이하게 개발이 필요한 경우 해당부분을 고려하여 개발 해주세요.
|
|
10
|
+
*/
|
|
11
|
+
export const StyledButton = styled("button")(() => ({
|
|
12
|
+
minWidth: "190px",
|
|
13
|
+
display: "flex",
|
|
14
|
+
padding: "14px 24px 14px 18px",
|
|
15
|
+
fontSize: "16px",
|
|
16
|
+
fontWeight: "600",
|
|
17
|
+
background: "#fff",
|
|
18
|
+
borderRadius: "4px",
|
|
19
|
+
border: "1px solid #e3e3e3",
|
|
20
|
+
cursor: "pointer",
|
|
21
|
+
boxShadow: `0px 0px 4px 0px #00000012`,
|
|
22
|
+
":hover": {
|
|
23
|
+
backgroundColor: "#fcfcfc",
|
|
24
|
+
},
|
|
25
|
+
":active": {
|
|
26
|
+
backgroundColor: "#fbfbfb",
|
|
27
|
+
boxShadow: `0px 0px 4px 0px #0000000a`,
|
|
28
|
+
},
|
|
29
|
+
}));
|
|
30
|
+
export const StyledSubTitle = styled("h3")(() => ({
|
|
31
|
+
fontSize: "15px",
|
|
32
|
+
color: "#818181",
|
|
33
|
+
}));
|
|
34
|
+
export const StyledNoneContent = styled("div")(() => ({
|
|
35
|
+
width: "100%",
|
|
36
|
+
height: initialWindowHeight,
|
|
37
|
+
display: "flex",
|
|
38
|
+
justifyContent: "center",
|
|
39
|
+
alignItems: "center",
|
|
40
|
+
gap: "4px",
|
|
41
|
+
flexDirection: "column",
|
|
42
|
+
opacity: 0.2,
|
|
43
|
+
}));
|
|
44
|
+
export const Typography = styled("p")((props) => {
|
|
45
|
+
var _a;
|
|
46
|
+
return (Object.assign(Object.assign({}, (props.variant && variantMapping[props.variant])), { color: foundation.$scale.color[(_a = props === null || props === void 0 ? void 0 : props.color) !== null && _a !== void 0 ? _a : "black"] }));
|
|
47
|
+
});
|
|
48
|
+
const variantMapping = {
|
|
49
|
+
KR_TITLE_H1: {
|
|
50
|
+
fontSize: "12px",
|
|
51
|
+
fontWeight: "bold",
|
|
52
|
+
},
|
|
53
|
+
KR_TITLE_H2: {
|
|
54
|
+
fontSize: "12px",
|
|
55
|
+
fontWeight: 400,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
const containerHeight = 250;
|
|
4
|
+
const overscanCount = 3;
|
|
5
|
+
const scrollThreshold = 40; // 스크롤 이벤트를 처리할 임계값 (여기서는 200px)
|
|
6
|
+
function GridBasicRows(props) {
|
|
7
|
+
const { children } = props;
|
|
8
|
+
const parentRef = React.useRef(null);
|
|
9
|
+
const ticking = React.useRef(false);
|
|
10
|
+
const prevScrollTop = React.useRef(0); // 이전 스크롤 위치를 저장하는 Ref
|
|
11
|
+
const [visibleRange, setVisibleRange] = React.useState({ start: 0, end: 0 });
|
|
12
|
+
const [itemsData, setItemsData] = React.useState([]);
|
|
13
|
+
const visibleItems = React.useMemo(() => itemsData.slice(visibleRange.start, visibleRange.end + 1), [itemsData, visibleRange]);
|
|
14
|
+
const totalHeight = React.useMemo(() => itemsData.reduce((sum, item) => sum + item.height, 0), [itemsData]);
|
|
15
|
+
const getCumulativeHeight = React.useCallback((index) => {
|
|
16
|
+
return itemsData.slice(0, index).reduce((sum, item) => sum + item.height, 0);
|
|
17
|
+
}, [itemsData]);
|
|
18
|
+
const findItemIndexByScrollTop = React.useCallback((scrollTop) => {
|
|
19
|
+
let low = 0;
|
|
20
|
+
let high = itemsData.length - 1;
|
|
21
|
+
while (low <= high) {
|
|
22
|
+
const mid = Math.floor((low + high) / 2);
|
|
23
|
+
const midHeight = getCumulativeHeight(mid);
|
|
24
|
+
if (midHeight <= scrollTop && scrollTop < midHeight + itemsData[mid].height) {
|
|
25
|
+
return mid;
|
|
26
|
+
}
|
|
27
|
+
else if (midHeight > scrollTop) {
|
|
28
|
+
high = mid - 1;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
low = mid + 1;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return low;
|
|
35
|
+
}, [itemsData, getCumulativeHeight]);
|
|
36
|
+
const calculateVisibleRange = React.useCallback(() => {
|
|
37
|
+
if (!parentRef.current)
|
|
38
|
+
return;
|
|
39
|
+
const scrollTop = parentRef.current.scrollTop;
|
|
40
|
+
const start = findItemIndexByScrollTop(scrollTop);
|
|
41
|
+
let end = start;
|
|
42
|
+
let heightSum = getCumulativeHeight(end + 1) - scrollTop;
|
|
43
|
+
while (end < itemsData.length - 1 && heightSum < containerHeight) {
|
|
44
|
+
end++;
|
|
45
|
+
heightSum += itemsData[end].height;
|
|
46
|
+
}
|
|
47
|
+
setVisibleRange({
|
|
48
|
+
start: Math.max(0, start - overscanCount),
|
|
49
|
+
end: Math.min(itemsData.length - 1, end + overscanCount),
|
|
50
|
+
});
|
|
51
|
+
ticking.current = false;
|
|
52
|
+
}, [itemsData, containerHeight, findItemIndexByScrollTop, getCumulativeHeight, overscanCount]);
|
|
53
|
+
const handleScroll = React.useCallback(() => {
|
|
54
|
+
if (!parentRef.current)
|
|
55
|
+
return;
|
|
56
|
+
const scrollTop = parentRef.current.scrollTop;
|
|
57
|
+
if (!ticking.current) {
|
|
58
|
+
requestAnimationFrame(() => {
|
|
59
|
+
if (Math.abs(scrollTop - prevScrollTop.current) >= scrollThreshold) {
|
|
60
|
+
calculateVisibleRange();
|
|
61
|
+
prevScrollTop.current = scrollTop;
|
|
62
|
+
}
|
|
63
|
+
ticking.current = false;
|
|
64
|
+
});
|
|
65
|
+
ticking.current = true;
|
|
66
|
+
}
|
|
67
|
+
}, [calculateVisibleRange, scrollThreshold]);
|
|
68
|
+
React.useEffect(() => {
|
|
69
|
+
calculateVisibleRange();
|
|
70
|
+
}, [calculateVisibleRange]);
|
|
71
|
+
return (_jsx("div", { ref: parentRef, style: {
|
|
72
|
+
height: `${containerHeight}px`,
|
|
73
|
+
overflowY: "auto",
|
|
74
|
+
}, onScroll: handleScroll, children: _jsx("div", { style: {
|
|
75
|
+
height: `${totalHeight}px`,
|
|
76
|
+
position: "relative",
|
|
77
|
+
}, children: visibleItems.map((item, _i) => {
|
|
78
|
+
return (_jsxs("div", { style: {
|
|
79
|
+
position: "absolute",
|
|
80
|
+
transform: `translate3d(0px, ${getCumulativeHeight(item.id - 1)}px, 0px)`,
|
|
81
|
+
left: 0,
|
|
82
|
+
right: 0,
|
|
83
|
+
height: `${item.height}px`,
|
|
84
|
+
borderBottom: "1px solid #ddd",
|
|
85
|
+
}, children: [children, " \uC624\uC789?"] }, item.id));
|
|
86
|
+
}) }) }));
|
|
87
|
+
}
|
|
88
|
+
export default GridBasicRows;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
export declare const NoraDataGrid: React.ForwardRefExoticComponent<NoraDataGridMainProps & React.RefAttributes<HTMLDivElement>> & {
|
|
3
|
+
Title: typeof NoraDataGridTitle;
|
|
4
|
+
Body: React.ForwardRefExoticComponent<NoraDataGridMainProps & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
Footer: typeof NoraDataGridFooter;
|
|
6
|
+
};
|
|
7
|
+
declare function NoraDataGridTitle(props: NoraDataGridMainProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function NoraDataGridFooter(props: NoraDataGridMainProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
interface NoraDataGridMainProps {
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { classes } from "../types/classes";
|
|
4
|
+
import { cx } from "@emotion/css";
|
|
5
|
+
import useGridApiContext from "../hooks/useGridApiContext";
|
|
6
|
+
import { useStore } from "../provider/GridStoreContent";
|
|
7
|
+
const NoraDataGridMain = React.forwardRef((props, ref) => {
|
|
8
|
+
const { children } = props;
|
|
9
|
+
return (_jsx("div", { className: cx(classes.TableClasses.container.root, classes.TableClasses.container.classes), ref: ref, children: children }));
|
|
10
|
+
});
|
|
11
|
+
const NoraDataGridBody = React.forwardRef((props, ref) => {
|
|
12
|
+
const { children } = props;
|
|
13
|
+
const gridRef = useGridApiContext();
|
|
14
|
+
const store = useStore();
|
|
15
|
+
const bodyRef = React.useRef(null);
|
|
16
|
+
React.useImperativeHandle(ref, () => bodyRef.current);
|
|
17
|
+
React.useEffect(() => {
|
|
18
|
+
function handleClickOutside(event) {
|
|
19
|
+
if (bodyRef.current && bodyRef.current.contains(event.target)) {
|
|
20
|
+
console.log("Provider 안쪽", event.target);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
// body 바깥 클릭 감지
|
|
24
|
+
if (gridRef === null || gridRef === void 0 ? void 0 : gridRef.current) {
|
|
25
|
+
gridRef.current.setCellFocus(undefined, undefined).then((res) => {
|
|
26
|
+
store.setState(["state", "cellFocus"], res);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
32
|
+
return () => {
|
|
33
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
34
|
+
};
|
|
35
|
+
}, []);
|
|
36
|
+
return (_jsx("div", { ref: bodyRef, className: cx(classes.TableClasses.body.root, classes.TableClasses.body.classes), children: children }));
|
|
37
|
+
});
|
|
38
|
+
export const NoraDataGrid = Object.assign(NoraDataGridMain, {
|
|
39
|
+
Title: NoraDataGridTitle,
|
|
40
|
+
Body: NoraDataGridBody,
|
|
41
|
+
Footer: NoraDataGridFooter,
|
|
42
|
+
});
|
|
43
|
+
function NoraDataGridTitle(props) {
|
|
44
|
+
const { children } = props;
|
|
45
|
+
return _jsx("div", { className: cx(classes.TableClasses.title.root, classes.TableClasses.title.classes), children: children });
|
|
46
|
+
}
|
|
47
|
+
function NoraDataGridFooter(props) {
|
|
48
|
+
const { children } = props;
|
|
49
|
+
return _jsx("div", { className: classes.TableClasses.footer, children: children });
|
|
50
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare const initialWindowHeight = 500;
|
|
3
|
+
export declare const TwoDimensionalVirtualizedList: React.MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
4
|
+
declare const _default: React.MemoExoticComponent<React.MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>>;
|
|
5
|
+
export default _default;
|