@moda-grid/vue2 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/DataGrid.vue CHANGED
@@ -5,19 +5,25 @@ import {
5
5
  onBeforeUnmount,
6
6
  onMounted,
7
7
  ref,
8
+ useSlots,
8
9
  watch,
9
10
  watchEffect,
10
11
  } from "vue";
11
12
  import type { CSSProperties, PropType } from "vue";
12
13
  import {
14
+ createLongPressTracker,
15
+ createTouchDrag,
13
16
  DEFAULT_COLUMN_WIDTH,
14
17
  DEFAULT_OPERATOR_BY_TYPE,
15
18
  FILTER_OPERATOR_LABELS,
16
19
  FILTER_OPERATORS_BY_TYPE,
17
20
  formatAggregate,
21
+ gridThemeClasses,
22
+ gridThemeVars,
18
23
  } from "@moda-grid/core";
19
24
  import type {
20
25
  AggregateFn,
26
+ BuiltInAggregateFn,
21
27
  AppendScrollOptions,
22
28
  PivotOptions,
23
29
  PivotZone,
@@ -30,6 +36,8 @@ import type {
30
36
  DisplayRow,
31
37
  FilterOperator,
32
38
  Grid,
39
+ GridDensity,
40
+ GridTheme,
33
41
  GridEventHandlers,
34
42
  GridEventMap,
35
43
  GridOptions,
@@ -52,15 +60,28 @@ function editorInputValue(v: unknown): string {
52
60
  return String(v ?? "");
53
61
  }
54
62
 
63
+ const slots = useSlots();
64
+ /** 행 상세 패널 (master-detail) — #detail="{ row, rowIndex }" 슬롯이 있으면 각 행에 ▸ 토글 표시 */
65
+ const hasDetailSlot = computed(() => !!slots.detail);
66
+
55
67
  const props = defineProps({
56
68
  columns: { type: Array as PropType<ColumnDef[]>, required: true },
57
69
  /** 모든 컬럼에 적용되는 공통 기본값 — 컬럼 명시 속성이 우선 (defaultColDef 대응) */
58
- defaultColDef: { type: Object as PropType<Partial<ColumnDef>>, default: undefined },
70
+ defaultColDef: {
71
+ type: Object as PropType<Partial<ColumnDef>>,
72
+ default: undefined,
73
+ },
59
74
  /** 행 데이터. `grid`를 직접 넘기는 제어 모드에서는 생략 가능 */
60
- data: { type: Array as PropType<Record<string, unknown>[]>, default: undefined },
75
+ data: {
76
+ type: Array as PropType<Record<string, unknown>[]>,
77
+ default: undefined,
78
+ },
61
79
  /** 외부에서 생성/관리하는 GridCore. 생략하면 내부 인스턴스 생성 */
62
80
  grid: { type: Object as PropType<Grid<any>>, default: undefined },
63
- getRowId: { type: Function as PropType<(row: Record<string, unknown>) => string>, default: undefined },
81
+ getRowId: {
82
+ type: Function as PropType<(row: Record<string, unknown>) => string>,
83
+ default: undefined,
84
+ },
64
85
  /** 행 클릭 시 선택 토글 */
65
86
  selectable: { type: Boolean, default: true },
66
87
  /** 가상 스크롤: 뷰포트 높이(px). `rowHeight`와 함께 지정 시 활성 */
@@ -75,11 +96,20 @@ const props = defineProps({
75
96
  reorderable: { type: Boolean, default: true },
76
97
  rowResizable: { type: Boolean, default: false },
77
98
  /** 셀 선택 모드: 방향키 이동 + Shift 범위 확장 */
78
- selectionMode: { type: String as PropType<SelectionMode>, default: undefined },
99
+ selectionMode: {
100
+ type: String as PropType<SelectionMode>,
101
+ default: undefined,
102
+ },
79
103
  /** 서버 사이드 데이터 소스 (내부 GridCore 생성 모드에서만 적용) */
80
- serverSide: { type: Object as PropType<ServerSideOptions>, default: undefined },
104
+ serverSide: {
105
+ type: Object as PropType<ServerSideOptions>,
106
+ default: undefined,
107
+ },
81
108
  /** Append Scroll 데이터 소스 — 스크롤 하단에서 자동으로 다음 페이지 로드 (내부 GridCore 생성 모드에서만 적용) */
82
- appendScroll: { type: Object as PropType<AppendScrollOptions>, default: undefined },
109
+ appendScroll: {
110
+ type: Object as PropType<AppendScrollOptions>,
111
+ default: undefined,
112
+ },
83
113
  /** 계층형 데이터: flat parentId 또는 nested children (내부 GridCore 생성 모드에서만 적용) */
84
114
  treeData: { type: Object as PropType<TreeDataOptions>, default: undefined },
85
115
  /** 피벗 모드 (내부 GridCore 생성 모드에서만 적용) */
@@ -89,9 +119,17 @@ const props = defineProps({
89
119
  /** 내장 UI 문자열 로케일 */
90
120
  locale: { type: Object as PropType<Partial<GridLocale>>, default: undefined },
91
121
  /** 셀 우클릭 컨텍스트 메뉴 항목 (배열 또는 grid를 받는 함수) */
92
- contextMenu: { type: [Array, Function] as PropType<GridOptions<RowData>["contextMenu"]>, default: undefined },
122
+ contextMenu: {
123
+ type: [Array, Function] as PropType<GridOptions<RowData>["contextMenu"]>,
124
+ default: undefined,
125
+ },
93
126
  /** 헤더 우클릭 컨텍스트 메뉴 항목 */
94
- headerContextMenu: { type: [Array, Function] as PropType<GridOptions<RowData>["headerContextMenu"]>, default: undefined },
127
+ headerContextMenu: {
128
+ type: [Array, Function] as PropType<
129
+ GridOptions<RowData>["headerContextMenu"]
130
+ >,
131
+ default: undefined,
132
+ },
95
133
  /** 맨 왼쪽에 행 번호 컬럼 표시 */
96
134
  rowNumbers: { type: Boolean, default: false },
97
135
  /** 우상단 컬럼 관리 도구(체크박스 팝오버 + 전체 선택/해제) 표시 */
@@ -117,6 +155,7 @@ const props = defineProps({
117
155
  singleClickEdit: { type: Boolean, default: false },
118
156
  /** 편집 단위 — "cell"(기본) / "fullRow"(행 전체 동시 편집) */
119
157
  editType: { type: String as () => "cell" | "fullRow", default: "cell" },
158
+ pasteExtend: { type: Boolean, default: false },
120
159
  /** 그리드 상단에 찾기 바 표시 — Enter 다음 매치 / Shift+Enter 이전 매치 */
121
160
  findBox: { type: Boolean, default: false },
122
161
  /** filterable 컬럼 헤더에 값 목록 필터 드롭다운 버튼 표시 — 엑셀 autofilter */
@@ -126,22 +165,62 @@ const props = defineProps({
126
165
  /** 헤더 영역 전체 높이(px) — 헤더 행 수로 균등 분할 */
127
166
  headerHeight: { type: Number, default: undefined },
128
167
  /** 파이프라인에서 숨길 행 id 목록 — 정렬/필터/집계에서 제외, 원본 데이터는 유지 */
129
- hiddenRowIds: { type: Array as PropType<readonly string[]>, default: undefined },
168
+ hiddenRowIds: {
169
+ type: Array as PropType<readonly string[]>,
170
+ default: undefined,
171
+ },
130
172
  /** zebra 줄무늬 행 배경 — 짝수 표시 행에 --grid-stripe-bg */
131
173
  striped: { type: Boolean, default: false },
132
174
  /** 편집 진입 직전 훅 — false 반환 시 편집 취소 (타사 그리드 OnBeforeEdit 대응) */
133
- beforeEdit: { type: Function as PropType<GridOptions<RowData>["beforeEdit"]>, default: undefined },
134
- isRowSelectable: { type: Function as PropType<GridOptions<RowData>["isRowSelectable"]>, default: undefined },
135
- externalFilter: { type: Function as PropType<GridOptions<RowData>["externalFilter"]>, default: undefined },
136
- postSort: { type: Function as PropType<GridOptions<RowData>["postSort"]>, default: undefined },
137
- beforePaste: { type: Function as PropType<GridOptions<RowData>["beforePaste"]>, default: undefined },
138
- beforeCopy: { type: Function as PropType<GridOptions<RowData>["beforeCopy"]>, default: undefined },
139
- /** 그리드 자체 테마 — 지정 시 루트에 grid-theme-* 클래스 적용 */
140
- theme: { type: String as PropType<"light" | "dark">, default: undefined },
175
+ beforeEdit: {
176
+ type: Function as PropType<GridOptions<RowData>["beforeEdit"]>,
177
+ default: undefined,
178
+ },
179
+ isRowSelectable: {
180
+ type: Function as PropType<GridOptions<RowData>["isRowSelectable"]>,
181
+ default: undefined,
182
+ },
183
+ externalFilter: {
184
+ type: Function as PropType<GridOptions<RowData>["externalFilter"]>,
185
+ default: undefined,
186
+ },
187
+ postSort: {
188
+ type: Function as PropType<GridOptions<RowData>["postSort"]>,
189
+ default: undefined,
190
+ },
191
+ beforePaste: {
192
+ type: Function as PropType<GridOptions<RowData>["beforePaste"]>,
193
+ default: undefined,
194
+ },
195
+ beforeCopy: {
196
+ type: Function as PropType<GridOptions<RowData>["beforeCopy"]>,
197
+ default: undefined,
198
+ },
199
+ /** 레이아웃 모드 — "autoHeight"면 내용만큼 늘어남 (내부 스크롤·가상 스크롤 무시) */
200
+ domLayout: {
201
+ type: String as PropType<"normal" | "autoHeight">,
202
+ default: undefined,
203
+ },
204
+ /** 뷰포트 높이/행 높이로 페이지 크기 자동 계산 — height/rowHeight 필요 */
205
+ autoPageSize: { type: Boolean, default: false },
206
+ /** 클립보드 셀 구분자 — 복사/붙여넣기 양쪽에 적용 (기본값: 탭) */
207
+ clipboardDelimiter: { type: String, default: undefined },
208
+ /** 로딩 오버레이 표시 — 그리드 전체를 반투명 레이어로 덮음 */
209
+ loading: { type: Boolean, default: false },
210
+ /**
211
+ * 그리드 테마 — "light"/"dark" 팔레트 또는 `{ base, vars }` 오브젝트로
212
+ * --grid-* 변수를 루트에 인라인 적용한다
213
+ */
214
+ theme: { type: [String, Object] as PropType<GridTheme>, default: undefined },
215
+ /** 밀도 프리셋 — "compact"/"comfortable"이 폰트·셀 패딩을 일괄 조정 */
216
+ density: { type: String as PropType<GridDensity>, default: undefined },
141
217
  /** 선언형 이벤트 핸들러 — 마운트 시 구독, 언마운트 시 해제 (grid.on과 동일) */
142
218
  events: { type: Object as PropType<GridEventHandlers>, default: undefined },
143
219
  /** GridCore 인스턴스가 준비되면 한 번 호출 — props 모드에서도 grid API 접근 가능 */
144
- onReady: { type: Function as PropType<(grid: Grid) => void>, default: undefined },
220
+ onReady: {
221
+ type: Function as PropType<(grid: Grid) => void>,
222
+ default: undefined,
223
+ },
145
224
  });
146
225
 
147
226
  // 내부 GridCore (grid prop이 없을 때만 생성)
@@ -166,6 +245,7 @@ const internal = props.grid
166
245
  copyFormatted: props.copyFormatted,
167
246
  singleClickEdit: props.singleClickEdit,
168
247
  editType: props.editType,
248
+ pasteExtend: props.pasteExtend,
169
249
  headerHeight: props.headerHeight,
170
250
  hiddenRowIds: props.hiddenRowIds ? [...props.hiddenRowIds] : undefined,
171
251
  striped: props.striped,
@@ -176,7 +256,10 @@ const internal = props.grid
176
256
  beforePaste: props.beforePaste,
177
257
  beforeCopy: props.beforeCopy,
178
258
  virtualScroll:
179
- props.height != null && props.rowHeight != null && props.rowHeight > 0
259
+ props.domLayout !== "autoHeight" &&
260
+ props.height != null &&
261
+ props.rowHeight != null &&
262
+ props.rowHeight > 0
180
263
  ? {
181
264
  rowHeight: props.rowHeight,
182
265
  viewportHeight: props.height,
@@ -186,6 +269,13 @@ const internal = props.grid
186
269
  });
187
270
  const grid = props.grid ?? internal!.grid;
188
271
  const state = props.grid ? useGridState(grid).state : internal!.state;
272
+ // 로딩 오버레이 — prop 또는 코어 상태(grid.setLoading → state.loading) 합산
273
+ const isLoading = computed(() => props.loading || state.value.loading);
274
+ // 테마·밀도 — 코어 헬퍼로 클래스/인라인 var를 선언적 바인딩한다
275
+ const themeClasses = computed(() =>
276
+ gridThemeClasses(props.theme, props.density),
277
+ );
278
+ const themeStyle = computed(() => gridThemeVars(props.theme) as CSSProperties);
189
279
 
190
280
  // 선언형 이벤트 구독 — events 맵의 각 키를 grid.on에 연결
191
281
  watch(
@@ -215,10 +305,18 @@ watchEffect(() => {
215
305
  if (props.data) grid.setData(props.data);
216
306
  });
217
307
  watchEffect(() => {
308
+ // 외부 grid 경로에서도 defaultColDef prop이 적용되도록 먼저 동기화 —
309
+ // undefined는 "미지정"이라 기존 기본값이 유지된다
310
+ grid.setDefaultColDef(props.defaultColDef);
218
311
  grid.setColumns(props.columns);
219
312
  });
220
313
  watchEffect(() => {
221
- if (props.height != null && props.rowHeight != null && props.rowHeight > 0) {
314
+ if (
315
+ props.domLayout !== "autoHeight" &&
316
+ props.height != null &&
317
+ props.rowHeight != null &&
318
+ props.rowHeight > 0
319
+ ) {
222
320
  grid.setVirtualScroll({
223
321
  rowHeight: props.rowHeight,
224
322
  viewportHeight: props.height,
@@ -247,6 +345,13 @@ watchEffect(() => {
247
345
  grid.setPostSort(props.postSort ?? null);
248
346
  grid.setBeforePaste(props.beforePaste ?? null);
249
347
  grid.setBeforeCopy(props.beforeCopy ?? null);
348
+ // 외부 grid prop 경로에서도 컨텍스트 메뉴 prop이 적용되도록
349
+ // 런타임 setter로 동기화한다
350
+ grid.setContextMenu(props.contextMenu ?? null);
351
+ grid.setHeaderContextMenu(props.headerContextMenu ?? null);
352
+ });
353
+ watchEffect(() => {
354
+ grid.setClipboardDelimiter(props.clipboardDelimiter ?? null);
250
355
  });
251
356
 
252
357
  // 가상 스크롤: 코어가 보정한 scrollTop을 DOM에 동기화 (키보드 scrollIntoView)
@@ -268,9 +373,7 @@ watch(
268
373
  (scrollEl.value ?? hostEl.value)
269
374
  ?.querySelector<HTMLElement>(
270
375
  `td[data-mg-row="${req.rowIndex}"]` +
271
- (req.columnIndex != null
272
- ? `[data-mg-col="${req.columnIndex}"]`
273
- : ""),
376
+ (req.columnIndex != null ? `[data-mg-col="${req.columnIndex}"]` : ""),
274
377
  )
275
378
  ?.scrollIntoView({ block: "nearest", inline: "nearest" });
276
379
  },
@@ -289,6 +392,7 @@ watchEffect(() => grid.setEditType(props.editType ?? "cell"));
289
392
 
290
393
  // 찾기 바 — findNext로 다음/이전 매치 순환 (Enter / Shift+Enter)
291
394
  const findInputEl = ref<HTMLInputElement | null>(null);
395
+ const replaceInputEl = ref<HTMLInputElement | null>(null);
292
396
  const findCount = ref("");
293
397
  // 찾기 옵션 — 대소문자 구분 / 셀 전체 일치 (타사 그리드 찾기 옵션 대응)
294
398
  const findCaseSensitive = ref(false);
@@ -302,7 +406,9 @@ function currentFindOpts() {
302
406
  function onFindOptChange() {
303
407
  const q = findInputEl.value?.value ?? "";
304
408
  grid.setFindQuery(q || null, currentFindOpts());
305
- findCount.value = q ? `${grid.findCells(q, currentFindOpts()).length}건` : "";
409
+ findCount.value = q
410
+ ? grid.locale.findResult(grid.findCells(q, currentFindOpts()).length)
411
+ : "";
306
412
  }
307
413
  // Vue2 템플릿은 TS 캐스트 미지원 — 체크박스 change는 스크립트 메서드로 처리
308
414
  function onFindCaseChange(e: Event) {
@@ -317,7 +423,7 @@ function goFind(backward: boolean) {
317
423
  const q = findInputEl.value?.value ?? "";
318
424
  grid.setFindQuery(q || null, currentFindOpts()); // 매치 셀 하이라이트
319
425
  const total = grid.findCells(q, currentFindOpts()).length;
320
- findCount.value = q ? `${total}건` : "";
426
+ findCount.value = q ? grid.locale.findResult(total) : "";
321
427
  if (!q || !total) return;
322
428
  const m = grid.findNext(q, { ...currentFindOpts(), backward });
323
429
  if (m) {
@@ -328,6 +434,25 @@ function goFind(backward: boolean) {
328
434
  ?.scrollIntoView({ block: "nearest", inline: "nearest" });
329
435
  }
330
436
  }
437
+ // 찾기 바 바꾸기 — 모든 매치를 바꿀 값으로 치환 (grid.replaceAll 경유)
438
+ function replaceAll() {
439
+ const q = findInputEl.value?.value ?? "";
440
+ if (!q) return;
441
+ const n = grid.replaceAll(
442
+ q,
443
+ replaceInputEl.value?.value ?? "",
444
+ currentFindOpts(),
445
+ );
446
+ findCount.value = grid.locale.replaceResult(n);
447
+ }
448
+ function onReplaceKeydown(e: KeyboardEvent) {
449
+ if (e.isComposing) return; // IME 조합 확정 Enter가 바꾸기로 오작동하지 않도록
450
+ if (e.key === "Enter") {
451
+ e.preventDefault();
452
+ replaceAll();
453
+ }
454
+ e.stopPropagation(); // 그리드 키 내비와 충돌 방지
455
+ }
331
456
  function onFindKeydown(e: KeyboardEvent) {
332
457
  if (e.isComposing) return; // IME 조합 확정 Enter가 매치 이동으로 오작동하지 않도록
333
458
  if (e.key === "Enter") {
@@ -339,7 +464,9 @@ function onFindKeydown(e: KeyboardEvent) {
339
464
  function onFindInput(e: Event) {
340
465
  const q = (e.target as HTMLInputElement).value;
341
466
  grid.setFindQuery(q || null, currentFindOpts()); // 입력 즉시 매치 하이라이트
342
- findCount.value = q ? `${grid.findCells(q, currentFindOpts()).length}건` : "";
467
+ findCount.value = q
468
+ ? grid.locale.findResult(grid.findCells(q, currentFindOpts()).length)
469
+ : "";
343
470
  }
344
471
 
345
472
  // 헤더 필터 드롭다운 — 엑셀 autofilter식 값 체크리스트 (한 번에 하나)
@@ -365,9 +492,7 @@ const filterDropCol = computed(() =>
365
492
  : null,
366
493
  );
367
494
  const filterDropAll = computed(() =>
368
- filterDropCol.value
369
- ? grid.getUniqueValues(filterDropCol.value.field)
370
- : [],
495
+ filterDropCol.value ? grid.getUniqueValues(filterDropCol.value.field) : [],
371
496
  );
372
497
  const filterDropActive = computed(() =>
373
498
  filterDropCol.value
@@ -400,7 +525,15 @@ function onFilterDropKeydown(e: KeyboardEvent) {
400
525
 
401
526
  // ── 피벗 필드 패널 — 필드 칩을 행/열/값 존으로 드래그해 피벗 구성 ──
402
527
  const PIVOT_DATA_TYPE = "application/x-mg-pivot";
403
- const PIVOT_AGGS: AggregateFn[] = ["sum", "avg", "min", "max", "count"];
528
+ const PIVOT_AGGS: BuiltInAggregateFn[] = [
529
+ "sum",
530
+ "avg",
531
+ "min",
532
+ "max",
533
+ "count",
534
+ "first",
535
+ "last",
536
+ ];
404
537
  const pivotDropZone = ref<string | null>(null);
405
538
  function pivotHeaderOf(field: string) {
406
539
  return (
@@ -409,7 +542,7 @@ function pivotHeaderOf(field: string) {
409
542
  }
410
543
  function onPivotAggChange(field: string, e: Event) {
411
544
  const v = (e.target as HTMLSelectElement).value;
412
- grid.setPivotValueAgg(field, v as AggregateFn);
545
+ grid.setPivotValueAgg(field, v as BuiltInAggregateFn);
413
546
  }
414
547
  function pivotChipsOf(zone: string) {
415
548
  const p = state.value.pivot;
@@ -458,7 +591,10 @@ function pivotDragField(e: DragEvent): string {
458
591
  }
459
592
  function pivotDragAccepts(e: DragEvent): boolean {
460
593
  const t = e.dataTransfer?.types;
461
- return !!t && (t.includes(PIVOT_DATA_TYPE) || t.includes("application/x-mg-column"));
594
+ return (
595
+ !!t &&
596
+ (t.includes(PIVOT_DATA_TYPE) || t.includes("application/x-mg-column"))
597
+ );
462
598
  }
463
599
  function onPivotZoneDragOver(zone: string, e: DragEvent) {
464
600
  if (!pivotDragAccepts(e)) return;
@@ -489,7 +625,8 @@ function onPivotChipDragOver(e: DragEvent) {
489
625
  function rowStyleOf(entry: AnyRow, rowIdx: number) {
490
626
  const row = rowDataOf(entry);
491
627
  const base: Record<string, string> = {};
492
- const h = virtual.value && props.rowHeight ? props.rowHeight : grid.getRowHeight(row);
628
+ const h =
629
+ virtual.value && props.rowHeight ? props.rowHeight : grid.getRowHeight(row);
493
630
  if (h) base.height = `${h}px`;
494
631
  // GridOptions/ColumnDef.rowStyle — kebab-case 맵 병합 (Vue :style이 그대로 적용)
495
632
  const custom = grid.getRowStyle(row, entryIndexOf(entry, rowIdx));
@@ -518,14 +655,37 @@ function onGroupPanelDrop(event: DragEvent) {
518
655
  groupDropOver.value = false;
519
656
  const field = event.dataTransfer?.getData("application/x-mg-column");
520
657
  if (field && !state.value.groupBy.includes(field)) {
521
- grid.setGroupBy([
522
- ...state.value.groupBy,
523
- field,
524
- ] as (keyof RowT & string)[]);
658
+ grid.setGroupBy([...state.value.groupBy, field] as (keyof RowT & string)[]);
525
659
  }
526
660
  }
527
661
 
528
662
  const virtual = computed(() => state.value.virtual);
663
+ const autoHeight = computed(() => props.domLayout === "autoHeight");
664
+
665
+ // autoPageSize — 뷰포트 높이/행 높이로 pageSize 자동 계산 (리사이즈 재계산)
666
+ let pageSizeObs: ResizeObserver | null = null;
667
+ onMounted(() => {
668
+ const rh = props.rowHeight;
669
+ if (!props.autoPageSize || !rh) return;
670
+ const sync = () => {
671
+ const host = hostEl.value;
672
+ if (!host) return;
673
+ const headH =
674
+ host.querySelector("thead")?.getBoundingClientRect().height ?? 0;
675
+ const pagerH =
676
+ host.querySelector(".mg-pager")?.getBoundingClientRect().height ?? 0;
677
+ const avail = (props.height ?? host.clientHeight) - headH - pagerH;
678
+ const size = Math.max(1, Math.floor(avail / rh));
679
+ const snap = grid.getSnapshot();
680
+ if (size !== snap.pageSize) grid.setPage(snap.pageIndex, size);
681
+ };
682
+ nextTick(sync);
683
+ if (typeof ResizeObserver !== "undefined") {
684
+ pageSizeObs = new ResizeObserver(sync);
685
+ if (hostEl.value) pageSizeObs.observe(hostEl.value);
686
+ }
687
+ });
688
+ onBeforeUnmount(() => pageSizeObs?.disconnect());
529
689
  // 그룹화 시: displayRows(그룹 헤더 포함)를 virtual 인덱스로 슬라이스
530
690
  type RowT = Record<string, unknown>;
531
691
  type AnyRow = DisplayRow<RowT> | RowT;
@@ -569,7 +729,10 @@ const activeFilterCount = computed(
569
729
  );
570
730
  const bottomOffset = computed(() =>
571
731
  virtual.value && props.rowHeight
572
- ? Math.max(0, virtual.value.totalHeight - virtual.value.endIndex * props.rowHeight)
732
+ ? Math.max(
733
+ 0,
734
+ virtual.value.totalHeight - virtual.value.endIndex * props.rowHeight,
735
+ )
573
736
  : 0,
574
737
  );
575
738
 
@@ -655,6 +818,211 @@ function onCellContextMenu(
655
818
  }
656
819
  }
657
820
 
821
+ // 터치 롱프레스 → contextmenu와 동일 동작 (헤더/셀 공용 트래커)
822
+ const lp = createLongPressTracker();
823
+
824
+ function onCellPointerDown(
825
+ e: PointerEvent,
826
+ rowIndex: number,
827
+ col: ColumnDef,
828
+ ): void {
829
+ lp.down(e, (x, y) => grid.openContextMenu(x, y, rowIndex, col.field));
830
+ }
831
+
832
+ function onHeaderPointerDown(e: PointerEvent, col: ColumnDef): void {
833
+ lp.down(e, (x, y) => grid.openHeaderContextMenu(x, y, col.field));
834
+ if (props.reorderable && col.movable !== false)
835
+ touchDrag.col.down(e, col.field);
836
+ }
837
+
838
+ // ── 터치 커스텀 DnD — iOS/Android는 HTML5 DnD가 없어 포인터 제스처로 보강 ──
839
+ const touchColField = ref<string | null>(null); // mg-col-dragging 표시용
840
+ let touchColFieldRaw: string | null = null;
841
+
842
+ /** 터치 드롭 대상 해석 — 컬럼 헤더/피벗 존/그룹 패널 */
843
+ function touchHitAt(target: Element | null) {
844
+ const root = hostEl.value;
845
+ const t = target as HTMLElement | null;
846
+ if (!root || !t?.closest) return null;
847
+ const zoneEl = t.closest<HTMLElement>(".mg-pivot-zone");
848
+ if (zoneEl && root.contains(zoneEl)) {
849
+ const chip = t.closest<HTMLElement>(".mg-pivot-chip");
850
+ const idx =
851
+ chip && zoneEl.contains(chip)
852
+ ? chip.getAttribute("data-mg-pivot-index")
853
+ : null;
854
+ return {
855
+ kind: "pivot" as const,
856
+ zone: zoneEl.getAttribute("data-mg-pivot-zone") ?? "",
857
+ index: idx != null ? Number(idx) : undefined,
858
+ };
859
+ }
860
+ const gp = t.closest<HTMLElement>(".mg-group-panel");
861
+ if (gp && root.contains(gp)) return { kind: "group" as const };
862
+ const th = t.closest<HTMLElement>("th[data-mg-field]");
863
+ if (th && root.contains(th))
864
+ return {
865
+ kind: "column" as const,
866
+ field: th.getAttribute("data-mg-field")!,
867
+ };
868
+ return null;
869
+ }
870
+
871
+ /** 포인터 아래 행의 삽입 갭 — td의 data-mg-row로 행 인덱스를 해석한다 */
872
+ function touchRowGapAt(target: Element | null, y: number): number | null {
873
+ const root = hostEl.value;
874
+ const t = target as HTMLElement | null;
875
+ let td = t?.closest?.("td[data-mg-row]") as HTMLElement | null;
876
+ if (!td)
877
+ td =
878
+ (t?.closest?.("tr") as HTMLElement | null)?.querySelector?.(
879
+ "td[data-mg-row]",
880
+ ) ?? null;
881
+ if (!root || !td || !root.contains(td)) return null;
882
+ const rowIndex = Number(td.getAttribute("data-mg-row"));
883
+ const tr = td.closest("tr");
884
+ if (Number.isNaN(rowIndex) || !tr) return null;
885
+ const rect = tr.getBoundingClientRect();
886
+ return y < rect.top + rect.height / 2 ? rowIndex : rowIndex + 1;
887
+ }
888
+
889
+ function applyTouchDrop(
890
+ hit: ReturnType<typeof touchHitAt>,
891
+ field: string,
892
+ ): void {
893
+ if (!hit || !field) return;
894
+ if (hit.kind === "pivot") {
895
+ if (hit.zone === "fields") grid.removePivotField(field);
896
+ else
897
+ grid.addPivotField(
898
+ hit.zone as PivotZone,
899
+ field,
900
+ hit.index != null ? { index: hit.index } : {},
901
+ );
902
+ } else if (hit.kind === "group") {
903
+ const snap = grid.getSnapshot();
904
+ if (!snap.groupBy.includes(field))
905
+ grid.setGroupBy([...snap.groupBy, field]);
906
+ } else if (hit.field !== field) {
907
+ grid.reorderColumn(field, hit.field);
908
+ }
909
+ }
910
+
911
+ function clearTouchDropMarks(): void {
912
+ dragOverField.value = null;
913
+ pivotDropZone.value = null;
914
+ groupDropOver.value = false;
915
+ }
916
+
917
+ const touchDrag = {
918
+ // 컬럼 헤더 — 수평 이동으로 확정 (th는 touch-action: pan-y)
919
+ col: createTouchDrag<string>("x", {
920
+ start: (field: string) => {
921
+ // 롱프레스 메뉴가 이미 열렸으면 드래그로 전환하지 않는다
922
+ if (grid.getSnapshot().contextMenu) return false;
923
+ lp.end();
924
+ touchColFieldRaw = field;
925
+ touchColField.value = field;
926
+ return true;
927
+ },
928
+ move: (_x: number, _y: number, target: Element | null) => {
929
+ const hit = touchHitAt(target);
930
+ dragOverField.value =
931
+ hit?.kind === "column" && hit.field !== touchColFieldRaw
932
+ ? hit.field
933
+ : null;
934
+ pivotDropZone.value = hit?.kind === "pivot" ? hit.zone : null;
935
+ groupDropOver.value = hit?.kind === "group";
936
+ },
937
+ up: (_x: number, _y: number, target: Element | null, field: string) => {
938
+ applyTouchDrop(touchHitAt(target), field);
939
+ clearTouchDropMarks();
940
+ touchColFieldRaw = null;
941
+ touchColField.value = null;
942
+ },
943
+ cancel: () => {
944
+ clearTouchDropMarks();
945
+ touchColFieldRaw = null;
946
+ touchColField.value = null;
947
+ },
948
+ }),
949
+ // 행 드래그 핸들 — 세로 이동으로 확정 (핸들은 touch-action: none)
950
+ row: createTouchDrag<number>("y", {
951
+ start: (rowIndex: number) => {
952
+ lp.end();
953
+ return grid.beginRowDrag(rowIndex);
954
+ },
955
+ move: (_x: number, y: number, target: Element | null) => {
956
+ const gap = touchRowGapAt(target, y);
957
+ if (gap != null) grid.updateRowDropPosition(gap);
958
+ },
959
+ up: () => grid.endRowDrag(true),
960
+ cancel: () => grid.endRowDrag(false),
961
+ }),
962
+ // 피벗 칩 — 아무 방향이든 이동으로 확정 (칩은 touch-action: none)
963
+ chip: createTouchDrag<string>("any", {
964
+ move: (_x: number, _y: number, target: Element | null) => {
965
+ const hit = touchHitAt(target);
966
+ pivotDropZone.value = hit?.kind === "pivot" ? hit.zone : null;
967
+ },
968
+ up: (_x: number, _y: number, target: Element | null, field: string) => {
969
+ const hit = touchHitAt(target);
970
+ pivotDropZone.value = null;
971
+ if (hit?.kind !== "pivot") return;
972
+ if (hit.zone === "fields") grid.removePivotField(field);
973
+ else
974
+ grid.addPivotField(
975
+ hit.zone as PivotZone,
976
+ field,
977
+ hit.index != null ? { index: hit.index } : {},
978
+ );
979
+ },
980
+ cancel: () => {
981
+ pivotDropZone.value = null;
982
+ },
983
+ }),
984
+ };
985
+
986
+ function onPivotChipPointerDown(field: string, e: PointerEvent): void {
987
+ e.stopPropagation();
988
+ touchDrag.chip.down(e, field);
989
+ }
990
+
991
+ function onRowDragPointerDown(e: PointerEvent, rowIndex: number): void {
992
+ e.stopPropagation();
993
+ if (rowDraggable.value) touchDrag.row.down(e, rowIndex);
994
+ }
995
+
996
+ // 포인터 추적을 document에 위임 — 드래그 중 소스 노드가 재생성돼도 계속된다
997
+ onMounted(() => {
998
+ const move = (e: PointerEvent) => {
999
+ lp.move(e);
1000
+ touchDrag.col.move(e);
1001
+ touchDrag.row.move(e);
1002
+ touchDrag.chip.move(e);
1003
+ };
1004
+ const up = (e: PointerEvent) => {
1005
+ lp.end();
1006
+ touchDrag.col.up(e);
1007
+ touchDrag.row.up(e);
1008
+ touchDrag.chip.up(e);
1009
+ };
1010
+ const cancel = () => {
1011
+ lp.end();
1012
+ touchDrag.col.cancel();
1013
+ touchDrag.row.cancel();
1014
+ touchDrag.chip.cancel();
1015
+ };
1016
+ document.addEventListener("pointermove", move);
1017
+ document.addEventListener("pointerup", up);
1018
+ document.addEventListener("pointercancel", cancel);
1019
+ onBeforeUnmount(() => {
1020
+ document.removeEventListener("pointermove", move);
1021
+ document.removeEventListener("pointerup", up);
1022
+ document.removeEventListener("pointercancel", cancel);
1023
+ });
1024
+ });
1025
+
658
1026
  function cellPosFromPoint(
659
1027
  x: number,
660
1028
  y: number,
@@ -666,16 +1034,22 @@ function cellPosFromPoint(
666
1034
  return Number.isNaN(row) || Number.isNaN(col) ? null : { row, col };
667
1035
  }
668
1036
 
669
- let fillSource: { startRow: number; endRow: number; startCol: number; endCol: number } | null = null;
1037
+ let fillSource: {
1038
+ startRow: number;
1039
+ endRow: number;
1040
+ startCol: number;
1041
+ endCol: number;
1042
+ } | null = null;
670
1043
 
671
- function onFillMouseDown(e: MouseEvent): void {
1044
+ function onFillPointerDown(e: PointerEvent): void {
672
1045
  e.preventDefault();
673
1046
  e.stopPropagation();
674
1047
  const src = state.value.selectedRange;
675
1048
  if (!src) return;
676
1049
  fillSource = { ...src };
677
- const onUp = (ev: MouseEvent) => {
678
- window.removeEventListener("mouseup", onUp);
1050
+ const onUp = (ev: PointerEvent) => {
1051
+ window.removeEventListener("pointerup", onUp);
1052
+ window.removeEventListener("pointercancel", onUp);
679
1053
  const source = fillSource;
680
1054
  fillSource = null;
681
1055
  const pos = cellPosFromPoint(ev.clientX, ev.clientY);
@@ -689,7 +1063,8 @@ function onFillMouseDown(e: MouseEvent): void {
689
1063
  grid.fillRange(source, target);
690
1064
  grid.setCellRange(target);
691
1065
  };
692
- window.addEventListener("mouseup", onUp);
1066
+ window.addEventListener("pointerup", onUp);
1067
+ window.addEventListener("pointercancel", onUp);
693
1068
  }
694
1069
 
695
1070
  function cellLinkHref(row: RowData, col: ColumnDef): string {
@@ -723,12 +1098,18 @@ function filterInputType(col: ColumnDef<Record<string, unknown>>) {
723
1098
  return t === "number" ? "number" : t === "date" ? "date" : "text";
724
1099
  }
725
1100
 
726
- function filterValueOf(col: ColumnDef<Record<string, unknown>>, key: "value" | "valueTo") {
1101
+ function filterValueOf(
1102
+ col: ColumnDef<Record<string, unknown>>,
1103
+ key: "value" | "valueTo",
1104
+ ) {
727
1105
  const f = state.value.filters[col.field];
728
1106
  return f ? f[key] || "" : "";
729
1107
  }
730
1108
 
731
- function updateFilter(col: ColumnDef<Record<string, unknown>>, patch: Partial<ColumnFilter>) {
1109
+ function updateFilter(
1110
+ col: ColumnDef<Record<string, unknown>>,
1111
+ patch: Partial<ColumnFilter>,
1112
+ ) {
732
1113
  const f = state.value.filters[col.field];
733
1114
  grid.setFilter(col.field, {
734
1115
  operator: filterOpOf(col),
@@ -738,13 +1119,20 @@ function updateFilter(col: ColumnDef<Record<string, unknown>>, patch: Partial<Co
738
1119
  });
739
1120
  }
740
1121
 
741
- function onFilterOpChange(col: ColumnDef<Record<string, unknown>>, event: Event) {
1122
+ function onFilterOpChange(
1123
+ col: ColumnDef<Record<string, unknown>>,
1124
+ event: Event,
1125
+ ) {
742
1126
  updateFilter(col, {
743
1127
  operator: (event.target as HTMLSelectElement).value as FilterOperator,
744
1128
  });
745
1129
  }
746
1130
 
747
- function onFilterInput(col: ColumnDef<Record<string, unknown>>, key: "value" | "valueTo", event: Event) {
1131
+ function onFilterInput(
1132
+ col: ColumnDef<Record<string, unknown>>,
1133
+ key: "value" | "valueTo",
1134
+ event: Event,
1135
+ ) {
748
1136
  updateFilter(col, { [key]: (event.target as HTMLInputElement).value });
749
1137
  }
750
1138
 
@@ -775,7 +1163,11 @@ function setAllCheckedOf(col: ColumnDef<Record<string, unknown>>) {
775
1163
  return !vals || vals.length >= setValuesOf(col).length;
776
1164
  }
777
1165
 
778
- function onSetToggle(col: ColumnDef<Record<string, unknown>>, v: string, event: Event) {
1166
+ function onSetToggle(
1167
+ col: ColumnDef<Record<string, unknown>>,
1168
+ v: string,
1169
+ event: Event,
1170
+ ) {
779
1171
  const checked = (event.target as HTMLInputElement).checked;
780
1172
  const all = setValuesOf(col);
781
1173
  const f = state.value.filters[col.field];
@@ -842,14 +1234,12 @@ const headerRows = computed<HeaderCell[][]>(() => {
842
1234
  );
843
1235
  const row2: HeaderCell[] = spans.flatMap((s) =>
844
1236
  s.groupId
845
- ? cols
846
- .slice(s.startIndex, s.startIndex + s.colSpan)
847
- .map((col, i) => ({
848
- kind: "col" as const,
849
- key: col.field,
850
- col,
851
- colIndex: s.startIndex + i,
852
- }))
1237
+ ? cols.slice(s.startIndex, s.startIndex + s.colSpan).map((col, i) => ({
1238
+ kind: "col" as const,
1239
+ key: col.field,
1240
+ col,
1241
+ colIndex: s.startIndex + i,
1242
+ }))
853
1243
  : [],
854
1244
  );
855
1245
  return row2.length > 0 ? [row1, row2] : [row1];
@@ -857,63 +1247,68 @@ const headerRows = computed<HeaderCell[][]>(() => {
857
1247
 
858
1248
  const headerRowSpan = computed(() => headerRows.value.length);
859
1249
 
860
- // ── 컬럼 리사이즈: document mousemove를 rAF로 스로틀 ──
1250
+ // ── 컬럼 리사이즈: document pointermove를 rAF로 스로틀 ──
1251
+ // pointerdown/move/up — 마우스·터치·펜 공통 경로 (핸들은 touch-action:none)
861
1252
  let resizeRaf = 0;
862
1253
  let pendingWidth: { field: string; width: number } | null = null;
863
1254
 
864
- function onResizeStart(col: ColumnDef, event: MouseEvent) {
1255
+ function onResizeStart(col: ColumnDef, event: PointerEvent) {
865
1256
  const th = (event.currentTarget as HTMLElement).closest("th");
866
1257
  const startWidth = th?.getBoundingClientRect().width ?? 0;
867
1258
  const startX = event.clientX;
868
1259
  const field = col.field;
869
1260
 
870
- const onMove = (ev: MouseEvent) => {
1261
+ const onMove = (ev: PointerEvent) => {
871
1262
  pendingWidth = { field, width: startWidth + (ev.clientX - startX) };
872
1263
  if (resizeRaf === 0) {
873
1264
  resizeRaf = requestAnimationFrame(() => {
874
1265
  resizeRaf = 0;
875
- if (pendingWidth) grid.setColumnWidth(pendingWidth.field, pendingWidth.width);
1266
+ if (pendingWidth)
1267
+ grid.setColumnWidth(pendingWidth.field, pendingWidth.width);
876
1268
  });
877
1269
  }
878
1270
  };
879
1271
  const onUp = () => {
880
- document.removeEventListener("mousemove", onMove);
881
- document.removeEventListener("mouseup", onUp);
1272
+ document.removeEventListener("pointermove", onMove);
1273
+ document.removeEventListener("pointerup", onUp);
1274
+ document.removeEventListener("pointercancel", onUp);
882
1275
  if (resizeRaf !== 0) {
883
1276
  cancelAnimationFrame(resizeRaf);
884
1277
  resizeRaf = 0;
885
1278
  }
886
- if (pendingWidth) grid.setColumnWidth(pendingWidth.field, pendingWidth.width);
1279
+ if (pendingWidth)
1280
+ grid.setColumnWidth(pendingWidth.field, pendingWidth.width);
887
1281
  pendingWidth = null;
888
1282
  };
889
- document.addEventListener("mousemove", onMove);
890
- document.addEventListener("mouseup", onUp);
1283
+ document.addEventListener("pointermove", onMove);
1284
+ document.addEventListener("pointerup", onUp);
1285
+ document.addEventListener("pointercancel", onUp);
891
1286
  }
892
1287
 
893
1288
  // ── 행 높이 리사이즈: 행 번호 셀 하단 핸들 드래그 → setRowHeight ──
894
- function onRowResizeStart(rowId: string, event: MouseEvent) {
1289
+ function onRowResizeStart(rowId: string, event: PointerEvent) {
895
1290
  event.preventDefault();
896
1291
  event.stopPropagation();
897
1292
  const tr = (event.currentTarget as HTMLElement).closest("tr");
898
1293
  const startHeight = tr?.getBoundingClientRect().height ?? 0;
899
1294
  const startY = event.clientY;
900
- const onMove = (ev: MouseEvent) => {
901
- grid.setRowHeight(
902
- rowId,
903
- Math.max(16, startHeight + (ev.clientY - startY)),
904
- );
1295
+ const onMove = (ev: PointerEvent) => {
1296
+ grid.setRowHeight(rowId, Math.max(16, startHeight + (ev.clientY - startY)));
905
1297
  };
906
1298
  const onUp = () => {
907
- document.removeEventListener("mousemove", onMove);
908
- document.removeEventListener("mouseup", onUp);
1299
+ document.removeEventListener("pointermove", onMove);
1300
+ document.removeEventListener("pointerup", onUp);
1301
+ document.removeEventListener("pointercancel", onUp);
909
1302
  };
910
- document.addEventListener("mousemove", onMove);
911
- document.addEventListener("mouseup", onUp);
1303
+ document.addEventListener("pointermove", onMove);
1304
+ document.addEventListener("pointerup", onUp);
1305
+ document.addEventListener("pointercancel", onUp);
912
1306
  }
913
1307
 
914
1308
  // 키보드 리사이즈 (방향키 ±10px)
915
1309
  function onResizerKeydown(col: ColumnDef, event: KeyboardEvent) {
916
- const delta = event.key === "ArrowLeft" ? -10 : event.key === "ArrowRight" ? 10 : 0;
1310
+ const delta =
1311
+ event.key === "ArrowLeft" ? -10 : event.key === "ArrowRight" ? 10 : 0;
917
1312
  if (delta === 0) return;
918
1313
  event.preventDefault();
919
1314
  const th = (event.currentTarget as HTMLElement).closest("th");
@@ -967,7 +1362,10 @@ const rowCount = computed(() => state.value.rows.length);
967
1362
  const dropGap = computed(() => {
968
1363
  const rd = state.value.rowDrag;
969
1364
  if (!rd || rd.dropIndex == null) return null;
970
- if (rd.dropIndex === rd.draggingIndex || rd.dropIndex === rd.draggingIndex + 1)
1365
+ if (
1366
+ rd.dropIndex === rd.draggingIndex ||
1367
+ rd.dropIndex === rd.draggingIndex + 1
1368
+ )
971
1369
  return null;
972
1370
  return rd.dropIndex;
973
1371
  });
@@ -998,7 +1396,10 @@ function rowStateOf(row: RowT | null | undefined) {
998
1396
  /** 변경(I/U/D) 행의 셀 유효성 에러 — required/validate 검사. 없으면 null. */
999
1397
  function cellErrorOf(entry: AnyRow, col: ColumnDef): string | null {
1000
1398
  const row = rowDataOf(entry);
1001
- if (!row || !rowStateOf(row)) return null;
1399
+ if (!row) return null;
1400
+ // setCellError 수동 마킹은 행 상태·validate 유무와 무관하게 표시한다
1401
+ if (grid.hasManualCellError(row, col)) return grid.getCellError(row, col);
1402
+ if (!rowStateOf(row)) return null;
1002
1403
  if (!col.required && !col.validate) return null;
1003
1404
  return grid.getCellError(row, col);
1004
1405
  }
@@ -1187,7 +1588,13 @@ function onGridKeydown(event: KeyboardEvent) {
1187
1588
  return;
1188
1589
  }
1189
1590
  // 인쇄 가능한 문자 직접 입력 → 값을 교체하며 편집 진입
1190
- if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey && active) {
1591
+ if (
1592
+ event.key.length === 1 &&
1593
+ !event.ctrlKey &&
1594
+ !event.metaKey &&
1595
+ !event.altKey &&
1596
+ active
1597
+ ) {
1191
1598
  event.preventDefault();
1192
1599
  grid.startEditing(active.rowIndex, active.columnIndex, event.key);
1193
1600
  }
@@ -1236,10 +1643,12 @@ function entryIndexOf(entry: AnyRow, rowIdx: number) {
1236
1643
  return virtual.value ? virtual.value.startIndex + rowIdx : rowIdx;
1237
1644
  }
1238
1645
 
1239
- function rowKeyOf(entry: AnyRow) {
1240
- return isGroupRow(entry)
1241
- ? groupOf(entry).key
1242
- : grid.getRowId(rowDataOf(entry));
1646
+ function rowKeyOf(entry: AnyRow, rowIdx: number) {
1647
+ if (isGroupRow(entry)) return groupOf(entry).key;
1648
+ const row = rowDataOf(entry);
1649
+ // 서버 사이드 미로드(스파스) 행은 id가 없으므로 위치로 키잉 — getRowId(undefined) 크래시 방지
1650
+ if (row == null) return `skeleton-${rowIdx}`;
1651
+ return grid.getRowId(row);
1243
1652
  }
1244
1653
 
1245
1654
  function groupLabelOf(entry: AnyRow) {
@@ -1333,6 +1742,11 @@ function editorContext(rowIndex: number, colIndex: number) {
1333
1742
  return grid.getEditorContext(rowIndex, colIndex) as CellEditorContext;
1334
1743
  }
1335
1744
 
1745
+ // editorOptions — 배열 또는 행별 함수(종속 콤보) 해석
1746
+ function editorOptionsOf(col: ColumnDef, row: RowT) {
1747
+ return grid.getEditorOptions(col, row);
1748
+ }
1749
+
1336
1750
  function editorInputType(col: ColumnDef) {
1337
1751
  return col.cellEditor === "number"
1338
1752
  ? "number"
@@ -1368,10 +1782,22 @@ function onRadioPick(opt: string, col: ColumnDef) {
1368
1782
  if (state.value.editType !== "fullRow") grid.commitEditing();
1369
1783
  }
1370
1784
 
1785
+ // select 에디터 — 고르는 즉시 커밋 (fullRow에서는 보류 값만 반영)
1786
+ function onSelectPick(event: Event, col: ColumnDef) {
1787
+ grid.updateEditValue((event.target as HTMLSelectElement).value, col.field);
1788
+ if (state.value.editType !== "fullRow") grid.commitEditing();
1789
+ }
1790
+
1791
+ // date 에디터 — 날짜 선택(완성 입력) 즉시 커밋. text/number의 blur change는 무시
1792
+ function onDatePick(event: Event, col: ColumnDef) {
1793
+ if (col.cellEditor !== "date") return;
1794
+ onSelectPick(event, col);
1795
+ }
1796
+
1371
1797
  // 커밋 후 이동 시 편집기 언마운트로 빠진 포커스를 그리드로 되돌린다
1372
1798
  function commitThenNavigate(
1373
- dir: "up" | "down" | "left" | "right" | "tabLeft" | "tabRight",
1374
- ) {
1799
+ dir: "up" | "down" | "left" | "right" | "tabLeft" | "tabRight",
1800
+ ) {
1375
1801
  if (grid.commitEditing()) {
1376
1802
  grid.navigateCell(dir);
1377
1803
  scrollEl.value?.focus();
@@ -1443,9 +1869,11 @@ watch(
1443
1869
  ref="hostEl"
1444
1870
  :class="[
1445
1871
  showOverlay ? 'mg-colctl-host' : undefined,
1446
- theme && `grid-theme-${theme}`,
1872
+ ...themeClasses,
1447
1873
  state.striped && 'mg-striped',
1874
+ isLoading && 'mg-loading-host',
1448
1875
  ]"
1876
+ :style="themeStyle"
1449
1877
  >
1450
1878
  <!-- 피벗 필드 패널 — 칩을 존 사이로 드래그해 디멘션 구성 -->
1451
1879
  <div v-if="pivotPanel" class="mg-pivot-panel">
@@ -1453,8 +1881,11 @@ watch(
1453
1881
  v-for="zone in ['fields', 'rows', 'columns', 'values']"
1454
1882
  :key="zone"
1455
1883
  :class="['mg-pivot-zone', pivotDropZone === zone && 'mg-drop-over']"
1884
+ :data-mg-pivot-zone="zone"
1456
1885
  @dragover="onPivotZoneDragOver(zone, $event)"
1457
- @dragleave="pivotDropZone = pivotDropZone === zone ? null : pivotDropZone"
1886
+ @dragleave="
1887
+ pivotDropZone = pivotDropZone === zone ? null : pivotDropZone
1888
+ "
1458
1889
  @drop="onPivotZoneDrop(zone, $event)"
1459
1890
  >
1460
1891
  <span class="mg-pivot-zone-label">{{ pivotZoneLabel(zone) }}</span>
@@ -1463,9 +1894,13 @@ watch(
1463
1894
  :key="chip.field"
1464
1895
  :class="[
1465
1896
  'mg-pivot-chip',
1466
- zone === 'fields' && pivotPlaced.has(chip.field) && 'mg-pivot-chip-placed',
1897
+ zone === 'fields' &&
1898
+ pivotPlaced.has(chip.field) &&
1899
+ 'mg-pivot-chip-placed',
1467
1900
  ]"
1468
1901
  draggable="true"
1902
+ :data-mg-pivot-index="i"
1903
+ @pointerdown="onPivotChipPointerDown(chip.field, $event)"
1469
1904
  @dragstart="onPivotChipDragStart(chip.field, $event)"
1470
1905
  @dragover="onPivotChipDragOver($event)"
1471
1906
  @drop="onPivotZoneDrop(zone, $event, i)"
@@ -1474,7 +1909,7 @@ watch(
1474
1909
  <select
1475
1910
  v-if="zone === 'values'"
1476
1911
  class="mg-pivot-agg"
1477
- :value="chip.agg"
1912
+ :value="typeof chip.agg === 'string' ? chip.agg : 'sum'"
1478
1913
  @click.stop
1479
1914
  @change="onPivotAggChange(chip.field, $event)"
1480
1915
  >
@@ -1506,16 +1941,15 @@ watch(
1506
1941
  <label class="mg-colctl-item">
1507
1942
  <input
1508
1943
  type="checkbox"
1509
- :checked="!filterDropActive || filterDropActive.length >= filterDropAll.length"
1944
+ :checked="
1945
+ !filterDropActive ||
1946
+ filterDropActive.length >= filterDropAll.length
1947
+ "
1510
1948
  @change="grid.setFilter(filterDropCol.field, null)"
1511
1949
  />
1512
1950
  {{ state.locale.setFilterAll }}
1513
1951
  </label>
1514
- <label
1515
- v-for="v in filterDropAll"
1516
- :key="v"
1517
- class="mg-colctl-item"
1518
- >
1952
+ <label v-for="v in filterDropAll" :key="v" class="mg-colctl-item">
1519
1953
  <input
1520
1954
  type="checkbox"
1521
1955
  :checked="filterDropChecked(v)"
@@ -1532,7 +1966,7 @@ watch(
1532
1966
  ref="findInputEl"
1533
1967
  type="search"
1534
1968
  class="mg-find-input"
1535
- placeholder="셀 찾기…"
1969
+ :placeholder="state.locale.findPlaceholder"
1536
1970
  @keydown="onFindKeydown"
1537
1971
  @input="onFindInput"
1538
1972
  />
@@ -1553,10 +1987,24 @@ watch(
1553
1987
  {{ state.locale.findWholeCell }}
1554
1988
  </label>
1555
1989
  <button type="button" class="mg-find-btn" @click="goFind(true)">
1556
- ▲ 이전
1990
+ {{ state.locale.findPrev }}
1557
1991
  </button>
1558
1992
  <button type="button" class="mg-find-btn" @click="goFind(false)">
1559
- ▼ 다음
1993
+ {{ state.locale.findNext }}
1994
+ </button>
1995
+ <input
1996
+ ref="replaceInputEl"
1997
+ type="text"
1998
+ class="mg-replace-input"
1999
+ :placeholder="state.locale.replacePlaceholder"
2000
+ @keydown="onReplaceKeydown"
2001
+ />
2002
+ <button
2003
+ type="button"
2004
+ class="mg-find-btn mg-replace-all"
2005
+ @click="replaceAll"
2006
+ >
2007
+ {{ state.locale.replaceAllLabel }}
1560
2008
  </button>
1561
2009
  <span class="mg-find-count">{{ findCount }}</span>
1562
2010
  </div>
@@ -1640,270 +2088,179 @@ watch(
1640
2088
  </div>
1641
2089
  <div
1642
2090
  ref="scrollEl"
1643
- :class="{ 'mg-scroll': virtual || hasPinned || hasAppend }"
2091
+ :class="{
2092
+ 'mg-scroll': (virtual || hasPinned || hasAppend) && !autoHeight,
2093
+ }"
1644
2094
  :style="
1645
- (virtual || (hasAppend && height))
1646
- ? { height: `${height}px`, overflow: 'auto' }
1647
- : hasPinned || hasAppend
1648
- ? { overflowX: 'auto', overflowY: height ? undefined : 'auto' }
1649
- : undefined
2095
+ autoHeight
2096
+ ? undefined
2097
+ : virtual || (hasAppend && height)
2098
+ ? { height: `${height}px`, overflow: 'auto' }
2099
+ : hasPinned || hasAppend
2100
+ ? { overflowX: 'auto', overflowY: height ? undefined : 'auto' }
2101
+ : undefined
1650
2102
  "
1651
2103
  @scroll="onScroll"
1652
2104
  >
1653
- <table
1654
- class="mg-table"
1655
- role="grid"
1656
- tabindex="0"
1657
- :style="{ minWidth: `${tableMinWidth}px` }"
1658
- @keydown="onGridKeydown"
1659
- >
1660
- <colgroup>
1661
- <col v-if="rowStatus" class="mg-col-status" />
1662
- <col v-if="rowCheckboxes" class="mg-col-check" />
1663
- <col v-if="rowNumbers" class="mg-col-rownum" />
1664
- <col
1665
- v-for="col in state.visibleColumns"
1666
- :key="col.field"
1667
- :style="{ width: `${col.width ?? DEFAULT_COLUMN_WIDTH}px` }"
1668
- />
1669
- </colgroup>
1670
- <thead role="rowgroup">
1671
- <tr
1672
- v-for="(row, rowIdx) in headerRows"
1673
- :key="rowIdx"
1674
- :style="headerTrStyle"
1675
- >
1676
- <th
1677
- v-if="rowStatus && rowIdx === 0"
1678
- :rowspan="headerRowSpan"
1679
- class="mg-status-cell"
1680
- title="행 상태 — I: 입력, U: 수정, D: 삭제"
1681
- >
1682
- 상태
1683
- </th>
1684
- <th
1685
- v-if="rowCheckboxes && rowIdx === 0"
1686
- :rowspan="headerRowSpan"
1687
- class="mg-check-cell"
2105
+ <table
2106
+ class="mg-table"
2107
+ role="grid"
2108
+ tabindex="0"
2109
+ :style="{ minWidth: `${tableMinWidth}px` }"
2110
+ @keydown="onGridKeydown"
2111
+ >
2112
+ <colgroup>
2113
+ <col v-if="rowStatus" class="mg-col-status" />
2114
+ <col v-if="rowCheckboxes" class="mg-col-check" />
2115
+ <col v-if="rowNumbers" class="mg-col-rownum" />
2116
+ <col
2117
+ v-for="col in state.visibleColumns"
2118
+ :key="col.field"
2119
+ :style="{ width: `${col.width ?? DEFAULT_COLUMN_WIDTH}px` }"
2120
+ />
2121
+ </colgroup>
2122
+ <thead role="rowgroup">
2123
+ <tr
2124
+ v-for="(row, rowIdx) in headerRows"
2125
+ :key="rowIdx"
2126
+ :style="headerTrStyle"
1688
2127
  >
1689
- <input
1690
- type="checkbox"
1691
- :aria-label="state.locale.selectAllRowsAria"
1692
- :checked="grid.isAllSelected()"
1693
- :indeterminate.prop="grid.isSomeSelected()"
1694
- @click.stop
1695
- @change="grid.toggleAllRows()"
1696
- />
1697
- </th>
1698
- <th
1699
- v-if="rowNumbers && rowIdx === 0"
1700
- :rowspan="headerRowSpan"
1701
- class="mg-rownum-cell"
1702
- ></th>
1703
- <template v-for="cell in row">
1704
2128
  <th
1705
- v-if="cell.kind === 'group'"
1706
- :key="cell.key"
1707
- :colspan="cell.colSpan"
1708
- class="mg-colgroup"
2129
+ v-if="rowStatus && rowIdx === 0"
2130
+ :rowspan="headerRowSpan"
2131
+ class="mg-status-cell"
2132
+ title="행 상태 — I: 입력, U: 수정, D: 삭제"
1709
2133
  >
1710
- {{ cell.header }}
2134
+ 상태
1711
2135
  </th>
1712
2136
  <th
1713
- v-else
1714
- :key="cell.key"
1715
- :rowspan="cell.rowSpan"
1716
- :style="
1717
- cell.col.pinned
1718
- ? pinStyleOf(cell.col)
1719
- : cell.col.width
1720
- ? { width: `${cell.col.width}px` }
1721
- : undefined
1722
- "
1723
- :class="[
1724
- {
1725
- 'mg-sortable': cell.col.sortable !== false,
1726
- 'mg-col-dragover': dragOverField === cell.col.field,
1727
- 'mg-pinned': !!cell.col.pinned,
1728
- 'mg-pin-left-edge': cell.colIndex === lastLeftPinIdx,
1729
- 'mg-pin-right-edge': cell.colIndex === firstRightPinIdx,
1730
- },
1731
- (cell.col.headerAlign ?? cell.col.align) &&
1732
- (cell.col.headerAlign ?? cell.col.align) !== 'left'
1733
- ? `mg-halign-${cell.col.headerAlign ?? cell.col.align}`
1734
- : '',
1735
- grid.getHeaderClass(cell.col),
1736
- ]"
1737
- :title="cell.col.headerTooltip"
1738
- :aria-sort="sortAria(cell.col.field)"
1739
- :draggable="reorderable && cell.col.movable !== false"
1740
- @dragstart="onDragStart(cell.col, $event)"
1741
- @dragover="onDragOver(cell.col, $event)"
1742
- @drop="onDrop(cell.col, $event)"
1743
- @dragend="onDragEnd"
1744
- @click="grid.toggleSort(cell.col.field, $event.shiftKey)"
1745
- @contextmenu="onHeaderContextMenu($event, cell.col)"
2137
+ v-if="rowCheckboxes && rowIdx === 0"
2138
+ :rowspan="headerRowSpan"
2139
+ class="mg-check-cell"
1746
2140
  >
1747
2141
  <input
1748
- v-if="cell.col.cellEditor === 'checkbox' && cell.col.headerCheckbox"
1749
2142
  type="checkbox"
1750
- class="mg-header-checkbox"
1751
- :aria-label="`${cell.col.header || cell.col.field} 전체 체크`"
1752
- :checked="grid.checkboxColumnState(cell.col) === 'all'"
1753
- :indeterminate.prop="grid.checkboxColumnState(cell.col) === 'some'"
2143
+ :aria-label="state.locale.selectAllRowsAria"
2144
+ :checked="grid.isAllSelected()"
2145
+ :indeterminate.prop="grid.isSomeSelected()"
1754
2146
  @click.stop
1755
- @change="grid.toggleAllChecked(cell.col)"
2147
+ @change="grid.toggleAllRows()"
1756
2148
  />
1757
- {{ cell.col.header || cell.col.field }}
1758
- <span v-if="cell.col.required" class="mg-required-mark">*</span>
1759
- <span v-if="sortArrowOf(cell.col.field)" class="mg-sort-arrow">
1760
- {{ sortArrowOf(cell.col.field) }}
1761
- </span>
1762
- <span v-if="sortPriorityOf(cell.col.field)" class="mg-sort-priority">
1763
- {{ sortPriorityOf(cell.col.field) }}
1764
- </span>
1765
- <button
1766
- v-if="headerFilters && cell.col.filterable"
1767
- type="button"
2149
+ </th>
2150
+ <th
2151
+ v-if="rowNumbers && rowIdx === 0"
2152
+ :rowspan="headerRowSpan"
2153
+ class="mg-rownum-cell"
2154
+ ></th>
2155
+ <template v-for="cell in row">
2156
+ <th
2157
+ v-if="cell.kind === 'group'"
2158
+ :key="cell.key"
2159
+ :colspan="cell.colSpan"
2160
+ class="mg-colgroup"
2161
+ >
2162
+ {{ cell.header }}
2163
+ </th>
2164
+ <th
2165
+ v-else
2166
+ :key="cell.key"
2167
+ :rowspan="cell.rowSpan"
2168
+ :style="
2169
+ cell.col.pinned
2170
+ ? pinStyleOf(cell.col)
2171
+ : cell.col.width
2172
+ ? { width: `${cell.col.width}px` }
2173
+ : undefined
2174
+ "
1768
2175
  :class="[
1769
- 'mg-header-filter-btn',
1770
- state.filters[cell.col.field] && 'mg-active',
2176
+ {
2177
+ 'mg-sortable': cell.col.sortable !== false,
2178
+ 'mg-col-dragover': dragOverField === cell.col.field,
2179
+ 'mg-col-dragging': touchColField === cell.col.field,
2180
+ 'mg-pinned': !!cell.col.pinned,
2181
+ 'mg-pin-left-edge': cell.colIndex === lastLeftPinIdx,
2182
+ 'mg-pin-right-edge': cell.colIndex === firstRightPinIdx,
2183
+ },
2184
+ (cell.col.headerAlign ?? cell.col.align) &&
2185
+ (cell.col.headerAlign ?? cell.col.align) !== 'left'
2186
+ ? `mg-halign-${cell.col.headerAlign ?? cell.col.align}`
2187
+ : '',
2188
+ grid.getHeaderClass(cell.col),
1771
2189
  ]"
1772
- :aria-label="`${cell.col.header || cell.col.field} 필터`"
1773
- @click="toggleFilterDrop(cell.col, $event)"
2190
+ :title="cell.col.headerTooltip"
2191
+ :aria-sort="sortAria(cell.col.field)"
2192
+ :draggable="reorderable && cell.col.movable !== false"
2193
+ @dragstart="onDragStart(cell.col, $event)"
2194
+ @dragover="onDragOver(cell.col, $event)"
2195
+ @drop="onDrop(cell.col, $event)"
2196
+ @dragend="onDragEnd"
2197
+ @click="grid.toggleSort(cell.col.field, $event.shiftKey)"
2198
+ @contextmenu="onHeaderContextMenu($event, cell.col)"
2199
+ :data-mg-field="cell.col.field"
2200
+ @pointerdown="onHeaderPointerDown($event, cell.col)"
1774
2201
  >
1775
- ▾
1776
- </button>
1777
- <button
1778
- v-if="resizable && cell.col.resizable !== false"
1779
- type="button"
1780
- class="mg-resizer"
1781
- :aria-label="`${cell.col.field} 너비 조절`"
1782
- @mousedown.stop.prevent="onResizeStart(cell.col, $event)"
1783
- @dblclick.stop="grid.autoSizeColumn(cell.col.field)"
1784
- @keydown.stop="onResizerKeydown(cell.col, $event)"
1785
- @click.stop
1786
- />
1787
- </th>
1788
- </template>
1789
- </tr>
1790
- <tr v-if="hasFilterRow" class="mg-filter-row">
1791
- <th v-if="rowStatus" class="mg-status-cell" />
1792
- <th v-if="rowCheckboxes" class="mg-check-cell" />
1793
- <th v-if="rowNumbers" class="mg-rownum-cell" />
1794
- <th
1795
- v-for="(col, colIndex) in state.visibleColumns"
1796
- :key="col.field"
1797
- :class="{
1798
- 'mg-pinned': !!col.pinned,
1799
- 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
1800
- 'mg-pin-right-edge': colIndex === firstRightPinIdx,
1801
- }"
1802
- :style="pinStyleOf(col)"
1803
- >
1804
- <div v-if="col.filterable" class="mg-filter-cell">
1805
- <details v-if="isSetFilter(col)" class="mg-setfilter">
1806
- <summary>{{ setFilterLabel(col) }}</summary>
1807
- <div class="mg-setfilter-panel">
1808
- <label class="mg-setfilter-item">
1809
- <input
1810
- type="checkbox"
1811
- :checked="setAllCheckedOf(col)"
1812
- @change="grid.setFilter(col.field, null)"
1813
- />
1814
- {{ state.locale.setFilterAll }}
1815
- </label>
1816
- <label
1817
- v-for="v in setValuesOf(col)"
1818
- :key="v"
1819
- class="mg-setfilter-item"
1820
- >
1821
- <input
1822
- type="checkbox"
1823
- :checked="setCheckedOf(col, v)"
1824
- @change="onSetToggle(col, v, $event)"
1825
- />
1826
- {{ v }}
1827
- </label>
1828
- </div>
1829
- </details>
1830
- <template v-else>
1831
- <select
1832
- class="mg-filter-op"
1833
- :value="filterOpOf(col)"
1834
- @change="onFilterOpChange(col, $event)"
1835
- >
1836
- <option v-for="op in filterOpsOf(col)" :key="op" :value="op">
1837
- {{ FILTER_OPERATOR_LABELS[op] }}
1838
- </option>
1839
- </select>
1840
2202
  <input
1841
- class="mg-filter-input"
1842
- :type="filterInputType(col)"
1843
- :value="filterValueOf(col, 'value')"
1844
- :placeholder="`${col.header || col.field} 필터`"
1845
- @input="onFilterInput(col, 'value', $event)"
2203
+ v-if="
2204
+ cell.col.cellEditor === 'checkbox' &&
2205
+ cell.col.headerCheckbox
2206
+ "
2207
+ type="checkbox"
2208
+ class="mg-header-checkbox"
2209
+ :aria-label="`${cell.col.header || cell.col.field} 전체 체크`"
2210
+ :checked="grid.checkboxColumnState(cell.col) === 'all'"
2211
+ :indeterminate.prop="
2212
+ grid.checkboxColumnState(cell.col) === 'some'
2213
+ "
2214
+ :disabled="!grid.isCheckboxColumnEditable(cell.col)"
2215
+ @click.stop
2216
+ @change="grid.toggleAllChecked(cell.col)"
1846
2217
  />
1847
- <input
1848
- v-if="filterOpOf(col) === 'inRange'"
1849
- class="mg-filter-input mg-filter-to"
1850
- :type="filterInputType(col)"
1851
- :value="filterValueOf(col, 'valueTo')"
1852
- :placeholder="state.locale.rangeEndPlaceholder"
1853
- @input="onFilterInput(col, 'valueTo', $event)"
2218
+ <!-- 커스텀 헤더 슬롯: #header-{field}="{ column }" -->
2219
+ <slot :name="`header-${cell.col.field}`" :column="cell.col">{{
2220
+ cell.col.header || cell.col.field
2221
+ }}</slot>
2222
+ <span v-if="cell.col.required" class="mg-required-mark">*</span>
2223
+ <span v-if="sortArrowOf(cell.col.field)" class="mg-sort-arrow">
2224
+ {{ sortArrowOf(cell.col.field) }}
2225
+ </span>
2226
+ <span
2227
+ v-if="sortPriorityOf(cell.col.field)"
2228
+ class="mg-sort-priority"
2229
+ >
2230
+ {{ sortPriorityOf(cell.col.field) }}
2231
+ </span>
2232
+ <button
2233
+ v-if="headerFilters && cell.col.filterable"
2234
+ type="button"
2235
+ :class="[
2236
+ 'mg-header-filter-btn',
2237
+ state.filters[cell.col.field] && 'mg-active',
2238
+ ]"
2239
+ :aria-label="`${cell.col.header || cell.col.field} 필터`"
2240
+ @click="toggleFilterDrop(cell.col, $event)"
2241
+ >
2242
+ ▾
2243
+ </button>
2244
+ <button
2245
+ v-if="resizable && cell.col.resizable !== false"
2246
+ type="button"
2247
+ class="mg-resizer"
2248
+ :aria-label="`${cell.col.field} 너비 조절`"
2249
+ @pointerdown.stop.prevent="onResizeStart(cell.col, $event)"
2250
+ @dblclick.stop="grid.autoSizeColumn(cell.col.field)"
2251
+ @keydown.stop="onResizerKeydown(cell.col, $event)"
2252
+ @click.stop
1854
2253
  />
1855
- </template>
1856
- </div>
1857
- </th>
1858
- </tr>
1859
- </thead>
1860
- <tbody role="rowgroup">
1861
- <tr
1862
- v-for="(prow, pIdx) in state.pinnedTopRows"
1863
- :key="`pin-top-${pIdx}`"
1864
- class="mg-pinned-top-row"
1865
- >
1866
- <td v-if="rowStatus" class="mg-status-cell" />
1867
- <td v-if="rowCheckboxes" class="mg-check-cell" />
1868
- <td v-if="rowNumbers" class="mg-rownum-cell" />
1869
- <td
1870
- v-for="(col, colIndex) in state.visibleColumns"
1871
- :key="col.field"
1872
- :class="{
1873
- 'mg-pinned': !!col.pinned,
1874
- 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
1875
- 'mg-pin-right-edge': colIndex === firstRightPinIdx,
1876
- }"
1877
- :style="pinStyleOf(col)"
1878
- >
1879
- {{ grid.getCellText(prow, col) }}
1880
- </td>
1881
- </tr>
1882
- <tr
1883
- v-if="virtual && virtual.startOffset > 0"
1884
- class="mg-spacer"
1885
- aria-hidden="true"
1886
- >
1887
- <td :colspan="colSpan" :style="{ height: `${virtual.startOffset}px`, padding: 0 }" />
1888
- </tr>
1889
- <tr v-if="bodyRows.length === 0">
1890
- <td class="mg-empty" :colspan="colSpan">{{ state.locale.noRows }}</td>
1891
- </tr>
1892
- <template v-for="(entry, rowIdx) in bodyRows">
1893
- <!-- 그룹 헤더 행 -->
1894
- <tr
1895
- v-if="isGroupRow(entry)"
1896
- :key="rowKeyOf(entry)"
1897
- class="mg-group-row"
1898
- @click="onToggleGroup(entry)"
1899
- >
1900
- <td v-if="rowStatus" class="mg-status-cell" />
1901
- <td v-if="rowCheckboxes" class="mg-check-cell" />
1902
- <td v-if="rowNumbers" class="mg-rownum-cell" />
1903
- <td
2254
+ </th>
2255
+ </template>
2256
+ </tr>
2257
+ <tr v-if="hasFilterRow" class="mg-filter-row">
2258
+ <th v-if="rowStatus" class="mg-status-cell" />
2259
+ <th v-if="rowCheckboxes" class="mg-check-cell" />
2260
+ <th v-if="rowNumbers" class="mg-rownum-cell" />
2261
+ <th
1904
2262
  v-for="(col, colIndex) in state.visibleColumns"
1905
2263
  :key="col.field"
1906
- class="mg-group-cell"
1907
2264
  :class="{
1908
2265
  'mg-pinned': !!col.pinned,
1909
2266
  'mg-pin-left-edge': colIndex === lastLeftPinIdx,
@@ -1911,35 +2268,78 @@ watch(
1911
2268
  }"
1912
2269
  :style="pinStyleOf(col)"
1913
2270
  >
1914
- <span
1915
- v-if="colIndex === 0"
1916
- class="mg-group-label"
1917
- :style="{ paddingLeft: `${groupOf(entry).depth * 16}px` }"
1918
- >
1919
- <span class="mg-group-toggle">
1920
- {{ groupOf(entry).expanded ? "▾" : "▸" }}
1921
- </span>
1922
- <strong>{{ groupLabelOf(entry) }}</strong>
1923
- <span class="mg-group-count">({{ groupOf(entry).rowCount }})</span>
1924
- </span>
1925
- <span v-else-if="groupAggOf(entry, col)" class="mg-agg">
1926
- {{ groupAggOf(entry, col) }}
1927
- </span>
1928
- </td>
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"
2307
+ >
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>
1929
2329
  </tr>
1930
- <!-- 그룹 소계 행 -->
2330
+ </thead>
2331
+ <tbody role="rowgroup">
1931
2332
  <tr
1932
- v-else-if="isSubtotalRow(entry)"
1933
- :key="rowKeyOf(entry)"
1934
- class="mg-subtotal-row"
2333
+ v-for="(prow, pIdx) in state.pinnedTopRows"
2334
+ :key="`pin-top-${pIdx}`"
2335
+ class="mg-pinned-top-row"
1935
2336
  >
1936
2337
  <td v-if="rowStatus" class="mg-status-cell" />
1937
2338
  <td v-if="rowCheckboxes" class="mg-check-cell" />
1938
- <td v-if="rowNumbers" class="mg-rownum-cell" />
2339
+ <td v-if="rowNumbers" class="mg-rownum-cell" />
1939
2340
  <td
1940
2341
  v-for="(col, colIndex) in state.visibleColumns"
1941
2342
  :key="col.field"
1942
- class="mg-subtotal-cell"
1943
2343
  :class="{
1944
2344
  'mg-pinned': !!col.pinned,
1945
2345
  'mg-pin-left-edge': colIndex === lastLeftPinIdx,
@@ -1947,434 +2347,657 @@ watch(
1947
2347
  }"
1948
2348
  :style="pinStyleOf(col)"
1949
2349
  >
1950
- <span
1951
- v-if="colIndex === 0"
1952
- class="mg-subtotal-label"
1953
- :style="{ paddingLeft: `${groupOf(entry).depth * 16}px` }"
1954
- >
1955
- {{ state.locale.subtotalLabel }}: {{ groupLabelOf(entry) }}
1956
- </span>
1957
- <span v-else-if="groupAggOf(entry, col)" class="mg-agg">
1958
- {{ groupAggOf(entry, col) }}
1959
- </span>
2350
+ {{ grid.getCellText(prow, col) }}
1960
2351
  </td>
1961
2352
  </tr>
1962
- <!-- 서버 사이드 미로드 행 → 스켈레톤 -->
1963
2353
  <tr
1964
- v-else-if="rowDataOf(entry) == null"
1965
- :key="rowKeyOf(entry)"
1966
- class="mg-skeleton-row"
2354
+ v-if="virtual && virtual.startOffset > 0"
2355
+ class="mg-spacer"
1967
2356
  aria-hidden="true"
1968
2357
  >
1969
- <td v-if="rowStatus" class="mg-status-cell" />
1970
- <td v-if="rowCheckboxes" class="mg-check-cell" />
1971
- <td v-if="rowNumbers" class="mg-rownum-cell" />
1972
2358
  <td
1973
- v-for="(col, colIndex) in state.visibleColumns"
1974
- :key="col.field"
1975
- :class="{
1976
- 'mg-pinned': !!col.pinned,
1977
- 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
1978
- 'mg-pin-right-edge': colIndex === firstRightPinIdx,
1979
- }"
1980
- :style="pinStyleOf(col)"
1981
- >
1982
- <span class="mg-skeleton-bar" />
2359
+ :colspan="colSpan"
2360
+ :style="{ height: `${virtual.startOffset}px`, padding: 0 }"
2361
+ />
2362
+ </tr>
2363
+ <tr v-if="bodyRows.length === 0">
2364
+ <td class="mg-empty" :colspan="colSpan">
2365
+ {{ state.locale.noRows }}
1983
2366
  </td>
1984
2367
  </tr>
1985
- <!-- 리프(데이터) 행 -->
1986
- <tr
1987
- v-else
1988
- :key="rowKeyOf(entry)"
1989
- role="row"
1990
- :aria-selected="state.selectedRowIds.has(grid.getRowId(rowDataOf(entry)))"
1991
- :class="rowClassOf(entry, rowIdx)"
1992
- :style="rowStyleOf(entry, rowIdx)"
1993
- @click="selectable && grid.toggleRowSelection(grid.getRowId(rowDataOf(entry)))"
1994
- @dragover="onRowDragOver(entryIndexOf(entry, rowIdx), $event)"
1995
- @drop="onRowDrop($event)"
1996
- >
1997
- <td
1998
- v-if="rowStatus"
1999
- class="mg-status-cell"
2000
- :class="
2001
- rowStateOf(rowDataOf(entry))
2002
- ? `mg-status-${rowStateOf(rowDataOf(entry))}`
2003
- : undefined
2004
- "
2368
+ <template v-for="(entry, rowIdx) in bodyRows">
2369
+ <!-- 그룹 헤더 행 -->
2370
+ <tr
2371
+ v-if="isGroupRow(entry)"
2372
+ :key="rowKeyOf(entry, rowIdx)"
2373
+ class="mg-group-row"
2374
+ @click="onToggleGroup(entry)"
2005
2375
  >
2006
- {{ rowStateOf(rowDataOf(entry)) ?? "" }}
2007
- </td>
2008
- <td
2009
- v-if="rowCheckboxes"
2010
- class="mg-check-cell"
2011
- @click.stop
2376
+ <td v-if="rowStatus" class="mg-status-cell" />
2377
+ <td v-if="rowCheckboxes" class="mg-check-cell" />
2378
+ <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)"
2389
+ >
2390
+ <span
2391
+ v-if="colIndex === 0"
2392
+ class="mg-group-label"
2393
+ :style="{ paddingLeft: `${groupOf(entry).depth * 16}px` }"
2394
+ >
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
2401
+ >
2402
+ </span>
2403
+ <span v-else-if="groupAggOf(entry, col)" class="mg-agg">
2404
+ {{ groupAggOf(entry, col) }}
2405
+ </span>
2406
+ </td>
2407
+ </tr>
2408
+ <!-- 그룹 소계 행 -->
2409
+ <tr
2410
+ v-else-if="isSubtotalRow(entry)"
2411
+ :key="rowKeyOf(entry, rowIdx)"
2412
+ class="mg-subtotal-row"
2012
2413
  >
2013
- <input
2014
- type="checkbox"
2015
- aria-label="행 선택"
2016
- :checked="isSelected(rowDataOf(entry))"
2017
- :disabled="!grid.isRowSelectable(rowDataOf(entry))"
2018
- @change="
2019
- grid.toggleRowSelection(grid.getRowId(rowDataOf(entry)))
2020
- "
2021
- />
2022
- </td>
2023
- <td v-if="rowNumbers" class="mg-rownum-cell">
2024
- {{ entryIndexOf(entry, rowIdx) + 1 }}
2025
- <span
2026
- v-if="rowResizable && !virtual"
2027
- class="mg-row-resizer"
2028
- title="행 높이 조정"
2029
- @mousedown="onRowResizeStart(grid.getRowId(rowDataOf(entry)), $event)"
2030
- />
2031
- </td>
2032
- <template
2033
- v-for="(col, colIndex) in state.visibleColumns"
2414
+ <td v-if="rowStatus" class="mg-status-cell" />
2415
+ <td v-if="rowCheckboxes" class="mg-check-cell" />
2416
+ <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)"
2427
+ >
2428
+ <span
2429
+ v-if="colIndex === 0"
2430
+ class="mg-subtotal-label"
2431
+ :style="{ paddingLeft: `${groupOf(entry).depth * 16}px` }"
2432
+ >
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>
2439
+ </tr>
2440
+ <!-- 서버 사이드 미로드 행 → 스켈레톤 -->
2441
+ <tr
2442
+ v-else-if="rowDataOf(entry) == null"
2443
+ :key="rowKeyOf(entry, rowIdx)"
2444
+ class="mg-skeleton-row"
2445
+ aria-hidden="true"
2034
2446
  >
2035
- <td
2036
- v-if="!cellSpanOf(rowDataOf(entry), col).hidden"
2037
- :key="col.field"
2038
- :rowspan="cellSpanOf(rowDataOf(entry), col).rowSpan"
2039
- :colspan="cellSpanOf(rowDataOf(entry), col).colSpan"
2040
- :class="[
2041
- col.align && col.align !== 'left' ? `mg-align-${col.align}` : '',
2042
- {
2043
- 'mg-cell-readonly': !grid.isCellEditable(entryIndexOf(entry, rowIdx), colIndex),
2044
- 'mg-cell-active': grid.isActiveCell(entryIndexOf(entry, rowIdx), colIndex),
2045
- 'mg-cell-selected': grid.isCellInRange(entryIndexOf(entry, rowIdx), colIndex),
2046
- 'mg-cell-editing': isEditingCell(entryIndexOf(entry, rowIdx), colIndex),
2047
- 'mg-cell-invalid': !!cellErrorOf(entry, col),
2048
- 'mg-find-match': isFindMatch(entry, col),
2049
- 'mg-cell-flash': state.flashedCells?.has(grid.getRowId(rowDataOf(entry)) + '|' + String(col.field)),
2050
- 'mg-multiline': !!col.multiLine,
2447
+ <td v-if="rowStatus" class="mg-status-cell" />
2448
+ <td v-if="rowCheckboxes" class="mg-check-cell" />
2449
+ <td v-if="rowNumbers" class="mg-rownum-cell" />
2450
+ <td
2451
+ v-for="(col, colIndex) in state.visibleColumns"
2452
+ :key="col.field"
2453
+ :class="{
2051
2454
  'mg-pinned': !!col.pinned,
2052
2455
  'mg-pin-left-edge': colIndex === lastLeftPinIdx,
2053
2456
  'mg-pin-right-edge': colIndex === firstRightPinIdx,
2054
- },
2055
- cellClassOf(entry, rowIdx, col),
2056
- cellNoteOf(entry, col) && 'mg-cell-note',
2057
- ]"
2058
- role="gridcell"
2059
- :title="
2060
- cellErrorOf(entry, col) ||
2061
- grid.getCellTooltip(rowDataOf(entry), col) ||
2062
- cellNoteOf(entry, col) ||
2063
- undefined
2064
- "
2065
- :style="[
2066
- pinStyleOf(col),
2067
- colIndex === 0 && leafDepthOf(entry)
2068
- ? { paddingLeft: `${leafDepthOf(entry) * 16 + 12}px` }
2069
- : undefined,
2070
- grid.getCellStyle(
2071
- rowDataOf(entry),
2072
- entryIndexOf(entry, rowIdx),
2073
- col,
2074
- ) ?? undefined,
2075
- ]"
2076
- :data-mg-row="entryIndexOf(entry, rowIdx)"
2077
- :data-mg-col="colIndex"
2078
- @mousedown="
2079
- onCellMouseDown(
2080
- $event,
2081
- entryIndexOf(entry, rowIdx),
2082
- colIndex,
2083
- col,
2084
- )
2085
- "
2086
- @mouseenter="
2087
- onCellMouseEnter(entryIndexOf(entry, rowIdx), colIndex)
2457
+ }"
2458
+ :style="pinStyleOf(col)"
2459
+ >
2460
+ <span class="mg-skeleton-bar" />
2461
+ </td>
2462
+ </tr>
2463
+ <!-- 리프(데이터) 행 -->
2464
+ <tr
2465
+ v-else
2466
+ :key="rowKeyOf(entry, rowIdx)"
2467
+ role="row"
2468
+ :aria-selected="
2469
+ state.selectedRowIds.has(grid.getRowId(rowDataOf(entry)))
2088
2470
  "
2471
+ :class="rowClassOf(entry, rowIdx)"
2472
+ :style="rowStyleOf(entry, rowIdx)"
2089
2473
  @click="
2090
- onCellClick(entryIndexOf(entry, rowIdx), colIndex)
2091
- "
2092
- @dblclick="
2093
- grid.notifyCellEvent('cellDblClick', entryIndexOf(entry, rowIdx), colIndex);
2094
- grid.startEditing(entryIndexOf(entry, rowIdx), colIndex);
2474
+ selectable &&
2475
+ grid.toggleRowSelection(grid.getRowId(rowDataOf(entry)))
2095
2476
  "
2096
- @contextmenu="onCellContextMenu($event, entryIndexOf(entry, rowIdx), col)"
2477
+ @dragover="onRowDragOver(entryIndexOf(entry, rowIdx), $event)"
2478
+ @drop="onRowDrop($event)"
2097
2479
  >
2098
- <button
2099
- v-if="colIndex === 0 && leafHasChildren(entry) !== undefined"
2100
- type="button"
2101
- class="mg-tree-toggle"
2102
- :class="{ 'mg-tree-leaf': !leafHasChildren(entry) }"
2103
- :aria-label="leafExpanded(entry) ? '접기' : '펼치기'"
2104
- :disabled="!leafHasChildren(entry)"
2105
- @click.stop="grid.toggleTreeExpanded(grid.getRowId(rowDataOf(entry)))"
2106
- >
2107
- {{ leafHasChildren(entry) ? (leafExpanded(entry) ? "▾" : "▸") : "" }}
2108
- </button>
2109
- <span
2110
- v-if="grid.isActiveCell(entryIndexOf(entry, rowIdx), colIndex) && !isEditingCell(entryIndexOf(entry, rowIdx), colIndex)"
2111
- class="mg-fill-handle"
2112
- @mousedown="onFillMouseDown"
2113
- ></span>
2114
- <span
2115
- v-if="col.rowDrag && !isEditingCell(entryIndexOf(entry, rowIdx), colIndex)"
2116
- class="mg-row-drag-handle"
2117
- :class="{ 'mg-disabled': !rowDraggable }"
2118
- :draggable="rowDraggable"
2119
- title="행 이동"
2120
- @dragstart="onRowDragStart(entryIndexOf(entry, rowIdx), $event)"
2121
- @dragend="onRowDragEnd"
2122
- >⠿</span
2480
+ <td
2481
+ v-if="rowStatus"
2482
+ class="mg-status-cell"
2483
+ :class="
2484
+ rowStateOf(rowDataOf(entry))
2485
+ ? `mg-status-${rowStateOf(rowDataOf(entry))}`
2486
+ : undefined
2487
+ "
2123
2488
  >
2124
- <template v-if="isEditingCell(entryIndexOf(entry, rowIdx), colIndex)">
2125
- <!-- 커스텀 에디터 슬롯: #editor-{field}="ctx" -->
2126
- <slot
2127
- :name="`editor-${col.field}`"
2128
- v-bind="editorContext(entryIndexOf(entry, rowIdx), colIndex)"
2489
+ {{ rowStateOf(rowDataOf(entry)) ?? "" }}
2490
+ </td>
2491
+ <td v-if="rowCheckboxes" class="mg-check-cell" @click.stop>
2492
+ <input
2493
+ type="checkbox"
2494
+ aria-label="행 선택"
2495
+ :checked="isSelected(rowDataOf(entry))"
2496
+ :indeterminate.prop="
2497
+ grid.isRowSelectionIndeterminate(
2498
+ grid.getRowId(rowDataOf(entry)),
2499
+ )
2500
+ "
2501
+ :disabled="!grid.isRowSelectable(rowDataOf(entry))"
2502
+ @change="
2503
+ grid.toggleRowSelection(grid.getRowId(rowDataOf(entry)))
2504
+ "
2505
+ />
2506
+ </td>
2507
+ <td v-if="rowNumbers" class="mg-rownum-cell">
2508
+ {{ entryIndexOf(entry, rowIdx) + 1 }}
2509
+ <span
2510
+ v-if="rowResizable && !virtual"
2511
+ class="mg-row-resizer"
2512
+ title="행 높이 조정"
2513
+ @pointerdown="
2514
+ onRowResizeStart(grid.getRowId(rowDataOf(entry)), $event)
2515
+ "
2516
+ />
2517
+ </td>
2518
+ <template v-for="(col, colIndex) in state.visibleColumns">
2519
+ <td
2520
+ v-if="!cellSpanOf(rowDataOf(entry), col).hidden"
2521
+ :key="col.field"
2522
+ :rowspan="cellSpanOf(rowDataOf(entry), col).rowSpan"
2523
+ :colspan="cellSpanOf(rowDataOf(entry), col).colSpan"
2524
+ :class="[
2525
+ col.align && col.align !== 'left'
2526
+ ? `mg-align-${col.align}`
2527
+ : '',
2528
+ {
2529
+ 'mg-cell-readonly': !grid.isCellEditable(
2530
+ entryIndexOf(entry, rowIdx),
2531
+ colIndex,
2532
+ ),
2533
+ 'mg-cell-active': grid.isActiveCell(
2534
+ entryIndexOf(entry, rowIdx),
2535
+ colIndex,
2536
+ ),
2537
+ 'mg-cell-selected': grid.isCellInRange(
2538
+ entryIndexOf(entry, rowIdx),
2539
+ colIndex,
2540
+ ),
2541
+ 'mg-cell-editing': isEditingCell(
2542
+ entryIndexOf(entry, rowIdx),
2543
+ colIndex,
2544
+ ),
2545
+ 'mg-cell-invalid': !!cellErrorOf(entry, col),
2546
+ 'mg-find-match': isFindMatch(entry, col),
2547
+ 'mg-cell-flash': state.flashedCells?.has(
2548
+ grid.getRowId(rowDataOf(entry)) +
2549
+ '|' +
2550
+ String(col.field),
2551
+ ),
2552
+ 'mg-multiline': !!col.multiLine,
2553
+ 'mg-pinned': !!col.pinned,
2554
+ 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
2555
+ 'mg-pin-right-edge': colIndex === firstRightPinIdx,
2556
+ },
2557
+ cellClassOf(entry, rowIdx, col),
2558
+ cellNoteOf(entry, col) && 'mg-cell-note',
2559
+ ]"
2560
+ role="gridcell"
2561
+ :title="
2562
+ cellErrorOf(entry, col) ||
2563
+ grid.getCellTooltip(rowDataOf(entry), col) ||
2564
+ cellNoteOf(entry, col) ||
2565
+ undefined
2566
+ "
2567
+ :style="[
2568
+ pinStyleOf(col),
2569
+ colIndex === 0 && leafDepthOf(entry)
2570
+ ? { paddingLeft: `${leafDepthOf(entry) * 16 + 12}px` }
2571
+ : undefined,
2572
+ grid.getCellStyle(
2573
+ rowDataOf(entry),
2574
+ entryIndexOf(entry, rowIdx),
2575
+ col,
2576
+ ) ?? undefined,
2577
+ ]"
2578
+ :data-mg-row="entryIndexOf(entry, rowIdx)"
2579
+ :data-mg-col="colIndex"
2580
+ @mousedown="
2581
+ onCellMouseDown(
2582
+ $event,
2583
+ entryIndexOf(entry, rowIdx),
2584
+ colIndex,
2585
+ col,
2586
+ )
2587
+ "
2588
+ @mouseenter="
2589
+ onCellMouseEnter(entryIndexOf(entry, rowIdx), colIndex)
2590
+ "
2591
+ @click="onCellClick(entryIndexOf(entry, rowIdx), colIndex)"
2592
+ @dblclick="
2593
+ grid.notifyCellEvent(
2594
+ 'cellDblClick',
2595
+ entryIndexOf(entry, rowIdx),
2596
+ colIndex,
2597
+ );
2598
+ grid.startEditing(entryIndexOf(entry, rowIdx), colIndex);
2599
+ "
2600
+ @contextmenu="
2601
+ onCellContextMenu($event, entryIndexOf(entry, rowIdx), col)
2602
+ "
2603
+ @pointerdown="
2604
+ onCellPointerDown($event, entryIndexOf(entry, rowIdx), col)
2605
+ "
2129
2606
  >
2130
- <select
2131
- v-if="col.cellEditor === 'select'"
2132
- class="mg-editor"
2133
- :class="{ 'mg-editor-error': editErrorOf(col) }"
2134
- :value="editorInputValue(editValueOf(col))"
2135
- @change="onEditorInput($event, col)"
2136
- @keydown="onEditorKeydown"
2137
- @click.stop
2607
+ <button
2608
+ v-if="hasDetailSlot && colIndex === 0"
2609
+ type="button"
2610
+ class="mg-detail-toggle"
2611
+ title="행 상세"
2612
+ aria-label="행 상세 펼치기/접기"
2138
2613
  @mousedown.stop
2614
+ @click.stop="
2615
+ grid.toggleRowDetail(grid.getRowId(rowDataOf(entry)))
2616
+ "
2139
2617
  >
2140
- <option v-for="opt in col.editorOptions || []" :key="opt" :value="opt">
2141
- {{ opt }}
2142
- </option>
2143
- </select>
2144
- <select
2145
- v-else-if="col.cellEditor === 'multiselect'"
2146
- class="mg-editor"
2147
- :class="{ 'mg-editor-error': editErrorOf(col) }"
2148
- multiple
2149
- :size="Math.min(Math.max((col.editorOptions || []).length, 2), 8)"
2150
- @change="onMultiselectChange($event, col)"
2151
- @keydown="onEditorKeydown"
2152
- @click.stop
2153
- @mousedown.stop
2618
+ {{
2619
+ state.detailExpanded.has(grid.getRowId(rowDataOf(entry)))
2620
+ ? "▾"
2621
+ : "▸"
2622
+ }}
2623
+ </button>
2624
+ <button
2625
+ v-if="
2626
+ colIndex === 0 && leafHasChildren(entry) !== undefined
2627
+ "
2628
+ type="button"
2629
+ class="mg-tree-toggle"
2630
+ :class="{ 'mg-tree-leaf': !leafHasChildren(entry) }"
2631
+ :aria-label="leafExpanded(entry) ? '접기' : '펼치기'"
2632
+ :disabled="!leafHasChildren(entry)"
2633
+ @click.stop="
2634
+ grid.toggleTreeExpanded(grid.getRowId(rowDataOf(entry)))
2635
+ "
2154
2636
  >
2155
- <option
2156
- v-for="opt in col.editorOptions || []"
2157
- :key="opt"
2158
- :value="opt"
2159
- :selected="isEditOptSelected(opt, col)"
2160
- >
2161
- {{ opt }}
2162
- </option>
2163
- </select>
2164
- <div
2165
- v-else-if="col.cellEditor === 'radio'"
2166
- class="mg-radio-group"
2167
- role="radiogroup"
2637
+ {{
2638
+ leafHasChildren(entry)
2639
+ ? leafExpanded(entry)
2640
+ ? "▾"
2641
+ : "▸"
2642
+ : ""
2643
+ }}
2644
+ </button>
2645
+ <span
2646
+ v-if="
2647
+ grid.isActiveCell(
2648
+ entryIndexOf(entry, rowIdx),
2649
+ colIndex,
2650
+ ) && !isEditingCell(entryIndexOf(entry, rowIdx), colIndex)
2651
+ "
2652
+ class="mg-fill-handle"
2653
+ @pointerdown="onFillPointerDown"
2654
+ ></span>
2655
+ <span
2656
+ v-if="
2657
+ col.rowDrag &&
2658
+ !isEditingCell(entryIndexOf(entry, rowIdx), colIndex)
2659
+ "
2660
+ class="mg-row-drag-handle"
2661
+ :class="{ 'mg-disabled': !rowDraggable }"
2662
+ :draggable="rowDraggable"
2663
+ title="행 이동"
2664
+ @pointerdown="
2665
+ onRowDragPointerDown($event, entryIndexOf(entry, rowIdx))
2666
+ "
2667
+ @dragstart="
2668
+ onRowDragStart(entryIndexOf(entry, rowIdx), $event)
2669
+ "
2670
+ @dragend="onRowDragEnd"
2671
+ >⠿</span
2168
2672
  >
2169
- <label
2170
- v-for="opt in col.editorOptions || []"
2171
- :key="opt"
2172
- class="mg-radio-label"
2673
+ <template
2674
+ v-if="isEditingCell(entryIndexOf(entry, rowIdx), colIndex)"
2675
+ >
2676
+ <!-- 커스텀 에디터 슬롯: #editor-{field}="ctx" -->
2677
+ <slot
2678
+ :name="`editor-${col.field}`"
2679
+ v-bind="
2680
+ editorContext(entryIndexOf(entry, rowIdx), colIndex)
2681
+ "
2173
2682
  >
2683
+ <select
2684
+ v-if="col.cellEditor === 'select'"
2685
+ class="mg-editor"
2686
+ :class="{ 'mg-editor-error': editErrorOf(col) }"
2687
+ :value="editorInputValue(editValueOf(col))"
2688
+ @change="onSelectPick($event, col)"
2689
+ @keydown="onEditorKeydown"
2690
+ @click.stop
2691
+ @mousedown.stop
2692
+ >
2693
+ <option
2694
+ v-for="opt in editorOptionsOf(col, rowDataOf(entry))"
2695
+ :key="opt"
2696
+ :value="opt"
2697
+ >
2698
+ {{ opt }}
2699
+ </option>
2700
+ </select>
2701
+ <select
2702
+ v-else-if="col.cellEditor === 'multiselect'"
2703
+ class="mg-editor"
2704
+ :class="{ 'mg-editor-error': editErrorOf(col) }"
2705
+ multiple
2706
+ :size="
2707
+ Math.min(
2708
+ Math.max(
2709
+ editorOptionsOf(col, rowDataOf(entry)).length,
2710
+ 2,
2711
+ ),
2712
+ 8,
2713
+ )
2714
+ "
2715
+ @change="onMultiselectChange($event, col)"
2716
+ @keydown="onEditorKeydown"
2717
+ @click.stop
2718
+ @mousedown.stop
2719
+ >
2720
+ <option
2721
+ v-for="opt in editorOptionsOf(col, rowDataOf(entry))"
2722
+ :key="opt"
2723
+ :value="opt"
2724
+ :selected="isEditOptSelected(opt, col)"
2725
+ >
2726
+ {{ opt }}
2727
+ </option>
2728
+ </select>
2729
+ <div
2730
+ v-else-if="col.cellEditor === 'radio'"
2731
+ class="mg-radio-group"
2732
+ role="radiogroup"
2733
+ >
2734
+ <label
2735
+ v-for="opt in editorOptionsOf(col, rowDataOf(entry))"
2736
+ :key="opt"
2737
+ class="mg-radio-label"
2738
+ >
2739
+ <input
2740
+ type="radio"
2741
+ :checked="String(editValueOf(col) ?? '') === opt"
2742
+ @change="onRadioPick(opt, col)"
2743
+ @click.stop
2744
+ @mousedown.stop
2745
+ />
2746
+ <span>{{ opt }}</span>
2747
+ </label>
2748
+ </div>
2749
+ <textarea
2750
+ v-else-if="col.cellEditor === 'textarea'"
2751
+ class="mg-editor mg-editor-textarea"
2752
+ :class="{ 'mg-editor-error': editErrorOf(col) }"
2753
+ :value="editorInputValue(editValueOf(col))"
2754
+ @input="onEditorInput($event, col)"
2755
+ @keydown="onTextareaKeydown"
2756
+ @blur="
2757
+ state.editType !== 'fullRow' && grid.commitEditing()
2758
+ "
2759
+ @click.stop
2760
+ @dblclick.stop
2761
+ @mousedown.stop
2762
+ />
2174
2763
  <input
2175
- type="radio"
2176
- :checked="String(editValueOf(col) ?? '') === opt"
2177
- @change="onRadioPick(opt, col)"
2764
+ v-else
2765
+ :type="editorInputType(col)"
2766
+ class="mg-editor"
2767
+ :class="{ 'mg-editor-error': editErrorOf(col) }"
2768
+ :value="editorInputValue(editValueOf(col))"
2769
+ :list="
2770
+ editorInputType(col) === 'text' &&
2771
+ editorOptionsOf(col, rowDataOf(entry)).length
2772
+ ? `mg-dl-${col.field}`
2773
+ : undefined
2774
+ "
2775
+ @input="onEditorInput($event, col)"
2776
+ @change="onDatePick($event, col)"
2777
+ @keydown="onEditorKeydown"
2178
2778
  @click.stop
2179
2779
  @mousedown.stop
2180
2780
  />
2181
- <span>{{ opt }}</span>
2182
- </label>
2183
- </div>
2184
- <textarea
2185
- v-else-if="col.cellEditor === 'textarea'"
2186
- class="mg-editor mg-editor-textarea"
2187
- :class="{ 'mg-editor-error': editErrorOf(col) }"
2188
- :value="editorInputValue(editValueOf(col))"
2189
- @input="onEditorInput($event, col)"
2190
- @keydown="onTextareaKeydown"
2191
- @blur="state.editType !== 'fullRow' && grid.commitEditing()"
2192
- @click.stop
2193
- @dblclick.stop
2194
- @mousedown.stop
2195
- />
2196
- <input
2781
+ <datalist
2782
+ v-if="
2783
+ editorInputType(col) === 'text' &&
2784
+ editorOptionsOf(col, rowDataOf(entry)).length
2785
+ "
2786
+ :id="`mg-dl-${col.field}`"
2787
+ >
2788
+ <option
2789
+ v-for="opt in editorOptionsOf(col, rowDataOf(entry))"
2790
+ :key="opt"
2791
+ :value="opt"
2792
+ />
2793
+ </datalist>
2794
+ </slot>
2795
+ <span v-if="editErrorOf(col)" class="mg-edit-error">{{
2796
+ editErrorOf(col)
2797
+ }}</span>
2798
+ </template>
2799
+ <!-- 커스텀 셀 슬롯: #cell-{field}="{ value, row, column }" -->
2800
+ <slot
2197
2801
  v-else
2198
- :type="editorInputType(col)"
2199
- class="mg-editor"
2200
- :class="{ 'mg-editor-error': editErrorOf(col) }"
2201
- :value="editorInputValue(editValueOf(col))"
2202
- :list="
2203
- editorInputType(col) === 'text' && col.editorOptions?.length
2204
- ? `mg-dl-${col.field}`
2205
- : undefined
2206
- "
2207
- @input="onEditorInput($event, col)"
2208
- @keydown="onEditorKeydown"
2209
- @click.stop
2210
- @mousedown.stop
2211
- />
2212
- <datalist
2213
- v-if="
2214
- editorInputType(col) === 'text' &&
2215
- col.editorOptions?.length
2216
- "
2217
- :id="`mg-dl-${col.field}`"
2802
+ :name="`cell-${col.field}`"
2803
+ :value="grid.getCellValue(rowDataOf(entry), col)"
2804
+ :row="rowDataOf(entry)"
2805
+ :column="col"
2218
2806
  >
2219
- <option
2220
- v-for="opt in col.editorOptions"
2221
- :key="opt"
2222
- :value="opt"
2807
+ <img
2808
+ v-if="
2809
+ col.cellType === 'image' &&
2810
+ grid.getCellValue(rowDataOf(entry), col) != null
2811
+ "
2812
+ class="mg-cell-image"
2813
+ :src="String(grid.getCellValue(rowDataOf(entry), col))"
2814
+ :alt="col.cellOptions?.alt?.(rowDataOf(entry)) ?? ''"
2815
+ />
2816
+ <button
2817
+ v-else-if="col.cellType === 'button'"
2818
+ type="button"
2819
+ class="mg-cell-button"
2820
+ @click.stop="col.cellOptions?.onClick?.(rowDataOf(entry))"
2821
+ @dblclick.stop
2822
+ >
2823
+ {{ grid.getCellText(rowDataOf(entry), col) }}
2824
+ </button>
2825
+ <a
2826
+ v-else-if="col.cellType === 'link'"
2827
+ class="mg-cell-link"
2828
+ :href="cellLinkHref(rowDataOf(entry), col)"
2829
+ :target="col.cellOptions?.target ?? '_blank'"
2830
+ rel="noreferrer"
2831
+ @click.stop
2832
+ >
2833
+ {{ grid.getCellText(rowDataOf(entry), col) }}
2834
+ </a>
2835
+ <span
2836
+ v-else-if="col.cellType === 'progress'"
2837
+ class="mg-cell-progress"
2838
+ role="progressbar"
2839
+ aria-valuemin="0"
2840
+ :aria-valuenow="progressValueOf(rowDataOf(entry), col)"
2841
+ :aria-valuemax="col.cellOptions?.max ?? 100"
2842
+ >
2843
+ <span
2844
+ class="mg-cell-progress-bar"
2845
+ :style="{
2846
+ width: `${progressPctOf(rowDataOf(entry), col)}%`,
2847
+ }"
2848
+ />
2849
+ <span class="mg-cell-progress-text"
2850
+ >{{
2851
+ Math.round(progressPctOf(rowDataOf(entry), col))
2852
+ }}%</span
2853
+ >
2854
+ </span>
2855
+ <!-- XSS 주의: html 셀은 신뢰할 수 있는 HTML만 -->
2856
+ <span
2857
+ v-else-if="col.cellType === 'html'"
2858
+ class="mg-cell-html"
2859
+ v-html="grid.getCellText(rowDataOf(entry), col)"
2223
2860
  />
2224
- </datalist>
2225
- </slot>
2226
- <span v-if="editErrorOf(col)" class="mg-edit-error">{{ editErrorOf(col) }}</span>
2861
+ <input
2862
+ v-else-if="col.cellEditor === 'checkbox'"
2863
+ type="checkbox"
2864
+ class="mg-cell-checkbox"
2865
+ :checked="grid.isCellChecked(rowDataOf(entry), col)"
2866
+ :disabled="
2867
+ !grid.isCellEditable(
2868
+ entryIndexOf(entry, rowIdx),
2869
+ colIndex,
2870
+ )
2871
+ "
2872
+ @click.stop
2873
+ @dblclick.stop
2874
+ @change="grid.toggleCellChecked(rowDataOf(entry), col)"
2875
+ />
2876
+ <template v-else>{{
2877
+ grid.getCellText(rowDataOf(entry), col)
2878
+ }}</template>
2879
+ </slot>
2880
+ </td>
2227
2881
  </template>
2228
- <!-- 커스텀 셀 슬롯: #cell-{field}="{ value, row, column }" -->
2229
- <slot
2230
- v-else
2231
- :name="`cell-${col.field}`"
2232
- :value="grid.getCellValue(rowDataOf(entry), col)"
2233
- :row="rowDataOf(entry)"
2234
- :column="col"
2235
- >
2236
- <img
2237
- v-if="col.cellType === 'image' && grid.getCellValue(rowDataOf(entry), col) != null"
2238
- class="mg-cell-image"
2239
- :src="String(grid.getCellValue(rowDataOf(entry), col))"
2240
- :alt="col.cellOptions?.alt?.(rowDataOf(entry)) ?? ''"
2241
- />
2242
- <button
2243
- v-else-if="col.cellType === 'button'"
2244
- type="button"
2245
- class="mg-cell-button"
2246
- @click.stop="col.cellOptions?.onClick?.(rowDataOf(entry))"
2247
- @dblclick.stop
2248
- >
2249
- {{ grid.getCellText(rowDataOf(entry), col) }}
2250
- </button>
2251
- <a
2252
- v-else-if="col.cellType === 'link'"
2253
- class="mg-cell-link"
2254
- :href="cellLinkHref(rowDataOf(entry), col)"
2255
- :target="col.cellOptions?.target ?? '_blank'"
2256
- rel="noreferrer"
2257
- @click.stop
2258
- >
2259
- {{ grid.getCellText(rowDataOf(entry), col) }}
2260
- </a>
2261
- <span
2262
- v-else-if="col.cellType === 'progress'"
2263
- class="mg-cell-progress"
2264
- role="progressbar"
2265
- :aria-valuenow="progressValueOf(rowDataOf(entry), col)"
2266
- :aria-valuemax="col.cellOptions?.max ?? 100"
2267
- >
2268
- <span
2269
- class="mg-cell-progress-bar"
2270
- :style="{ width: `${progressPctOf(rowDataOf(entry), col)}%` }"
2882
+ </tr>
2883
+ <!-- 행 상세 패널 (master-detail) — #detail 슬롯 -->
2884
+ <tr
2885
+ v-if="
2886
+ hasDetailSlot &&
2887
+ !isGroupRow(entry) &&
2888
+ !isSubtotalRow(entry) &&
2889
+ rowDataOf(entry) != null &&
2890
+ state.detailExpanded.has(grid.getRowId(rowDataOf(entry)))
2891
+ "
2892
+ :key="rowKeyOf(entry, rowIdx) + '-detail'"
2893
+ class="mg-detail-row"
2894
+ >
2895
+ <td class="mg-detail-cell" :colspan="colSpan">
2896
+ <div class="mg-detail-content">
2897
+ <slot
2898
+ name="detail"
2899
+ :row="rowDataOf(entry)"
2900
+ :row-index="entryIndexOf(entry, rowIdx)"
2271
2901
  />
2272
- <span class="mg-cell-progress-text">{{ Math.round(progressPctOf(rowDataOf(entry), col)) }}%</span>
2273
- </span>
2274
- <!-- XSS 주의: html 셀은 신뢰할 수 있는 HTML만 -->
2275
- <span
2276
- v-else-if="col.cellType === 'html'"
2277
- class="mg-cell-html"
2278
- v-html="grid.getCellText(rowDataOf(entry), col)"
2279
- />
2280
- <input
2281
- v-else-if="col.cellEditor === 'checkbox'"
2282
- type="checkbox"
2283
- class="mg-cell-checkbox"
2284
- :checked="grid.isCellChecked(rowDataOf(entry), col)"
2285
- :disabled="!grid.isCellEditable(entryIndexOf(entry, rowIdx), colIndex)"
2286
- @click.stop
2287
- @dblclick.stop
2288
- @change="grid.toggleCellChecked(rowDataOf(entry), col)"
2289
- />
2290
- <template v-else>{{ grid.getCellText(rowDataOf(entry), col) }}</template>
2291
- </slot>
2292
- </td>
2293
- </template>
2902
+ </div>
2903
+ </td>
2904
+ </tr>
2905
+ </template>
2906
+ <tr
2907
+ v-if="virtual && bottomOffset > 0"
2908
+ class="mg-spacer"
2909
+ aria-hidden="true"
2910
+ >
2911
+ <td
2912
+ :colspan="colSpan"
2913
+ :style="{ height: `${bottomOffset}px`, padding: 0 }"
2914
+ />
2294
2915
  </tr>
2295
- </template>
2296
- <tr
2297
- v-if="virtual && bottomOffset > 0"
2298
- class="mg-spacer"
2299
- aria-hidden="true"
2300
- >
2301
- <td :colspan="colSpan" :style="{ height: `${bottomOffset}px`, padding: 0 }" />
2302
- </tr>
2303
- <tr
2304
- v-for="(prow, pIdx) in state.pinnedBottomRows"
2305
- :key="`pin-bottom-${pIdx}`"
2306
- class="mg-pinned-bottom-row"
2307
- >
2308
- <td v-if="rowStatus" class="mg-status-cell" />
2309
- <td v-if="rowCheckboxes" class="mg-check-cell" />
2310
- <td v-if="rowNumbers" class="mg-rownum-cell" />
2311
- <td
2312
- v-for="(col, colIndex) in state.visibleColumns"
2313
- :key="col.field"
2314
- :class="{
2315
- 'mg-pinned': !!col.pinned,
2316
- 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
2317
- 'mg-pin-right-edge': colIndex === firstRightPinIdx,
2318
- }"
2319
- :style="pinStyleOf(col)"
2916
+ <tr
2917
+ v-for="(prow, pIdx) in state.pinnedBottomRows"
2918
+ :key="`pin-bottom-${pIdx}`"
2919
+ class="mg-pinned-bottom-row"
2320
2920
  >
2321
- {{ grid.getCellText(prow, col) }}
2322
- </td>
2323
- </tr>
2324
- <tr
2325
- v-if="state.appendScroll && (state.appendScroll.loading || state.appendScroll.hasMore)"
2326
- class="mg-append-row"
2327
- >
2328
- <td :colspan="colSpan">
2329
- <span v-if="state.appendScroll.loading">{{ state.locale.loadingMore }}</span>
2330
- <button
2331
- v-else
2332
- type="button"
2333
- class="mg-append-btn"
2334
- @click="onLoadMore"
2921
+ <td v-if="rowStatus" class="mg-status-cell" />
2922
+ <td v-if="rowCheckboxes" class="mg-check-cell" />
2923
+ <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)"
2335
2933
  >
2336
- 더 보기
2337
- </button>
2338
- </td>
2339
- </tr>
2340
- </tbody>
2341
- <tfoot v-if="state.grandTotals">
2342
- <tr class="mg-total-row">
2343
- <td v-if="rowStatus" class="mg-status-cell" />
2344
- <td v-if="rowCheckboxes" class="mg-check-cell" />
2345
- <td v-if="rowNumbers" class="mg-rownum-cell" />
2346
- <td
2347
- v-for="(col, colIndex) in state.visibleColumns"
2348
- :key="col.field"
2349
- :class="{
2350
- 'mg-pinned': !!col.pinned,
2351
- 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
2352
- 'mg-pin-right-edge': colIndex === firstRightPinIdx,
2353
- }"
2354
- :style="pinStyleOf(col)"
2934
+ {{ grid.getCellText(prow, col) }}
2935
+ </td>
2936
+ </tr>
2937
+ <tr
2938
+ v-if="
2939
+ state.appendScroll &&
2940
+ (state.appendScroll.loading || state.appendScroll.hasMore)
2941
+ "
2942
+ class="mg-append-row"
2355
2943
  >
2356
- <span
2357
- v-if="col.aggregationFn && state.grandTotals[col.field] != null"
2358
- class="mg-agg"
2944
+ <td :colspan="colSpan">
2945
+ <span v-if="state.appendScroll.loading">{{
2946
+ state.locale.loadingMore
2947
+ }}</span>
2948
+ <button
2949
+ v-else
2950
+ type="button"
2951
+ class="mg-append-btn"
2952
+ @click="onLoadMore"
2953
+ >
2954
+ 더 보기
2955
+ </button>
2956
+ </td>
2957
+ </tr>
2958
+ </tbody>
2959
+ <tfoot v-if="state.grandTotals">
2960
+ <tr class="mg-total-row">
2961
+ <td v-if="rowStatus" class="mg-status-cell" />
2962
+ <td v-if="rowCheckboxes" class="mg-check-cell" />
2963
+ <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)"
2359
2973
  >
2360
- {{ formatAggregate(state.grandTotals[col.field]) }}
2361
- </span>
2362
- <template v-else-if="colIndex === 0">{{ state.locale.totalLabel }}</template>
2363
- </td>
2364
- </tr>
2365
- </tfoot>
2366
- </table>
2367
- <div v-if="state.serverSide?.loading" class="mg-loading">{{ state.locale.loadingMore }}</div>
2974
+ <span
2975
+ v-if="col.aggregationFn && state.grandTotals[col.field] != null"
2976
+ class="mg-agg"
2977
+ >
2978
+ {{ formatAggregate(state.grandTotals[col.field]) }}
2979
+ </span>
2980
+ <template v-else-if="colIndex === 0">{{
2981
+ state.locale.totalLabel
2982
+ }}</template>
2983
+ </td>
2984
+ </tr>
2985
+ </tfoot>
2986
+ </table>
2987
+ <div v-if="state.serverSide?.loading" class="mg-loading">
2988
+ {{ state.locale.loadingMore }}
2989
+ </div>
2368
2990
  </div>
2369
- <div
2370
- v-if="statusBar && state.selectionAggregates"
2371
- class="mg-statusbar"
2372
- >
2991
+ <div v-if="statusBar && state.selectionAggregates" class="mg-statusbar">
2373
2992
  <span>
2374
2993
  <span class="mg-status-value">
2375
- {{ state.selectionAggregates.cells }}
2994
+ {{
2995
+ state.selectionAggregates.rows > 0
2996
+ ? state.selectionAggregates.rows
2997
+ : state.selectionAggregates.cells
2998
+ }}
2376
2999
  </span>
2377
- 셀 선택
3000
+ {{ state.selectionAggregates.rows > 0 ? "행 선택" : "셀 선택" }}
2378
3001
  </span>
2379
3002
  <template v-if="state.selectionAggregates.count > 0">
2380
3003
  <span>
@@ -2418,10 +3041,18 @@ watch(
2418
3041
  <ul
2419
3042
  class="mg-ctx-menu"
2420
3043
  role="menu"
2421
- :style="{ left: `${state.contextMenu.x}px`, top: `${state.contextMenu.y}px` }"
3044
+ :style="{
3045
+ left: `${state.contextMenu.x}px`,
3046
+ top: `${state.contextMenu.y}px`,
3047
+ }"
2422
3048
  >
2423
3049
  <template v-for="item in state.contextMenu.items">
2424
- <li v-if="item.separator" :key="item.id" class="mg-ctx-separator" role="separator" />
3050
+ <li
3051
+ v-if="item.separator"
3052
+ :key="item.id"
3053
+ class="mg-ctx-separator"
3054
+ role="separator"
3055
+ />
2425
3056
  <li v-else :key="item.id" role="none">
2426
3057
  <button
2427
3058
  type="button"
@@ -2436,5 +3067,8 @@ watch(
2436
3067
  </template>
2437
3068
  </ul>
2438
3069
  </template>
3070
+ <div v-if="isLoading" class="mg-loading-overlay">
3071
+ {{ state.locale.loadingMore }}
3072
+ </div>
2439
3073
  </div>
2440
3074
  </template>