@moda-grid/vue2 2.1.2 → 2.2.0

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/DataGrid.vue CHANGED
@@ -21,15 +21,36 @@ import {
21
21
  createTouchDrag,
22
22
  DEFAULT_COLUMN_WIDTH,
23
23
  DEFAULT_OPERATOR_BY_TYPE,
24
+ describeCell,
25
+ dropRatioForY,
26
+ editorInputValue,
24
27
  FILTER_OPERATOR_LABELS,
25
28
  FILTER_OPERATORS_BY_TYPE,
26
29
  formatAggregate,
27
30
  gridThemeClasses,
28
31
  gridThemeVars,
32
+ groupLabelOf as coreGroupLabelOf,
33
+ groupOf,
34
+ handleGridKeydown,
35
+ isGroupRow,
29
36
  isInteractiveCellTarget,
37
+ isSubtotalRow,
38
+ leafDepthOf,
39
+ filterDropAnchorX,
40
+ leafExpanded,
41
+ leafHasChildren,
42
+ leafOf,
30
43
  logicalToDomScrollLeft,
31
- readClipboardText,
32
- writeClipboardText,
44
+ pinPartition,
45
+ pinStyleProps,
46
+ resolveRowDrop,
47
+ resizeKeyDelta,
48
+ rowDataOf,
49
+ startColumnResize,
50
+ startFillDrag,
51
+ startRowResize,
52
+ colKeyOf,
53
+ resolveColumn,
33
54
  } from "@moda-grid/core";
