@ihabdevteam/core 0.380.0 → 0.382.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +142 -1
- package/dist/components.cjs.js +172 -172
- package/dist/components.esm.css +1 -1
- package/dist/hooks.cjs.js +3 -3
- package/dist/i18n.cjs.js +3 -3
- package/dist/ihabdevteam-core.cjs.js +177 -177
- package/dist/ihabdevteam-core.d.ts +20 -3
- package/dist/packages/core/src/components/Word/TableFilterPanel.d.ts +2 -0
- package/dist/packages/core/src/components/Word/TableFilterPanel.js +2 -2
- package/dist/packages/core/src/components/Word/WordTableBlock.d.ts +1 -1
- package/dist/packages/core/src/components/Word/WordTableBlock.js +43 -9
- package/dist/packages/core/src/components/Word/wordTableBlockTypes.d.ts +15 -0
- package/dist/packages/core/src/components/Word/wordTableSettings.d.ts +23 -5
- package/dist/packages/core/src/components/Word/wordTableSettings.js +29 -7
- package/dist/packages/core/src/components/WordTable.css +33 -8
- package/dist/packages/core/src/components/WordTable.js +44 -6
- package/dist/packages/core/src/components/wordTableLayout.d.ts +1 -1
- package/dist/packages/core/src/i18n/locales/en.json +1 -0
- package/dist/packages/core/src/i18n/locales/ko.json +1 -0
- package/dist/packages/core/src/utils/headProbeStatus.d.ts +21 -0
- package/dist/packages/core/src/utils/headProbeStatus.js +23 -0
- package/dist/packages/core/src/utils/imageConfig.js +3 -2
- package/dist/packages/core/src/utils/ttsConfig.js +3 -2
- package/dist/packages/core/src/version.d.ts +1 -1
- package/dist/packages/core/src/version.js +1 -1
- package/dist/utils.cjs.js +160 -160
- package/package.json +1 -1
|
@@ -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.
|
|
1790
|
+
export declare const CORE_VERSION = "0.382.0";
|
|
1791
1791
|
|
|
1792
1792
|
/** @public */
|
|
1793
1793
|
declare const coreDefault: Record<string, unknown>;
|
|
@@ -7921,6 +7921,8 @@ declare interface TableFilterPanelShellProps extends TableFilterPanelBaseProps {
|
|
|
7921
7921
|
declare interface TableFilterPanelSmartProps extends TableFilterPanelBaseProps {
|
|
7922
7922
|
hasImage: boolean;
|
|
7923
7923
|
hasColloquial: boolean;
|
|
7924
|
+
/** 이름표를 쥔 칸이 하나라도 있나 — '유형' 칩을 켤지 가른다(청 (334)) */
|
|
7925
|
+
hasCaption?: boolean;
|
|
7924
7926
|
contentTypes: WordTableContentType[];
|
|
7925
7927
|
orientation: WordTableOrientation;
|
|
7926
7928
|
showOutline: boolean;
|
|
@@ -11523,7 +11525,7 @@ export declare interface WordSearchResultWord {
|
|
|
11523
11525
|
*/
|
|
11524
11526
|
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;
|
|
11525
11527
|
|
|
11526
|
-
export declare function WordTableBlock({ title, titleIcon, disc, filterTitle, filterCollapsible, filterDefaultCollapsed, filterCollapsed, onFilterCollapsedChange, filterHeaderSummary, brand, code, baseItem, baseContentTypes, cellCapacity, 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;
|
|
11528
|
+
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;
|
|
11527
11529
|
|
|
11528
11530
|
/** @public */
|
|
11529
11531
|
export declare interface WordTableBlockProps {
|
|
@@ -11601,6 +11603,21 @@ export declare interface WordTableBlockProps {
|
|
|
11601
11603
|
* 그쪽이 이긴다(사람이 고른 것이 마지막 말이다).
|
|
11602
11604
|
*/
|
|
11603
11605
|
cellCapacity?: number;
|
|
11606
|
+
/**
|
|
11607
|
+
* **한 쪽에 설 수 있는 가장 많은 수** — '페이지당 개수' 고르개의 첫 칸이 여기서 멎는다.
|
|
11608
|
+
*
|
|
11609
|
+
* 사장님 지시(2026-10-28) *"단어 수 최대와 페이지당 단어 수 최대가 다른거야"* ·
|
|
11610
|
+
* *"단어는 20개더라도 페이지당 표현은 12로 선택할 수 있도록 해야지"*(말귀 청 (333)).
|
|
11611
|
+
* 활용표의 **칸 수는 낱말이 정하고**(동사 36 · 형용사 21), 종이 한 장에 열둘보다 많으면
|
|
11612
|
+
* 글자가 작아져 못 읽는다 — 그래서 둘이 다른 수다.
|
|
11613
|
+
*
|
|
11614
|
+
* 안 주면 지금까지대로 칸 수가 첫 칸이다. 칸 수보다 크면 무시한다(없는 자리를 고를 수 없다).
|
|
11615
|
+
*
|
|
11616
|
+
* **이것은 `cellCapacity` 와 다르다** — `cellCapacity` 는 *표가 몇 칸인가*, 이것은 *그
|
|
11617
|
+
* 칸들이 한 쪽에 몇씩 서는가* 다. 스무 칸짜리 표에 `maxItemsPerPage={12}` 면 칸은 스물
|
|
11618
|
+
* 그대로고 쪽이 둘로 나뉜다.
|
|
11619
|
+
*/
|
|
11620
|
+
maxItemsPerPage?: number;
|
|
11604
11621
|
disc?: ReactNode;
|
|
11605
11622
|
/** 현재 표의 저장된 이름(불러온 표 등). 있으면 인쇄/PDF 저장 시 파일명으로 사용, 없으면 "오늘 날짜 + 단어표/대립쌍표" */
|
|
11606
11623
|
tableName?: string;
|
|
@@ -11789,7 +11806,7 @@ export declare interface WordTableButtonProps {
|
|
|
11789
11806
|
*
|
|
11790
11807
|
* @public
|
|
11791
11808
|
*/
|
|
11792
|
-
export declare type WordTableContentType = 'word' | 'image' | 'standardPron' | 'colloquialPron';
|
|
11809
|
+
export declare type WordTableContentType = 'word' | 'image' | 'standardPron' | 'colloquialPron' | 'caption';
|
|
11793
11810
|
|
|
11794
11811
|
/** 칸 사이 선 — **코드다.** 보일 글은 사전(`wordTable.filter.show`·`.dotted`·`.corner`·`.hide`). @public */
|
|
11795
11812
|
export declare type WordTableCutLine = 'show' | 'dashed' | 'corner' | 'hide';
|
|
@@ -34,6 +34,8 @@ export interface TableFilterPanelShellProps extends TableFilterPanelBaseProps {
|
|
|
34
34
|
export interface TableFilterPanelSmartProps extends TableFilterPanelBaseProps {
|
|
35
35
|
hasImage: boolean;
|
|
36
36
|
hasColloquial: boolean;
|
|
37
|
+
/** 이름표를 쥔 칸이 하나라도 있나 — '유형' 칩을 켤지 가른다(청 (334)) */
|
|
38
|
+
hasCaption?: boolean;
|
|
37
39
|
contentTypes: WordTableContentType[];
|
|
38
40
|
orientation: WordTableOrientation;
|
|
39
41
|
showOutline: boolean;
|
|
@@ -22,9 +22,9 @@ export default function TableFilterPanel(props) {
|
|
|
22
22
|
if (isShellProps(props)) {
|
|
23
23
|
return (_jsx(FilterPanel, { className: className, title: title ?? t('wordTable.filterTitle', '표 설정'), sections: props.sections, selected: props.selected, onSelect: props.onSelect, ...collapseProps, align: "inline" }));
|
|
24
24
|
}
|
|
25
|
-
const { hasImage, hasColloquial, contentTypes, orientation, showOutline, cutLine, showDivLine, setters, showCutLine = false, showDivLine2 = false, middleSections = [], extraSelected = {}, onExtraSelect, showPaperBands = false, showTopInfo = true, showBottomInfo = true, } = props;
|
|
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 }),
|
|
27
|
+
buildCompositionSection(t, { hasImage, hasColloquial, hasCaption }),
|
|
28
28
|
buildOrientationSection(t),
|
|
29
29
|
...middleSections,
|
|
30
30
|
buildBorderSection(t),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import './WordTableBlock.css';
|
|
2
2
|
import type { WordTableBlockProps } from './wordTableBlockTypes';
|
|
3
3
|
export type { WordEntry, WordTableBlockProps } from './wordTableBlockTypes';
|
|
4
|
-
export default function WordTableBlock({ title, titleIcon, disc, filterTitle, filterCollapsible, filterDefaultCollapsed, filterCollapsed, onFilterCollapsedChange, filterHeaderSummary, brand, code, baseItem, baseContentTypes, cellCapacity, 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): import("react").JSX.Element;
|
|
4
|
+
export default 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): import("react").JSX.Element;
|
|
@@ -44,7 +44,7 @@ function withUniqueIds(list) {
|
|
|
44
44
|
return id === it.id ? it : { ...it, id };
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
export default function WordTableBlock({ title, titleIcon, disc, filterTitle, filterCollapsible, filterDefaultCollapsed, filterCollapsed, onFilterCollapsedChange, filterHeaderSummary, brand, code, baseItem, baseContentTypes, cellCapacity, 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 }) {
|
|
47
|
+
export default 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 }) {
|
|
48
48
|
const { t } = useTranslation();
|
|
49
49
|
const resolvedResetLabel = resetLabel ?? t('wordPrint.clearAllSelection', '모두 선택 해제');
|
|
50
50
|
const isEditable = items === undefined;
|
|
@@ -83,7 +83,9 @@ export default function WordTableBlock({ title, titleIcon, disc, filterTitle, fi
|
|
|
83
83
|
const band = brand && { ...brand, top: showTopInfo, bottom: showBottomInfo };
|
|
84
84
|
// 공통 단어 표 설정 상태
|
|
85
85
|
const [orientation, setOrientation] = useState('landscape');
|
|
86
|
-
|
|
86
|
+
/* `caption` 이 처음부터 켜져 있다 — 안 넣으면 (334) 가 들어오는 날 **지금까지 서던
|
|
87
|
+
이름표가 통째로 사라진다**(`showOf` 는 빈 배열일 때만 다 켠다). 끄는 것은 사람이 한다. */
|
|
88
|
+
const [contentTypes, setContentTypes] = useState(['image', 'word', 'caption', 'standardPron']);
|
|
87
89
|
const [cutLine, setCutLine] = useState('show');
|
|
88
90
|
const [showOutline, setShowOutline] = useState(true);
|
|
89
91
|
const [showDivLine, setShowDivLine] = useState(true);
|
|
@@ -135,11 +137,35 @@ export default function WordTableBlock({ title, titleIcon, disc, filterTitle, fi
|
|
|
135
137
|
**항목 수가 아니라 자리 수로 조인다**(청 (327)). 항목이 하나뿐인 열두 칸짜리 표를
|
|
136
138
|
항목 수로 조이면 한 쪽에 한 칸씩 **열두 쪽**이 된다. `cellCapacity` 를 안 주면
|
|
137
139
|
자리 수 = 항목 수라 지금까지와 같다. */
|
|
138
|
-
|
|
140
|
+
/* 천장이 있으면 거기서 멎는다 — 칸 수와 **한 쪽에 서는 수**는 다른 것이다(청 (333)) */
|
|
141
|
+
const perPageCeiling = Math.max(1, Math.min(capacity, maxItemsPerPage ?? capacity));
|
|
142
|
+
const effectiveItemsPerPage = Math.min(itemsPerPageSetting, perPageCeiling);
|
|
139
143
|
const itemsPerPage = pagesEnabled ? effectiveItemsPerPage : count;
|
|
140
|
-
/* 쪽은
|
|
141
|
-
|
|
142
|
-
|
|
144
|
+
/* 쪽은 **쓸 자리가 닿는 곳까지만** 센다(말귀 청 (337), 2026-10-28,
|
|
145
|
+
사장님 *"모두 빈칸이 되면 없어야지"*).
|
|
146
|
+
|
|
147
|
+
규칙 한 줄: **한 쪽은 항목을 쥐었거나, 다음에 들어갈 첫 빈자리를 쥐었을 때 선다.**
|
|
148
|
+
그 뒤는 안 선다.
|
|
149
|
+
|
|
150
|
+
전에는 **자리 수**로 셌다 — `올림(capacity / 쪽당)`. 빈 칸만 남은 쪽도 서야 거기
|
|
151
|
+
'추가하기' 가 닿는다고 보았는데(청 (327)), 자리 수를 부르는 쪽이 못 박아 넘기면
|
|
152
|
+
**아무것도 없는 쪽이 여럿** 선다: 자리 36 · 항목 27 · 쪽당 6 이면 다섯째 쪽에 셋과 빈 칸
|
|
153
|
+
셋이 서고 **여섯째 쪽은 통째로 빈 종이**다(말귀 실측).
|
|
154
|
+
|
|
155
|
+
위 규칙은 둘을 다 지킨다 — 첫 빈자리를 쥔 쪽까지는 서니 '추가하기' 가 늘 닿고(청 (327)
|
|
156
|
+
의 자리 10 · 항목 8 · 쪽당 4 도 셋째 쪽이 그대로 선다), 그 **뒤**는 더할 자리가 없으므로
|
|
157
|
+
안 선다.
|
|
158
|
+
|
|
159
|
+
**쪽이 딱 나누어떨어질 때는 빈 쪽 하나가 선다** — 항목 24 · 자리 36 · 쪽당 12 면 첫
|
|
160
|
+
빈자리가 셋째 쪽 머리라 셋째 쪽이 선다. 그 한 장까지 없애려면 부르는 쪽이 자리 수를
|
|
161
|
+
항목 수에 맞춰 줘야 한다(말귀는 `올림(항목/12) × 12` 로 이미 그렇게 쥔다 — 항목 24 면
|
|
162
|
+
자리도 24 라 두 쪽이다). 여기서 더 줄이면 **더할 자리가 사라진다.** */
|
|
163
|
+
const pagesWithItems = Math.ceil((items?.length ?? 0) / Math.max(1, itemsPerPage));
|
|
164
|
+
/* 첫 빈자리는 `items.length` 번 칸이다 — 자리가 남았을 때만 있다 */
|
|
165
|
+
const pageOfFirstFree = (items?.length ?? 0) < capacity
|
|
166
|
+
? Math.floor((items?.length ?? 0) / Math.max(1, itemsPerPage)) + 1
|
|
167
|
+
: 0;
|
|
168
|
+
const pageCount = pagesEnabled ? Math.max(1, pagesWithItems, pageOfFirstFree) : 0;
|
|
143
169
|
const pages = pagesEnabled
|
|
144
170
|
? Array.from({ length: pageCount }, (_, i) => (items ?? []).slice(i * itemsPerPage, (i + 1) * itemsPerPage))
|
|
145
171
|
: null;
|
|
@@ -183,6 +209,11 @@ export default function WordTableBlock({ title, titleIcon, disc, filterTitle, fi
|
|
|
183
209
|
const hasColloquial = isEditable
|
|
184
210
|
? visibleCells.some(c => c?.some(e => !!e.colloquialPronunciation))
|
|
185
211
|
: (items ?? []).some(item => (item.words ?? []).some(w => !!w.colloquialLabel));
|
|
212
|
+
/* 이름표를 쥔 칸이 하나라도 있나 — 없으면 '유형' 칩이 회색으로 선다(청 (334)).
|
|
213
|
+
편집 격자에는 이름표를 담는 자리가 없다(`WordEntry` 에 없다) — 거기서는 늘 꺼진다.
|
|
214
|
+
머리 칸도 센다 — 활용표의 머리 칸만 이름표를 쥐는 일이 있다(청 (329) 와 같은 결). */
|
|
215
|
+
const hasCaption = !isEditable && [...(baseItem ? [baseItem] : []), ...(items ?? [])]
|
|
216
|
+
.some(item => (item.words ?? []).some(w => !!w.captionBadge || !!w.captionLabel));
|
|
186
217
|
// 표에 실제로 이미지가 있는지 — resolver(word)는 존재 여부와 무관하게 항상 URL을 만들어 반환하므로
|
|
187
218
|
// 그 truthiness만으로는 판정할 수 없다(항상 true가 되어 이미지 없는 표에서도 '이미지' 토글이
|
|
188
219
|
// 활성화되는 문제가 있었다). checkImageExists로 실제 HEAD 요청(+캐시) 확인을 거친다.
|
|
@@ -220,11 +251,11 @@ export default function WordTableBlock({ title, titleIcon, disc, filterTitle, fi
|
|
|
220
251
|
const middleSections = useMemo(() => [
|
|
221
252
|
...((isEditable || showCellCount) ? [{ label: t('wordTable.filter.columns', '칸 수'), items: CELL_COUNTS.map(n => ({ value: `${n}칸`, displayLabel: t('wordTable.filter.column', { count: n }) })), display: 'segmented' }] : []),
|
|
222
253
|
// 내용이 있는(1개 이상) 표면 '페이지당 대립쌍/단어 수'를 항상 노출한다(표시 모드 한정).
|
|
223
|
-
...(pagesEnabled && (items?.length ?? 0) > 0 ? [buildItemsPerPageSection(t, { hasPairs, itemCount: capacity })] : []),
|
|
254
|
+
...(pagesEnabled && (items?.length ?? 0) > 0 ? [buildItemsPerPageSection(t, { hasPairs, itemCount: capacity, max: maxItemsPerPage })] : []),
|
|
224
255
|
/* 이 블록은 종이 띠를 안 받는다 — 쪽 번호가 설 데가 여기뿐이라 자리 고르개를 그대로 둔다
|
|
225
256
|
(띠를 쓰는 `WordTable` 쪽만 이 절을 걷는다). */
|
|
226
257
|
...(isPaginated ? [buildPageNumberSection(t)] : []),
|
|
227
|
-
], [t, isEditable, showCellCount, pagesEnabled, items?.length, hasPairs, capacity, isPaginated]);
|
|
258
|
+
], [t, isEditable, showCellCount, pagesEnabled, items?.length, hasPairs, capacity, maxItemsPerPage, isPaginated]);
|
|
228
259
|
const middleSelected = {
|
|
229
260
|
...((isEditable || showCellCount) ? { [t('wordTable.filter.columns', '칸 수')]: `${count}칸` } : {}),
|
|
230
261
|
...(pagesEnabled && (items?.length ?? 0) > 0 ? { [t(hasPairs ? 'wordTable.filter.itemsPerPagePair' : 'wordTable.filter.itemsPerPageWord')]: `${effectiveItemsPerPage}개` } : {}),
|
|
@@ -240,6 +271,9 @@ export default function WordTableBlock({ title, titleIcon, disc, filterTitle, fi
|
|
|
240
271
|
setChosenCellCount(parseInt(value));
|
|
241
272
|
}
|
|
242
273
|
else if (sectionLabel === t(hasPairs ? 'wordTable.filter.itemsPerPagePair' : 'wordTable.filter.itemsPerPageWord')) {
|
|
274
|
+
/* **칸 수**로 묻는다 — 천장이 아니다. 천장을 주면 첫 칸(열둘)이 곧 천장이라
|
|
275
|
+
`n >= 천장` 이 늘 참이 되어 **고른 수가 전부로 담긴다**(심어 확인했다: 천장을
|
|
276
|
+
떼는 순간 한 쪽이 됐다). '전부' 는 *칸을 다 담는다* 는 뜻이지 *첫 칸* 이 아니다. */
|
|
243
277
|
setItemsPerPageSetting(itemsPerPageFromChoice(parseInt(value), capacity));
|
|
244
278
|
}
|
|
245
279
|
else if (sectionLabel === t('wordTable.filter.pageNumber', '페이지 번호')) {
|
|
@@ -345,7 +379,7 @@ export default function WordTableBlock({ title, titleIcon, disc, filterTitle, fi
|
|
|
345
379
|
setActiveCell(null);
|
|
346
380
|
},
|
|
347
381
|
onClose: handleCloseWordSearch,
|
|
348
|
-
}), !hideControls && (_jsx(TableFilterPanel, { title: filterTitle, collapsible: filterCollapsible, defaultCollapsed: filterDefaultCollapsed, collapsed: filterCollapsed, onCollapsedChange: onFilterCollapsedChange, headerSummary: filterHeaderSummary, hasImage: hasImage, hasColloquial: hasColloquial, contentTypes: contentTypes, orientation: orientation, showOutline: showOutline, cutLine: cutLine, showDivLine: showDivLine, setters: { setContentTypes, setOrientation, setShowOutline, setCutLine, setShowDivLine, setShowTopInfo, setShowBottomInfo }, showCutLine: (pagesEnabled ? itemsPerPage : count) > 1, showDivLine2: hasPairs, middleSections: middleSections, extraSelected: middleSelected, onExtraSelect: handleMiddleSelect, showPaperBands: showBand, showTopInfo: showTopInfo, showBottomInfo: showBottomInfo })), isPaginated && pages ? (_jsx("div", { className: "word-table-block__pages", children: pages.map((page, i) => (_jsx(WordTable, { orientation: orientation, contentTypes: contentTypes, cutLine: cutLine, showOutline: showOutline, showDivLine: showDivLine, count: itemsPerPage, items: page,
|
|
382
|
+
}), !hideControls && (_jsx(TableFilterPanel, { title: filterTitle, collapsible: filterCollapsible, defaultCollapsed: filterDefaultCollapsed, collapsed: filterCollapsed, onCollapsedChange: onFilterCollapsedChange, headerSummary: filterHeaderSummary, hasImage: hasImage, hasColloquial: hasColloquial, hasCaption: hasCaption, contentTypes: contentTypes, orientation: orientation, showOutline: showOutline, cutLine: cutLine, showDivLine: showDivLine, setters: { setContentTypes, setOrientation, setShowOutline, setCutLine, setShowDivLine, setShowTopInfo, setShowBottomInfo }, showCutLine: (pagesEnabled ? itemsPerPage : count) > 1, showDivLine2: hasPairs, middleSections: middleSections, extraSelected: middleSelected, onExtraSelect: handleMiddleSelect, showPaperBands: showBand, showTopInfo: showTopInfo, showBottomInfo: showBottomInfo })), isPaginated && pages ? (_jsx("div", { className: "word-table-block__pages", children: pages.map((page, i) => (_jsx(WordTable, { orientation: orientation, contentTypes: contentTypes, cutLine: cutLine, showOutline: showOutline, showDivLine: showDivLine, count: itemsPerPage, items: page,
|
|
349
383
|
/* 쪽마다 머리 칸이 선다 — 한 장만 들고 보는 종이에 머리 낱말이 없으면
|
|
350
384
|
나머지 칸이 무엇의 활용인지 알 수 없다 */
|
|
351
385
|
baseItem: baseItem, baseContentTypes: baseContentTypes, onRemoveItem: onRemoveItem,
|
|
@@ -91,6 +91,21 @@ export interface WordTableBlockProps {
|
|
|
91
91
|
* 그쪽이 이긴다(사람이 고른 것이 마지막 말이다).
|
|
92
92
|
*/
|
|
93
93
|
cellCapacity?: number;
|
|
94
|
+
/**
|
|
95
|
+
* **한 쪽에 설 수 있는 가장 많은 수** — '페이지당 개수' 고르개의 첫 칸이 여기서 멎는다.
|
|
96
|
+
*
|
|
97
|
+
* 사장님 지시(2026-10-28) *"단어 수 최대와 페이지당 단어 수 최대가 다른거야"* ·
|
|
98
|
+
* *"단어는 20개더라도 페이지당 표현은 12로 선택할 수 있도록 해야지"*(말귀 청 (333)).
|
|
99
|
+
* 활용표의 **칸 수는 낱말이 정하고**(동사 36 · 형용사 21), 종이 한 장에 열둘보다 많으면
|
|
100
|
+
* 글자가 작아져 못 읽는다 — 그래서 둘이 다른 수다.
|
|
101
|
+
*
|
|
102
|
+
* 안 주면 지금까지대로 칸 수가 첫 칸이다. 칸 수보다 크면 무시한다(없는 자리를 고를 수 없다).
|
|
103
|
+
*
|
|
104
|
+
* **이것은 `cellCapacity` 와 다르다** — `cellCapacity` 는 *표가 몇 칸인가*, 이것은 *그
|
|
105
|
+
* 칸들이 한 쪽에 몇씩 서는가* 다. 스무 칸짜리 표에 `maxItemsPerPage={12}` 면 칸은 스물
|
|
106
|
+
* 그대로고 쪽이 둘로 나뉜다.
|
|
107
|
+
*/
|
|
108
|
+
maxItemsPerPage?: number;
|
|
94
109
|
disc?: ReactNode;
|
|
95
110
|
/** 현재 표의 저장된 이름(불러온 표 등). 있으면 인쇄/PDF 저장 시 파일명으로 사용, 없으면 "오늘 날짜 + 단어표/대립쌍표" */
|
|
96
111
|
tableName?: string;
|
|
@@ -4,6 +4,7 @@ import type { WordTableOrientation, WordTableContentType, WordTableCutLine, Page
|
|
|
4
4
|
export declare function buildCompositionSection(t: TFunction, opts: {
|
|
5
5
|
hasImage: boolean;
|
|
6
6
|
hasColloquial: boolean;
|
|
7
|
+
hasCaption?: boolean;
|
|
7
8
|
}): FilterPanelSection;
|
|
8
9
|
/** @public 용지 방향(가로/세로) 세그먼트 섹션. */
|
|
9
10
|
export declare function buildOrientationSection(t: TFunction): FilterPanelSection;
|
|
@@ -17,18 +18,35 @@ export declare function buildBottomInfoSection(t: TFunction): FilterPanelSection
|
|
|
17
18
|
export declare function buildCutLineSection(t: TFunction): FilterPanelSection;
|
|
18
19
|
/** @public 구분선(대립선, 표시/미표시) 세그먼트 섹션 — 대립쌍표에만 노출. */
|
|
19
20
|
export declare function buildDivLineSection(t: TFunction): FilterPanelSection;
|
|
20
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* @public 페이지당 대립쌍/단어 수 세그먼트 섹션.
|
|
23
|
+
*
|
|
24
|
+
* 첫 칸은 **한 쪽에 들어갈 수 있는 가장 큰 수**고, 나머지는 그보다 작은 표준 분할값이다.
|
|
25
|
+
*
|
|
26
|
+
* `max` 를 주면 첫 칸이 거기서 멎는다(말귀 청 (333), 2026-10-28 — 사장님 *"단어는 20개더라도
|
|
27
|
+
* 페이지당 표현은 12로 선택할 수 있도록 해야지"*). **칸 수와 한 쪽에 서는 수는 다른 것**이다 —
|
|
28
|
+
* 활용표의 칸 수는 낱말이 정하고(동사 36 · 형용사 21), 종이 한 장에 열둘보다 많으면 글자가
|
|
29
|
+
* 작아져 못 읽는다. `max` 가 없으면 지금까지대로 `itemCount` 가 첫 칸이다.
|
|
30
|
+
*/
|
|
21
31
|
export declare function buildItemsPerPageSection(t: TFunction, opts: {
|
|
22
32
|
hasPairs: boolean;
|
|
23
33
|
itemCount: number;
|
|
34
|
+
max?: number;
|
|
24
35
|
}): FilterPanelSection;
|
|
25
36
|
/**
|
|
26
37
|
* 페이지당 개수 섹션에서 고른 값 → 기억할 페이지당 개수.
|
|
27
38
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
39
|
+
* **'한 쪽에 전부' 를 고르면 전체(`Infinity`)** 로 기억한다 — 숫자로 담으면, 4개일 때
|
|
40
|
+
* '4개(전부)' 를 골라 둔 표에 낱말을 더 담는 순간 4개씩 두 쪽으로 나뉘었다(5개일 때 '5개' 는
|
|
41
|
+
* 목록에 없는 수라 전체로 기억돼 한 쪽에 남았다 — 같은 첫 칸인데 뜻이 갈렸다).
|
|
42
|
+
*
|
|
43
|
+
* **천장이 생기면 첫 칸이 '전부' 가 아니다**(말귀 청 (333), 2026-10-28). 스무 칸짜리 표에서
|
|
44
|
+
* `12개` 는 전부가 아니라 **두 쪽**이다 — 그래서 *"첫 칸이면 전부"* 가 아니라
|
|
45
|
+
* **"칸 수에 닿으면 전부"** 로 묻는다. 천장이 없으면 첫 칸이 곧 칸 수라 지금까지와 같다.
|
|
46
|
+
*
|
|
47
|
+
* > 옛 글은 *"목록에 없는 수도 전부로 본다"* 고 했는데, 이 함수는 **사람이 칩을 누를 때만**
|
|
48
|
+
* > 불린다 — 그때의 `n` 은 늘 그 순간 목록에 있는 수다. 천장이 생기면 첫 칸(열둘)이
|
|
49
|
+
* > 표준값 목록에 없으므로, 그 가름을 그대로 두면 **방금 고른 수가 전부로 바뀐다.**
|
|
32
50
|
*/
|
|
33
51
|
export declare function itemsPerPageFromChoice(n: number, itemCount: number): number;
|
|
34
52
|
/** @public 페이지 번호 위치(왼쪽/중앙/오른쪽/미표시) 세그먼트 섹션 — 실제 2페이지 이상일 때만 노출. */
|
|
@@ -21,6 +21,11 @@ export function buildCompositionSection(t, opts) {
|
|
|
21
21
|
items: [
|
|
22
22
|
{ value: 'image', disabled: !opts.hasImage, displayLabel: t('wordTable.filter.image', '이미지') },
|
|
23
23
|
{ value: 'word', displayLabel: t('wordTable.filter.word', '단어') },
|
|
24
|
+
/* **유형**(이름표) — 말귀 청 (334), 2026-10-28. 이름은 사장님 말씀 그대로다.
|
|
25
|
+
자리는 `단어` 뒤다. 칸에 서는 차례(이름표 → 낱말 → 발음)와는 어긋나지만, 이미 있던
|
|
26
|
+
넷의 차례를 덜 흔드는 쪽이다. 이름표를 쥔 칸이 하나도 없으면 회색으로 선다 —
|
|
27
|
+
단어표에는 이름표가 없다. */
|
|
28
|
+
{ value: 'caption', disabled: !opts.hasCaption, displayLabel: t('wordTable.filter.caption', '유형') },
|
|
24
29
|
{ value: 'standardPron', displayLabel: t('wordTable.filter.standardPron', '표준 발음') },
|
|
25
30
|
{ value: 'colloquialPron', disabled: !opts.hasColloquial, displayLabel: t('wordTable.filter.colloquialPron', '구어체 발음') },
|
|
26
31
|
],
|
|
@@ -96,11 +101,21 @@ export function buildDivLineSection(t) {
|
|
|
96
101
|
display: 'segmented',
|
|
97
102
|
};
|
|
98
103
|
}
|
|
99
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* @public 페이지당 대립쌍/단어 수 세그먼트 섹션.
|
|
106
|
+
*
|
|
107
|
+
* 첫 칸은 **한 쪽에 들어갈 수 있는 가장 큰 수**고, 나머지는 그보다 작은 표준 분할값이다.
|
|
108
|
+
*
|
|
109
|
+
* `max` 를 주면 첫 칸이 거기서 멎는다(말귀 청 (333), 2026-10-28 — 사장님 *"단어는 20개더라도
|
|
110
|
+
* 페이지당 표현은 12로 선택할 수 있도록 해야지"*). **칸 수와 한 쪽에 서는 수는 다른 것**이다 —
|
|
111
|
+
* 활용표의 칸 수는 낱말이 정하고(동사 36 · 형용사 21), 종이 한 장에 열둘보다 많으면 글자가
|
|
112
|
+
* 작아져 못 읽는다. `max` 가 없으면 지금까지대로 `itemCount` 가 첫 칸이다.
|
|
113
|
+
*/
|
|
100
114
|
export function buildItemsPerPageSection(t, opts) {
|
|
115
|
+
const first = Math.max(1, Math.min(opts.itemCount, opts.max ?? opts.itemCount));
|
|
101
116
|
return {
|
|
102
117
|
label: t(opts.hasPairs ? 'wordTable.filter.itemsPerPagePair' : 'wordTable.filter.itemsPerPageWord'),
|
|
103
|
-
items: [
|
|
118
|
+
items: [first, ...ITEMS_PER_PAGE_OPTIONS.filter(n => n < first)].map(n => ({
|
|
104
119
|
value: `${n}개`, displayLabel: t('wordTable.filter.itemsPerPageOption', { count: n }),
|
|
105
120
|
})),
|
|
106
121
|
display: 'segmented',
|
|
@@ -109,13 +124,20 @@ export function buildItemsPerPageSection(t, opts) {
|
|
|
109
124
|
/**
|
|
110
125
|
* 페이지당 개수 섹션에서 고른 값 → 기억할 페이지당 개수.
|
|
111
126
|
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
127
|
+
* **'한 쪽에 전부' 를 고르면 전체(`Infinity`)** 로 기억한다 — 숫자로 담으면, 4개일 때
|
|
128
|
+
* '4개(전부)' 를 골라 둔 표에 낱말을 더 담는 순간 4개씩 두 쪽으로 나뉘었다(5개일 때 '5개' 는
|
|
129
|
+
* 목록에 없는 수라 전체로 기억돼 한 쪽에 남았다 — 같은 첫 칸인데 뜻이 갈렸다).
|
|
130
|
+
*
|
|
131
|
+
* **천장이 생기면 첫 칸이 '전부' 가 아니다**(말귀 청 (333), 2026-10-28). 스무 칸짜리 표에서
|
|
132
|
+
* `12개` 는 전부가 아니라 **두 쪽**이다 — 그래서 *"첫 칸이면 전부"* 가 아니라
|
|
133
|
+
* **"칸 수에 닿으면 전부"** 로 묻는다. 천장이 없으면 첫 칸이 곧 칸 수라 지금까지와 같다.
|
|
134
|
+
*
|
|
135
|
+
* > 옛 글은 *"목록에 없는 수도 전부로 본다"* 고 했는데, 이 함수는 **사람이 칩을 누를 때만**
|
|
136
|
+
* > 불린다 — 그때의 `n` 은 늘 그 순간 목록에 있는 수다. 천장이 생기면 첫 칸(열둘)이
|
|
137
|
+
* > 표준값 목록에 없으므로, 그 가름을 그대로 두면 **방금 고른 수가 전부로 바뀐다.**
|
|
116
138
|
*/
|
|
117
139
|
export function itemsPerPageFromChoice(n, itemCount) {
|
|
118
|
-
return n
|
|
140
|
+
return n >= itemCount ? Number.POSITIVE_INFINITY : n;
|
|
119
141
|
}
|
|
120
142
|
/** @public 페이지 번호 위치(왼쪽/중앙/오른쪽/미표시) 세그먼트 섹션 — 실제 2페이지 이상일 때만 노출. */
|
|
121
143
|
export function buildPageNumberSection(t) {
|
|
@@ -322,6 +322,31 @@
|
|
|
322
322
|
}
|
|
323
323
|
|
|
324
324
|
/* ── 카드 ───────────────────────────────────────────────── */
|
|
325
|
+
/* **손 단추의 들여쓰기는 칸 폭을 따른다**(`--wt-hand-inset`, 사장님 지시 2026-10-28:
|
|
326
|
+
*"작아졌을때 패딩 20이 너무 커 보여 기준점 잡아서 패딩 낮춰줘"*).
|
|
327
|
+
|
|
328
|
+
**기준점은 네 칸짜리 표다** — 거기서 칸이 종이 좌표로 503px 이고, 지금까지 쓰던 20px 이
|
|
329
|
+
그 폭의 **4%** 다. 그 비를 그대로 쓰면 큰 칸은 지금과 똑같고 작은 칸만 줄어든다.
|
|
330
|
+
|
|
331
|
+
재 보니 `20 + 단추 40` 이 칸 폭에서 차지하는 몫이 이랬다(종이 좌표, 2026-10-28) —
|
|
332
|
+
|
|
333
|
+
| 칸 수 | 칸 폭 | 지금 | 고친 뒤 |
|
|
334
|
+
|---|---|---|---|
|
|
335
|
+
| 4 | 503 | 11.9% | 11.9%(그대로) |
|
|
336
|
+
| 8 | 251 | 23.9% | 19.9% |
|
|
337
|
+
| 16 | 169 | 35.6% | 27.7% |
|
|
338
|
+
|
|
339
|
+
바닥을 6px 로 둔 것은 더 내려가면 단추가 칸 모서리에 붙어 **잘린 것처럼** 보여서다.
|
|
340
|
+
천장이 20px 인 것은 큰 칸에서 지금보다 더 벌어지지 않게 하려는 것이다.
|
|
341
|
+
|
|
342
|
+
> **남은 몫은 단추 자신이다.** 열여섯 칸에서 단추 40px 만으로 칸 폭의 23.7% 다 —
|
|
343
|
+
> 들여쓰기를 0 으로 해도 거기까지만 준다. 그쪽은 `buttonSize` 가 쥔다. */
|
|
344
|
+
.word-table__card,
|
|
345
|
+
.word-table__edit-cell {
|
|
346
|
+
container-type: inline-size;
|
|
347
|
+
--wt-hand-inset: clamp(6px, 4cqw, 20px);
|
|
348
|
+
}
|
|
349
|
+
|
|
325
350
|
.word-table__card {
|
|
326
351
|
display: flex;
|
|
327
352
|
/* 칸(.word-table-cell)은 투명이고 **이 카드가 면을 쥔다** — 그래서 `--cut-show` 의 선 바탕 위에
|
|
@@ -379,8 +404,8 @@
|
|
|
379
404
|
/* 옮기기 손잡이 — 빼기 단추와 같은 규칙(평소엔 숨고 hover·초점에 드러난다), 자리만 왼쪽이다 */
|
|
380
405
|
.word-table__card-handle {
|
|
381
406
|
position: absolute;
|
|
382
|
-
top: 20px;
|
|
383
|
-
left: 20px;
|
|
407
|
+
top: var(--wt-hand-inset, 20px);
|
|
408
|
+
left: var(--wt-hand-inset, 20px);
|
|
384
409
|
z-index: 1;
|
|
385
410
|
opacity: 0;
|
|
386
411
|
transition: opacity 0.15s;
|
|
@@ -400,8 +425,8 @@
|
|
|
400
425
|
|
|
401
426
|
.word-table__card-close {
|
|
402
427
|
position: absolute;
|
|
403
|
-
top: 20px;
|
|
404
|
-
right: 20px;
|
|
428
|
+
top: var(--wt-hand-inset, 20px);
|
|
429
|
+
right: var(--wt-hand-inset, 20px);
|
|
405
430
|
z-index: 1;
|
|
406
431
|
opacity: 0;
|
|
407
432
|
transition: opacity 0.15s;
|
|
@@ -419,8 +444,8 @@
|
|
|
419
444
|
0 이라, 재생과 빼기가 같은 높이에 선다. */
|
|
420
445
|
.word-table__card-actions {
|
|
421
446
|
position: absolute;
|
|
422
|
-
top: 20px;
|
|
423
|
-
right: 20px;
|
|
447
|
+
top: var(--wt-hand-inset, 20px);
|
|
448
|
+
right: var(--wt-hand-inset, 20px);
|
|
424
449
|
z-index: 1;
|
|
425
450
|
display: flex;
|
|
426
451
|
flex-direction: column;
|
|
@@ -606,8 +631,8 @@
|
|
|
606
631
|
재생과 빼기 · 정보와 그 아래 것이 서로 같은 높이에 선다(사장님 2026-10-12). */
|
|
607
632
|
.word-table-cell__side {
|
|
608
633
|
position: absolute;
|
|
609
|
-
top: 20px;
|
|
610
|
-
left: 20px;
|
|
634
|
+
top: var(--wt-hand-inset, 20px);
|
|
635
|
+
left: var(--wt-hand-inset, 20px);
|
|
611
636
|
z-index: 1;
|
|
612
637
|
display: flex;
|
|
613
638
|
flex-direction: column;
|
|
@@ -8,6 +8,7 @@ import './WordTable.css';
|
|
|
8
8
|
import Button from './Button';
|
|
9
9
|
import Badge from './Badge';
|
|
10
10
|
import { withLegacy } from '../utils/legacyBlocks';
|
|
11
|
+
import { devWarnOnce } from '../utils/devWarn';
|
|
11
12
|
import Section from './Section';
|
|
12
13
|
import DescriptionTooltip from './Tooltip/DescriptionTooltip';
|
|
13
14
|
import { getTTSUrlResolver, getTTSFallbackUrlResolver } from '../utils/ttsConfig';
|
|
@@ -49,7 +50,7 @@ const srOnly = {
|
|
|
49
50
|
const LONG_PRESS_MS = 400;
|
|
50
51
|
/** 길게 누르기가 익기 전에 이만큼 움직이면 그건 끌기가 아니라 **스크롤**이라 취소한다 */
|
|
51
52
|
const MOVE_THRESHOLD_PX = 8;
|
|
52
|
-
function WordCell({ label, subLabel, colloquialLabel, captionLabel, captionBadge, homonum, showWord = true, showImage = true, showPronunciation = true, showColloquial = true, buttonSize = 40, wordInfo, outerScale = 1, }) {
|
|
53
|
+
function WordCell({ label, subLabel, colloquialLabel, captionLabel, captionBadge, homonum, showWord = true, showImage = true, showPronunciation = true, showColloquial = true, showCaption = true, buttonSize = 40, wordInfo, outerScale = 1, }) {
|
|
53
54
|
const { t } = useTranslation();
|
|
54
55
|
const outerRef = useRef(null);
|
|
55
56
|
const infoRef = useRef(null);
|
|
@@ -253,7 +254,7 @@ function WordCell({ label, subLabel, colloquialLabel, captionLabel, captionBadge
|
|
|
253
254
|
* 안 곱하면 또 조용히 헛돈다.
|
|
254
255
|
*/
|
|
255
256
|
const tapTooSmall = buttonSize * outerScale < MIN_TAP_PX;
|
|
256
|
-
return (_jsxs("div", { ref: outerRef, className: cx('word-table-cell', tapTooSmall && 'word-table-cell--tap-too-small', hasImage ? 'word-table-cell--with-image' : ''), "data-ref-w": refW, "data-ref-h": refH, children: [_jsxs("div", { className: "word-table-cell__inner", style: { transform: `scale(${scale})` }, children: [hasImage && (_jsxs("div", { className: "word-table-cell__image-wrap", children: [imgLoading && _jsx("div", { className: "word-table-cell__spinner" }), _jsx("img", { ref: imgRef, className: "word-table-cell__image", src: imageUrl, alt: label, draggable: false, style: { opacity: imgLoading ? 0 : 1 }, onLoad: handleImgLoad, onError: handleImgError })] })), (captionBadge || captionLabel) && (
|
|
257
|
+
return (_jsxs("div", { ref: outerRef, className: cx('word-table-cell', tapTooSmall && 'word-table-cell--tap-too-small', hasImage ? 'word-table-cell--with-image' : ''), "data-ref-w": refW, "data-ref-h": refH, children: [_jsxs("div", { className: "word-table-cell__inner", style: { transform: `scale(${scale})` }, children: [hasImage && (_jsxs("div", { className: "word-table-cell__image-wrap", children: [imgLoading && _jsx("div", { className: "word-table-cell__spinner" }), _jsx("img", { ref: imgRef, className: "word-table-cell__image", src: imageUrl, alt: label, draggable: false, style: { opacity: imgLoading ? 0 : 1 }, onLoad: handleImgLoad, onError: handleImgError })] })), showCaption && (captionBadge || captionLabel) && (
|
|
257
258
|
/* **[배지][이름표] 한 줄** — 둘은 성격이 다르다(청 (328)). 배지는 *무엇을 하는
|
|
258
259
|
말인가*(치료사가 고르는 잣대), 이름표는 *어떤 꼬리가 붙는가*(학습자가 낼
|
|
259
260
|
소리)다. 한 글자로 붙여 놓으면 그 둘이 안 갈린다. 가운뎃점은 안 쓴다 —
|
|
@@ -522,8 +523,45 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
|
|
|
522
523
|
image: types.length === 0 || types.includes('image'),
|
|
523
524
|
pron: types.length === 0 || types.includes('standardPron'),
|
|
524
525
|
colloq: types.length === 0 || types.includes('colloquialPron'),
|
|
526
|
+
/* 이름표(`captionBadge`·`captionLabel`) — 말귀 청 (334), 2026-10-28. 종이로 뽑아 쓰는
|
|
527
|
+
자리라 **무엇을 숨기느냐가 그대로 과제가 된다**: 끄면 *이 꼴이 무엇인지 맞혀 보라*,
|
|
528
|
+
켜면 *이 꼴은 이것이다* 다. 전에는 주면 늘 서서 뒤쪽 하나만 만들 수 있었다. */
|
|
529
|
+
caption: types.length === 0 || types.includes('caption'),
|
|
525
530
|
});
|
|
526
531
|
const show = showOf(contentTypes);
|
|
532
|
+
/**
|
|
533
|
+
* **칸의 열쇠** — `item.id` 가 표 안에서 **하나뿐일 때만** 그것으로 센다(말귀 청 (335), 2026-10-28).
|
|
534
|
+
*
|
|
535
|
+
* 번호로 세면 셋째 칸을 뺄 때 그 뒤 칸이 **전부 다른 `item` 을 받는다.** 칸은 그대로 선
|
|
536
|
+
* 채로 속만 바뀌니 `WordCell` 의 `useEffect([pron, label])` 이 그때마다 소리 주소를 다시
|
|
537
|
+
* 받아 오고, 재생 중이던 소리와 상태가 밀린다 — 서른네 칸짜리 표에서 둘째를 빼자 HEAD 가
|
|
538
|
+
* **열다섯 번** 나갔다(말귀 실측, 전부 이미 받아 둔 파일).
|
|
539
|
+
*
|
|
540
|
+
* **그래도 `id` 를 곧바로 못 쓴다.** `id` 가 겹치는 표에서는 React 가 그 칸들을 하나로
|
|
541
|
+
* 본다 — 2026-10-27 에 활용표가 그랬다(`감사하다#1` 이 네 칸에 섰다. 한 낱말의 열두 꼴이
|
|
542
|
+
* 모두 그 낱말의 `id` 를 쥐던 때다). 말귀는 그 뒤 `감사하다#1::과거` 꼴로 바꾸어 겹침을
|
|
543
|
+
* 풀었지만, **코어는 부르는 쪽이 그랬다고 믿을 수 없다.** 그래서 센다 — 겹치거나 빈
|
|
544
|
+
* `id` 가 하나라도 있으면 표 **통째로** 번호로 돌아간다(지금까지와 같다).
|
|
545
|
+
*
|
|
546
|
+
* **번호에 `id` 를 덧붙이지 않는다.** 그러면 겹침은 풀리지만 자리바꿈에서 두 칸이 **다시
|
|
547
|
+
* 태어난다**(실측: DOM 마디 `false/false`). 이 표에는 끌어 옮기기가 있고 `WordCell` 은
|
|
548
|
+
* `ResizeObserver` 로 제 상자를 재어 배율을 쥐므로, 끄는 동안 칸마다 관찰자가 뜯겼다
|
|
549
|
+
* 붙고 배율이 처음부터 다시 선다. 그대로인 `item.id` 는 자리만 옮기니 그 값을 안 치른다.
|
|
550
|
+
*
|
|
551
|
+
* 격자 자리(`dotDashStyle(index, …)`)·채점 열쇠(`renderScore(index, …)`)·손가락 밑의
|
|
552
|
+
* 칸(`data-wordtable-cell`)은 **그대로 번호**다 — 그것들은 자리를 묻는 것이고, 열쇠는
|
|
553
|
+
* 정체를 묻는 것이다.
|
|
554
|
+
*/
|
|
555
|
+
const cellKeys = useMemo(() => {
|
|
556
|
+
const ids = (items ?? []).map(it => it.id);
|
|
557
|
+
const unique = ids.every(id => typeof id === 'string' && id.length > 0) && new Set(ids).size === ids.length;
|
|
558
|
+
if (!unique && ids.length > 0) {
|
|
559
|
+
devWarnOnce('wordTable.cellKeyFallback', '[ihab/core] WordTable: items 의 id 가 겹치거나 비어 있어 칸을 자리 번호로 센다. ' +
|
|
560
|
+
'칸을 빼거나 더할 때 뒤 칸들이 통째로 다시 그려진다(소리 주소를 다시 받아 온다). ' +
|
|
561
|
+
'id 를 표 안에서 하나뿐인 값으로 지어 주면 그 값이 사라진다.');
|
|
562
|
+
}
|
|
563
|
+
return unique ? ids : null;
|
|
564
|
+
}, [items]);
|
|
527
565
|
const baseShow = showOf(baseContentTypes ?? contentTypes);
|
|
528
566
|
const hasPairs = isEdit
|
|
529
567
|
? (editCells ?? []).some(c => c !== null && c.length > 1)
|
|
@@ -570,7 +608,7 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
|
|
|
570
608
|
gridTemplateRows: `repeat(${rows}, 1fr)`,
|
|
571
609
|
}, children: [isEdit ? (_jsx(_Fragment, { children: (editCells ?? []).map((cell, i) => (_jsx("div", { className: withLegacy(cx('word-table__edit-cell', cell ? 'word-table__edit-cell--filled' : 'word-table__edit-cell--empty', activeCell === i ? 'word-table__edit-cell--active' : '')), style: dotDashStyle(i, cols, rows, cutLine), children: cell ? (_jsxs(_Fragment, { children: [cell.map((e, wi) => (_jsxs(Fragment, { children: [wi > 0 && _jsx("div", { className: withLegacy("word-table__pair-divider") }), _jsx(WordCell, { outerScale: scale, label: e.word, subLabel: e.pronunciation,
|
|
572
610
|
// 편집 칸도 구어체 발음을 넘긴다 — 빠져 있어 '구어체 발음'을 켜도 편집 모드에서만 비었다.
|
|
573
|
-
colloquialLabel: e.colloquialPronunciation, homonum: e.homonum, showWord: show.word, showImage: show.image, showPronunciation: show.pron, showColloquial: show.colloq, buttonSize: buttonSize })] }, wi))), scoring && renderScore(i, cell.map(e => e.word).join(' / ')), onRemoveCell && (_jsx("div", { className: withLegacy("word-table__card-close"), children: _jsx(Button, { htmlType: "button", size: buttonSize, type: "dot", icon: "x", variant: "transparent-lightGray", useBorder: false, showTooltipInfo: cell.length > 1 ? t('wordPrint.removePair', '대립쌍 빼기') : t('wordPrint.removeWord', '단어 빼기'), ariaLabel: cell.length > 1 ? t('wordPrint.removePair', '대립쌍 빼기') : t('wordPrint.removeWord', '단어 빼기'), onClick: () => onRemoveCell(i) }) }))] })) : (onActivateCell && (_jsx("div", { style: counterScale, children: _jsx(Button, { htmlType: "button", size:
|
|
611
|
+
colloquialLabel: e.colloquialPronunciation, homonum: e.homonum, showWord: show.word, showImage: show.image, showPronunciation: show.pron, showColloquial: show.colloq, showCaption: show.caption, buttonSize: buttonSize })] }, wi))), scoring && renderScore(i, cell.map(e => e.word).join(' / ')), onRemoveCell && (_jsx("div", { className: withLegacy("word-table__card-close"), children: _jsx(Button, { htmlType: "button", size: buttonSize, type: "dot", icon: "x", variant: "transparent-lightGray", useBorder: false, showTooltipInfo: cell.length > 1 ? t('wordPrint.removePair', '대립쌍 빼기') : t('wordPrint.removeWord', '단어 빼기'), ariaLabel: cell.length > 1 ? t('wordPrint.removePair', '대립쌍 빼기') : t('wordPrint.removeWord', '단어 빼기'), onClick: () => onRemoveCell(i) }) }))] })) : (onActivateCell && (_jsx("div", { style: counterScale, children: _jsx(Button, { htmlType: "button", size: buttonSize, type: "dot", icon: "plus", variant: "default", ariaLabel: t('wordTable.addWord', '추가하기'), showTooltipInfo: t('wordTable.addWord', '추가하기'), onClick: () => onActivateCell(i) }) }))) }, i))) })) : (_jsxs(_Fragment, { children: [hasBase && baseItem && (
|
|
574
612
|
/* 걸치는 자리는 양쪽이 같은 식이다 — 가로면 왼쪽 `half.cols` 열 × 전체 `half.rows` 줄,
|
|
575
613
|
세로면 전체 `half.cols` 열 × 위 `half.rows` 줄. 둘 다 `1 / span` 으로 같게 적힌다. */
|
|
576
614
|
_jsx("div", { className: withLegacy("word-table__card word-table__card--base"), style: {
|
|
@@ -578,9 +616,9 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
|
|
|
578
616
|
gridRow: `1 / span ${half.rows}`,
|
|
579
617
|
/* 머리 칸과 나머지 절반을 가르는 점선 — 가로면 오른쪽, 세로면 아래쪽 */
|
|
580
618
|
...dotDashStyle(0, orientation === 'landscape' ? 2 : 1, orientation === 'landscape' ? 1 : 2, cutLine),
|
|
581
|
-
}, 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, 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) {
|
|
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) {
|
|
582
620
|
onReorder(dragIndex.current, index);
|
|
583
|
-
} ; 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, 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) && (
|
|
621
|
+
} ; 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) && (
|
|
584
622
|
/* **오른쪽 기둥** — 빼기 → 부르는 쪽이 얹은 것 → 옮기기 손잡이 차례로 쌓인다
|
|
585
623
|
(말귀 청 (331), 2026-10-28). 전에는 빼기와 얹은 것만 **한 줄**로 서고
|
|
586
624
|
손잡이는 왼쪽 위에 따로 섰다 — 재생 단추와 **같은 자리라 겹쳤다.**
|
|
@@ -601,7 +639,7 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
|
|
|
601
639
|
ariaLabel: t('wordTable.reorder.handle', {
|
|
602
640
|
word: (item.words ?? []).map(w => w.label).join(' / '),
|
|
603
641
|
defaultValue: '{{word}} 순서 바꾸기 (Alt + 화살표)',
|
|
604
|
-
}) }) }))] }))] }, index))), Array.from({ length: Math.max(0, itemCols * itemRows - (items?.length ?? 0)) }).map((_, i) => {
|
|
642
|
+
}) }) }))] }))] }, cellKeys ? cellKeys[index] : index))), Array.from({ length: Math.max(0, itemCols * itemRows - (items?.length ?? 0)) }).map((_, i) => {
|
|
605
643
|
const isWithinCount = (items?.length ?? 0) + i < (addableCount ?? cellCount);
|
|
606
644
|
return (_jsx("div", { className: withLegacy("word-table__card word-table__card--filler"), children: showFillerAdd && onActivateCell && isWithinCount && (
|
|
607
645
|
/* **점 단추 하나**(사장님 지시 2026-10-28: *"Button dot size 40 베리언트
|
|
@@ -18,7 +18,7 @@ export type WordTableOrientation = 'landscape' | 'portrait';
|
|
|
18
18
|
*
|
|
19
19
|
* @public
|
|
20
20
|
*/
|
|
21
|
-
export type WordTableContentType = 'word' | 'image' | 'standardPron' | 'colloquialPron';
|
|
21
|
+
export type WordTableContentType = 'word' | 'image' | 'standardPron' | 'colloquialPron' | 'caption';
|
|
22
22
|
/** 칸 사이 선 — **코드다.** 보일 글은 사전(`wordTable.filter.show`·`.dotted`·`.corner`·`.hide`). @public */
|
|
23
23
|
export type WordTableCutLine = 'show' | 'dashed' | 'corner' | 'hide';
|
|
24
24
|
/** 페이지 분할 시 종이 안에 찍는 페이지 번호 위치 — 'none'이면 미표시 */
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HEAD 로 파일이 있나 물었을 때, **"없다" 를 받은 것인가.**
|
|
3
|
+
*
|
|
4
|
+
* 그림·음원 확인은 답을 캐시에 담는데, **담아도 되는 답과 안 되는 답**이 갈린다.
|
|
5
|
+
* 2xx(있다)와 여기서 참을 주는 상태(없다)만 담는다. 나머지는 *확인이 안 된 것*이라
|
|
6
|
+
* 담지 않는다 — 망 끊김·타임아웃·권한 오류(401·403)·5xx 를 담으면 한 번의 장애가
|
|
7
|
+
* 그 낱말을 세션 내내 '없음' 으로 못 박아, '그림 있음'·'음성 있음' 거르개에서
|
|
8
|
+
* 통째로 빠진다.
|
|
9
|
+
*
|
|
10
|
+
* **400 이 여기 있는 까닭**(말귀 청 (336), 2026-10-28). 저장소가 *없는 파일* 에
|
|
11
|
+
* 404 가 아니라 **400** 을 준다. 400 은 404 와 410 어느 쪽도 아니라 캐시에
|
|
12
|
+
* **영영 안 담겼고**, 그래서 표가 다시 그려질 때마다 같은 글자를 또 물었다 —
|
|
13
|
+
* 스물한 칸짜리 표에서 ✕ 한 번에 HEAD 가 **스물한 번** 나갔다(말귀 실측).
|
|
14
|
+
* 400 은 *답을 받은 것*이지 망이 끊긴 것이 아니다.
|
|
15
|
+
*
|
|
16
|
+
* **대가도 적어 둔다** — 리졸버가 설정이 덜 선 때에 **엉뚱한 주소**를 지어 내면
|
|
17
|
+
* 그 400 까지 담긴다. 그 낱말은 캐시를 비울 때까지 '없음' 으로 눌러앉는다
|
|
18
|
+
* (`clearImageExistsCache`·`clearAudioExistsCache` 가 비우는 자리다).
|
|
19
|
+
* 주소를 때에 따라 다르게 짓는 리졸버라면 표를 그리기 전에 그 때를 지나 둬야 한다.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isDefiniteAbsence(status: number): boolean;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HEAD 로 파일이 있나 물었을 때, **"없다" 를 받은 것인가.**
|
|
3
|
+
*
|
|
4
|
+
* 그림·음원 확인은 답을 캐시에 담는데, **담아도 되는 답과 안 되는 답**이 갈린다.
|
|
5
|
+
* 2xx(있다)와 여기서 참을 주는 상태(없다)만 담는다. 나머지는 *확인이 안 된 것*이라
|
|
6
|
+
* 담지 않는다 — 망 끊김·타임아웃·권한 오류(401·403)·5xx 를 담으면 한 번의 장애가
|
|
7
|
+
* 그 낱말을 세션 내내 '없음' 으로 못 박아, '그림 있음'·'음성 있음' 거르개에서
|
|
8
|
+
* 통째로 빠진다.
|
|
9
|
+
*
|
|
10
|
+
* **400 이 여기 있는 까닭**(말귀 청 (336), 2026-10-28). 저장소가 *없는 파일* 에
|
|
11
|
+
* 404 가 아니라 **400** 을 준다. 400 은 404 와 410 어느 쪽도 아니라 캐시에
|
|
12
|
+
* **영영 안 담겼고**, 그래서 표가 다시 그려질 때마다 같은 글자를 또 물었다 —
|
|
13
|
+
* 스물한 칸짜리 표에서 ✕ 한 번에 HEAD 가 **스물한 번** 나갔다(말귀 실측).
|
|
14
|
+
* 400 은 *답을 받은 것*이지 망이 끊긴 것이 아니다.
|
|
15
|
+
*
|
|
16
|
+
* **대가도 적어 둔다** — 리졸버가 설정이 덜 선 때에 **엉뚱한 주소**를 지어 내면
|
|
17
|
+
* 그 400 까지 담긴다. 그 낱말은 캐시를 비울 때까지 '없음' 으로 눌러앉는다
|
|
18
|
+
* (`clearImageExistsCache`·`clearAudioExistsCache` 가 비우는 자리다).
|
|
19
|
+
* 주소를 때에 따라 다르게 짓는 리졸버라면 표를 그리기 전에 그 때를 지나 둬야 한다.
|
|
20
|
+
*/
|
|
21
|
+
export function isDefiniteAbsence(status) {
|
|
22
|
+
return status === 400 || status === 404 || status === 410;
|
|
23
|
+
}
|