aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormehekj <mehek.jethani@gmail.com>2022-08-18 14:28:58 -0400
committermehekj <mehek.jethani@gmail.com>2022-08-18 14:28:58 -0400
commit14a938e8bf543ddaf7b8a9ae0c35cd725b5bdb77 (patch)
tree71aa0d903bff1646c5fafcf0991102b49a04a714 /src
parentdd9f736e7b522be12267f34d35fe7e7993229afc (diff)
col widths update on add/remove
Diffstat (limited to 'src')
-rw-r--r--src/client/views/collections/collectionSchema/CollectionSchemaView.tsx19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
index a09d2722c..69a49598d 100644
--- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
+++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
@@ -76,6 +76,15 @@ export class CollectionSchemaView extends CollectionSubView() {
let currKeys = this.columnKeys;
currKeys.splice(index, 0, 'title');
this.layoutDoc.columnKeys = new List<string>(currKeys);
+
+ const newColWidth = this._minColWidth;
+ let currWidths = this.storedColumnWidths;
+ currWidths = currWidths.map(w => {
+ const proportion = w / (this.props.PanelWidth() - this._rowMenuWidth);
+ return proportion * (this.props.PanelWidth() - this._rowMenuWidth - newColWidth);
+ });
+ currWidths.splice(index, 0, newColWidth);
+ this.layoutDoc.columnWidths = new List<number>(currWidths);
};
@undoBatch
@@ -84,6 +93,15 @@ export class CollectionSchemaView extends CollectionSubView() {
let currKeys = this.columnKeys;
currKeys.splice(index, 1);
this.layoutDoc.columnKeys = new List<string>(currKeys);
+
+ let currWidths = this.storedColumnWidths;
+ const removedColWidth = currWidths[index];
+ currWidths = currWidths.map(w => {
+ const proportion = w / (this.props.PanelWidth() - this._rowMenuWidth - removedColWidth);
+ return proportion * (this.props.PanelWidth() - this._rowMenuWidth);
+ });
+ currWidths.splice(index, 1);
+ this.layoutDoc.columnWidths = new List<number>(currWidths);
};
@action
@@ -123,7 +141,6 @@ export class CollectionSchemaView extends CollectionSubView() {
return true;
};
- // @undoBatch
@action
finishResize = () => {
console.log('finished');