@ihabdevteam/core 0.375.0 → 0.377.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 +147 -0
- package/dist/components.cjs.js +173 -173
- package/dist/components.esm.css +3 -3
- 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 +55 -3
- package/dist/packages/core/src/components/Button.css +8 -0
- package/dist/packages/core/src/components/Button.js +18 -5
- package/dist/packages/core/src/components/Training/TrainingWordCard.js +14 -2
- package/dist/packages/core/src/components/Word/WordSearchResultBlock.css +0 -7
- package/dist/packages/core/src/components/Word/WordSearchResultBlock.js +1 -1
- package/dist/packages/core/src/components/Word/WordTableBlock.d.ts +1 -1
- package/dist/packages/core/src/components/Word/WordTableBlock.js +38 -16
- package/dist/packages/core/src/components/Word/wordTableBlockTypes.d.ts +15 -0
- package/dist/packages/core/src/components/WordTable.css +45 -18
- package/dist/packages/core/src/components/WordTable.d.ts +10 -1
- package/dist/packages/core/src/components/WordTable.js +69 -31
- package/dist/packages/core/src/components/buttonTypes.d.ts +17 -0
- 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/types/wordSearch.d.ts +11 -0
- 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 +2 -1
|
@@ -986,6 +986,23 @@ export declare interface ButtonProps {
|
|
|
986
986
|
/** 이 단추가 여닫는 영역의 id — `aria-controls` 로 단다(`ariaExpanded` 와 함께 쓴다) */
|
|
987
987
|
ariaControls?: string;
|
|
988
988
|
disabled?: boolean;
|
|
989
|
+
/**
|
|
990
|
+
* **기다리는 중** — 아이콘 자리에 도는 표시(`Loader variant="spinner"`)가 서고 다시 눌리지 않는다.
|
|
991
|
+
*
|
|
992
|
+
* 소리 단추가 쥐는 때는 **셋**인데 꼴은 둘뿐이었다 — `재생`/`멈춤` 만 있고 *받아 오는 중*
|
|
993
|
+
* 이 없었다(말귀 청 (330), 2026-10-28). 음원이 없는 낱말은 누른 뒤 합성을 기다리는데
|
|
994
|
+
* (실측 처음 3,567ms · 캐시가 있을 때 772ms), 그동안 단추가 곧바로 '멈춤' 이 되어
|
|
995
|
+
* **눌렀는데 멈춰 있는** 꼴로 보였다.
|
|
996
|
+
*
|
|
997
|
+
* **보이는 꼴만 바꾼다 — 손은 그대로 받는다.** 막으려면 `disabled` 를 함께 준다.
|
|
998
|
+
*
|
|
999
|
+
* 막는 것까지 여기 묶지 않은 까닭은, 기다리는 단추를 누르는 뜻이 자리마다 갈려서다.
|
|
1000
|
+
* 저장 단추는 **아무 일도 안 나야** 하고(두 번 누르면 두 번 저장된다), 소리 단추는
|
|
1001
|
+
* **기다림을 접어야** 한다(옆 칸을 누르거나 마음이 바뀐다). 하나의 참/거짓으로 둘을 다
|
|
1002
|
+
* 말할 수 없다 — 그래서 *보이는 꼴*만 맡고, 막는 일은 이미 그 일을 하는 `disabled` 에
|
|
1003
|
+
* 둔다. 빠져나갈 구멍을 하나 더 뚫는 것보다 **뜻이 하나씩인 쪽**이 낫다.
|
|
1004
|
+
*/
|
|
1005
|
+
loading?: boolean;
|
|
989
1006
|
/** label을 숨기려면 false로 설정 */
|
|
990
1007
|
useLabel?: boolean;
|
|
991
1008
|
useBorder?: boolean;
|
|
@@ -1770,7 +1787,7 @@ export declare function copyText(text: string): Promise<boolean>;
|
|
|
1770
1787
|
*
|
|
1771
1788
|
* 값은 손으로 적고 `test/coreVersion.test.ts` 가 package.json 과 어긋나면 운다.
|
|
1772
1789
|
*/
|
|
1773
|
-
export declare const CORE_VERSION = "0.
|
|
1790
|
+
export declare const CORE_VERSION = "0.377.0";
|
|
1774
1791
|
|
|
1775
1792
|
/** @public */
|
|
1776
1793
|
declare const coreDefault: Record<string, unknown>;
|
|
@@ -11474,6 +11491,17 @@ export declare interface WordSearchResultWord {
|
|
|
11474
11491
|
* (말귀가 활용표를 옮기며 실측 2026-10-27).
|
|
11475
11492
|
*/
|
|
11476
11493
|
captionLabel?: string;
|
|
11494
|
+
/**
|
|
11495
|
+
* 이름표 앞에 서는 **배지** — `captionLabel` 과 한 줄로 낱말 **위**에 선다.
|
|
11496
|
+
*
|
|
11497
|
+
* 활용표의 이름표가 성격이 다른 둘이 되어서다(말귀 청 (328), 2026-10-28 사장님 지시
|
|
11498
|
+
* *"양보 는 badge 로 표현하도록"*). `양보` 는 **무엇을 하는 말인가** — 치료사가 꼴을
|
|
11499
|
+
* 고르는 잣대다. `-아/어도` 는 **어떤 꼬리가 붙는가** — 학습자가 낼 소리다. 한 글자로
|
|
11500
|
+
* 붙여 놓으면 그 둘이 안 갈린다.
|
|
11501
|
+
*
|
|
11502
|
+
* 배지만 주거나 이름표만 줘도 된다. 둘 다 없으면 아무것도 안 선다.
|
|
11503
|
+
*/
|
|
11504
|
+
captionBadge?: string;
|
|
11477
11505
|
homonum?: number;
|
|
11478
11506
|
grade?: string;
|
|
11479
11507
|
syllables?: number;
|
|
@@ -11493,9 +11521,9 @@ export declare interface WordSearchResultWord {
|
|
|
11493
11521
|
* 표시(items)·편집(editCells) 두 모드를 지원한다.
|
|
11494
11522
|
* @public
|
|
11495
11523
|
*/
|
|
11496
|
-
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, contentRef, buttonSize, brand, code, pageNumber, pageNumberPosition, fitHeight, scoring, marks, onMarkClick, scoreIndexOffset, }: WordTableProps): JSX.Element;
|
|
11524
|
+
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;
|
|
11497
11525
|
|
|
11498
|
-
export declare function WordTableBlock({ title, titleIcon, disc, filterTitle, filterCollapsible, filterDefaultCollapsed, filterCollapsed, onFilterCollapsedChange, filterHeaderSummary, brand, code, baseItem, baseContentTypes, 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;
|
|
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;
|
|
11499
11527
|
|
|
11500
11528
|
/** @public */
|
|
11501
11529
|
export declare interface WordTableBlockProps {
|
|
@@ -11558,6 +11586,21 @@ export declare interface WordTableBlockProps {
|
|
|
11558
11586
|
baseItem?: WordTableProps['baseItem'];
|
|
11559
11587
|
/** 머리 칸에만 걸리는 보임 — 안 주면 표 설정 판에서 고른 `contentTypes` 를 따른다. */
|
|
11560
11588
|
baseContentTypes?: WordTableProps['baseContentTypes'];
|
|
11589
|
+
/**
|
|
11590
|
+
* **이 표가 채울 수 있는 칸 수** — 항목 수보다 크면 그만큼 빈 칸이 생기고,
|
|
11591
|
+
* `onAddItem` 이 있으면 그 칸 가운데에 '추가하기' 가 선다.
|
|
11592
|
+
*
|
|
11593
|
+
* 활용표처럼 **칸 수를 사람이 아니라 낱말이 정하는 표**를 위해 둔다(말귀 청 (327),
|
|
11594
|
+
* 2026-10-28). 전에는 빈 칸을 내는 길이 `showCellCount` 뿐이었는데 그것은 값이 비쌌다 —
|
|
11595
|
+
* '칸 수' 고르개를 세우고 **쪽 나눔을 통째로 껐다.** 이것은 둘 다 안 한다.
|
|
11596
|
+
*
|
|
11597
|
+
* 쪽이 나뉘면 빈 칸은 **뒤쪽 쪽에** 선다. 쪽 수는 `올림(cellCapacity / 페이지당 개수)` 이라,
|
|
11598
|
+
* 항목이 모자라도 채울 자리가 남아 있으면 그만큼 쪽이 더 선다.
|
|
11599
|
+
*
|
|
11600
|
+
* 항목 수보다 작으면 무시한다 — 담긴 것을 가릴 수는 없다. `showCellCount` 와 함께 주면
|
|
11601
|
+
* 그쪽이 이긴다(사람이 고른 것이 마지막 말이다).
|
|
11602
|
+
*/
|
|
11603
|
+
cellCapacity?: number;
|
|
11561
11604
|
disc?: ReactNode;
|
|
11562
11605
|
/** 현재 표의 저장된 이름(불러온 표 등). 있으면 인쇄/PDF 저장 시 파일명으로 사용, 없으면 "오늘 날짜 + 단어표/대립쌍표" */
|
|
11563
11606
|
tableName?: string;
|
|
@@ -11894,6 +11937,15 @@ export declare interface WordTableProps {
|
|
|
11894
11937
|
onReorder?: (fromIndex: number, toIndex: number) => void;
|
|
11895
11938
|
/** 표시 모드에서 `count` 안의 빈칸(항목 수 뒤 ~ count)에 '추가' 버튼 노출. count 가 항목 수와 같으면 그런 칸이 없다. `onActivateCell` 필요. */
|
|
11896
11939
|
showFillerAdd?: boolean;
|
|
11940
|
+
/**
|
|
11941
|
+
* '추가하기' 가 설 수 있는 칸 수 — 안 주면 `count` 를 따른다.
|
|
11942
|
+
*
|
|
11943
|
+
* 쪽이 나뉜 표의 **마지막 쪽**을 위해 둔다(말귀 청 (327), 2026-10-28). 쪽마다 칸 크기가
|
|
11944
|
+
* 같아야 해서 `count` 는 모든 쪽이 '페이지당 개수' 로 같은데, 채울 자리는 마지막 쪽에서
|
|
11945
|
+
* 모자랄 수 있다(자리 12 · 쪽당 8 → 둘째 쪽은 네 자리뿐). `count` 로 세면 **없는 자리에도
|
|
11946
|
+
* 단추가 선다.**
|
|
11947
|
+
*/
|
|
11948
|
+
addableCount?: number;
|
|
11897
11949
|
/**
|
|
11898
11950
|
* **칸 오른쪽 위에 부르는 쪽이 얹는 것** — 칸 번호와 그 칸의 항목을 준다. 안 주면 아무것도 안 얹는다.
|
|
11899
11951
|
*
|
|
@@ -41,6 +41,14 @@
|
|
|
41
41
|
.button__icon--medium { width: 24px; height: 24px; }
|
|
42
42
|
.button__icon--large { width: 36px; height: 36px; }
|
|
43
43
|
|
|
44
|
+
/* 기다리는 꼴(`loading`) — 아이콘과 **같은 상자**에 도는 표시를 세운다(청 (330), 2026-10-28).
|
|
45
|
+
상자 크기는 위 `button__icon--*` 가 그대로 정하고, 여기서는 안의 것을 가운데로만 몬다. */
|
|
46
|
+
.button__spinner {
|
|
47
|
+
display: inline-flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
}
|
|
51
|
+
|
|
44
52
|
/* group for center-aligned icon+label so they stay together */
|
|
45
53
|
.button__center-group {
|
|
46
54
|
display: inline-flex;
|
|
@@ -5,13 +5,14 @@ import { devWarnOnce, isDev } from '../utils/devWarn';
|
|
|
5
5
|
import { forwardRef, useCallback, useEffect, useId, useRef, useState } from 'react';
|
|
6
6
|
import './Button.css';
|
|
7
7
|
import Icon from './Icon';
|
|
8
|
+
import Loader from './Loader';
|
|
8
9
|
import InfoTooltip from "./Tooltip/InfoTooltip";
|
|
9
10
|
import DescriptionTooltip from "./Tooltip/DescriptionTooltip";
|
|
10
11
|
import { isTouchPointer, recentlyTouched, useTouchToggle } from '../hooks/touchToggle';
|
|
11
12
|
/* **ref 는 forwardRef 로 받는다** — React 19 는 ref 를 props 로 넘기지만 peer 는 16.8~ 라, React 18(kscan) 에서는 함수 컴포넌트에 준
|
|
12
13
|
ref 가 버려진다. 게다가 전에는 안쪽 ref(`btnRef`)가 props 에서 온 ref 를 덮어써 19 에서도 부르는 쪽 ref 가 비었다. 두 ref 를 잇는다. */
|
|
13
14
|
function ButtonInner(props, forwardedRef) {
|
|
14
|
-
const { size = 48, type: explicitType, htmlType, href, target, rel, icon, rightIcon, label: labelProp, count, subLabel, children, ariaLabel, variant = 'default', align = 'center', nowrap = false, selected, toggleable = false, ariaExpanded, ariaControls, disabled = false, useLabel = true, useBorder = true, useBG = true, useDisabledCovered = false, useDisabledInvisible = false, useDisabledFilled = false, width, minWidth, onClick, onDisabledClick, showTooltipInfo = false, tooltipInfoText = null, tooltipDescription = null, tooltipOnly = false, iconSize = 'medium', iconColor, shape = 'rounded', color, className, ...rest } = props;
|
|
15
|
+
const { size = 48, type: explicitType, htmlType, href, target, rel, icon, rightIcon, label: labelProp, count, subLabel, children, ariaLabel, variant = 'default', align = 'center', nowrap = false, selected, toggleable = false, ariaExpanded, ariaControls, disabled = false, loading = false, useLabel = true, useBorder = true, useBG = true, useDisabledCovered = false, useDisabledInvisible = false, useDisabledFilled = false, width, minWidth, onClick, onDisabledClick, showTooltipInfo = false, tooltipInfoText = null, tooltipDescription = null, tooltipOnly = false, iconSize = 'medium', iconColor, shape = 'rounded', color, className, ...rest } = props;
|
|
15
16
|
const sizeKey = typeof size === 'string' && isNaN(Number(size))
|
|
16
17
|
? size.toLowerCase()
|
|
17
18
|
: String(Number(size) || 48);
|
|
@@ -233,6 +234,9 @@ function ButtonInner(props, forwardedRef) {
|
|
|
233
234
|
});
|
|
234
235
|
restProps['aria-disabled'] = 'true';
|
|
235
236
|
}
|
|
237
|
+
/* 낭독기에 *기다리는 중* 을 알린다 — 도는 표시는 `aria-hidden` 이라 이 말이 유일하다 */
|
|
238
|
+
if (loading)
|
|
239
|
+
restProps['aria-busy'] = 'true';
|
|
236
240
|
// 툴팁 텍스트: showTooltipInfo(string) → tooltipInfoText → ariaLabel → label 순 우선
|
|
237
241
|
const tooltipText = (typeof showTooltipInfo === 'string' ? showTooltipInfo : null)
|
|
238
242
|
?? (typeof tooltipInfoText === 'string' ? tooltipInfoText : null)
|
|
@@ -252,15 +256,24 @@ function ButtonInner(props, forwardedRef) {
|
|
|
252
256
|
: showTooltipInfo && tooltipText && tooltipText !== ariaLabelString ? tooltipText : '';
|
|
253
257
|
const consumerDescribedBy = typeof rest['aria-describedby'] === 'string' ? rest['aria-describedby'] : undefined;
|
|
254
258
|
const ariaDescribedBy = [consumerDescribedBy, describeText ? describeId : null].filter(Boolean).join(' ') || undefined;
|
|
259
|
+
/* **기다리는 꼴**(`loading`) — 아이콘 자리를 그대로 쓴다(청 (330)).
|
|
260
|
+
`button__icon` 을 함께 달아 아이콘과 **같은 상자**에 서게 한다 — 따로 재면 단추 크기마다
|
|
261
|
+
어긋난다. `Loader` 가 `role="status"` 와 숨은 글자를 들고 오므로 **통째로 가린다** —
|
|
262
|
+
단추 쪽의 `aria-busy` 가 그 말을 이미 하고 있어, 안 가리면 두 번 읽힌다. */
|
|
263
|
+
const renderSpinner = () => (_jsx("span", { className: `${iconClassName} button__spinner`, "aria-hidden": "true", children: _jsx(Loader, { variant: "spinner", size: "100%" }) }));
|
|
255
264
|
const renderIcon = (iconVal, label) => (_jsx(Icon, { icon: iconVal, label: label ?? ariaLabelString, className: iconClassName, imgClassName: "button__icon-img", maskClassName: "button__icon-mask", svgClassName: "button__icon-svg" }));
|
|
265
|
+
/* 기다리는 꼴은 **왼쪽(주된) 아이콘 자리 하나**만 바꾼다. `renderIcon` 안에서 바꾸면
|
|
266
|
+
오른쪽 아이콘까지 돌아 **한 단추에 도는 표시가 둘**이 된다. 아이콘이 없는 단추에는
|
|
267
|
+
글자 앞에 세운다 — 그 자리도 기다리고 있기는 마찬가지다. */
|
|
268
|
+
const renderMainIcon = (label) => (loading ? renderSpinner() : renderIcon(icon, label));
|
|
256
269
|
const renderContent = () => {
|
|
257
270
|
if (type === 'dot') {
|
|
258
|
-
return (_jsxs(_Fragment, { children: [
|
|
271
|
+
return (_jsxs(_Fragment, { children: [renderMainIcon(), hasLabel && _jsx("span", { className: `button__label ${labelTypoClass}`, children: renderLabelContent() })] }));
|
|
259
272
|
}
|
|
260
|
-
if (align === 'center' && icon) {
|
|
261
|
-
return (_jsxs(_Fragment, { children: [_jsxs("span", { className: "button__center-group", children: [_jsx("span", { className: "button__left", children:
|
|
273
|
+
if (align === 'center' && (icon || loading)) {
|
|
274
|
+
return (_jsxs(_Fragment, { children: [_jsxs("span", { className: "button__center-group", children: [_jsx("span", { className: "button__left", children: renderMainIcon() }), hasLabel && _jsx("span", { className: `button__label ${labelTypoClass}`, children: renderLabelContent() })] }), hasRight && _jsx("span", { className: "button__right", children: renderIcon(rightIcon) })] }));
|
|
262
275
|
}
|
|
263
|
-
return (_jsxs(_Fragment, { children: [icon && _jsx("span", { className: "button__left", children:
|
|
276
|
+
return (_jsxs(_Fragment, { children: [(icon || loading) && _jsx("span", { className: "button__left", children: renderMainIcon(ariaLabel ?? label) }), hasLabel && _jsx("span", { className: `button__label ${labelTypoClass}`, children: renderLabelContent() }), hasRight && _jsx("span", { className: "button__right", children: renderIcon(rightIcon) })] }));
|
|
264
277
|
};
|
|
265
278
|
/* href 가 있고 비활성이 아니면 링크로 렌더한다. */
|
|
266
279
|
const isLink = !!href && !disabledProp;
|
|
@@ -43,6 +43,9 @@ const TrainingWordCard = forwardRef(function TrainingWordCard({ item, disabled =
|
|
|
43
43
|
const audioRef = useRef(null);
|
|
44
44
|
const isMobile = useMediaQuery('(max-width: 767px)');
|
|
45
45
|
const [playing, setPlaying] = useState(false);
|
|
46
|
+
/* **받아 오는 중** — 합성 폴백을 기다리는 동안이다(말귀 청 (330), 2026-10-28).
|
|
47
|
+
전에는 이 동안 단추가 그냥 '재생' 이라, 누른 사람이 제 손이 닿았는지를 알 수 없었다. */
|
|
48
|
+
const [waiting, setWaiting] = useState(false);
|
|
46
49
|
/* 준비한 URL 은 **어느 낱말의 것인지와 함께** 둔다. 카드는 번호 key 로 재사용되는데(TrainingStepCard),
|
|
47
50
|
전에는 낱말이 바뀌어도 URL 을 비우지 않아 새 낱말의 리졸버가 기다리는 동안·실패했을 때 누르면
|
|
48
51
|
**이전 낱말 소리**가 났다 — 변별 훈련에서 틀린 자극이다. 지금 낱말의 것이 아니면 없는 것으로 본다. */
|
|
@@ -197,11 +200,17 @@ const TrainingWordCard = forwardRef(function TrainingWordCard({ item, disabled =
|
|
|
197
200
|
const fallbackResolver = getTTSFallbackUrlResolver();
|
|
198
201
|
if (fallbackResolver && label) {
|
|
199
202
|
try {
|
|
203
|
+
/* 합성은 그 자리에서 만든다 — 실측 처음 3.5초. 그동안 단추가 도는 표시를 든다
|
|
204
|
+
(청 (330)). 끄는 자리가 **소리가 나기 시작할 때**인 것이 중요하다 — 아래
|
|
205
|
+
`finally` 는 `playUrl` 이 **끝날 때** 도는 자리라, 거기서만 끄면 듣는 내내 돈다. */
|
|
206
|
+
setWaiting(true);
|
|
200
207
|
const url = await Promise.resolve(fallbackResolver(label));
|
|
201
208
|
/* 기다리는 사이 떠났거나 **소리 자리를 남에게 넘겼으면**(다른 카드를 눌렀거나 같은 카드를 다시 눌렀으면) 끝낸다 —
|
|
202
|
-
늦게 온 합성 주소로 틀어 두 소리가 겹쳤고, 같은 카드를 두 번 누르면 두 번 울려 onPlayDone 도 두 번 나갔다.
|
|
209
|
+
늦게 온 합성 주소로 틀어 두 소리가 겹쳤고, 같은 카드를 두 번 누르면 두 번 울려 onPlayDone 도 두 번 나갔다.
|
|
210
|
+
이때 도는 표시를 끄지 않는 것도 같은 까닭이다 — **다음 누름이 그것을 쥐고 있다.** */
|
|
203
211
|
if (!mountedRef.current || heldSoundRef.current !== stop)
|
|
204
212
|
return;
|
|
213
|
+
setWaiting(false);
|
|
205
214
|
if (url) {
|
|
206
215
|
setPlaying(true);
|
|
207
216
|
if (await playUrl(url))
|
|
@@ -215,6 +224,9 @@ const TrainingWordCard = forwardRef(function TrainingWordCard({ item, disabled =
|
|
|
215
224
|
await playSpeechSynthesis();
|
|
216
225
|
}
|
|
217
226
|
finally {
|
|
227
|
+
/* 남이 가져갔으면 그 사람의 기다림이다 — 내가 끄면 그쪽 도는 표시가 사라진다 */
|
|
228
|
+
if (heldSoundRef.current === stop)
|
|
229
|
+
setWaiting(false);
|
|
218
230
|
release(); // 다음 사람이 이미 가져갔으면 아무 일도 안 한다
|
|
219
231
|
if (heldSoundRef.current === stop)
|
|
220
232
|
heldSoundRef.current = null;
|
|
@@ -261,6 +273,6 @@ const TrainingWordCard = forwardRef(function TrainingWordCard({ item, disabled =
|
|
|
261
273
|
onSelect?.();
|
|
262
274
|
}
|
|
263
275
|
}
|
|
264
|
-
: undefined, children: _jsxs("div", { className: "training-word-card__flipper", style: { transitionDelay: showBack ? '0ms' : `${flipDelay}ms` }, children: [_jsxs("div", { className: "training-word-card__front", children: [selected && (_jsx("div", { className: "training-word-card__selected-badge", onClick: handleStopProp, children: _jsx(Badge, { type: "dot", size: 40, position: "inline", animate: true, icon: orderRank != null ? undefined : 'check', number: orderRank ?? undefined, "aria-label": orderRank != null ? t('training.nthSelected', { n: orderRank }) : t('training.selected', '선택됨') }) })), _jsx("div", { className: "training-word-card__image-wrap", children: textCard ? (_jsx("div", { className: "training-word-card__text-face", children: front.label })) : hasImage ? (_jsxs(_Fragment, { children: [imgLoading && _jsx("div", { className: "training-word-card__spinner" }), _jsx("img", { ref: imgRef, className: "training-word-card__image", src: imageUrl, alt: front.label || t('common.image', '이미지'), style: { opacity: imgLoading ? 0 : 1 }, onLoad: handleImgLoad, onError: handleImgError })] })) : (_jsx("div", { className: "training-word-card__placeholder" })) }), !hideLabel && (_jsxs("div", { className: "training-word-card__body", children: [!textCard && _jsx("div", { className: "training-word-card__word", children: front.label }), front.subLabel && (_jsxs("div", { className: "training-word-card__pronunciation", children: ["[", front.subLabel, "]"] })), front.colloquialLabel && (_jsxs("div", { className: "training-word-card__colloquial caption-1", children: ["[", front.colloquialLabel, "]"] }))] })), !hideAudio && (_jsx("div", { className: "training-word-card__bottom", onClick: selectable ? handleStopProp : undefined, children: _jsx(Button, { htmlType: "button", size: isMobile ? 40 : 48, type: isMobile ? 'dot' : 'bar', icon: playing ? 'pause' : 'play', label: isMobile ? undefined : t('training.playSound', '소리 듣기'), selected: playing, onClick: handlePlay, disabled: disabled, ariaLabel: t('training.playSound', '소리 듣기') }) }))] }), _jsx("div", { className: "training-word-card__back", "aria-hidden": "true", children: _jsx("span", { className: "training-word-card__disabled-symbol", style: { ['--disabled-symbol-src']: `url("${symbolSrc}")` } }) })] }) }));
|
|
276
|
+
: undefined, children: _jsxs("div", { className: "training-word-card__flipper", style: { transitionDelay: showBack ? '0ms' : `${flipDelay}ms` }, children: [_jsxs("div", { className: "training-word-card__front", children: [selected && (_jsx("div", { className: "training-word-card__selected-badge", onClick: handleStopProp, children: _jsx(Badge, { type: "dot", size: 40, position: "inline", animate: true, icon: orderRank != null ? undefined : 'check', number: orderRank ?? undefined, "aria-label": orderRank != null ? t('training.nthSelected', { n: orderRank }) : t('training.selected', '선택됨') }) })), _jsx("div", { className: "training-word-card__image-wrap", children: textCard ? (_jsx("div", { className: "training-word-card__text-face", children: front.label })) : hasImage ? (_jsxs(_Fragment, { children: [imgLoading && _jsx("div", { className: "training-word-card__spinner" }), _jsx("img", { ref: imgRef, className: "training-word-card__image", src: imageUrl, alt: front.label || t('common.image', '이미지'), style: { opacity: imgLoading ? 0 : 1 }, onLoad: handleImgLoad, onError: handleImgError })] })) : (_jsx("div", { className: "training-word-card__placeholder" })) }), !hideLabel && (_jsxs("div", { className: "training-word-card__body", children: [!textCard && _jsx("div", { className: "training-word-card__word", children: front.label }), front.subLabel && (_jsxs("div", { className: "training-word-card__pronunciation", children: ["[", front.subLabel, "]"] })), front.colloquialLabel && (_jsxs("div", { className: "training-word-card__colloquial caption-1", children: ["[", front.colloquialLabel, "]"] }))] })), !hideAudio && (_jsx("div", { className: "training-word-card__bottom", onClick: selectable ? handleStopProp : undefined, children: _jsx(Button, { htmlType: "button", size: isMobile ? 40 : 48, type: isMobile ? 'dot' : 'bar', icon: playing ? 'pause' : 'play', label: isMobile ? undefined : t('training.playSound', '소리 듣기'), selected: playing, loading: waiting, onClick: handlePlay, disabled: disabled, ariaLabel: t('training.playSound', '소리 듣기') }) }))] }), _jsx("div", { className: "training-word-card__back", "aria-hidden": "true", children: _jsx("span", { className: "training-word-card__disabled-symbol", style: { ['--disabled-symbol-src']: `url("${symbolSrc}")` } }) })] }) }));
|
|
265
277
|
});
|
|
266
278
|
export default TrainingWordCard;
|
|
@@ -149,13 +149,6 @@
|
|
|
149
149
|
border-top: 1px solid var(--color-darkWhite);
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
/* 결과 하단 페이지네이션 — 상단 툴바와 별개로 목록 아래에도 노출(긴 목록 편의) */
|
|
153
|
-
.word-search-result-block__pagination-bottom {
|
|
154
|
-
display: flex;
|
|
155
|
-
justify-content: center;
|
|
156
|
-
margin-top: 16px;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
152
|
/* 결과 없음 아래 한 줄 — 왜 없는지 설명한다. 본문보다 옅게 두되, 읽히지 않을 만큼
|
|
160
153
|
옅으면 안 된다(--color-sub 는 tokens.css 에 정의돼 있다). */
|
|
161
154
|
.word-search-result-block__empty-wrap {
|
|
@@ -208,5 +208,5 @@ export default function WordSearchResultBlock({ titleIcon, resultCount, resultUn
|
|
|
208
208
|
}, onMouseLeave: handleHoverLeave, children: _jsx(Button, { htmlType: "button", size: "word", align: "grid", label: (item.words ?? []).map(w => w.label), subLabel: (item.words ?? []).some(w => w.subLabel)
|
|
209
209
|
? (item.words ?? []).map(w => w.subLabel)
|
|
210
210
|
: undefined, selected: isSelected, onClick: () => handleClick(item.id), minWidth: 200 }) }, item.id));
|
|
211
|
-
}) })), hoverWords && hoverAnchorRect && (_jsx(WordImageTooltip, { words: hoverWords, anchorRect: hoverAnchorRect }))] }),
|
|
211
|
+
}) })), hoverWords && hoverAnchorRect && (_jsx(WordImageTooltip, { words: hoverWords, anchorRect: hoverAnchorRect }))] }), (onClearSelection || onPrint) && (_jsxs("div", { className: "word-search-result-block__actions", children: [onClearSelection && (_jsx(Button, { htmlType: "button", size: "56", type: "bar", label: t('common.resetSelection', '선택 초기화'), selected: false, disabled: selected.length === 0, onClick: selected.length === 0 ? undefined : onClearSelection })), onPrint && (_jsx("div", { onClick: selected.length === 0 ? onPrintEmpty : undefined, children: _jsx(Button, { htmlType: "button", size: "56", type: "bar", variant: "main", label: t('wordTable.title', '단어 표 만들기'), disabled: selected.length === 0, onClick: selected.length === 0 ? undefined : onPrint }) }))] }))] }));
|
|
212
212
|
}
|
|
@@ -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, 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, 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;
|
|
@@ -10,7 +10,6 @@ import TextField from '../TextField';
|
|
|
10
10
|
import Panel, { PanelRow } from '../Panel';
|
|
11
11
|
import Popup from '../Popup/Popup';
|
|
12
12
|
import WordTable, { WORD_TABLE_PAPER } from '../WordTable';
|
|
13
|
-
import { chunkItems } from '../wordTableLayout';
|
|
14
13
|
import TableFilterPanel from './TableFilterPanel';
|
|
15
14
|
import { buildItemsPerPageSection, buildPageNumberSection, parsePageNumberPosition, itemsPerPageFromChoice } from './wordTableSettings';
|
|
16
15
|
import Toast from '../Toast';
|
|
@@ -45,7 +44,7 @@ function withUniqueIds(list) {
|
|
|
45
44
|
return id === it.id ? it : { ...it, id };
|
|
46
45
|
});
|
|
47
46
|
}
|
|
48
|
-
export default function WordTableBlock({ title, titleIcon, disc, filterTitle, filterCollapsible, filterDefaultCollapsed, filterCollapsed, onFilterCollapsedChange, filterHeaderSummary, brand, code, baseItem, baseContentTypes, 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, 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 }) {
|
|
49
48
|
const { t } = useTranslation();
|
|
50
49
|
const resolvedResetLabel = resetLabel ?? t('wordPrint.clearAllSelection', '모두 선택 해제');
|
|
51
50
|
const isEditable = items === undefined;
|
|
@@ -107,8 +106,8 @@ export default function WordTableBlock({ title, titleIcon, disc, filterTitle, fi
|
|
|
107
106
|
const handleCloseWordSearch = useCallback(() => setActiveCell(null), [setActiveCell]);
|
|
108
107
|
/* onAddItem 의 "추가하기" 는 빈 칸에 선다 — 표시 모드에서 빈 칸은 showCellCount 로 칸 수를 늘릴 때만 생긴다.
|
|
109
108
|
둘을 함께 주지 않으면 아무것도 안 떠서 조용히 헛돈다. */
|
|
110
|
-
if (onAddItem && !isEditable && !showCellCount) {
|
|
111
|
-
devWarnOnce('word-table-block-add-without-cell-count', '[WordTableBlock] 표시 모드에서 onAddItem 은 showCellCount 와 함께 줘야 "추가하기" 칸이 생긴다.');
|
|
109
|
+
if (onAddItem && !isEditable && !showCellCount && !cellCapacity) {
|
|
110
|
+
devWarnOnce('word-table-block-add-without-cell-count', '[WordTableBlock] 표시 모드에서 onAddItem 은 cellCapacity 나 showCellCount 와 함께 줘야 "추가하기" 칸이 생긴다.');
|
|
112
111
|
}
|
|
113
112
|
/* 머리 칸은 표시 모드에서만 선다 — 편집 격자에 주면 아무 데서도 안 터지고 **그냥 안 보인다** */
|
|
114
113
|
if (baseItem && isEditable) {
|
|
@@ -119,20 +118,31 @@ export default function WordTableBlock({ title, titleIcon, disc, filterTitle, fi
|
|
|
119
118
|
담았다 3개로 줄여도 8칸이 남았다. 처음 값은 처음 항목 수 — 고르기 전에 하나를 빼도 표가 한 칸 줄어 흔들리지 않게. */
|
|
120
119
|
const [chosenCellCount, setChosenCellCount] = useState(() => Math.max(items?.length ?? 1, 1));
|
|
121
120
|
// 레이아웃 칸 수
|
|
121
|
+
/* **채울 수 있는 칸 수** — 항목보다 많으면 그 차이가 빈 칸이 된다(`cellCapacity`, 청 (327)).
|
|
122
|
+
담긴 것을 가릴 수는 없으니 항목 수가 바닥이다. */
|
|
123
|
+
const capacity = Math.max(cellCapacity ?? 0, items?.length ?? 0, 1);
|
|
122
124
|
const count = isEditable
|
|
123
125
|
? cellCount
|
|
124
126
|
: showCellCount
|
|
125
127
|
? Math.max(chosenCellCount, items?.length ?? 1, 1)
|
|
126
|
-
:
|
|
128
|
+
: capacity;
|
|
127
129
|
const { width, height } = WORD_TABLE_PAPER[orientation];
|
|
128
130
|
// 페이지 분할 — 편집/칸수조절(showCellCount) 모드에서는 적용하지 않고, 완성된 표시 모드에서만 적용
|
|
129
131
|
const pagesEnabled = !isEditable && !showCellCount;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
/* '페이지당 개수' 첫 옵션은 늘 **자리 수**(= 한 쪽에 전부), 나머지는 그보다 작은 표준 분할값.
|
|
133
|
+
기본/저장된 설정(8)이 자리 수보다 크면 전체로 조인다 — 다섯 자리뿐이면 "5개(전부)" 가 기본.
|
|
134
|
+
|
|
135
|
+
**항목 수가 아니라 자리 수로 조인다**(청 (327)). 항목이 하나뿐인 열두 칸짜리 표를
|
|
136
|
+
항목 수로 조이면 한 쪽에 한 칸씩 **열두 쪽**이 된다. `cellCapacity` 를 안 주면
|
|
137
|
+
자리 수 = 항목 수라 지금까지와 같다. */
|
|
138
|
+
const effectiveItemsPerPage = Math.min(itemsPerPageSetting, Math.max(capacity, 1));
|
|
134
139
|
const itemsPerPage = pagesEnabled ? effectiveItemsPerPage : count;
|
|
135
|
-
|
|
140
|
+
/* 쪽은 **항목이 아니라 자리**로 센다 — 빈 칸만 남은 쪽도 서야 '추가하기' 가 닿는다.
|
|
141
|
+
항목이 모자란 쪽은 빈 배열을 받는다. */
|
|
142
|
+
const pageCount = pagesEnabled ? Math.max(1, Math.ceil(capacity / Math.max(1, itemsPerPage))) : 0;
|
|
143
|
+
const pages = pagesEnabled
|
|
144
|
+
? Array.from({ length: pageCount }, (_, i) => (items ?? []).slice(i * itemsPerPage, (i + 1) * itemsPerPage))
|
|
145
|
+
: null;
|
|
136
146
|
const isPaginated = !!pages && pages.length > 1;
|
|
137
147
|
const hasPairs = isEditable
|
|
138
148
|
? visibleCells.some(c => c !== null && c.length > 1)
|
|
@@ -179,13 +189,18 @@ export default function WordTableBlock({ title, titleIcon, disc, filterTitle, fi
|
|
|
179
189
|
/* 물어볼 낱말이 있는지는 **렌더 중에 안다** — 굳이 상태로 들고 있을 것이 아니다.
|
|
180
190
|
이걸 상태로 두면 "없음"으로 되돌리는 일을 효과가 해야 하고, 그러면 낡은 값으로
|
|
181
191
|
한 번 그린 뒤에 고쳐진다. */
|
|
192
|
+
/* **머리 칸도 센다**(말귀 청 (329), 2026-10-28 — 사장님 *"이거 왜 비활성화 되어 있어?
|
|
193
|
+
왼쪽 칸에 이미지 있는데?"*). 활용표는 그림이 머리 칸에만 있다 — 나머지 절반은 사전에
|
|
194
|
+
없는 활용형이라 그림이 없다. `items` 만 세면 전부 헛쳐서 **왼쪽 절반에 그림이 떡하니
|
|
195
|
+
떠 있는데 '이미지' 칩만 회색**이 된다. `baseItem` 은 `items` 와 같은 꼴이라 그대로 잇는다. */
|
|
182
196
|
const imagePairs = useMemo(() => {
|
|
183
197
|
if (!getImageResolver())
|
|
184
198
|
return [];
|
|
199
|
+
const pairsOf = (list) => list.flatMap(item => (item.words ?? []).map(w => [w.label, w.homonum]));
|
|
185
200
|
return isEditable
|
|
186
201
|
? cells.slice(0, cellCount).flatMap(c => (c ?? []).map(e => [e.word, e.homonum]))
|
|
187
|
-
: (
|
|
188
|
-
}, [isEditable, cells, cellCount, items]);
|
|
202
|
+
: pairsOf([...(baseItem ? [baseItem] : []), ...(items ?? [])]);
|
|
203
|
+
}, [isEditable, cells, cellCount, items, baseItem]);
|
|
189
204
|
/* 실제로 파일이 있는지는 물어봐야 안다(HEAD 요청 + 캐시). 그 답만 상태로 든다.
|
|
190
205
|
`imagePairs` 가 비면 물어볼 것도 없으므로 아래 유도에서 곧바로 false 가 된다. */
|
|
191
206
|
const [imageFound, setImageFound] = useState(false);
|
|
@@ -205,11 +220,11 @@ export default function WordTableBlock({ title, titleIcon, disc, filterTitle, fi
|
|
|
205
220
|
const middleSections = useMemo(() => [
|
|
206
221
|
...((isEditable || showCellCount) ? [{ label: t('wordTable.filter.columns', '칸 수'), items: CELL_COUNTS.map(n => ({ value: `${n}칸`, displayLabel: t('wordTable.filter.column', { count: n }) })), display: 'segmented' }] : []),
|
|
207
222
|
// 내용이 있는(1개 이상) 표면 '페이지당 대립쌍/단어 수'를 항상 노출한다(표시 모드 한정).
|
|
208
|
-
...(pagesEnabled && (items?.length ?? 0) > 0 ? [buildItemsPerPageSection(t, { hasPairs, itemCount })] : []),
|
|
223
|
+
...(pagesEnabled && (items?.length ?? 0) > 0 ? [buildItemsPerPageSection(t, { hasPairs, itemCount: capacity })] : []),
|
|
209
224
|
/* 이 블록은 종이 띠를 안 받는다 — 쪽 번호가 설 데가 여기뿐이라 자리 고르개를 그대로 둔다
|
|
210
225
|
(띠를 쓰는 `WordTable` 쪽만 이 절을 걷는다). */
|
|
211
226
|
...(isPaginated ? [buildPageNumberSection(t)] : []),
|
|
212
|
-
], [t, isEditable, showCellCount, pagesEnabled, items?.length, hasPairs,
|
|
227
|
+
], [t, isEditable, showCellCount, pagesEnabled, items?.length, hasPairs, capacity, isPaginated]);
|
|
213
228
|
const middleSelected = {
|
|
214
229
|
...((isEditable || showCellCount) ? { [t('wordTable.filter.columns', '칸 수')]: `${count}칸` } : {}),
|
|
215
230
|
...(pagesEnabled && (items?.length ?? 0) > 0 ? { [t(hasPairs ? 'wordTable.filter.itemsPerPagePair' : 'wordTable.filter.itemsPerPageWord')]: `${effectiveItemsPerPage}개` } : {}),
|
|
@@ -225,7 +240,7 @@ export default function WordTableBlock({ title, titleIcon, disc, filterTitle, fi
|
|
|
225
240
|
setChosenCellCount(parseInt(value));
|
|
226
241
|
}
|
|
227
242
|
else if (sectionLabel === t(hasPairs ? 'wordTable.filter.itemsPerPagePair' : 'wordTable.filter.itemsPerPageWord')) {
|
|
228
|
-
setItemsPerPageSetting(itemsPerPageFromChoice(parseInt(value),
|
|
243
|
+
setItemsPerPageSetting(itemsPerPageFromChoice(parseInt(value), capacity));
|
|
229
244
|
}
|
|
230
245
|
else if (sectionLabel === t('wordTable.filter.pageNumber', '페이지 번호')) {
|
|
231
246
|
setPageNumberPosition(parsePageNumberPosition(value));
|
|
@@ -339,7 +354,14 @@ export default function WordTableBlock({ title, titleIcon, disc, filterTitle, fi
|
|
|
339
354
|
onReorder: onReorder && ((from, to) => onReorder(from + i * itemsPerPage, to + i * itemsPerPage)),
|
|
340
355
|
/* 안쪽 표는 제 쪽 안의 번호를 준다 — 부르는 쪽에는 **표 전체 기준**으로 넘긴다
|
|
341
356
|
(위 `onReorder` 와 같은 셈이다. 쪽이 몇으로 나뉘었는지는 부르는 쪽 일이 아니다). */
|
|
342
|
-
renderCellAction: renderCellAction && ((n, item) => renderCellAction(n + i * itemsPerPage, item)),
|
|
357
|
+
renderCellAction: renderCellAction && ((n, item) => renderCellAction(n + i * itemsPerPage, item)),
|
|
358
|
+
/* **빈 칸과 '추가하기' 는 쪽이 나뉘어도 선다**(청 (327)) — 전에는 한 장짜리 가지에만
|
|
359
|
+
실려 있어 쪽이 둘이 되는 순간 단추가 조용히 사라졌다. 칸 번호는 위 둘과 같은 셈으로
|
|
360
|
+
**표 전체 기준**으로 올린다. */
|
|
361
|
+
showFillerAdd: !!onAddItem, onActivateCell: onAddItem ? (n => setActiveCell(n + i * itemsPerPage)) : undefined,
|
|
362
|
+
/* 칸 크기가 쪽마다 같아야 해서 `count` 는 모든 쪽이 '페이지당 개수' 다 —
|
|
363
|
+
채울 자리는 마지막 쪽에서 모자랄 수 있으니 그것만 따로 센다. */
|
|
364
|
+
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, onReorder: !isEditable ? onReorder : undefined,
|
|
343
365
|
/* 편집 모드에는 얹을 항목이 없다 — 칸을 손으로 채우는 꼴이다 */
|
|
344
366
|
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', '이 단어표에 대한 제목을 입력하세요.'),
|
|
345
367
|
/* PanelRow의 라벨은 시각적으로만 붙어 있고 입력과 연결돼 있지 않아, 낭독기에는
|
|
@@ -76,6 +76,21 @@ export interface WordTableBlockProps {
|
|
|
76
76
|
baseItem?: WordTableProps['baseItem'];
|
|
77
77
|
/** 머리 칸에만 걸리는 보임 — 안 주면 표 설정 판에서 고른 `contentTypes` 를 따른다. */
|
|
78
78
|
baseContentTypes?: WordTableProps['baseContentTypes'];
|
|
79
|
+
/**
|
|
80
|
+
* **이 표가 채울 수 있는 칸 수** — 항목 수보다 크면 그만큼 빈 칸이 생기고,
|
|
81
|
+
* `onAddItem` 이 있으면 그 칸 가운데에 '추가하기' 가 선다.
|
|
82
|
+
*
|
|
83
|
+
* 활용표처럼 **칸 수를 사람이 아니라 낱말이 정하는 표**를 위해 둔다(말귀 청 (327),
|
|
84
|
+
* 2026-10-28). 전에는 빈 칸을 내는 길이 `showCellCount` 뿐이었는데 그것은 값이 비쌌다 —
|
|
85
|
+
* '칸 수' 고르개를 세우고 **쪽 나눔을 통째로 껐다.** 이것은 둘 다 안 한다.
|
|
86
|
+
*
|
|
87
|
+
* 쪽이 나뉘면 빈 칸은 **뒤쪽 쪽에** 선다. 쪽 수는 `올림(cellCapacity / 페이지당 개수)` 이라,
|
|
88
|
+
* 항목이 모자라도 채울 자리가 남아 있으면 그만큼 쪽이 더 선다.
|
|
89
|
+
*
|
|
90
|
+
* 항목 수보다 작으면 무시한다 — 담긴 것을 가릴 수는 없다. `showCellCount` 와 함께 주면
|
|
91
|
+
* 그쪽이 이긴다(사람이 고른 것이 마지막 말이다).
|
|
92
|
+
*/
|
|
93
|
+
cellCapacity?: number;
|
|
79
94
|
disc?: ReactNode;
|
|
80
95
|
/** 현재 표의 저장된 이름(불러온 표 등). 있으면 인쇄/PDF 저장 시 파일명으로 사용, 없으면 "오늘 날짜 + 단어표/대립쌍표" */
|
|
81
96
|
tableName?: string;
|
|
@@ -397,27 +397,36 @@
|
|
|
397
397
|
transition: opacity 0.15s;
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
-
/* **오른쪽
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
400
|
+
/* **오른쪽 기둥**(말귀 청 (331), 2026-10-28) — 빼기 → 부르는 쪽이 얹은 것
|
|
401
|
+
(`renderCellAction`) → 옮기기 손잡이 차례로 **쌓인다.**
|
|
402
|
+
|
|
403
|
+
전에는 이것이 **한 줄**이었고 손잡이는 왼쪽 위에 따로 서서 **재생 단추와 겹쳤다.**
|
|
404
|
+
사장님이 세로를 세 번 이르셔서 앱이 줄 밖으로 하나씩 꺼내 `top: calc(20+40+40+8)` 처럼
|
|
405
|
+
**숫자로 쌓아** 두었는데, 그 숫자가 단어표에 맞춘 것이라 끼어들 단추가 없는 표에서
|
|
406
|
+
구멍이 났다(활용표: ✕ 밑이 48px 비고 손잡이만 홀로 내려가 있었다).
|
|
407
|
+
|
|
408
|
+
**자리를 수로 못 박지 않는다** — 쌓으면 몇 개가 들든 붙어 선다. 틈은 왼쪽 기둥과 같은
|
|
409
|
+
0 이라, 재생과 빼기가 같은 높이에 선다. */
|
|
404
410
|
.word-table-block__card-actions {
|
|
405
411
|
position: absolute;
|
|
406
412
|
top: 20px;
|
|
407
413
|
right: 20px;
|
|
408
414
|
z-index: 1;
|
|
409
415
|
display: flex;
|
|
410
|
-
|
|
411
|
-
|
|
416
|
+
flex-direction: column;
|
|
417
|
+
align-items: flex-end;
|
|
418
|
+
gap: 0;
|
|
412
419
|
opacity: 0;
|
|
413
420
|
transition: opacity 0.15s;
|
|
414
421
|
}
|
|
415
|
-
/*
|
|
416
|
-
혼자 서므로 위 규칙이 그대로 산다. */
|
|
417
|
-
.word-table-block__card-actions .word-table-block__card-close
|
|
422
|
+
/* 기둥 안에 들면 제 자리를 안 잡는다 — 기둥이 잡아 준다. 편집 모드(`cells`)의 빼기는
|
|
423
|
+
기둥 없이 혼자 서므로 위 규칙이 그대로 산다. */
|
|
424
|
+
.word-table-block__card-actions .word-table-block__card-close,
|
|
425
|
+
.word-table-block__card-actions .word-table-block__card-handle {
|
|
418
426
|
position: static;
|
|
419
427
|
top: auto;
|
|
420
428
|
right: auto;
|
|
429
|
+
left: auto;
|
|
421
430
|
opacity: 1;
|
|
422
431
|
}
|
|
423
432
|
|
|
@@ -555,26 +564,48 @@
|
|
|
555
564
|
font-weight: var(--wt-cell-sub-weight, var(--text-h3-weight));
|
|
556
565
|
}
|
|
557
566
|
|
|
558
|
-
/*
|
|
559
|
-
|
|
560
|
-
|
|
567
|
+
/* **낱말 위 이름표** — 활용표의 `[양보] -아/어도` 가 서는 자리(청 (328), 2026-10-28).
|
|
568
|
+
배지와 꼬리가 한 줄이다. 가운뎃점은 안 쓴다 — 배지가 이미 경계다.
|
|
569
|
+
낱말 **위**인 까닭은 이것이 *이 칸이 무슨 꼴인가* 를 말하는 **머리말**이어서다. 아래에
|
|
570
|
+
두면 발음과 나란히 서서 둘 다 낱말에 딸린 설명처럼 읽힌다. */
|
|
561
571
|
.word-table-cell__caption {
|
|
562
|
-
|
|
572
|
+
display: flex;
|
|
573
|
+
align-items: center;
|
|
574
|
+
justify-content: center;
|
|
575
|
+
gap: var(--spacing-xs);
|
|
563
576
|
text-align: center;
|
|
564
577
|
white-space: nowrap;
|
|
565
578
|
}
|
|
566
579
|
|
|
580
|
+
/* 꼬리(`captionLabel`) — 사장님이 `--color-lightGray` 를 이르셨다(2026-10-28).
|
|
581
|
+
배지가 무게를 들고 있으니 꼬리는 물러선다. */
|
|
582
|
+
.word-table-cell__caption-tail {
|
|
583
|
+
color: var(--color-lightGray);
|
|
584
|
+
}
|
|
585
|
+
|
|
567
586
|
.word-table-cell__colloquial {
|
|
568
587
|
color: var(--color-lightGray);
|
|
569
588
|
text-align: center;
|
|
570
589
|
white-space: nowrap;
|
|
571
590
|
}
|
|
572
591
|
|
|
573
|
-
|
|
592
|
+
/* **왼쪽 기둥**(말귀 청 (331), 2026-10-28) — 재생 → 정보 차례로 쌓인다.
|
|
593
|
+
전에는 둘이 저마다 `top: 20px` · `top: 60px` 으로 **자리를 수로 못 박아** 섰다. 하나가
|
|
594
|
+
없으면 빈자리가 남고, 끼어들 것이 생기면 수를 다시 세야 한다. 틈은 0 이다 — 단추가
|
|
595
|
+
40px 이라 20·60 이던 옛 자리와 **같은 자리**에 선다. 오른쪽 기둥도 같은 틈이라,
|
|
596
|
+
재생과 빼기 · 정보와 그 아래 것이 서로 같은 높이에 선다(사장님 2026-10-12). */
|
|
597
|
+
.word-table-cell__side {
|
|
574
598
|
position: absolute;
|
|
575
599
|
top: 20px;
|
|
576
600
|
left: 20px;
|
|
577
601
|
z-index: 1;
|
|
602
|
+
display: flex;
|
|
603
|
+
flex-direction: column;
|
|
604
|
+
align-items: flex-start;
|
|
605
|
+
gap: 0;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
.word-table-cell__play-button {
|
|
578
609
|
opacity: 0;
|
|
579
610
|
transition: opacity 0.15s;
|
|
580
611
|
}
|
|
@@ -588,10 +619,6 @@
|
|
|
588
619
|
}
|
|
589
620
|
|
|
590
621
|
.word-table-cell__info-button {
|
|
591
|
-
position: absolute;
|
|
592
|
-
top: 60px;
|
|
593
|
-
left: 20px;
|
|
594
|
-
z-index: 1;
|
|
595
622
|
opacity: 0;
|
|
596
623
|
transition: opacity 0.15s;
|
|
597
624
|
}
|
|
@@ -52,6 +52,15 @@ export interface WordTableProps {
|
|
|
52
52
|
onReorder?: (fromIndex: number, toIndex: number) => void;
|
|
53
53
|
/** 표시 모드에서 `count` 안의 빈칸(항목 수 뒤 ~ count)에 '추가' 버튼 노출. count 가 항목 수와 같으면 그런 칸이 없다. `onActivateCell` 필요. */
|
|
54
54
|
showFillerAdd?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* '추가하기' 가 설 수 있는 칸 수 — 안 주면 `count` 를 따른다.
|
|
57
|
+
*
|
|
58
|
+
* 쪽이 나뉜 표의 **마지막 쪽**을 위해 둔다(말귀 청 (327), 2026-10-28). 쪽마다 칸 크기가
|
|
59
|
+
* 같아야 해서 `count` 는 모든 쪽이 '페이지당 개수' 로 같은데, 채울 자리는 마지막 쪽에서
|
|
60
|
+
* 모자랄 수 있다(자리 12 · 쪽당 8 → 둘째 쪽은 네 자리뿐). `count` 로 세면 **없는 자리에도
|
|
61
|
+
* 단추가 선다.**
|
|
62
|
+
*/
|
|
63
|
+
addableCount?: number;
|
|
55
64
|
/**
|
|
56
65
|
* **칸 오른쪽 위에 부르는 쪽이 얹는 것** — 칸 번호와 그 칸의 항목을 준다. 안 주면 아무것도 안 얹는다.
|
|
57
66
|
*
|
|
@@ -202,4 +211,4 @@ export interface WordTableProps {
|
|
|
202
211
|
* 표시(items)·편집(editCells) 두 모드를 지원한다.
|
|
203
212
|
* @public
|
|
204
213
|
*/
|
|
205
|
-
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, contentRef, buttonSize, brand, code, pageNumber, pageNumberPosition, fitHeight, scoring, marks, onMarkClick, scoreIndexOffset, }: WordTableProps): import("react").JSX.Element;
|
|
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;
|