251216_01_ENH : 프로젝트에 FW User 배정 구현 및 테스트 완료
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import * as React from 'react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { MultiSelect } from '@/components/ui/multi-select'
|
||||
import {MultiSelect, MultiSelectRef} from '@/components/ui/multi-select'
|
||||
import type { MultiSelectOption } from '@/components/ui/multi-select'
|
||||
|
||||
type BaseProps<T> = {
|
||||
@@ -14,6 +14,8 @@ type BaseProps<T> = {
|
||||
placeholder?: string
|
||||
widthClassName?: string
|
||||
heightClassName?: string
|
||||
spanClassName?: string
|
||||
badgeClassName?: string
|
||||
className?: string
|
||||
getValue?: (item: T) => string
|
||||
getLabel?: (item: T) => string
|
||||
@@ -48,6 +50,8 @@ export function KriMultiSelect<T = unknown>({
|
||||
placeholder = 'Select options',
|
||||
widthClassName,
|
||||
heightClassName,
|
||||
spanClassName = "content-text-lg",
|
||||
badgeClassName = "content-text-lg",
|
||||
className,
|
||||
getValue,
|
||||
getLabel,
|
||||
@@ -55,6 +59,8 @@ export function KriMultiSelect<T = unknown>({
|
||||
onItemsChange,
|
||||
onOptionsChange,
|
||||
}: KriMultiSelectProps<T>) {
|
||||
const msRef = React.useRef<MultiSelectRef>(null);
|
||||
|
||||
const extractValue = React.useCallback(
|
||||
(item: T) => (getValue ? getValue(item) : String(item)),
|
||||
[getValue]
|
||||
@@ -75,6 +81,7 @@ export function KriMultiSelect<T = unknown>({
|
||||
return (
|
||||
<div className={cn(widthClassName, heightClassName, "flex-none overflow-hidden")}>
|
||||
<MultiSelect<T>
|
||||
ref={msRef}
|
||||
options={options}
|
||||
defaultValue={value}
|
||||
onValueChange={onChange}
|
||||
@@ -83,6 +90,8 @@ export function KriMultiSelect<T = unknown>({
|
||||
maxSelected={maxSelected}
|
||||
placeholder={placeholder}
|
||||
className={cn("bg-white content-text-lg", className)}
|
||||
spanClassName={spanClassName}
|
||||
badgeClassName={badgeClassName}
|
||||
searchable={searchable}
|
||||
searchMode={searchMode}
|
||||
defaultSearchValue={defaultSearchValue}
|
||||
@@ -105,6 +114,12 @@ type KriSingleSelectProps<T = unknown> = BaseProps<T> & {
|
||||
onOptionChange?: (option: MultiSelectOption<T> | null) => void
|
||||
preventDeselect?: boolean;
|
||||
hideOptionCheck?: boolean;
|
||||
|
||||
useClear?: boolean
|
||||
clearLabel?: string
|
||||
clearValue?: string
|
||||
|
||||
showSelectedTooltip?: boolean
|
||||
}
|
||||
|
||||
export function KriSingleSelect<T = unknown>({
|
||||
@@ -118,6 +133,8 @@ export function KriSingleSelect<T = unknown>({
|
||||
placeholder = 'Select an option',
|
||||
heightClassName,
|
||||
widthClassName,
|
||||
spanClassName = "content-text-lg",
|
||||
badgeClassName = "content-text-lg",
|
||||
className,
|
||||
getValue,
|
||||
getLabel,
|
||||
@@ -126,7 +143,13 @@ export function KriSingleSelect<T = unknown>({
|
||||
onOptionChange,
|
||||
preventDeselect = false,
|
||||
hideOptionCheck = false,
|
||||
showSelectedTooltip = false,
|
||||
useClear = false,
|
||||
clearLabel = "선택 해제",
|
||||
clearValue = "__CLEAR__",
|
||||
}: KriSingleSelectProps<T>) {
|
||||
const msRef = React.useRef<MultiSelectRef>(null);
|
||||
|
||||
const extractValue = React.useCallback(
|
||||
(item: T) => (getValue ? getValue(item) : String(item)),
|
||||
[getValue]
|
||||
@@ -137,31 +160,65 @@ export function KriSingleSelect<T = unknown>({
|
||||
)
|
||||
|
||||
const options = React.useMemo<MultiSelectOption<T>[]>(() => {
|
||||
return items.map((item) => ({
|
||||
const special: MultiSelectOption<T>[] = [];
|
||||
|
||||
if (useClear) special.push({ value: clearValue, label: clearLabel });
|
||||
|
||||
const normal = items.map((item) => ({
|
||||
value: extractValue(item),
|
||||
label: extractLabel(item),
|
||||
...(withInfo ? { info: item } : {}),
|
||||
}))
|
||||
}, [items, extractValue, extractLabel, withInfo])
|
||||
}));
|
||||
|
||||
return [...special, ...normal]
|
||||
}, [items, extractValue, extractLabel, withInfo, useClear, clearLabel, clearValue])
|
||||
|
||||
const defaultValue = React.useMemo(() => (value ? [value] : []), [value])
|
||||
|
||||
const tooltipText = React.useMemo(() => {
|
||||
if (!showSelectedTooltip) return undefined;
|
||||
if (!value || !value) return undefined;
|
||||
if (useClear && value === clearValue) return undefined;
|
||||
|
||||
const label = options.find(o => o.value === value)?.label;
|
||||
return label ?? value; // options에 없으면 value라도 표시
|
||||
}, [showSelectedTooltip, value, options, useClear, clearValue]);
|
||||
|
||||
return (
|
||||
<div className={cn(widthClassName, heightClassName, "flex-none overflow-hidden")}>
|
||||
<MultiSelect<T>
|
||||
ref={msRef}
|
||||
options={options}
|
||||
defaultValue={defaultValue}
|
||||
onValueChange={(next) => onChange(next[0] ?? '')}
|
||||
onValueChange={(next) => {
|
||||
const v = next[0] ?? ""
|
||||
|
||||
if (v === clearValue) {
|
||||
msRef.current?.clear();
|
||||
|
||||
onChange("")
|
||||
onOptionChange?.(null)
|
||||
onItemChange?.(null)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
onChange(v)
|
||||
}}
|
||||
onOptionChange={(opts) => {
|
||||
const opt = opts[0] ?? null
|
||||
const item = withInfo ? ((opt as any)?.info ?? null) : null
|
||||
|
||||
onOptionChange?.(opt)
|
||||
onItemChange?.((withInfo ? (opt?.info ?? null) : null))
|
||||
onItemChange?.(item)
|
||||
}}
|
||||
selectionMode="single"
|
||||
maxCount={1}
|
||||
maxSelected={1}
|
||||
placeholder={placeholder}
|
||||
className={cn("bg-white content-text-lg", className)}
|
||||
spanClassName={spanClassName}
|
||||
badgeClassName={badgeClassName}
|
||||
searchable={searchable}
|
||||
searchMode={searchMode}
|
||||
defaultSearchValue={defaultSearchValue}
|
||||
|
||||
@@ -14,7 +14,9 @@ type KriSelectProps<T> = {
|
||||
/** 현재 선택 값 */
|
||||
value: string
|
||||
/** 값 변경 시 호출 */
|
||||
onChange: (value: string) => void
|
||||
onChange?: (value: string) => void
|
||||
/** 옵션 변경시 호출 */
|
||||
onChangeOption?: (option: T) => void
|
||||
/** placeholder 텍스트 */
|
||||
placeholder?: string
|
||||
/** 기타 클래스 (예: 'w-40') */
|
||||
@@ -31,22 +33,31 @@ export function KriSelect<T>({
|
||||
items,
|
||||
value,
|
||||
onChange,
|
||||
onChangeOption,
|
||||
placeholder,
|
||||
className,
|
||||
getValue,
|
||||
getLabel,
|
||||
useAll = true,
|
||||
}: KriSelectProps<T>) {
|
||||
|
||||
const extractValue = (item: T) =>
|
||||
getValue ? getValue(item) : String(item)
|
||||
getValue ? getValue(item) : String(item);
|
||||
|
||||
const extractLabel = (item: T) =>
|
||||
getLabel ? getLabel(item) : String(item)
|
||||
getLabel ? getLabel(item) : String(item);
|
||||
|
||||
return (
|
||||
<Select
|
||||
value={value}
|
||||
onValueChange={onChange}
|
||||
onValueChange={(v) => {
|
||||
onChange?.(v);
|
||||
|
||||
const selected = items.find((item) => extractValue(item) === v);
|
||||
if(selected) {
|
||||
onChangeOption?.(selected);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<SelectTrigger
|
||||
className={cn(
|
||||
@@ -60,8 +71,9 @@ export function KriSelect<T>({
|
||||
<SelectContent>
|
||||
{ useAll? <SelectItem key="ALL" value="ALL">전체</SelectItem> :null }
|
||||
{items.map((item, idx) => {
|
||||
const v = extractValue(item)
|
||||
const label = extractLabel(item)
|
||||
const v = extractValue(item);
|
||||
const label = extractLabel(item);
|
||||
|
||||
return (
|
||||
<SelectItem key={v ?? idx} value={v}>
|
||||
{label}
|
||||
|
||||
@@ -5,6 +5,9 @@ import { cn } from "@/lib/utils";
|
||||
import type { KriEditorProps } from "./types";
|
||||
import { useDebouncedChange } from "./hooks/useDebouncedChange";
|
||||
import { sanitizeHtmlForPreview } from "./utils/sanitizeHtml";
|
||||
import {useCallback} from "react";
|
||||
import {toast} from "sonner";
|
||||
import {compressImage} from "@/components/kri-editor/utils/imageCompression";
|
||||
|
||||
type HtmlOnlyProps = Omit<KriEditorProps, "mode"> & {
|
||||
mode: "html";
|
||||
@@ -20,18 +23,26 @@ export function KriEditorHtmlOnly(props: HtmlOnlyProps) {
|
||||
showPreview,
|
||||
previewClassName,
|
||||
rows = 14,
|
||||
debounceMs = 350,
|
||||
|
||||
onImageUpload,
|
||||
onImageUploadError,
|
||||
debounceMs = 350,
|
||||
maxImageBytes = 5 * 1024 * 1024,
|
||||
imageMaxWidth = 1600,
|
||||
imageMaxHeight = 1600,
|
||||
imageQuality = 0.82,
|
||||
imageMimeType = "image/webp",
|
||||
} = props;
|
||||
|
||||
const [html, setHtml] = React.useState<string>(value || "");
|
||||
const textareaRef = React.useRef<HTMLTextAreaElement | null>(null);
|
||||
const fileInputRef = React.useRef<HTMLInputElement | null>(null);
|
||||
const fileRef = React.useRef<HTMLInputElement | null>(null);
|
||||
const latestHtmlRef = React.useRef(html);
|
||||
latestHtmlRef.current = html;
|
||||
|
||||
const flushChange = useDebouncedChange(onChange, debounceMs);
|
||||
const canImageUpload = Boolean(onImageUpload);
|
||||
|
||||
const { scheduleChange, flushChange } = useDebouncedChange(onChange, debounceMs);
|
||||
|
||||
// 외부 value 변경 시 동기화
|
||||
React.useEffect(() => {
|
||||
@@ -45,65 +56,100 @@ export function KriEditorHtmlOnly(props: HtmlOnlyProps) {
|
||||
const next = e.target.value;
|
||||
setHtml(next);
|
||||
latestHtmlRef.current = next;
|
||||
flushChange(next);
|
||||
scheduleChange(next);
|
||||
};
|
||||
|
||||
const handleBlur = () => {
|
||||
flushChange(latestHtmlRef.current);
|
||||
};
|
||||
|
||||
const handleClickImageButton = () => {
|
||||
if (!onImageUpload) return;
|
||||
fileInputRef.current?.click();
|
||||
};
|
||||
const handlePickImage = useCallback(() => {
|
||||
if (!canImageUpload) return;
|
||||
fileRef.current?.click();
|
||||
}, [canImageUpload]);
|
||||
|
||||
const handleFileChange = async (
|
||||
e: React.ChangeEvent<HTMLInputElement>,
|
||||
) => {
|
||||
const file = e.target.files?.[0];
|
||||
if (!file || !onImageUpload) return;
|
||||
const handleFile = useCallback(
|
||||
async (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
try {
|
||||
const file = e.target.files?.[0];
|
||||
e.target.value = "";
|
||||
if (!file) return;
|
||||
|
||||
try {
|
||||
const url = await onImageUpload(file);
|
||||
if (!url) return;
|
||||
if (!canImageUpload || !onImageUpload) return;
|
||||
|
||||
setHtml((prev) => {
|
||||
const current = prev ?? "";
|
||||
const textarea = textareaRef.current;
|
||||
const imgTag = `<img src="${url}" alt="" />`;
|
||||
if (!file.type.startsWith("image/")) {
|
||||
toast.error("이미지 파일만 업로드할 수 있습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!textarea) {
|
||||
const next = current + imgTag;
|
||||
latestHtmlRef.current = next;
|
||||
flushChange(next);
|
||||
return next;
|
||||
const compressed = await compressImage(file, {
|
||||
maxBytes: maxImageBytes,
|
||||
maxWidth: imageMaxWidth,
|
||||
maxHeight: imageMaxHeight,
|
||||
mimeType: imageMimeType,
|
||||
quality: imageQuality,
|
||||
});
|
||||
|
||||
if (compressed.size > maxImageBytes) {
|
||||
toast.error("이미지 용량이 제한을 초과합니다.", {
|
||||
description: `최대 ${(maxImageBytes / (1024 * 1024)).toFixed(0)}MB`,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const { url } = await onImageUpload(compressed);
|
||||
|
||||
if (!url || typeof url !== "string") {
|
||||
toast.error("이미지 업로드 응답이 올바르지 않습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
setHtml((prev) => {
|
||||
const current = prev ?? "";
|
||||
const textarea = textareaRef.current;
|
||||
const imgTag = `<img src="${url}" alt="" />`;
|
||||
|
||||
if (!textarea) {
|
||||
const next = current + imgTag;
|
||||
latestHtmlRef.current = next;
|
||||
scheduleChange(next);
|
||||
return next;
|
||||
}
|
||||
|
||||
const { selectionStart, selectionEnd } = textarea;
|
||||
const before = current.slice(0, selectionStart);
|
||||
const after = current.slice(selectionEnd);
|
||||
const next = before + imgTag + after;
|
||||
|
||||
latestHtmlRef.current = next;
|
||||
scheduleChange(next);
|
||||
|
||||
// 커서 위치를 이미지 태그 뒤로 이동
|
||||
window.requestAnimationFrame(() => {
|
||||
const pos = before.length + imgTag.length;
|
||||
textarea.focus();
|
||||
textarea.setSelectionRange(pos, pos);
|
||||
});
|
||||
|
||||
return next;
|
||||
});
|
||||
} catch (err) {
|
||||
toast.error("이미지 업로드에 실패했습니다.");
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
const { selectionStart, selectionEnd } = textarea;
|
||||
const before = current.slice(0, selectionStart);
|
||||
const after = current.slice(selectionEnd);
|
||||
const next = before + imgTag + after;
|
||||
|
||||
latestHtmlRef.current = next;
|
||||
flushChange(next);
|
||||
|
||||
// 커서 위치를 이미지 태그 뒤로 이동
|
||||
window.requestAnimationFrame(() => {
|
||||
const pos = before.length + imgTag.length;
|
||||
textarea.focus();
|
||||
textarea.setSelectionRange(pos, pos);
|
||||
});
|
||||
|
||||
return next;
|
||||
});
|
||||
} catch (error) {
|
||||
onImageUploadError?.(error);
|
||||
} finally {
|
||||
if (fileInputRef.current) {
|
||||
fileInputRef.current.value = "";
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
[
|
||||
scheduleChange,
|
||||
setHtml,
|
||||
canImageUpload,
|
||||
onImageUpload,
|
||||
maxImageBytes,
|
||||
imageMaxWidth,
|
||||
imageMaxHeight,
|
||||
imageMimeType,
|
||||
imageQuality,
|
||||
]
|
||||
);
|
||||
|
||||
const sanitizedHtml = React.useMemo(
|
||||
() => sanitizeHtmlForPreview(html || ""),
|
||||
@@ -124,7 +170,7 @@ export function KriEditorHtmlOnly(props: HtmlOnlyProps) {
|
||||
{onImageUpload && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleClickImageButton}
|
||||
onClick={handlePickImage}
|
||||
className="rounded border px-2 py-1 text-xs hover:bg-gray-50"
|
||||
>
|
||||
이미지 업로드
|
||||
@@ -143,18 +189,17 @@ export function KriEditorHtmlOnly(props: HtmlOnlyProps) {
|
||||
/>
|
||||
|
||||
<input
|
||||
ref={fileInputRef}
|
||||
ref={fileRef}
|
||||
type="file"
|
||||
accept="image/*"
|
||||
className="hidden"
|
||||
onChange={handleFileChange}
|
||||
onChange={handleFile}
|
||||
/>
|
||||
</div>
|
||||
{showPreview ?? (
|
||||
{showPreview && (
|
||||
<div className={cn("border-t p-3", previewClassName)}>
|
||||
<div className="mb-2 text-sm font-semibold">미리보기</div>
|
||||
<div className="rounded-md border bg-gray-50 p-3 text-sm leading-relaxed">
|
||||
{/* eslint-disable-next-line react/no-danger */}
|
||||
<div dangerouslySetInnerHTML={{ __html: sanitizedHtml }} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -79,6 +79,7 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
||||
debounceMs = 350,
|
||||
|
||||
onImageUpload,
|
||||
onImageUploadError,
|
||||
maxImageBytes = 5 * 1024 * 1024,
|
||||
imageMaxWidth = 1600,
|
||||
imageMaxHeight = 1600,
|
||||
@@ -93,6 +94,11 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
||||
const isLmsMode = mode === "lms";
|
||||
const showHtmlToggle = mode === "both";
|
||||
|
||||
const LINK_HTML_ATTRS = {
|
||||
rel: "noopener noreferrer",
|
||||
target: "_blank",
|
||||
} as const;
|
||||
|
||||
const { scheduleChange, flushChange, optimisticHtmlRef } = useDebouncedChange(onChange, debounceMs);
|
||||
|
||||
const fileRef = useRef<HTMLInputElement | null>(null);
|
||||
@@ -156,13 +162,12 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
||||
Div,
|
||||
|
||||
Link.configure({
|
||||
openOnClick: false,
|
||||
autolink: true,
|
||||
openOnClick: false,
|
||||
linkOnPaste: true,
|
||||
HTMLAttributes: {
|
||||
class: "text-blue-600 underline underline-offset-2",
|
||||
rel: "noopener noreferrer nofollow",
|
||||
target: "_blank",
|
||||
class: "cursor-pointer text-blue-600 underline underline-offset-2",
|
||||
...LINK_HTML_ATTRS,
|
||||
},
|
||||
}),
|
||||
|
||||
@@ -174,6 +179,7 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
||||
TableCell,
|
||||
|
||||
TiptapImage.configure({
|
||||
inline: true,
|
||||
allowBase64,
|
||||
HTMLAttributes: {
|
||||
class: "max-w-full h-auto",
|
||||
@@ -206,6 +212,52 @@ export function KriEditorWysiwyg(props: KriEditorProps) {
|
||||
"[&_td]:border [&_td]:p-2 [&_td]:align-top [&_td]:min-w-[90px]"
|
||||
),
|
||||
},
|
||||
handleDOMEvents: {
|
||||
click: (view, event) => {
|
||||
const e = event as MouseEvent;
|
||||
|
||||
// Alt + 좌클릭만
|
||||
if (!e.altKey || e.button !== 0) return false;
|
||||
|
||||
// 이미지(또는 리사이즈 컨테이너) 클릭일 때만
|
||||
const target = e.target as HTMLElement | null;
|
||||
const isImageClick = !!target?.closest?.("img, [data-resize-container]");
|
||||
if (!isImageClick) return false;
|
||||
|
||||
// 1) 문서 상태에서 link mark의 href 찾기 (NodeView/리사이즈 DOM에서도 안전)
|
||||
const pos = view.posAtCoords({ left: e.clientX, top: e.clientY });
|
||||
const linkType = view.state.schema.marks.link;
|
||||
|
||||
let href: string | undefined;
|
||||
|
||||
if (pos && linkType) {
|
||||
const $pos = view.state.doc.resolve(pos.pos);
|
||||
|
||||
const pickHref = (marks: readonly any[] | null | undefined) =>
|
||||
marks?.find(m => m.type === linkType)?.attrs?.href as string | undefined;
|
||||
|
||||
href =
|
||||
pickHref($pos.marks()) ||
|
||||
pickHref($pos.nodeAfter?.marks) ||
|
||||
pickHref($pos.nodeBefore?.marks);
|
||||
}
|
||||
|
||||
// 2) DOM fallback (실제 <a>가 있는 경우)
|
||||
if (!href) {
|
||||
const a = target?.closest?.("a") as HTMLAnchorElement | null;
|
||||
if (a?.href) href = a.href;
|
||||
}
|
||||
|
||||
if (!href) return false;
|
||||
|
||||
// 링크 열기 + 에디터 클릭 처리(커서 이동 등) 막기
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
console.log(LINK_HTML_ATTRS.rel.replaceAll(" ",","))
|
||||
window.open(href, LINK_HTML_ATTRS.target, LINK_HTML_ATTRS.rel.replaceAll(" ",","));
|
||||
return true;
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -318,12 +370,14 @@ const normalizeLinkUrl = (raw: string): string => {
|
||||
if (!editor) return;
|
||||
restoreSelection();
|
||||
|
||||
const prev = (editor.getAttributes("link").href as string | undefined) ?? "";
|
||||
if (editor.isActive("link")) {
|
||||
editor.chain().focus().unsetLink().run();
|
||||
return;
|
||||
if(confirm(`링크를 해제 하시겠습니까?\r\nLink: ${prev}`)){
|
||||
editor.chain().focus().unsetLink().run();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const prev = (editor.getAttributes("link").href as string | undefined) ?? "";
|
||||
const url = window.prompt("링크 URL을 입력하세요", prev);
|
||||
if (url === null) return;
|
||||
|
||||
@@ -412,8 +466,12 @@ const normalizeLinkUrl = (raw: string): string => {
|
||||
restoreSelection();
|
||||
editor.chain().focus().setImage({ src: url }).run();
|
||||
} catch (err) {
|
||||
toast.error("이미지 업로드에 실패했습니다.");
|
||||
console.error(err);
|
||||
if(onImageUploadError){
|
||||
onImageUploadError(err);
|
||||
}else{
|
||||
toast.error("이미지 업로드에 실패했습니다.");
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
},
|
||||
[
|
||||
|
||||
@@ -37,8 +37,7 @@ export const Header = ({
|
||||
setUserInfo(auth.user);
|
||||
}
|
||||
else{
|
||||
alert("Fix Me!!!! components/layout/Header.tsx")
|
||||
//window.location.replace("/logout");
|
||||
window.location.replace("/logout");
|
||||
}
|
||||
}, [auth])
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ const MainLayout = ({ children, initialFontSize }: MainLayoutProps) => {
|
||||
useEffect(() => {
|
||||
if(!isMain && isProjectMenu && !selectedProject){
|
||||
alert("옳지 않은 접근입니다.");
|
||||
window.location.replace("/");
|
||||
}
|
||||
}, []);
|
||||
|
||||
@@ -83,7 +84,7 @@ const MainLayout = ({ children, initialFontSize }: MainLayoutProps) => {
|
||||
<div
|
||||
className={cn(
|
||||
"bg-gray-50 flex flex-col",
|
||||
isMain ? "min-h-screen" : "h-screen overflow-hidden" // ✅ 메인 제외: 바깥 스크롤 잠금
|
||||
isMain ? "min-h-screen" : "h-screen overflow-hidden"
|
||||
)}
|
||||
>
|
||||
{/* 헤더 - 고정 폰트 크기 */}
|
||||
|
||||
@@ -52,10 +52,12 @@ export const SidebarProjectSearch = () =>{
|
||||
searchMode="inputOnly"
|
||||
onSearchValueChange={setSearchKeyword}
|
||||
placeholder="프로젝트 검색..."
|
||||
spanClassName="content-text-sm"
|
||||
widthClassName="w-full"
|
||||
heightClassName="h-9"
|
||||
preventDeselect
|
||||
hideOptionCheck
|
||||
showSelectedTooltip
|
||||
getLabel={(item) => `${item.prjctCd}_${item.prjctName}`}
|
||||
getValue={(item) => String(item.prjctIdx)}
|
||||
/>
|
||||
|
||||
@@ -14,7 +14,7 @@ function Checkbox({
|
||||
<CheckboxPrimitive.Root
|
||||
data-slot="checkbox"
|
||||
className={cn(
|
||||
"peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
||||
"cursor-pointer peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
|
||||
@@ -216,6 +216,10 @@ export interface MultiSelectProps<T = unknown>
|
||||
*/
|
||||
className?: string;
|
||||
|
||||
spanClassName?: string;
|
||||
|
||||
badgeClassName?: string;
|
||||
|
||||
/**
|
||||
* If true, disables the select all functionality.
|
||||
* Optional, defaults to false.
|
||||
@@ -389,6 +393,8 @@ function MultiSelectInner(
|
||||
modalPopover = false,
|
||||
asChild = false,
|
||||
className,
|
||||
spanClassName,
|
||||
badgeClassName,
|
||||
hideSelectAll = false,
|
||||
searchable = true,
|
||||
searchMode = "filter",
|
||||
@@ -1115,7 +1121,7 @@ function MultiSelectInner(
|
||||
{selectedValues.length > 0 ? (
|
||||
<div className="flex justify-between items-center w-full">
|
||||
{isSingle ? (
|
||||
<span className="mx-3 flex-1 min-w-0 truncate text-left content-text-lg text-foreground">
|
||||
<span className={cn("mx-3 flex-1 min-w-0 truncate text-left text-foreground", spanClassName)}>
|
||||
{selectedValues[0]
|
||||
? (getOptionByValue(selectedValues[0])?.label ?? selectedValues[0])
|
||||
: ""}
|
||||
@@ -1156,14 +1162,14 @@ function MultiSelectInner(
|
||||
multiSelectVariants({ variant }),
|
||||
customStyle?.gradient &&
|
||||
"text-white border-transparent",
|
||||
"content-text-lg",
|
||||
responsiveSettings.compactMode &&
|
||||
"px-1.5 py-0.5",
|
||||
screenSize === "mobile" &&
|
||||
"max-w-[120px] truncate",
|
||||
singleLine &&
|
||||
"flex-shrink-0 whitespace-nowrap",
|
||||
"[&>svg]:pointer-events-auto"
|
||||
"[&>svg]:pointer-events-auto",
|
||||
badgeClassName
|
||||
)}
|
||||
style={{
|
||||
...badgeStyle,
|
||||
@@ -1238,12 +1244,12 @@ function MultiSelectInner(
|
||||
"bg-transparent text-foreground border-foreground/1 hover:bg-transparent",
|
||||
getBadgeAnimationClass(),
|
||||
multiSelectVariants({ variant }),
|
||||
"content-text-lg",
|
||||
responsiveSettings.compactMode &&
|
||||
"px-1.5 py-0.5",
|
||||
singleLine &&
|
||||
"flex-shrink-0 whitespace-nowrap",
|
||||
"[&>svg]:pointer-events-auto"
|
||||
"[&>svg]:pointer-events-auto",
|
||||
badgeClassName
|
||||
)}
|
||||
style={{
|
||||
animationDuration: `${
|
||||
@@ -1307,7 +1313,7 @@ function MultiSelectInner(
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex items-center justify-between w-full mx-auto">
|
||||
<span className="mx-3 text-muted-foreground content-text-lg">
|
||||
<span className={cn("mx-3 text-muted-foreground", spanClassName)}>
|
||||
{placeholder}
|
||||
</span>
|
||||
<ChevronDown className="h-4 cursor-pointer text-muted-foreground mx-2" />
|
||||
|
||||
Reference in New Issue
Block a user