@noraent/nora-datagrid 1.1.0-beta.31 → 1.1.0-beta.32
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 +28 -0
- package/dist/buildPackage.json +1 -1
- package/dist/common/constants/useEnhancedEffect/useEnhancedEffect.d.ts +1 -1
- package/dist/common/constants/utils.d.ts +5 -0
- package/dist/common/rows/treeData.d.ts +20 -0
- package/dist/common/rows/treeData.test.d.ts +1 -0
- package/dist/components/TreeData.test.d.ts +1 -0
- package/dist/components/TwoDimensionalVirtualizedList.d.ts +6 -0
- package/dist/components/icon/ChevronDownIcon.d.ts +7 -0
- package/dist/components/icon/ChevronRightIcon.d.ts +7 -0
- package/dist/components/icon/GripIcon.d.ts +7 -0
- package/dist/nora_datagrid.cjs.js +4 -4
- package/dist/nora_datagrid.es.js +886 -69
- package/dist/types/dataGridCoreProps.d.ts +7 -1
- package/dist/types/dataGridProps.d.ts +32 -2
- package/dist/types/index.d.ts +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -208,7 +208,35 @@ pnpm add @emotion/react @emotion/styled @emotion/css
|
|
|
208
208
|
pnpm add rimraf
|
|
209
209
|
```
|
|
210
210
|
|
|
211
|
+
## Tree Data와 행 이동
|
|
212
|
+
|
|
213
|
+
평면 데이터의 parent id field를 사용해 계층을 구성할 수 있습니다. Tree Data에서는 행 상태와 이동을 안정적으로 유지하기 위해 `getRowId`를 지정해야 합니다.
|
|
214
|
+
|
|
215
|
+
```tsx
|
|
216
|
+
const rows = [
|
|
217
|
+
{ id: "project", parentId: null, name: "프로젝트" },
|
|
218
|
+
{ id: "design", parentId: "project", name: "디자인" },
|
|
219
|
+
{ id: "develop", parentId: "project", name: "개발" },
|
|
220
|
+
];
|
|
221
|
+
|
|
222
|
+
<DataGrid
|
|
223
|
+
columns={[{ fieldId: "name", fieldName: "이름", width: 280 }]}
|
|
224
|
+
dataSource={rows}
|
|
225
|
+
getRowId={(row) => row.id}
|
|
226
|
+
treeData
|
|
227
|
+
treeDataParentIdField="parentId"
|
|
228
|
+
treeDataColumn="name"
|
|
229
|
+
groupDefaultExpanded={-1}
|
|
230
|
+
rowDragManaged
|
|
231
|
+
onRowMove={({ dataSource }) => setRows(dataSource)}
|
|
232
|
+
/>
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
`groupDefaultExpanded`는 기본으로 펼칠 계층 수이며 `-1`은 전체 펼침입니다. Managed row drag는 정렬이 적용되지 않은 클라이언트 데이터에서 활성화됩니다. `isRowValidDropPosition`으로 업무 규칙에 맞지 않는 drop을 차단할 수 있습니다.
|
|
236
|
+
펼쳐진 그룹의 상위 행은 세로 스크롤 중 컬럼 헤더 아래에 고정됩니다. 이 동작이 필요하지 않으면 `suppressGroupRowsSticky`를 `true`로 설정합니다.
|
|
237
|
+
|
|
211
238
|
참고 레퍼런스
|
|
239
|
+
|
|
212
240
|
nora-data-grid은 @leokim97제공하는 ConveGrid 코어를 기반으로 개발 되었습니다.
|
|
213
241
|
일부 nameSpace 구조등 ConveGrid 기반이므로 중복될 수 있습니다.
|
|
214
242
|
|
package/dist/buildPackage.json
CHANGED
|
@@ -45,6 +45,11 @@ export declare const sorting: (dataSource: DataGridDataSource, newSort: GridSort
|
|
|
45
45
|
__ariaRowindex: number;
|
|
46
46
|
__dataRowindex: number;
|
|
47
47
|
__uuid: string;
|
|
48
|
+
__rowId?: import('../../types').GridRowId;
|
|
48
49
|
__originalRowindex: number;
|
|
50
|
+
__parentId?: import('../../types').GridRowId | null;
|
|
51
|
+
__treeDepth?: number;
|
|
52
|
+
__hasChildren?: boolean;
|
|
53
|
+
__expanded?: boolean;
|
|
49
54
|
height?: number;
|
|
50
55
|
}[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DataGridPrivateDataSourceModel, GridRowId, GridSortModel } from '../../types/dataGridCoreProps';
|
|
2
|
+
export type TreeDropPosition = "before" | "inside" | "after";
|
|
3
|
+
export interface TreeRowModel {
|
|
4
|
+
sourceRows: DataGridPrivateDataSourceModel[];
|
|
5
|
+
visibleRows: DataGridPrivateDataSourceModel[];
|
|
6
|
+
nodeById: Map<GridRowId, DataGridPrivateDataSourceModel>;
|
|
7
|
+
childrenByParentId: Map<GridRowId | null, GridRowId[]>;
|
|
8
|
+
expandedIds: Set<GridRowId>;
|
|
9
|
+
}
|
|
10
|
+
interface BuildTreeRowModelOptions {
|
|
11
|
+
getRowId: (row: DataGridPrivateDataSourceModel) => GridRowId;
|
|
12
|
+
parentIdField: string;
|
|
13
|
+
expandedIds?: ReadonlySet<GridRowId>;
|
|
14
|
+
groupDefaultExpanded?: number;
|
|
15
|
+
sortModel?: GridSortModel;
|
|
16
|
+
}
|
|
17
|
+
export declare function rowIdToKey(id: GridRowId): string;
|
|
18
|
+
export declare function buildTreeRowModel(sourceRows: DataGridPrivateDataSourceModel[], options: BuildTreeRowModelOptions): TreeRowModel;
|
|
19
|
+
export declare function moveTreeRow(model: TreeRowModel, sourceId: GridRowId, targetId: GridRowId, position: TreeDropPosition, parentIdField: string, getRowId: (row: DataGridPrivateDataSourceModel) => GridRowId): DataGridPrivateDataSourceModel[] | null;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,6 +2,12 @@ import { default as React, ReactNode } from 'react';
|
|
|
2
2
|
import { DataGridPrivateColumnModel, DataGridPrivateDataSourceModel } from '../types/dataGridCoreProps';
|
|
3
3
|
import { DataGridPrivateApiModel, GirdApiCommon } from '../types/dataGridProps';
|
|
4
4
|
export declare const initialWindowHeight = 500;
|
|
5
|
+
export interface StickyTreeRow {
|
|
6
|
+
row: DataGridPrivateDataSourceModel;
|
|
7
|
+
top: number;
|
|
8
|
+
translateY: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function getStickyTreeRows(rows: DataGridPrivateDataSourceModel[], cumulativeHeights: number[], scrollTop: number, fallbackRowHeight: number): StickyTreeRow[];
|
|
5
11
|
interface VirtualListProps {
|
|
6
12
|
children: (props: {
|
|
7
13
|
visibleItems: Array<DataGridPrivateDataSourceModel>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function ChevronDownIcon({ size, color, strokeWidth, className, ...props }: {
|
|
2
|
+
[x: string]: any;
|
|
3
|
+
size?: number | undefined;
|
|
4
|
+
color?: string | undefined;
|
|
5
|
+
strokeWidth?: number | undefined;
|
|
6
|
+
className?: string | undefined;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function ChevronRightIcon({ size, color, strokeWidth, className, ...props }: {
|
|
2
|
+
[x: string]: any;
|
|
3
|
+
size?: number | undefined;
|
|
4
|
+
color?: string | undefined;
|
|
5
|
+
strokeWidth?: number | undefined;
|
|
6
|
+
className?: string | undefined;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function GripIcon({ size, color, strokeWidth, className, ...props }: {
|
|
2
|
+
[x: string]: any;
|
|
3
|
+
size?: number | undefined;
|
|
4
|
+
color?: string | undefined;
|
|
5
|
+
strokeWidth?: number | undefined;
|
|
6
|
+
className?: string | undefined;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|