@ihabdevteam/core 0.398.0 → 0.400.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 +76 -0
- package/dist/components.cjs.js +172 -171
- package/dist/components.esm.css +2 -2
- package/dist/hooks.cjs.js +5 -5
- package/dist/i18n.cjs.js +3 -3
- package/dist/ihabdevteam-core.cjs.js +173 -172
- package/dist/ihabdevteam-core.d.ts +23 -3
- package/dist/packages/core/src/components/Word/WordTableBlock.d.ts +1 -1
- package/dist/packages/core/src/components/Word/WordTableBlock.js +4 -4
- package/dist/packages/core/src/components/Word/wordTableBlockTypes.d.ts +2 -0
- package/dist/packages/core/src/components/Word/wordTablePrint.js +1 -0
- package/dist/packages/core/src/components/WordTable.css +7 -1
- package/dist/packages/core/src/components/WordTable.d.ts +19 -1
- package/dist/packages/core/src/components/WordTable.js +51 -6
- package/dist/packages/core/src/i18n/locales/en.json +5 -1
- package/dist/packages/core/src/i18n/locales/ko.json +5 -1
- package/dist/packages/core/src/version.d.ts +1 -1
- package/dist/packages/core/src/version.js +1 -1
- package/dist/utils.cjs.js +3 -3
- package/package.json +1 -1
|
@@ -1916,7 +1916,7 @@ export declare function copyText(text: string): Promise<boolean>;
|
|
|
1916
1916
|
*
|
|
1917
1917
|
* 값은 손으로 적고 `test/coreVersion.test.ts` 가 package.json 과 어긋나면 운다.
|
|
1918
1918
|
*/
|
|
1919
|
-
export declare const CORE_VERSION = "0.
|
|
1919
|
+
export declare const CORE_VERSION = "0.400.0";
|
|
1920
1920
|
|
|
1921
1921
|
/** @public */
|
|
1922
1922
|
declare const coreDefault: Record<string, unknown>;
|
|
@@ -11698,9 +11698,9 @@ export declare interface WordSearchResultWord {
|
|
|
11698
11698
|
* 표시(items)·편집(editCells) 두 모드를 지원한다.
|
|
11699
11699
|
* @public
|
|
11700
11700
|
*/
|
|
11701
|
-
export declare function WordTable({ title, titleIcon, disc, className, orientation, contentTypes, baseItem, baseContentTypes, cutLine, showOutline, showDivLine, items, editCells, count, activeCell, onActivateCell, onRemoveCell, onRemoveItem, onReorder, onCopyItem, indexOffset, totalCount, renderCellAction, showFillerAdd, addableCount, contentRef, buttonSize, brand, code, pageNumber, pageNumberPosition, fitHeight, scoring, marks, onMarkClick, scoreIndexOffset, }: WordTableProps): JSX.Element;
|
|
11701
|
+
export declare function WordTable({ title, titleIcon, disc, className, orientation, contentTypes, baseItem, baseContentTypes, cutLine, showOutline, showDivLine, items, editCells, count, activeCell, onActivateCell, onRemoveCell, onRemoveItem, onReorder, onCopyItem, onReplaceItem, indexOffset, totalCount, renderCellAction, showFillerAdd, addableCount, contentRef, buttonSize, brand, code, pageNumber, pageNumberPosition, fitHeight, scoring, marks, onMarkClick, scoreIndexOffset, }: WordTableProps): JSX.Element;
|
|
11702
11702
|
|
|
11703
|
-
export declare function WordTableBlock({ title, titleIcon, disc, filterTitle, filterCollapsible, filterDefaultCollapsed, filterCollapsed, onFilterCollapsedChange, filterHeaderSummary, brand, code, baseItem, baseContentTypes, cellCapacity, maxItemsPerPage, items, onSaveComplete, onLoad, onRemoveItem, onCopyItem, 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;
|
|
11703
|
+
export declare function WordTableBlock({ title, titleIcon, disc, filterTitle, filterCollapsible, filterDefaultCollapsed, filterCollapsed, onFilterCollapsedChange, filterHeaderSummary, brand, code, baseItem, baseContentTypes, cellCapacity, maxItemsPerPage, items, onSaveComplete, onLoad, onRemoveItem, onCopyItem, onReplaceItem, 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;
|
|
11704
11704
|
|
|
11705
11705
|
/** @public */
|
|
11706
11706
|
export declare interface WordTableBlockProps {
|
|
@@ -11805,6 +11805,8 @@ export declare interface WordTableBlockProps {
|
|
|
11805
11805
|
onRemoveItem?: (id: string) => void;
|
|
11806
11806
|
/** 주면 칸에 **복사 단추**가 선다 — 그 낱말을 한 칸 더 만든다. 꼴은 코어가 빼기·옮기기와 같게 짓는다. */
|
|
11807
11807
|
onCopyItem?: (id: string, index: number) => void;
|
|
11808
|
+
/** 주면 칸에 **바꾸기 단추**가 선다 — 그 칸을 다른 낱말로. 꼴은 코어가 빼기·한 칸 더와 같게 짓는다(청 (353)). */
|
|
11809
|
+
onReplaceItem?: (id: string, index: number) => void;
|
|
11808
11810
|
/** 전달하면 액션 영역 왼쪽에 초기화 버튼 표시 */
|
|
11809
11811
|
onReset?: () => void;
|
|
11810
11812
|
resetLabel?: string;
|
|
@@ -12152,6 +12154,24 @@ export declare interface WordTableProps {
|
|
|
12152
12154
|
* 여기서 그리면 빼기·옮기기와 **같은 꼴로 지어진다** — 맞출 것이 없다.
|
|
12153
12155
|
*/
|
|
12154
12156
|
onCopyItem?: (id: string, index: number) => void;
|
|
12157
|
+
/**
|
|
12158
|
+
* 그 칸을 **다른 낱말로** 바꾼다 — 주면 칸의 오른쪽 기둥에 바꾸기 단추가 선다
|
|
12159
|
+
* (말귀 청 (353), 2026-10-29).
|
|
12160
|
+
*
|
|
12161
|
+
* **`onCopyItem` 과 같은 까닭으로 코어가 그린다.** 이 자리는 `renderCellAction` 으로
|
|
12162
|
+
* 부르는 쪽이 얹던 곳인데, 꼴을 다시 적어야 해서 **안 적은 쪽만 테두리가 생겼다**
|
|
12163
|
+
* (`useBorder` 기본이 `true` 다). 사장님이 **같은 것을 두 번** 이르셨다 —
|
|
12164
|
+
* 2026-09-27 *"다른 단어로 버튼만 다르네? 베리언트 동일하게"* · 2026-10-29
|
|
12165
|
+
* *"다른 단어로 버튼과 복사버튼이 스타일이 다르네?"*. 두 번 어긋났다는 것은
|
|
12166
|
+
* **적어 두는 것으로는 안 맞는다**는 뜻이라 그릴 자리를 코어로 옮긴다.
|
|
12167
|
+
*
|
|
12168
|
+
* 떠 있는 말은 **칸에 든 낱말 수**가 가른다 — 하나면 '다른 단어로', 대립쌍이면 '다른 쌍으로'.
|
|
12169
|
+
* 빼기가 '단어 빼기'·'대립쌍 빼기' 로 갈리는 것과 **같은 자**다. 앱은 이것을 *화면*
|
|
12170
|
+
* (단어표냐 대립쌍표냐)으로 갈라 왔는데 코어는 화면을 모르고, 두 자는 늘 같은 답을 낸다
|
|
12171
|
+
* (대립쌍표 칸은 낱말이 둘, 단어표·활용표 칸은 하나다). 갈리는 칸이 생긴다면 그때는
|
|
12172
|
+
* **빼기도 함께 틀리는 것**이라, 한 자에 묶어 두는 편이 낫다.
|
|
12173
|
+
*/
|
|
12174
|
+
onReplaceItem?: (id: string, index: number) => void;
|
|
12155
12175
|
onReorder?: (fromIndex: number, toIndex: number) => void;
|
|
12156
12176
|
/**
|
|
12157
12177
|
* 이 표의 첫 칸이 **전체 목록에서 몇 번째**인가 — 쪽으로 나뉜 표에서 `WordTableBlock` 이 준다
|
|
@@ -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, maxItemsPerPage, items, onSaveComplete, onLoad, onRemoveItem, onCopyItem, 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, onCopyItem, onReplaceItem, 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, maxItemsPerPage, items, onSaveComplete, onLoad, onRemoveItem, onCopyItem, 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, onCopyItem, onReplaceItem, 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;
|
|
@@ -381,7 +381,7 @@ export default function WordTableBlock({ title, titleIcon, disc, filterTitle, fi
|
|
|
381
381
|
}), !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,
|
|
382
382
|
/* 쪽마다 머리 칸이 선다 — 한 장만 들고 보는 종이에 머리 낱말이 없으면
|
|
383
383
|
나머지 칸이 무엇의 활용인지 알 수 없다 */
|
|
384
|
-
baseItem: baseItem, baseContentTypes: baseContentTypes, onRemoveItem: onRemoveItem, onCopyItem: onCopyItem,
|
|
384
|
+
baseItem: baseItem, baseContentTypes: baseContentTypes, onRemoveItem: onRemoveItem, onCopyItem: onCopyItem, onReplaceItem: onReplaceItem,
|
|
385
385
|
/* 쪽이 나뉘면 끌어 옮기기가 통째로 꺼졌다(말귀 단어 찾기: 9개부터). 쪽 안의 자리를 전체 자리로 옮겨 넘긴다 —
|
|
386
386
|
쪽을 넘는 이동은 하지 않는다. */
|
|
387
387
|
onReorder: onReorder && ((from, to) => onReorder(from + i * itemsPerPage, to + i * itemsPerPage)),
|
|
@@ -399,8 +399,8 @@ export default function WordTableBlock({ title, titleIcon, disc, filterTitle, fi
|
|
|
399
399
|
/* 칸 크기가 쪽마다 같아야 해서 `count` 는 모든 쪽이 '페이지당 개수' 다 —
|
|
400
400
|
채울 자리는 마지막 쪽에서 모자랄 수 있으니 그것만 따로 센다. */
|
|
401
401
|
addableCount: Math.max(0, Math.min(itemsPerPage, capacity - i * itemsPerPage)), brand: band, code: code, contentRef: el => { pageRefs.current[i] = el; }, pageNumber: { current: i + 1, total: pages.length }, pageNumberPosition: pageNumberPosition }, i))) })) : (_jsx(WordTable, { orientation: orientation, contentTypes: contentTypes, cutLine: cutLine, showOutline: showOutline, showDivLine: showDivLine, count: count, items: isEditable ? undefined : (items ?? []), baseItem: isEditable ? undefined : baseItem, baseContentTypes: baseContentTypes, editCells: isEditable ? visibleCells : undefined, activeCell: activeCell, onActivateCell: (isEditable || onAddItem) ? setActiveCell : undefined, onRemoveCell: isEditable ? handleRemove : undefined, onRemoveItem: !isEditable ? onRemoveItem : undefined,
|
|
402
|
-
/* 편집 격자에는 '한 칸 더' 가 뜻이 없다 — 거기선 칸을 손으로 채운다 */
|
|
403
|
-
onCopyItem: !isEditable ? onCopyItem : undefined, onReorder: !isEditable ? onReorder : undefined,
|
|
402
|
+
/* 편집 격자에는 '한 칸 더'·'다른 단어로' 가 뜻이 없다 — 거기선 칸을 손으로 채운다 */
|
|
403
|
+
onCopyItem: !isEditable ? onCopyItem : undefined, onReplaceItem: !isEditable ? onReplaceItem : undefined, onReorder: !isEditable ? onReorder : undefined,
|
|
404
404
|
/* 편집 모드에는 얹을 항목이 없다 — 칸을 손으로 채우는 꼴이다 */
|
|
405
405
|
renderCellAction: !isEditable ? renderCellAction : undefined, brand: band, code: code, showFillerAdd: !!onAddItem, contentRef: contentRef })), !hideControls && !saveOnly && actionsLeftExtra != null && (_jsx("div", { className: "word-table-block__table-actions", children: actionsLeftExtra })), inlineNameFields && !hideControls && (_jsxs(Panel, { size: "medium", labelWidth: 64, useBorder: false, useRowBorder: false, className: "word-table-block__meta", children: [_jsx(PanelRow, { variant: "custom", label: t('wordTable.save.nameLabel', '이름'), required: true, align: "vertical", useFullWidth: true, children: _jsx(TextField, { required: true, value: nameValue ?? '', onChange: onNameChange, placeholder: namePlaceholder ? namePlaceholder + t('wordTable.save.autoFillHint', ' (Tab 또는 space 입력시 자동 입력)') : t('wordTable.save.placeholder', '이 단어표에 대한 제목을 입력하세요.'),
|
|
406
406
|
/* PanelRow의 라벨은 시각적으로만 붙어 있고 입력과 연결돼 있지 않아, 낭독기에는
|
|
@@ -118,6 +118,8 @@ export interface WordTableBlockProps {
|
|
|
118
118
|
onRemoveItem?: (id: string) => void;
|
|
119
119
|
/** 주면 칸에 **복사 단추**가 선다 — 그 낱말을 한 칸 더 만든다. 꼴은 코어가 빼기·옮기기와 같게 짓는다. */
|
|
120
120
|
onCopyItem?: (id: string, index: number) => void;
|
|
121
|
+
/** 주면 칸에 **바꾸기 단추**가 선다 — 그 칸을 다른 낱말로. 꼴은 코어가 빼기·한 칸 더와 같게 짓는다(청 (353)). */
|
|
122
|
+
onReplaceItem?: (id: string, index: number) => void;
|
|
121
123
|
/** 전달하면 액션 영역 왼쪽에 초기화 버튼 표시 */
|
|
122
124
|
onReset?: () => void;
|
|
123
125
|
resetLabel?: string;
|
|
@@ -192,6 +192,7 @@ export function captureHtml(els, paperW, paperH, autoPrint = false, fileName = '
|
|
|
192
192
|
/* 만드는 동안만 쓰는 손잡이들 — 종이에는 안 나간다(renderCellAction 이 얹은 것도 이 줄 안에 있다).
|
|
193
193
|
**여기는 템플릿 글 안이다** — 홑따옴표 대신 역따옴표를 쓰면 글이 거기서 끊긴다. */
|
|
194
194
|
.word-table__card-close,
|
|
195
|
+
.word-table__card-add,
|
|
195
196
|
.word-table__card-actions { display: none; }
|
|
196
197
|
/* 머리글은 격자 위에 얹힌다. 용지 안쪽 여백(57px)을 이미 .paper-wrap 이 갖고 있어
|
|
197
198
|
여기서는 아래 간격만 준다. 격자는 제 높이를 스스로 잡으므로 밀려도 잘리지 않는다. */
|
|
@@ -26,6 +26,11 @@
|
|
|
26
26
|
width: 100%;
|
|
27
27
|
height: 100%;
|
|
28
28
|
box-sizing: border-box;
|
|
29
|
+
/* **칸 사이 틈은 한 곳에만 적는다.** 줄 높이를 `WordTable.tsx` 가
|
|
30
|
+
`calc((100% - (줄-1) x 이 값) / 줄)` 로 셈하므로, 틈을 다른 데서 따로 적으면
|
|
31
|
+
그 셈이 틀어져 격자가 종이 밖으로 나간다. 절취선을 보이는 표만 1px 을 준다. */
|
|
32
|
+
--wt-cell-gap: 0px;
|
|
33
|
+
gap: var(--wt-cell-gap);
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
/* ── 페이지 번호 ───────────────────────────────────────── */
|
|
@@ -286,7 +291,7 @@
|
|
|
286
291
|
|
|
287
292
|
/* 절취선: 표시 (solid, 내부 선만) */
|
|
288
293
|
.word-table__content--cut-show {
|
|
289
|
-
gap: 1px;
|
|
294
|
+
--wt-cell-gap: 1px;
|
|
290
295
|
background: var(--color-whiteLine);
|
|
291
296
|
print-color-adjust: exact;
|
|
292
297
|
-webkit-print-color-adjust: exact;
|
|
@@ -767,6 +772,7 @@
|
|
|
767
772
|
}
|
|
768
773
|
|
|
769
774
|
.word-table__card-close,
|
|
775
|
+
.word-table__card-add,
|
|
770
776
|
.word-table__card-actions,
|
|
771
777
|
.word-table__card-handle { display: none; }
|
|
772
778
|
|
|
@@ -59,6 +59,24 @@ export interface WordTableProps {
|
|
|
59
59
|
* 여기서 그리면 빼기·옮기기와 **같은 꼴로 지어진다** — 맞출 것이 없다.
|
|
60
60
|
*/
|
|
61
61
|
onCopyItem?: (id: string, index: number) => void;
|
|
62
|
+
/**
|
|
63
|
+
* 그 칸을 **다른 낱말로** 바꾼다 — 주면 칸의 오른쪽 기둥에 바꾸기 단추가 선다
|
|
64
|
+
* (말귀 청 (353), 2026-10-29).
|
|
65
|
+
*
|
|
66
|
+
* **`onCopyItem` 과 같은 까닭으로 코어가 그린다.** 이 자리는 `renderCellAction` 으로
|
|
67
|
+
* 부르는 쪽이 얹던 곳인데, 꼴을 다시 적어야 해서 **안 적은 쪽만 테두리가 생겼다**
|
|
68
|
+
* (`useBorder` 기본이 `true` 다). 사장님이 **같은 것을 두 번** 이르셨다 —
|
|
69
|
+
* 2026-09-27 *"다른 단어로 버튼만 다르네? 베리언트 동일하게"* · 2026-10-29
|
|
70
|
+
* *"다른 단어로 버튼과 복사버튼이 스타일이 다르네?"*. 두 번 어긋났다는 것은
|
|
71
|
+
* **적어 두는 것으로는 안 맞는다**는 뜻이라 그릴 자리를 코어로 옮긴다.
|
|
72
|
+
*
|
|
73
|
+
* 떠 있는 말은 **칸에 든 낱말 수**가 가른다 — 하나면 '다른 단어로', 대립쌍이면 '다른 쌍으로'.
|
|
74
|
+
* 빼기가 '단어 빼기'·'대립쌍 빼기' 로 갈리는 것과 **같은 자**다. 앱은 이것을 *화면*
|
|
75
|
+
* (단어표냐 대립쌍표냐)으로 갈라 왔는데 코어는 화면을 모르고, 두 자는 늘 같은 답을 낸다
|
|
76
|
+
* (대립쌍표 칸은 낱말이 둘, 단어표·활용표 칸은 하나다). 갈리는 칸이 생긴다면 그때는
|
|
77
|
+
* **빼기도 함께 틀리는 것**이라, 한 자에 묶어 두는 편이 낫다.
|
|
78
|
+
*/
|
|
79
|
+
onReplaceItem?: (id: string, index: number) => void;
|
|
62
80
|
onReorder?: (fromIndex: number, toIndex: number) => void;
|
|
63
81
|
/**
|
|
64
82
|
* 이 표의 첫 칸이 **전체 목록에서 몇 번째**인가 — 쪽으로 나뉜 표에서 `WordTableBlock` 이 준다
|
|
@@ -237,4 +255,4 @@ export interface WordTableProps {
|
|
|
237
255
|
* 표시(items)·편집(editCells) 두 모드를 지원한다.
|
|
238
256
|
* @public
|
|
239
257
|
*/
|
|
240
|
-
export default function WordTable({ title, titleIcon, disc, className, orientation, contentTypes, baseItem, baseContentTypes, cutLine, showOutline, showDivLine, items, editCells, count, activeCell, onActivateCell, onRemoveCell, onRemoveItem, onReorder, onCopyItem, indexOffset, totalCount, renderCellAction, showFillerAdd, addableCount, contentRef, buttonSize, brand, code, pageNumber, pageNumberPosition, fitHeight, scoring, marks, onMarkClick, scoreIndexOffset, }: WordTableProps): import("react").JSX.Element;
|
|
258
|
+
export default function WordTable({ title, titleIcon, disc, className, orientation, contentTypes, baseItem, baseContentTypes, cutLine, showOutline, showDivLine, items, editCells, count, activeCell, onActivateCell, onRemoveCell, onRemoveItem, onReorder, onCopyItem, onReplaceItem, indexOffset, totalCount, renderCellAction, showFillerAdd, addableCount, contentRef, buttonSize, brand, code, pageNumber, pageNumberPosition, fitHeight, scoring, marks, onMarkClick, scoreIndexOffset, }: WordTableProps): import("react").JSX.Element;
|
|
@@ -50,6 +50,33 @@ const srOnly = {
|
|
|
50
50
|
const LONG_PRESS_MS = 400;
|
|
51
51
|
/** 길게 누르기가 익기 전에 이만큼 움직이면 그건 끌기가 아니라 **스크롤**이라 취소한다 */
|
|
52
52
|
const MOVE_THRESHOLD_PX = 8;
|
|
53
|
+
/**
|
|
54
|
+
* **줄 높이는 `1fr` 이 아니라 백분율로 적는다**(말귀 청 (351), 2026-10-29).
|
|
55
|
+
*
|
|
56
|
+
* 격자는 위아래로 **안쪽 여백**을 쥔다 — 머리 띠 40px · 바닥 띠 32px(쪽 번호면 28px).
|
|
57
|
+
* 화면에서는 `repeat(n, 1fr)` 이 그 여백을 뺀 안쪽 높이를 제대로 나눈다. 그런데
|
|
58
|
+
* **종이에서는 첫 줄이 그 여백을 되받는다**(크로미움 인쇄 배치, 실측 2026-10-29).
|
|
59
|
+
*
|
|
60
|
+
* 가로 A4 · 6x4 · 띠 둘(안쪽 608px)을 150dpi PDF 로 떠서 줄 경계를 픽셀로 잰 것 —
|
|
61
|
+
*
|
|
62
|
+
* | | 1번째 줄 | 2·3·4번째 줄 | 마지막 경계 |
|
|
63
|
+
* |---|---|---|---|
|
|
64
|
+
* | `repeat(4, 1fr)` | **226.8px** | 151.5px | 1215 (종이 안쪽 바닥 **1101**) |
|
|
65
|
+
* | `repeat(4, calc((100% - 3px) / 4))` | 150.2px | 150.8px | 1097 |
|
|
66
|
+
*
|
|
67
|
+
* 첫 줄이 **75px** 을 더 먹어 마지막 줄이 바닥 띠에 깔려 잘렸다. `minmax(0, 1fr)` ·
|
|
68
|
+
* `height: 100%` · `align-content: start` 로는 안 낫는다(셋 다 그대로 1215). 내용이
|
|
69
|
+
* 밀어서가 아니라 **`fr` 이 나눌 자리를 잘못 잡아서**다 — 그래서 자리를 직접 적는다.
|
|
70
|
+
* 백분율은 안쪽 상자를 보므로 종이와 화면이 같은 수를 낸다.
|
|
71
|
+
*
|
|
72
|
+
* 틈(`--wt-cell-gap`)을 빼지 않으면 (줄-1)px 만큼 넘친다. 그 값은 `WordTable.css`
|
|
73
|
+
* 한 곳에만 산다 — 여기서 수를 다시 적지 않는 까닭이다.
|
|
74
|
+
*/
|
|
75
|
+
function rowTemplate(rows) {
|
|
76
|
+
if (rows <= 1)
|
|
77
|
+
return '100%';
|
|
78
|
+
return `repeat(${rows}, calc((100% - ${rows - 1} * var(--wt-cell-gap, 0px)) / ${rows}))`;
|
|
79
|
+
}
|
|
53
80
|
function WordCell({ label, subLabel, colloquialLabel, captionLabel, captionBadge, homonum, showWord = true, showImage = true, showPronunciation = true, showColloquial = true, showCaption = true, buttonSize = 40, wordInfo, outerScale = 1, }) {
|
|
54
81
|
const { t } = useTranslation();
|
|
55
82
|
const outerRef = useRef(null);
|
|
@@ -277,7 +304,7 @@ function WordCell({ label, subLabel, colloquialLabel, captionLabel, captionBadge
|
|
|
277
304
|
* 표시(items)·편집(editCells) 두 모드를 지원한다.
|
|
278
305
|
* @public
|
|
279
306
|
*/
|
|
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, onCopyItem, indexOffset = 0, totalCount, renderCellAction, showFillerAdd = false, addableCount, contentRef, buttonSize = 40, brand, code, pageNumber, pageNumberPosition = 'right', fitHeight = false, scoring = false, marks, onMarkClick, scoreIndexOffset = 0, }) {
|
|
307
|
+
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, onCopyItem, onReplaceItem, indexOffset = 0, totalCount, renderCellAction, showFillerAdd = false, addableCount, contentRef, buttonSize = 40, brand, code, pageNumber, pageNumberPosition = 'right', fitHeight = false, scoring = false, marks, onMarkClick, scoreIndexOffset = 0, }) {
|
|
281
308
|
const clickMark = useCallback((cellIndex, clicked) => {
|
|
282
309
|
onMarkClick?.(scoreIndexOffset + cellIndex, clicked);
|
|
283
310
|
}, [onMarkClick, scoreIndexOffset]);
|
|
@@ -640,10 +667,10 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
|
|
|
640
667
|
늘 서면 **읽기만 하는 표가 아직 안 매긴 표처럼** 보였다(말귀 요청 ㊷). */
|
|
641
668
|
className: cx('word-table', scoring && !canMark && 'word-table--score-readonly', !wrapped && className), style: { width, height, transform: `scale(${scale})`, transformOrigin: 'top left', marginLeft: offset }, children: _jsxs("div", { ref: gridContentRef, className: contentClass, style: {
|
|
642
669
|
gridTemplateColumns: `repeat(${cols}, 1fr)`,
|
|
643
|
-
gridTemplateRows:
|
|
670
|
+
gridTemplateRows: rowTemplate(rows),
|
|
644
671
|
}, 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,
|
|
645
672
|
// 편집 칸도 구어체 발음을 넘긴다 — 빠져 있어 '구어체 발음'을 켜도 편집 모드에서만 비었다.
|
|
646
|
-
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: removeAriaLabel(cell.map(e => e.word), cell.length > 1), 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 && (
|
|
673
|
+
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: removeAriaLabel(cell.map(e => e.word), cell.length > 1), onClick: () => onRemoveCell(i) }) }))] })) : (onActivateCell && (_jsx("div", { className: withLegacy("word-table__card-add"), 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 && (
|
|
647
674
|
/* 걸치는 자리는 양쪽이 같은 식이다 — 가로면 왼쪽 `half.cols` 열 × 전체 `half.rows` 줄,
|
|
648
675
|
세로면 전체 `half.cols` 열 × 위 `half.rows` 줄. 둘 다 `1 / span` 으로 같게 적힌다. */
|
|
649
676
|
_jsx("div", { className: withLegacy("word-table__card word-table__card--base"), style: {
|
|
@@ -653,7 +680,7 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
|
|
|
653
680
|
...dotDashStyle(0, orientation === 'landscape' ? 2 : 1, orientation === 'landscape' ? 1 : 2, cutLine),
|
|
654
681
|
}, 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) {
|
|
655
682
|
onReorder(dragIndex.current, index);
|
|
656
|
-
} ; 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 || onCopyItem || onReorder) && (
|
|
683
|
+
} ; 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 || onCopyItem || onReplaceItem || onReorder) && (
|
|
657
684
|
/* **오른쪽 기둥** — 빼기 → 부르는 쪽이 얹은 것 → 옮기기 손잡이 차례로 쌓인다
|
|
658
685
|
(말귀 청 (331), 2026-10-28). 전에는 빼기와 얹은 것만 **한 줄**로 서고
|
|
659
686
|
손잡이는 왼쪽 위에 따로 섰다 — 재생 단추와 **같은 자리라 겹쳤다.**
|
|
@@ -671,7 +698,21 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
|
|
|
671
698
|
_jsx("div", { className: withLegacy("word-table__card-copy"), children: _jsx(Button, { htmlType: "button", size: buttonSize, type: "dot", icon: "copy", variant: "transparent-lightGray", useBorder: false, showTooltipInfo: t('wordTable.copyItem', '한 칸 더'), ariaLabel: t('wordTable.copyItemAria', {
|
|
672
699
|
n: indexOffset + index + 1,
|
|
673
700
|
defaultValue: '{{n}}번 칸 낱말을 한 칸 더',
|
|
674
|
-
}), onClick: () => onCopyItem(item.id, indexOffset + index) }) })),
|
|
701
|
+
}), onClick: () => onCopyItem(item.id, indexOffset + index) }) })), onReplaceItem && (
|
|
702
|
+
/* **'한 칸 더' 바로 아래** — 지금까지 `renderCellAction` 이 서던 자리라
|
|
703
|
+
화면 차례가 안 바뀐다. 꼴은 위아래 이웃과 **한 글자도 안 다르다**
|
|
704
|
+
(`type="dot"` · `transparent-lightGray` · `useBorder={false}`). */
|
|
705
|
+
_jsx("div", { className: withLegacy("word-table__card-replace"), children: _jsx(Button, { htmlType: "button", size: buttonSize, type: "dot", icon: "refresh-cw", variant: "transparent-lightGray", useBorder: false, showTooltipInfo: (item.words ?? []).length > 1
|
|
706
|
+
? t('wordTable.replacePair', '다른 쌍으로')
|
|
707
|
+
: t('wordTable.replaceItem', '다른 단어로'), ariaLabel: (item.words ?? []).length > 1
|
|
708
|
+
? t('wordTable.replacePairAria', {
|
|
709
|
+
n: indexOffset + index + 1,
|
|
710
|
+
defaultValue: '{{n}}번 칸만 다른 쌍으로',
|
|
711
|
+
})
|
|
712
|
+
: t('wordTable.replaceItemAria', {
|
|
713
|
+
n: indexOffset + index + 1,
|
|
714
|
+
defaultValue: '{{n}}번 칸만 다른 단어로',
|
|
715
|
+
}), onClick: () => onReplaceItem(item.id, indexOffset + index) }) })), renderCellAction?.(index, item), onReorder && (
|
|
675
716
|
/* **옮기기 손잡이.** 키보드로 순서를 바꾸려면 초점이 갈 자리가 있어야 하는데,
|
|
676
717
|
칸 자체를 초점 대상으로 만들면 칸마다 뜻 없는 탭 정지점이 하나씩 늘고
|
|
677
718
|
낭독기는 그것이 무엇인지 말할 수 없다. 이름 붙은 진짜 단추를 둔다 —
|
|
@@ -689,7 +730,11 @@ export default function WordTable({ title, titleIcon, disc, className, orientati
|
|
|
689
730
|
디폴트로"*). 전에는 `추가하기` 글자를 단 가로 단추였는데, 빈 칸이 열둘인
|
|
690
731
|
활용표에서는 같은 글자가 열두 번 서서 칸보다 글자가 먼저 읽혔다.
|
|
691
732
|
글자가 빠졌으니 이름은 `ariaLabel` 이 든다 — 낭독기에는 그대로 '추가하기'다. */
|
|
692
|
-
|
|
733
|
+
/* **이름이 있어야 종이가 걷어 낸다**(말귀 청 (350), 2026-10-29).
|
|
734
|
+
종이는 `card-close` · `card-actions` 를 이름으로 걷는데, 이 `+` 는
|
|
735
|
+
이름 없는 `<div>` 안에 있어 걸 자가 없었다 — 인쇄는 물론 **새 창과
|
|
736
|
+
내려받은 HTML 에도** 눌리지 않는 단추가 그대로 찍혔다. */
|
|
737
|
+
_jsx("div", { className: withLegacy("word-table__card-add"), 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((items?.length ?? 0) + i) }) })) }, `filler-${i}`));
|
|
693
738
|
})] })), showTopBand && (_jsx(_Fragment, { children: _jsxs("div", { className: "word-table__band word-table__band--top", children: [_jsx("img", { className: "word-table__brand-logo", src: brand?.topLogo?.src ?? speechearLogo, alt: brand?.topLogo?.alt ?? '말귀' }), (() => {
|
|
694
739
|
/* 표 제목 · 기관 이름 · 표 번호 — 있는 것끼리만 가운뎃점으로 잇는다
|
|
695
740
|
(사용자 지시 2026-09-30). 없는 것 자리에 점이 남으면 안 된다. */
|
|
@@ -685,7 +685,11 @@
|
|
|
685
685
|
"handle": "Reorder {{word}} (Alt + arrow keys)",
|
|
686
686
|
"hint": "Alt + ← → to reorder"
|
|
687
687
|
},
|
|
688
|
-
"thumbMore": "+{{count}}"
|
|
688
|
+
"thumbMore": "+{{count}}",
|
|
689
|
+
"replaceItem": "Other words",
|
|
690
|
+
"replacePair": "Other pairs",
|
|
691
|
+
"replaceItemAria": "Swap cell {{n}} only",
|
|
692
|
+
"replacePairAria": "Swap pair {{n}} only"
|
|
689
693
|
},
|
|
690
694
|
"wordSearch": {
|
|
691
695
|
"filterTitle": "Word Search Settings",
|
|
@@ -672,7 +672,11 @@
|
|
|
672
672
|
"handle": "{{word}} 순서 바꾸기 (Alt + 화살표)",
|
|
673
673
|
"hint": "Alt + ← → 로 순서 바꾸기"
|
|
674
674
|
},
|
|
675
|
-
"thumbMore": "+{{count}}"
|
|
675
|
+
"thumbMore": "+{{count}}",
|
|
676
|
+
"replaceItem": "다른 단어로",
|
|
677
|
+
"replacePair": "다른 쌍으로",
|
|
678
|
+
"replaceItemAria": "{{n}}번 칸만 다른 단어로",
|
|
679
|
+
"replacePairAria": "{{n}}번 칸만 다른 쌍으로"
|
|
676
680
|
},
|
|
677
681
|
"wordSearch": {
|
|
678
682
|
"filterTitle": "단어 검색 설정",
|