fix(ag-grid): resolve theme API conflict and rowSelection deprecation warning in QuantDataGrid
Validators (Pushes and Pull Requests) / UI & Storage Validation (push) Failing after 12s
Validators (Pushes and Pull Requests) / Database & Schema Validation (push) Successful in 12s
Validators (Pushes and Pull Requests) / Core Validators & Database Setup (push) Failing after 19s
Validators (Pushes and Pull Requests) / WBS & Audit Validations (push) Has been skipped
Validators (Pushes and Pull Requests) / .NET Contracts (push) Has been skipped
Validators (Pushes and Pull Requests) / Calibration & Performance (push) Has been skipped
Validators (Pushes and Pull Requests) / Notify PR Results (push) Has been skipped
Validators (Pushes and Pull Requests) / Operational Report & Decision Packet (push) Has been skipped
Validators (Pushes and Pull Requests) / Security & Secrets (push) Successful in 9s
Validators (Pushes and Pull Requests) / CI Workflow Lint (push) Failing after 8s
Validators (Pushes and Pull Requests) / UI & Storage Validation (push) Failing after 12s
Validators (Pushes and Pull Requests) / Database & Schema Validation (push) Successful in 12s
Validators (Pushes and Pull Requests) / Core Validators & Database Setup (push) Failing after 19s
Validators (Pushes and Pull Requests) / WBS & Audit Validations (push) Has been skipped
Validators (Pushes and Pull Requests) / .NET Contracts (push) Has been skipped
Validators (Pushes and Pull Requests) / Calibration & Performance (push) Has been skipped
Validators (Pushes and Pull Requests) / Notify PR Results (push) Has been skipped
Validators (Pushes and Pull Requests) / Operational Report & Decision Packet (push) Has been skipped
Validators (Pushes and Pull Requests) / Security & Secrets (push) Successful in 9s
Validators (Pushes and Pull Requests) / CI Workflow Lint (push) Failing after 8s
This commit is contained in:
@@ -1,20 +1,29 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { ref, computed } from 'vue';
|
||||
import { AgGridVue } from 'ag-grid-vue3';
|
||||
import 'ag-grid-community/styles/ag-grid.css';
|
||||
import 'ag-grid-community/styles/ag-theme-alpine.css';
|
||||
import type { ColDef, GridApi, GridReadyEvent, CellValueChangedEvent } from 'ag-grid-community';
|
||||
import type { ColDef, GridApi, GridReadyEvent, CellValueChangedEvent, RowSelectionOptions } from 'ag-grid-community';
|
||||
|
||||
const props = defineProps<{
|
||||
columnDefs: ColDef[];
|
||||
rowData: any[];
|
||||
rowSelection?: 'single' | 'multiple';
|
||||
rowSelection?: 'single' | 'multiple' | RowSelectionOptions;
|
||||
filename?: string;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits(['row-selected', 'cell-value-changed']);
|
||||
const gridApi = ref<GridApi | null>(null);
|
||||
|
||||
// AG Grid v36 rowSelection deprecation 대응
|
||||
const normalizedRowSelection = computed<RowSelectionOptions>(() => {
|
||||
if (typeof props.rowSelection === 'object' && props.rowSelection !== null) {
|
||||
return props.rowSelection;
|
||||
}
|
||||
if (props.rowSelection === 'multiple') {
|
||||
return { mode: 'multiRow' };
|
||||
}
|
||||
return { mode: 'singleRow' };
|
||||
});
|
||||
|
||||
const onGridReady = (params: GridReadyEvent) => {
|
||||
gridApi.value = params.api;
|
||||
};
|
||||
@@ -27,7 +36,7 @@ const onSelectionChanged = () => {
|
||||
};
|
||||
|
||||
const selectedRowPayload = (selectedData: any[]) => {
|
||||
if (props.rowSelection === 'multiple') {
|
||||
if (props.rowSelection === 'multiple' || (typeof props.rowSelection === 'object' && props.rowSelection?.mode === 'multiRow')) {
|
||||
return selectedData;
|
||||
}
|
||||
return selectedData.length > 0 ? selectedData[0] : null;
|
||||
@@ -59,10 +68,11 @@ defineExpose({ exportToExcel, gridApi });
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- AG Grid Container -->
|
||||
<!-- AG Grid Container (v36 legacy theme & object rowSelection) -->
|
||||
<div class="flex-1 ag-theme-alpine w-full">
|
||||
<ag-grid-vue
|
||||
class="h-full w-full"
|
||||
theme="legacy"
|
||||
:columnDefs="columnDefs"
|
||||
:rowData="rowData"
|
||||
:defaultColDef="{
|
||||
@@ -72,7 +82,7 @@ defineExpose({ exportToExcel, gridApi });
|
||||
flex: 1,
|
||||
minWidth: 100
|
||||
}"
|
||||
:rowSelection="rowSelection || 'single'"
|
||||
:rowSelection="normalizedRowSelection"
|
||||
@grid-ready="onGridReady"
|
||||
@selection-changed="onSelectionChanged"
|
||||
@cell-value-changed="onCellValueChanged"
|
||||
|
||||
Reference in New Issue
Block a user