@ncds/ui-admin 1.8.22-alpha.2 → 1.8.22-alpha.3
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/dist/cjs/assets/scripts/table/scrollbar/const.js +50 -0
- package/dist/cjs/assets/scripts/table/scrollbar/drag.js +75 -0
- package/dist/cjs/assets/scripts/table/scrollbar/geometry.js +69 -0
- package/dist/cjs/assets/scripts/table/scrollbar/isolate.js +36 -0
- package/dist/cjs/src/components/data-display/table/Table.js +1 -0
- package/dist/cjs/src/components/data-display/table/__tests__/useTableScrollbars.characterisation.test.js +390 -0
- package/dist/cjs/src/components/data-display/table/__tests__/useTableScrollbars.regression.test.js +339 -0
- package/dist/cjs/src/components/data-display/table/useTableScrollbars.js +115 -86
- package/dist/cjs/src/generated/scoped-css.js +1 -1
- package/dist/esm/assets/scripts/table/scrollbar/const.js +44 -0
- package/dist/esm/assets/scripts/table/scrollbar/drag.js +67 -0
- package/dist/esm/assets/scripts/table/scrollbar/geometry.js +60 -0
- package/dist/esm/assets/scripts/table/scrollbar/isolate.js +27 -0
- package/dist/esm/src/components/data-display/table/Table.js +1 -0
- package/dist/esm/src/components/data-display/table/__tests__/useTableScrollbars.characterisation.test.js +387 -0
- package/dist/esm/src/components/data-display/table/__tests__/useTableScrollbars.regression.test.js +336 -0
- package/dist/esm/src/components/data-display/table/useTableScrollbars.js +85 -86
- package/dist/esm/src/generated/scoped-css.js +1 -1
- package/dist/temp/assets/scripts/table/scrollbar/const.d.ts +46 -0
- package/dist/temp/assets/scripts/table/scrollbar/const.js +44 -0
- package/dist/temp/assets/scripts/table/scrollbar/drag.d.ts +18 -0
- package/dist/temp/assets/scripts/table/scrollbar/drag.js +49 -0
- package/dist/temp/assets/scripts/table/scrollbar/geometry.d.ts +47 -0
- package/dist/temp/assets/scripts/table/scrollbar/geometry.js +37 -0
- package/dist/temp/assets/scripts/table/scrollbar/isolate.d.ts +4 -0
- package/dist/temp/assets/scripts/table/scrollbar/isolate.js +30 -0
- package/dist/temp/src/components/data-display/table/Table.js +1 -0
- package/dist/temp/src/components/data-display/table/__tests__/useTableScrollbars.characterisation.test.d.ts +1 -0
- package/dist/temp/src/components/data-display/table/__tests__/useTableScrollbars.characterisation.test.js +282 -0
- package/dist/temp/src/components/data-display/table/__tests__/useTableScrollbars.regression.test.d.ts +1 -0
- package/dist/temp/src/components/data-display/table/__tests__/useTableScrollbars.regression.test.js +244 -0
- package/dist/temp/src/components/data-display/table/useTableScrollbars.d.ts +2 -6
- package/dist/temp/src/components/data-display/table/useTableScrollbars.js +100 -72
- package/dist/temp/src/generated/scoped-css.js +1 -1
- package/dist/temp/src/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
- package/dist/types/assets/scripts/table/scrollbar/const.d.ts +46 -0
- package/dist/types/assets/scripts/table/scrollbar/drag.d.ts +18 -0
- package/dist/types/assets/scripts/table/scrollbar/geometry.d.ts +47 -0
- package/dist/types/assets/scripts/table/scrollbar/isolate.d.ts +4 -0
- package/dist/types/src/components/data-display/table/__tests__/useTableScrollbars.characterisation.test.d.ts +1 -0
- package/dist/types/src/components/data-display/table/__tests__/useTableScrollbars.regression.test.d.ts +1 -0
- package/dist/types/src/components/data-display/table/useTableScrollbars.d.ts +2 -6
- package/dist/types/src/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
- package/dist/ui-admin/assets/styles/style.css +29 -0
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const useIsomorphicLayoutEffect: typeof
|
|
1
|
+
import { useLayoutEffect } from 'react';
|
|
2
|
+
export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** Table 커스텀 스크롤바의 클래스명·속성명·수치 상수. React 와 CDN 이 함께 참조한다. */
|
|
2
|
+
/** `_table.scss` 의 `--ncua-table-header-height` 와 같은 값 */
|
|
3
|
+
export declare const TABLE_HEADER_HEIGHT = 40;
|
|
4
|
+
/** `.ncua-table__scrollbar-thumb { height }` 와 같은 값 */
|
|
5
|
+
export declare const SCROLLBAR_THUMB_MIN_HEIGHT = 40;
|
|
6
|
+
/** `.ncua-table__h-scrollbar-thumb { width }` 와 같은 값 */
|
|
7
|
+
export declare const H_SCROLLBAR_THUMB_MIN_WIDTH = 40;
|
|
8
|
+
/** `.ncua-table__h-scrollbar { left/right: var(--spacing-s) }` 와 같은 값 */
|
|
9
|
+
export declare const H_SCROLLBAR_SIDE_GAP = 8;
|
|
10
|
+
/** 세로 트랙 상하 여백 합계. 헤더 회피분은 `TABLE_HEADER_HEIGHT` 로 따로 뺀다 */
|
|
11
|
+
export declare const SCROLLBAR_TRACK_OFFSET = 16;
|
|
12
|
+
export declare const SCROLLBAR_CLASS_NAMES: {
|
|
13
|
+
readonly table: "ncua-table";
|
|
14
|
+
readonly tableWrapper: "ncua-table-wrapper";
|
|
15
|
+
readonly dataGrid: "ncua-data-grid";
|
|
16
|
+
readonly scrollArea: "ncua-table__scroll-area";
|
|
17
|
+
readonly scrollContainer: "ncua-table__scroll-container";
|
|
18
|
+
readonly scrollbar: "ncua-table__scrollbar";
|
|
19
|
+
readonly scrollbarThumb: "ncua-table__scrollbar-thumb";
|
|
20
|
+
readonly hScrollContainer: "ncua-table__h-scroll-container";
|
|
21
|
+
readonly hScrollInner: "ncua-table__h-scroll-inner";
|
|
22
|
+
readonly hScrollbar: "ncua-table__h-scrollbar";
|
|
23
|
+
readonly hScrollbarThumb: "ncua-table__h-scrollbar-thumb";
|
|
24
|
+
readonly tableElement: "ncua-table__table";
|
|
25
|
+
};
|
|
26
|
+
/** `optOut` 을 제외한 전부가 런타임에만 부착된다. 마크업에 직접 기재하지 않는다. */
|
|
27
|
+
export declare const SCROLLBAR_ATTRS: {
|
|
28
|
+
readonly ready: "data-scrollbar-ready";
|
|
29
|
+
/** `ready` 와 항상 함께 부착·제거한다 */
|
|
30
|
+
readonly owner: "data-scrollbar-owner";
|
|
31
|
+
readonly generated: "data-scrollbar-generated";
|
|
32
|
+
readonly fallbackArmed: "data-ncua-scrollbar-fallback";
|
|
33
|
+
readonly dragging: "data-dragging";
|
|
34
|
+
readonly optOut: "data-ncua-scrollbar";
|
|
35
|
+
};
|
|
36
|
+
export declare const SCROLLBAR_OWNERS: {
|
|
37
|
+
readonly cdn: "cdn";
|
|
38
|
+
readonly react: "react";
|
|
39
|
+
};
|
|
40
|
+
export type ScrollbarOwner = (typeof SCROLLBAR_OWNERS)[keyof typeof SCROLLBAR_OWNERS];
|
|
41
|
+
export declare const SCROLLBAR_OWNER_VALUES: readonly string[];
|
|
42
|
+
export declare const OPT_OUT_VALUE = "off";
|
|
43
|
+
export declare const AXIS_VALUES: readonly ["both", "x", "y"];
|
|
44
|
+
export type ScrollbarAxisOption = (typeof AXIS_VALUES)[number];
|
|
45
|
+
export declare const DEFAULT_AXIS: ScrollbarAxisOption;
|
|
46
|
+
export declare const LOG_PREFIX = "[ncua.TableScrollbar]";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** React 합성 이벤트와 DOM 이벤트를 함께 받기 위한 최소 표면 */
|
|
2
|
+
export type DragPointerEvent = {
|
|
3
|
+
readonly clientX: number;
|
|
4
|
+
readonly clientY: number;
|
|
5
|
+
preventDefault: () => void;
|
|
6
|
+
};
|
|
7
|
+
export type ThumbDragInput = {
|
|
8
|
+
readonly axis: 'x' | 'y';
|
|
9
|
+
readonly scrollEl: HTMLElement;
|
|
10
|
+
readonly thumbEl: HTMLElement;
|
|
11
|
+
/** `[data-dragging]` 부착 대상 */
|
|
12
|
+
readonly draggingTarget: HTMLElement;
|
|
13
|
+
/** `DRAG_BASIS` 기준 길이. 축별 산출식이 달라 호출자가 넘긴다 */
|
|
14
|
+
readonly measureDragBasisSize: (clientSize: number) => number;
|
|
15
|
+
/** 바인딩 해제 시 진행 중인 드래그를 함께 끊는 신호 */
|
|
16
|
+
readonly releaseSignal?: AbortSignal;
|
|
17
|
+
};
|
|
18
|
+
export declare const startThumbDrag: (event: DragPointerEvent, input: ThumbDragInput) => void;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 썸 치수·위치 산출. React 훅과 CDN 바인딩이 공유한다.
|
|
3
|
+
* SSR 경로에서도 평가되므로 `document`·`window` 를 참조하지 않는다.
|
|
4
|
+
*/
|
|
5
|
+
export type AxisMetrics = {
|
|
6
|
+
readonly scrollOffset: number;
|
|
7
|
+
readonly scrollSize: number;
|
|
8
|
+
readonly clientSize: number;
|
|
9
|
+
readonly trackSize: number;
|
|
10
|
+
readonly thumbMinSize: number;
|
|
11
|
+
};
|
|
12
|
+
export type ThumbGeometry = {
|
|
13
|
+
/** `false` 이면 트랙·썸을 감춘다 */
|
|
14
|
+
readonly visible: boolean;
|
|
15
|
+
readonly size: number;
|
|
16
|
+
/** 트랙 기준 썸 오프셋 (px) */
|
|
17
|
+
readonly offset: number;
|
|
18
|
+
};
|
|
19
|
+
export declare const computeThumbGeometry: (metrics: AxisMetrics) => ThumbGeometry;
|
|
20
|
+
/** 호출자가 넘겨야 하는 축별 `dragBasisSize` 기준 */
|
|
21
|
+
export declare const DRAG_BASIS: {
|
|
22
|
+
readonly y: "clientSize";
|
|
23
|
+
readonly x: "trackSize";
|
|
24
|
+
};
|
|
25
|
+
export type DragScrollDeltaInput = {
|
|
26
|
+
readonly pointerDelta: number;
|
|
27
|
+
readonly scrollSize: number;
|
|
28
|
+
readonly clientSize: number;
|
|
29
|
+
readonly dragBasisSize: number;
|
|
30
|
+
readonly thumbSize: number;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* 포인터 이동량(px) → 스크롤 오프셋 변화량(px).
|
|
34
|
+
* 환산 분모 기준이 축마다 다르므로 `dragBasisSize` 는 호출자가 `DRAG_BASIS` 대로 넘긴다.
|
|
35
|
+
*/
|
|
36
|
+
export declare const computeDragScrollDelta: (input: DragScrollDeltaInput) => number;
|
|
37
|
+
export type HorizontalTrackBoxInput = {
|
|
38
|
+
readonly clientWidth: number;
|
|
39
|
+
readonly scrollLeft: number;
|
|
40
|
+
readonly sideGap: number;
|
|
41
|
+
};
|
|
42
|
+
export type HorizontalTrackBox = {
|
|
43
|
+
readonly translateX: number;
|
|
44
|
+
readonly width: number;
|
|
45
|
+
};
|
|
46
|
+
/** 가로 트랙은 스크롤 컨테이너 안에 있어 함께 밀리므로, 되돌릴 오프셋과 폭을 산출한다. */
|
|
47
|
+
export declare const computeHorizontalTrackBox: (input: HorizontalTrackBoxInput) => HorizontalTrackBox;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** 스크롤·리사이즈는 초당 수십 회 불리므로 같은 지점의 실패는 1회만 기록한다 */
|
|
2
|
+
export declare const isolate: <A extends readonly unknown[]>(label: string, run: (...args: A) => void) => (...args: A) => void;
|
|
3
|
+
/** 1회성 호출용. 실패해도 나머지 정리·순회가 이어지도록 한다 */
|
|
4
|
+
export declare const runIsolated: (label: string, run: () => void) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { type MouseEvent, type RefObject } from 'react';
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export declare const H_SCROLLBAR_THUMB_MIN_WIDTH = 40;
|
|
5
|
-
export declare const H_SCROLLBAR_SIDE_GAP = 8;
|
|
6
|
-
export declare const SCROLLBAR_TRACK_OFFSET = 16;
|
|
2
|
+
import { H_SCROLLBAR_SIDE_GAP, H_SCROLLBAR_THUMB_MIN_WIDTH, SCROLLBAR_THUMB_MIN_HEIGHT, SCROLLBAR_TRACK_OFFSET, TABLE_HEADER_HEIGHT } from '../../../../assets/scripts/table/scrollbar/const';
|
|
3
|
+
export { H_SCROLLBAR_SIDE_GAP, H_SCROLLBAR_THUMB_MIN_WIDTH, SCROLLBAR_THUMB_MIN_HEIGHT, SCROLLBAR_TRACK_OFFSET, TABLE_HEADER_HEIGHT, };
|
|
7
4
|
type VerticalScrollbarOptions = {
|
|
8
5
|
enabled: boolean;
|
|
9
6
|
layoutKey: unknown;
|
|
@@ -24,4 +21,3 @@ type HorizontalScrollbarOptions = {
|
|
|
24
21
|
export declare const useTableHorizontalScrollbar: ({ enabled, hScrollContainerRef, hScrollbarRef, hThumbRef, }: HorizontalScrollbarOptions) => {
|
|
25
22
|
handleHThumbMouseDown: (e: MouseEvent<HTMLDivElement>) => void;
|
|
26
23
|
};
|
|
27
|
-
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const useIsomorphicLayoutEffect: typeof
|
|
1
|
+
import { useLayoutEffect } from 'react';
|
|
2
|
+
export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
|
|
@@ -6972,6 +6972,35 @@ button {
|
|
|
6972
6972
|
z-index: 2;
|
|
6973
6973
|
}
|
|
6974
6974
|
|
|
6975
|
+
[data-ncua-scrollbar-fallback] .ncua-table__h-scroll-container:not([data-scrollbar-ready]),
|
|
6976
|
+
[data-ncua-scrollbar-fallback] .ncua-table__scroll-container:not([data-scrollbar-ready]) {
|
|
6977
|
+
scrollbar-width: thin;
|
|
6978
|
+
scrollbar-color: var(--gray-300) transparent;
|
|
6979
|
+
}
|
|
6980
|
+
[data-ncua-scrollbar-fallback] .ncua-table__h-scroll-container:not([data-scrollbar-ready])::-webkit-scrollbar,
|
|
6981
|
+
[data-ncua-scrollbar-fallback] .ncua-table__scroll-container:not([data-scrollbar-ready])::-webkit-scrollbar {
|
|
6982
|
+
display: block;
|
|
6983
|
+
width: 8px;
|
|
6984
|
+
height: 8px;
|
|
6985
|
+
}
|
|
6986
|
+
[data-ncua-scrollbar-fallback] .ncua-table__h-scroll-container:not([data-scrollbar-ready])::-webkit-scrollbar-thumb,
|
|
6987
|
+
[data-ncua-scrollbar-fallback] .ncua-table__scroll-container:not([data-scrollbar-ready])::-webkit-scrollbar-thumb {
|
|
6988
|
+
background: var(--gray-300);
|
|
6989
|
+
border-radius: var(--border-radius-md);
|
|
6990
|
+
}
|
|
6991
|
+
|
|
6992
|
+
[data-ncua-scrollbar-fallback] .ncua-table__h-scroll-container:not([data-scrollbar-ready]) > .ncua-table__h-scrollbar {
|
|
6993
|
+
display: none;
|
|
6994
|
+
}
|
|
6995
|
+
|
|
6996
|
+
[data-ncua-scrollbar-fallback] .ncua-table__scroll-area:not(:has(> .ncua-table__scroll-container[data-scrollbar-ready])) > .ncua-table__scrollbar {
|
|
6997
|
+
display: none;
|
|
6998
|
+
}
|
|
6999
|
+
|
|
7000
|
+
[data-ncua-scrollbar-fallback] .ncua-table:not(:has(.ncua-table__scroll-container[data-scrollbar-ready])) > .ncua-table__scrollbar {
|
|
7001
|
+
display: none;
|
|
7002
|
+
}
|
|
7003
|
+
|
|
6975
7004
|
.ncua-table-dnd-preview {
|
|
6976
7005
|
position: fixed;
|
|
6977
7006
|
top: -9999px;
|