aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
diff options
context:
space:
mode:
authormehekj <mehek.jethani@gmail.com>2022-11-14 10:22:29 -0500
committermehekj <mehek.jethani@gmail.com>2022-11-14 10:22:29 -0500
commitc3d7e526247dd6225af5146e93a0001d56a84c29 (patch)
treeca95eef5e516e8c486bfab28deecd12d5874c0f7 /src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
parenta73521cdbccf9bed1326d24522e133fad4a0de26 (diff)
added menu for creating new keys
Diffstat (limited to 'src/client/views/collections/collectionSchema/CollectionSchemaView.tsx')
-rw-r--r--src/client/views/collections/collectionSchema/CollectionSchemaView.tsx16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
index 7516b95b8..0466ce343 100644
--- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
+++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
@@ -79,26 +79,25 @@ export class CollectionSchemaView extends CollectionSubView() {
@undoBatch
@action
- changeColumnKey = (index: number, newKey: string) => {
+ changeColumnKey = (index: number, newKey: string, defaultVal?: any) => {
if (!this.documentKeys.includes(newKey)) {
- this.addNewKey(newKey);
+ this.addNewKey(newKey, defaultVal);
}
let currKeys = this.columnKeys;
currKeys[index] = newKey;
this.layoutDoc.columnKeys = new List<string>(currKeys);
- return true;
};
@undoBatch
@action
- addColumn = (index: number, key: string) => {
+ addColumn = (index: number, key: string, defaultVal?: any) => {
if (!this.documentKeys.includes(key)) {
- this.addNewKey(key);
+ this.addNewKey(key, defaultVal);
}
- const newColWidth = this._minColWidth;
let currWidths = this.storedColumnWidths;
+ const newColWidth = this.props.PanelWidth() / (currWidths.length + 1);
currWidths = currWidths.map(w => {
const proportion = w / (this.props.PanelWidth() - this._rowMenuWidth);
return proportion * (this.props.PanelWidth() - this._rowMenuWidth - newColWidth);
@@ -112,8 +111,9 @@ export class CollectionSchemaView extends CollectionSubView() {
};
@action
- addNewKey = (key: string) => {
- this.childDocs.forEach(doc => (doc[key] = key + ' default val'));
+ addNewKey = (key: string, defaultVal: any) => {
+ console.log(defaultVal);
+ this.childDocs.forEach(doc => (doc[key] = defaultVal));
};
@undoBatch