[ST] - fix: 그리드 여러행 복사 붙여넣기 시 초과된 행 수 많큼 빈행이 추가되지 않도록 수정
This commit is contained in:
@@ -289,14 +289,28 @@ type GridViewWithSetColumnProperty = {
|
||||
};
|
||||
|
||||
type GridViewWithEditOptions = {
|
||||
setEditOptions?: (options: { commitWhenLeave?: boolean }) => void;
|
||||
setEditOptions?: (options: {
|
||||
commitWhenLeave?: boolean;
|
||||
appendable?: boolean;
|
||||
insertable?: boolean;
|
||||
}) => void;
|
||||
setPasteOptions?: (options: { enableAppend?: boolean }) => void;
|
||||
};
|
||||
|
||||
/** 포커스가 그리드 밖으로 나갈 때 편집 중인 값을 자동 commit */
|
||||
function applyDefaultGridEditOptions(
|
||||
gridView: GridViewWithEditOptions | null | undefined,
|
||||
options?: { preventRowAppend?: boolean },
|
||||
) {
|
||||
gridView?.setEditOptions?.({ commitWhenLeave: true });
|
||||
gridView?.setEditOptions?.({
|
||||
commitWhenLeave: true,
|
||||
...(options?.preventRowAppend
|
||||
? { appendable: false, insertable: false }
|
||||
: {}),
|
||||
});
|
||||
if (options?.preventRowAppend) {
|
||||
gridView?.setPasteOptions?.({ enableAppend: false });
|
||||
}
|
||||
}
|
||||
|
||||
function isDateEditorColumn(column: {
|
||||
@@ -853,6 +867,7 @@ const DataGrid = ({
|
||||
gridHeight = 55, // vh 단위
|
||||
headerHeight = 60,
|
||||
fitStyle = GridFitStyle.EVEN,
|
||||
preventRowAppend = true,
|
||||
}: DataGridProps) => {
|
||||
const { columns, columnLayout } = columnInfo;
|
||||
const fixedColumnNameSet = useMemo(
|
||||
@@ -1467,7 +1482,9 @@ useEffect(() => {
|
||||
const scheduleFooterTask = (task: () => void, delayMs: number) => {
|
||||
footerTimerIds.push(setTimeout(task, delayMs));
|
||||
};
|
||||
applyDefaultGridEditOptions(gridView as GridViewWithEditOptions);
|
||||
applyDefaultGridEditOptions(gridView as GridViewWithEditOptions, {
|
||||
preventRowAppend,
|
||||
});
|
||||
|
||||
const columnsFieldsSig = columns.map((c) => c.fieldName).join("\u0001");
|
||||
if (columnsFieldsSig !== columnsFieldsSigRef.current) {
|
||||
@@ -1990,6 +2007,7 @@ useEffect(() => {
|
||||
fitStyle,
|
||||
enableSort,
|
||||
footerVerificationResult,
|
||||
preventRowAppend,
|
||||
]);
|
||||
|
||||
// 행·셀 클릭 이벤트 (검증 오류 툴팁은 hover만 — onShowTooltip / 빈 셀 오버레이)
|
||||
@@ -2527,6 +2545,7 @@ useEffect(() => {
|
||||
const gridView = gridRef.current?.gridView ?? grid;
|
||||
applyDefaultGridEditOptions(
|
||||
gridView as GridViewWithEditOptions,
|
||||
{ preventRowAppend },
|
||||
);
|
||||
if (!gridView?.columnByName) return;
|
||||
setTimeout(() => {
|
||||
|
||||
@@ -481,6 +481,11 @@ export type DataGridProps = {
|
||||
headerHeight?: number;
|
||||
/** RealGrid `displayOptions.fitStyle` (기본 EVEN). 컬럼별 width 유지 시 NONE */
|
||||
fitStyle?: GridFitStyle;
|
||||
/**
|
||||
* true면 붙여넣기·편집으로 행을 추가하지 않음.
|
||||
* 검증 결과처럼 조회 행 수가 고정된 그리드에서 사용.
|
||||
*/
|
||||
preventRowAppend?: boolean;
|
||||
};
|
||||
|
||||
export type TabDataGridProps = {
|
||||
|
||||
Reference in New Issue
Block a user