Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ export default {
type: Array as () => Question[],
default: () => [],
},
// Allows parent components to specify formatters, cellClick handlers, frozen, etc.
columnConfigs: {
type: Array as () => Array<Record<string, any>>,
default: () => [],
},
},

model: {
Expand Down Expand Up @@ -193,10 +198,22 @@ export default {
columnsConfig() {
if (!this.tableJSON?.schema) return [];

// Create a map of custom column configs by field name for quick lookup
const customConfigMap = new Map<string, Record<string, any>>();
if (this.columnConfigs && this.columnConfigs.length > 0) {
this.columnConfigs.forEach((config: Record<string, any>) => {
if (config.field) {
customConfigMap.set(config.field, config);
}
});
}

var configs = this.tableJSON.schema.fields.map((column: DataFrameField) => {
const commonConfig = this.generateColumnConfig(column.name);
const editableConfig = this.generateColumnEditableConfig(column.name);
return { ...commonConfig, ...editableConfig };
// Merge with custom config if provided (custom config takes precedence)
const customConfig = customConfigMap.get(column.name) || {};
return { ...commonConfig, ...editableConfig, ...customConfig };
});

if (!this.editable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:editable="editable"
:hasValidValues="hasValidValues"
:questions="questions"
:columnConfigs="columns"
@table-built="$emit('table-built')"
@row-click="(e, row) => $emit('row-click', e, row)"
@cell-edited="(cell) => $emit('cell-edited', cell)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

<!-- Step 2: Import Analysis -->
<ImportAnalysisTable v-if="stepIndex === 1" ref="analysisTableComponent" :dataframe-data="bibData.dataframeData"
:pdf-data="pdfData" :workspace="workspace" :loading="isAnalyzing" @update="handleAnalysisUpdate"
:pdf-data="pdfData" :workspace="workspace" :loading="isAnalyzing"
:initial-document-actions="uploadData.documentActions"
@update="handleAnalysisUpdate"
@analysis-complete="handleAnalysisComplete" />

<!-- Step 3: Upload Progress -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,32 @@ export default {
type: Boolean,
default: false,
},
initialDocumentActions: {
type: Object as () => Record<string, ImportStatus>,
default: () => ({}),
},
},

emits: ["update", "analysis-complete"],

data() {
return {
localDocumentActions: {} as Record<string, ImportStatus>,
// Initialize from prop to persist state when navigating back/forward
localDocumentActions: { ...this.initialDocumentActions } as Record<string, ImportStatus>,
};
},

mounted() {
// Restore document actions from parent state when component is remounted
if (this.initialDocumentActions && Object.keys(this.initialDocumentActions).length > 0) {
this.localDocumentActions = { ...this.initialDocumentActions };
// Emit update to sync state with parent
this.$nextTick(() => {
this.emitUpdate();
});
}
},

computed: {
summaryData() {
if (this.analysisResult) {
Expand Down Expand Up @@ -330,8 +346,11 @@ export default {
analysisResult: {
handler(newData: ImportAnalysisResponse) {
if (newData) {
// Reset local document actions when new analysis data arrives
this.localDocumentActions = {};
// Only reset local document actions if there are no persisted actions from parent
// This preserves user modifications when navigating back/forward between steps
if (!this.initialDocumentActions || Object.keys(this.initialDocumentActions).length === 0) {
this.localDocumentActions = {};
}
// Emit the analysis complete event
this.$emit('analysis-complete', newData);
// Emit initial update
Expand Down