@moda-grid/vue2 1.0.3 → 2.1.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
@@ -4,6 +4,7 @@ import {
4
4
  nextTick,
5
5
  onBeforeUnmount,
6
6
  onMounted,
7
+ onUpdated,
7
8
  ref,
8
9
  useSlots,
9
10
  watch,
@@ -11,6 +12,11 @@ import {
11
12
  } from "vue";
12
13
  import type { CSSProperties, PropType } from "vue";
13
14
  import {
15
+ applyEditMask,
16
+ applyRowFlip,
17
+ buildColumnFilter,
18
+ buildColumnWindow,
19
+ captureRowTops,
14
20
  createLongPressTracker,
15
21
  createTouchDrag,
16
22
  DEFAULT_COLUMN_WIDTH,
@@ -20,6 +26,9 @@ import {
20
26
  formatAggregate,
21
27
  gridThemeClasses,
22
28
  gridThemeVars,
29
+ logicalToDomScrollLeft,
30
+ readClipboardText,
31
+ writeClipboardText,
23
32
  } from "@moda-grid/core";
24
33
  import type {
25
34
  AggregateFn,
@@ -34,6 +43,7 @@ import type {
34
43
  ColumnDef,
35
44
  ColumnFilter,
36
45
  DisplayRow,
46
+ FilterBuilderInput,
37
47
  FilterOperator,
38
48
  Grid,
39
49
  GridDensity,
@@ -47,6 +57,7 @@ import type {
47
57
  SelectionMode,
48
58
  ServerSideOptions,
49
59
  TreeDataOptions,
60
+ TreeDropPosition,
50
61
  } from "@moda-grid/core";
51
62
  import { useGrid, useGridState } from "./useGrid.js";
52
63
 
@@ -90,6 +101,21 @@ const props = defineProps({
90
101
  rowHeight: { type: Number, default: undefined },
91
102
  /** 가상 스크롤: overscan 행 수 */
92
103
  overscan: { type: Number, default: undefined },
104
+ /**
105
+ * 컬럼 가상화 — 뷰포트(+overscan) 밖 컬럼을 `td.mg-col-spacer`로 대체.
106
+ * pinned 컬럼은 항상 렌더. 멀티레벨 헤더(headerGroups) 조합은 미지원.
107
+ */
108
+ virtualColumns: {
109
+ type: [Boolean, Object] as PropType<GridOptions<RowData>["virtualColumns"]>,
110
+ default: undefined,
111
+ },
112
+ /** 다른 그리드에서 드래그한 행을 드롭으로 받는다 (이동 시맨틱) */
113
+ rowDragAcceptExternal: { type: Boolean, default: undefined },
114
+ /** 텍스트 방향 — "rtl"이면 루트 dir 속성 + 내비/핀/스크롤 좌표 반전 */
115
+ dir: {
116
+ type: String as PropType<GridOptions<RowData>["dir"]>,
117
+ default: undefined,
118
+ },
93
119
  /** 헤더 리사이저 핸들 표시 */
94
120
  resizable: { type: Boolean, default: true },
95
121
  /** 헤더 드래그로 컬럼 순서 변경 허용 */
@@ -196,6 +222,16 @@ const props = defineProps({
196
222
  type: Function as PropType<GridOptions<RowData>["beforeCopy"]>,
197
223
  default: undefined,
198
224
  },
225
+ /**
226
+ * 전체 너비 행 판정 — true인 행은 컬럼 대신 단일 셀(colspan)로
227
+ * 렌더링된다. 내용은 `#fullwidth="{ row, rowIndex }"` 슬롯으로 채운다.
228
+ */
229
+ isFullWidthRow: {
230
+ type: Function as PropType<GridOptions<RowData>["isFullWidthRow"]>,
231
+ default: undefined,
232
+ },
233
+ /** 행 이동 트랜지션 — 정렬/필터 시 위치 전이 (animateRows 대응) */
234
+ animateRows: { type: Boolean, default: undefined },
199
235
  /** 레이아웃 모드 — "autoHeight"면 내용만큼 늘어남 (내부 스크롤·가상 스크롤 무시) */
200
236
  domLayout: {
201
237
  type: String as PropType<"normal" | "autoHeight">,
@@ -255,6 +291,7 @@ const internal = props.grid
255
291
  postSort: props.postSort,
256
292
  beforePaste: props.beforePaste,
257
293
  beforeCopy: props.beforeCopy,
294
+ isFullWidthRow: props.isFullWidthRow,
258
295
  virtualScroll:
259
296
  props.domLayout !== "autoHeight" &&
260
297
  props.height != null &&
@@ -266,6 +303,9 @@ const internal = props.grid
266
303
  overscan: props.overscan,
267
304
  }
268
305
  : undefined,
306
+ virtualColumns: props.virtualColumns,
307
+ rowDragAcceptExternal: props.rowDragAcceptExternal,
308
+ dir: props.dir,
269
309
  });
270
310
  const grid = props.grid ?? internal!.grid;
271
311
  const state = props.grid ? useGridState(grid).state : internal!.state;
@@ -326,6 +366,15 @@ watchEffect(() => {
326
366
  grid.setVirtualScroll(null);
327
367
  }
328
368
  });
369
+ watchEffect(() => {
370
+ grid.setVirtualColumns(props.virtualColumns ?? null);
371
+ });
372
+ watchEffect(() => {
373
+ grid.setRowDragAcceptExternal(props.rowDragAcceptExternal ?? null);
374
+ });
375
+ watchEffect(() => {
376
+ grid.setDir(props.dir ?? null);
377
+ });
329
378
  watchEffect(() => {
330
379
  if (props.selectionMode) grid.setSelectionMode(props.selectionMode);
331
380
  });
@@ -345,6 +394,8 @@ watchEffect(() => {
345
394
  grid.setPostSort(props.postSort ?? null);
346
395
  grid.setBeforePaste(props.beforePaste ?? null);
347
396
  grid.setBeforeCopy(props.beforeCopy ?? null);
397
+ grid.setIsFullWidthRow(props.isFullWidthRow ?? null);
398
+ grid.setAnimateRows(props.animateRows ?? false);
348
399
  // 외부 grid prop 경로에서도 컨텍스트 메뉴 prop이 적용되도록
349
400
  // 런타임 setter로 동기화한다
350
401
  grid.setContextMenu(props.contextMenu ?? null);
@@ -362,8 +413,55 @@ watchEffect(() => {
362
413
  if (v && el && el.scrollTop !== v.scrollTop) el.scrollTop = v.scrollTop;
363
414
  });
364
415
 
416
+ // 컬럼 가상화: 코어가 보정한 scrollLeft를 DOM에 동기화한다
417
+ // (ensureColumnVisible/scrollToColumn 경로). 사용자 스크롤은 같은 값이라 no-op.
418
+ watchEffect(() => {
419
+ const vc = state.value.virtualCols;
420
+ const el = scrollEl.value;
421
+ // 스냅샷의 scrollLeft는 논리 좌표 — RTL에서는 DOM 음수 규약으로 변환
422
+ if (vc && el) {
423
+ const domLeft = logicalToDomScrollLeft(
424
+ vc.scrollLeft,
425
+ state.value.dir === "rtl",
426
+ );
427
+ if (el.scrollLeft !== domLeft) el.scrollLeft = domLeft;
428
+ }
429
+ });
430
+
431
+ // 컬럼 가상화 뷰포트 측정 — 스크롤 컨테이너 폭과 보조 셀(상태/체크/행번호)
432
+ // 너비 합을 코어에 보고한다. 마운트 시 1회 + 리사이즈마다 갱신.
433
+ let colViewObs: ResizeObserver | null = null;
434
+ onMounted(() => {
435
+ const el = scrollEl.value;
436
+ if (!el) return;
437
+ const lead =
438
+ (props.rowStatus ? 40 : 0) +
439
+ (props.rowCheckboxes ? 36 : 0) +
440
+ (props.rowNumbers ? 40 : 0);
441
+ const sync = () => grid.setColumnViewport(el.clientWidth, lead);
442
+ nextTick(sync);
443
+ if (typeof ResizeObserver !== "undefined") {
444
+ colViewObs = new ResizeObserver(sync);
445
+ colViewObs.observe(el);
446
+ }
447
+ });
448
+ onBeforeUnmount(() => colViewObs?.disconnect());
449
+
365
450
  // 비가상 스크롤: scrollToRow 요청을 scrollIntoView로 처리 (seq로 호출 구분)
366
451
  const hostEl = ref<HTMLElement | null>(null);
452
+ // animateRows — 행 키(getRowId)→직전 offsetTop 맵. DOM 갱신 후(mounted/
453
+ // updated) 위치가 바뀐 행에만 FLIP 트랜지션을 건다
454
+ const tbodyEl = ref<HTMLElement | null>(null);
455
+ let prevRowTops = new Map<string, number>();
456
+ const flipRows = () => {
457
+ const tbody = tbodyEl.value;
458
+ if (!tbody) return;
459
+ const prev = prevRowTops;
460
+ prevRowTops = captureRowTops(tbody);
461
+ if (grid.isRowAnimationEnabled()) applyRowFlip(tbody, prev);
462
+ };
463
+ onMounted(flipRows);
464
+ onUpdated(flipRows);
367
465
  watch(
368
466
  () => state.value.scrollRequest?.seq,
369
467
  async () => {
@@ -499,24 +597,72 @@ const filterDropActive = computed(() =>
499
597
  ? state.value.filters[filterDropCol.value.field]?.values
500
598
  : undefined,
501
599
  );
600
+ // ── 필터 빌더 상태: 조건식(연산자+값)과 값 체크리스트를 분리해 다룬다 ──
601
+ // 레거시 {operator:"set", values}는 "조건 없음 + 체크리스트"로 읽는다
602
+ const filterDropType = computed(
603
+ () => filterDropCol.value?.filterType ?? "text",
604
+ );
605
+ const filterDropBuilder = computed<FilterBuilderInput>(() => {
606
+ const col = filterDropCol.value;
607
+ if (!col)
608
+ return {
609
+ operator: "contains",
610
+ value: "",
611
+ values: null,
612
+ join: "and" as const,
613
+ };
614
+ const cur = state.value.filters[col.field];
615
+ const condOn = cur != null && cur.operator !== "set";
616
+ return {
617
+ operator: condOn
618
+ ? cur.operator
619
+ : DEFAULT_OPERATOR_BY_TYPE[filterDropType.value],
620
+ value: condOn ? (cur.value ?? "") : "",
621
+ valueTo: cur?.valueTo ?? "",
622
+ values: cur?.values ?? null,
623
+ join: cur?.join === "or" ? "or" : "and",
624
+ };
625
+ });
626
+ const filterDropOps = computed(() =>
627
+ FILTER_OPERATORS_BY_TYPE[filterDropType.value].filter((o) => o !== "set"),
628
+ );
629
+ /** 빌더 패치를 현재 모델과 병합 — 조건/체크리스트 한쪽만 바뀌어도 다른 쪽 유지 */
630
+ function applyFilterBuilder(patch: Partial<FilterBuilderInput>) {
631
+ const col = filterDropCol.value;
632
+ if (!col) return;
633
+ grid.setFilter(
634
+ col.field,
635
+ buildColumnFilter({ ...filterDropBuilder.value, ...patch }),
636
+ );
637
+ }
638
+ function onFilterCondValue(e: Event) {
639
+ applyFilterBuilder({ value: (e.target as HTMLInputElement).value });
640
+ }
641
+ function onFilterCondValueTo(e: Event) {
642
+ applyFilterBuilder({ valueTo: (e.target as HTMLInputElement).value });
643
+ }
644
+ function onFilterCondOp(e: Event) {
645
+ applyFilterBuilder({
646
+ operator: (e.target as HTMLSelectElement).value as FilterOperator,
647
+ });
648
+ }
649
+ function onFilterJoin(e: Event) {
650
+ const v = (e.target as HTMLInputElement).value;
651
+ if (v === "and" || v === "or") applyFilterBuilder({ join: v });
652
+ }
502
653
  function filterDropChecked(v: string) {
503
654
  const active = filterDropActive.value;
504
655
  return active ? active.includes(v) : true;
505
656
  }
506
657
  function toggleFilterValue(v: string) {
507
- const col = filterDropCol.value;
508
- if (!col) return;
509
658
  const all = filterDropAll.value;
510
659
  const next = new Set(filterDropActive.value ?? all);
511
660
  if (next.has(v)) next.delete(v);
512
661
  else next.add(v);
513
- if (next.size >= all.length) grid.setFilter(col.field, null);
514
- else
515
- grid.setFilter(col.field, {
516
- operator: "set",
517
- value: "",
518
- values: [...next],
519
- });
662
+ // 전부 체크면 체크리스트 비활성(null) — 조건식만 남는다
663
+ applyFilterBuilder({
664
+ values: next.size >= all.length ? null : [...next],
665
+ });
520
666
  }
521
667
  function onFilterDropKeydown(e: KeyboardEvent) {
522
668
  e.stopPropagation();
@@ -646,7 +792,8 @@ const groupDropOver = ref(false);
646
792
  function onGroupPanelDragOver(event: DragEvent) {
647
793
  if (event.dataTransfer?.types.includes("application/x-mg-column")) {
648
794
  event.preventDefault();
649
- event.dataTransfer.dropEffect = "copy";
795
+ // effectAllowed=move 세션에서 dropEffect=copy는 실제 DnD가 drop을 거부한다
796
+ event.dataTransfer.dropEffect = "move";
650
797
  groupDropOver.value = true;
651
798
  }
652
799
  }
@@ -751,9 +898,30 @@ const hasPinned = computed(
751
898
  );
752
899
  const hasAppend = computed(() => !!state.value.appendScroll);
753
900
 
901
+ // ── 컬럼 가상화 — 윈도우 밖 연속 구간을 spacer 셀로 대체 ──
902
+ // buildColumnWindow를 5개 렌더러가 공유해 DOM 계약(td.mg-col-spacer)이
903
+ // 일치한다. 멀티레벨 헤더(headerGroups)는 그룹 colSpan과 윈도우 경계가
904
+ // 교차해 정렬이 깨지므로 그 경우 전체 컬럼 렌더로 폴백한다.
905
+ const colVirtualOn = computed(() => state.value.virtualCols != null);
906
+ const renderCols = computed(() =>
907
+ buildColumnWindow(
908
+ state.value.visibleColumns,
909
+ state.value.headerGroups ? null : state.value.virtualCols,
910
+ ).map((it) => ({
911
+ kind: it.kind,
912
+ // spacer 아이템에도 col 슬롯을 두어 v-for 디스트럭처가 안전하다 —
913
+ // v-else-if="col" 가드로 좁혀져 본문은 col을 그대로 쓴다
914
+ col: it.kind === "col" ? it.col : null,
915
+ index: it.index,
916
+ count: it.kind === "spacer" ? it.count : 0,
917
+ })),
918
+ );
919
+
754
920
  function pinStyleOf(col: ColumnDef<RowT>): CSSProperties | undefined {
755
921
  if (!col.pinned) return undefined;
756
- const side = col.pinned === "left" ? "left" : "right";
922
+ // 논리 인셋 — pinned:"left"는 inline-start라 dir="rtl"이면 우측에 붙는다
923
+ const side =
924
+ col.pinned === "left" ? "inset-inline-start" : "inset-inline-end";
757
925
  return {
758
926
  position: "sticky",
759
927
  width: `${col.width ?? DEFAULT_COLUMN_WIDTH}px`,
@@ -793,7 +961,7 @@ function onColumnToggle(field: string, event: Event) {
793
961
 
794
962
  function onScroll(event: Event) {
795
963
  const el = event.target as HTMLElement;
796
- grid.handleScroll(el.scrollTop);
964
+ grid.handleScroll(el.scrollTop, el.scrollLeft);
797
965
  grid.maybeLoadMore(el.scrollTop, el.clientHeight, el.scrollHeight);
798
966
  }
799
967
 
@@ -868,8 +1036,11 @@ function touchHitAt(target: Element | null) {
868
1036
  return null;
869
1037
  }
870
1038
 
871
- /** 포인터 아래 행의 삽입 갭 — td의 data-mg-row로 행 인덱스를 해석한다 */
872
- function touchRowGapAt(target: Element | null, y: number): number | null {
1039
+ /** 포인터 아래 행의 삽입 위치 — td의 data-mg-row로 행 인덱스를 해석한다 */
1040
+ function touchRowDropAt(
1041
+ target: Element | null,
1042
+ y: number,
1043
+ ): { index: number; position?: TreeDropPosition } | null {
873
1044
  const root = hostEl.value;
874
1045
  const t = target as HTMLElement | null;
875
1046
  let td = t?.closest?.("td[data-mg-row]") as HTMLElement | null;
@@ -883,7 +1054,15 @@ function touchRowGapAt(target: Element | null, y: number): number | null {
883
1054
  const tr = td.closest("tr");
884
1055
  if (Number.isNaN(rowIndex) || !tr) return null;
885
1056
  const rect = tr.getBoundingClientRect();
886
- return y < rect.top + rect.height / 2 ? rowIndex : rowIndex + 1;
1057
+ const ratio = (y - rect.top) / rect.height;
1058
+ // 트리 모드는 상하 25%=before/after, 가운데 50%=inside
1059
+ if (grid.isTreeRowDraggable()) {
1060
+ return {
1061
+ index: rowIndex,
1062
+ position: ratio < 0.25 ? "before" : ratio > 0.75 ? "after" : "inside",
1063
+ };
1064
+ }
1065
+ return { index: ratio < 0.5 ? rowIndex : rowIndex + 1 };
887
1066
  }
888
1067
 
889
1068
  function applyTouchDrop(
@@ -953,8 +1132,8 @@ const touchDrag = {
953
1132
  return grid.beginRowDrag(rowIndex);
954
1133
  },
955
1134
  move: (_x: number, y: number, target: Element | null) => {
956
- const gap = touchRowGapAt(target, y);
957
- if (gap != null) grid.updateRowDropPosition(gap);
1135
+ const drop = touchRowDropAt(target, y);
1136
+ if (drop != null) grid.updateRowDropPosition(drop.index, drop.position);
958
1137
  },
959
1138
  up: () => grid.endRowDrag(true),
960
1139
  cancel: () => grid.endRowDrag(false),
@@ -1187,6 +1366,7 @@ function onSetToggle(
1187
1366
  // ── 컬럼 그룹 헤더 (다단계 헤더) ──
1188
1367
  type HeaderCell =
1189
1368
  | { kind: "group"; key: string; header: string; colSpan: number }
1369
+ | { kind: "spacer"; key: string; colSpan: number }
1190
1370
  | {
1191
1371
  kind: "col";
1192
1372
  key: string;
@@ -1207,13 +1387,23 @@ const headerRows = computed<HeaderCell[][]>(() => {
1207
1387
  const spans = state.value.headerGroups;
1208
1388
  const cols = state.value.visibleColumns;
1209
1389
  if (!spans) {
1390
+ // 컬럼 가상화 — tbody와 동일 윈도우를 헤더에도 적용한다
1391
+ // (spans가 있으면 멀티레벨 헤더 → 위에서 전체 렌더 폴백)
1210
1392
  return [
1211
- cols.map((col, colIndex) => ({
1212
- kind: "col" as const,
1213
- key: col.field,
1214
- col,
1215
- colIndex,
1216
- })),
1393
+ buildColumnWindow(cols, state.value.virtualCols).map((it) =>
1394
+ it.kind === "spacer"
1395
+ ? {
1396
+ kind: "spacer" as const,
1397
+ key: `csp-${it.index}`,
1398
+ colSpan: it.count,
1399
+ }
1400
+ : {
1401
+ kind: "col" as const,
1402
+ key: it.col.field,
1403
+ col: it.col,
1404
+ colIndex: it.index,
1405
+ },
1406
+ ),
1217
1407
  ];
1218
1408
  }
1219
1409
  const row1: HeaderCell[] = spans.map((s) =>
@@ -1358,13 +1548,17 @@ const rowDraggable = computed(
1358
1548
  state.value.groupBy.length === 0,
1359
1549
  );
1360
1550
  const rowCount = computed(() => state.value.rows.length);
1361
- // 자기 자신 위/바로 아래 갭은 제자리 드롭 — 인디케이터를 숨긴다
1551
+ // 자기 자신 위/바로 아래 갭은 제자리 드롭 — 인디케이터를 숨긴다.
1552
+ // 외부 수신(external)은 이 그리드에 드래그 행이 없으므로(draggingIndex는
1553
+ // 센티널 -1) 모든 갭이 유효 — 억제 규칙을 적용하면 갭 0이 -1+1과 충돌한다
1362
1554
  const dropGap = computed(() => {
1363
1555
  const rd = state.value.rowDrag;
1364
1556
  if (!rd || rd.dropIndex == null) return null;
1557
+ // 트리 모드는 position이 대상 행 인덱스를 가리킨다 — 갭 인디케이터는 안 쓴다
1558
+ if (rd.position != null) return null;
1365
1559
  if (
1366
- rd.dropIndex === rd.draggingIndex ||
1367
- rd.dropIndex === rd.draggingIndex + 1
1560
+ !rd.external &&
1561
+ (rd.dropIndex === rd.draggingIndex || rd.dropIndex === rd.draggingIndex + 1)
1368
1562
  )
1369
1563
  return null;
1370
1564
  return rd.dropIndex;
@@ -1379,9 +1573,14 @@ function rowClassOf(entry: AnyRow, rowIdx: number) {
1379
1573
  {
1380
1574
  "mg-selected": isSelected(row),
1381
1575
  "mg-row-dragging": rd?.draggingIndex === rowIndex,
1382
- "mg-drop-before": dropGap.value === rowIndex,
1576
+ "mg-drop-before":
1577
+ dropGap.value === rowIndex ||
1578
+ (rd?.position === "before" && rd.dropIndex === rowIndex),
1383
1579
  "mg-drop-after":
1384
- dropGap.value === rowCount.value && rowIndex === rowCount.value - 1,
1580
+ (dropGap.value === rowCount.value && rowIndex === rowCount.value - 1) ||
1581
+ (rd?.position === "after" && rd.dropIndex === rowIndex),
1582
+ "mg-drop-inside": rd?.position === "inside" && rd.dropIndex === rowIndex,
1583
+ "mg-drop-denied": rd?.denied === true && rd.dropIndex === rowIndex,
1385
1584
  },
1386
1585
  status ? `mg-row-${status}` : "",
1387
1586
  // 커스텀 행 클래스 (GridOptions/ColumnDef.rowClass)
@@ -1439,17 +1638,27 @@ function onRowDragStart(rowIndex: number, event: DragEvent) {
1439
1638
  }
1440
1639
 
1441
1640
  function onRowDragOver(rowIndex: number, event: DragEvent) {
1442
- if (!state.value.rowDrag) return;
1641
+ // 자체 드래그가 없어도 다른 그리드의 드래그 세션은 수락한다
1642
+ // (rowDragAcceptExternal)
1643
+ if (!state.value.rowDrag && !grid.canAcceptExternalRowDrop()) return;
1443
1644
  event.preventDefault();
1444
1645
  if (event.dataTransfer) event.dataTransfer.dropEffect = "move";
1445
1646
  const rect = (event.currentTarget as HTMLElement).getBoundingClientRect();
1446
- const gap =
1447
- event.clientY < rect.top + rect.height / 2 ? rowIndex : rowIndex + 1;
1647
+ const ratio = (event.clientY - rect.top) / rect.height;
1648
+ // 트리 모드 — 상하 25%는 형제 위/아래, 가운데 50%는 자식(inside)
1649
+ if (grid.isTreeRowDraggable()) {
1650
+ grid.updateRowDropPosition(
1651
+ rowIndex,
1652
+ ratio < 0.25 ? "before" : ratio > 0.75 ? "after" : "inside",
1653
+ );
1654
+ return;
1655
+ }
1656
+ const gap = ratio < 0.5 ? rowIndex : rowIndex + 1;
1448
1657
  grid.updateRowDropPosition(gap);
1449
1658
  }
1450
1659
 
1451
1660
  function onRowDrop(event: DragEvent) {
1452
- if (!state.value.rowDrag) return;
1661
+ if (!state.value.rowDrag && !grid.canAcceptExternalRowDrop()) return;
1453
1662
  event.preventDefault();
1454
1663
  grid.endRowDrag(true);
1455
1664
  }
@@ -1481,17 +1690,19 @@ function onGridKeydown(event: KeyboardEvent) {
1481
1690
  const tsv = grid.getSelectionTsv({ includeHeaders: event.shiftKey });
1482
1691
  if (tsv != null) {
1483
1692
  event.preventDefault();
1484
- void navigator.clipboard?.writeText(tsv);
1693
+ void writeClipboardText(tsv);
1485
1694
  }
1486
1695
  } else if (key === "x") {
1487
1696
  const tsv = grid.cutSelectionTsv(); // 엑셀 Ctrl+X — 잘라내기
1488
1697
  if (tsv != null) {
1489
1698
  event.preventDefault();
1490
- void navigator.clipboard?.writeText(tsv);
1699
+ void writeClipboardText(tsv);
1491
1700
  }
1492
1701
  } else if (key === "v") {
1493
1702
  event.preventDefault();
1494
- void navigator.clipboard?.readText().then((text) => grid.pasteTsv(text));
1703
+ void readClipboardText().then((text) => {
1704
+ if (text != null) grid.pasteTsv(text);
1705
+ });
1495
1706
  } else if (key === "z") {
1496
1707
  event.preventDefault();
1497
1708
  if (event.shiftKey) grid.redo();
@@ -1533,10 +1744,17 @@ function onGridKeydown(event: KeyboardEvent) {
1533
1744
  grid.navigateCell("bottom", event.shiftKey);
1534
1745
  } else if (event.key === "ArrowLeft") {
1535
1746
  event.preventDefault();
1536
- grid.navigateCell("home", event.shiftKey);
1747
+ // Ctrl+←는 시각적 왼쪽 가장자리 — RTL에서는 논리적으로 마지막 컬럼
1748
+ grid.navigateCell(
1749
+ state.value.dir === "rtl" ? "end" : "home",
1750
+ event.shiftKey,
1751
+ );
1537
1752
  } else if (event.key === "ArrowRight") {
1538
1753
  event.preventDefault();
1539
- grid.navigateCell("end", event.shiftKey);
1754
+ grid.navigateCell(
1755
+ state.value.dir === "rtl" ? "home" : "end",
1756
+ event.shiftKey,
1757
+ );
1540
1758
  } else if (event.key === " ") {
1541
1759
  event.preventDefault();
1542
1760
  grid.selectEntireColumn(); // 엑셀 Ctrl+Space — 열 선택
@@ -1637,6 +1855,13 @@ function leafExpanded(entry: AnyRow): boolean {
1637
1855
  return leafOf(entry)?.expanded === true;
1638
1856
  }
1639
1857
 
1858
+ /** 전체 너비 행 판정 — leaf 행만 검사 (스켈레톤·그룹 행 제외) */
1859
+ function isFullWidthOf(entry: AnyRow, rowIdx: number): boolean {
1860
+ const row = rowDataOf(entry);
1861
+ if (row == null) return false;
1862
+ return grid.isFullWidthRow(row, entryIndexOf(entry, rowIdx));
1863
+ }
1864
+
1640
1865
  function entryIndexOf(entry: AnyRow, rowIdx: number) {
1641
1866
  const l = leafOf(entry);
1642
1867
  if (l) return l.rowIndex;
@@ -1756,10 +1981,22 @@ function editorInputType(col: ColumnDef) {
1756
1981
  }
1757
1982
 
1758
1983
  function onEditorInput(event: Event, col: ColumnDef) {
1759
- grid.updateEditValue(
1760
- (event.target as HTMLInputElement | HTMLSelectElement).value,
1761
- col.field,
1762
- );
1984
+ const el = event.target as HTMLInputElement | HTMLSelectElement;
1985
+ // 입력 마스크 — text 에디터에서 타이핑마다 패턴 자동 포맷
1986
+ if (col.editMask && el instanceof HTMLInputElement && el.type === "text") {
1987
+ const next = applyEditMask(el.value, col.editMask);
1988
+ if (next !== el.value) {
1989
+ el.value = next;
1990
+ el.setSelectionRange(next.length, next.length);
1991
+ }
1992
+ }
1993
+ grid.updateEditValue(el.value, col.field);
1994
+ }
1995
+
1996
+ // text 에디터 표시 값 — editMask가 있으면 기존 저장값도 마스크 형태로 표시
1997
+ function editorMaskedValue(col: ColumnDef): string {
1998
+ const s = editorInputValue(editValueOf(col));
1999
+ return col.editMask ? applyEditMask(s, col.editMask) : s;
1763
2000
  }
1764
2001
 
1765
2002
  // multiselect 에디터 — 선택된 옵션들을 배열로 저장
@@ -1867,6 +2104,7 @@ watch(
1867
2104
  <template>
1868
2105
  <div
1869
2106
  ref="hostEl"
2107
+ :dir="state.dir"
1870
2108
  :class="[
1871
2109
  showOverlay ? 'mg-colctl-host' : undefined,
1872
2110
  ...themeClasses,
@@ -1938,14 +2176,65 @@ watch(
1938
2176
  :aria-label="`${filterDropCol.header || filterDropCol.field} 필터`"
1939
2177
  @keydown="onFilterDropKeydown"
1940
2178
  >
2179
+ <!-- 조건 섹션: 연산자 + 비교 값 (+ inRange 상한). set 전용 컬럼은 생략 -->
2180
+ <template v-if="filterDropType !== 'set'">
2181
+ <div class="mg-filter-cond">
2182
+ <select
2183
+ class="mg-filter-cond-op"
2184
+ :value="filterDropBuilder.operator"
2185
+ @change="onFilterCondOp"
2186
+ >
2187
+ <option v-for="op in filterDropOps" :key="op" :value="op">
2188
+ {{ FILTER_OPERATOR_LABELS[op] }}
2189
+ </option>
2190
+ </select>
2191
+ <input
2192
+ class="mg-filter-cond-val"
2193
+ :type="filterDropType === 'text' ? 'text' : filterDropType"
2194
+ :value="filterDropBuilder.value"
2195
+ :placeholder="
2196
+ state.locale.filterPlaceholder(
2197
+ filterDropCol.header || filterDropCol.field,
2198
+ )
2199
+ "
2200
+ @change="onFilterCondValue"
2201
+ />
2202
+ <input
2203
+ v-if="filterDropBuilder.operator === 'inRange'"
2204
+ class="mg-filter-cond-val mg-filter-to"
2205
+ :type="filterDropType === 'text' ? 'text' : filterDropType"
2206
+ :value="filterDropBuilder.valueTo"
2207
+ :placeholder="state.locale.rangeEndPlaceholder"
2208
+ @change="onFilterCondValueTo"
2209
+ />
2210
+ </div>
2211
+ <!-- 결합 토글: 조건식 ↔ 체크리스트를 AND/OR로 묶는다 -->
2212
+ <div class="mg-filter-join">
2213
+ <label
2214
+ v-for="mode in ['and', 'or']"
2215
+ :key="mode"
2216
+ class="mg-filter-join-opt"
2217
+ >
2218
+ <input
2219
+ type="radio"
2220
+ class="mg-filter-join-radio"
2221
+ :name="`mg-join-${filterDropCol.field}`"
2222
+ :value="mode"
2223
+ :checked="filterDropBuilder.join === mode"
2224
+ @change="onFilterJoin"
2225
+ />
2226
+ {{
2227
+ mode === "and" ? state.locale.filterAnd : state.locale.filterOr
2228
+ }}
2229
+ </label>
2230
+ </div>
2231
+ </template>
2232
+ <!-- 값 체크리스트 — 조건식과 독립 상태 (전체 체크 = 비활성) -->
1941
2233
  <label class="mg-colctl-item">
1942
2234
  <input
1943
2235
  type="checkbox"
1944
- :checked="
1945
- !filterDropActive ||
1946
- filterDropActive.length >= filterDropAll.length
1947
- "
1948
- @change="grid.setFilter(filterDropCol.field, null)"
2236
+ :checked="filterDropBuilder.values == null"
2237
+ @change="applyFilterBuilder({ values: null })"
1949
2238
  />
1950
2239
  {{ state.locale.setFilterAll }}
1951
2240
  </label>
@@ -2089,14 +2378,21 @@ watch(
2089
2378
  <div
2090
2379
  ref="scrollEl"
2091
2380
  :class="{
2092
- 'mg-scroll': (virtual || hasPinned || hasAppend) && !autoHeight,
2381
+ // 컬럼 가상화는 가로 스크롤 컨테이너가 필요 — autoHeight에서도 유지
2382
+ 'mg-scroll':
2383
+ ((virtual || hasPinned || hasAppend) && !autoHeight) || colVirtualOn,
2093
2384
  }"
2094
2385
  :style="
2095
2386
  autoHeight
2096
- ? undefined
2387
+ ? colVirtualOn
2388
+ ? // autoHeight는 세로 스크롤 해제 — 가로만 유지한다.
2389
+ // overflow-y를 명시하지 않으면 stylesheet의 overflow:auto가
2390
+ // y축을 되살린다
2391
+ { overflowX: 'auto', overflowY: 'visible' }
2392
+ : undefined
2097
2393
  : virtual || (hasAppend && height)
2098
2394
  ? { height: `${height}px`, overflow: 'auto' }
2099
- : hasPinned || hasAppend
2395
+ : hasPinned || hasAppend || colVirtualOn
2100
2396
  ? { overflowX: 'auto', overflowY: height ? undefined : 'auto' }
2101
2397
  : undefined
2102
2398
  "
@@ -2161,6 +2457,12 @@ watch(
2161
2457
  >
2162
2458
  {{ cell.header }}
2163
2459
  </th>
2460
+ <th
2461
+ v-else-if="cell.kind === 'spacer'"
2462
+ :key="cell.key"
2463
+ class="mg-col-spacer"
2464
+ :colspan="cell.colSpan"
2465
+ ></th>
2164
2466
  <th
2165
2467
  v-else
2166
2468
  :key="cell.key"
@@ -2258,77 +2560,92 @@ watch(
2258
2560
  <th v-if="rowStatus" class="mg-status-cell" />
2259
2561
  <th v-if="rowCheckboxes" class="mg-check-cell" />
2260
2562
  <th v-if="rowNumbers" class="mg-rownum-cell" />
2261
- <th
2262
- v-for="(col, colIndex) in state.visibleColumns"
2263
- :key="col.field"
2264
- :class="{
2265
- 'mg-pinned': !!col.pinned,
2266
- 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
2267
- 'mg-pin-right-edge': colIndex === firstRightPinIdx,
2268
- }"
2269
- :style="pinStyleOf(col)"
2563
+ <!-- 컬럼 가상화 — tbody와 동일 윈도우. spacer는 colSpan 단일 셀 -->
2564
+ <template
2565
+ v-for="{ kind, col, index: colIndex, count } in renderCols"
2270
2566
  >
2271
- <div v-if="col.filterable" class="mg-filter-cell">
2272
- <details v-if="isSetFilter(col)" class="mg-setfilter">
2273
- <summary>{{ setFilterLabel(col) }}</summary>
2274
- <div class="mg-setfilter-panel">
2275
- <label class="mg-setfilter-item">
2276
- <input
2277
- type="checkbox"
2278
- :checked="setAllCheckedOf(col)"
2279
- @change="grid.setFilter(col.field, null)"
2280
- />
2281
- {{ state.locale.setFilterAll }}
2282
- </label>
2283
- <label
2284
- v-for="v in setValuesOf(col)"
2285
- :key="v"
2286
- class="mg-setfilter-item"
2287
- >
2288
- <input
2289
- type="checkbox"
2290
- :checked="setCheckedOf(col, v)"
2291
- @change="onSetToggle(col, v, $event)"
2292
- />
2293
- {{ v }}
2294
- </label>
2295
- </div>
2296
- </details>
2297
- <template v-else>
2298
- <select
2299
- class="mg-filter-op"
2300
- :value="filterOpOf(col)"
2301
- @change="onFilterOpChange(col, $event)"
2302
- >
2303
- <option
2304
- v-for="op in filterOpsOf(col)"
2305
- :key="op"
2306
- :value="op"
2567
+ <th
2568
+ v-if="kind === 'spacer'"
2569
+ :key="`csp-${colIndex}`"
2570
+ class="mg-col-spacer"
2571
+ :colspan="count"
2572
+ ></th>
2573
+ <th
2574
+ v-else
2575
+ :key="col.field"
2576
+ :class="{
2577
+ 'mg-pinned': !!col.pinned,
2578
+ 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
2579
+ 'mg-pin-right-edge': colIndex === firstRightPinIdx,
2580
+ }"
2581
+ :style="pinStyleOf(col)"
2582
+ >
2583
+ <div v-if="col.filterable" class="mg-filter-cell">
2584
+ <details v-if="isSetFilter(col)" class="mg-setfilter">
2585
+ <summary>{{ setFilterLabel(col) }}</summary>
2586
+ <div class="mg-setfilter-panel">
2587
+ <label class="mg-setfilter-item">
2588
+ <input
2589
+ type="checkbox"
2590
+ :checked="setAllCheckedOf(col)"
2591
+ @change="grid.setFilter(col.field, null)"
2592
+ />
2593
+ {{ state.locale.setFilterAll }}
2594
+ </label>
2595
+ <label
2596
+ v-for="v in setValuesOf(col)"
2597
+ :key="v"
2598
+ class="mg-setfilter-item"
2599
+ >
2600
+ <input
2601
+ type="checkbox"
2602
+ :checked="setCheckedOf(col, v)"
2603
+ @change="onSetToggle(col, v, $event)"
2604
+ />
2605
+ {{ v }}
2606
+ </label>
2607
+ </div>
2608
+ </details>
2609
+ <template v-else>
2610
+ <select
2611
+ class="mg-filter-op"
2612
+ :value="filterOpOf(col)"
2613
+ @change="onFilterOpChange(col, $event)"
2307
2614
  >
2308
- {{ FILTER_OPERATOR_LABELS[op] }}
2309
- </option>
2310
- </select>
2311
- <input
2312
- class="mg-filter-input"
2313
- :type="filterInputType(col)"
2314
- :value="filterValueOf(col, 'value')"
2315
- :placeholder="`${col.header || col.field} 필터`"
2316
- @input="onFilterInput(col, 'value', $event)"
2317
- />
2318
- <input
2319
- v-if="filterOpOf(col) === 'inRange'"
2320
- class="mg-filter-input mg-filter-to"
2321
- :type="filterInputType(col)"
2322
- :value="filterValueOf(col, 'valueTo')"
2323
- :placeholder="state.locale.rangeEndPlaceholder"
2324
- @input="onFilterInput(col, 'valueTo', $event)"
2325
- />
2326
- </template>
2327
- </div>
2328
- </th>
2615
+ <option
2616
+ v-for="op in filterOpsOf(col)"
2617
+ :key="op"
2618
+ :value="op"
2619
+ >
2620
+ {{ FILTER_OPERATOR_LABELS[op] }}
2621
+ </option>
2622
+ </select>
2623
+ <input
2624
+ class="mg-filter-input"
2625
+ :type="filterInputType(col)"
2626
+ :value="filterValueOf(col, 'value')"
2627
+ :placeholder="`${col.header || col.field} 필터`"
2628
+ @input="onFilterInput(col, 'value', $event)"
2629
+ />
2630
+ <input
2631
+ v-if="filterOpOf(col) === 'inRange'"
2632
+ class="mg-filter-input mg-filter-to"
2633
+ :type="filterInputType(col)"
2634
+ :value="filterValueOf(col, 'valueTo')"
2635
+ :placeholder="state.locale.rangeEndPlaceholder"
2636
+ @input="onFilterInput(col, 'valueTo', $event)"
2637
+ />
2638
+ </template>
2639
+ </div>
2640
+ </th>
2641
+ </template>
2329
2642
  </tr>
2330
2643
  </thead>
2331
- <tbody role="rowgroup">
2644
+ <tbody
2645
+ role="rowgroup"
2646
+ ref="tbodyEl"
2647
+ :class="{ 'mg-animate-rows': grid.isRowAnimationEnabled() }"
2648
+ >
2332
2649
  <tr
2333
2650
  v-for="(prow, pIdx) in state.pinnedTopRows"
2334
2651
  :key="`pin-top-${pIdx}`"
@@ -2337,18 +2654,28 @@ watch(
2337
2654
  <td v-if="rowStatus" class="mg-status-cell" />
2338
2655
  <td v-if="rowCheckboxes" class="mg-check-cell" />
2339
2656
  <td v-if="rowNumbers" class="mg-rownum-cell" />
2340
- <td
2341
- v-for="(col, colIndex) in state.visibleColumns"
2342
- :key="col.field"
2343
- :class="{
2344
- 'mg-pinned': !!col.pinned,
2345
- 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
2346
- 'mg-pin-right-edge': colIndex === firstRightPinIdx,
2347
- }"
2348
- :style="pinStyleOf(col)"
2657
+ <template
2658
+ v-for="{ kind, col, index: colIndex, count } in renderCols"
2349
2659
  >
2350
- {{ grid.getCellText(prow, col) }}
2351
- </td>
2660
+ <td
2661
+ v-if="kind === 'spacer'"
2662
+ :key="`csp-${colIndex}`"
2663
+ class="mg-col-spacer"
2664
+ :colspan="count"
2665
+ />
2666
+ <td
2667
+ v-else
2668
+ :key="col.field"
2669
+ :class="{
2670
+ 'mg-pinned': !!col.pinned,
2671
+ 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
2672
+ 'mg-pin-right-edge': colIndex === firstRightPinIdx,
2673
+ }"
2674
+ :style="pinStyleOf(col)"
2675
+ >
2676
+ {{ grid.getCellText(prow, col) }}
2677
+ </td>
2678
+ </template>
2352
2679
  </tr>
2353
2680
  <tr
2354
2681
  v-if="virtual && virtual.startOffset > 0"
@@ -2376,34 +2703,44 @@ watch(
2376
2703
  <td v-if="rowStatus" class="mg-status-cell" />
2377
2704
  <td v-if="rowCheckboxes" class="mg-check-cell" />
2378
2705
  <td v-if="rowNumbers" class="mg-rownum-cell" />
2379
- <td
2380
- v-for="(col, colIndex) in state.visibleColumns"
2381
- :key="col.field"
2382
- class="mg-group-cell"
2383
- :class="{
2384
- 'mg-pinned': !!col.pinned,
2385
- 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
2386
- 'mg-pin-right-edge': colIndex === firstRightPinIdx,
2387
- }"
2388
- :style="pinStyleOf(col)"
2706
+ <template
2707
+ v-for="{ kind, col, index: colIndex, count } in renderCols"
2389
2708
  >
2390
- <span
2391
- v-if="colIndex === 0"
2392
- class="mg-group-label"
2393
- :style="{ paddingLeft: `${groupOf(entry).depth * 16}px` }"
2709
+ <td
2710
+ v-if="kind === 'spacer'"
2711
+ :key="`csp-${colIndex}`"
2712
+ class="mg-col-spacer"
2713
+ :colspan="count"
2714
+ />
2715
+ <td
2716
+ v-else
2717
+ :key="col.field"
2718
+ class="mg-group-cell"
2719
+ :class="{
2720
+ 'mg-pinned': !!col.pinned,
2721
+ 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
2722
+ 'mg-pin-right-edge': colIndex === firstRightPinIdx,
2723
+ }"
2724
+ :style="pinStyleOf(col)"
2394
2725
  >
2395
- <span class="mg-group-toggle">
2396
- {{ groupOf(entry).expanded ? "▾" : "▸" }}
2397
- </span>
2398
- <strong>{{ groupLabelOf(entry) }}</strong>
2399
- <span class="mg-group-count"
2400
- >({{ groupOf(entry).rowCount }})</span
2726
+ <span
2727
+ v-if="colIndex === 0"
2728
+ class="mg-group-label"
2729
+ :style="{ paddingLeft: `${groupOf(entry).depth * 16}px` }"
2401
2730
  >
2402
- </span>
2403
- <span v-else-if="groupAggOf(entry, col)" class="mg-agg">
2404
- {{ groupAggOf(entry, col) }}
2405
- </span>
2406
- </td>
2731
+ <span class="mg-group-toggle">
2732
+ {{ groupOf(entry).expanded ? "▾" : "▸" }}
2733
+ </span>
2734
+ <strong>{{ groupLabelOf(entry) }}</strong>
2735
+ <span class="mg-group-count"
2736
+ >({{ groupOf(entry).rowCount }})</span
2737
+ >
2738
+ </span>
2739
+ <span v-else-if="groupAggOf(entry, col)" class="mg-agg">
2740
+ {{ groupAggOf(entry, col) }}
2741
+ </span>
2742
+ </td>
2743
+ </template>
2407
2744
  </tr>
2408
2745
  <!-- 그룹 소계 행 -->
2409
2746
  <tr
@@ -2414,28 +2751,38 @@ watch(
2414
2751
  <td v-if="rowStatus" class="mg-status-cell" />
2415
2752
  <td v-if="rowCheckboxes" class="mg-check-cell" />
2416
2753
  <td v-if="rowNumbers" class="mg-rownum-cell" />
2417
- <td
2418
- v-for="(col, colIndex) in state.visibleColumns"
2419
- :key="col.field"
2420
- class="mg-subtotal-cell"
2421
- :class="{
2422
- 'mg-pinned': !!col.pinned,
2423
- 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
2424
- 'mg-pin-right-edge': colIndex === firstRightPinIdx,
2425
- }"
2426
- :style="pinStyleOf(col)"
2754
+ <template
2755
+ v-for="{ kind, col, index: colIndex, count } in renderCols"
2427
2756
  >
2428
- <span
2429
- v-if="colIndex === 0"
2430
- class="mg-subtotal-label"
2431
- :style="{ paddingLeft: `${groupOf(entry).depth * 16}px` }"
2757
+ <td
2758
+ v-if="kind === 'spacer'"
2759
+ :key="`csp-${colIndex}`"
2760
+ class="mg-col-spacer"
2761
+ :colspan="count"
2762
+ />
2763
+ <td
2764
+ v-else
2765
+ :key="col.field"
2766
+ class="mg-subtotal-cell"
2767
+ :class="{
2768
+ 'mg-pinned': !!col.pinned,
2769
+ 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
2770
+ 'mg-pin-right-edge': colIndex === firstRightPinIdx,
2771
+ }"
2772
+ :style="pinStyleOf(col)"
2432
2773
  >
2433
- {{ state.locale.subtotalLabel }}: {{ groupLabelOf(entry) }}
2434
- </span>
2435
- <span v-else-if="groupAggOf(entry, col)" class="mg-agg">
2436
- {{ groupAggOf(entry, col) }}
2437
- </span>
2438
- </td>
2774
+ <span
2775
+ v-if="colIndex === 0"
2776
+ class="mg-subtotal-label"
2777
+ :style="{ paddingLeft: `${groupOf(entry).depth * 16}px` }"
2778
+ >
2779
+ {{ state.locale.subtotalLabel }}: {{ groupLabelOf(entry) }}
2780
+ </span>
2781
+ <span v-else-if="groupAggOf(entry, col)" class="mg-agg">
2782
+ {{ groupAggOf(entry, col) }}
2783
+ </span>
2784
+ </td>
2785
+ </template>
2439
2786
  </tr>
2440
2787
  <!-- 서버 사이드 미로드 행 → 스켈레톤 -->
2441
2788
  <tr
@@ -2447,17 +2794,42 @@ watch(
2447
2794
  <td v-if="rowStatus" class="mg-status-cell" />
2448
2795
  <td v-if="rowCheckboxes" class="mg-check-cell" />
2449
2796
  <td v-if="rowNumbers" class="mg-rownum-cell" />
2450
- <td
2451
- v-for="(col, colIndex) in state.visibleColumns"
2452
- :key="col.field"
2453
- :class="{
2454
- 'mg-pinned': !!col.pinned,
2455
- 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
2456
- 'mg-pin-right-edge': colIndex === firstRightPinIdx,
2457
- }"
2458
- :style="pinStyleOf(col)"
2797
+ <template
2798
+ v-for="{ kind, col, index: colIndex, count } in renderCols"
2459
2799
  >
2460
- <span class="mg-skeleton-bar" />
2800
+ <td
2801
+ v-if="kind === 'spacer'"
2802
+ :key="`csp-${colIndex}`"
2803
+ class="mg-col-spacer"
2804
+ :colspan="count"
2805
+ />
2806
+ <td
2807
+ v-else
2808
+ :key="col.field"
2809
+ :class="{
2810
+ 'mg-pinned': !!col.pinned,
2811
+ 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
2812
+ 'mg-pin-right-edge': colIndex === firstRightPinIdx,
2813
+ }"
2814
+ :style="pinStyleOf(col)"
2815
+ >
2816
+ <span class="mg-skeleton-bar" />
2817
+ </td>
2818
+ </template>
2819
+ </tr>
2820
+ <!-- 전체 너비 행 (fullWidth) — 컬럼 대신 단일 셀 -->
2821
+ <tr
2822
+ v-else-if="isFullWidthOf(entry, rowIdx)"
2823
+ :key="rowKeyOf(entry, rowIdx)"
2824
+ class="mg-fullwidth-row"
2825
+ :data-mg-key="grid.getRowId(rowDataOf(entry))"
2826
+ >
2827
+ <td class="mg-fullwidth-cell" :colspan="colSpan">
2828
+ <slot
2829
+ name="fullwidth"
2830
+ :row="rowDataOf(entry)"
2831
+ :row-index="entryIndexOf(entry, rowIdx)"
2832
+ />
2461
2833
  </td>
2462
2834
  </tr>
2463
2835
  <!-- 리프(데이터) 행 -->
@@ -2465,6 +2837,7 @@ watch(
2465
2837
  v-else
2466
2838
  :key="rowKeyOf(entry, rowIdx)"
2467
2839
  role="row"
2840
+ :data-mg-key="grid.getRowId(rowDataOf(entry))"
2468
2841
  :aria-selected="
2469
2842
  state.selectedRowIds.has(grid.getRowId(rowDataOf(entry)))
2470
2843
  "
@@ -2515,9 +2888,17 @@ watch(
2515
2888
  "
2516
2889
  />
2517
2890
  </td>
2518
- <template v-for="(col, colIndex) in state.visibleColumns">
2891
+ <template
2892
+ v-for="{ kind, col, index: colIndex, count } in renderCols"
2893
+ >
2519
2894
  <td
2520
- v-if="!cellSpanOf(rowDataOf(entry), col).hidden"
2895
+ v-if="kind === 'spacer'"
2896
+ :key="`csp-${colIndex}`"
2897
+ class="mg-col-spacer"
2898
+ :colspan="count"
2899
+ />
2900
+ <td
2901
+ v-else-if="!cellSpanOf(rowDataOf(entry), col).hidden"
2521
2902
  :key="col.field"
2522
2903
  :rowspan="cellSpanOf(rowDataOf(entry), col).rowSpan"
2523
2904
  :colspan="cellSpanOf(rowDataOf(entry), col).colSpan"
@@ -2765,7 +3146,11 @@ watch(
2765
3146
  :type="editorInputType(col)"
2766
3147
  class="mg-editor"
2767
3148
  :class="{ 'mg-editor-error': editErrorOf(col) }"
2768
- :value="editorInputValue(editValueOf(col))"
3149
+ :value="
3150
+ editorInputType(col) === 'text'
3151
+ ? editorMaskedValue(col)
3152
+ : editorInputValue(editValueOf(col))
3153
+ "
2769
3154
  :list="
2770
3155
  editorInputType(col) === 'text' &&
2771
3156
  editorOptionsOf(col, rowDataOf(entry)).length
@@ -2921,18 +3306,28 @@ watch(
2921
3306
  <td v-if="rowStatus" class="mg-status-cell" />
2922
3307
  <td v-if="rowCheckboxes" class="mg-check-cell" />
2923
3308
  <td v-if="rowNumbers" class="mg-rownum-cell" />
2924
- <td
2925
- v-for="(col, colIndex) in state.visibleColumns"
2926
- :key="col.field"
2927
- :class="{
2928
- 'mg-pinned': !!col.pinned,
2929
- 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
2930
- 'mg-pin-right-edge': colIndex === firstRightPinIdx,
2931
- }"
2932
- :style="pinStyleOf(col)"
3309
+ <template
3310
+ v-for="{ kind, col, index: colIndex, count } in renderCols"
2933
3311
  >
2934
- {{ grid.getCellText(prow, col) }}
2935
- </td>
3312
+ <td
3313
+ v-if="kind === 'spacer'"
3314
+ :key="`csp-${colIndex}`"
3315
+ class="mg-col-spacer"
3316
+ :colspan="count"
3317
+ />
3318
+ <td
3319
+ v-else
3320
+ :key="col.field"
3321
+ :class="{
3322
+ 'mg-pinned': !!col.pinned,
3323
+ 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
3324
+ 'mg-pin-right-edge': colIndex === firstRightPinIdx,
3325
+ }"
3326
+ :style="pinStyleOf(col)"
3327
+ >
3328
+ {{ grid.getCellText(prow, col) }}
3329
+ </td>
3330
+ </template>
2936
3331
  </tr>
2937
3332
  <tr
2938
3333
  v-if="
@@ -2961,26 +3356,38 @@ watch(
2961
3356
  <td v-if="rowStatus" class="mg-status-cell" />
2962
3357
  <td v-if="rowCheckboxes" class="mg-check-cell" />
2963
3358
  <td v-if="rowNumbers" class="mg-rownum-cell" />
2964
- <td
2965
- v-for="(col, colIndex) in state.visibleColumns"
2966
- :key="col.field"
2967
- :class="{
2968
- 'mg-pinned': !!col.pinned,
2969
- 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
2970
- 'mg-pin-right-edge': colIndex === firstRightPinIdx,
2971
- }"
2972
- :style="pinStyleOf(col)"
3359
+ <template
3360
+ v-for="{ kind, col, index: colIndex, count } in renderCols"
2973
3361
  >
2974
- <span
2975
- v-if="col.aggregationFn && state.grandTotals[col.field] != null"
2976
- class="mg-agg"
3362
+ <td
3363
+ v-if="kind === 'spacer'"
3364
+ :key="`csp-${colIndex}`"
3365
+ class="mg-col-spacer"
3366
+ :colspan="count"
3367
+ />
3368
+ <td
3369
+ v-else
3370
+ :key="col.field"
3371
+ :class="{
3372
+ 'mg-pinned': !!col.pinned,
3373
+ 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
3374
+ 'mg-pin-right-edge': colIndex === firstRightPinIdx,
3375
+ }"
3376
+ :style="pinStyleOf(col)"
2977
3377
  >
2978
- {{ formatAggregate(state.grandTotals[col.field]) }}
2979
- </span>
2980
- <template v-else-if="colIndex === 0">{{
2981
- state.locale.totalLabel
2982
- }}</template>
2983
- </td>
3378
+ <span
3379
+ v-if="
3380
+ col.aggregationFn && state.grandTotals[col.field] != null
3381
+ "
3382
+ class="mg-agg"
3383
+ >
3384
+ {{ formatAggregate(state.grandTotals[col.field]) }}
3385
+ </span>
3386
+ <template v-else-if="colIndex === 0">{{
3387
+ state.locale.totalLabel
3388
+ }}</template>
3389
+ </td>
3390
+ </template>
2984
3391
  </tr>
2985
3392
  </tfoot>
2986
3393
  </table>