|
65 | 65 | let freq = $state(''); |
66 | 66 | let busy = $state(''); |
67 | 67 | let copiedKey = $state(''); |
| 68 | + let showCols = $state(false); // 컬럼 칩은 기본 접힘(전체) — [고르기]로만 펼침(단순성) |
| 69 | +
|
| 70 | + function changeDir(dirStr: string) { |
| 71 | + selectDir(dirStr); |
| 72 | + if (id.trim()) probe(); // 데이터셋 바꾸면 같은 ID 로 자동 조회(편의성) |
| 73 | + } |
| 74 | + function idBlur() { |
| 75 | + if (id.trim() && dir && probedKey !== `${dir.dir}/${id.trim()}`) probe(); |
| 76 | + } |
68 | 77 |
|
69 | 78 | const cleanName = (s: string) => s.replace(/[\\/:*?"<>|]+/g, '_').slice(0, 80); |
70 | 79 |
|
|
269 | 278 | <div class="ctl"> |
270 | 279 | <label class="fld grow"> |
271 | 280 | <span class="fld-label">데이터</span> |
272 | | - <select value={dir?.dir ?? ''} onchange={(e) => selectDir(e.currentTarget.value)}> |
| 281 | + <select value={dir?.dir ?? ''} onchange={(e) => changeDir(e.currentTarget.value)} aria-label="데이터셋 선택"> |
273 | 282 | {#each grouped as g (g.name)} |
274 | 283 | <optgroup label={g.name}> |
275 | 284 | {#each g.items as e (e.dir)}<option value={e.dir}>{e.label}</option>{/each} |
|
279 | 288 | </label> |
280 | 289 | <label class="fld"> |
281 | 290 | <span class="fld-label">{dir?.shardKind === 'company' ? '종목' : '항목'}</span> |
282 | | - <input class="id-input" placeholder={dir ? ID_HINT[dir.shardKind] : ''} bind:value={id} onkeydown={(ev) => ev.key === 'Enter' && probe()} /> |
| 291 | + <input class="id-input" placeholder={dir ? ID_HINT[dir.shardKind] : ''} bind:value={id} aria-label="종목·항목 ID" onkeydown={(ev) => ev.key === 'Enter' && probe()} onblur={idBlur} /> |
283 | 292 | </label> |
284 | 293 | <button class="btn" onclick={probe} disabled={!id.trim() || probing}>{probing ? '조회 중…' : '조회'}</button> |
285 | 294 | {#if dir} |
|
290 | 299 | {#if probeErr}<p class="err">{probeErr}</p>{/if} |
291 | 300 |
|
292 | 301 | {#if probed && allCols.length} |
293 | | - <!-- 컬럼 --> |
| 302 | + <!-- 컬럼 (기본 접힘 = 전체) --> |
294 | 303 | <div class="optline"> |
295 | 304 | <span class="opt-label">컬럼</span> |
296 | | - <div class="cols"> |
297 | | - {#each allCols as c (c)} |
298 | | - <label class="chip" class:on={pickedCols.has(c)}> |
299 | | - <input type="checkbox" checked={pickedCols.has(c)} onchange={() => toggleCol(c)} />{c} |
300 | | - </label> |
301 | | - {/each} |
| 305 | + <div class="colwrap"> |
| 306 | + <button class="link-btn" onclick={() => (showCols = !showCols)} aria-expanded={showCols}> |
| 307 | + {cols.length === 0 || cols.length === allCols.length ? `전체 ${allCols.length}열` : `${cols.length} / ${allCols.length}열 선택`} |
| 308 | + <span class="caret">{showCols ? '▾' : '▸'}</span> |
| 309 | + </button> |
| 310 | + {#if showCols} |
| 311 | + <div class="cols"> |
| 312 | + {#each allCols as c (c)} |
| 313 | + <label class="chip" class:on={pickedCols.has(c)}> |
| 314 | + <input type="checkbox" checked={pickedCols.has(c)} onchange={() => toggleCol(c)} />{c} |
| 315 | + </label> |
| 316 | + {/each} |
| 317 | + </div> |
| 318 | + {/if} |
302 | 319 | </div> |
303 | 320 | </div> |
304 | 321 | <!-- 범위 --> |
|
515 | 532 | gap: var(--dl-s-2); |
516 | 533 | align-items: center; |
517 | 534 | } |
| 535 | + .colwrap { |
| 536 | + flex: 1; |
| 537 | + display: flex; |
| 538 | + flex-direction: column; |
| 539 | + gap: var(--dl-s-2); |
| 540 | + align-items: flex-start; |
| 541 | + } |
| 542 | + .link-btn { |
| 543 | + padding: 0.1rem 0; |
| 544 | + background: none; |
| 545 | + border: 0; |
| 546 | + color: var(--dl-ink); |
| 547 | + font-size: 0.85rem; |
| 548 | + font-family: inherit; |
| 549 | + cursor: pointer; |
| 550 | + } |
| 551 | + .link-btn:hover { |
| 552 | + color: var(--dl-accent); |
| 553 | + } |
| 554 | + .caret { |
| 555 | + color: var(--dl-accent); |
| 556 | + font-size: 0.7rem; |
| 557 | + } |
518 | 558 | .range { |
519 | 559 | row-gap: var(--dl-s-1); |
520 | 560 | } |
|
671 | 711 | font-family: var(--dl-font-mono); |
672 | 712 | font-size: 0.86em; |
673 | 713 | } |
| 714 | +
|
| 715 | + /* 접근성 — 키보드 포커스 링 */ |
| 716 | + .btn:focus-visible, |
| 717 | + .chip-ex:focus-visible, |
| 718 | + .link-btn:focus-visible, |
| 719 | + select:focus-visible, |
| 720 | + .id-input:focus-visible, |
| 721 | + .num:focus-visible, |
| 722 | + .chip:focus-within, |
| 723 | + .radio:focus-within, |
| 724 | + summary:focus-visible { |
| 725 | + outline: 2px solid var(--dl-focus); |
| 726 | + outline-offset: 2px; |
| 727 | + border-radius: var(--dl-r-sm); |
| 728 | + } |
674 | 729 | </style> |
0 commit comments