@moda-grid/vue2 0.3.0 → 0.4.1

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.
Files changed (2) hide show
  1. package/dist/DataGrid.vue +636 -38
  2. package/package.json +2 -2
package/dist/DataGrid.vue CHANGED
@@ -1,5 +1,13 @@
1
1
  <script setup lang="ts">
2
- import { computed, nextTick, ref, watch, watchEffect } from "vue";
2
+ import {
3
+ computed,
4
+ nextTick,
5
+ onBeforeUnmount,
6
+ onMounted,
7
+ ref,
8
+ watch,
9
+ watchEffect,
10
+ } from "vue";
3
11
  import type { CSSProperties, PropType } from "vue";
4
12
  import {
5
13
  DEFAULT_COLUMN_WIDTH,
@@ -9,6 +17,10 @@ import {
9
17
  formatAggregate,
10
18
  } from "@moda-grid/core";
11
19
  import type {
20
+ AppendScrollOptions,
21
+ PivotOptions,
22
+ ContextMenuItem,
23
+ GridLocale,
12
24
  CellEditorContext,
13
25
  CellNavigation,
14
26
  ColumnDef,
@@ -16,8 +28,12 @@ import type {
16
28
  DisplayRow,
17
29
  FilterOperator,
18
30
  Grid,
31
+ GridEventHandlers,
32
+ GridEventMap,
33
+ GridOptions,
19
34
  GroupNode,
20
35
  LeafDisplayRow,
36
+ RowData,
21
37
  SelectionMode,
22
38
  ServerSideOptions,
23
39
  TreeDataOptions,
@@ -25,6 +41,15 @@ import type {
25
41
  import { useGrid, useGridState } from "./useGrid.js";
26
42
 
27
43
  // Vue 2.7 script setup — runtime props 선언 사용
44
+ /** 편집기 input 씨드 값 — Date는 YYYY-MM-DD 로 변환 (input[type=date] 호환) */
45
+ function editorInputValue(v: unknown): string {
46
+ if (v instanceof Date) {
47
+ const pad = (n: number) => String(n).padStart(2, "0");
48
+ return `${v.getFullYear()}-${pad(v.getMonth() + 1)}-${pad(v.getDate())}`;
49
+ }
50
+ return String(v ?? "");
51
+ }
52
+
28
53
  const props = defineProps({
29
54
  columns: { type: Array as PropType<ColumnDef[]>, required: true },
30
55
  /** 행 데이터. `grid`를 직접 넘기는 제어 모드에서는 생략 가능 */
@@ -44,12 +69,27 @@ const props = defineProps({
44
69
  resizable: { type: Boolean, default: true },
45
70
  /** 헤더 드래그로 컬럼 순서 변경 허용 */
46
71
  reorderable: { type: Boolean, default: true },
72
+ rowResizable: { type: Boolean, default: false },
47
73
  /** 셀 선택 모드: 방향키 이동 + Shift 범위 확장 */
48
74
  selectionMode: { type: String as PropType<SelectionMode>, default: undefined },
49
75
  /** 서버 사이드 데이터 소스 (내부 GridCore 생성 모드에서만 적용) */
50
76
  serverSide: { type: Object as PropType<ServerSideOptions>, default: undefined },
77
+ /** Append Scroll 데이터 소스 — 스크롤 하단에서 자동으로 다음 페이지 로드 (내부 GridCore 생성 모드에서만 적용) */
78
+ appendScroll: { type: Object as PropType<AppendScrollOptions>, default: undefined },
51
79
  /** 계층형 데이터: flat parentId 또는 nested children (내부 GridCore 생성 모드에서만 적용) */
52
80
  treeData: { type: Object as PropType<TreeDataOptions>, default: undefined },
81
+ /** 피벗 모드 (내부 GridCore 생성 모드에서만 적용) */
82
+ pivot: { type: Object as PropType<PivotOptions>, default: undefined },
83
+ /** 그룹 소계 행 표시 */
84
+ groupSubtotals: { type: Boolean, default: false },
85
+ /** 내장 UI 문자열 로케일 */
86
+ locale: { type: Object as PropType<Partial<GridLocale>>, default: undefined },
87
+ /** 셀 우클릭 컨텍스트 메뉴 항목 (배열 또는 grid를 받는 함수) */
88
+ contextMenu: { type: [Array, Function] as PropType<GridOptions<RowData>["contextMenu"]>, default: undefined },
89
+ /** 헤더 우클릭 컨텍스트 메뉴 항목 */
90
+ headerContextMenu: { type: [Array, Function] as PropType<GridOptions<RowData>["headerContextMenu"]>, default: undefined },
91
+ /** 맨 왼쪽에 행 번호 컬럼 표시 */
92
+ rowNumbers: { type: Boolean, default: false },
53
93
  /** 우상단 컬럼 관리 도구(체크박스 팝오버 + 전체 선택/해제) 표시 */
54
94
  columnController: { type: Boolean, default: false },
55
95
  /** 우상단 필터 행 표시/숨김 토글 버튼 표시 — filterable 컬럼이 있을 때만 렌더 */
@@ -60,6 +100,14 @@ const props = defineProps({
60
100
  rowStatus: { type: Boolean, default: false },
61
101
  /** 선택 영역 집계 상태바 표시 */
62
102
  statusBar: { type: Boolean, default: true },
103
+ /** 그리드 상단에 그룹 패널 표시 — 그룹된 컬럼 칩 + 클릭으로 해제 */
104
+ groupPanel: { type: Boolean, default: false },
105
+ /** multiLine 셀 내용만큼 행 높이 자동 확장 — 가상 스크롤에서는 무시 */
106
+ autoRowHeight: { type: Boolean, default: false },
107
+ /** 선언형 이벤트 핸들러 — 마운트 시 구독, 언마운트 시 해제 (grid.on과 동일) */
108
+ events: { type: Object as PropType<GridEventHandlers>, default: undefined },
109
+ /** GridCore 인스턴스가 준비되면 한 번 호출 — props 모드에서도 grid API 접근 가능 */
110
+ onReady: { type: Function as PropType<(grid: Grid) => void>, default: undefined },
63
111
  });
64
112
 
65
113
  // 내부 GridCore (grid prop이 없을 때만 생성)
@@ -70,7 +118,14 @@ const internal = props.grid
70
118
  data: props.data ?? [],
71
119
  getRowId: props.getRowId,
72
120
  serverSide: props.serverSide,
121
+ appendScroll: props.appendScroll,
73
122
  treeData: props.treeData,
123
+ pivot: props.pivot,
124
+ groupSubtotals: props.groupSubtotals,
125
+ locale: props.locale,
126
+ contextMenu: props.contextMenu,
127
+ headerContextMenu: props.headerContextMenu,
128
+ autoRowHeight: props.autoRowHeight,
74
129
  virtualScroll:
75
130
  props.height != null && props.rowHeight != null && props.rowHeight > 0
76
131
  ? {
@@ -82,6 +137,27 @@ const internal = props.grid
82
137
  });
83
138
  const grid = props.grid ?? internal!.grid;
84
139
  const state = props.grid ? useGridState(grid).state : internal!.state;
140
+
141
+ // 선언형 이벤트 구독 — events 맵의 각 키를 grid.on에 연결
142
+ watch(
143
+ () => props.events,
144
+ (ev, _prev, onCleanup) => {
145
+ if (!ev) return;
146
+ const offs = Object.entries(ev).map(([name, handler]) =>
147
+ handler
148
+ ? grid.on(
149
+ name as keyof GridEventMap,
150
+ handler as (e: GridEventMap[keyof GridEventMap]) => void,
151
+ )
152
+ : () => {},
153
+ );
154
+ onCleanup(() => offs.forEach((off) => off()));
155
+ },
156
+ { immediate: true },
157
+ );
158
+ // 인스턴스 준비 콜백 + 템플릿 ref 노출 — props 모드에서도 grid 접근 가능
159
+ onMounted(() => props.onReady?.(grid));
160
+ defineExpose({ grid });
85
161
  // 컬럼 관리 도구 팝오버 열림 상태
86
162
  const colCtlOpen = ref(false);
87
163
 
@@ -115,6 +191,38 @@ watchEffect(() => {
115
191
  if (v && el && el.scrollTop !== v.scrollTop) el.scrollTop = v.scrollTop;
116
192
  });
117
193
 
194
+ // 비가상 스크롤: scrollToRow 요청을 scrollIntoView로 처리 (seq로 호출 구분)
195
+ const hostEl = ref<HTMLElement | null>(null);
196
+ watch(
197
+ () => state.value.scrollRequest?.seq,
198
+ async () => {
199
+ const req = state.value.scrollRequest;
200
+ if (!req) return;
201
+ await nextTick();
202
+ (scrollEl.value ?? hostEl.value)
203
+ ?.querySelector<HTMLElement>(`td[data-mg-row="${req.rowIndex}"]`)
204
+ ?.scrollIntoView({ block: "nearest" });
205
+ },
206
+ );
207
+
208
+ // autoRowHeight prop → core 동기화 (제어 모드 포함)
209
+ watchEffect(() => grid.setAutoRowHeight(!!props.autoRowHeight));
210
+
211
+ // 행 높이 — 가상 스크롤은 고정, 아니면 autoRowHeight 추정치 적용
212
+ function rowStyleOf(entry: AnyRow) {
213
+ if (virtual.value && props.rowHeight)
214
+ return { height: `${props.rowHeight}px` };
215
+ const h = grid.getRowHeight(rowDataOf(entry));
216
+ return h ? { height: `${h}px` } : undefined;
217
+ }
218
+
219
+ // 그룹 패널 칩 — 클릭 시 해당 컬럼 그룹 해제
220
+ function ungroupField(field: string) {
221
+ grid.setGroupBy(
222
+ state.value.groupBy.filter((f) => f !== field) as (keyof RowT & string)[],
223
+ );
224
+ }
225
+
118
226
  const virtual = computed(() => state.value.virtual);
119
227
  // 그룹화 시: displayRows(그룹 헤더 포함)를 virtual 인덱스로 슬라이스
120
228
  type RowT = Record<string, unknown>;
@@ -131,7 +239,8 @@ const colSpan = computed(
131
239
  () =>
132
240
  (state.value.visibleColumns.length || 1) +
133
241
  (props.rowCheckboxes ? 1 : 0) +
134
- (props.rowStatus ? 1 : 0),
242
+ (props.rowStatus ? 1 : 0) +
243
+ (props.rowNumbers ? 1 : 0),
135
244
  );
136
245
  const hasFilterable = computed(() =>
137
246
  state.value.visibleColumns.some((c) => c.filterable),
@@ -164,6 +273,7 @@ const firstRightPinIdx = computed(() =>
164
273
  const hasPinned = computed(
165
274
  () => lastLeftPinIdx.value >= 0 || firstRightPinIdx.value >= 0,
166
275
  );
276
+ const hasAppend = computed(() => !!state.value.appendScroll);
167
277
 
168
278
  function pinStyleOf(col: ColumnDef<RowT>): CSSProperties | undefined {
169
279
  if (!col.pinned) return undefined;
@@ -206,7 +316,83 @@ function onColumnToggle(field: string, event: Event) {
206
316
  }
207
317
 
208
318
  function onScroll(event: Event) {
209
- grid.handleScroll((event.target as HTMLElement).scrollTop);
319
+ const el = event.target as HTMLElement;
320
+ grid.handleScroll(el.scrollTop);
321
+ grid.maybeLoadMore(el.scrollTop, el.clientHeight, el.scrollHeight);
322
+ }
323
+
324
+ function onLoadMore() {
325
+ void grid.loadMore();
326
+ }
327
+
328
+ // ── 컨텍스트 메뉴 + 셀 타입 ──
329
+ function onHeaderContextMenu(e: MouseEvent, col: ColumnDef): void {
330
+ if (grid.openHeaderContextMenu(e.clientX, e.clientY, col.field)) {
331
+ e.preventDefault();
332
+ }
333
+ }
334
+
335
+ function onCellContextMenu(
336
+ e: MouseEvent,
337
+ rowIndex: number,
338
+ col: ColumnDef,
339
+ ): void {
340
+ if (grid.openContextMenu(e.clientX, e.clientY, rowIndex, col.field)) {
341
+ e.preventDefault();
342
+ }
343
+ }
344
+
345
+ function cellPosFromPoint(
346
+ x: number,
347
+ y: number,
348
+ ): { row: number; col: number } | null {
349
+ const el = document.elementFromPoint(x, y)?.closest("td[data-mg-row]");
350
+ if (!el) return null;
351
+ const row = Number(el.getAttribute("data-mg-row"));
352
+ const col = Number(el.getAttribute("data-mg-col"));
353
+ return Number.isNaN(row) || Number.isNaN(col) ? null : { row, col };
354
+ }
355
+
356
+ let fillSource: { startRow: number; endRow: number; startCol: number; endCol: number } | null = null;
357
+
358
+ function onFillMouseDown(e: MouseEvent): void {
359
+ e.preventDefault();
360
+ e.stopPropagation();
361
+ const src = state.value.selectedRange;
362
+ if (!src) return;
363
+ fillSource = { ...src };
364
+ const onUp = (ev: MouseEvent) => {
365
+ window.removeEventListener("mouseup", onUp);
366
+ const source = fillSource;
367
+ fillSource = null;
368
+ const pos = cellPosFromPoint(ev.clientX, ev.clientY);
369
+ if (!source || !pos) return;
370
+ const target = {
371
+ startRow: Math.min(source.startRow, pos.row),
372
+ endRow: Math.max(source.endRow, pos.row),
373
+ startCol: Math.min(source.startCol, pos.col),
374
+ endCol: Math.max(source.endCol, pos.col),
375
+ };
376
+ grid.fillRange(source, target);
377
+ grid.setCellRange(target);
378
+ };
379
+ window.addEventListener("mouseup", onUp);
380
+ }
381
+
382
+ function cellLinkHref(row: RowData, col: ColumnDef): string {
383
+ const v = grid.getCellValue(row, col);
384
+ return col.cellOptions?.href?.(row) ?? (v == null ? "" : String(v));
385
+ }
386
+
387
+ function progressValueOf(row: RowData, col: ColumnDef): number {
388
+ const v = grid.getCellValue(row, col);
389
+ const n = typeof v === "number" ? v : Number(v);
390
+ return Number.isFinite(n) ? n : 0;
391
+ }
392
+
393
+ function progressPctOf(row: RowData, col: ColumnDef): number {
394
+ const max = col.cellOptions?.max ?? 100;
395
+ return Math.min(100, Math.max(0, (progressValueOf(row, col) / max) * 100));
210
396
  }
211
397
 
212
398
  // ── 연산자 기반 필터 ──
@@ -261,7 +447,7 @@ function setValuesOf(col: ColumnDef<Record<string, unknown>>): string[] {
261
447
  function setFilterLabel(col: ColumnDef<Record<string, unknown>>) {
262
448
  const f = state.value.filters[col.field];
263
449
  const vals = f && f.values;
264
- return vals ? `${vals.length}개 선택` : "전체";
450
+ return vals ? state.value.locale.setFilterCount(vals.length) : "전체";
265
451
  }
266
452
 
267
453
  function setCheckedOf(col: ColumnDef<Record<string, unknown>>, v: string) {
@@ -383,6 +569,27 @@ function onResizeStart(col: ColumnDef, event: MouseEvent) {
383
569
  document.addEventListener("mouseup", onUp);
384
570
  }
385
571
 
572
+ // ── 행 높이 리사이즈: 행 번호 셀 하단 핸들 드래그 → setRowHeight ──
573
+ function onRowResizeStart(rowId: string, event: MouseEvent) {
574
+ event.preventDefault();
575
+ event.stopPropagation();
576
+ const tr = (event.currentTarget as HTMLElement).closest("tr");
577
+ const startHeight = tr?.getBoundingClientRect().height ?? 0;
578
+ const startY = event.clientY;
579
+ const onMove = (ev: MouseEvent) => {
580
+ grid.setRowHeight(
581
+ rowId,
582
+ Math.max(16, startHeight + (ev.clientY - startY)),
583
+ );
584
+ };
585
+ const onUp = () => {
586
+ document.removeEventListener("mousemove", onMove);
587
+ document.removeEventListener("mouseup", onUp);
588
+ };
589
+ document.addEventListener("mousemove", onMove);
590
+ document.addEventListener("mouseup", onUp);
591
+ }
592
+
386
593
  // 키보드 리사이즈 (방향키 ±10px)
387
594
  function onResizerKeydown(col: ColumnDef, event: KeyboardEvent) {
388
595
  const delta = event.key === "ArrowLeft" ? -10 : event.key === "ArrowRight" ? 10 : 0;
@@ -474,6 +681,13 @@ function cellErrorOf(entry: AnyRow, col: ColumnDef): string | null {
474
681
  return grid.getCellError(row, col);
475
682
  }
476
683
 
684
+ /** 셀 노트 텍스트 — 있으면 td에 mg-cell-note 클래스 + title로 표시 */
685
+ function cellNoteOf(entry: AnyRow, col: ColumnDef): string | null {
686
+ const row = rowDataOf(entry);
687
+ if (row == null) return null;
688
+ return grid.getCellNote(row, col);
689
+ }
690
+
477
691
  function cellClassOf(entry: AnyRow, rowIdx: number, col: ColumnDef) {
478
692
  const row = rowDataOf(entry);
479
693
  if (row == null) return "";
@@ -545,6 +759,15 @@ function onGridKeydown(event: KeyboardEvent) {
545
759
  } else if (key === "y") {
546
760
  event.preventDefault();
547
761
  grid.redo();
762
+ } else if (key === "a") {
763
+ // single-cell 모드의 selectAll은 전체 행 선택 — selectable일 때만
764
+ if (
765
+ state.value.selectionMode === "single-cell" &&
766
+ props.selectable === false
767
+ )
768
+ return;
769
+ event.preventDefault();
770
+ grid.selectAll();
548
771
  }
549
772
  return;
550
773
  }
@@ -553,6 +776,12 @@ function onGridKeydown(event: KeyboardEvent) {
553
776
  else grid.clearCellSelection();
554
777
  return;
555
778
  }
779
+ if (event.key === "Delete" || event.key === "Backspace") {
780
+ // 선택 범위(없으면 활성 셀) 내용 지우기 — IBSheet Del키 대응
781
+ event.preventDefault();
782
+ grid.clearRange();
783
+ return;
784
+ }
556
785
  const active = state.value.activeCell;
557
786
  if (event.key === "Enter" || event.key === "F2") {
558
787
  // 활성 셀에서 Enter → 편집 진입
@@ -580,6 +809,10 @@ function isGroupRow(entry: AnyRow) {
580
809
  return (entry as DisplayRow<RowT> | undefined)?.type === "group";
581
810
  }
582
811
 
812
+ function isSubtotalRow(entry: AnyRow) {
813
+ return (entry as DisplayRow<RowT> | undefined)?.type === "subtotal";
814
+ }
815
+
583
816
  function groupOf(entry: AnyRow): GroupNode<RowT> {
584
817
  return entry as GroupNode<RowT>;
585
818
  }
@@ -637,11 +870,48 @@ function onToggleGroup(entry: AnyRow) {
637
870
  }
638
871
 
639
872
  // ── 인라인 셀 편집 ──
873
+ // 셀 병합 정보 — td의 rowspan/colspan/hidden에 사용
874
+ function cellSpanOf(row: RowT, col: ColumnDef<RowT>) {
875
+ return grid.getCellSpan(row, col);
876
+ }
877
+
640
878
  function isEditingCell(rowIndex: number, col: ColumnDef) {
641
879
  const cell = state.value.editingCell;
642
880
  return !!cell && cell.rowIndex === rowIndex && cell.columnKey === col.field;
643
881
  }
644
882
 
883
+ // 마우스 드래그 범위 선택
884
+ let cellDragging = false;
885
+ let suppressCellClick = false;
886
+ const endCellDrag = () => {
887
+ cellDragging = false;
888
+ };
889
+ onMounted(() => window.addEventListener("mouseup", endCellDrag));
890
+ onBeforeUnmount(() => window.removeEventListener("mouseup", endCellDrag));
891
+ function onCellMouseDown(
892
+ e: MouseEvent,
893
+ rowIndex: number,
894
+ colIndex: number,
895
+ col: ColumnDef,
896
+ ) {
897
+ if (e.button !== 0 || isEditingCell(rowIndex, col)) return;
898
+ suppressCellClick = false;
899
+ if (state.value.editingCell) grid.commitEditing();
900
+ grid.setActiveCell(rowIndex, colIndex);
901
+ cellDragging = true;
902
+ e.preventDefault(); // 드래그 중 텍스트 선택 방지
903
+ }
904
+ function onCellMouseEnter(rowIndex: number, colIndex: number) {
905
+ if (!cellDragging) return;
906
+ suppressCellClick = true;
907
+ grid.extendSelectionTo(rowIndex, colIndex);
908
+ }
909
+ function onCellClick(rowIndex: number, colIndex: number) {
910
+ if (!suppressCellClick) grid.setActiveCell(rowIndex, colIndex);
911
+ suppressCellClick = false;
912
+ grid.notifyCellEvent("cellClick", rowIndex, colIndex);
913
+ }
914
+
645
915
  function editorContext(rowIndex: number, colIndex: number) {
646
916
  return grid.getEditorContext(rowIndex, colIndex) as CellEditorContext;
647
917
  }
@@ -658,6 +928,38 @@ function onEditorInput(event: Event) {
658
928
  grid.updateEditValue((event.target as HTMLInputElement | HTMLSelectElement).value);
659
929
  }
660
930
 
931
+ // multiselect 에디터 — 선택된 옵션들을 배열로 저장
932
+ function isEditOptSelected(opt: string): boolean {
933
+ const v = state.value.editValue;
934
+ return Array.isArray(v) && (v as unknown[]).includes(opt);
935
+ }
936
+
937
+ function onMultiselectChange(event: Event) {
938
+ const sel = event.target as HTMLSelectElement;
939
+ grid.updateEditValue(Array.from(sel.selectedOptions).map((o) => o.value));
940
+ }
941
+
942
+ // 라디오 에디터 — 선택 즉시 커밋 (IBSheet와 동일 UX)
943
+ function onRadioPick(opt: string, _rowIndex: number, _colIndex: number) {
944
+ grid.updateEditValue(opt);
945
+ grid.commitEditing();
946
+ }
947
+
948
+ // textarea: Enter=줄바꿈, Ctrl/Meta+Enter=커밋, Tab=저장+이동, Esc=취소
949
+ function onTextareaKeydown(event: KeyboardEvent) {
950
+ event.stopPropagation();
951
+ if (event.key === "Enter" && (event.ctrlKey || event.metaKey)) {
952
+ event.preventDefault();
953
+ if (grid.commitEditing()) grid.navigateCell("down");
954
+ } else if (event.key === "Tab") {
955
+ event.preventDefault();
956
+ if (grid.commitEditing()) grid.navigateCell(event.shiftKey ? "left" : "right");
957
+ } else if (event.key === "Escape") {
958
+ event.preventDefault();
959
+ grid.cancelEditing();
960
+ }
961
+ }
962
+
661
963
  // 편집기 내부 키: Enter 저장, Tab 저장+이동, Escape 취소
662
964
  function onEditorKeydown(event: KeyboardEvent) {
663
965
  event.stopPropagation();
@@ -685,7 +987,24 @@ watch(
685
987
  </script>
686
988
 
687
989
  <template>
688
- <div :class="showOverlay ? 'mg-colctl-host' : undefined">
990
+ <div ref="hostEl" :class="showOverlay ? 'mg-colctl-host' : undefined">
991
+ <!-- 그룹 패널 — 그룹된 컬럼 칩, 클릭 시 해제 -->
992
+ <div v-if="groupPanel" class="mg-group-panel">
993
+ <span v-if="state.groupBy.length === 0" class="mg-group-panel-empty">
994
+ {{ state.locale.groupPanelEmpty }}
995
+ </span>
996
+ <button
997
+ v-for="field in state.groupBy"
998
+ v-else
999
+ :key="field"
1000
+ type="button"
1001
+ class="mg-group-chip"
1002
+ title="클릭 시 그룹 해제"
1003
+ @click="ungroupField(field)"
1004
+ >
1005
+ {{ state.columns.find((c) => c.field === field)?.header ?? field }} ×
1006
+ </button>
1007
+ </div>
689
1008
  <div v-if="showOverlay" class="mg-colctl">
690
1009
  <button
691
1010
  v-if="filterToggle && hasFilterable"
@@ -694,7 +1013,7 @@ watch(
694
1013
  :aria-pressed="state.filterRowVisible"
695
1014
  @click="grid.setFilterRowVisible(!state.filterRowVisible)"
696
1015
  >
697
- 필터 {{ state.filterRowVisible ? "▾" : "▸"
1016
+ {{ state.locale.filterToggle }} {{ state.filterRowVisible ? "▾" : "▸"
698
1017
  }}<template v-if="activeFilterCount > 0">
699
1018
  ({{ activeFilterCount }})</template
700
1019
  >
@@ -706,22 +1025,22 @@ watch(
706
1025
  :aria-expanded="colCtlOpen"
707
1026
  @click="colCtlOpen = !colCtlOpen"
708
1027
  >
709
- 컬럼 ▾
1028
+ {{ state.locale.columnsLabel }} ▾
710
1029
  </button>
711
1030
  <template v-if="colCtlOpen">
712
1031
  <div class="mg-colctl-overlay" @click="colCtlOpen = false"></div>
713
1032
  <div
714
1033
  class="mg-colctl-panel"
715
1034
  role="dialog"
716
- aria-label="컬럼 관리"
1035
+ :aria-label="state.locale.columnsLabel"
717
1036
  @keydown.esc="colCtlOpen = false"
718
1037
  >
719
1038
  <div class="mg-colctl-actions">
720
1039
  <button type="button" @click="grid.setAllColumnsVisible(true)">
721
- 전체 선택
1040
+ {{ state.locale.selectAll }}
722
1041
  </button>
723
1042
  <button type="button" @click="grid.setAllColumnsVisible(false)">
724
- 전체 해제
1043
+ {{ state.locale.deselectAll }}
725
1044
  </button>
726
1045
  </div>
727
1046
  <label
@@ -741,18 +1060,18 @@ watch(
741
1060
  </div>
742
1061
  <div
743
1062
  ref="scrollEl"
744
- :class="{ 'mg-scroll': virtual || hasPinned }"
1063
+ :class="{ 'mg-scroll': virtual || hasPinned || hasAppend }"
745
1064
  :style="
746
- virtual && height
1065
+ (virtual || (hasAppend && height))
747
1066
  ? { height: `${height}px`, overflow: 'auto' }
748
- : hasPinned
749
- ? { overflowX: 'auto' }
1067
+ : hasPinned || hasAppend
1068
+ ? { overflowX: 'auto', overflowY: height ? undefined : 'auto' }
750
1069
  : undefined
751
1070
  "
752
1071
  @scroll="onScroll"
753
1072
  >
754
1073
  <table class="mg-table" role="grid" tabindex="0" @keydown="onGridKeydown">
755
- <thead>
1074
+ <thead role="rowgroup">
756
1075
  <tr v-for="(row, rowIdx) in headerRows" :key="rowIdx">
757
1076
  <th
758
1077
  v-if="rowStatus && rowIdx === 0"
@@ -769,13 +1088,18 @@ watch(
769
1088
  >
770
1089
  <input
771
1090
  type="checkbox"
772
- aria-label="전체 행 선택"
1091
+ :aria-label="state.locale.selectAllRowsAria"
773
1092
  :checked="grid.isAllSelected()"
774
1093
  :indeterminate.prop="grid.isSomeSelected()"
775
1094
  @click.stop
776
1095
  @change="grid.toggleAllRows()"
777
1096
  />
778
1097
  </th>
1098
+ <th
1099
+ v-if="rowNumbers && rowIdx === 0"
1100
+ :rowspan="headerRowSpan"
1101
+ class="mg-rownum-cell"
1102
+ ></th>
779
1103
  <template v-for="cell in row" :key="cell.key">
780
1104
  <th
781
1105
  v-if="cell.kind === 'group'"
@@ -794,13 +1118,16 @@ watch(
794
1118
  ? { width: `${cell.col.width}px` }
795
1119
  : undefined
796
1120
  "
797
- :class="{
798
- 'mg-sortable': cell.col.sortable !== false,
799
- 'mg-col-dragover': dragOverField === cell.col.field,
800
- 'mg-pinned': !!cell.col.pinned,
801
- 'mg-pin-left-edge': cell.colIndex === lastLeftPinIdx,
802
- 'mg-pin-right-edge': cell.colIndex === firstRightPinIdx,
803
- }"
1121
+ :class="[
1122
+ {
1123
+ 'mg-sortable': cell.col.sortable !== false,
1124
+ 'mg-col-dragover': dragOverField === cell.col.field,
1125
+ 'mg-pinned': !!cell.col.pinned,
1126
+ 'mg-pin-left-edge': cell.colIndex === lastLeftPinIdx,
1127
+ 'mg-pin-right-edge': cell.colIndex === firstRightPinIdx,
1128
+ },
1129
+ grid.getHeaderClass(cell.col),
1130
+ ]"
804
1131
  :aria-sort="sortAria(cell.col.field)"
805
1132
  :draggable="reorderable"
806
1133
  @dragstart="onDragStart(cell.col, $event)"
@@ -808,7 +1135,18 @@ watch(
808
1135
  @drop="onDrop(cell.col, $event)"
809
1136
  @dragend="onDragEnd"
810
1137
  @click="grid.toggleSort(cell.col.field, $event.shiftKey)"
1138
+ @contextmenu="onHeaderContextMenu($event, cell.col)"
811
1139
  >
1140
+ <input
1141
+ v-if="cell.col.cellEditor === 'checkbox' && cell.col.headerCheckbox"
1142
+ type="checkbox"
1143
+ class="mg-header-checkbox"
1144
+ :aria-label="`${cell.col.header || cell.col.field} 전체 체크`"
1145
+ :checked="grid.checkboxColumnState(cell.col) === 'all'"
1146
+ :indeterminate.prop="grid.checkboxColumnState(cell.col) === 'some'"
1147
+ @click.stop
1148
+ @change="grid.toggleAllChecked(cell.col)"
1149
+ />
812
1150
  {{ cell.col.header || cell.col.field }}
813
1151
  <span v-if="cell.col.required" class="mg-required-mark">*</span>
814
1152
  <span v-if="sortArrowOf(cell.col.field)" class="mg-sort-arrow">
@@ -823,6 +1161,7 @@ watch(
823
1161
  class="mg-resizer"
824
1162
  :aria-label="`${cell.col.field} 너비 조절`"
825
1163
  @mousedown.stop.prevent="onResizeStart(cell.col, $event)"
1164
+ @dblclick.stop="grid.autoSizeColumn(cell.col.field)"
826
1165
  @keydown.stop="onResizerKeydown(cell.col, $event)"
827
1166
  @click.stop
828
1167
  />
@@ -832,6 +1171,7 @@ watch(
832
1171
  <tr v-if="hasFilterRow" class="mg-filter-row">
833
1172
  <th v-if="rowStatus" class="mg-status-cell" />
834
1173
  <th v-if="rowCheckboxes" class="mg-check-cell" />
1174
+ <th v-if="rowNumbers" class="mg-rownum-cell" />
835
1175
  <th
836
1176
  v-for="(col, colIndex) in state.visibleColumns"
837
1177
  :key="col.field"
@@ -852,7 +1192,7 @@ watch(
852
1192
  :checked="setAllCheckedOf(col)"
853
1193
  @change="grid.setFilter(col.field, null)"
854
1194
  />
855
- (전체 선택)
1195
+ {{ state.locale.setFilterAll }}
856
1196
  </label>
857
1197
  <label
858
1198
  v-for="v in setValuesOf(col)"
@@ -890,7 +1230,7 @@ watch(
890
1230
  class="mg-filter-input mg-filter-to"
891
1231
  :type="filterInputType(col)"
892
1232
  :value="filterValueOf(col, 'valueTo')"
893
- placeholder="~ 까지"
1233
+ :placeholder="state.locale.rangeEndPlaceholder"
894
1234
  @input="onFilterInput(col, 'valueTo', $event)"
895
1235
  />
896
1236
  </template>
@@ -898,7 +1238,7 @@ watch(
898
1238
  </th>
899
1239
  </tr>
900
1240
  </thead>
901
- <tbody>
1241
+ <tbody role="rowgroup">
902
1242
  <tr
903
1243
  v-for="(prow, pIdx) in state.pinnedTopRows"
904
1244
  :key="`pin-top-${pIdx}`"
@@ -906,6 +1246,7 @@ watch(
906
1246
  >
907
1247
  <td v-if="rowStatus" class="mg-status-cell" />
908
1248
  <td v-if="rowCheckboxes" class="mg-check-cell" />
1249
+ <td v-if="rowNumbers" class="mg-rownum-cell" />
909
1250
  <td
910
1251
  v-for="(col, colIndex) in state.visibleColumns"
911
1252
  :key="col.field"
@@ -927,7 +1268,7 @@ watch(
927
1268
  <td :colspan="colSpan" :style="{ height: `${virtual.startOffset}px`, padding: 0 }" />
928
1269
  </tr>
929
1270
  <tr v-if="bodyRows.length === 0">
930
- <td class="mg-empty" :colspan="colSpan">No rows</td>
1271
+ <td class="mg-empty" :colspan="colSpan">{{ state.locale.noRows }}</td>
931
1272
  </tr>
932
1273
  <template v-for="(entry, rowIdx) in bodyRows" :key="rowKeyOf(entry)">
933
1274
  <!-- 그룹 헤더 행 -->
@@ -938,6 +1279,7 @@ watch(
938
1279
  >
939
1280
  <td v-if="rowStatus" class="mg-status-cell" />
940
1281
  <td v-if="rowCheckboxes" class="mg-check-cell" />
1282
+ <td v-if="rowNumbers" class="mg-rownum-cell" />
941
1283
  <td
942
1284
  v-for="(col, colIndex) in state.visibleColumns"
943
1285
  :key="col.field"
@@ -965,6 +1307,37 @@ watch(
965
1307
  </span>
966
1308
  </td>
967
1309
  </tr>
1310
+ <!-- 그룹 소계 행 -->
1311
+ <tr
1312
+ v-else-if="isSubtotalRow(entry)"
1313
+ class="mg-subtotal-row"
1314
+ >
1315
+ <td v-if="rowStatus" class="mg-status-cell" />
1316
+ <td v-if="rowCheckboxes" class="mg-check-cell" />
1317
+ <td v-if="rowNumbers" class="mg-rownum-cell" />
1318
+ <td
1319
+ v-for="(col, colIndex) in state.visibleColumns"
1320
+ :key="col.field"
1321
+ class="mg-subtotal-cell"
1322
+ :class="{
1323
+ 'mg-pinned': !!col.pinned,
1324
+ 'mg-pin-left-edge': colIndex === lastLeftPinIdx,
1325
+ 'mg-pin-right-edge': colIndex === firstRightPinIdx,
1326
+ }"
1327
+ :style="pinStyleOf(col)"
1328
+ >
1329
+ <span
1330
+ v-if="colIndex === 0"
1331
+ class="mg-subtotal-label"
1332
+ :style="{ paddingLeft: `${groupOf(entry).depth * 16}px` }"
1333
+ >
1334
+ {{ state.locale.subtotalLabel }}: {{ groupLabelOf(entry) }}
1335
+ </span>
1336
+ <span v-else-if="groupAggOf(entry, col)" class="mg-agg">
1337
+ {{ groupAggOf(entry, col) }}
1338
+ </span>
1339
+ </td>
1340
+ </tr>
968
1341
  <!-- 서버 사이드 미로드 행 → 스켈레톤 -->
969
1342
  <tr
970
1343
  v-else-if="rowDataOf(entry) == null"
@@ -973,6 +1346,7 @@ watch(
973
1346
  >
974
1347
  <td v-if="rowStatus" class="mg-status-cell" />
975
1348
  <td v-if="rowCheckboxes" class="mg-check-cell" />
1349
+ <td v-if="rowNumbers" class="mg-rownum-cell" />
976
1350
  <td
977
1351
  v-for="(col, colIndex) in state.visibleColumns"
978
1352
  :key="col.field"
@@ -989,8 +1363,10 @@ watch(
989
1363
  <!-- 리프(데이터) 행 -->
990
1364
  <tr
991
1365
  v-else
1366
+ role="row"
1367
+ :aria-selected="state.selectedRowIds.has(grid.getRowId(rowDataOf(entry)))"
992
1368
  :class="rowClassOf(entry, rowIdx)"
993
- :style="virtual && rowHeight ? { height: `${rowHeight}px` } : undefined"
1369
+ :style="rowStyleOf(entry)"
994
1370
  @click="selectable && grid.toggleRowSelection(grid.getRowId(rowDataOf(entry)))"
995
1371
  @dragover="onRowDragOver(entryIndexOf(entry, rowIdx), $event)"
996
1372
  @drop="onRowDrop($event)"
@@ -1020,30 +1396,77 @@ watch(
1020
1396
  "
1021
1397
  />
1022
1398
  </td>
1023
- <td
1399
+ <td v-if="rowNumbers" class="mg-rownum-cell">
1400
+ {{ entryIndexOf(entry, rowIdx) + 1 }}
1401
+ <span
1402
+ v-if="rowResizable && !virtual"
1403
+ class="mg-row-resizer"
1404
+ title="행 높이 조정"
1405
+ @mousedown="onRowResizeStart(grid.getRowId(rowDataOf(entry)), $event)"
1406
+ />
1407
+ </td>
1408
+ <template
1024
1409
  v-for="(col, colIndex) in state.visibleColumns"
1410
+ >
1411
+ <td
1412
+ v-if="!cellSpanOf(rowDataOf(entry), col).hidden"
1025
1413
  :key="col.field"
1414
+ :rowspan="cellSpanOf(rowDataOf(entry), col).rowSpan"
1415
+ :colspan="cellSpanOf(rowDataOf(entry), col).colSpan"
1026
1416
  :class="[
1027
1417
  {
1418
+ 'mg-cell-readonly': !grid.isCellEditable(entryIndexOf(entry, rowIdx), colIndex),
1028
1419
  'mg-cell-active': grid.isActiveCell(entryIndexOf(entry, rowIdx), colIndex),
1029
1420
  'mg-cell-selected': grid.isCellInRange(entryIndexOf(entry, rowIdx), colIndex),
1030
1421
  'mg-cell-editing': isEditingCell(entryIndexOf(entry, rowIdx), col),
1031
1422
  'mg-cell-invalid': !!cellErrorOf(entry, col),
1423
+ 'mg-multiline': !!col.multiLine,
1032
1424
  'mg-pinned': !!col.pinned,
1033
1425
  'mg-pin-left-edge': colIndex === lastLeftPinIdx,
1034
1426
  'mg-pin-right-edge': colIndex === firstRightPinIdx,
1035
1427
  },
1036
1428
  cellClassOf(entry, rowIdx, col),
1429
+ cellNoteOf(entry, col) && 'mg-cell-note',
1037
1430
  ]"
1038
- :title="cellErrorOf(entry, col) || undefined"
1431
+ role="gridcell"
1432
+ :title="
1433
+ cellErrorOf(entry, col) ||
1434
+ grid.getCellTooltip(rowDataOf(entry), col) ||
1435
+ cellNoteOf(entry, col) ||
1436
+ undefined
1437
+ "
1039
1438
  :style="[
1040
1439
  pinStyleOf(col),
1041
1440
  colIndex === 0 && leafDepthOf(entry)
1042
1441
  ? { paddingLeft: `${leafDepthOf(entry) * 16 + 12}px` }
1043
1442
  : undefined,
1443
+ grid.getCellStyle(
1444
+ rowDataOf(entry),
1445
+ entryIndexOf(entry, rowIdx),
1446
+ col,
1447
+ ) ?? undefined,
1044
1448
  ]"
1045
- @click="grid.setActiveCell(entryIndexOf(entry, rowIdx), colIndex)"
1046
- @dblclick="grid.startEditing(entryIndexOf(entry, rowIdx), colIndex)"
1449
+ :data-mg-row="entryIndexOf(entry, rowIdx)"
1450
+ :data-mg-col="colIndex"
1451
+ @mousedown="
1452
+ onCellMouseDown(
1453
+ $event,
1454
+ entryIndexOf(entry, rowIdx),
1455
+ colIndex,
1456
+ col,
1457
+ )
1458
+ "
1459
+ @mouseenter="
1460
+ onCellMouseEnter(entryIndexOf(entry, rowIdx), colIndex)
1461
+ "
1462
+ @click="
1463
+ onCellClick(entryIndexOf(entry, rowIdx), colIndex)
1464
+ "
1465
+ @dblclick="
1466
+ grid.notifyCellEvent('cellDblClick', entryIndexOf(entry, rowIdx), colIndex);
1467
+ grid.startEditing(entryIndexOf(entry, rowIdx), colIndex);
1468
+ "
1469
+ @contextmenu="onCellContextMenu($event, entryIndexOf(entry, rowIdx), col)"
1047
1470
  >
1048
1471
  <button
1049
1472
  v-if="colIndex === 0 && leafHasChildren(entry) !== undefined"
@@ -1056,6 +1479,11 @@ watch(
1056
1479
  >
1057
1480
  {{ leafHasChildren(entry) ? (leafExpanded(entry) ? "▾" : "▸") : "" }}
1058
1481
  </button>
1482
+ <span
1483
+ v-if="grid.isActiveCell(entryIndexOf(entry, rowIdx), colIndex) && !isEditingCell(entryIndexOf(entry, rowIdx), col)"
1484
+ class="mg-fill-handle"
1485
+ @mousedown="onFillMouseDown"
1486
+ ></span>
1059
1487
  <span
1060
1488
  v-if="col.rowDrag && !isEditingCell(entryIndexOf(entry, rowIdx), col)"
1061
1489
  class="mg-row-drag-handle"
@@ -1076,7 +1504,7 @@ watch(
1076
1504
  v-if="col.cellEditor === 'select'"
1077
1505
  class="mg-editor"
1078
1506
  :class="{ 'mg-editor-error': state.editError }"
1079
- :value="String(state.editValue || '')"
1507
+ :value="editorInputValue(state.editValue)"
1080
1508
  @change="onEditorInput"
1081
1509
  @keydown="onEditorKeydown"
1082
1510
  @click.stop
@@ -1086,17 +1514,87 @@ watch(
1086
1514
  {{ opt }}
1087
1515
  </option>
1088
1516
  </select>
1517
+ <select
1518
+ v-else-if="col.cellEditor === 'multiselect'"
1519
+ class="mg-editor"
1520
+ :class="{ 'mg-editor-error': state.editError }"
1521
+ multiple
1522
+ :size="Math.min(Math.max((col.editorOptions || []).length, 2), 8)"
1523
+ @change="onMultiselectChange"
1524
+ @keydown="onEditorKeydown"
1525
+ @click.stop
1526
+ @mousedown.stop
1527
+ >
1528
+ <option
1529
+ v-for="opt in col.editorOptions || []"
1530
+ :key="opt"
1531
+ :value="opt"
1532
+ :selected="isEditOptSelected(opt)"
1533
+ >
1534
+ {{ opt }}
1535
+ </option>
1536
+ </select>
1537
+ <div
1538
+ v-else-if="col.cellEditor === 'radio'"
1539
+ class="mg-radio-group"
1540
+ role="radiogroup"
1541
+ >
1542
+ <label
1543
+ v-for="opt in col.editorOptions || []"
1544
+ :key="opt"
1545
+ class="mg-radio-label"
1546
+ >
1547
+ <input
1548
+ type="radio"
1549
+ :checked="String(state.editValue ?? '') === opt"
1550
+ @change="onRadioPick(opt, entryIndexOf(entry, rowIdx), colIndex)"
1551
+ @click.stop
1552
+ @mousedown.stop
1553
+ />
1554
+ <span>{{ opt }}</span>
1555
+ </label>
1556
+ </div>
1557
+ <textarea
1558
+ v-else-if="col.cellEditor === 'textarea'"
1559
+ class="mg-editor mg-editor-textarea"
1560
+ :class="{ 'mg-editor-error': state.editError }"
1561
+ :value="editorInputValue(state.editValue)"
1562
+ @input="onEditorInput"
1563
+ @keydown="onTextareaKeydown"
1564
+ @blur="grid.commitEditing()"
1565
+ @click.stop
1566
+ @dblclick.stop
1567
+ @mousedown.stop
1568
+ />
1089
1569
  <input
1090
1570
  v-else
1091
1571
  :type="editorInputType(col)"
1092
1572
  class="mg-editor"
1093
1573
  :class="{ 'mg-editor-error': state.editError }"
1094
- :value="String(state.editValue || '')"
1574
+ :value="editorInputValue(state.editValue)"
1575
+ :list="
1576
+ editorInputType(col) === 'text' && col.editorOptions?.length
1577
+ ? `mg-dl-${col.field}`
1578
+ : undefined
1579
+ "
1095
1580
  @input="onEditorInput"
1096
1581
  @keydown="onEditorKeydown"
1097
1582
  @click.stop
1098
1583
  @mousedown.stop
1099
1584
  />
1585
+ <datalist
1586
+ v-if="
1587
+ editorInputType(col) === 'text' &&
1588
+ col.editorOptions?.length
1589
+ "
1590
+ :id="`mg-dl-${col.field}`"
1591
+ >
1592
+ <option
1593
+ v-for="opt in col.editorOptions"
1594
+ :key="opt"
1595
+ :value="opt"
1596
+ />
1597
+ </datalist>
1100
1598
  </slot>
1101
1599
  <span v-if="state.editError" class="mg-edit-error">{{ state.editError }}</span>
1102
1600
  </template>
@@ -1108,9 +1606,64 @@ watch(
1108
1606
  :row="rowDataOf(entry)"
1109
1607
  :column="col"
1110
1608
  >
1111
- {{ grid.getCellText(rowDataOf(entry), col) }}
1609
+ <img
1610
+ v-if="col.cellType === 'image' && grid.getCellValue(rowDataOf(entry), col) != null"
1611
+ class="mg-cell-image"
1612
+ :src="String(grid.getCellValue(rowDataOf(entry), col))"
1613
+ :alt="col.cellOptions?.alt?.(rowDataOf(entry)) ?? ''"
1614
+ />
1615
+ <button
1616
+ v-else-if="col.cellType === 'button'"
1617
+ type="button"
1618
+ class="mg-cell-button"
1619
+ @click.stop="col.cellOptions?.onClick?.(rowDataOf(entry))"
1620
+ @dblclick.stop
1621
+ >
1622
+ {{ grid.getCellText(rowDataOf(entry), col) }}
1623
+ </button>
1624
+ <a
1625
+ v-else-if="col.cellType === 'link'"
1626
+ class="mg-cell-link"
1627
+ :href="cellLinkHref(rowDataOf(entry), col)"
1628
+ :target="col.cellOptions?.target ?? '_blank'"
1629
+ rel="noreferrer"
1630
+ @click.stop
1631
+ >
1632
+ {{ grid.getCellText(rowDataOf(entry), col) }}
1633
+ </a>
1634
+ <span
1635
+ v-else-if="col.cellType === 'progress'"
1636
+ class="mg-cell-progress"
1637
+ role="progressbar"
1638
+ :aria-valuenow="progressValueOf(rowDataOf(entry), col)"
1639
+ :aria-valuemax="col.cellOptions?.max ?? 100"
1640
+ >
1641
+ <span
1642
+ class="mg-cell-progress-bar"
1643
+ :style="{ width: `${progressPctOf(rowDataOf(entry), col)}%` }"
1644
+ />
1645
+ <span class="mg-cell-progress-text">{{ Math.round(progressPctOf(rowDataOf(entry), col)) }}%</span>
1646
+ </span>
1647
+ <!-- XSS 주의: html 셀은 신뢰할 수 있는 HTML만 -->
1648
+ <span
1649
+ v-else-if="col.cellType === 'html'"
1650
+ class="mg-cell-html"
1651
+ v-html="grid.getCellText(rowDataOf(entry), col)"
1652
+ />
1653
+ <input
1654
+ v-else-if="col.cellEditor === 'checkbox'"
1655
+ type="checkbox"
1656
+ class="mg-cell-checkbox"
1657
+ :checked="grid.isCellChecked(rowDataOf(entry), col)"
1658
+ :disabled="col.editable === false"
1659
+ @click.stop
1660
+ @dblclick.stop
1661
+ @change="grid.toggleCellChecked(rowDataOf(entry), col)"
1662
+ />
1663
+ <template v-else>{{ grid.getCellText(rowDataOf(entry), col) }}</template>
1112
1664
  </slot>
1113
1665
  </td>
1666
+ </template>
1114
1667
  </tr>
1115
1668
  </template>
1116
1669
  <tr
@@ -1127,6 +1680,7 @@ watch(
1127
1680
  >
1128
1681
  <td v-if="rowStatus" class="mg-status-cell" />
1129
1682
  <td v-if="rowCheckboxes" class="mg-check-cell" />
1683
+ <td v-if="rowNumbers" class="mg-rownum-cell" />
1130
1684
  <td
1131
1685
  v-for="(col, colIndex) in state.visibleColumns"
1132
1686
  :key="col.field"
@@ -1140,11 +1694,28 @@ watch(
1140
1694
  {{ grid.getCellText(prow, col) }}
1141
1695
  </td>
1142
1696
  </tr>
1697
+ <tr
1698
+ v-if="state.appendScroll && (state.appendScroll.loading || state.appendScroll.hasMore)"
1699
+ class="mg-append-row"
1700
+ >
1701
+ <td :colspan="colSpan">
1702
+ <span v-if="state.appendScroll.loading">{{ state.locale.loadingMore }}</span>
1703
+ <button
1704
+ v-else
1705
+ type="button"
1706
+ class="mg-append-btn"
1707
+ @click="onLoadMore"
1708
+ >
1709
+ 더 보기
1710
+ </button>
1711
+ </td>
1712
+ </tr>
1143
1713
  </tbody>
1144
1714
  <tfoot v-if="state.grandTotals">
1145
1715
  <tr class="mg-total-row">
1146
1716
  <td v-if="rowStatus" class="mg-status-cell" />
1147
1717
  <td v-if="rowCheckboxes" class="mg-check-cell" />
1718
+ <td v-if="rowNumbers" class="mg-rownum-cell" />
1148
1719
  <td
1149
1720
  v-for="(col, colIndex) in state.visibleColumns"
1150
1721
  :key="col.field"
@@ -1161,12 +1732,12 @@ watch(
1161
1732
  >
1162
1733
  {{ formatAggregate(state.grandTotals[col.field]) }}
1163
1734
  </span>
1164
- <template v-else-if="colIndex === 0">합계</template>
1735
+ <template v-else-if="colIndex === 0">{{ state.locale.totalLabel }}</template>
1165
1736
  </td>
1166
1737
  </tr>
1167
1738
  </tfoot>
1168
1739
  </table>
1169
- <div v-if="state.serverSide?.loading" class="mg-loading">Loading…</div>
1740
+ <div v-if="state.serverSide?.loading" class="mg-loading">{{ state.locale.loadingMore }}</div>
1170
1741
  </div>
1171
1742
  <div
1172
1743
  v-if="statusBar && state.selectionAggregates"
@@ -1186,7 +1757,7 @@ watch(
1186
1757
  </span>
1187
1758
  </span>
1188
1759
  <span>
1189
- 합계
1760
+ {{ state.locale.totalLabel }}
1190
1761
  <span class="mg-status-value">
1191
1762
  {{ formatAggregate(state.selectionAggregates.sum) }}
1192
1763
  </span>
@@ -1211,5 +1782,32 @@ watch(
1211
1782
  </span>
1212
1783
  </template>
1213
1784
  </div>
1785
+ <template v-if="state.contextMenu">
1786
+ <div
1787
+ class="mg-ctx-overlay"
1788
+ @click="grid.closeContextMenu()"
1789
+ @contextmenu.prevent="grid.closeContextMenu()"
1790
+ />
1791
+ <ul
1792
+ class="mg-ctx-menu"
1793
+ role="menu"
1794
+ :style="{ left: `${state.contextMenu.x}px`, top: `${state.contextMenu.y}px` }"
1795
+ >
1796
+ <template v-for="item in state.contextMenu.items" :key="item.id">
1797
+ <li v-if="item.separator" class="mg-ctx-separator" role="separator" />
1798
+ <li v-else role="none">
1799
+ <button
1800
+ type="button"
1801
+ role="menuitem"
1802
+ class="mg-ctx-item"
1803
+ :disabled="item.disabled"
1804
+ @click="grid.runContextMenuItem(item.id)"
1805
+ >
1806
+ {{ item.label }}
1807
+ </button>
1808
+ </li>
1809
+ </template>
1810
+ </ul>
1811
+ </template>
1214
1812
  </div>
1215
1813
  </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moda-grid/vue2",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "Vue 2.7 adapter for @moda-grid — DataGrid SFC and useGrid composable",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,7 +35,7 @@
35
35
  "grid"
36
36
  ],
37
37
  "dependencies": {
38
- "@moda-grid/core": "0.3.0"
38
+ "@moda-grid/core": "0.4.1"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "vue": "^2.7.0"