@moda-grid/vue2 0.4.1 → 1.0.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.
package/README.md CHANGED
@@ -21,4 +21,5 @@ const { grid } = useGrid({ columns, data });
21
21
  ```
22
22
 
23
23
  - 문서: https://github.com/park-taejoon/moda-grid-releases
24
- - 소스/이슈: https://github.com/park-taejoon/moda-grid
24
+ - 홈페이지: https://www.modaolive.com/download/modagrid
25
+ - 이슈: https://github.com/park-taejoon/moda-grid-releases/issues
package/dist/DataGrid.vue CHANGED
@@ -17,8 +17,10 @@ import {
17
17
  formatAggregate,
18
18
  } from "@moda-grid/core";
19
19
  import type {
20
+ AggregateFn,
20
21
  AppendScrollOptions,
21
22
  PivotOptions,
23
+ PivotZone,
22
24
  ContextMenuItem,
23
25
  GridLocale,
24
26
  CellEditorContext,
@@ -52,6 +54,8 @@ function editorInputValue(v: unknown): string {
52
54
 
53
55
  const props = defineProps({
54
56
  columns: { type: Array as PropType<ColumnDef[]>, required: true },
57
+ /** 모든 컬럼에 적용되는 공통 기본값 — 컬럼 명시 속성이 우선 (defaultColDef 대응) */
58
+ defaultColDef: { type: Object as PropType<Partial<ColumnDef>>, default: undefined },
55
59
  /** 행 데이터. `grid`를 직접 넘기는 제어 모드에서는 생략 가능 */
56
60
  data: { type: Array as PropType<Record<string, unknown>[]>, default: undefined },
57
61
  /** 외부에서 생성/관리하는 GridCore. 생략하면 내부 인스턴스 생성 */
@@ -104,6 +108,36 @@ const props = defineProps({
104
108
  groupPanel: { type: Boolean, default: false },
105
109
  /** multiLine 셀 내용만큼 행 높이 자동 확장 — 가상 스크롤에서는 무시 */
106
110
  autoRowHeight: { type: Boolean, default: false },
111
+ /** 채우기 시 숫자/날짜 소스를 등차·날짜 수열로 채움 — 엑셀 자동 채우기 */
112
+ fillSeries: { type: Boolean, default: false },
113
+ /** API/붙여넣기 등으로 바뀐 셀을 잠깐 강조 — 변경 플래시 */
114
+ cellFlash: { type: Boolean, default: false },
115
+ /** 복사 시 표시 문자열(formatter/format 적용) 사용 */
116
+ copyFormatted: { type: Boolean, default: false },
117
+ singleClickEdit: { type: Boolean, default: false },
118
+ /** 편집 단위 — "cell"(기본) / "fullRow"(행 전체 동시 편집) */
119
+ editType: { type: String as () => "cell" | "fullRow", default: "cell" },
120
+ /** 그리드 상단에 찾기 바 표시 — Enter 다음 매치 / Shift+Enter 이전 매치 */
121
+ findBox: { type: Boolean, default: false },
122
+ /** filterable 컬럼 헤더에 값 목록 필터 드롭다운 버튼 표시 — 엑셀 autofilter */
123
+ headerFilters: { type: Boolean, default: false },
124
+ /** 피벗 필드 패널 표시 — 필드 칩을 행/열/값 존으로 드래그해 피벗 구성 */
125
+ pivotPanel: { type: Boolean, default: false },
126
+ /** 헤더 영역 전체 높이(px) — 헤더 행 수로 균등 분할 */
127
+ headerHeight: { type: Number, default: undefined },
128
+ /** 파이프라인에서 숨길 행 id 목록 — 정렬/필터/집계에서 제외, 원본 데이터는 유지 */
129
+ hiddenRowIds: { type: Array as PropType<readonly string[]>, default: undefined },
130
+ /** zebra 줄무늬 행 배경 — 짝수 표시 행에 --grid-stripe-bg */
131
+ striped: { type: Boolean, default: false },
132
+ /** 편집 진입 직전 훅 — 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 },
107
141
  /** 선언형 이벤트 핸들러 — 마운트 시 구독, 언마운트 시 해제 (grid.on과 동일) */
108
142
  events: { type: Object as PropType<GridEventHandlers>, default: undefined },
109
143
  /** GridCore 인스턴스가 준비되면 한 번 호출 — props 모드에서도 grid API 접근 가능 */
@@ -115,6 +149,7 @@ const internal = props.grid
115
149
  ? null
116
150
  : useGrid({
117
151
  columns: props.columns,
152
+ defaultColDef: props.defaultColDef,
118
153
  data: props.data ?? [],
119
154
  getRowId: props.getRowId,
120
155
  serverSide: props.serverSide,
@@ -126,6 +161,20 @@ const internal = props.grid
126
161
  contextMenu: props.contextMenu,
127
162
  headerContextMenu: props.headerContextMenu,
128
163
  autoRowHeight: props.autoRowHeight,
164
+ fillSeries: props.fillSeries,
165
+ cellFlash: props.cellFlash,
166
+ copyFormatted: props.copyFormatted,
167
+ singleClickEdit: props.singleClickEdit,
168
+ editType: props.editType,
169
+ headerHeight: props.headerHeight,
170
+ hiddenRowIds: props.hiddenRowIds ? [...props.hiddenRowIds] : undefined,
171
+ striped: props.striped,
172
+ beforeEdit: props.beforeEdit,
173
+ isRowSelectable: props.isRowSelectable,
174
+ externalFilter: props.externalFilter,
175
+ postSort: props.postSort,
176
+ beforePaste: props.beforePaste,
177
+ beforeCopy: props.beforeCopy,
129
178
  virtualScroll:
130
179
  props.height != null && props.rowHeight != null && props.rowHeight > 0
131
180
  ? {
@@ -182,6 +231,23 @@ watchEffect(() => {
182
231
  watchEffect(() => {
183
232
  if (props.selectionMode) grid.setSelectionMode(props.selectionMode);
184
233
  });
234
+ watchEffect(() => {
235
+ grid.setHiddenRows([...(props.hiddenRowIds ?? [])]);
236
+ });
237
+ watchEffect(() => {
238
+ grid.setHeaderHeight(props.headerHeight ?? null);
239
+ });
240
+ watchEffect(() => {
241
+ grid.setStriped(props.striped ?? false);
242
+ });
243
+ watchEffect(() => {
244
+ grid.setBeforeEdit(props.beforeEdit ?? null);
245
+ grid.setIsRowSelectable(props.isRowSelectable ?? null);
246
+ grid.setExternalFilter(props.externalFilter ?? null);
247
+ grid.setPostSort(props.postSort ?? null);
248
+ grid.setBeforePaste(props.beforePaste ?? null);
249
+ grid.setBeforeCopy(props.beforeCopy ?? null);
250
+ });
185
251
 
186
252
  // 가상 스크롤: 코어가 보정한 scrollTop을 DOM에 동기화 (키보드 scrollIntoView)
187
253
  const scrollEl = ref<HTMLElement | null>(null);
@@ -200,20 +266,235 @@ watch(
200
266
  if (!req) return;
201
267
  await nextTick();
202
268
  (scrollEl.value ?? hostEl.value)
203
- ?.querySelector<HTMLElement>(`td[data-mg-row="${req.rowIndex}"]`)
204
- ?.scrollIntoView({ block: "nearest" });
269
+ ?.querySelector<HTMLElement>(
270
+ `td[data-mg-row="${req.rowIndex}"]` +
271
+ (req.columnIndex != null
272
+ ? `[data-mg-col="${req.columnIndex}"]`
273
+ : ""),
274
+ )
275
+ ?.scrollIntoView({ block: "nearest", inline: "nearest" });
205
276
  },
206
277
  );
207
278
 
208
279
  // autoRowHeight prop → core 동기화 (제어 모드 포함)
209
280
  watchEffect(() => grid.setAutoRowHeight(!!props.autoRowHeight));
281
+ // fillSeries prop → core 동기화 (제어 모드 포함)
282
+ watchEffect(() => grid.setFillSeries(!!props.fillSeries));
283
+ // cellFlash prop → core 동기화
284
+ watchEffect(() => grid.setCellFlash(!!props.cellFlash));
285
+ // copyFormatted prop → core 동기화
286
+ watchEffect(() => grid.setCopyFormatted(!!props.copyFormatted));
287
+ watchEffect(() => grid.setSingleClickEdit(!!props.singleClickEdit));
288
+ watchEffect(() => grid.setEditType(props.editType ?? "cell"));
289
+
290
+ // 찾기 바 — findNext로 다음/이전 매치 순환 (Enter / Shift+Enter)
291
+ const findInputEl = ref<HTMLInputElement | null>(null);
292
+ const findCount = ref("");
293
+ // 찾기 옵션 — 대소문자 구분 / 셀 전체 일치 (타사 그리드 찾기 옵션 대응)
294
+ const findCaseSensitive = ref(false);
295
+ const findWholeCell = ref(false);
296
+ function currentFindOpts() {
297
+ return {
298
+ caseSensitive: findCaseSensitive.value,
299
+ wholeCell: findWholeCell.value,
300
+ };
301
+ }
302
+ function onFindOptChange() {
303
+ const q = findInputEl.value?.value ?? "";
304
+ grid.setFindQuery(q || null, currentFindOpts());
305
+ findCount.value = q ? `${grid.findCells(q, currentFindOpts()).length}건` : "";
306
+ }
307
+ // Vue2 템플릿은 TS 캐스트 미지원 — 체크박스 change는 스크립트 메서드로 처리
308
+ function onFindCaseChange(e: Event) {
309
+ findCaseSensitive.value = (e.target as HTMLInputElement).checked;
310
+ onFindOptChange();
311
+ }
312
+ function onFindWholeChange(e: Event) {
313
+ findWholeCell.value = (e.target as HTMLInputElement).checked;
314
+ onFindOptChange();
315
+ }
316
+ function goFind(backward: boolean) {
317
+ const q = findInputEl.value?.value ?? "";
318
+ grid.setFindQuery(q || null, currentFindOpts()); // 매치 셀 하이라이트
319
+ const total = grid.findCells(q, currentFindOpts()).length;
320
+ findCount.value = q ? `${total}건` : "";
321
+ if (!q || !total) return;
322
+ const m = grid.findNext(q, { ...currentFindOpts(), backward });
323
+ if (m) {
324
+ hostEl.value
325
+ ?.querySelector<HTMLElement>(
326
+ `td[data-mg-row="${m.rowIndex}"][data-mg-col="${m.columnIndex}"]`,
327
+ )
328
+ ?.scrollIntoView({ block: "nearest", inline: "nearest" });
329
+ }
330
+ }
331
+ function onFindKeydown(e: KeyboardEvent) {
332
+ if (e.isComposing) return; // IME 조합 확정 Enter가 매치 이동으로 오작동하지 않도록
333
+ if (e.key === "Enter") {
334
+ e.preventDefault();
335
+ goFind(e.shiftKey);
336
+ }
337
+ e.stopPropagation(); // 그리드 키 내비와 충돌 방지
338
+ }
339
+ function onFindInput(e: Event) {
340
+ const q = (e.target as HTMLInputElement).value;
341
+ grid.setFindQuery(q || null, currentFindOpts()); // 입력 즉시 매치 하이라이트
342
+ findCount.value = q ? `${grid.findCells(q, currentFindOpts()).length}건` : "";
343
+ }
210
344
 
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;
345
+ // 헤더 필터 드롭다운 — 엑셀 autofilter식 값 체크리스트 (한 번에 하나)
346
+ const filterDrop = ref<{ field: string; x: number; y: number } | null>(null);
347
+ function toggleFilterDrop(col: ColumnDef, e: MouseEvent) {
348
+ e.stopPropagation();
349
+ if (filterDrop.value?.field === col.field) {
350
+ filterDrop.value = null;
351
+ return;
352
+ }
353
+ const b = (e.currentTarget as HTMLElement).getBoundingClientRect();
354
+ const h = hostEl.value?.getBoundingClientRect();
355
+ filterDrop.value = {
356
+ field: col.field,
357
+ x: b.right - (h?.left ?? 0),
358
+ y: b.bottom - (h?.top ?? 0) + 4,
359
+ };
360
+ }
361
+ const filterDropCol = computed(() =>
362
+ filterDrop.value
363
+ ? (state.value.columns.find((c) => c.field === filterDrop.value!.field) ??
364
+ null)
365
+ : null,
366
+ );
367
+ const filterDropAll = computed(() =>
368
+ filterDropCol.value
369
+ ? grid.getUniqueValues(filterDropCol.value.field)
370
+ : [],
371
+ );
372
+ const filterDropActive = computed(() =>
373
+ filterDropCol.value
374
+ ? state.value.filters[filterDropCol.value.field]?.values
375
+ : undefined,
376
+ );
377
+ function filterDropChecked(v: string) {
378
+ const active = filterDropActive.value;
379
+ return active ? active.includes(v) : true;
380
+ }
381
+ function toggleFilterValue(v: string) {
382
+ const col = filterDropCol.value;
383
+ if (!col) return;
384
+ const all = filterDropAll.value;
385
+ const next = new Set(filterDropActive.value ?? all);
386
+ if (next.has(v)) next.delete(v);
387
+ else next.add(v);
388
+ if (next.size >= all.length) grid.setFilter(col.field, null);
389
+ else
390
+ grid.setFilter(col.field, {
391
+ operator: "set",
392
+ value: "",
393
+ values: [...next],
394
+ });
395
+ }
396
+ function onFilterDropKeydown(e: KeyboardEvent) {
397
+ e.stopPropagation();
398
+ if (e.key === "Escape") filterDrop.value = null;
399
+ }
400
+
401
+ // ── 피벗 필드 패널 — 필드 칩을 행/열/값 존으로 드래그해 피벗 구성 ──
402
+ const PIVOT_DATA_TYPE = "application/x-mg-pivot";
403
+ const PIVOT_AGGS: AggregateFn[] = ["sum", "avg", "min", "max", "count"];
404
+ const pivotDropZone = ref<string | null>(null);
405
+ function pivotHeaderOf(field: string) {
406
+ return (
407
+ state.value.sourceColumns.find((c) => c.field === field)?.header ?? field
408
+ );
409
+ }
410
+ function onPivotAggChange(field: string, e: Event) {
411
+ const v = (e.target as HTMLSelectElement).value;
412
+ grid.setPivotValueAgg(field, v as AggregateFn);
413
+ }
414
+ function pivotChipsOf(zone: string) {
415
+ const p = state.value.pivot;
416
+ if (zone === "fields")
417
+ return state.value.sourceColumns.map((c) => ({
418
+ field: c.field,
419
+ label: c.header ?? c.field,
420
+ agg: undefined as AggregateFn | undefined,
421
+ }));
422
+ if (zone === "values")
423
+ return (p?.values ?? []).map((v) => ({
424
+ field: v.field,
425
+ label: pivotHeaderOf(v.field),
426
+ agg: v.agg,
427
+ }));
428
+ const list = zone === "rows" ? (p?.rows ?? []) : (p?.columns ?? []);
429
+ return list.map((f) => ({
430
+ field: f,
431
+ label: pivotHeaderOf(f),
432
+ agg: undefined as AggregateFn | undefined,
433
+ }));
434
+ }
435
+ const pivotPlaced = computed(
436
+ () =>
437
+ new Set<string>([
438
+ ...(state.value.pivot?.rows ?? []),
439
+ ...(state.value.pivot?.columns ?? []),
440
+ ...(state.value.pivot?.values.map((v) => v.field) ?? []),
441
+ ]),
442
+ );
443
+ function pivotZoneLabel(zone: string) {
444
+ return zone === "fields"
445
+ ? state.value.locale.pivotFieldsLabel
446
+ : zone === "rows"
447
+ ? state.value.locale.pivotRowsLabel
448
+ : zone === "columns"
449
+ ? state.value.locale.pivotColumnsLabel
450
+ : state.value.locale.pivotValuesLabel;
451
+ }
452
+ function pivotDragField(e: DragEvent): string {
453
+ return (
454
+ e.dataTransfer?.getData(PIVOT_DATA_TYPE) ||
455
+ e.dataTransfer?.getData("application/x-mg-column") ||
456
+ ""
457
+ );
458
+ }
459
+ function pivotDragAccepts(e: DragEvent): boolean {
460
+ const t = e.dataTransfer?.types;
461
+ return !!t && (t.includes(PIVOT_DATA_TYPE) || t.includes("application/x-mg-column"));
462
+ }
463
+ function onPivotZoneDragOver(zone: string, e: DragEvent) {
464
+ if (!pivotDragAccepts(e)) return;
465
+ e.preventDefault();
466
+ e.dataTransfer!.dropEffect = "move";
467
+ pivotDropZone.value = zone;
468
+ }
469
+ function onPivotZoneDrop(zone: string, e: DragEvent, index?: number) {
470
+ const f = pivotDragField(e);
471
+ pivotDropZone.value = null;
472
+ if (!f) return;
473
+ e.preventDefault();
474
+ e.stopPropagation();
475
+ if (zone === "fields") grid.removePivotField(f as string);
476
+ else grid.addPivotField(zone as PivotZone, f as string, { index });
477
+ }
478
+ function onPivotChipDragStart(field: string, e: DragEvent) {
479
+ e.dataTransfer!.effectAllowed = "move";
480
+ e.dataTransfer!.setData(PIVOT_DATA_TYPE, field);
481
+ }
482
+ function onPivotChipDragOver(e: DragEvent) {
483
+ if (!pivotDragAccepts(e)) return;
484
+ e.preventDefault();
485
+ e.stopPropagation();
486
+ }
487
+
488
+ // 행 높이 + rowStyle — 가상 스크롤은 고정, 아니면 autoRowHeight 추정치 적용
489
+ function rowStyleOf(entry: AnyRow, rowIdx: number) {
490
+ const row = rowDataOf(entry);
491
+ const base: Record<string, string> = {};
492
+ const h = virtual.value && props.rowHeight ? props.rowHeight : grid.getRowHeight(row);
493
+ if (h) base.height = `${h}px`;
494
+ // GridOptions/ColumnDef.rowStyle — kebab-case 맵 병합 (Vue :style이 그대로 적용)
495
+ const custom = grid.getRowStyle(row, entryIndexOf(entry, rowIdx));
496
+ if (custom) Object.assign(base, custom);
497
+ return Object.keys(base).length ? base : undefined;
217
498
  }
218
499
 
219
500
  // 그룹 패널 칩 — 클릭 시 해당 컬럼 그룹 해제
@@ -223,6 +504,27 @@ function ungroupField(field: string) {
223
504
  );
224
505
  }
225
506
 
507
+ // 헤더 컬럼을 그룹 패널에 드롭 → 그룹에 추가 (타사 그리드 그룹 패널 드래그)
508
+ const groupDropOver = ref(false);
509
+ function onGroupPanelDragOver(event: DragEvent) {
510
+ if (event.dataTransfer?.types.includes("application/x-mg-column")) {
511
+ event.preventDefault();
512
+ event.dataTransfer.dropEffect = "copy";
513
+ groupDropOver.value = true;
514
+ }
515
+ }
516
+ function onGroupPanelDrop(event: DragEvent) {
517
+ event.preventDefault();
518
+ groupDropOver.value = false;
519
+ const field = event.dataTransfer?.getData("application/x-mg-column");
520
+ if (field && !state.value.groupBy.includes(field)) {
521
+ grid.setGroupBy([
522
+ ...state.value.groupBy,
523
+ field,
524
+ ] as (keyof RowT & string)[]);
525
+ }
526
+ }
527
+
226
528
  const virtual = computed(() => state.value.virtual);
227
529
  // 그룹화 시: displayRows(그룹 헤더 포함)를 virtual 인덱스로 슬라이스
228
530
  type RowT = Record<string, unknown>;
@@ -248,6 +550,17 @@ const hasFilterable = computed(() =>
248
550
  const hasFilterRow = computed(
249
551
  () => hasFilterable.value && state.value.filterRowVisible,
250
552
  );
553
+ // 고정 테이블 레이아웃용 최소 폭 — 전체 컬럼 너비 합(선행 셀 포함)
554
+ const tableMinWidth = computed(
555
+ () =>
556
+ (props.rowStatus ? 40 : 0) +
557
+ (props.rowCheckboxes ? 36 : 0) +
558
+ (props.rowNumbers ? 40 : 0) +
559
+ state.value.visibleColumns.reduce(
560
+ (s, c) => s + (c.width ?? DEFAULT_COLUMN_WIDTH),
561
+ 0,
562
+ ),
563
+ );
251
564
  const showOverlay = computed(
252
565
  () => props.columnController || (props.filterToggle && hasFilterable.value),
253
566
  );
@@ -490,6 +803,14 @@ type HeaderCell =
490
803
  rowSpan?: number;
491
804
  };
492
805
 
806
+ // headerHeight는 헤더 행 수로 균등 분할 (멀티레벨 헤더 대응)
807
+ const headerTrStyle = computed(() => {
808
+ const h = state.value.headerHeight;
809
+ if (h == null) return undefined;
810
+ const rows = state.value.headerGroups ? 2 : 1;
811
+ return { height: `${h / rows}px` };
812
+ });
813
+
493
814
  const headerRows = computed<HeaderCell[][]>(() => {
494
815
  const spans = state.value.headerGroups;
495
816
  const cols = state.value.visibleColumns;
@@ -609,6 +930,7 @@ function onDragStart(col: ColumnDef, event: DragEvent) {
609
930
  if (event.dataTransfer) {
610
931
  event.dataTransfer.effectAllowed = "move";
611
932
  event.dataTransfer.setData("text/plain", col.field);
933
+ event.dataTransfer.setData("application/x-mg-column", col.field);
612
934
  }
613
935
  }
614
936
 
@@ -694,6 +1016,16 @@ function cellClassOf(entry: AnyRow, rowIdx: number, col: ColumnDef) {
694
1016
  return grid.getCellClass(row, entryIndexOf(entry, rowIdx), col);
695
1017
  }
696
1018
 
1019
+ /** find 하이라이트 — findBox 검색어에 매치되는 셀인지 (그룹 헤더 등 null 행 제외) */
1020
+ function isFindMatch(entry: AnyRow, col: ColumnDef): boolean {
1021
+ const row = rowDataOf(entry);
1022
+ return (
1023
+ !!state.value.findQuery &&
1024
+ row != null &&
1025
+ grid.isFindMatch(row, String(col.field))
1026
+ );
1027
+ }
1028
+
697
1029
  function onRowDragStart(rowIndex: number, event: DragEvent) {
698
1030
  if (!grid.beginRowDrag(rowIndex)) {
699
1031
  event.preventDefault();
@@ -738,6 +1070,7 @@ const CELL_KEYS: Record<string, CellNavigation> = {
738
1070
  };
739
1071
 
740
1072
  function onGridKeydown(event: KeyboardEvent) {
1073
+ if (event.isComposing) return; // IME 조합 중 — 조합 확정 키가 그리드 키로 해석되지 않도록
741
1074
  if ((event.target as HTMLElement).closest("input, textarea, select")) return;
742
1075
  // 클립보드/이력: Ctrl+C 복사, Ctrl+Shift+C 헤더 포함 복사,
743
1076
  // Ctrl+V 붙여넣기, Ctrl+Z 되돌리기, Ctrl+Y·Ctrl+Shift+Z 다시 실행
@@ -749,6 +1082,12 @@ function onGridKeydown(event: KeyboardEvent) {
749
1082
  event.preventDefault();
750
1083
  void navigator.clipboard?.writeText(tsv);
751
1084
  }
1085
+ } else if (key === "x") {
1086
+ const tsv = grid.cutSelectionTsv(); // 엑셀 Ctrl+X — 잘라내기
1087
+ if (tsv != null) {
1088
+ event.preventDefault();
1089
+ void navigator.clipboard?.writeText(tsv);
1090
+ }
752
1091
  } else if (key === "v") {
753
1092
  event.preventDefault();
754
1093
  void navigator.clipboard?.readText().then((text) => grid.pasteTsv(text));
@@ -768,6 +1107,38 @@ function onGridKeydown(event: KeyboardEvent) {
768
1107
  return;
769
1108
  event.preventDefault();
770
1109
  grid.selectAll();
1110
+ } else if (key === "f") {
1111
+ if (!props.findBox) return; // findBox 없으면 브라우저 검색에 양보
1112
+ event.preventDefault();
1113
+ findInputEl.value?.focus();
1114
+ findInputEl.value?.select();
1115
+ } else if (key === "d") {
1116
+ event.preventDefault();
1117
+ grid.fillDown(); // 엑셀 Ctrl+D — 아래 채우기
1118
+ } else if (key === "r") {
1119
+ event.preventDefault();
1120
+ grid.fillRight(); // 엑셀 Ctrl+R — 오른쪽 채우기
1121
+ } else if (event.key === "Home") {
1122
+ event.preventDefault();
1123
+ grid.navigateCell("first", event.shiftKey); // Ctrl+Home — 첫 셀
1124
+ } else if (event.key === "End") {
1125
+ event.preventDefault();
1126
+ grid.navigateCell("last", event.shiftKey); // Ctrl+End — 마지막 셀
1127
+ } else if (event.key === "ArrowUp") {
1128
+ event.preventDefault();
1129
+ grid.navigateCell("top", event.shiftKey);
1130
+ } else if (event.key === "ArrowDown") {
1131
+ event.preventDefault();
1132
+ grid.navigateCell("bottom", event.shiftKey);
1133
+ } else if (event.key === "ArrowLeft") {
1134
+ event.preventDefault();
1135
+ grid.navigateCell("home", event.shiftKey);
1136
+ } else if (event.key === "ArrowRight") {
1137
+ event.preventDefault();
1138
+ grid.navigateCell("end", event.shiftKey);
1139
+ } else if (event.key === " ") {
1140
+ event.preventDefault();
1141
+ grid.selectEntireColumn(); // 엑셀 Ctrl+Space — 열 선택
771
1142
  }
772
1143
  return;
773
1144
  }
@@ -777,12 +1148,30 @@ function onGridKeydown(event: KeyboardEvent) {
777
1148
  return;
778
1149
  }
779
1150
  if (event.key === "Delete" || event.key === "Backspace") {
780
- // 선택 범위(없으면 활성 셀) 내용 지우기 — IBSheet Del키 대응
1151
+ // 선택 영역(없으면 활성 셀) 내용 지우기 — 타사 그리드 Del키 대응
781
1152
  event.preventDefault();
782
1153
  grid.clearRange();
783
1154
  return;
784
1155
  }
785
1156
  const active = state.value.activeCell;
1157
+ if (event.key === " " && event.shiftKey) {
1158
+ // 엑셀 Shift+Space — 행 선택 (타이핑 경로보다 먼저 처리).
1159
+ // single-cell은 행 선택으로 대체되므로 selectable을 게이트한다
1160
+ if (
1161
+ state.value.selectionMode === "single-cell" &&
1162
+ props.selectable === false
1163
+ )
1164
+ return;
1165
+ event.preventDefault();
1166
+ grid.selectEntireRow();
1167
+ return;
1168
+ }
1169
+ if (event.key === "Tab" && active) {
1170
+ // 엑셀 Tab — 활성 셀 좌/우 이동
1171
+ event.preventDefault();
1172
+ grid.navigateCell(event.shiftKey ? "tabLeft" : "tabRight");
1173
+ return;
1174
+ }
786
1175
  if (event.key === "Enter" || event.key === "F2") {
787
1176
  // 활성 셀에서 Enter → 편집 진입
788
1177
  if (active) {
@@ -875,9 +1264,22 @@ function cellSpanOf(row: RowT, col: ColumnDef<RowT>) {
875
1264
  return grid.getCellSpan(row, col);
876
1265
  }
877
1266
 
878
- function isEditingCell(rowIndex: number, col: ColumnDef) {
879
- const cell = state.value.editingCell;
880
- return !!cell && cell.rowIndex === rowIndex && cell.columnKey === col.field;
1267
+ function isEditingCell(rowIndex: number, colIndex: number) {
1268
+ return grid.isEditing(rowIndex, colIndex);
1269
+ }
1270
+
1271
+ // fullRow 편집 — 셀별 보류 값/에러 (cell 모드면 단일 editValue/editError)
1272
+ function editValueOf(col: ColumnDef) {
1273
+ const s = state.value;
1274
+ if (s.editType === "fullRow" && s.editingValues)
1275
+ return s.editingValues[col.field];
1276
+ return s.editValue;
1277
+ }
1278
+ function editErrorOf(col: ColumnDef) {
1279
+ const s = state.value;
1280
+ if (s.editType === "fullRow" && s.editingErrors)
1281
+ return s.editingErrors[col.field] ?? null;
1282
+ return s.editError;
881
1283
  }
882
1284
 
883
1285
  // 마우스 드래그 범위 선택
@@ -894,10 +1296,22 @@ function onCellMouseDown(
894
1296
  colIndex: number,
895
1297
  col: ColumnDef,
896
1298
  ) {
897
- if (e.button !== 0 || isEditingCell(rowIndex, col)) return;
1299
+ if (e.button !== 0 || isEditingCell(rowIndex, colIndex)) return;
1300
+ // fullRow — 편집 행 안 클릭은 커밋/선택 변경 없이 통과
1301
+ if (
1302
+ state.value.editType === "fullRow" &&
1303
+ state.value.editingCell?.rowIndex === rowIndex
1304
+ )
1305
+ return;
898
1306
  suppressCellClick = false;
899
1307
  if (state.value.editingCell) grid.commitEditing();
900
- grid.setActiveCell(rowIndex, colIndex);
1308
+ if (e.ctrlKey || e.metaKey) {
1309
+ // Ctrl+드래그 — 기존 범위 유지 + 새 범위 추가
1310
+ grid.beginAdditionalRange(rowIndex, colIndex);
1311
+ suppressCellClick = true;
1312
+ } else {
1313
+ grid.setActiveCell(rowIndex, colIndex);
1314
+ }
901
1315
  cellDragging = true;
902
1316
  e.preventDefault(); // 드래그 중 텍스트 선택 방지
903
1317
  }
@@ -907,7 +1321,10 @@ function onCellMouseEnter(rowIndex: number, colIndex: number) {
907
1321
  grid.extendSelectionTo(rowIndex, colIndex);
908
1322
  }
909
1323
  function onCellClick(rowIndex: number, colIndex: number) {
910
- if (!suppressCellClick) grid.setActiveCell(rowIndex, colIndex);
1324
+ if (!suppressCellClick) {
1325
+ grid.setActiveCell(rowIndex, colIndex);
1326
+ grid.trySingleClickEdit(rowIndex, colIndex);
1327
+ }
911
1328
  suppressCellClick = false;
912
1329
  grid.notifyCellEvent("cellClick", rowIndex, colIndex);
913
1330
  }
@@ -924,36 +1341,57 @@ function editorInputType(col: ColumnDef) {
924
1341
  : "text";
925
1342
  }
926
1343
 
927
- function onEditorInput(event: Event) {
928
- grid.updateEditValue((event.target as HTMLInputElement | HTMLSelectElement).value);
1344
+ function onEditorInput(event: Event, col: ColumnDef) {
1345
+ grid.updateEditValue(
1346
+ (event.target as HTMLInputElement | HTMLSelectElement).value,
1347
+ col.field,
1348
+ );
929
1349
  }
930
1350
 
931
1351
  // multiselect 에디터 — 선택된 옵션들을 배열로 저장
932
- function isEditOptSelected(opt: string): boolean {
933
- const v = state.value.editValue;
1352
+ function isEditOptSelected(opt: string, col: ColumnDef): boolean {
1353
+ const v = editValueOf(col);
934
1354
  return Array.isArray(v) && (v as unknown[]).includes(opt);
935
1355
  }
936
1356
 
937
- function onMultiselectChange(event: Event) {
1357
+ function onMultiselectChange(event: Event, col: ColumnDef) {
938
1358
  const sel = event.target as HTMLSelectElement;
939
- grid.updateEditValue(Array.from(sel.selectedOptions).map((o) => o.value));
1359
+ grid.updateEditValue(
1360
+ Array.from(sel.selectedOptions).map((o) => o.value),
1361
+ col.field,
1362
+ );
1363
+ }
1364
+
1365
+ // 라디오 에디터 — 선택 즉시 커밋 (fullRow에서는 보류 값만 반영)
1366
+ function onRadioPick(opt: string, col: ColumnDef) {
1367
+ grid.updateEditValue(opt, col.field);
1368
+ if (state.value.editType !== "fullRow") grid.commitEditing();
940
1369
  }
941
1370
 
942
- // 라디오 에디터 — 선택 즉시 커밋 (IBSheet와 동일 UX)
943
- function onRadioPick(opt: string, _rowIndex: number, _colIndex: number) {
944
- grid.updateEditValue(opt);
945
- grid.commitEditing();
1371
+ // 커밋 후 이동 시 편집기 언마운트로 빠진 포커스를 그리드로 되돌린다
1372
+ function commitThenNavigate(
1373
+ dir: "up" | "down" | "left" | "right" | "tabLeft" | "tabRight",
1374
+ ) {
1375
+ if (grid.commitEditing()) {
1376
+ grid.navigateCell(dir);
1377
+ scrollEl.value?.focus();
1378
+ }
946
1379
  }
947
1380
 
948
1381
  // textarea: Enter=줄바꿈, Ctrl/Meta+Enter=커밋, Tab=저장+이동, Esc=취소
949
1382
  function onTextareaKeydown(event: KeyboardEvent) {
950
1383
  event.stopPropagation();
1384
+ if (event.isComposing) return;
951
1385
  if (event.key === "Enter" && (event.ctrlKey || event.metaKey)) {
952
1386
  event.preventDefault();
953
- if (grid.commitEditing()) grid.navigateCell("down");
1387
+ commitThenNavigate("down");
954
1388
  } else if (event.key === "Tab") {
955
1389
  event.preventDefault();
956
- if (grid.commitEditing()) grid.navigateCell(event.shiftKey ? "left" : "right");
1390
+ const dir = event.shiftKey ? "left" : "right";
1391
+ // fullRow — 행 안 다음 편집 셀로 포커스 이동, 끝이면 행 커밋
1392
+ if (state.value.editType === "fullRow" && grid.navigateEditingCell(dir))
1393
+ return;
1394
+ commitThenNavigate(dir === "left" ? "tabLeft" : "tabRight");
957
1395
  } else if (event.key === "Escape") {
958
1396
  event.preventDefault();
959
1397
  grid.cancelEditing();
@@ -963,33 +1401,175 @@ function onTextareaKeydown(event: KeyboardEvent) {
963
1401
  // 편집기 내부 키: Enter 저장, Tab 저장+이동, Escape 취소
964
1402
  function onEditorKeydown(event: KeyboardEvent) {
965
1403
  event.stopPropagation();
1404
+ if (event.isComposing) return; // IME 조합 확정 Enter가 커밋으로 오작동하지 않도록
966
1405
  if (event.key === "Enter") {
967
1406
  event.preventDefault();
968
- if (grid.commitEditing()) grid.navigateCell("down");
1407
+ if (event.ctrlKey || event.metaKey) {
1408
+ // 엑셀 Ctrl+Enter — 입력 값을 선택 범위 전체에 적용 (이동 없음)
1409
+ if (grid.commitEditing()) grid.fillActiveToSelection();
1410
+ } else commitThenNavigate("down");
969
1411
  } else if (event.key === "Tab") {
970
1412
  event.preventDefault();
971
- if (grid.commitEditing()) grid.navigateCell(event.shiftKey ? "left" : "right");
1413
+ const dir = event.shiftKey ? "left" : "right";
1414
+ if (state.value.editType === "fullRow" && grid.navigateEditingCell(dir))
1415
+ return;
1416
+ commitThenNavigate(dir === "left" ? "tabLeft" : "tabRight");
972
1417
  } else if (event.key === "Escape") {
973
1418
  event.preventDefault();
974
1419
  grid.cancelEditing();
975
1420
  }
976
1421
  }
977
1422
 
978
- // 편집 진입 시 에디터 포커스
1423
+ // 편집 진입 시 에디터 포커스 — fullRow에서는 포커스된 컬럼의 에디터를 찾는다
979
1424
  watch(
980
1425
  () => state.value.editingCell,
981
1426
  async (cell) => {
982
1427
  if (!cell) return;
983
1428
  await nextTick();
984
- scrollEl.value?.querySelector<HTMLElement>(".mg-editor")?.focus();
1429
+ const colIdx = state.value.visibleColumns.findIndex(
1430
+ (c) => c.field === cell.columnKey,
1431
+ );
1432
+ const target =
1433
+ scrollEl.value?.querySelector<HTMLElement>(
1434
+ `td[data-mg-col="${colIdx}"] .mg-editor`,
1435
+ ) ?? scrollEl.value?.querySelector<HTMLElement>(".mg-editor");
1436
+ target?.focus();
985
1437
  },
986
1438
  );
987
1439
  </script>
988
1440
 
989
1441
  <template>
990
- <div ref="hostEl" :class="showOverlay ? 'mg-colctl-host' : undefined">
1442
+ <div
1443
+ ref="hostEl"
1444
+ :class="[
1445
+ showOverlay ? 'mg-colctl-host' : undefined,
1446
+ theme && `grid-theme-${theme}`,
1447
+ state.striped && 'mg-striped',
1448
+ ]"
1449
+ >
1450
+ <!-- 피벗 필드 패널 — 칩을 존 사이로 드래그해 디멘션 구성 -->
1451
+ <div v-if="pivotPanel" class="mg-pivot-panel">
1452
+ <div
1453
+ v-for="zone in ['fields', 'rows', 'columns', 'values']"
1454
+ :key="zone"
1455
+ :class="['mg-pivot-zone', pivotDropZone === zone && 'mg-drop-over']"
1456
+ @dragover="onPivotZoneDragOver(zone, $event)"
1457
+ @dragleave="pivotDropZone = pivotDropZone === zone ? null : pivotDropZone"
1458
+ @drop="onPivotZoneDrop(zone, $event)"
1459
+ >
1460
+ <span class="mg-pivot-zone-label">{{ pivotZoneLabel(zone) }}</span>
1461
+ <span
1462
+ v-for="(chip, i) in pivotChipsOf(zone)"
1463
+ :key="chip.field"
1464
+ :class="[
1465
+ 'mg-pivot-chip',
1466
+ zone === 'fields' && pivotPlaced.has(chip.field) && 'mg-pivot-chip-placed',
1467
+ ]"
1468
+ draggable="true"
1469
+ @dragstart="onPivotChipDragStart(chip.field, $event)"
1470
+ @dragover="onPivotChipDragOver($event)"
1471
+ @drop="onPivotZoneDrop(zone, $event, i)"
1472
+ >
1473
+ {{ chip.label }}
1474
+ <select
1475
+ v-if="zone === 'values'"
1476
+ class="mg-pivot-agg"
1477
+ :value="chip.agg"
1478
+ @click.stop
1479
+ @change="onPivotAggChange(chip.field, $event)"
1480
+ >
1481
+ <option v-for="a in PIVOT_AGGS" :key="a" :value="a">{{ a }}</option>
1482
+ </select>
1483
+ <button
1484
+ v-if="zone !== 'fields'"
1485
+ type="button"
1486
+ class="mg-pivot-chip-x"
1487
+ :aria-label="`${chip.label} 제거`"
1488
+ @click="grid.removePivotField(chip.field)"
1489
+ >
1490
+ ×
1491
+ </button>
1492
+ </span>
1493
+ </div>
1494
+ </div>
1495
+
1496
+ <!-- 헤더 필터 드롭다운 — 엑셀 autofilter식 값 체크리스트 -->
1497
+ <template v-if="filterDrop && filterDropCol">
1498
+ <div class="mg-colctl-overlay" @click="filterDrop = null" />
1499
+ <div
1500
+ class="mg-colctl-panel mg-filter-drop-panel"
1501
+ :style="{ left: `${filterDrop.x}px`, top: `${filterDrop.y}px` }"
1502
+ role="dialog"
1503
+ :aria-label="`${filterDropCol.header || filterDropCol.field} 필터`"
1504
+ @keydown="onFilterDropKeydown"
1505
+ >
1506
+ <label class="mg-colctl-item">
1507
+ <input
1508
+ type="checkbox"
1509
+ :checked="!filterDropActive || filterDropActive.length >= filterDropAll.length"
1510
+ @change="grid.setFilter(filterDropCol.field, null)"
1511
+ />
1512
+ {{ state.locale.setFilterAll }}
1513
+ </label>
1514
+ <label
1515
+ v-for="v in filterDropAll"
1516
+ :key="v"
1517
+ class="mg-colctl-item"
1518
+ >
1519
+ <input
1520
+ type="checkbox"
1521
+ :checked="filterDropChecked(v)"
1522
+ @change="toggleFilterValue(v)"
1523
+ />
1524
+ {{ v }}
1525
+ </label>
1526
+ </div>
1527
+ </template>
1528
+
1529
+ <!-- 찾기 바 — Enter 다음 / Shift+Enter 이전 매치 -->
1530
+ <div v-if="findBox" class="mg-find-bar">
1531
+ <input
1532
+ ref="findInputEl"
1533
+ type="search"
1534
+ class="mg-find-input"
1535
+ placeholder="셀 찾기…"
1536
+ @keydown="onFindKeydown"
1537
+ @input="onFindInput"
1538
+ />
1539
+ <label class="mg-find-opt">
1540
+ <input
1541
+ type="checkbox"
1542
+ :checked="findCaseSensitive"
1543
+ @change="onFindCaseChange"
1544
+ />
1545
+ {{ state.locale.findMatchCase }}
1546
+ </label>
1547
+ <label class="mg-find-opt">
1548
+ <input
1549
+ type="checkbox"
1550
+ :checked="findWholeCell"
1551
+ @change="onFindWholeChange"
1552
+ />
1553
+ {{ state.locale.findWholeCell }}
1554
+ </label>
1555
+ <button type="button" class="mg-find-btn" @click="goFind(true)">
1556
+ ▲ 이전
1557
+ </button>
1558
+ <button type="button" class="mg-find-btn" @click="goFind(false)">
1559
+ ▼ 다음
1560
+ </button>
1561
+ <span class="mg-find-count">{{ findCount }}</span>
1562
+ </div>
1563
+
991
1564
  <!-- 그룹 패널 — 그룹된 컬럼 칩, 클릭 시 해제 -->
992
- <div v-if="groupPanel" class="mg-group-panel">
1565
+ <div
1566
+ v-if="groupPanel"
1567
+ class="mg-group-panel"
1568
+ :class="{ 'mg-drop-target': groupDropOver }"
1569
+ @dragover="onGroupPanelDragOver"
1570
+ @dragleave="groupDropOver = false"
1571
+ @drop="onGroupPanelDrop"
1572
+ >
993
1573
  <span v-if="state.groupBy.length === 0" class="mg-group-panel-empty">
994
1574
  {{ state.locale.groupPanelEmpty }}
995
1575
  </span>
@@ -1070,9 +1650,29 @@ watch(
1070
1650
  "
1071
1651
  @scroll="onScroll"
1072
1652
  >
1073
- <table class="mg-table" role="grid" tabindex="0" @keydown="onGridKeydown">
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>
1074
1670
  <thead role="rowgroup">
1075
- <tr v-for="(row, rowIdx) in headerRows" :key="rowIdx">
1671
+ <tr
1672
+ v-for="(row, rowIdx) in headerRows"
1673
+ :key="rowIdx"
1674
+ :style="headerTrStyle"
1675
+ >
1076
1676
  <th
1077
1677
  v-if="rowStatus && rowIdx === 0"
1078
1678
  :rowspan="headerRowSpan"
@@ -1100,9 +1700,10 @@ watch(
1100
1700
  :rowspan="headerRowSpan"
1101
1701
  class="mg-rownum-cell"
1102
1702
  ></th>
1103
- <template v-for="cell in row" :key="cell.key">
1703
+ <template v-for="cell in row">
1104
1704
  <th
1105
1705
  v-if="cell.kind === 'group'"
1706
+ :key="cell.key"
1106
1707
  :colspan="cell.colSpan"
1107
1708
  class="mg-colgroup"
1108
1709
  >
@@ -1110,6 +1711,7 @@ watch(
1110
1711
  </th>
1111
1712
  <th
1112
1713
  v-else
1714
+ :key="cell.key"
1113
1715
  :rowspan="cell.rowSpan"
1114
1716
  :style="
1115
1717
  cell.col.pinned
@@ -1126,10 +1728,15 @@ watch(
1126
1728
  'mg-pin-left-edge': cell.colIndex === lastLeftPinIdx,
1127
1729
  'mg-pin-right-edge': cell.colIndex === firstRightPinIdx,
1128
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
+ : '',
1129
1735
  grid.getHeaderClass(cell.col),
1130
1736
  ]"
1737
+ :title="cell.col.headerTooltip"
1131
1738
  :aria-sort="sortAria(cell.col.field)"
1132
- :draggable="reorderable"
1739
+ :draggable="reorderable && cell.col.movable !== false"
1133
1740
  @dragstart="onDragStart(cell.col, $event)"
1134
1741
  @dragover="onDragOver(cell.col, $event)"
1135
1742
  @drop="onDrop(cell.col, $event)"
@@ -1155,6 +1762,18 @@ watch(
1155
1762
  <span v-if="sortPriorityOf(cell.col.field)" class="mg-sort-priority">
1156
1763
  {{ sortPriorityOf(cell.col.field) }}
1157
1764
  </span>
1765
+ <button
1766
+ v-if="headerFilters && cell.col.filterable"
1767
+ type="button"
1768
+ :class="[
1769
+ 'mg-header-filter-btn',
1770
+ state.filters[cell.col.field] && 'mg-active',
1771
+ ]"
1772
+ :aria-label="`${cell.col.header || cell.col.field} 필터`"
1773
+ @click="toggleFilterDrop(cell.col, $event)"
1774
+ >
1775
+ ▾
1776
+ </button>
1158
1777
  <button
1159
1778
  v-if="resizable && cell.col.resizable !== false"
1160
1779
  type="button"
@@ -1270,10 +1889,11 @@ watch(
1270
1889
  <tr v-if="bodyRows.length === 0">
1271
1890
  <td class="mg-empty" :colspan="colSpan">{{ state.locale.noRows }}</td>
1272
1891
  </tr>
1273
- <template v-for="(entry, rowIdx) in bodyRows" :key="rowKeyOf(entry)">
1892
+ <template v-for="(entry, rowIdx) in bodyRows">
1274
1893
  <!-- 그룹 헤더 행 -->
1275
1894
  <tr
1276
1895
  v-if="isGroupRow(entry)"
1896
+ :key="rowKeyOf(entry)"
1277
1897
  class="mg-group-row"
1278
1898
  @click="onToggleGroup(entry)"
1279
1899
  >
@@ -1310,6 +1930,7 @@ watch(
1310
1930
  <!-- 그룹 소계 행 -->
1311
1931
  <tr
1312
1932
  v-else-if="isSubtotalRow(entry)"
1933
+ :key="rowKeyOf(entry)"
1313
1934
  class="mg-subtotal-row"
1314
1935
  >
1315
1936
  <td v-if="rowStatus" class="mg-status-cell" />
@@ -1341,6 +1962,7 @@ watch(
1341
1962
  <!-- 서버 사이드 미로드 행 → 스켈레톤 -->
1342
1963
  <tr
1343
1964
  v-else-if="rowDataOf(entry) == null"
1965
+ :key="rowKeyOf(entry)"
1344
1966
  class="mg-skeleton-row"
1345
1967
  aria-hidden="true"
1346
1968
  >
@@ -1363,10 +1985,11 @@ watch(
1363
1985
  <!-- 리프(데이터) 행 -->
1364
1986
  <tr
1365
1987
  v-else
1988
+ :key="rowKeyOf(entry)"
1366
1989
  role="row"
1367
1990
  :aria-selected="state.selectedRowIds.has(grid.getRowId(rowDataOf(entry)))"
1368
1991
  :class="rowClassOf(entry, rowIdx)"
1369
- :style="rowStyleOf(entry)"
1992
+ :style="rowStyleOf(entry, rowIdx)"
1370
1993
  @click="selectable && grid.toggleRowSelection(grid.getRowId(rowDataOf(entry)))"
1371
1994
  @dragover="onRowDragOver(entryIndexOf(entry, rowIdx), $event)"
1372
1995
  @drop="onRowDrop($event)"
@@ -1391,6 +2014,7 @@ watch(
1391
2014
  type="checkbox"
1392
2015
  aria-label="행 선택"
1393
2016
  :checked="isSelected(rowDataOf(entry))"
2017
+ :disabled="!grid.isRowSelectable(rowDataOf(entry))"
1394
2018
  @change="
1395
2019
  grid.toggleRowSelection(grid.getRowId(rowDataOf(entry)))
1396
2020
  "
@@ -1414,12 +2038,15 @@ watch(
1414
2038
  :rowspan="cellSpanOf(rowDataOf(entry), col).rowSpan"
1415
2039
  :colspan="cellSpanOf(rowDataOf(entry), col).colSpan"
1416
2040
  :class="[
2041
+ col.align && col.align !== 'left' ? `mg-align-${col.align}` : '',
1417
2042
  {
1418
2043
  'mg-cell-readonly': !grid.isCellEditable(entryIndexOf(entry, rowIdx), colIndex),
1419
2044
  'mg-cell-active': grid.isActiveCell(entryIndexOf(entry, rowIdx), colIndex),
1420
2045
  'mg-cell-selected': grid.isCellInRange(entryIndexOf(entry, rowIdx), colIndex),
1421
- 'mg-cell-editing': isEditingCell(entryIndexOf(entry, rowIdx), col),
2046
+ 'mg-cell-editing': isEditingCell(entryIndexOf(entry, rowIdx), colIndex),
1422
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)),
1423
2050
  'mg-multiline': !!col.multiLine,
1424
2051
  'mg-pinned': !!col.pinned,
1425
2052
  'mg-pin-left-edge': colIndex === lastLeftPinIdx,
@@ -1480,12 +2107,12 @@ watch(
1480
2107
  {{ leafHasChildren(entry) ? (leafExpanded(entry) ? "▾" : "▸") : "" }}
1481
2108
  </button>
1482
2109
  <span
1483
- v-if="grid.isActiveCell(entryIndexOf(entry, rowIdx), colIndex) && !isEditingCell(entryIndexOf(entry, rowIdx), col)"
2110
+ v-if="grid.isActiveCell(entryIndexOf(entry, rowIdx), colIndex) && !isEditingCell(entryIndexOf(entry, rowIdx), colIndex)"
1484
2111
  class="mg-fill-handle"
1485
2112
  @mousedown="onFillMouseDown"
1486
2113
  ></span>
1487
2114
  <span
1488
- v-if="col.rowDrag && !isEditingCell(entryIndexOf(entry, rowIdx), col)"
2115
+ v-if="col.rowDrag && !isEditingCell(entryIndexOf(entry, rowIdx), colIndex)"
1489
2116
  class="mg-row-drag-handle"
1490
2117
  :class="{ 'mg-disabled': !rowDraggable }"
1491
2118
  :draggable="rowDraggable"
@@ -1494,7 +2121,7 @@ watch(
1494
2121
  @dragend="onRowDragEnd"
1495
2122
  >⠿</span
1496
2123
  >
1497
- <template v-if="isEditingCell(entryIndexOf(entry, rowIdx), col)">
2124
+ <template v-if="isEditingCell(entryIndexOf(entry, rowIdx), colIndex)">
1498
2125
  <!-- 커스텀 에디터 슬롯: #editor-{field}="ctx" -->
1499
2126
  <slot
1500
2127
  :name="`editor-${col.field}`"
@@ -1503,9 +2130,9 @@ watch(
1503
2130
  <select
1504
2131
  v-if="col.cellEditor === 'select'"
1505
2132
  class="mg-editor"
1506
- :class="{ 'mg-editor-error': state.editError }"
1507
- :value="editorInputValue(state.editValue)"
1508
- @change="onEditorInput"
2133
+ :class="{ 'mg-editor-error': editErrorOf(col) }"
2134
+ :value="editorInputValue(editValueOf(col))"
2135
+ @change="onEditorInput($event, col)"
1509
2136
  @keydown="onEditorKeydown"
1510
2137
  @click.stop
1511
2138
  @mousedown.stop
@@ -1517,10 +2144,10 @@ watch(
1517
2144
  <select
1518
2145
  v-else-if="col.cellEditor === 'multiselect'"
1519
2146
  class="mg-editor"
1520
- :class="{ 'mg-editor-error': state.editError }"
2147
+ :class="{ 'mg-editor-error': editErrorOf(col) }"
1521
2148
  multiple
1522
2149
  :size="Math.min(Math.max((col.editorOptions || []).length, 2), 8)"
1523
- @change="onMultiselectChange"
2150
+ @change="onMultiselectChange($event, col)"
1524
2151
  @keydown="onEditorKeydown"
1525
2152
  @click.stop
1526
2153
  @mousedown.stop
@@ -1529,7 +2156,7 @@ watch(
1529
2156
  v-for="opt in col.editorOptions || []"
1530
2157
  :key="opt"
1531
2158
  :value="opt"
1532
- :selected="isEditOptSelected(opt)"
2159
+ :selected="isEditOptSelected(opt, col)"
1533
2160
  >
1534
2161
  {{ opt }}
1535
2162
  </option>
@@ -1546,8 +2173,8 @@ watch(
1546
2173
  >
1547
2174
  <input
1548
2175
  type="radio"
1549
- :checked="String(state.editValue ?? '') === opt"
1550
- @change="onRadioPick(opt, entryIndexOf(entry, rowIdx), colIndex)"
2176
+ :checked="String(editValueOf(col) ?? '') === opt"
2177
+ @change="onRadioPick(opt, col)"
1551
2178
  @click.stop
1552
2179
  @mousedown.stop
1553
2180
  />
@@ -1557,11 +2184,11 @@ watch(
1557
2184
  <textarea
1558
2185
  v-else-if="col.cellEditor === 'textarea'"
1559
2186
  class="mg-editor mg-editor-textarea"
1560
- :class="{ 'mg-editor-error': state.editError }"
1561
- :value="editorInputValue(state.editValue)"
1562
- @input="onEditorInput"
2187
+ :class="{ 'mg-editor-error': editErrorOf(col) }"
2188
+ :value="editorInputValue(editValueOf(col))"
2189
+ @input="onEditorInput($event, col)"
1563
2190
  @keydown="onTextareaKeydown"
1564
- @blur="grid.commitEditing()"
2191
+ @blur="state.editType !== 'fullRow' && grid.commitEditing()"
1565
2192
  @click.stop
1566
2193
  @dblclick.stop
1567
2194
  @mousedown.stop
@@ -1570,14 +2197,14 @@ watch(
1570
2197
  v-else
1571
2198
  :type="editorInputType(col)"
1572
2199
  class="mg-editor"
1573
- :class="{ 'mg-editor-error': state.editError }"
1574
- :value="editorInputValue(state.editValue)"
2200
+ :class="{ 'mg-editor-error': editErrorOf(col) }"
2201
+ :value="editorInputValue(editValueOf(col))"
1575
2202
  :list="
1576
2203
  editorInputType(col) === 'text' && col.editorOptions?.length
1577
2204
  ? `mg-dl-${col.field}`
1578
2205
  : undefined
1579
2206
  "
1580
- @input="onEditorInput"
2207
+ @input="onEditorInput($event, col)"
1581
2208
  @keydown="onEditorKeydown"
1582
2209
  @click.stop
1583
2210
  @mousedown.stop
@@ -1596,7 +2223,7 @@ watch(
1596
2223
  />
1597
2224
  </datalist>
1598
2225
  </slot>
1599
- <span v-if="state.editError" class="mg-edit-error">{{ state.editError }}</span>
2226
+ <span v-if="editErrorOf(col)" class="mg-edit-error">{{ editErrorOf(col) }}</span>
1600
2227
  </template>
1601
2228
  <!-- 커스텀 셀 슬롯: #cell-{field}="{ value, row, column }" -->
1602
2229
  <slot
@@ -1655,7 +2282,7 @@ watch(
1655
2282
  type="checkbox"
1656
2283
  class="mg-cell-checkbox"
1657
2284
  :checked="grid.isCellChecked(rowDataOf(entry), col)"
1658
- :disabled="col.editable === false"
2285
+ :disabled="!grid.isCellEditable(entryIndexOf(entry, rowIdx), colIndex)"
1659
2286
  @click.stop
1660
2287
  @dblclick.stop
1661
2288
  @change="grid.toggleCellChecked(rowDataOf(entry), col)"
@@ -1793,9 +2420,9 @@ watch(
1793
2420
  role="menu"
1794
2421
  :style="{ left: `${state.contextMenu.x}px`, top: `${state.contextMenu.y}px` }"
1795
2422
  >
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">
2423
+ <template v-for="item in state.contextMenu.items">
2424
+ <li v-if="item.separator" :key="item.id" class="mg-ctx-separator" role="separator" />
2425
+ <li v-else :key="item.id" role="none">
1799
2426
  <button
1800
2427
  type="button"
1801
2428
  role="menuitem"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moda-grid/vue2",
3
- "version": "0.4.1",
3
+ "version": "1.0.1",
4
4
  "description": "Vue 2.7 adapter for @moda-grid — DataGrid SFC and useGrid composable",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -23,9 +23,10 @@
23
23
  },
24
24
  "repository": {
25
25
  "type": "git",
26
- "url": "git+https://github.com/park-taejoon/moda-grid.git",
27
- "directory": "packages/vue2"
26
+ "url": "git+https://github.com/park-taejoon/moda-grid-releases.git"
28
27
  },
28
+ "homepage": "https://www.modaolive.com/download/modagrid",
29
+ "bugs": "https://github.com/park-taejoon/moda-grid-releases/issues",
29
30
  "keywords": [
30
31
  "vue",
31
32
  "vue2",
@@ -35,7 +36,7 @@
35
36
  "grid"
36
37
  ],
37
38
  "dependencies": {
38
- "@moda-grid/core": "0.4.1"
39
+ "@moda-grid/core": "1.0.1"
39
40
  },
40
41
  "peerDependencies": {
41
42
  "vue": "^2.7.0"