feat: ag-grid에서 iActionInfo를 툴팁으로 띄움
This commit is contained in:
@@ -34,12 +34,12 @@ import type {
|
||||
GridReadyEvent,
|
||||
} from "ag-grid-community";
|
||||
import { getNpcColor } from "@/common_legacy";
|
||||
import type {
|
||||
BaseWithValueColDefParams,
|
||||
ValueGetterParams,
|
||||
} from "ag-grid-community/dist/lib/entities/colDef";
|
||||
import type { BaseWithValueColDefParams, ValueGetterParams } from "ag-grid-community/dist/lib/entities/colDef";
|
||||
import type { GameConstStore } from "@/GameConstStore";
|
||||
import { unwrap } from "@/util/unwrap";
|
||||
import SimpleTooltipCell from "@/gridCellRenderer/SimpleTooltipCell.vue";
|
||||
import GridTooltipCell from "@/gridCellRenderer/GridTooltipCell.vue";
|
||||
import type { GameIActionInfo } from "@/defs/GameObj";
|
||||
|
||||
const props = defineProps({
|
||||
list: {
|
||||
@@ -54,7 +54,7 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
|
||||
const gameConstStore = unwrap(inject<Ref<GameConstStore>>('gameConstStore'));
|
||||
const gameConstStore = unwrap(inject<Ref<GameConstStore>>("gameConstStore"));
|
||||
const iActionInfo = gameConstStore.value.iActionInfo;
|
||||
console.log(iActionInfo);
|
||||
//debug
|
||||
@@ -144,6 +144,12 @@ interface GenCellClassParams extends CellClassParams {
|
||||
data: GeneralListItem;
|
||||
}
|
||||
|
||||
type GridCellInfo = {
|
||||
iActionMap?: Record<string, GameIActionInfo>;
|
||||
info?: string;
|
||||
target: keyof GeneralListItem;
|
||||
};
|
||||
|
||||
function naiveCheClassNameFilter(value: string): string {
|
||||
const text = value.split("_").pop() ?? "None";
|
||||
if (text === "None") {
|
||||
@@ -310,11 +316,17 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
||||
children: [
|
||||
{
|
||||
headerName: "요약",
|
||||
cellRenderer: ({ data }: GenValueParams) => {
|
||||
const personal = naiveCheClassNameFilter(data.personal);
|
||||
const specialDomestic = naiveCheClassNameFilter(data.specialDomestic);
|
||||
const specialWar = naiveCheClassNameFilter(data.specialWar);
|
||||
return `${personal}<br><div class="row gx-1 m-0 cell-sp"><div class="col">${specialDomestic}</div><div class="col">${specialWar}</div>`;
|
||||
cellRenderer: GridTooltipCell,
|
||||
cellRendererParams: {
|
||||
cells: ((): GridCellInfo[][] => {
|
||||
return [
|
||||
[{ target: "personal", iActionMap: gameConstStore.value.iActionInfo.personality }],
|
||||
[
|
||||
{ target: "specialDomestic", iActionMap: gameConstStore.value.iActionInfo.specialDomestic },
|
||||
{ target: "specialWar", iActionMap: gameConstStore.value.iActionInfo.specialWar },
|
||||
],
|
||||
];
|
||||
})(),
|
||||
},
|
||||
width: 90,
|
||||
columnGroupShow: "closed",
|
||||
@@ -322,7 +334,10 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
||||
{
|
||||
headerName: "성격",
|
||||
field: "personal",
|
||||
valueFormatter: naiveCheClassNameFilterFromRow("personal"),
|
||||
cellRenderer: SimpleTooltipCell,
|
||||
cellRendererParams: {
|
||||
iActionMap: gameConstStore.value.iActionInfo.personality,
|
||||
},
|
||||
width: 70,
|
||||
sortable: true,
|
||||
filter: true,
|
||||
@@ -331,7 +346,10 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
||||
{
|
||||
headerName: "내특",
|
||||
field: "specialDomestic",
|
||||
valueFormatter: naiveCheClassNameFilterFromRow("specialDomestic"),
|
||||
cellRenderer: SimpleTooltipCell,
|
||||
cellRendererParams: {
|
||||
iActionMap: gameConstStore.value.iActionInfo.specialDomestic,
|
||||
},
|
||||
width: 70,
|
||||
sortable: true,
|
||||
filter: true,
|
||||
@@ -340,7 +358,10 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
||||
{
|
||||
headerName: "전특",
|
||||
field: "specialWar",
|
||||
valueFormatter: naiveCheClassNameFilterFromRow("specialWar"),
|
||||
cellRenderer: SimpleTooltipCell,
|
||||
cellRendererParams: {
|
||||
iActionMap: gameConstStore.value.iActionInfo.specialWar,
|
||||
},
|
||||
width: 70,
|
||||
sortable: true,
|
||||
filter: true,
|
||||
|
||||
Reference in New Issue
Block a user