@ihabdevteam/core 0.383.0 → 0.385.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1787,7 +1787,7 @@ export declare function copyText(text: string): Promise<boolean>;
1787
1787
  *
1788
1788
  * 값은 손으로 적고 `test/coreVersion.test.ts` 가 package.json 과 어긋나면 운다.
1789
1789
  */
1790
- export declare const CORE_VERSION = "0.383.0";
1790
+ export declare const CORE_VERSION = "0.385.0";
1791
1791
 
1792
1792
  /** @public */
1793
1793
  declare const coreDefault: Record<string, unknown>;
@@ -11530,7 +11530,7 @@ export declare interface WordSearchResultWord {
11530
11530
  * 표시(items)·편집(editCells) 두 모드를 지원한다.
11531
11531
  * @public
11532
11532
  */
11533
- export declare function WordTable({ title, titleIcon, disc, className, orientation, contentTypes, baseItem, baseContentTypes, cutLine, showOutline, showDivLine, items, editCells, count, activeCell, onActivateCell, onRemoveCell, onRemoveItem, onReorder, renderCellAction, showFillerAdd, addableCount, contentRef, buttonSize, brand, code, pageNumber, pageNumberPosition, fitHeight, scoring, marks, onMarkClick, scoreIndexOffset, }: WordTableProps): JSX.Element;
11533
+ export declare function WordTable({ title, titleIcon, disc, className, orientation, contentTypes, baseItem, baseContentTypes, cutLine, showOutline, showDivLine, items, editCells, count, activeCell, onActivateCell, onRemoveCell, onRemoveItem, onReorder, indexOffset, totalCount, renderCellAction, showFillerAdd, addableCount, contentRef, buttonSize, brand, code, pageNumber, pageNumberPosition, fitHeight, scoring, marks, onMarkClick, scoreIndexOffset, }: WordTableProps): JSX.Element;
11534
11534
 
11535
11535
  export declare function WordTableBlock({ title, titleIcon, disc, filterTitle, filterCollapsible, filterDefaultCollapsed, filterCollapsed, onFilterCollapsedChange, filterHeaderSummary, brand, code, baseItem, baseContentTypes, cellCapacity, maxItemsPerPage, items, onSaveComplete, onLoad, onRemoveItem, onReset, resetLabel, saveButtonLabel, secondarySaveButtonLabel, onReorder, showCellCount, onAddItem, className, renderSavePopup, renderWordSearch, hideControls, saveOnly, tableName, nameValue, onNameChange, descriptionValue, onDescriptionChange, namePlaceholder, descriptionPlaceholder, existingNames, editingName, onCancel, initialItemsPerPage, renderCellAction, actionsLeftExtra }: WordTableBlockProps): JSX.Element;
11536
11536
 
@@ -11959,6 +11959,22 @@ export declare interface WordTableProps {
11959
11959
  * 키보드로 옮기면 초점이 그 칸을 따라가고 바뀐 자리를 `role="status"` 로 알린다.
11960
11960
  */
11961
11961
  onReorder?: (fromIndex: number, toIndex: number) => void;
11962
+ /**
11963
+ * 이 표의 첫 칸이 **전체 목록에서 몇 번째**인가 — 쪽으로 나뉜 표에서 `WordTableBlock` 이 준다
11964
+ * (말귀 청 (338), 2026-10-28).
11965
+ *
11966
+ * 쪽마다 `WordTable` 이 따로 서면 `index` 는 **쪽 안의 번호**다. 그래서 `Alt`+`→` 가 쪽의
11967
+ * 마지막 칸에서, `Alt`+`←` 가 쪽의 첫 칸에서 **돌아섰다** — 활용표는 스무 칸이 두 쪽이라
11968
+ * 쪽 경계가 늘 가운데에 있고, 거기 선 칸은 영영 못 옮겼다(말귀 실측: 눌러도 아무 칸도
11969
+ * 안 움직인다).
11970
+ *
11971
+ * `onReorder` 로 올라가는 번호는 **그대로 쪽 안의 번호**다(쪽을 넘을 때는 `-1` 이나
11972
+ * `count` 가 된다) — 부르는 쪽이 이미 `+ 쪽번호 × 쪽당` 을 얹으므로 그 합이 곧 전체
11973
+ * 번호가 된다. 부르는 쪽은 고칠 것이 없다.
11974
+ */
11975
+ indexOffset?: number;
11976
+ /** 전체 칸 수 — 쪽으로 나뉜 표에서 양 끝을 전체 기준으로 가른다(`indexOffset` 과 한 짝) */
11977
+ totalCount?: number;
11962
11978
  /** 표시 모드에서 `count` 안의 빈칸(항목 수 뒤 ~ count)에 '추가' 버튼 노출. count 가 항목 수와 같으면 그런 칸이 없다. `onActivateCell` 필요. */
11963
11979
  showFillerAdd?: boolean;
11964
11980
  /**
@@ -79,7 +79,9 @@
79
79
  /* 필드 라벨 행 — 정렬 클릭 가능한 컬럼 헤더. 높이는 size 스케일을 따름 */
80
80
  /* 되돌리기 단추를 얹을 겉. **`.table-fields` 안에 넣으면 안 된다** — 그 자식은
81
81
  곧 열이라 칸이 하나 늘어 몸통 줄과 어긋난다. 겉에서 자리를 안 차지하게 얹는다. */
82
- .table-fields-strip { position: relative; }
82
+ .table-fields-strip { position: relative; display: flex; align-items: stretch; }
83
+ /* 격자는 **줄어들지 않는다** — `min-width: 0` 을 주면 열 폭 합보다 좁아져 넘침이 사라진다 */
84
+ .table-fields-strip > .table-fields { flex: 1 0 auto; }
83
85
 
84
86
  /* 단추가 설 자리를 비운다. **머리와 몸통에 똑같이** 줘야 한다 — 한쪽만 주면
85
87
  그쪽 격자만 좁아져 열이 어긋난다.
@@ -92,14 +94,38 @@
92
94
  .table-wrap--resizable .table-fields,
93
95
  .table-wrap--resizable .table-row { padding-right: var(--table-reset-gutter, 40px); }
94
96
 
97
+ /* **단추 받침 — 보이는 오른쪽 끝에 붙박인다**(말귀 청 (216), 2026-10-28).
98
+
99
+ 단추가 띠의 `right: 0` 에 그냥 얹혀 있던 때는, 열이 넘쳐 안쪽 상자가 열 폭만큼
100
+ 넓어지면 그 자리가 **스크롤 끝**이었다 — 오른쪽 끝까지 밀어야 단추가 나왔고,
101
+ 칸이 넘치는 그때가 바로 누르고 싶은 때였다(말귀 실측: 단추는 `visible`,
102
+ 스크롤러는 `.table-wrap` 의 `overflow-x: auto`).
103
+
104
+ `sticky right: 0` 이 스크롤러의 **보이는** 오른쪽 끝에 붙여 둔다. 폭을 0 으로 두어
105
+ 열 셈에는 아무것도 더하지 않는다(빈자리는 `--table-reset-gutter` 가 따로 비운다). */
106
+ .table-fields__reset-dock {
107
+ position: sticky;
108
+ right: 0;
109
+ flex: 0 0 0;
110
+ width: 0;
111
+ align-self: center;
112
+ /* 받침은 폭이 0 이라 단추가 밖으로 나와야 보인다 */
113
+ overflow: visible;
114
+ }
115
+
95
116
  .table-fields__reset {
96
117
  position: absolute;
97
118
  /* **빈자리(40px)에 딱 맞춘다** — `right: 2px` 이던 때는 40px 단추가 42px 을 차지해 마지막
98
119
  머리의 안쪽 여백을 2px 물고 있었다(2026-10-26 실측: 단추 1482~1522, 마지막 머리 끝 1484).
99
120
  눈에는 안 띄는 겹침이지만 머리·본문에 비운 자리와 수가 어긋난다. */
121
+ /* 받침의 오른쪽 끝에서 왼쪽으로 — 받침이 폭 0 이므로 단추 전체가 왼쪽에 걸린다 */
100
122
  right: 0;
101
123
  top: 50%;
102
124
  transform: translateY(-50%);
125
+ /* 넘쳐서 열 위에 겹쳐 설 때 **글자가 비쳐 읽히지 않게** 바탕을 깐다 —
126
+ 붙박이가 된 뒤에 생긴 일이다(전에는 빈자리에만 섰다). */
127
+ background: var(--color-white);
128
+ border-radius: var(--radius-card);
103
129
  }
104
130
 
105
131
  .table-fields {
@@ -13,6 +13,7 @@ import { useTranslation } from 'react-i18next';
13
13
  import './Table.css';
14
14
  import './TableCell.css';
15
15
  import { widestPerColumn, spanFromGridStyle } from './tableSpanMeasure';
16
+ import { fitFluidWidths, columnFloors } from './tableFitWidths';
16
17
  import './TableField.css';
17
18
  import { useState, useRef, useCallback, useEffect, useId, useMemo } from 'react';
18
19
  import ChevronUp from 'lucide-react/dist/esm/icons/chevron-up.mjs';
@@ -25,9 +26,14 @@ import useMediaQuery from '../hooks/useMediaQuery';
25
26
  역할이 없던 때는 줄 전체가 한 덩어리 글로 읽혀 `홍길동 010-1234-5678 2026-09-30 활성`
26
27
  이 한 호흡에 나갔다 — 어디까지가 이름이고 어디부터 전화인지 소리로는 알 수 없었다. */
27
28
  function TableCell({ children, className, style, span, rowLabel, onRowClick }) {
28
- /* 부르는 쪽이 `style` 에 적은 `gridColumn` 은 그대로 둔다 — `span` 을 줬을 때만 코어가 짓는다.
29
- 둘 다 주면 부르는 쪽 것이 이긴다(뒤에 놓인다): 격자는 그쪽 뜻대로 서고, 재는 자리는
30
- `span` 을 보니 둘이 어긋나면 그것은 부르는 쪽이 고를 일이다. */
29
+ /* 부르는 쪽이 `style` 에 적은 `gridColumn` 은 그대로 둔다 — `span` 을 줬을 때만 코어가 짓고,
30
+ 둘 다 주면 부르는 쪽 것이 이긴다(뒤에 놓인다).
31
+
32
+ **어긋날 자리가 없다.** 재는 쪽(`measureAutoWidths`)이 이 프롭이 아니라 **선 격자**를
33
+ 읽으므로(`spanFromGridStyle`), `style` 로 덮으면 격자와 셈이 함께 따라간다. 화면 폭에
34
+ 따라 덮는 수를 바꾸는 표도 그래서 그냥 맞는다(`span 1` 이면 `gridColumn` 을 아예 안
35
+ 붙이고, 읽는 쪽도 1 로 본다). `aria-colspan` 은 이 프롭을 받을 때만 붙으므로 셈의
36
+ 열쇠로 쓰지 않는다 — 그것만 믿으면 손으로 적은 줄을 못 본다. */
31
37
  const cellStyle = span && span > 1
32
38
  ? { gridColumn: `span ${span}`, ...style }
33
39
  : style;
@@ -542,7 +548,30 @@ export default function Table({ fields: rawFields = [], sort: sortBinding, sorta
542
548
  return { width: c.getBoundingClientRect().width, span: spanFromGridStyle(cs.gridColumnStart, cs.gridColumnEnd) };
543
549
  });
544
550
  const columnGap = parseFloat(window.getComputedStyle(el).columnGap) || 0;
545
- const widest = widestPerColumn([cellsOf(el), ...rows.map(cellsOf)], fields.length, columnGap);
551
+ const bodyCells = rows.map(cellsOf);
552
+ const headCells = cellsOf(el);
553
+ const widest = widestPerColumn([headCells, ...bodyCells], fields.length, columnGap);
554
+ /**
555
+ * **머리글자가 드는 폭은 바닥이다**(말귀 청 (217), 2026-10-28,
556
+ * 사장님 *"value 길이만 계산하고 있는건가? tablefield의 이름 길이도 고려할 수 있나?"*).
557
+ *
558
+ * 머리 칸은 **재고 있었다** — 위 `headCells` 가 그것이다. **잰 뒤 줄일 때 잊었다.**
559
+ * 비율로 줄이는 자리의 바닥이 `declaredMinWidth` 뿐이라, 그 칸에 `minmax(…px,…)` 가
560
+ * 없으면 `MIN_COL_W`(48px) 한 값으로 떨어졌다. 그래서 `성별` 이 `성ᅧ` 로 잘렸다
561
+ * (말귀 실측: 단추 칸 머리는 118px 이 드는데 70px 로 줄었다).
562
+ *
563
+ * **화살표 자리를 정렬 가능한 칸 모두에 얹는다.** 화살표는 *지금 고른* 칸에만 서므로
564
+ * (실측: 고른 칸 16px, 나머지 0), 지금 폭만 보고 바닥을 잡으면 **다른 칸을 고르는
565
+ * 순간 그 칸만 잘린다.**
566
+ */
567
+ const floors = columnFloors(fields.map((f, i) => ({
568
+ declaredMin: minWidthRef.current(i),
569
+ headWidth: headCells[i]?.width ?? 0,
570
+ sortable: f.sortDir !== undefined || !!f.onClick,
571
+ sorted: !!f.sortDir,
572
+ })));
573
+ /** 줄일 때의 바닥 — 선언된 밑값과 머리글자가 드는 폭 가운데 넓은 쪽 */
574
+ const floorOf = (i) => floors[i] ?? minWidthRef.current(i);
546
575
  const measured = fields.map((_, i) => {
547
576
  const w = widest[i];
548
577
  /* 고정 px 열은 정해 둔 값 그대로 — 최소 폭(MIN_COL_W)으로 올린 값을 고정 합에 넣으면 격자에는 원래 값(40px)으로 나가
@@ -579,25 +608,12 @@ export default function Table({ fields: rawFields = [], sort: sortBinding, sorta
579
608
 
580
609
  `fit` 은 이 값이 fr 가중치가 되어 어차피 비율로 채우지만, 저장되는 숫자도
581
610
  같은 뜻이 되게 함께 맞춘다. */
582
- let finalWidths = measured;
583
- const fixedTotal = measured.reduce((a, w, i) => a + (isFixedPxRef.current(i) ? w : 0), 0);
584
- const fluidTotal = measured.reduce((a, w, i) => a + (isFixedPxRef.current(i) ? 0 : w), 0);
585
- const available = containerWidth - fixedTotal;
586
- if (containerWidth > 0 && fluidTotal > 0 && available > 0) {
587
- const ratio = available / fluidTotal;
588
- finalWidths = measured.map((w, i) => (isFixedPxRef.current(i) ? w : Math.max(minWidthRef.current(i), Math.round(w * ratio))));
589
- /* 반올림으로 남은 몇 px 은 가장 넓은 유동 열에 얹는다 — 안 그러면 늘 몇 px 이
590
- 비거나 넘친다. 최소 폭에 걸린 열이 있으면 넘칠 수 있는데, 그건 담을 수
591
- 없을 만큼 좁다는 뜻이라 가로 스크롤로 두는 편이 맞다. */
592
- const diff = Math.round(available - finalWidths.reduce((a, w, i) => a + (isFixedPxRef.current(i) ? 0 : w), 0));
593
- if (diff !== 0) {
594
- let widestIndex = -1;
595
- finalWidths.forEach((w, i) => { if (!isFixedPxRef.current(i) && (widestIndex < 0 || w > finalWidths[widestIndex]))
596
- widestIndex = i; });
597
- if (widestIndex >= 0)
598
- finalWidths[widestIndex] = Math.max(minWidthRef.current(widestIndex), finalWidths[widestIndex] + diff);
599
- }
600
- }
611
+ /* 규칙은 `tableFitWidths.ts` 가 든다 — 줄일 때의 **바닥**이 그 머리말의 핵이다(청 (217)). */
612
+ const finalWidths = fitFluidWidths(measured, {
613
+ isFixed: i => isFixedPxRef.current(i),
614
+ floorOf,
615
+ containerWidth,
616
+ });
601
617
  /* **쓰지도 저장하지도 않는다 — 잰 값을 돌려줄 뿐이다.** 자동 모드에서는 저장하면
602
618
  안 된다(저장소에 값이 있으면 손 모드이므로, 저장하는 순간 자동으로 돌아갈 길이
603
619
  사라진다). 쓰는 것은 부르는 쪽이 한다. */
@@ -878,7 +894,19 @@ export default function Table({ fields: rawFields = [], sort: sortBinding, sorta
878
894
  손잡이를 두지 않는다 — 두면 그 컬럼만 grow처럼 넓어져 표가 밀린다. */
879
895
  onResizeStart: canResize && i < fields.length - 1 && f.resizable !== false
880
896
  && (resizeMode !== 'fit' || fields.some((g, j) => j > i && g.resizable !== false))
881
- ? (e) => startResize(i, e) : undefined, children: f.label }, i))) }), canResize && (_jsx(Button, { htmlType: "button", size: 40, type: "dot", variant: "transparent-gray", useBorder: false, icon: "chevrons-left-right-ellipsis", ariaLabel: t('table.resetColumns', '칸 너비 초기화'), showTooltipInfo: t('table.resetColumns', '칸 너비 초기화'), className: "table-fields__reset", onClick: resetColumns }))] }), _jsx("div", { role: "rowgroup", className: "table-body", children: loading ? (_jsx(TableRow, { variant: "loading", colSpan: fields.length || undefined })) : items.length === 0 && empty ? (_jsx(TableRow, { variant: "empty", colSpan: fields.length || undefined, children: empty })) : items.map((item, idx) => {
897
+ ? (e) => startResize(i, e) : undefined, children: f.label }, i))) }), canResize && (
898
+ /* **보이는 오른쪽 끝에 붙박는다**(말귀 청 (216), 2026-10-28,
899
+ 사장님 *"칸 너비 초기화 버튼이 사라지면 안되지"*).
900
+
901
+ 전에는 단추가 이 띠의 `right: 0` 에 그냥 얹혀 있었다. 띠는 `.table-wrap`
902
+ (= 가로 스크롤러) 안이고, 열이 넘칠 때는 안쪽 상자가 **열 폭만큼** 넓어지므로
903
+ (`measureOverflow`) 그 `right: 0` 은 **스크롤 끝**이다 — 오른쪽 끝까지 밀어야
904
+ 단추가 나왔다. **칸이 넘치는 그때가 바로 누르고 싶은 때**인데 그때 손이 안 닿았다.
905
+
906
+ 그래서 자리를 안 차지하는 `sticky` 받침에 담는다. 넘치지 않을 때는 띠 끝의
907
+ 빈자리(`--table-reset-gutter`)에 그대로 서고, 넘칠 때는 보이는 오른쪽 끝에
908
+ 붙어 선다. 받침이 폭 0 이라 열 셈에는 아무것도 더하지 않는다. */
909
+ _jsx("div", { className: "table-fields__reset-dock", children: _jsx(Button, { htmlType: "button", size: 40, type: "dot", variant: "transparent-gray", useBorder: false, icon: "chevrons-left-right-ellipsis", ariaLabel: t('table.resetColumns', '칸 너비 초기화'), showTooltipInfo: t('table.resetColumns', '칸 너비 초기화'), className: "table-fields__reset", onClick: resetColumns }) }))] }), _jsx("div", { role: "rowgroup", className: "table-body", children: loading ? (_jsx(TableRow, { variant: "loading", colSpan: fields.length || undefined })) : items.length === 0 && empty ? (_jsx(TableRow, { variant: "empty", colSpan: fields.length || undefined, children: empty })) : items.map((item, idx) => {
882
910
  const isDragging = draggingId != null && item.id === draggingId;
883
911
  const clickable = !!onRowClick && (isRowClickable ? isRowClickable(item) : true);
884
912
  /* 글자로 견준다 — URL·폼에서 온 '5' 와 자료의 5 가 같은 줄인데 `===` 로는 안 펴졌다 */
@@ -24,7 +24,7 @@ export default function TableFilterPanel(props) {
24
24
  }
25
25
  const { hasImage, hasColloquial, hasCaption, contentTypes, orientation, showOutline, cutLine, showDivLine, setters, showCutLine = false, showDivLine2 = false, middleSections = [], extraSelected = {}, onExtraSelect, showPaperBands = false, showTopInfo = true, showBottomInfo = true, } = props;
26
26
  const sections = [
27
- buildCompositionSection(t, { hasImage, hasColloquial, hasCaption }),
27
+ buildCompositionSection(t, { hasImage, hasColloquial, hasCaption: hasCaption ?? false }),
28
28
  buildOrientationSection(t),
29
29
  ...middleSections,
30
30
  buildBorderSection(t),
@@ -11,7 +11,7 @@ import Panel, { PanelRow } from '../Panel';
11
11
  import Popup from '../Popup/Popup';
12
12
  import WordTable, { WORD_TABLE_PAPER } from '../WordTable';
13
13
  import TableFilterPanel from './TableFilterPanel';
14
- import { buildItemsPerPageSection, buildPageNumberSection, parsePageNumberPosition, itemsPerPageFromChoice } from './wordTableSettings';
14
+ import { buildItemsPerPageSection, buildPageNumberSection, parsePageNumberPosition, itemsPerPageFromChoice, hasCaptionIn, DEFAULT_CONTENT_TYPES } from './wordTableSettings';
15
15
  import Toast from '../Toast';
16
16
  import { useToastState } from '../../hooks/useToastState';
17
17
  import { getImageResolver, checkImageExists } from '../../utils/imageConfig';
@@ -85,7 +85,7 @@ export default function WordTableBlock({ title, titleIcon, disc, filterTitle, fi
85
85
  const [orientation, setOrientation] = useState('landscape');
86
86
  /* `caption` 이 처음부터 켜져 있다 — 안 넣으면 (334) 가 들어오는 날 **지금까지 서던
87
87
  이름표가 통째로 사라진다**(`showOf` 는 빈 배열일 때만 다 켠다). 끄는 것은 사람이 한다. */
88
- const [contentTypes, setContentTypes] = useState(['image', 'word', 'caption', 'standardPron']);
88
+ const [contentTypes, setContentTypes] = useState([...DEFAULT_CONTENT_TYPES]);
89
89
  const [cutLine, setCutLine] = useState('show');
90
90
  const [showOutline, setShowOutline] = useState(true);
91
91
  const [showDivLine, setShowDivLine] = useState(true);
@@ -212,8 +212,7 @@ export default function WordTableBlock({ title, titleIcon, disc, filterTitle, fi
212
212
  /* 이름표를 쥔 칸이 하나라도 있나 — 없으면 '유형' 칩이 회색으로 선다(청 (334)).
213
213
  편집 격자에는 이름표를 담는 자리가 없다(`WordEntry` 에 없다) — 거기서는 늘 꺼진다.
214
214
  머리 칸도 센다 — 활용표의 머리 칸만 이름표를 쥐는 일이 있다(청 (329) 와 같은 결). */
215
- const hasCaption = !isEditable && [...(baseItem ? [baseItem] : []), ...(items ?? [])]
216
- .some(item => (item.words ?? []).some(w => !!w.captionBadge || !!w.captionLabel));
215
+ const hasCaption = !isEditable && hasCaptionIn([...(baseItem ? [baseItem] : []), ...(items ?? [])]);
217
216
  // 표에 실제로 이미지가 있는지 — resolver(word)는 존재 여부와 무관하게 항상 URL을 만들어 반환하므로
218
217
  // 그 truthiness만으로는 판정할 수 없다(항상 true가 되어 이미지 없는 표에서도 '이미지' 토글이
219
218
  // 활성화되는 문제가 있었다). checkImageExists로 실제 HEAD 요청(+캐시) 확인을 거친다.
@@ -386,6 +385,10 @@ export default function WordTableBlock({ title, titleIcon, disc, filterTitle, fi
386
385
  /* 쪽이 나뉘면 끌어 옮기기가 통째로 꺼졌다(말귀 단어 찾기: 9개부터). 쪽 안의 자리를 전체 자리로 옮겨 넘긴다 —
387
386
  쪽을 넘는 이동은 하지 않는다. */
388
387
  onReorder: onReorder && ((from, to) => onReorder(from + i * itemsPerPage, to + i * itemsPerPage)),
388
+ /* 쪽 경계에 선 칸도 옮길 수 있게 — 양 끝을 **전체 기준**으로 가르고, 옮긴 칸에
389
+ 초점이 옆 쪽까지 따라간다(말귀 청 (338)). 위 `onReorder` 의 셈은 그대로다:
390
+ 쪽을 넘을 때 안쪽 표가 주는 `-1`·`쪽당` 에 이 쪽의 몫이 얹혀 전체 번호가 된다. */
391
+ indexOffset: i * itemsPerPage, totalCount: items?.length ?? 0,
389
392
  /* 안쪽 표는 제 쪽 안의 번호를 준다 — 부르는 쪽에는 **표 전체 기준**으로 넘긴다
390
393
  (위 `onReorder` 와 같은 셈이다. 쪽이 몇으로 나뉘었는지는 부르는 쪽 일이 아니다). */
391
394
  renderCellAction: renderCellAction && ((n, item) => renderCellAction(n + i * itemsPerPage, item)),
@@ -3,7 +3,7 @@ import { useMemo, useState, useCallback, useEffect } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { chunkItems } from '../wordTableLayout';
5
5
  import { getImageResolver, checkImageExists } from '../../utils/imageConfig';
6
- import { buildCompositionSection, buildOrientationSection, buildBorderSection, buildCutLineSection, buildDivLineSection, buildTopInfoSection, buildBottomInfoSection, buildItemsPerPageSection, buildTableSettingsSelected, applyTableSettingsSelect, parsePageNumberPosition, itemsPerPageFromChoice, } from './wordTableSettings';
6
+ import { buildCompositionSection, buildOrientationSection, buildBorderSection, buildCutLineSection, buildDivLineSection, buildTopInfoSection, buildBottomInfoSection, buildItemsPerPageSection, buildTableSettingsSelected, applyTableSettingsSelect, hasCaptionIn, DEFAULT_CONTENT_TYPES, parsePageNumberPosition, itemsPerPageFromChoice, } from './wordTableSettings';
7
7
  /**
8
8
  * 표시 전용 단어표(편집 없음)의 '표 설정' FilterPanel 상태·섹션을 제공하는 훅.
9
9
  * 구성·용지 방향·외곽선, 내용이 있으면 페이지당 개수, 2페이지 이상이면 페이지 번호, 항목이 2개 이상이면
@@ -18,7 +18,7 @@ opts) {
18
18
  const { t } = useTranslation();
19
19
  const showBands = opts?.paperBands === true;
20
20
  const [orientation, setOrientation] = useState('landscape');
21
- const [contentTypes, setContentTypes] = useState(['image', 'word', 'standardPron']);
21
+ const [contentTypes, setContentTypes] = useState([...DEFAULT_CONTENT_TYPES]);
22
22
  const [cutLine, setCutLine] = useState('show');
23
23
  const [showOutline, setShowOutline] = useState(true);
24
24
  /* 종이 머리·바닥 띠 — 기본은 켬(브랜드가 찍힌 종이가 기본값이다) */
@@ -31,6 +31,11 @@ opts) {
31
31
  // 저장소에서 온 항목에 words 가 빠져 있을 수 있다({ id }) — 빈 낱말로 본다
32
32
  const hasPairs = items.some(item => (item.words ?? []).length > 1);
33
33
  const hasColloquial = items.some(item => (item.words ?? []).some(w => !!w.colloquialLabel));
34
+ /* 이름표를 쥔 칸이 하나라도 있나 — **이 훅이 안 세고 있었다**(말귀 청 (339), 2026-10-28).
35
+ 저장된 표는 이 길로 그려지는데 `hasCaption` 을 안 넘겨 `유형` 칩이 늘 잠겼고, 이름표를
36
+ 쥔 칸이 열세이던 표에서도 종이에 이름표가 안 찍혔다. 셈은 `hasCaptionIn` 한 자리다.
37
+ 이 훅에는 머리 칸이 없으므로 `items` 만 센다. */
38
+ const hasCaption = hasCaptionIn(items);
34
39
  // 페이지 분할 — 페이지당 개수(기본 8, 실제 개수보다 크면 전체로 클램프)로 나눈다. 항목이 없으면 1칸짜리 빈 표.
35
40
  const effectiveItemsPerPage = Math.min(itemsPerPageSetting, Math.max(itemCount, 1));
36
41
  const pages = useMemo(() => chunkItems(items, effectiveItemsPerPage), [items, effectiveItemsPerPage]);
@@ -57,7 +62,7 @@ opts) {
57
62
  // 기본 5개 섹션은 공용 빌더(wordTableSettings)로 조립 — WordTableBlock과 문구·항목이 어긋나지 않는다.
58
63
  // 편집(칸 수)은 표시 전용이라 제외하고, 페이지당 개수·페이지 번호는 WordTableBlock 표시 모드와 동일하게 포함한다.
59
64
  const filterSections = useMemo(() => [
60
- buildCompositionSection(t, { hasImage, hasColloquial }),
65
+ buildCompositionSection(t, { hasImage, hasColloquial, hasCaption }),
61
66
  buildOrientationSection(t),
62
67
  // 내용이 있는(1개 이상) 표면 페이지당 개수를 항상 노출.
63
68
  ...(itemCount > 0 ? [buildItemsPerPageSection(t, { hasPairs, itemCount })] : []),
@@ -73,7 +78,7 @@ opts) {
73
78
  ...(hasPairs ? [buildDivLineSection(t)] : []),
74
79
  /* 띠를 쓰는 화면에서만 — 안 쓰는 표에 켜고 끌 것이 없는 절이 서면 안 된다 */
75
80
  ...(showBands ? [buildTopInfoSection(t), buildBottomInfoSection(t)] : []),
76
- ], [t, hasImage, hasColloquial, itemCount, hasPairs, isPaginated, count, showBands]);
81
+ ], [t, hasImage, hasColloquial, hasCaption, itemCount, hasPairs, isPaginated, count, showBands]);
77
82
  const filterSelected = {
78
83
  ...buildTableSettingsSelected(t, { contentTypes, orientation, showOutline, cutLine, showDivLine, showTopInfo, showBottomInfo }),
79
84
  ...(itemCount > 0 ? { [t(hasPairs ? 'wordTable.filter.itemsPerPagePair' : 'wordTable.filter.itemsPerPageWord')]: `${effectiveItemsPerPage}개` } : {}),
@@ -1,10 +1,39 @@
1
1
  import type { TFunction } from 'i18next';
2
2
  import { type FilterPanelSection } from '../FilterPanel';
3
3
  import type { WordTableOrientation, WordTableContentType, WordTableCutLine, PageNumberPosition } from '../WordTable';
4
+ /**
5
+ * **표를 처음 열 때 켜져 있는 구성** — 두 길이 같은 것을 쓴다(말귀 청 (339), 2026-10-28).
6
+ *
7
+ * 청 (334) 로 `caption`(이름표)을 넣을 때 `WordTableBlock` 의 처음 값에만 넣었고, 저장된
8
+ * 표를 그리는 `useWordTableDisplaySettings` 는 그대로였다. 그래서 칩이 켜져도 **처음에는
9
+ * 이름표가 안 찍혔다** — 사람이 칩을 한 번 눌러야 나왔다. 처음 값을 두 자리에 적으면
10
+ * 한 자리가 조용히 뒤처진다.
11
+ *
12
+ * 이름표가 없는 표에 `caption` 이 들어 있어도 해롭지 않다 — 그릴 것이 없으면 안 그리고,
13
+ * 칩은 `hasCaption` 이 꺼 둔다.
14
+ */
15
+ export declare const DEFAULT_CONTENT_TYPES: readonly WordTableContentType[];
16
+ /**
17
+ * **이름표를 쥔 칸이 하나라도 있나** — `유형` 칩을 켤지 가른다(청 (334)).
18
+ *
19
+ * **셈을 한 자리에 둔다**(말귀 청 (339), 2026-10-28). 전에는 `WordTableBlock` 안에만
20
+ * 있었고, 저장된 표를 그리는 **둘째 길**(`useWordTableDisplaySettings`)은 그 셈을 아예 안
21
+ * 했다 — `hasCaption` 이 `undefined` 로 가서 칩이 **늘 잠겼다.** 자료는 다 왔는데 그리라는
22
+ * 말이 안 간 꼴이다(말귀 실측: 열세 칸 전부 `captionBadge` 를 쥐었는데 `showCaption: false`).
23
+ * 같은 물음을 두 자리에서 따로 세면 한 자리가 조용히 틀린다.
24
+ *
25
+ * 머리 칸도 함께 넘긴다 — 활용표의 머리 칸만 이름표를 쥐는 일이 있다(청 (329) 와 같은 결).
26
+ */
27
+ export declare function hasCaptionIn(items: readonly {
28
+ words?: readonly {
29
+ captionBadge?: string;
30
+ captionLabel?: string;
31
+ }[];
32
+ }[]): boolean;
4
33
  export declare function buildCompositionSection(t: TFunction, opts: {
5
34
  hasImage: boolean;
6
35
  hasColloquial: boolean;
7
- hasCaption?: boolean;
36
+ hasCaption: boolean;
8
37
  }): FilterPanelSection;
9
38
  /** @public 용지 방향(가로/세로) 세그먼트 섹션. */
10
39
  export declare function buildOrientationSection(t: TFunction): FilterPanelSection;
@@ -15,7 +15,37 @@ import { ITEMS_PER_PAGE_OPTIONS } from './wordTableBlockTypes';
15
15
  */
16
16
  const SHOW = 'show';
17
17
  const HIDE = 'hide';
18
- export function buildCompositionSection(t, opts) {
18
+ /**
19
+ * **표를 처음 열 때 켜져 있는 구성** — 두 길이 같은 것을 쓴다(말귀 청 (339), 2026-10-28).
20
+ *
21
+ * 청 (334) 로 `caption`(이름표)을 넣을 때 `WordTableBlock` 의 처음 값에만 넣었고, 저장된
22
+ * 표를 그리는 `useWordTableDisplaySettings` 는 그대로였다. 그래서 칩이 켜져도 **처음에는
23
+ * 이름표가 안 찍혔다** — 사람이 칩을 한 번 눌러야 나왔다. 처음 값을 두 자리에 적으면
24
+ * 한 자리가 조용히 뒤처진다.
25
+ *
26
+ * 이름표가 없는 표에 `caption` 이 들어 있어도 해롭지 않다 — 그릴 것이 없으면 안 그리고,
27
+ * 칩은 `hasCaption` 이 꺼 둔다.
28
+ */
29
+ export const DEFAULT_CONTENT_TYPES = ['image', 'word', 'caption', 'standardPron'];
30
+ /**
31
+ * **이름표를 쥔 칸이 하나라도 있나** — `유형` 칩을 켤지 가른다(청 (334)).
32
+ *
33
+ * **셈을 한 자리에 둔다**(말귀 청 (339), 2026-10-28). 전에는 `WordTableBlock` 안에만
34
+ * 있었고, 저장된 표를 그리는 **둘째 길**(`useWordTableDisplaySettings`)은 그 셈을 아예 안
35
+ * 했다 — `hasCaption` 이 `undefined` 로 가서 칩이 **늘 잠겼다.** 자료는 다 왔는데 그리라는
36
+ * 말이 안 간 꼴이다(말귀 실측: 열세 칸 전부 `captionBadge` 를 쥐었는데 `showCaption: false`).
37
+ * 같은 물음을 두 자리에서 따로 세면 한 자리가 조용히 틀린다.
38
+ *
39
+ * 머리 칸도 함께 넘긴다 — 활용표의 머리 칸만 이름표를 쥐는 일이 있다(청 (329) 와 같은 결).
40
+ */
41
+ export function hasCaptionIn(items) {
42
+ return items.some(item => (item.words ?? []).some(w => !!w.captionBadge || !!w.captionLabel));
43
+ }
44
+ export function buildCompositionSection(
45
+ /* `hasCaption` 은 **없어도 되는 것이 아니다.** 안 주면 칩이 잠기는데 화면에는 아무 표시도
46
+ 안 나므로, 빠뜨린 자리를 **tsc 가 잡게** 못 박아 둔다(청 (339) 가 바로 그 자리였다).
47
+ 이름표가 없는 표는 `false` 를 **적어서** 준다 — 빠뜨린 것과 없다고 말한 것이 갈린다. */
48
+ t, opts) {
19
49
  return {
20
50
  label: t('wordTable.filter.composition', '구성'),
21
51
  items: [
@@ -50,6 +50,22 @@ export interface WordTableProps {
50
50
  * 키보드로 옮기면 초점이 그 칸을 따라가고 바뀐 자리를 `role="status"` 로 알린다.
51
51
  */
52
52
  onReorder?: (fromIndex: number, toIndex: number) => void;
53
+ /**
54
+ * 이 표의 첫 칸이 **전체 목록에서 몇 번째**인가 — 쪽으로 나뉜 표에서 `WordTableBlock` 이 준다
55
+ * (말귀 청 (338), 2026-10-28).
56
+ *
57
+ * 쪽마다 `WordTable` 이 따로 서면 `index` 는 **쪽 안의 번호**다. 그래서 `Alt`+`→` 가 쪽의
58
+ * 마지막 칸에서, `Alt`+`←` 가 쪽의 첫 칸에서 **돌아섰다** — 활용표는 스무 칸이 두 쪽이라
59
+ * 쪽 경계가 늘 가운데에 있고, 거기 선 칸은 영영 못 옮겼다(말귀 실측: 눌러도 아무 칸도
60
+ * 안 움직인다).
61
+ *
62
+ * `onReorder` 로 올라가는 번호는 **그대로 쪽 안의 번호**다(쪽을 넘을 때는 `-1` 이나
63
+ * `count` 가 된다) — 부르는 쪽이 이미 `+ 쪽번호 × 쪽당` 을 얹으므로 그 합이 곧 전체
64
+ * 번호가 된다. 부르는 쪽은 고칠 것이 없다.
65
+ */
66
+ indexOffset?: number;
67
+ /** 전체 칸 수 — 쪽으로 나뉜 표에서 양 끝을 전체 기준으로 가른다(`indexOffset` 과 한 짝) */
68
+ totalCount?: number;
53
69
  /** 표시 모드에서 `count` 안의 빈칸(항목 수 뒤 ~ count)에 '추가' 버튼 노출. count 가 항목 수와 같으면 그런 칸이 없다. `onActivateCell` 필요. */
54
70
  showFillerAdd?: boolean;
55
71
  /**
@@ -211,4 +227,4 @@ export interface WordTableProps {
211
227
  * 표시(items)·편집(editCells) 두 모드를 지원한다.
212
228
  * @public
213
229
  */
214
- export default function WordTable({ title, titleIcon, disc, className, orientation, contentTypes, baseItem, baseContentTypes, cutLine, showOutline, showDivLine, items, editCells, count, activeCell, onActivateCell, onRemoveCell, onRemoveItem, onReorder, renderCellAction, showFillerAdd, addableCount, contentRef, buttonSize, brand, code, pageNumber, pageNumberPosition, fitHeight, scoring, marks, onMarkClick, scoreIndexOffset, }: WordTableProps): import("react").JSX.Element;
230
+ export default function WordTable({ title, titleIcon, disc, className, orientation, contentTypes, baseItem, baseContentTypes, cutLine, showOutline, showDivLine, items, editCells, count, activeCell, onActivateCell, onRemoveCell, onRemoveItem, onReorder, indexOffset, totalCount, renderCellAction, showFillerAdd, addableCount, contentRef, buttonSize, brand, code, pageNumber, pageNumberPosition, fitHeight, scoring, marks, onMarkClick, scoreIndexOffset, }: WordTableProps): import("react").JSX.Element;
@@ -277,7 +277,7 @@ function WordCell({ label, subLabel, colloquialLabel, captionLabel, captionBadge
277
277
  * 표시(items)·편집(editCells) 두 모드를 지원한다.
278
278
  * @public
279
279
  */
280
- export default function WordTable({ title, titleIcon, disc, className, orientation = 'landscape', contentTypes = ['image', 'word', 'standardPron'], baseItem, baseContentTypes, cutLine = 'show', showOutline = true, showDivLine = true, items, editCells, count, activeCell = null, onActivateCell, onRemoveCell, onRemoveItem, onReorder, renderCellAction, showFillerAdd = false, addableCount, contentRef, buttonSize = 40, brand, code, pageNumber, pageNumberPosition = 'right', fitHeight = false, scoring = false, marks, onMarkClick, scoreIndexOffset = 0, }) {
280
+ export default function WordTable({ title, titleIcon, disc, className, orientation = 'landscape', contentTypes = ['image', 'word', 'standardPron'], baseItem, baseContentTypes, cutLine = 'show', showOutline = true, showDivLine = true, items, editCells, count, activeCell = null, onActivateCell, onRemoveCell, onRemoveItem, onReorder, indexOffset = 0, totalCount, renderCellAction, showFillerAdd = false, addableCount, contentRef, buttonSize = 40, brand, code, pageNumber, pageNumberPosition = 'right', fitHeight = false, scoring = false, marks, onMarkClick, scoreIndexOffset = 0, }) {
281
281
  const clickMark = useCallback((cellIndex, clicked) => {
282
282
  onMarkClick?.(scoreIndexOffset + cellIndex, clicked);
283
283
  }, [onMarkClick, scoreIndexOffset]);
@@ -326,6 +326,8 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
326
326
  굴러가지도 않아 손가락으로도 못 바꿨다. 표를 만드는 화면의 핵심 조작인데
327
327
  마우스 있는 사람만 쓸 수 있었다. 마우스 끌기는 그대로 두고 두 길을 더한다. */
328
328
  const wordCount = items?.length ?? 0;
329
+ /* 쪽으로 나뉜 표에서는 **전체** 칸 수로 양 끝을 가른다(청 (338)) — 안 주면 이 표가 전부다 */
330
+ const reorderTotal = totalCount ?? wordCount;
329
331
  /** 지금 손가락에 끌려가는 칸 */
330
332
  const [dragging, setDragging] = useState(null);
331
333
  /** 낭독기에 바뀐 자리를 알리는 글. 처음에는 비워 둔다 — 열자마자 뜬금없이 읽지 않게. */
@@ -347,12 +349,16 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
347
349
  contentRef.current = el;
348
350
  }, [contentRef]);
349
351
  const move = useCallback((from, to) => {
350
- focusTarget.current = to;
352
+ /* **초점 갈 곳은 전체 번호로 둔다** — 쪽을 넘는 이동에서는 그 칸이 **옆 쪽의 표**에
353
+ 서므로, 이 표 안의 번호로는 찾을 수 없다(청 (338)). */
354
+ focusTarget.current = indexOffset + to;
351
355
  onReorder?.(from, to);
356
+ /* 낭독기에 이르는 수도 전체 기준이다 — 쪽 안의 번호를 읽으면 "20칸 가운데 1번째" 가
357
+ 두 번 나와 어디로 갔는지 알 수 없다 */
352
358
  setMoveAnnounce(t('wordTable.reorder.moved', {
353
- n: to + 1, total: wordCount, defaultValue: '{{total}}칸 가운데 {{n}}번째로 옮김',
359
+ n: indexOffset + to + 1, total: reorderTotal, defaultValue: '{{total}}칸 가운데 {{n}}번째로 옮김',
354
360
  }));
355
- }, [onReorder, t, wordCount]);
361
+ }, [onReorder, t, reorderTotal, indexOffset]);
356
362
  /* 옮긴 칸을 초점이 따라간다. 자리를 잃으면 다음 Alt+화살표가 엉뚱한 칸을 민다 —
357
363
  아예 문서 처음으로 튀어 어디였는지도 알 수 없다. 의존성 배열 없이 매 렌더 뒤에
358
364
  보되 `초점갈곳` 이 비어 있으면 곧바로 돌아온다(거의 언제나 그렇다). */
@@ -361,8 +367,12 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
361
367
  if (to == null)
362
368
  return;
363
369
  focusTarget.current = null;
364
- const cells = gridRef.current?.querySelectorAll('.word-table__card:not(.word-table__card--filler):not(.word-table__card--base)');
365
- cells?.[to]?.querySelector('.word-table__card-handle button')?.focus();
370
+ /* **쪽을 넘어 찾는다**(청 (338)). 쪽으로 나뉜 표는 쪽마다 `WordTable` 이 따로 서므로,
371
+ 옆 쪽으로 옮긴 칸은 **이 표 안에 없다.** 쪽들을 담은 상자까지 올라가 전체 번호로 찾는다
372
+ — 그 상자가 없으면(쪽이 안 나뉜 표) 이 표 안에서만 찾는다. 상자까지 올라가는 것이
373
+ `document` 전체를 뒤지는 것보다 좁다: 한 화면에 표가 둘이면 번호가 겹친다. */
374
+ const scope = gridRef.current?.closest('.word-table-block__pages') ?? gridRef.current;
375
+ scope?.querySelector(`[data-wordtable-index="${to}"] .word-table__card-handle button`)?.focus();
366
376
  });
367
377
  /* 떠날 때 걸어 둔 것을 푼다 — 길게 누르는 중에 팝업이 닫히면 window 리스너와
368
378
  타이머가 남아 사라진 화면의 상태를 건드린다(표의 폭 조절에서 겪은 것과 같다). */
@@ -383,10 +393,14 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
383
393
  return;
384
394
  e.preventDefault();
385
395
  const to = index + (forward ? 1 : -1);
386
- if (to < 0 || to >= wordCount)
387
- return; // 양 끝 — 아무 일도 하지 않는다
396
+ /* **전체 기준으로 가른다**(청 (338)). 쪽 안의 번호로 가르면 쪽의 첫 칸(`to = -1`)과
397
+ 마지막 칸(`to = 쪽당`)에서 돌아서, 쪽 경계에 선 칸을 영영 못 옮긴다. 넘기는 번호는
398
+ 그대로 쪽 안의 것이라(`-1`·`count`) 부르는 쪽이 얹는 쪽 몫과 합쳐 전체 번호가 된다. */
399
+ const globalTo = indexOffset + to;
400
+ if (globalTo < 0 || globalTo >= reorderTotal)
401
+ return; // 전체의 양 끝 — 아무 일도 하지 않는다
388
402
  move(index, to);
389
- }, [onReorder, wordCount, move]);
403
+ }, [onReorder, reorderTotal, indexOffset, move]);
390
404
  /**
391
405
  * **손가락으로 옮긴다** — 길게 누르면(400ms) 끌기가 시작되고 손가락 밑의 칸으로 떨어진다.
392
406
  *
@@ -616,7 +630,7 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
616
630
  gridRow: `1 / span ${half.rows}`,
617
631
  /* 머리 칸과 나머지 절반을 가르는 점선 — 가로면 오른쪽, 세로면 아래쪽 */
618
632
  ...dotDashStyle(0, orientation === 'landscape' ? 2 : 1, orientation === 'landscape' ? 1 : 2, cutLine),
619
- }, children: (baseItem.words ?? []).map((w, wi) => (_jsxs(Fragment, { children: [wi > 0 && _jsx("div", { className: withLegacy("word-table__pair-divider") }), _jsx(WordCell, { outerScale: scale, label: w.label, subLabel: w.subLabel, colloquialLabel: w.colloquialLabel, captionLabel: w.captionLabel, captionBadge: w.captionBadge, homonum: w.homonum, showWord: baseShow.word, showImage: baseShow.image, showPronunciation: baseShow.pron, showColloquial: baseShow.colloq, showCaption: baseShow.caption, buttonSize: buttonSize, wordInfo: (w.grade || w.syllables != null || w.pos || w.wordType) ? { grade: w.grade, syllables: w.syllables, pos: w.pos, wordType: w.wordType } : undefined })] }, wi))) })), (items ?? []).map((item, index) => (_jsxs("div", { "data-wordtable-cell": onReorder ? index : undefined, className: withLegacy(`word-table__card${onReorder ? ' word-table__card--draggable' : ''}${dragOver === index ? ' word-table__card--drag-over' : ''}${dragging === index ? ' word-table__card--dragging' : ''}`), style: dotDashStyle(index, itemCols, itemRows, cutLine), draggable: !!onReorder, onPointerDown: onReorder ? (e) => longPressDrag(e, index) : undefined, onKeyDown: onReorder ? (e) => moveByKey(e, index) : undefined, onDragStart: onReorder ? () => { dragIndex.current = index; } : undefined, onDragOver: onReorder ? (e) => { e.preventDefault(); setDragOver(index); } : undefined, onDragLeave: onReorder ? () => setDragOver(null) : undefined, onDrop: onReorder ? (e) => { e.preventDefault(); if (dragIndex.current !== null && dragIndex.current !== index) {
633
+ }, children: (baseItem.words ?? []).map((w, wi) => (_jsxs(Fragment, { children: [wi > 0 && _jsx("div", { className: withLegacy("word-table__pair-divider") }), _jsx(WordCell, { outerScale: scale, label: w.label, subLabel: w.subLabel, colloquialLabel: w.colloquialLabel, captionLabel: w.captionLabel, captionBadge: w.captionBadge, homonum: w.homonum, showWord: baseShow.word, showImage: baseShow.image, showPronunciation: baseShow.pron, showColloquial: baseShow.colloq, showCaption: baseShow.caption, buttonSize: buttonSize, wordInfo: (w.grade || w.syllables != null || w.pos || w.wordType) ? { grade: w.grade, syllables: w.syllables, pos: w.pos, wordType: w.wordType } : undefined })] }, wi))) })), (items ?? []).map((item, index) => (_jsxs("div", { "data-wordtable-cell": onReorder ? index : undefined, "data-wordtable-index": onReorder ? indexOffset + index : undefined, className: withLegacy(`word-table__card${onReorder ? ' word-table__card--draggable' : ''}${dragOver === index ? ' word-table__card--drag-over' : ''}${dragging === index ? ' word-table__card--dragging' : ''}`), style: dotDashStyle(index, itemCols, itemRows, cutLine), draggable: !!onReorder, onPointerDown: onReorder ? (e) => longPressDrag(e, index) : undefined, onKeyDown: onReorder ? (e) => moveByKey(e, index) : undefined, onDragStart: onReorder ? () => { dragIndex.current = index; } : undefined, onDragOver: onReorder ? (e) => { e.preventDefault(); setDragOver(index); } : undefined, onDragLeave: onReorder ? () => setDragOver(null) : undefined, onDrop: onReorder ? (e) => { e.preventDefault(); if (dragIndex.current !== null && dragIndex.current !== index) {
620
634
  onReorder(dragIndex.current, index);
621
635
  } ; dragIndex.current = null; setDragOver(null); } : undefined, onDragEnd: onReorder ? () => { dragIndex.current = null; setDragOver(null); } : undefined, children: [(item.words ?? []).map((w, i) => (_jsxs(Fragment, { children: [i > 0 && _jsx("div", { className: withLegacy("word-table__pair-divider") }), _jsx(WordCell, { outerScale: scale, label: w.label, subLabel: w.subLabel, colloquialLabel: w.colloquialLabel, captionLabel: w.captionLabel, captionBadge: w.captionBadge, homonum: w.homonum, showWord: show.word, showImage: show.image, showPronunciation: show.pron, showColloquial: show.colloq, showCaption: show.caption, buttonSize: buttonSize, wordInfo: (w.grade || w.syllables != null || w.pos || w.wordType) ? { grade: w.grade, syllables: w.syllables, pos: w.pos, wordType: w.wordType } : undefined })] }, i))), scoring && renderScore(index, (item.words ?? []).map(w => w.label).join(' / ')), (renderCellAction || onRemoveItem || onReorder) && (
622
636
  /* **오른쪽 기둥** — 빼기 → 부르는 쪽이 얹은 것 → 옮기기 손잡이 차례로 쌓인다
@@ -0,0 +1,46 @@
1
+ /**
2
+ * **잰 열 폭을 그릇에 맞춘다** — 남는 자리는 비율대로 나누고, 좁으면 비율대로 줄인다.
3
+ *
4
+ * 잰 값을 그대로 쓰면 칸이 제 글자만큼만 차지해 표 오른쪽에 빈 자리가 남는다(다 왼쪽에
5
+ * 붙어 보인다). 그래서 고정 px 열을 뺀 나머지를 **잰 크기의 비율대로** 늘리거나 줄여 그릇을
6
+ * 꽉 채운다 — 좁으면 줄고 넓으면 는다. 한 식으로 둘 다 된다.
7
+ *
8
+ * **줄일 때의 바닥이 이 함수의 핵이다**(말귀 청 (217), 2026-10-28). 바닥이 선언된 밑값
9
+ * 하나뿐이던 때는, 그 칸에 `minmax(…px,…)` 가 없으면 `MIN_COL_W`(48px) 한 값으로 떨어져
10
+ * **머리글자가 잘렸다** — 사장님이 화면에서 `성별` 이 `성ᅧ` 로 잘린 것을 짚으셨다(말귀 실측:
11
+ * 단추 칸 머리는 118px 이 드는데 70px 로 줄었다). 머리 폭은 이미 재고 있었고 **줄일 때만
12
+ * 잊었다.** 그래서 바닥을 부르는 쪽이 넘긴다 — 선언된 밑값과 머리글자가 드는 폭 가운데
13
+ * 넓은 쪽이다.
14
+ *
15
+ * 바닥에 걸린 열이 있으면 합이 그릇을 넘을 수 있다. 그것은 **담을 수 없을 만큼 좁다는 뜻**
16
+ * 이라 가로 스크롤로 두는 편이 맞다 — 잘려 안 보이는 것보다 밀어서 보는 편이 낫다.
17
+ */
18
+ export interface FitWidthsOptions {
19
+ /** 이 열이 고정 px 인가 — 고정 열은 비율에 안 든다(정해 둔 크기를 잃지 않게) */
20
+ isFixed: (index: number) => boolean;
21
+ /** 이 열이 줄어들 수 있는 바닥 */
22
+ floorOf: (index: number) => number;
23
+ /** 열들이 채울 그릇의 안쪽 폭 */
24
+ containerWidth: number;
25
+ }
26
+ export declare function fitFluidWidths(measured: readonly number[], opts: FitWidthsOptions): number[];
27
+ /** 정렬 화살표가 드는 폭 — `SortArrow` 의 `size={16}` 과 같아야 한다(어긋나면 머리가 잘린다) */
28
+ export declare const SORT_ARROW_W = 16;
29
+ export interface ColumnFloorInput {
30
+ /** 선언된 밑값 — `minmax(…px,…)` 의 밑값, 없으면 `MIN_COL_W` */
31
+ declaredMin: number;
32
+ /** 그 칸 **머리글자**가 드는 폭(`max-content` 로 재 둔 값) */
33
+ headWidth: number;
34
+ /** 이 칸을 눌러 정렬할 수 있나 */
35
+ sortable: boolean;
36
+ /** 지금 이 칸으로 정렬돼 있나 — 그때만 화살표가 서 있다 */
37
+ sorted: boolean;
38
+ }
39
+ /**
40
+ * **열이 줄어들 수 있는 바닥** — 선언된 밑값과 머리글자가 드는 폭 가운데 넓은 쪽(청 (217)).
41
+ *
42
+ * **화살표 자리를 정렬 가능한 칸 모두에 얹는다.** 화살표는 *지금 고른* 칸에만 서므로
43
+ * (말귀 실측: 고른 칸 16px, 나머지 0), 지금 폭만 보고 바닥을 잡으면 **다른 칸을 고르는
44
+ * 순간 그 칸만 잘린다.** 이미 선 칸에는 그 16px 이 `headWidth` 에 들어 있으니 또 얹지 않는다.
45
+ */
46
+ export declare function columnFloors(cols: readonly ColumnFloorInput[], arrowWidth?: number): number[];
@@ -0,0 +1,55 @@
1
+ /**
2
+ * **잰 열 폭을 그릇에 맞춘다** — 남는 자리는 비율대로 나누고, 좁으면 비율대로 줄인다.
3
+ *
4
+ * 잰 값을 그대로 쓰면 칸이 제 글자만큼만 차지해 표 오른쪽에 빈 자리가 남는다(다 왼쪽에
5
+ * 붙어 보인다). 그래서 고정 px 열을 뺀 나머지를 **잰 크기의 비율대로** 늘리거나 줄여 그릇을
6
+ * 꽉 채운다 — 좁으면 줄고 넓으면 는다. 한 식으로 둘 다 된다.
7
+ *
8
+ * **줄일 때의 바닥이 이 함수의 핵이다**(말귀 청 (217), 2026-10-28). 바닥이 선언된 밑값
9
+ * 하나뿐이던 때는, 그 칸에 `minmax(…px,…)` 가 없으면 `MIN_COL_W`(48px) 한 값으로 떨어져
10
+ * **머리글자가 잘렸다** — 사장님이 화면에서 `성별` 이 `성ᅧ` 로 잘린 것을 짚으셨다(말귀 실측:
11
+ * 단추 칸 머리는 118px 이 드는데 70px 로 줄었다). 머리 폭은 이미 재고 있었고 **줄일 때만
12
+ * 잊었다.** 그래서 바닥을 부르는 쪽이 넘긴다 — 선언된 밑값과 머리글자가 드는 폭 가운데
13
+ * 넓은 쪽이다.
14
+ *
15
+ * 바닥에 걸린 열이 있으면 합이 그릇을 넘을 수 있다. 그것은 **담을 수 없을 만큼 좁다는 뜻**
16
+ * 이라 가로 스크롤로 두는 편이 맞다 — 잘려 안 보이는 것보다 밀어서 보는 편이 낫다.
17
+ */
18
+ export function fitFluidWidths(measured, opts) {
19
+ const { isFixed, floorOf, containerWidth } = opts;
20
+ const fixedTotal = measured.reduce((a, w, i) => a + (isFixed(i) ? w : 0), 0);
21
+ const fluidTotal = measured.reduce((a, w, i) => a + (isFixed(i) ? 0 : w), 0);
22
+ const available = containerWidth - fixedTotal;
23
+ /* 맞출 수 없는 자리에서는 **잰 값을 그대로 둔다** — 그릇을 아직 모르거나(0), 유동 열이
24
+ 없거나, 고정 열만으로 이미 그릇을 넘었을 때다. */
25
+ if (!(containerWidth > 0 && fluidTotal > 0 && available > 0))
26
+ return [...measured];
27
+ const ratio = available / fluidTotal;
28
+ const out = measured.map((w, i) => (isFixed(i) ? w : Math.max(floorOf(i), Math.round(w * ratio))));
29
+ /* 반올림으로 남은 몇 px 은 **가장 넓은 유동 열**에 얹는다 — 안 그러면 늘 몇 px 이 비거나
30
+ 넘친다. 바닥에 걸린 열이 있으면 넘칠 수 있는데, 위 머리말에 적은 그 자리다. */
31
+ const diff = Math.round(available - out.reduce((a, w, i) => a + (isFixed(i) ? 0 : w), 0));
32
+ if (diff !== 0) {
33
+ let widestIndex = -1;
34
+ out.forEach((w, i) => { if (!isFixed(i) && (widestIndex < 0 || w > out[widestIndex]))
35
+ widestIndex = i; });
36
+ if (widestIndex >= 0)
37
+ out[widestIndex] = Math.max(floorOf(widestIndex), out[widestIndex] + diff);
38
+ }
39
+ return out;
40
+ }
41
+ /** 정렬 화살표가 드는 폭 — `SortArrow` 의 `size={16}` 과 같아야 한다(어긋나면 머리가 잘린다) */
42
+ export const SORT_ARROW_W = 16;
43
+ /**
44
+ * **열이 줄어들 수 있는 바닥** — 선언된 밑값과 머리글자가 드는 폭 가운데 넓은 쪽(청 (217)).
45
+ *
46
+ * **화살표 자리를 정렬 가능한 칸 모두에 얹는다.** 화살표는 *지금 고른* 칸에만 서므로
47
+ * (말귀 실측: 고른 칸 16px, 나머지 0), 지금 폭만 보고 바닥을 잡으면 **다른 칸을 고르는
48
+ * 순간 그 칸만 잘린다.** 이미 선 칸에는 그 16px 이 `headWidth` 에 들어 있으니 또 얹지 않는다.
49
+ */
50
+ export function columnFloors(cols, arrowWidth = SORT_ARROW_W) {
51
+ return cols.map(c => {
52
+ const needsArrowRoom = c.sortable && !c.sorted;
53
+ return Math.max(c.declaredMin, Math.ceil(c.headWidth + (needsArrowRoom ? arrowWidth : 0)));
54
+ });
55
+ }
@@ -46,4 +46,4 @@
46
46
  *
47
47
  * 값은 손으로 적고 `test/coreVersion.test.ts` 가 package.json 과 어긋나면 운다.
48
48
  */
49
- export declare const CORE_VERSION = "0.383.0";
49
+ export declare const CORE_VERSION = "0.385.0";