mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-27 12:36:01 +00:00
editable flag moved to grider
This commit is contained in:
@@ -16,7 +16,6 @@ export class FreeTableGridDisplay extends GridDisplay {
|
|||||||
this.columns = this.getDisplayColumns(model);
|
this.columns = this.getDisplayColumns(model);
|
||||||
this.filterable = false;
|
this.filterable = false;
|
||||||
this.sortable = false;
|
this.sortable = false;
|
||||||
this.editable = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getDisplayColumns(model: FreeTableModel) {
|
getDisplayColumns(model: FreeTableModel) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export class ViewGridDisplay extends GridDisplay {
|
|||||||
this.columns = this.getDisplayColumns(view);
|
this.columns = this.getDisplayColumns(view);
|
||||||
this.filterable = true;
|
this.filterable = true;
|
||||||
this.sortable = true;
|
this.sortable = true;
|
||||||
this.editable = true;
|
this.editable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getDisplayColumns(view: ViewInfo) {
|
getDisplayColumns(view: ViewInfo) {
|
||||||
|
|||||||
@@ -66,6 +66,10 @@ export default class ChangeSetGrider extends Grider {
|
|||||||
this.rowCacheIndexes.add(index);
|
this.rowCacheIndexes.add(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get editable() {
|
||||||
|
return this.display.editable;
|
||||||
|
}
|
||||||
|
|
||||||
get canInsert() {
|
get canInsert() {
|
||||||
return !!this.display.baseTable;
|
return !!this.display.baseTable;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ export default function DataGridCore(props) {
|
|||||||
const [inplaceEditorState, dispatchInsplaceEditor] = React.useReducer((state, action) => {
|
const [inplaceEditorState, dispatchInsplaceEditor] = React.useReducer((state, action) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case 'show':
|
case 'show':
|
||||||
if (!display.editable) return {};
|
if (!grider.editable) return {};
|
||||||
return {
|
return {
|
||||||
cell: action.cell,
|
cell: action.cell,
|
||||||
text: action.text,
|
text: action.text,
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ export default abstract class Grider {
|
|||||||
revertAllChanges() {}
|
revertAllChanges() {}
|
||||||
undo() {}
|
undo() {}
|
||||||
redo() {}
|
redo() {}
|
||||||
|
get editable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
get canInsert() {
|
get canInsert() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ export default class FreeTableGrider extends Grider {
|
|||||||
rows: model.rows.map((row, i) => (index == i ? { ...row, [uniqueName]: value } : row)),
|
rows: model.rows.map((row, i) => (index == i ? { ...row, [uniqueName]: value } : row)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
get editable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
get canInsert() {
|
get canInsert() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user