관망도 레이어 전체켜기 기능 추가
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
*/
|
||||
"use client";
|
||||
|
||||
import { getSnRowNumber } from "@/shared/lib/row-number";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
|
||||
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||
@@ -10,7 +11,6 @@ import useOnsemiroAddrStore from "@/app/store/useOnsemiroAddrStore";
|
||||
import {
|
||||
StandardDataTable,
|
||||
StandardPopupLayout,
|
||||
getStandardRowNumber,
|
||||
} from "@common/business_components";
|
||||
import {
|
||||
Button,
|
||||
@@ -273,7 +273,7 @@ export default function CfmtnBgtPopupContent({
|
||||
() =>
|
||||
(Array.isArray(data.content) ? data.content : []).map((row, index) => ({
|
||||
...row,
|
||||
rowNumber: getStandardRowNumber({
|
||||
rowNumber: getSnRowNumber({
|
||||
total: data.totalElements,
|
||||
rowIndex: index,
|
||||
pageIndex: page,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import { getSnRowNumber } from "@/shared/lib/row-number";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
|
||||
import {
|
||||
StandardDataTable,
|
||||
StandardTableSortHeader,
|
||||
getStandardRowNumber,
|
||||
type UiTableSort,
|
||||
} from "@common/business_components";
|
||||
import {
|
||||
@@ -463,7 +463,7 @@ export function CtyFldngPrvtnBizListPage() {
|
||||
result.content.map((row, i) =>
|
||||
flattenRow(
|
||||
row,
|
||||
getStandardRowNumber({
|
||||
getSnRowNumber({
|
||||
total: result.totalElements,
|
||||
rowIndex: i,
|
||||
pageIndex: target - 1,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { getSnRowNumber } from "@/shared/lib/row-number";
|
||||
import LoadingOverlay from "@/components/ui/LoadingBar";
|
||||
import { fileDownload } from "@/components/lib/utils";
|
||||
import { getStartYearArray } from "@/components/ui/YearRangeSelectBox";
|
||||
@@ -20,7 +21,6 @@ import {
|
||||
STANDARD_ROW_NUMBER_HEADER,
|
||||
StandardDataTable,
|
||||
StandardTableSortHeader,
|
||||
getStandardRowNumber,
|
||||
type UiTableSort,
|
||||
} from "@common/business_components";
|
||||
import {
|
||||
@@ -146,7 +146,7 @@ export function ExmnRegistrationPage() {
|
||||
() =>
|
||||
businesses.map((business, index) => ({
|
||||
...business,
|
||||
rowNumber: getStandardRowNumber({
|
||||
rowNumber: getSnRowNumber({
|
||||
total: totalElements,
|
||||
rowIndex: index,
|
||||
pageIndex: pagination.pageIndex,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { getSnRowNumber } from "@/shared/lib/row-number";
|
||||
import { useMemo, type ReactNode } from "react";
|
||||
import {
|
||||
getCoreRowModel,
|
||||
@@ -9,7 +10,6 @@ import {
|
||||
} from "@tanstack/react-table";
|
||||
import {
|
||||
StandardDataTable,
|
||||
getStandardRowNumber,
|
||||
type ScrollMode,
|
||||
type UiHeadProps,
|
||||
} from "@common/business_components";
|
||||
@@ -43,7 +43,7 @@ const formatValue = (value: unknown) => {
|
||||
: String(value);
|
||||
};
|
||||
|
||||
/** 조사관리 표를 CS 목록 규격과 역순 순번 계약으로 연결한다. */
|
||||
/** 조사관리 표를 CS 목록 규격과 페이지 연속 오름차순 순번으로 연결한다. */
|
||||
export function ExmnStandardDataTable<T extends Record<string, unknown>>({
|
||||
rows,
|
||||
headlist,
|
||||
@@ -69,7 +69,7 @@ export function ExmnStandardDataTable<T extends Record<string, unknown>>({
|
||||
header: ROW_NUMBER_IDS.has(head.id) ? "순번" : head.title,
|
||||
cell: ({ row, getValue }) => {
|
||||
const value = ROW_NUMBER_IDS.has(head.id)
|
||||
? getStandardRowNumber({
|
||||
? getSnRowNumber({
|
||||
total,
|
||||
rowIndex: row.index,
|
||||
pageIndex: page - 1,
|
||||
|
||||
@@ -189,7 +189,7 @@ export function ExmnStatusDetailPanel({
|
||||
const counts = getCounts(row);
|
||||
return {
|
||||
trtdstId: row.trtdstId,
|
||||
rowNumber: summaryRows.length - index,
|
||||
rowNumber: index + 1,
|
||||
trtdstNm: row.trtdstNm,
|
||||
trgtPrlgText: formatNumber(row.trgtPrlg),
|
||||
drvngDstncText: formatNumber(row.drvngDstnc),
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import { getSnRowNumber } from "@/shared/lib/row-number";
|
||||
import LoadingOverlay from "@/components/ui/LoadingBar";
|
||||
import useStore from "@/store/useStore";
|
||||
import {
|
||||
STANDARD_ROW_NUMBER_HEADER,
|
||||
StandardDataTable,
|
||||
StandardTableSortHeader,
|
||||
getStandardRowNumber,
|
||||
sortStandardTableRows,
|
||||
type UiTableSort,
|
||||
} from "@common/business_components";
|
||||
@@ -73,16 +73,16 @@ const createLocalKey = () =>
|
||||
? `client:${crypto.randomUUID()}`
|
||||
: `client:${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
||||
|
||||
/** 화면의 현재 행 순서를 전체 건수에서 시작하는 공통 내림차순 순번으로 정규화한다. */
|
||||
const withDescendingRowNumbers = (rows: TrtdstTableRow[]): TrtdstTableRow[] =>
|
||||
/** 화면의 현재 행 순서에 1부터 오름차순 표시 순번을 붙인다. */
|
||||
const withAscendingRowNumbers = (rows: TrtdstTableRow[]): TrtdstTableRow[] =>
|
||||
rows.map((row, index) => ({
|
||||
...row,
|
||||
rowNumber: getStandardRowNumber({ total: rows.length, rowIndex: index }),
|
||||
rowNumber: getSnRowNumber({ total: rows.length, rowIndex: index }),
|
||||
}));
|
||||
|
||||
/** 서버 처리분구 목록을 공통 표와 변경 추적에 필요한 행 구조로 변환한다. */
|
||||
const toTableRows = (items: TrtdstSettingDto[]): TrtdstTableRow[] =>
|
||||
withDescendingRowNumbers(
|
||||
withAscendingRowNumbers(
|
||||
items.map((item) => ({
|
||||
...item,
|
||||
trtdstId: String(item.trtdstId),
|
||||
@@ -103,7 +103,7 @@ const toSavedTableRows = (
|
||||
rows: TrtdstTableRow[],
|
||||
savedItems: TrtdstSettingDto[] = [],
|
||||
): TrtdstTableRow[] =>
|
||||
withDescendingRowNumbers(
|
||||
withAscendingRowNumbers(
|
||||
rows
|
||||
.filter((row) => row.rowStatus !== "deletePending")
|
||||
.map((row) => {
|
||||
@@ -300,7 +300,7 @@ export function TrtdstManagementPage() {
|
||||
setSort(undefined);
|
||||
setPagination((current) => ({ ...current, pageIndex: 0 }));
|
||||
setRows((current) =>
|
||||
withDescendingRowNumbers([
|
||||
withAscendingRowNumbers([
|
||||
...current,
|
||||
{
|
||||
trtdstId: "",
|
||||
@@ -353,7 +353,7 @@ export function TrtdstManagementPage() {
|
||||
if (selectedRow.rowStatus === "added") {
|
||||
if (!(await confirm("선택한 처리분구를 삭제하시겠습니까?"))) return;
|
||||
setRows((current) =>
|
||||
withDescendingRowNumbers(
|
||||
withAscendingRowNumbers(
|
||||
current.filter((row) => row.localKey !== selectedRow.localKey),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
*/
|
||||
"use client";
|
||||
|
||||
import { getSnRowNumber } from "@/shared/lib/row-number";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
|
||||
import {
|
||||
StandardDataTable,
|
||||
StandardTableSortHeader,
|
||||
getStandardRowNumber,
|
||||
type UiTableSort,
|
||||
} from "@common/business_components";
|
||||
import {
|
||||
@@ -331,7 +331,7 @@ export function ObsltPplListPage() {
|
||||
setRows(
|
||||
result.content.map((row, index) => ({
|
||||
...formatBusinessForDisplay(row),
|
||||
rowNumber: getStandardRowNumber({
|
||||
rowNumber: getSnRowNumber({
|
||||
total: result.totalElements,
|
||||
rowIndex: index,
|
||||
pageIndex: targetPage - 1,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { getSnRowNumber } from "@/shared/lib/row-number";
|
||||
import { type ReactNode, useMemo } from "react";
|
||||
|
||||
import {
|
||||
@@ -10,7 +11,6 @@ import {
|
||||
} from "@tanstack/react-table";
|
||||
|
||||
import {
|
||||
getStandardRowNumber,
|
||||
type ScrollMode,
|
||||
StandardDataTable,
|
||||
StandardTableSortHeader,
|
||||
@@ -109,7 +109,7 @@ export default function MapPopupDataTable<T extends Record<string, unknown>>({
|
||||
const rowIndex = row.index;
|
||||
const rendered = renderCell?.(row.original, head.id, rowIndex);
|
||||
const value = ROW_NUMBER_IDS.has(head.id)
|
||||
? getStandardRowNumber({
|
||||
? getSnRowNumber({
|
||||
total,
|
||||
rowIndex,
|
||||
pageIndex: page - 1,
|
||||
|
||||
Reference in New Issue
Block a user