34
55
  import type {
35
56
  AggregateFn,
@@ -37,10 +58,8 @@ import type {
37
58
  AppendScrollOptions,
38
59
  PivotOptions,
39
60
  PivotZone,
40
- ContextMenuItem,
41
61
  GridLocale,
42
62
  CellEditorContext,
43
- CellNavigation,
44
63
  ColumnDef,
45
64
  ColumnFilter,
46
65
  DisplayRow,
@@ -52,8 +71,7 @@ import type {
52
71
  GridEventHandlers,
53
72
  GridEventMap,
54
73
  GridOptions,
55
- GroupNode,
56
- LeafDisplayRow,
74
+ RangeTracking,
57
75
  RowData,
58
76
  SelectionMode,
59
77
  ServerSideOptions,
@@ -63,15 +81,6 @@ import type {
63
81
  import { useGrid, useGridState } from "./useGrid.js";
64
82
 
65
83
  // Vue 2.7 script setup — runtime props 선언 사용
66
- /** 편집기 input 씨드 값 — Date는 YYYY-MM-DD 로 변환 (input[type=date] 호환) */
67
- function editorInputValue(v: unknown): string {
68
- if (v instanceof Date) {
69
- const pad = (n: number) => String(n).padStart(2, "0");
70
- return `${v.getFullYear()}-${pad(v.getMonth() + 1)}-${pad(v.getDate())}`;
71
- }
72
- return String(v ?? "");
73
- }
74
-
75
84
  const slots = useSlots();
76
85
  /** 행 상세 패널 (master-detail) — #detail="{ row, rowIndex }" 슬롯이 있으면 각 행에 ▸ 토글 표시 */
77
86
  const hasDetailSlot = computed(() => !!slots.detail);
@@ -89,7 +98,10 @@ const props = defineProps({
89
98
  default: undefined,
90
99
  },
91
100
  /** 외부에서 생성/관리하는 GridCore. 생략하면 내부 인스턴스 생성 */
92
- grid: { type: Object as PropType<Grid<any>>, default: undefined },
101
+ grid: {
102
+ type: Object as PropType<Grid<Record<string, unknown>>>,
103
+ default: undefined,
104
+ },
93
105
  getRowId: {
94
106
  type: Function as PropType<(row: Record<string, unknown>) => string>,
95
107
  default: undefined,
@@ -100,6 +112,11 @@ const props = defineProps({
100
112
  height: { type: Number, default: undefined },
101
113
  /** 가상 스크롤: 행 높이(px) */
102
114
  rowHeight: { type: Number, default: undefined },
115
+ /** 가변 높이 가상화 — 행별 px 높이. height/rowHeight와 함께 지정 */
116
+ getRowHeight: {
117
+ type: Function as PropType<(row: unknown, index: number) => number>,
118
+ default: undefined,
119
+ },
103
120
  /** 가상 스크롤: overscan 행 수 */
104
121
  overscan: { type: Number, default: undefined },
105
122
  /**
@@ -127,6 +144,11 @@ const props = defineProps({
127
144
  type: String as PropType<SelectionMode>,
128
145
  default: undefined,
129
146
  },
147
+ /** 범위 선택 추적 방식 — 'identity'면 정렬/필터 후에도 같은 행·컬럼을 추적 */
148
+ rangeTracking: {
149
+ type: String as PropType<RangeTracking>,
150
+ default: undefined,
151
+ },
130
152
  /** 서버 사이드 데이터 소스 (내부 GridCore 생성 모드에서만 적용) */
131
153
  serverSide: {
132
154
  type: Object as PropType<ServerSideOptions>,
@@ -251,6 +273,8 @@ const props = defineProps({
251
273
  theme: { type: [String, Object] as PropType<GridTheme>, default: undefined },
252
274
  /** 밀도 프리셋 — "compact"/"comfortable"이 폰트·셀 패딩을 일괄 조정 */
253
275
  density: { type: String as PropType<GridDensity>, default: undefined },
276
+ /** 행 상세 패널 높이(px) — #detail 슬롯 사용 시 적용. 미지정 시 내용에 맞춤 */
277
+ detailHeight: { type: Number, default: undefined },
254
278
  /** 선언형 이벤트 핸들러 — 마운트 시 구독, 언마운트 시 해제 (grid.on과 동일) */
255
279
  events: { type: Object as PropType<GridEventHandlers>, default: undefined },
256
280
  /** GridCore 인스턴스가 준비되면 한 번 호출 — props 모드에서도 grid API 접근 가능 */
@@ -281,6 +305,7 @@ const internal = props.grid
281
305
  cellFlash: props.cellFlash,
282
306
  copyFormatted: props.copyFormatted,
283
307
  singleClickEdit: props.singleClickEdit,
308
+ rangeTracking: props.rangeTracking,
284
309
  editType: props.editType,
285
310
  pasteExtend: props.pasteExtend,
286
311
  headerHeight: props.headerHeight,
@@ -302,6 +327,7 @@ const internal = props.grid
302
327
  rowHeight: props.rowHeight,
303
328
  viewportHeight: props.height,
304
329
  overscan: props.overscan,
330
+ getRowHeight: props.getRowHeight,
305
331
  }
306
332
  : undefined,
307
333
  virtualColumns: props.virtualColumns,
@@ -362,6 +388,7 @@ watchEffect(() => {
362
388
  rowHeight: props.rowHeight,
363
389
  viewportHeight: props.height,
364
390
  overscan: props.overscan,
391
+ getRowHeight: props.getRowHeight,
365
392
  });
366
393
  } else {
367
394
  grid.setVirtualScroll(null);
@@ -378,6 +405,7 @@ watchEffect(() => {
378
405
  });
379
406
  watchEffect(() => {
380
407
  if (props.selectionMode) grid.setSelectionMode(props.selectionMode);
408
+ if (props.rangeTracking) grid.setRangeTracking(props.rangeTracking);
381
409
  });
382
410
  watchEffect(() => {
383
411
  grid.setHiddenRows([...(props.hiddenRowIds ?? [])]);
@@ -572,30 +600,31 @@ function onFindInput(e: Event) {
572
600
  const filterDrop = ref<{ field: string; x: number; y: number } | null>(null);
573
601
  function toggleFilterDrop(col: ColumnDef, e: MouseEvent) {
574
602
  e.stopPropagation();
575
- if (filterDrop.value?.field === col.field) {
603
+ if (filterDrop.value?.field === colKeyOf(col)) {
576
604
  filterDrop.value = null;
577
605
  return;
578
606
  }
579
607
  const b = (e.currentTarget as HTMLElement).getBoundingClientRect();
580
608
  const h = hostEl.value?.getBoundingClientRect();
581
609
  filterDrop.value = {
582
- field: col.field,
583
- x: b.right - (h?.left ?? 0),
610
+ field: colKeyOf(col),
611
+ x: filterDropAnchorX(b, h?.left ?? 0, state.value.dir),
584
612
  y: b.bottom - (h?.top ?? 0) + 4,
585
613
  };
586
614
  }
587
615
  const filterDropCol = computed(() =>
588
616
  filterDrop.value
589
- ? (state.value.columns.find((c) => c.field === filterDrop.value!.field) ??
590
- null)
617
+ ? (resolveColumn(state.value.columns, filterDrop.value.field) ?? null)
591
618
  : null,
592
619
  );
593
620
  const filterDropAll = computed(() =>
594
- filterDropCol.value ? grid.getUniqueValues(filterDropCol.value.field) : [],
621
+ filterDropCol.value
622
+ ? grid.getUniqueValues(colKeyOf(filterDropCol.value))
623
+ : [],
595
624
  );
596
625
  const filterDropActive = computed(() =>
597
626
  filterDropCol.value
598
- ? state.value.filters[filterDropCol.value.field]?.values
627
+ ? state.value.filters[colKeyOf(filterDropCol.value)]?.values
599
628
  : undefined,
600
629
  );
601
630
  // ── 필터 빌더 상태: 조건식(연산자+값)과 값 체크리스트를 분리해 다룬다 ──
@@ -612,7 +641,7 @@ const filterDropBuilder = computed<FilterBuilderInput>(() => {
612
641
  values: null,
613
642
  join: "and" as const,
614
643
  };
615
- const cur = state.value.filters[col.field];
644
+ const cur = state.value.filters[colKeyOf(col)];
616
645
  const condOn = cur != null && cur.operator !== "set";
617
646
  return {
618
647
  operator: condOn
@@ -632,7 +661,7 @@ function applyFilterBuilder(patch: Partial<FilterBuilderInput>) {
632
661
  const col = filterDropCol.value;
633
662
  if (!col) return;
634
663
  grid.setFilter(
635
- col.field,
664
+ colKeyOf(col),
636
665
  buildColumnFilter({ ...filterDropBuilder.value, ...patch }),
637
666
  );
638
667
  }
@@ -683,9 +712,7 @@ const PIVOT_AGGS: BuiltInAggregateFn[] = [
683
712
  ];
684
713
  const pivotDropZone = ref<string | null>(null);
685
714
  function pivotHeaderOf(field: string) {
686
- return (
687
- state.value.sourceColumns.find((c) => c.field === field)?.header ?? field
688
- );
715
+ return resolveColumn(state.value.sourceColumns, field)?.header ?? field;
689
716
  }
690
717
  function onPivotAggChange(field: string, e: Event) {
691
718
  const v = (e.target as HTMLSelectElement).value;
@@ -695,7 +722,7 @@ function pivotChipsOf(zone: string) {
695
722
  const p = state.value.pivot;
696
723
  if (zone === "fields")
697
724
  return state.value.sourceColumns.map((c) => ({
698
- field: c.field,
725
+ field: colKeyOf(c),
699
726
  label: c.header ?? c.field,
700
727
  agg: undefined as AggregateFn | undefined,
701
728
  }));
@@ -755,8 +782,8 @@ function onPivotZoneDrop(zone: string, e: DragEvent, index?: number) {
755
782
  if (!f) return;
756
783
  e.preventDefault();
757
784
  e.stopPropagation();
758
- if (zone === "fields") grid.removePivotField(f as string);
759
- else grid.addPivotField(zone as PivotZone, f as string, { index });
785
+ if (zone === "fields") grid.removePivotField(f);
786
+ else grid.addPivotField(zone as PivotZone, f, { index });
760
787
  }
761
788
  function onPivotChipDragStart(field: string, e: DragEvent) {
762
789
  e.dataTransfer!.effectAllowed = "move";
@@ -768,12 +795,13 @@ function onPivotChipDragOver(e: DragEvent) {
768
795
  e.stopPropagation();
769
796
  }
770
797
 
771
- // 행 높이 + rowStyle — 가상 스크롤은 고정, 아니면 autoRowHeight 추정치 적용
798
+ // 행 높이 + rowStyle — 가상 스크롤은 슬라이스 높이(가변)/고정, 아니면 autoRowHeight 추정치
772
799
  function rowStyleOf(entry: AnyRow, rowIdx: number) {
773
800
  const row = rowDataOf(entry);
774
801
  const base: Record<string, string> = {};
775
- const h =
776
- virtual.value && props.rowHeight ? props.rowHeight : grid.getRowHeight(row);
802
+ const h = virtual.value
803
+ ? (virtual.value.heights?.[rowIdx] ?? props.rowHeight)
804
+ : grid.getRowHeight(row);
777
805
  if (h) base.height = `${h}px`;
778
806
  // GridOptions/ColumnDef.rowStyle — kebab-case 맵 병합 (Vue :style이 그대로 적용)
779
807
  const custom = grid.getRowStyle(row, entryIndexOf(entry, rowIdx));
@@ -784,7 +812,7 @@ function rowStyleOf(entry: AnyRow, rowIdx: number) {
784
812
  // 그룹 패널 칩 — 클릭 시 해당 컬럼 그룹 해제
785
813
  function ungroupField(field: string) {
786
814
  grid.setGroupBy(
787
- state.value.groupBy.filter((f) => f !== field) as (keyof RowT & string)[],
815
+ state.value.groupBy.filter<keyof RowT & string>((f) => f !== field),
788
816
  );
789
817
  }
790
818
 
@@ -843,7 +871,7 @@ const bodyRows = computed<AnyRow[]>(() => {
843
871
  const v = virtual.value;
844
872
  return v ? displayRows.slice(v.startIndex, v.endIndex) : displayRows;
845
873
  }
846
- return (state.value.virtualRows || state.value.rows) as AnyRow[];
874
+ return state.value.virtualRows || state.value.rows;
847
875
  });
848
876
  const colSpan = computed(
849
877
  () =>
@@ -876,27 +904,16 @@ const activeFilterCount = computed(
876
904
  () => Object.keys(state.value.filters).length,
877
905
  );
878
906
  const bottomOffset = computed(() =>
879
- virtual.value && props.rowHeight
880
- ? Math.max(
881
- 0,
882
- virtual.value.totalHeight - virtual.value.endIndex * props.rowHeight,
883
- )
884
- : 0,
907
+ virtual.value ? virtual.value.endOffset : 0,
885
908
  );
886
909
 
887
910
  // ── 컬럼 고정: [Left | Scrollable | Right] 파티션 + sticky 오프셋 ──
888
- const lastLeftPinIdx = computed(() =>
889
- state.value.visibleColumns.reduce(
890
- (acc, c, i) => (c.pinned === "left" ? i : acc),
891
- -1,
892
- ),
893
- );
894
- const firstRightPinIdx = computed(() =>
895
- state.value.visibleColumns.findIndex((c) => c.pinned === "right"),
896
- );
897
- const hasPinned = computed(
898
- () => lastLeftPinIdx.value >= 0 || firstRightPinIdx.value >= 0,
899
- );
911
+ // 파티션 계산은 adapterDom 공용 — 템플릿의 edge 클래스 바인딩은
912
+ // lastLeftPinIdx/firstRightPinIdx 이름을 유지해 diff를 최소화한다
913
+ const pinPart = computed(() => pinPartition(state.value.visibleColumns));
914
+ const lastLeftPinIdx = computed(() => pinPart.value.lastLeftPinIdx);
915
+ const firstRightPinIdx = computed(() => pinPart.value.firstRightPinIdx);
916
+ const hasPinned = computed(() => pinPart.value.hasPinned);
900
917
  const hasAppend = computed(() => !!state.value.appendScroll);
901
918
 
902
919
  // ── 컬럼 가상화 — 윈도우 밖 연속 구간을 spacer 셀로 대체 ──
@@ -919,15 +936,11 @@ const renderCols = computed(() =>
919
936
  );
920
937
 
921
938
  function pinStyleOf(col: ColumnDef<RowT>): CSSProperties | undefined {
922
- if (!col.pinned) return undefined;
923
939
  // 논리 인셋 — pinned:"left"는 inline-start라 dir="rtl"이면 우측에 붙는다
924
- const side =
925
- col.pinned === "left" ? "inset-inline-start" : "inset-inline-end";
926
- return {
927
- position: "sticky",
928
- width: `${col.width ?? DEFAULT_COLUMN_WIDTH}px`,
929
- [side]: `${state.value.pinOffsets[col.field] ?? 0}px`,
930
- };
940
+ // 계산은 adapterDom 공용 (5개 렌더러 동일 계약). PinStyleProps는 Vue
941
+ // CSSProperties가 요구하는 CSS 변수 인덱스 시그니처가 없어 캐스트한다
942
+ return pinStyleProps(col, state.value.pinOffsets) as
943
+ CSSProperties | undefined;
931
944
  }
932
945
 
933
946
  // ── 다중 정렬 ──
@@ -972,7 +985,7 @@ function onLoadMore() {
972
985
 
973
986
  // ── 컨텍스트 메뉴 + 셀 타입 ──
974
987
  function onHeaderContextMenu(e: MouseEvent, col: ColumnDef): void {
975
- if (grid.openHeaderContextMenu(e.clientX, e.clientY, col.field)) {
988
+ if (grid.openHeaderContextMenu(e.clientX, e.clientY, colKeyOf(col))) {
976
989
  e.preventDefault();
977
990
  }
978
991
  }
@@ -982,26 +995,33 @@ function onCellContextMenu(
982
995
  rowIndex: number,
983
996
  col: ColumnDef,
984
997
  ): void {
985
- if (grid.openContextMenu(e.clientX, e.clientY, rowIndex, col.field)) {
998
+ if (grid.openContextMenu(e.clientX, e.clientY, rowIndex, colKeyOf(col))) {
986
999
  e.preventDefault();
987
1000
  }
988
1001
  }
989
1002
 
1003
+ // 터치 제스처의 릴리즈 클릭 삼킘 해제 함수 레지스트리 — 언마운트 시
1004
+ // 일괄 해제해, 삼킘 리스너가 다음 무관한 클릭을 삼키는 것을 막는다
1005
+ const swallows = new Set<() => void>();
1006
+ onBeforeUnmount(() => {
1007
+ swallows.forEach((fn) => fn());
1008
+ swallows.clear();
1009
+ });
990
1010
  // 터치 롱프레스 → contextmenu와 동일 동작 (헤더/셀 공용 트래커)
991
- const lp = createLongPressTracker();
1011
+ const lp = createLongPressTracker({ registry: swallows });
992
1012
 
993
1013
  function onCellPointerDown(
994
1014
  e: PointerEvent,
995
1015
  rowIndex: number,
996
1016
  col: ColumnDef,
997
1017
  ): void {
998
- lp.down(e, (x, y) => grid.openContextMenu(x, y, rowIndex, col.field));
1018
+ lp.down(e, (x, y) => grid.openContextMenu(x, y, rowIndex, colKeyOf(col)));
999
1019
  }
1000
1020
 
1001
1021
  function onHeaderPointerDown(e: PointerEvent, col: ColumnDef): void {
1002
- lp.down(e, (x, y) => grid.openHeaderContextMenu(x, y, col.field));
1022
+ lp.down(e, (x, y) => grid.openHeaderContextMenu(x, y, colKeyOf(col)));
1003
1023
  if (props.reorderable && col.movable !== false)
1004
- touchDrag.col.down(e, col.field);
1024
+ touchDrag.col.down(e, colKeyOf(col));
1005
1025
  }
1006
1026
 
1007
1027
  // ── 터치 커스텀 DnD — iOS/Android는 HTML5 DnD가 없어 포인터 제스처로 보강 ──
@@ -1054,16 +1074,13 @@ function touchRowDropAt(
1054
1074
  const rowIndex = Number(td.getAttribute("data-mg-row"));
1055
1075
  const tr = td.closest("tr");
1056
1076
  if (Number.isNaN(rowIndex) || !tr) return null;
1057
- const rect = tr.getBoundingClientRect();
1058
- const ratio = (y - rect.top) / rect.height;
1059
- // 트리 모드는 상하 25%=before/after, 가운데 50%=inside
1060
- if (grid.isTreeRowDraggable()) {
1061
- return {
1062
- index: rowIndex,
1063
- position: ratio < 0.25 ? "before" : ratio > 0.75 ? "after" : "inside",
1064
- };
1065
- }
1066
- return { index: ratio < 0.5 ? rowIndex : rowIndex + 1 };
1077
+ // 트리는 상하 25%=before/after·가운데 50%=inside, 평면은 상하반 gap
1078
+ // — adapterDom의 단일 드롭 계약
1079
+ return resolveRowDrop(
1080
+ dropRatioForY(y, tr.getBoundingClientRect()),
1081
+ rowIndex,
1082
+ grid.isTreeRowDraggable(),
1083
+ );
1067
1084
  }
1068
1085
 
1069
1086
  function applyTouchDrop(
@@ -1096,71 +1113,83 @@ function clearTouchDropMarks(): void {
1096
1113
 
1097
1114
  const touchDrag = {
1098
1115
  // 컬럼 헤더 — 수평 이동으로 확정 (th는 touch-action: pan-y)
1099
- col: createTouchDrag<string>("x", {
1100
- start: (field: string) => {
1101
- // 롱프레스 메뉴가 이미 열렸으면 드래그로 전환하지 않는다
1102
- if (grid.getSnapshot().contextMenu) return false;
1103
- lp.end();
1104
- touchColFieldRaw = field;
1105
- touchColField.value = field;
1106
- return true;
1107
- },
1108
- move: (_x: number, _y: number, target: Element | null) => {
1109
- const hit = touchHitAt(target);
1110
- dragOverField.value =
1111
- hit?.kind === "column" && hit.field !== touchColFieldRaw
1112
- ? hit.field
1113
- : null;
1114
- pivotDropZone.value = hit?.kind === "pivot" ? hit.zone : null;
1115
- groupDropOver.value = hit?.kind === "group";
1116
- },
1117
- up: (_x: number, _y: number, target: Element | null, field: string) => {
1118
- applyTouchDrop(touchHitAt(target), field);
1119
- clearTouchDropMarks();
1120
- touchColFieldRaw = null;
1121
- touchColField.value = null;
1122
- },
1123
- cancel: () => {
1124
- clearTouchDropMarks();
1125
- touchColFieldRaw = null;
1126
- touchColField.value = null;
1116
+ col: createTouchDrag<string>(
1117
+ "x",
1118
+ {
1119
+ start: (field: string) => {
1120
+ // 롱프레스 메뉴가 이미 열렸으면 드래그로 전환하지 않는다
1121
+ if (grid.getSnapshot().contextMenu) return false;
1122
+ lp.end();
1123
+ touchColFieldRaw = field;
1124
+ touchColField.value = field;
1125
+ return true;
1126
+ },
1127
+ move: (_x: number, _y: number, target: Element | null) => {
1128
+ const hit = touchHitAt(target);
1129
+ dragOverField.value =
1130
+ hit?.kind === "column" && hit.field !== touchColFieldRaw
1131
+ ? hit.field
1132
+ : null;
1133
+ pivotDropZone.value = hit?.kind === "pivot" ? hit.zone : null;
1134
+ groupDropOver.value = hit?.kind === "group";
1135
+ },
1136
+ up: (_x: number, _y: number, target: Element | null, field: string) => {
1137
+ applyTouchDrop(touchHitAt(target), field);
1138
+ clearTouchDropMarks();
1139
+ touchColFieldRaw = null;
1140
+ touchColField.value = null;
1141
+ },
1142
+ cancel: () => {
1143
+ clearTouchDropMarks();
1144
+ touchColFieldRaw = null;
1145
+ touchColField.value = null;
1146
+ },
1127
1147
  },
1128
- }),
1148
+ { registry: swallows },
1149
+ ),
1129
1150
  // 행 드래그 핸들 — 세로 이동으로 확정 (핸들은 touch-action: none)
1130
- row: createTouchDrag<number>("y", {
1131
- start: (rowIndex: number) => {
1132
- lp.end();
1133
- return grid.beginRowDrag(rowIndex);
1134
- },
1135
- move: (_x: number, y: number, target: Element | null) => {
1136
- const drop = touchRowDropAt(target, y);
1137
- if (drop != null) grid.updateRowDropPosition(drop.index, drop.position);
1151
+ row: createTouchDrag<number>(
1152
+ "y",
1153
+ {
1154
+ start: (rowIndex: number) => {
1155
+ lp.end();
1156
+ return grid.beginRowDrag(rowIndex);
1157
+ },
1158
+ move: (_x: number, y: number, target: Element | null) => {
1159
+ const drop = touchRowDropAt(target, y);
1160
+ if (drop != null) grid.updateRowDropPosition(drop.index, drop.position);
1161
+ },
1162
+ up: () => grid.endRowDrag(true),
1163
+ cancel: () => grid.endRowDrag(false),
1138
1164
  },
1139
- up: () => grid.endRowDrag(true),
1140
- cancel: () => grid.endRowDrag(false),
1141
- }),
1165
+ { registry: swallows },
1166
+ ),
1142
1167
  // 피벗 칩 — 아무 방향이든 이동으로 확정 (칩은 touch-action: none)
1143
- chip: createTouchDrag<string>("any", {
1144
- move: (_x: number, _y: number, target: Element | null) => {
1145
- const hit = touchHitAt(target);
1146
- pivotDropZone.value = hit?.kind === "pivot" ? hit.zone : null;
1147
- },
1148
- up: (_x: number, _y: number, target: Element | null, field: string) => {
1149
- const hit = touchHitAt(target);
1150
- pivotDropZone.value = null;
1151
- if (hit?.kind !== "pivot") return;
1152
- if (hit.zone === "fields") grid.removePivotField(field);
1153
- else
1154
- grid.addPivotField(
1155
- hit.zone as PivotZone,
1156
- field,
1157
- hit.index != null ? { index: hit.index } : {},
1158
- );
1159
- },
1160
- cancel: () => {
1161
- pivotDropZone.value = null;
1168
+ chip: createTouchDrag<string>(
1169
+ "any",
1170
+ {
1171
+ move: (_x: number, _y: number, target: Element | null) => {
1172
+ const hit = touchHitAt(target);
1173
+ pivotDropZone.value = hit?.kind === "pivot" ? hit.zone : null;
1174
+ },
1175
+ up: (_x: number, _y: number, target: Element | null, field: string) => {
1176
+ const hit = touchHitAt(target);
1177
+ pivotDropZone.value = null;
1178
+ if (hit?.kind !== "pivot") return;
1179
+ if (hit.zone === "fields") grid.removePivotField(field);
1180
+ else
1181
+ grid.addPivotField(
1182
+ hit.zone as PivotZone,
1183
+ field,
1184
+ hit.index != null ? { index: hit.index } : {},
1185
+ );
1186
+ },
1187
+ cancel: () => {
1188
+ pivotDropZone.value = null;
1189
+ },
1162
1190
  },
1163
- }),
1191
+ { registry: swallows },
1192
+ ),
1164
1193
  };
1165
1194
 
1166
1195
  function onPivotChipPointerDown(field: string, e: PointerEvent): void {
@@ -1203,48 +1232,18 @@ onMounted(() => {
1203
1232
  });
1204
1233
  });
1205
1234
 
1206
- function cellPosFromPoint(
1207
- x: number,
1208
- y: number,
1209
- ): { row: number; col: number } | null {
1210
- const el = document.elementFromPoint(x, y)?.closest("td[data-mg-row]");
1211
- if (!el) return null;
1212
- const row = Number(el.getAttribute("data-mg-row"));
1213
- const col = Number(el.getAttribute("data-mg-col"));
1214
- return Number.isNaN(row) || Number.isNaN(col) ? null : { row, col };
1215
- }
1216
-
1217
- let fillSource: {
1218
- startRow: number;
1219
- endRow: number;
1220
- startCol: number;
1221
- endCol: number;
1222
- } | null = null;
1235
+ // 진행 중 포인터 드래그의 취소 함수 — 언마운트 시 document 리스너 해제
1236
+ let dragCancel: (() => void) | null = null;
1237
+ onBeforeUnmount(() => dragCancel?.());
1223
1238
 
1239
+ // 채우기 핸들 — 릴리즈 좌표까지 범위 확장+fill은 adapterDom 컨트롤러.
1240
+ // hostEl을 넘겨 그리드 밖(다른 그리드 셀) 릴리즈를 무시한다
1224
1241
  function onFillPointerDown(e: PointerEvent): void {
1225
1242
  e.preventDefault();
1226
1243
  e.stopPropagation();
1227
1244
  const src = state.value.selectedRange;
1228
1245
  if (!src) return;
1229
- fillSource = { ...src };
1230
- const onUp = (ev: PointerEvent) => {
1231
- window.removeEventListener("pointerup", onUp);
1232
- window.removeEventListener("pointercancel", onUp);
1233
- const source = fillSource;
1234
- fillSource = null;
1235
- const pos = cellPosFromPoint(ev.clientX, ev.clientY);
1236
- if (!source || !pos) return;
1237
- const target = {
1238
- startRow: Math.min(source.startRow, pos.row),
1239
- endRow: Math.max(source.endRow, pos.row),
1240
- startCol: Math.min(source.startCol, pos.col),
1241
- endCol: Math.max(source.endCol, pos.col),
1242
- };
1243
- grid.fillRange(source, target);
1244
- grid.setCellRange(target);
1245
- };
1246
- window.addEventListener("pointerup", onUp);
1247
- window.addEventListener("pointercancel", onUp);
1246
+ dragCancel = startFillDrag(e, src, grid, hostEl.value);
1248
1247
  }
1249
1248
 
1250
1249
  function cellLinkHref(row: RowData, col: ColumnDef): string {
@@ -1269,7 +1268,7 @@ function filterOpsOf(col: ColumnDef<Record<string, unknown>>) {
1269
1268
  }
1270
1269
 
1271
1270
  function filterOpOf(col: ColumnDef<Record<string, unknown>>): FilterOperator {
1272
- const f = state.value.filters[col.field];
1271
+ const f = state.value.filters[colKeyOf(col)];
1273
1272
  return f ? f.operator : DEFAULT_OPERATOR_BY_TYPE[col.filterType || "text"];
1274
1273
  }
1275
1274
 
@@ -1282,7 +1281,7 @@ function filterValueOf(
1282
1281
  col: ColumnDef<Record<string, unknown>>,
1283
1282
  key: "value" | "valueTo",
1284
1283
  ) {
1285
- const f = state.value.filters[col.field];
1284
+ const f = state.value.filters[colKeyOf(col)];
1286
1285
  return f ? f[key] || "" : "";
1287
1286
  }
1288
1287
 
@@ -1290,8 +1289,8 @@ function updateFilter(
1290
1289
  col: ColumnDef<Record<string, unknown>>,
1291
1290
  patch: Partial<ColumnFilter>,
1292
1291
  ) {
1293
- const f = state.value.filters[col.field];
1294
- grid.setFilter(col.field, {
1292
+ const f = state.value.filters[colKeyOf(col)];
1293
+ grid.setFilter(colKeyOf(col), {
1295
1294
  operator: filterOpOf(col),
1296
1295
  value: f ? f.value : "",
1297
1296
  valueTo: f ? f.valueTo : undefined,
@@ -1322,23 +1321,23 @@ function isSetFilter(col: ColumnDef<Record<string, unknown>>) {
1322
1321
  }
1323
1322
 
1324
1323
  function setValuesOf(col: ColumnDef<Record<string, unknown>>): string[] {
1325
- return grid.getUniqueValues(col.field);
1324
+ return grid.getUniqueValues(colKeyOf(col));
1326
1325
  }
1327
1326
 
1328
1327
  function setFilterLabel(col: ColumnDef<Record<string, unknown>>) {
1329
- const f = state.value.filters[col.field];
1328
+ const f = state.value.filters[colKeyOf(col)];
1330
1329
  const vals = f && f.values;
1331
1330
  return vals ? state.value.locale.setFilterCount(vals.length) : "전체";
1332
1331
  }
1333
1332
 
1334
1333
  function setCheckedOf(col: ColumnDef<Record<string, unknown>>, v: string) {
1335
- const f = state.value.filters[col.field];
1334
+ const f = state.value.filters[colKeyOf(col)];
1336
1335
  const vals = f && f.values;
1337
1336
  return vals ? vals.includes(v) : true;
1338
1337
  }
1339
1338
 
1340
1339
  function setAllCheckedOf(col: ColumnDef<Record<string, unknown>>) {
1341
- const f = state.value.filters[col.field];
1340
+ const f = state.value.filters[colKeyOf(col)];
1342
1341
  const vals = f && f.values;
1343
1342
  return !vals || vals.length >= setValuesOf(col).length;
1344
1343
  }
@@ -1350,13 +1349,13 @@ function onSetToggle(
1350
1349
  ) {
1351
1350
  const checked = (event.target as HTMLInputElement).checked;
1352
1351
  const all = setValuesOf(col);
1353
- const f = state.value.filters[col.field];
1352
+ const f = state.value.filters[colKeyOf(col)];
1354
1353
  const next = new Set((f && f.values) || all);
1355
1354
  if (checked) next.add(v);
1356
1355
  else next.delete(v);
1357
- if (next.size >= all.length) grid.setFilter(col.field, null);
1356
+ if (next.size >= all.length) grid.setFilter(colKeyOf(col), null);
1358
1357
  else {
1359
- grid.setFilter(col.field, {
1358
+ grid.setFilter(colKeyOf(col), {
1360
1359
  operator: "set",
1361
1360
  value: "",
1362
1361
  values: [...next],
@@ -1400,7 +1399,7 @@ const headerRows = computed<HeaderCell[][]>(() => {
1400
1399
  }
1401
1400
  : {
1402
1401
  kind: "col" as const,
1403
- key: it.col.field,
1402
+ key: colKeyOf(it.col),
1404
1403
  col: it.col,
1405
1404
  colIndex: it.index,
1406
1405
  },
@@ -1417,7 +1416,7 @@ const headerRows = computed<HeaderCell[][]>(() => {
1417
1416
  }
1418
1417
  : {
1419
1418
  kind: "col",
1420
- key: cols[s.startIndex]!.field,
1419
+ key: colKeyOf(cols[s.startIndex]!),
1421
1420
  col: cols[s.startIndex]!,
1422
1421
  colIndex: s.startIndex,
1423
1422
  rowSpan: 2,
@@ -1427,7 +1426,7 @@ const headerRows = computed<HeaderCell[][]>(() => {
1427
1426
  s.groupId
1428
1427
  ? cols.slice(s.startIndex, s.startIndex + s.colSpan).map((col, i) => ({
1429
1428
  kind: "col" as const,
1430
- key: col.field,
1429
+ key: colKeyOf(col),
1431
1430
  col,
1432
1431
  colIndex: s.startIndex + i,
1433
1432
  }))
@@ -1438,73 +1437,35 @@ const headerRows = computed<HeaderCell[][]>(() => {
1438
1437
 
1439
1438
  const headerRowSpan = computed(() => headerRows.value.length);
1440
1439
 
1441
- // ── 컬럼 리사이즈: document pointermove를 rAF로 스로틀 ──
1442
- // pointerdown/move/up — 마우스·터치·펜 공통 경로 (핸들은 touch-action:none)
1443
- let resizeRaf = 0;
1444
- let pendingWidth: { field: string; width: number } | null = null;
1445
-
1440
+ // ── 리사이즈: document 포인터 추적은 adapterDom 컨트롤러에 위임 ──
1441
+ // rAF 스로틀·RTL 부호 반전·최종값 확정이 코어에 단일화돼 있다
1446
1442
  function onResizeStart(col: ColumnDef, event: PointerEvent) {
1447
- const th = (event.currentTarget as HTMLElement).closest("th");
1448
- const startWidth = th?.getBoundingClientRect().width ?? 0;
1449
- const startX = event.clientX;
1450
- const field = col.field;
1451
-
1452
- const onMove = (ev: PointerEvent) => {
1453
- pendingWidth = { field, width: startWidth + (ev.clientX - startX) };
1454
- if (resizeRaf === 0) {
1455
- resizeRaf = requestAnimationFrame(() => {
1456
- resizeRaf = 0;
1457
- if (pendingWidth)
1458
- grid.setColumnWidth(pendingWidth.field, pendingWidth.width);
1459
- });
1460
- }
1461
- };
1462
- const onUp = () => {
1463
- document.removeEventListener("pointermove", onMove);
1464
- document.removeEventListener("pointerup", onUp);
1465
- document.removeEventListener("pointercancel", onUp);
1466
- if (resizeRaf !== 0) {
1467
- cancelAnimationFrame(resizeRaf);
1468
- resizeRaf = 0;
1469
- }
1470
- if (pendingWidth)
1471
- grid.setColumnWidth(pendingWidth.field, pendingWidth.width);
1472
- pendingWidth = null;
1473
- };
1474
- document.addEventListener("pointermove", onMove);
1475
- document.addEventListener("pointerup", onUp);
1476
- document.addEventListener("pointercancel", onUp);
1443
+ dragCancel = startColumnResize(event, {
1444
+ field: colKeyOf(col),
1445
+ dir: grid.getSnapshot().dir,
1446
+ setWidth: (f, w) => grid.setColumnWidth(f, w),
1447
+ });
1477
1448
  }
1478
1449
 
1479
1450
  // ── 행 높이 리사이즈: 행 번호 셀 하단 핸들 드래그 → setRowHeight ──
1480
1451
  function onRowResizeStart(rowId: string, event: PointerEvent) {
1481
1452
  event.preventDefault();
1482
1453
  event.stopPropagation();
1483
- const tr = (event.currentTarget as HTMLElement).closest("tr");
1484
- const startHeight = tr?.getBoundingClientRect().height ?? 0;
1485
- const startY = event.clientY;
1486
- const onMove = (ev: PointerEvent) => {
1487
- grid.setRowHeight(rowId, Math.max(16, startHeight + (ev.clientY - startY)));
1488
- };
1489
- const onUp = () => {
1490
- document.removeEventListener("pointermove", onMove);
1491
- document.removeEventListener("pointerup", onUp);
1492
- document.removeEventListener("pointercancel", onUp);
1493
- };
1494
- document.addEventListener("pointermove", onMove);
1495
- document.addEventListener("pointerup", onUp);
1496
- document.addEventListener("pointercancel", onUp);
1454
+ dragCancel = startRowResize(event, {
1455
+ setHeight: (h) => grid.setRowHeight(rowId, h),
1456
+ });
1497
1457
  }
1498
1458
 
1499
1459
  // 키보드 리사이즈 (방향키 ±10px)
1500
1460
  function onResizerKeydown(col: ColumnDef, event: KeyboardEvent) {
1501
- const delta =
1502
- event.key === "ArrowLeft" ? -10 : event.key === "ArrowRight" ? 10 : 0;
1461
+ if (event.isComposing) return;
1462
+ // ±10px — RTL 부호 반전은 adapterDom 계약
1463
+ const delta = resizeKeyDelta(event.key, grid.getSnapshot().dir);
1503
1464
  if (delta === 0) return;
1504
1465
  event.preventDefault();
1505
1466
  const th = (event.currentTarget as HTMLElement).closest("th");
1506
1467
  const w = th?.getBoundingClientRect().width ?? col.width ?? 0;
1507
- grid.setColumnWidth(col.field, w + delta);
1468
+ grid.setColumnWidth(colKeyOf(col), w + delta);
1508
1469
  }
1509
1470
 
1510
1471
  // ── 컬럼 드래그 재배치 (HTML5 DnD) ──
@@ -1512,25 +1473,26 @@ const dragOverField = ref<string | null>(null);
1512
1473
  let dragField: string | null = null;
1513
1474
 
1514
1475
  function onDragStart(col: ColumnDef, event: DragEvent) {
1515
- dragField = col.field;
1476
+ dragField = colKeyOf(col);
1516
1477
  if (event.dataTransfer) {
1517
1478
  event.dataTransfer.effectAllowed = "move";
1518
- event.dataTransfer.setData("text/plain", col.field);
1519
- event.dataTransfer.setData("application/x-mg-column", col.field);
1479
+ event.dataTransfer.setData("text/plain", colKeyOf(col));
1480
+ event.dataTransfer.setData("application/x-mg-column", colKeyOf(col));
1520
1481
  }
1521
1482
  }
1522
1483
 
1523
1484
  function onDragOver(col: ColumnDef, event: DragEvent) {
1524
- if (!props.reorderable || !dragField || dragField === col.field) return;
1485
+ if (!props.reorderable || !dragField || dragField === colKeyOf(col)) return;
1525
1486
  event.preventDefault();
1526
1487
  if (event.dataTransfer) event.dataTransfer.dropEffect = "move";
1527
- if (dragOverField.value !== col.field) dragOverField.value = col.field;
1488
+ if (dragOverField.value !== colKeyOf(col))
1489
+ dragOverField.value = colKeyOf(col);
1528
1490
  }
1529
1491
 
1530
1492
  function onDrop(col: ColumnDef, event: DragEvent) {
1531
1493
  event.preventDefault();
1532
- if (dragField && dragField !== col.field) {
1533
- grid.reorderColumn(dragField, col.field);
1494
+ if (dragField && dragField !== colKeyOf(col)) {
1495
+ grid.reorderColumn(dragField, colKeyOf(col));
1534
1496
  }
1535
1497
  onDragEnd();
1536
1498
  }
@@ -1593,39 +1555,8 @@ function rowStateOf(row: RowT | null | undefined) {
1593
1555
  return row ? state.value.rowStates[grid.getRowId(row)] : undefined;
1594
1556
  }
1595
1557
 
1596
- /** 변경(I/U/D) 행의 셀 유효성 에러 — required/validate 검사. 없으면 null. */
1597
- function cellErrorOf(entry: AnyRow, col: ColumnDef): string | null {
1598
- const row = rowDataOf(entry);
1599
- if (!row) return null;
1600
- // setCellError 수동 마킹은 행 상태·validate 유무와 무관하게 표시한다
1601
- if (grid.hasManualCellError(row, col)) return grid.getCellError(row, col);
1602
- if (!rowStateOf(row)) return null;
1603
- if (!col.required && !col.validate) return null;
1604
- return grid.getCellError(row, col);
1605
- }
1606
-
1607
- /** 셀 노트 텍스트 — 있으면 td에 mg-cell-note 클래스 + title로 표시 */
1608
- function cellNoteOf(entry: AnyRow, col: ColumnDef): string | null {
1609
- const row = rowDataOf(entry);
1610
- if (row == null) return null;
1611
- return grid.getCellNote(row, col);
1612
- }
1613
-
1614
- function cellClassOf(entry: AnyRow, rowIdx: number, col: ColumnDef) {
1615
- const row = rowDataOf(entry);
1616
- if (row == null) return "";
1617
- return grid.getCellClass(row, entryIndexOf(entry, rowIdx), col);
1618
- }
1619
-
1620
- /** find 하이라이트 — findBox 검색어에 매치되는 셀인지 (그룹 헤더 등 null 행 제외) */
1621
- function isFindMatch(entry: AnyRow, col: ColumnDef): boolean {
1622
- const row = rowDataOf(entry);
1623
- return (
1624
- !!state.value.findQuery &&
1625
- row != null &&
1626
- grid.isFindMatch(row, String(col.field))
1627
- );
1628
- }
1558
+ // 셀 유효성 에러/노트/find 매칭/사용자 cellClass 표현은 코어
1559
+ // describeCell로 이동했다 (cellDescOf가 호출)
1629
1560
 
1630
1561
  function onRowDragStart(rowIndex: number, event: DragEvent) {
1631
1562
  if (!grid.beginRowDrag(rowIndex)) {
@@ -1645,17 +1576,13 @@ function onRowDragOver(rowIndex: number, event: DragEvent) {
1645
1576
  event.preventDefault();
1646
1577
  if (event.dataTransfer) event.dataTransfer.dropEffect = "move";
1647
1578
  const rect = (event.currentTarget as HTMLElement).getBoundingClientRect();
1648
- const ratio = (event.clientY - rect.top) / rect.height;
1649
- // 트리 모드 — 상하 25%는 형제 위/아래, 가운데 50%는 자식(inside)
1650
- if (grid.isTreeRowDraggable()) {
1651
- grid.updateRowDropPosition(
1652
- rowIndex,
1653
- ratio < 0.25 ? "before" : ratio > 0.75 ? "after" : "inside",
1654
- );
1655
- return;
1656
- }
1657
- const gap = ratio < 0.5 ? rowIndex : rowIndex + 1;
1658
- grid.updateRowDropPosition(gap);
1579
+ // 트리는 상하 25%가 형제 위/아래·가운데 50%가 자식 — adapterDom 계약
1580
+ const drop = resolveRowDrop(
1581
+ dropRatioForY(event.clientY, rect),
1582
+ rowIndex,
1583
+ grid.isTreeRowDraggable(),
1584
+ );
1585
+ grid.updateRowDropPosition(drop.index, drop.position);
1659
1586
  }
1660
1587
 
1661
1588
  function onRowDrop(event: DragEvent) {
@@ -1669,192 +1596,24 @@ function onRowDragEnd() {
1669
1596
  }
1670
1597
 
1671
1598
  // ── 셀 선택: 방향키/Home/End/PageUp·Down → 코어 네비게이션 ──
1672
- const CELL_KEYS: Record<string, CellNavigation> = {
1673
- ArrowUp: "up",
1674
- ArrowDown: "down",
1675
- ArrowLeft: "left",
1676
- ArrowRight: "right",
1677
- Home: "home",
1678
- End: "end",
1679
- PageUp: "pageUp",
1680
- PageDown: "pageDown",
1681
- };
1682
-
1599
+ // 키 계약 전체(클립보드/이력/Escape/Delete/Tab/Enter/방향키/인쇄문자)는
1600
+ // adapterDom.handleGridKeydown에 단일화 — 5개 렌더러가 같은 코드를 실행한다
1683
1601
  function onGridKeydown(event: KeyboardEvent) {
1684
- if (event.isComposing) return; // IME 조합 중 — 조합 확정 키가 그리드 키로 해석되지 않도록
1685
- if ((event.target as HTMLElement).closest("input, textarea, select")) return;
1686
- // 클립보드/이력: Ctrl+C 복사, Ctrl+Shift+C 헤더 포함 복사,
1687
- // Ctrl+V 붙여넣기, Ctrl+Z 되돌리기, Ctrl+Y·Ctrl+Shift+Z 다시 실행
1688
- if (event.ctrlKey || event.metaKey) {
1689
- const key = event.key.toLowerCase();
1690
- if (key === "c") {
1691
- const tsv = grid.getSelectionTsv({ includeHeaders: event.shiftKey });
1692
- if (tsv != null) {
1693
- event.preventDefault();
1694
- void writeClipboardText(tsv);
1695
- }
1696
- } else if (key === "x") {
1697
- const tsv = grid.cutSelectionTsv(); // 엑셀 Ctrl+X — 잘라내기
1698
- if (tsv != null) {
1699
- event.preventDefault();
1700
- void writeClipboardText(tsv);
1701
- }
1702
- } else if (key === "v") {
1703
- event.preventDefault();
1704
- void readClipboardText().then((text) => {
1705
- if (text != null) grid.pasteTsv(text);
1706
- });
1707
- } else if (key === "z") {
1708
- event.preventDefault();
1709
- if (event.shiftKey) grid.redo();
1710
- else grid.undo();
1711
- } else if (key === "y") {
1712
- event.preventDefault();
1713
- grid.redo();
1714
- } else if (key === "a") {
1715
- // single-cell 모드의 selectAll은 전체 행 선택 — selectable일 때만
1716
- if (
1717
- state.value.selectionMode === "single-cell" &&
1718
- props.selectable === false
1719
- )
1720
- return;
1721
- event.preventDefault();
1722
- grid.selectAll();
1723
- } else if (key === "f") {
1724
- if (!props.findBox) return; // findBox 없으면 브라우저 검색에 양보
1725
- event.preventDefault();
1726
- findInputEl.value?.focus();
1727
- findInputEl.value?.select();
1728
- } else if (key === "d") {
1729
- event.preventDefault();
1730
- grid.fillDown(); // 엑셀 Ctrl+D — 아래 채우기
1731
- } else if (key === "r") {
1732
- event.preventDefault();
1733
- grid.fillRight(); // 엑셀 Ctrl+R — 오른쪽 채우기
1734
- } else if (event.key === "Home") {
1735
- event.preventDefault();
1736
- grid.navigateCell("first", event.shiftKey); // Ctrl+Home — 첫 셀
1737
- } else if (event.key === "End") {
1738
- event.preventDefault();
1739
- grid.navigateCell("last", event.shiftKey); // Ctrl+End — 마지막 셀
1740
- } else if (event.key === "ArrowUp") {
1741
- event.preventDefault();
1742
- grid.navigateCell("top", event.shiftKey);
1743
- } else if (event.key === "ArrowDown") {
1744
- event.preventDefault();
1745
- grid.navigateCell("bottom", event.shiftKey);
1746
- } else if (event.key === "ArrowLeft") {
1747
- event.preventDefault();
1748
- // Ctrl+←는 시각적 왼쪽 가장자리 — RTL에서는 논리적으로 마지막 컬럼
1749
- grid.navigateCell(
1750
- state.value.dir === "rtl" ? "end" : "home",
1751
- event.shiftKey,
1752
- );
1753
- } else if (event.key === "ArrowRight") {
1754
- event.preventDefault();
1755
- grid.navigateCell(
1756
- state.value.dir === "rtl" ? "home" : "end",
1757
- event.shiftKey,
1758
- );
1759
- } else if (event.key === " ") {
1760
- event.preventDefault();
1761
- grid.selectEntireColumn(); // 엑셀 Ctrl+Space — 열 선택
1762
- }
1763
- return;
1764
- }
1765
- if (event.key === "Escape") {
1766
- if (state.value.rowDrag) grid.endRowDrag(false);
1767
- else grid.clearCellSelection();
1768
- return;
1769
- }
1770
- if (event.key === "Delete" || event.key === "Backspace") {
1771
- // 선택 영역(없으면 활성 셀) 내용 지우기 — 타사 그리드 Del키 대응
1772
- event.preventDefault();
1773
- grid.clearRange();
1774
- return;
1775
- }
1776
- const active = state.value.activeCell;
1777
- if (event.key === " " && event.shiftKey) {
1778
- // 엑셀 Shift+Space — 행 선택 (타이핑 경로보다 먼저 처리).
1779
- // single-cell은 행 선택으로 대체되므로 selectable을 게이트한다
1780
- if (
1781
- state.value.selectionMode === "single-cell" &&
1782
- props.selectable === false
1783
- )
1784
- return;
1785
- event.preventDefault();
1786
- grid.selectEntireRow();
1787
- return;
1788
- }
1789
- if (event.key === "Tab" && active) {
1790
- // 엑셀 Tab — 활성 셀 좌/우 이동
1791
- event.preventDefault();
1792
- grid.navigateCell(event.shiftKey ? "tabLeft" : "tabRight");
1793
- return;
1794
- }
1795
- if (event.key === "Enter" || event.key === "F2") {
1796
- // 활성 셀에서 Enter → 편집 진입
1797
- if (active) {
1798
- event.preventDefault();
1799
- grid.startEditing(active.rowIndex, active.columnIndex);
1800
- }
1801
- return;
1802
- }
1803
- const dir = CELL_KEYS[event.key];
1804
- if (dir) {
1805
- event.preventDefault();
1806
- grid.navigateCell(dir, event.shiftKey);
1807
- return;
1808
- }
1809
- // 인쇄 가능한 문자 직접 입력 → 값을 교체하며 편집 진입
1810
- if (
1811
- event.key.length === 1 &&
1812
- !event.ctrlKey &&
1813
- !event.metaKey &&
1814
- !event.altKey &&
1815
- active
1816
- ) {
1817
- event.preventDefault();
1818
- grid.startEditing(active.rowIndex, active.columnIndex, event.key);
1819
- }
1602
+ handleGridKeydown(event, grid, {
1603
+ selectable: props.selectable,
1604
+ focusFind: props.findBox
1605
+ ? () => {
1606
+ findInputEl.value?.focus();
1607
+ findInputEl.value?.select();
1608
+ }
1609
+ : undefined,
1610
+ });
1820
1611
  }
1821
1612
 
1822
1613
  // 가상 스크롤/그룹화 시 행 인덱스 → visibleData 기준 인덱스
1823
- function isGroupRow(entry: AnyRow) {
1824
- return (entry as DisplayRow<RowT> | undefined)?.type === "group";
1825
- }
1826
-
1827
- function isSubtotalRow(entry: AnyRow) {
1828
- return (entry as DisplayRow<RowT> | undefined)?.type === "subtotal";
1829
- }
1830
-
1831
- function groupOf(entry: AnyRow): GroupNode<RowT> {
1832
- return entry as GroupNode<RowT>;
1833
- }
1834
-
1835
- function leafOf(entry: AnyRow): LeafDisplayRow<RowT> | null {
1836
- const e = entry as DisplayRow<RowT>;
1837
- return e && e.type === "leaf" ? (e as LeafDisplayRow<RowT>) : null;
1838
- }
1839
-
1840
- function rowDataOf(entry: AnyRow): RowT {
1841
- const l = leafOf(entry);
1842
- return l ? l.row : (entry as RowT);
1843
- }
1844
-
1845
- function leafDepthOf(entry: AnyRow) {
1846
- const l = leafOf(entry);
1847
- return l ? l.depth : 0;
1848
- }
1849
-
1850
- // 트리 노드 헬퍼 — 템플릿에서 non-null 단언(!)을 쓸 수 없어 함수로 노출
1851
- function leafHasChildren(entry: AnyRow): boolean | undefined {
1852
- return leafOf(entry)?.hasChildren;
1853
- }
1854
-
1855
- function leafExpanded(entry: AnyRow): boolean {
1856
- return leafOf(entry)?.expanded === true;
1857
- }
1614
+ // DisplayRow 판별/추출은 코어 displayRows 헬퍼를 import해 공유한다 —
1615
+ // 로컬에 두는 것은 어댑터 전용 상태(가상 스크롤, 스냅샷, grid)를
1616
+ // 읽는 wrapper뿐이다
1858
1617
 
1859
1618
  /** 전체 너비 행 판정 — leaf 행만 검사 (스켈레톤·그룹 행 제외) */
1860
1619
  function isFullWidthOf(entry: AnyRow, rowIdx: number): boolean {
@@ -1878,10 +1637,7 @@ function rowKeyOf(entry: AnyRow, rowIdx: number) {
1878
1637
  }
1879
1638
 
1880
1639
  function groupLabelOf(entry: AnyRow) {
1881
- const n = groupOf(entry);
1882
- const col = state.value.columns.find((c) => c.field === n.field);
1883
- const header = col && col.header ? col.header : n.field;
1884
- return `${header}: ${String(n.value == null ? "(빈 값)" : n.value)}`;
1640
+ return coreGroupLabelOf(groupOf(entry), state.value.columns);
1885
1641
  }
1886
1642
 
1887
1643
  function groupAggOf(entry: AnyRow, col: ColumnDef<RowT>) {
@@ -1894,9 +1650,24 @@ function onToggleGroup(entry: AnyRow) {
1894
1650
  }
1895
1651
 
1896
1652
  // ── 인라인 셀 편집 ──
1897
- // 셀 병합 정보 — td의 rowspan/colspan/hidden에 사용
1898
- function cellSpanOf(row: RowT, col: ColumnDef<RowT>) {
1899
- return grid.getCellSpan(row, col);
1653
+ // 셀 표현 디스크립터 — td의 클래스/스타일/title/병합 span은 코어
1654
+ // describeCell이 계산한다 (5개 렌더러 동일 계약, 스파스 행은 null)
1655
+ function cellDescOf(
1656
+ entry: AnyRow,
1657
+ rowIdx: number,
1658
+ col: ColumnDef,
1659
+ colIndex: number,
1660
+ ) {
1661
+ const row = rowDataOf(entry);
1662
+ if (row == null) return null;
1663
+ return describeCell(
1664
+ grid,
1665
+ row,
1666
+ entryIndexOf(entry, rowIdx),
1667
+ col,
1668
+ colIndex,
1669
+ leafHasChildren(entry) !== undefined ? leafDepthOf(entry) : null,
1670
+ );
1900
1671
  }
1901
1672
 
1902
1673
  function isEditingCell(rowIndex: number, colIndex: number) {
@@ -1907,13 +1678,13 @@ function isEditingCell(rowIndex: number, colIndex: number) {
1907
1678
  function editValueOf(col: ColumnDef) {
1908
1679
  const s = state.value;
1909
1680
  if (s.editType === "fullRow" && s.editingValues)
1910
- return s.editingValues[col.field];
1681
+ return s.editingValues[colKeyOf(col)];
1911
1682
  return s.editValue;
1912
1683
  }
1913
1684
  function editErrorOf(col: ColumnDef) {
1914
1685
  const s = state.value;
1915
1686
  if (s.editType === "fullRow" && s.editingErrors)
1916
- return s.editingErrors[col.field] ?? null;
1687
+ return s.editingErrors[colKeyOf(col)] ?? null;
1917
1688
  return s.editError;
1918
1689
  }
1919
1690
 
@@ -1929,7 +1700,7 @@ function onCellMouseDown(
1929
1700
  e: MouseEvent,
1930
1701
  rowIndex: number,
1931
1702
  colIndex: number,
1932
- col: ColumnDef,
1703
+ _col: ColumnDef,
1933
1704
  ) {
1934
1705
  if (e.button !== 0 || isEditingCell(rowIndex, colIndex)) return;
1935
1706
  // 인터랙티브 자식(체크박스·select·버튼·링크 등)은 건드리지 않는다 —
@@ -1954,8 +1725,13 @@ function onCellMouseDown(
1954
1725
  cellDragging = true;
1955
1726
  e.preventDefault(); // 드래그 중 텍스트 선택 방지
1956
1727
  }
1957
- function onCellMouseEnter(rowIndex: number, colIndex: number) {
1728
+ function onCellMouseEnter(e: MouseEvent, rowIndex: number, colIndex: number) {
1958
1729
  if (!cellDragging) return;
1730
+ // 창 밖 mouseup 유실로 남은 stale 드래그 — 버튼이 안 눌려 있으면 자가 치유
1731
+ if ((e.buttons & 1) === 0) {
1732
+ cellDragging = false;
1733
+ return;
1734
+ }
1959
1735
  suppressCellClick = true;
1960
1736
  grid.extendSelectionTo(rowIndex, colIndex);
1961
1737
  }
@@ -2006,7 +1782,7 @@ function onEditorInput(event: Event, col: ColumnDef) {
2006
1782
  el.setSelectionRange(next.length, next.length);
2007
1783
  }
2008
1784
  }
2009
- grid.updateEditValue(el.value, col.field);
1785
+ grid.updateEditValue(el.value, colKeyOf(col));
2010
1786
  }
2011
1787
 
2012
1788
  // text 에디터 표시 값 — editMask가 있으면 기존 저장값도 마스크 형태로 표시
@@ -2025,19 +1801,22 @@ function onMultiselectChange(event: Event, col: ColumnDef) {
2025
1801
  const sel = event.target as HTMLSelectElement;
2026
1802
  grid.updateEditValue(
2027
1803
  Array.from(sel.selectedOptions).map((o) => o.value),
2028
- col.field,
1804
+ colKeyOf(col),
2029
1805
  );
2030
1806
  }
2031
1807
 
2032
1808
  // 라디오 에디터 — 선택 즉시 커밋 (fullRow에서는 보류 값만 반영)
2033
1809
  function onRadioPick(opt: string, col: ColumnDef) {
2034
- grid.updateEditValue(opt, col.field);
1810
+ grid.updateEditValue(opt, colKeyOf(col));
2035
1811
  if (state.value.editType !== "fullRow") grid.commitEditing();
2036
1812
  }
2037
1813
 
2038
1814
  // select 에디터 — 고르는 즉시 커밋 (fullRow에서는 보류 값만 반영)
2039
1815
  function onSelectPick(event: Event, col: ColumnDef) {
2040
- grid.updateEditValue((event.target as HTMLSelectElement).value, col.field);
1816
+ grid.updateEditValue(
1817
+ (event.target as HTMLSelectElement).value,
1818
+ colKeyOf(col),
1819
+ );
2041
1820
  if (state.value.editType !== "fullRow") grid.commitEditing();
2042
1821
  }
2043
1822
 
@@ -2106,7 +1885,7 @@ watch(
2106
1885
  if (!cell) return;
2107
1886
  await nextTick();
2108
1887
  const colIdx = state.value.visibleColumns.findIndex(
2109
- (c) => c.field === cell.columnKey,
1888
+ (c) => colKeyOf(c) === cell.columnKey,
2110
1889
  );
2111
1890
  const target =
2112
1891
  scrollEl.value?.querySelector<HTMLElement>(
@@ -2335,7 +2114,7 @@ watch(
2335
2114
  title="클릭 시 그룹 해제"
2336
2115
  @click="ungroupField(field)"
2337
2116
  >
2338
- {{ state.columns.find((c) => c.field === field)?.header ?? field }} ×
2117
+ {{ resolveColumn(state.columns, field)?.header ?? field }} ×
2339
2118
  </button>
2340
2119
  </div>
2341
2120
  <div v-if="showOverlay" class="mg-colctl">
@@ -2378,13 +2157,13 @@ watch(
2378
2157
  </div>
2379
2158
  <label
2380
2159
  v-for="col in state.columns"
2381
- :key="col.field"
2160
+ :key="colKeyOf(col)"
2382
2161
  class="mg-colctl-item"
2383
2162
  >
2384
2163
  <input
2385
2164
  type="checkbox"
2386
2165
  :checked="col.visible !== false"
2387
- @change="onColumnToggle(col.field, $event)"
2166
+ @change="onColumnToggle(colKeyOf(col), $event)"
2388
2167
  />
2389
2168
  {{ col.header ?? col.field }}
2390
2169
  </label>
@@ -2427,7 +2206,7 @@ watch(
2427
2206
  <col v-if="rowNumbers" class="mg-col-rownum" />
2428
2207
  <col
2429
2208
  v-for="col in state.visibleColumns"
2430
- :key="col.field"
2209
+ :key="colKeyOf(col)"
2431
2210
  :style="{ width: `${col.width ?? DEFAULT_COLUMN_WIDTH}px` }"
2432
2211
  />
2433
2212
  </colgroup>
@@ -2493,8 +2272,8 @@ watch(
2493
2272
  :class="[
2494
2273
  {
2495
2274
  'mg-sortable': cell.col.sortable !== false,
2496
- 'mg-col-dragover': dragOverField === cell.col.field,
2497
- 'mg-col-dragging': touchColField === cell.col.field,
2275
+ 'mg-col-dragover': dragOverField === colKeyOf(cell.col),
2276
+ 'mg-col-dragging': touchColField === colKeyOf(cell.col),
2498
2277
  'mg-pinned': !!cell.col.pinned,
2499
2278
  'mg-pin-left-edge': cell.colIndex === lastLeftPinIdx,
2500
2279
  'mg-pin-right-edge': cell.colIndex === firstRightPinIdx,
@@ -2506,15 +2285,15 @@ watch(
2506
2285
  grid.getHeaderClass(cell.col),
2507
2286
  ]"
2508
2287
  :title="cell.col.headerTooltip"
2509
- :aria-sort="sortAria(cell.col.field)"
2288
+ :aria-sort="sortAria(colKeyOf(cell.col))"
2510
2289
  :draggable="reorderable && cell.col.movable !== false"
2511
2290
  @dragstart="onDragStart(cell.col, $event)"
2512
2291
  @dragover="onDragOver(cell.col, $event)"
2513
2292
  @drop="onDrop(cell.col, $event)"
2514
2293
  @dragend="onDragEnd"
2515
- @click="grid.toggleSort(cell.col.field, $event.shiftKey)"
2294
+ @click="grid.toggleSort(colKeyOf(cell.col), $event.shiftKey)"
2516
2295
  @contextmenu="onHeaderContextMenu($event, cell.col)"
2517
- :data-mg-field="cell.col.field"
2296
+ :data-mg-field="colKeyOf(cell.col)"
2518
2297
  @pointerdown="onHeaderPointerDown($event, cell.col)"
2519
2298
  >
2520
2299
  <input
@@ -2534,25 +2313,30 @@ watch(
2534
2313
  @change="grid.toggleAllChecked(cell.col)"
2535
2314
  />
2536
2315
  <!-- 커스텀 헤더 슬롯: #header-{field}="{ column }" -->
2537
- <slot :name="`header-${cell.col.field}`" :column="cell.col">{{
2538
- cell.col.header || cell.col.field
2539
- }}</slot>
2316
+ <slot
2317
+ :name="`header-${colKeyOf(cell.col)}`"
2318
+ :column="cell.col"
2319
+ >{{ cell.col.header || cell.col.field }}</slot
2320
+ >
2540
2321
  <span v-if="cell.col.required" class="mg-required-mark">*</span>
2541
- <span v-if="sortArrowOf(cell.col.field)" class="mg-sort-arrow">
2542
- {{ sortArrowOf(cell.col.field) }}
2322
+ <span
2323
+ v-if="sortArrowOf(colKeyOf(cell.col))"
2324
+ class="mg-sort-arrow"
2325
+ >
2326
+ {{ sortArrowOf(colKeyOf(cell.col)) }}
2543
2327
  </span>
2544
2328
  <span
2545
- v-if="sortPriorityOf(cell.col.field)"
2329
+ v-if="sortPriorityOf(colKeyOf(cell.col))"
2546
2330
  class="mg-sort-priority"
2547
2331
  >
2548
- {{ sortPriorityOf(cell.col.field) }}
2332
+ {{ sortPriorityOf(colKeyOf(cell.col)) }}
2549
2333
  </span>
2550
2334
  <button
2551
2335
  v-if="headerFilters && cell.col.filterable"
2552
2336
  type="button"
2553
2337
  :class="[
2554
2338
  'mg-header-filter-btn',
2555
- state.filters[cell.col.field] && 'mg-active',
2339
+ state.filters[colKeyOf(cell.col)] && 'mg-active',
2556
2340
  ]"
2557
2341
  :aria-label="`${cell.col.header || cell.col.field} 필터`"
2558
2342
  @click="toggleFilterDrop(cell.col, $event)"
@@ -2565,7 +2349,7 @@ watch(
2565
2349
  class="mg-resizer"
2566
2350
  :aria-label="`${cell.col.field} 너비 조절`"
2567
2351
  @pointerdown.stop.prevent="onResizeStart(cell.col, $event)"
2568
- @dblclick.stop="grid.autoSizeColumn(cell.col.field)"
2352
+ @dblclick.stop="grid.autoSizeColumn(colKeyOf(cell.col))"
2569
2353
  @keydown.stop="onResizerKeydown(cell.col, $event)"
2570
2354
  @click.stop
2571
2355
  />
@@ -2588,7 +2372,7 @@ watch(
2588
2372
  ></th>
2589
2373
  <th
2590
2374
  v-else
2591
- :key="col.field"
2375
+ :key="colKeyOf(col)"
2592
2376
  :class="{
2593
2377
  'mg-pinned': !!col.pinned,
2594
2378
  'mg-pin-left-edge': colIndex === lastLeftPinIdx,
@@ -2604,7 +2388,7 @@ watch(
2604
2388
  <input
2605
2389
  type="checkbox"
2606
2390
  :checked="setAllCheckedOf(col)"
2607
- @change="grid.setFilter(col.field, null)"
2391
+ @change="grid.setFilter(colKeyOf(col), null)"
2608
2392
  />
2609
2393
  {{ state.locale.setFilterAll }}
2610
2394
  </label>
@@ -2681,7 +2465,7 @@ watch(
2681
2465
  />
2682
2466
  <td
2683
2467
  v-else
2684
- :key="col.field"
2468
+ :key="colKeyOf(col)"
2685
2469
  :class="{
2686
2470
  'mg-pinned': !!col.pinned,
2687
2471
  'mg-pin-left-edge': colIndex === lastLeftPinIdx,
@@ -2730,7 +2514,7 @@ watch(
2730
2514
  />
2731
2515
  <td
2732
2516
  v-else
2733
- :key="col.field"
2517
+ :key="colKeyOf(col)"
2734
2518
  class="mg-group-cell"
2735
2519
  :class="{
2736
2520
  'mg-pinned': !!col.pinned,
@@ -2778,7 +2562,7 @@ watch(
2778
2562
  />
2779
2563
  <td
2780
2564
  v-else
2781
- :key="col.field"
2565
+ :key="colKeyOf(col)"
2782
2566
  class="mg-subtotal-cell"
2783
2567
  :class="{
2784
2568
  'mg-pinned': !!col.pinned,
@@ -2821,7 +2605,7 @@ watch(
2821
2605
  />
2822
2606
  <td
2823
2607
  v-else
2824
- :key="col.field"
2608
+ :key="colKeyOf(col)"
2825
2609
  :class="{
2826
2610
  'mg-pinned': !!col.pinned,
2827
2611
  'mg-pin-left-edge': colIndex === lastLeftPinIdx,
@@ -2914,64 +2698,14 @@ watch(
2914
2698
  :colspan="count"
2915
2699
  />
2916
2700
  <td
2917
- v-else-if="!cellSpanOf(rowDataOf(entry), col).hidden"
2918
- :key="col.field"
2919
- :rowspan="cellSpanOf(rowDataOf(entry), col).rowSpan"
2920
- :colspan="cellSpanOf(rowDataOf(entry), col).colSpan"
2921
- :class="[
2922
- col.align && col.align !== 'left'
2923
- ? `mg-align-${col.align}`
2924
- : '',
2925
- {
2926
- 'mg-cell-readonly': !grid.isCellEditable(
2927
- entryIndexOf(entry, rowIdx),
2928
- colIndex,
2929
- ),
2930
- 'mg-cell-active': grid.isActiveCell(
2931
- entryIndexOf(entry, rowIdx),
2932
- colIndex,
2933
- ),
2934
- 'mg-cell-selected': grid.isCellInRange(
2935
- entryIndexOf(entry, rowIdx),
2936
- colIndex,
2937
- ),
2938
- 'mg-cell-editing': isEditingCell(
2939
- entryIndexOf(entry, rowIdx),
2940
- colIndex,
2941
- ),
2942
- 'mg-cell-invalid': !!cellErrorOf(entry, col),
2943
- 'mg-find-match': isFindMatch(entry, col),
2944
- 'mg-cell-flash': state.flashedCells?.has(
2945
- grid.getRowId(rowDataOf(entry)) +
2946
- '|' +
2947
- String(col.field),
2948
- ),
2949
- 'mg-multiline': !!col.multiLine,
2950
- 'mg-pinned': !!col.pinned,
2951
- 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
2952
- 'mg-pin-right-edge': colIndex === firstRightPinIdx,
2953
- },
2954
- cellClassOf(entry, rowIdx, col),
2955
- cellNoteOf(entry, col) && 'mg-cell-note',
2956
- ]"
2701
+ v-else-if="!cellDescOf(entry, rowIdx, col, colIndex)?.hidden"
2702
+ :key="colKeyOf(col)"
2703
+ :rowspan="cellDescOf(entry, rowIdx, col, colIndex)?.rowSpan"
2704
+ :colspan="cellDescOf(entry, rowIdx, col, colIndex)?.colSpan"
2705
+ :class="cellDescOf(entry, rowIdx, col, colIndex)?.classes"
2957
2706
  role="gridcell"
2958
- :title="
2959
- cellErrorOf(entry, col) ||
2960
- grid.getCellTooltip(rowDataOf(entry), col) ||
2961
- cellNoteOf(entry, col) ||
2962
- undefined
2963
- "
2964
- :style="[
2965
- pinStyleOf(col),
2966
- colIndex === 0 && leafDepthOf(entry)
2967
- ? { paddingLeft: `${leafDepthOf(entry) * 16 + 12}px` }
2968
- : undefined,
2969
- grid.getCellStyle(
2970
- rowDataOf(entry),
2971
- entryIndexOf(entry, rowIdx),
2972
- col,
2973
- ) ?? undefined,
2974
- ]"
2707
+ :title="cellDescOf(entry, rowIdx, col, colIndex)?.title"
2708
+ :style="cellDescOf(entry, rowIdx, col, colIndex)?.styles"
2975
2709
  :data-mg-row="entryIndexOf(entry, rowIdx)"
2976
2710
  :data-mg-col="colIndex"
2977
2711
  @mousedown="
@@ -2983,15 +2717,15 @@ watch(
2983
2717
  )
2984
2718
  "
2985
2719
  @mouseenter="
2986
- onCellMouseEnter(entryIndexOf(entry, rowIdx), colIndex)
2987
- "
2988
- @click="
2989
- onCellClick(
2720
+ onCellMouseEnter(
2990
2721
  $event,
2991
2722
  entryIndexOf(entry, rowIdx),
2992
2723
  colIndex,
2993
2724
  )
2994
2725
  "
2726
+ @click="
2727
+ onCellClick($event, entryIndexOf(entry, rowIdx), colIndex)
2728
+ "
2995
2729
  @dblclick="
2996
2730
  onCellDblClick(
2997
2731
  $event,
@@ -3077,7 +2811,7 @@ watch(
3077
2811
  >
3078
2812
  <!-- 커스텀 에디터 슬롯: #editor-{field}="ctx" -->
3079
2813
  <slot
3080
- :name="`editor-${col.field}`"
2814
+ :name="`editor-${colKeyOf(col)}`"
3081
2815
  v-bind="
3082
2816
  editorContext(entryIndexOf(entry, rowIdx), colIndex)
3083
2817
  "
@@ -3132,6 +2866,8 @@ watch(
3132
2866
  v-else-if="col.cellEditor === 'radio'"
3133
2867
  class="mg-radio-group"
3134
2868
  role="radiogroup"
2869
+ tabindex="-1"
2870
+ @keydown="onEditorKeydown"
3135
2871
  >
3136
2872
  <label
3137
2873
  v-for="opt in editorOptionsOf(col, rowDataOf(entry))"
@@ -3175,7 +2911,7 @@ watch(
3175
2911
  :list="
3176
2912
  editorInputType(col) === 'text' &&
3177
2913
  editorOptionsOf(col, rowDataOf(entry)).length
3178
- ? `mg-dl-${col.field}`
2914
+ ? `mg-dl-${colKeyOf(col)}`
3179
2915
  : undefined
3180
2916
  "
3181
2917
  @input="onEditorInput($event, col)"
@@ -3189,7 +2925,7 @@ watch(
3189
2925
  editorInputType(col) === 'text' &&
3190
2926
  editorOptionsOf(col, rowDataOf(entry)).length
3191
2927
  "
3192
- :id="`mg-dl-${col.field}`"
2928
+ :id="`mg-dl-${colKeyOf(col)}`"
3193
2929
  >
3194
2930
  <option
3195
2931
  v-for="opt in editorOptionsOf(col, rowDataOf(entry))"
@@ -3205,7 +2941,7 @@ watch(
3205
2941
  <!-- 커스텀 셀 슬롯: #cell-{field}="{ value, row, column }" -->
3206
2942
  <slot
3207
2943
  v-else
3208
- :name="`cell-${col.field}`"
2944
+ :name="`cell-${colKeyOf(col)}`"
3209
2945
  :value="grid.getCellValue(rowDataOf(entry), col)"
3210
2946
  :row="rowDataOf(entry)"
3211
2947
  :column="col"
@@ -3298,7 +3034,15 @@ watch(
3298
3034
  :key="rowKeyOf(entry, rowIdx) + '-detail'"
3299
3035
  class="mg-detail-row"
3300
3036
  >
3301
- <td class="mg-detail-cell" :colspan="colSpan">
3037
+ <td
3038
+ class="mg-detail-cell"
3039
+ :colspan="colSpan"
3040
+ :style="
3041
+ detailHeight != null
3042
+ ? { height: `${detailHeight}px` }
3043
+ : undefined
3044
+ "
3045
+ >
3302
3046
  <div class="mg-detail-content">
3303
3047
  <slot
3304
3048
  name="detail"
@@ -3338,7 +3082,7 @@ watch(
3338
3082
  />
3339
3083
  <td
3340
3084
  v-else
3341
- :key="col.field"
3085
+ :key="colKeyOf(col)"
3342
3086
  :class="{
3343
3087
  'mg-pinned': !!col.pinned,
3344
3088
  'mg-pin-left-edge': colIndex === lastLeftPinIdx,
@@ -3388,7 +3132,7 @@ watch(
3388
3132
  />
3389
3133
  <td
3390
3134
  v-else
3391
- :key="col.field"
3135
+ :key="colKeyOf(col)"
3392
3136
  :class="{
3393
3137
  'mg-pinned': !!col.pinned,
3394
3138
  'mg-pin-left-edge': colIndex === lastLeftPinIdx,