@@ -13,6 +13,9 @@ import {
|
||||
|
||||
import { type SelectedOgnzUser, toSelectedOgnzUser } from "../model/selected-ognz-user";
|
||||
|
||||
const FOCUS_RING_CLASS_NAME =
|
||||
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring";
|
||||
|
||||
interface OgnzUserTreeNodeProps {
|
||||
node: OgnzUserTreeResponseDto;
|
||||
depth?: number;
|
||||
@@ -56,7 +59,10 @@ function OgnzUserTreeNode({
|
||||
<CollapsibleTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
className="group flex w-full items-center gap-2 rounded-sm p-2 text-left hover:bg-accent"
|
||||
className={cn(
|
||||
"group flex w-full items-center gap-2 rounded-sm p-2 text-left hover:bg-accent",
|
||||
FOCUS_RING_CLASS_NAME,
|
||||
)}
|
||||
>
|
||||
<ChevronRight
|
||||
className={cn(
|
||||
@@ -73,31 +79,51 @@ function OgnzUserTreeNode({
|
||||
{node.users.map((user) => {
|
||||
const isSelected = selectedUserId === user.userUnqId;
|
||||
const selectedUser = toSelectedOgnzUser(user, node);
|
||||
const rowClassName = cn(
|
||||
"group flex w-full cursor-pointer items-center gap-2 rounded-sm p-2 text-left hover:bg-accent",
|
||||
isSelected && "!border !border-primary !bg-primary-transparent",
|
||||
);
|
||||
const userLabel = (
|
||||
<>
|
||||
<span className="text-[1.4rem] text-label">{user.userNm}</span>
|
||||
<span className="text-xl text-muted-foreground">({user.jbpsSeNm})</span>
|
||||
</>
|
||||
);
|
||||
|
||||
// 선택 버튼이 없으면 행 자체를 버튼으로 렌더링해 키보드(Tab/Enter/Space)로 선택 가능하게 한다.
|
||||
if (!showSelectButton) {
|
||||
return (
|
||||
<button
|
||||
key={user.userUnqId}
|
||||
type="button"
|
||||
style={{ paddingInlineStart: indent + 24 }}
|
||||
className={cn(rowClassName, FOCUS_RING_CLASS_NAME)}
|
||||
aria-pressed={isSelected}
|
||||
onClick={() => onSelect(selectedUser)}
|
||||
>
|
||||
{userLabel}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
key={user.userUnqId}
|
||||
style={{ paddingInlineStart: indent + 24 }}
|
||||
className={cn(
|
||||
"group flex cursor-pointer items-center gap-2 rounded-sm p-2 hover:bg-accent",
|
||||
isSelected && "!border !border-primary !bg-primary-transparent",
|
||||
)}
|
||||
className={rowClassName}
|
||||
onClick={() => onSelect(selectedUser)}
|
||||
>
|
||||
<span className="text-[1.4rem] text-label">{user.userNm}</span>
|
||||
<span className="text-xl text-muted-foreground">({user.jbpsSeNm})</span>
|
||||
{showSelectButton ? (
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onSelect(selectedUser);
|
||||
}}
|
||||
>
|
||||
선택
|
||||
</Button>
|
||||
) : null}
|
||||
{userLabel}
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onSelect(selectedUser);
|
||||
}}
|
||||
>
|
||||
선택
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -115,7 +115,9 @@ function PbadmsTaskApplyDialog({
|
||||
<TableHeader>
|
||||
{canSidoGugunSelectable && (
|
||||
<TableRow>
|
||||
<TableHead scope="row" data-required>시도</TableHead>
|
||||
<TableHead scope="row" data-required>
|
||||
<label htmlFor="pbadms-task-apply-sido">시도</label>
|
||||
</TableHead>
|
||||
<TableCell>
|
||||
<Select
|
||||
value={sidoComCd || undefined}
|
||||
@@ -124,7 +126,12 @@ function PbadmsTaskApplyDialog({
|
||||
setSggComCd("");
|
||||
}}
|
||||
>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectTrigger
|
||||
id="pbadms-task-apply-sido"
|
||||
title="시도 선택"
|
||||
aria-required="true"
|
||||
className="w-full"
|
||||
>
|
||||
<SelectValue placeholder="선택" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
@@ -136,14 +143,16 @@ function PbadmsTaskApplyDialog({
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</TableCell>
|
||||
<TableHead scope="row">시군구</TableHead>
|
||||
<TableHead scope="row">
|
||||
<label htmlFor="pbadms-task-apply-sgg">시군구</label>
|
||||
</TableHead>
|
||||
<TableCell>
|
||||
<Select
|
||||
value={sggComCd || undefined}
|
||||
onValueChange={setSggComCd}
|
||||
disabled={!sidoComCd || isUserGugunPending}
|
||||
>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectTrigger id="pbadms-task-apply-sgg" title="시군구 선택" className="w-full">
|
||||
<SelectValue placeholder="선택" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
@@ -158,9 +167,12 @@ function PbadmsTaskApplyDialog({
|
||||
</TableRow>
|
||||
)}
|
||||
<TableRow>
|
||||
<TableHead scope="row" data-required>업무구분</TableHead>
|
||||
<TableHead id="pbadms-task-apply-task-label" scope="row" data-required>
|
||||
업무구분
|
||||
</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<FieldSet className="px-2">
|
||||
{/* 체크박스 그룹이 어떤 항목의 선택인지 알 수 있도록 th 와 연결 */}
|
||||
<FieldSet className="px-2" aria-labelledby="pbadms-task-apply-task-label">
|
||||
<FieldGroup data-slot="checkbox-group" className="flex-row flex-wrap">
|
||||
{taskOptions?.map((option) => (
|
||||
<Field key={option.lwpoCd} orientation="horizontal" className="w-auto">
|
||||
|
||||
Reference in New Issue
Block a user