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">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { AgGridVue } from 'ag-grid-vue3';
|
import { AgGridVue } from 'ag-grid-vue3';
|
||||||
import 'ag-grid-community/styles/ag-grid.css';
|
import type { ColDef, GridApi, GridReadyEvent, CellValueChangedEvent, RowSelectionOptions } from 'ag-grid-community';
|
||||||
import 'ag-grid-community/styles/ag-theme-alpine.css';
|
|
||||||
import type { ColDef, GridApi, GridReadyEvent, CellValueChangedEvent } from 'ag-grid-community';
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
columnDefs: ColDef[];
|
columnDefs: ColDef[];
|
||||||
rowData: any[];
|
rowData: any[];
|
||||||
rowSelection?: 'single' | 'multiple';
|
rowSelection?: 'single' | 'multiple' | RowSelectionOptions;
|
||||||
filename?: string;
|
filename?: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits(['row-selected', 'cell-value-changed']);
|
const emit = defineEmits(['row-selected', 'cell-value-changed']);
|
||||||
const gridApi = ref<GridApi | null>(null);
|
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) => {
|
const onGridReady = (params: GridReadyEvent) => {
|
||||||
gridApi.value = params.api;
|
gridApi.value = params.api;
|
||||||
};
|
};
|
||||||
@@ -27,7 +36,7 @@ const onSelectionChanged = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const selectedRowPayload = (selectedData: any[]) => {
|
const selectedRowPayload = (selectedData: any[]) => {
|
||||||
if (props.rowSelection === 'multiple') {
|
if (props.rowSelection === 'multiple' || (typeof props.rowSelection === 'object' && props.rowSelection?.mode === 'multiRow')) {
|
||||||
return selectedData;
|
return selectedData;
|
||||||
}
|
}
|
||||||
return selectedData.length > 0 ? selectedData[0] : null;
|
return selectedData.length > 0 ? selectedData[0] : null;
|
||||||
@@ -59,10 +68,11 @@ defineExpose({ exportToExcel, gridApi });
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- AG Grid Container -->
|
<!-- AG Grid Container (v36 legacy theme & object rowSelection) -->
|
||||||
<div class="flex-1 ag-theme-alpine w-full">
|
<div class="flex-1 ag-theme-alpine w-full">
|
||||||
<ag-grid-vue
|
<ag-grid-vue
|
||||||
class="h-full w-full"
|
class="h-full w-full"
|
||||||
|
theme="legacy"
|
||||||
:columnDefs="columnDefs"
|
:columnDefs="columnDefs"
|
||||||
:rowData="rowData"
|
:rowData="rowData"
|
||||||
:defaultColDef="{
|
:defaultColDef="{
|
||||||
@@ -72,7 +82,7 @@ defineExpose({ exportToExcel, gridApi });
|
|||||||
flex: 1,
|
flex: 1,
|
||||||
minWidth: 100
|
minWidth: 100
|
||||||
}"
|
}"
|
||||||
:rowSelection="rowSelection || 'single'"
|
:rowSelection="normalizedRowSelection"
|
||||||
@grid-ready="onGridReady"
|
@grid-ready="onGridReady"
|
||||||
@selection-changed="onSelectionChanged"
|
@selection-changed="onSelectionChanged"
|
||||||
@cell-value-changed="onCellValueChanged"
|
@cell-value-changed="onCellValueChanged"
|
||||||
|
|||||||
Reference in New Issue
Block a user