@@ -290,27 +291,17 @@ export default {
},
style() {
let style = ''
- for (const [key, val] of Object.entries(this.columnsWidth || {})) {
- if (val && key !== this.resizingCol) {
- style += `
- [data-col="${key}"]{
- min-width: ${val};
- max-width: ${val};
- width: ${val};
- }
- `
- } else if (key === this.resizingCol) {
- style += `
- [data-col="${key}"]{
- min-width: ${this.resizingColWidth};
- max-width: ${this.resizingColWidth};
- width: ${this.resizingColWidth};
- }
- `
+ for (const c of this.availableColumns) {
+ const val = (this.columnsWidth && this.columnsWidth[c.alias]) || (c.virtual ? '200px' : (columnStyling[c.uidt] && columnStyling[c.uidt].w))
+ if (val && c.key !== this.resizingCol) {
+ style += `[data-col="${c.alias}"]{min-width:${val};max-width:${val};width: ${val};}`
}
}
return style
+ },
+ resizeColStyle() {
+ return this.resizingCol ? ` [data-col="${this.resizingCol}"]{min-width:${this.resizingColWidth};max-width:${this.resizingColWidth};width:${this.resizingColWidth};}` : ''
}
},
watch: {
@@ -344,20 +335,20 @@ export default {
this.onCellValueChange(colIndex, rowIndex, columnObj)
},
calculateColumnWidth() {
- setTimeout(() => {
- const obj = {}
- this.meta && this.meta.columns && this.meta.columns.forEach((c) => {
- obj[c._cn] = (columnStyling[c.uidt] && columnStyling[c.uidt].w) || undefined
- })
- this.meta && this.meta.v && this.meta.v.forEach((v) => {
- obj[v._cn] = v.bt ? '100px' : '200px'
- })
- Array.from(this.$el.querySelectorAll('th')).forEach((el) => {
- const width = el.getBoundingClientRect().width
- obj[el.dataset.col] = obj[el.dataset.col] || ((width < 100 ? 100 : width) + 'px')
- })
- this.$emit('update:columnsWidth', { ...obj, ...(this.columnWidth || {}) })
- }, 500)
+ // setTimeout(() => {
+ // const obj = {}
+ // this.meta && this.meta.columns && this.meta.columns.forEach((c) => {
+ // obj[c._cn] = (columnStyling[c.uidt] && columnStyling[c.uidt].w) || undefined
+ // })
+ // this.meta && this.meta.v && this.meta.v.forEach((v) => {
+ // obj[v._cn] = v.bt ? '100px' : '200px'
+ // })
+ // Array.from(this.$el.querySelectorAll('th')).forEach((el) => {
+ // const width = el.getBoundingClientRect().width
+ // obj[el.dataset.col] = obj[el.dataset.col] || ((width < 100 ? 100 : width) + 'px')
+ // })
+ // this.$emit('update:columnsWidth', { ...obj, ...(this.columnWidth || {}) })
+ // }, 2000)
},
isCentrallyAligned(col) {
return !['SingleLineText',
@@ -372,7 +363,9 @@ export default {
'LastModifiedTime'].includes(col.uidt)
},
async xcAuditModelCommentsCount() {
- if (this.isPublicView || !this.data || !this.data.length) { return }
+ if (this.isPublicView || !this.data || !this.data.length) {
+ return
+ }
const aggCount = await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.nodes.dbAlias
}, 'xcAuditModelCommentsCount', {
@@ -386,23 +379,33 @@ export default {
},
onKeyDown(e) {
- if (this.selected.col === null || this.selected.row === null) { return }
+ if (this.selected.col === null || this.selected.row === null) {
+ return
+ }
switch (e.keyCode) {
// left
case 37:
- if (this.selected.col > 0) { this.selected.col-- }
+ if (this.selected.col > 0) {
+ this.selected.col--
+ }
break
// right
case 39:
- if (this.selected.col < this.colLength - 1) { this.selected.col++ }
+ if (this.selected.col < this.colLength - 1) {
+ this.selected.col++
+ }
break
// up
case 38:
- if (this.selected.row > 0) { this.selected.row-- }
+ if (this.selected.row > 0) {
+ this.selected.row--
+ }
break
// down
case 40:
- if (this.selected.row < this.rowLength - 1) { this.selected.row++ }
+ if (this.selected.row < this.rowLength - 1) {
+ this.selected.row++
+ }
break
// enter
case 13:
@@ -424,7 +427,9 @@ export default {
this.meta.columns &&
this.meta.columns[this.selected.col] &&
this.meta.columns[this.selected.col].virtual
- ) { return }
+ ) {
+ return
+ }
this.selected.col = null
this.selected.row = null
},
@@ -452,7 +457,9 @@ export default {
}
},
makeEditable(col, row) {
- if (this.isPublicView || !this.isEditable) { return }
+ if (this.isPublicView || !this.isEditable) {
+ return
+ }
if (this.availableColumns[col].ai) {
return this.$toast.info('Auto Increment field is not editable').goAway(3000)
}
@@ -777,8 +784,4 @@ th:first-child, td:first-child {
transform: rotate(90deg);
}
-th {
- min-width: 100px;
-}
-
diff --git a/packages/nc-gui/plugins/globalMixin.js b/packages/nc-gui/plugins/globalMixin.js
index c7497eee16..dd5b61e117 100644
--- a/packages/nc-gui/plugins/globalMixin.js
+++ b/packages/nc-gui/plugins/globalMixin.js
@@ -48,8 +48,6 @@ export default async({ store }) => {
el.appendChild(resizer)
resizer.addEventListener('mousedown', initDrag, false)
- el.style.transition = '20ms width0'
-
// eslint-disable-next-line no-unused-vars
let startX, startY, startWidth
@@ -76,10 +74,8 @@ export default async({ store }) => {
function doDrag(e) {
width = (startWidth + e.clientX - startX) + 'px'
- el.style.maxWidth = el.style.minWidth = el.style.width = width
+ el.style.width = width
emit(vnode, 'xcresizing', width)
- //
- // p.style.height = (startHeight + e.clientY - startY) + 'px';
}
function stopDrag(e) {
diff --git a/packages/nc-gui/plugins/ncApis/index.js b/packages/nc-gui/plugins/ncApis/index.js
index d264213714..8f7491a5e4 100644
--- a/packages/nc-gui/plugins/ncApis/index.js
+++ b/packages/nc-gui/plugins/ncApis/index.js
@@ -5,7 +5,7 @@ export default function({ store: $store, $axios, ...rest }, inject) {
let projectId = null
inject('ncApis', {
- get: ({ table, dbAlias, env }) => {
+ get: ({ table, dbAlias = 'db', env = 'dev' }) => {
if (!$store.state.meta.metas[table]) {
return
}
diff --git a/packages/nocodb/package-lock.json b/packages/nocodb/package-lock.json
index 4c32b33a2b..91d1f8deef 100644
--- a/packages/nocodb/package-lock.json
+++ b/packages/nocodb/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "nocodb",
- "version": "0.11.1",
+ "version": "0.11.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -11800,9 +11800,9 @@
"integrity": "sha512-3AryS9uwa5NfISLxMciUonrH7YfXp+nlahB9T7girXIsLQrmwX4MdnuKs32akduCOGpKmjTJSWmATULbuMkbfw=="
},
"nc-help": {
- "version": "0.2.7",
- "resolved": "https://registry.npmjs.org/nc-help/-/nc-help-0.2.7.tgz",
- "integrity": "sha512-31wxoJmfZHJ4aP/YiI+GgZRqwulyB6Z5BamcCUw/NDdNVoze+zHX0CtmoxfSlyi/U4zUOG9rhennKPv6QmmsMQ==",
+ "version": "0.2.8",
+ "resolved": "https://registry.npmjs.org/nc-help/-/nc-help-0.2.8.tgz",
+ "integrity": "sha512-h6HUWb2trYEVm7x2/hWxifeq+ZALCIFxZFISgpI/IQPhe/BSoGUNpcRIhWg8wt1y87kxZ7/VCkvTQUhW9OTOGg==",
"requires": {
"axios": "^0.21.1",
"boxen": "^4.2.0",
diff --git a/packages/nocodb/package.json b/packages/nocodb/package.json
index dcced24239..d4908b8a4e 100644
--- a/packages/nocodb/package.json
+++ b/packages/nocodb/package.json
@@ -144,7 +144,7 @@
"mysql2": "^2.2.5",
"nanoid": "^3.1.20",
"nc-common": "0.0.6",
- "nc-help": "^0.2.7",
+ "nc-help": "^0.2.8",
"nc-lib-gui": "^0.2.9",
"nc-plugin": "^0.1.1",
"nodemailer": "^6.4.10",
diff --git a/packages/nocodb/src/lib/noco/common/BaseApiBuilder.ts b/packages/nocodb/src/lib/noco/common/BaseApiBuilder.ts
index 58af3d5856..a7c6fa8398 100644
--- a/packages/nocodb/src/lib/noco/common/BaseApiBuilder.ts
+++ b/packages/nocodb/src/lib/noco/common/BaseApiBuilder.ts
@@ -474,10 +474,10 @@ export default abstract class BaseApiBuilder
implements XcDynami
// update lookup columns
this.metas[bt.rtn].v?.forEach(v => {
- if (v.tn === tn && v.cn === column.cno) {
+ if (v.lk && v.lk.ltn === tn && v.lk.lcn === column.cno) {
relationTableMetas.add(this.metas[bt.rtn])
- v.cn = column.cn;
- v._cn = column._cn;
+ v.lk.lcn = column.cn;
+ v.lk._lcn = column._cn;
}
})
}
@@ -503,10 +503,10 @@ export default abstract class BaseApiBuilder implements XcDynami
// update lookup columns
this.metas[hm.tn].v?.forEach(v => {
- if (v.tn === tn && v.cn === column.cno) {
+ if (v.lk && v.lk.ltn === tn && v.lk.lcn === column.cno) {
relationTableMetas.add(this.metas[hm.tn])
- v.cn = column.cn;
- v._cn = column._cn;
+ v.lk.lcn = column.cn;
+ v.lk._lcn = column._cn;
}
})
@@ -533,10 +533,10 @@ export default abstract class BaseApiBuilder implements XcDynami
// update lookup columns
this.metas[mm.rtn].v?.forEach(v => {
- if (v.tn === tn && v.cn === column.cno) {
+ if (v.lk &&v.lk.ltn === tn && v.lk.lcn === column.cno) {
relationTableMetas.add(this.metas[mm.tn])
- v.cn = column.cn;
- v._cn = column._cn;
+ v.lk.lcn = column.cn;
+ v.lk._lcn = column._cn;
}
})
@@ -598,7 +598,7 @@ export default abstract class BaseApiBuilder implements XcDynami
for (const bt of newMeta.belongsTo) {
// filter out lookup columns which maps to current col
this.metas[bt.rtn].v = this.metas[bt.rtn].v?.filter(v => {
- if (v.lookup && v.tn === tn && v.cn === column.cn) {
+ if (v.lk && v.lk.ltn === tn && v.lk.lcn === column.cn) {
relationTableMetas.add(this.metas[bt.rtn])
return false;
}
@@ -613,7 +613,7 @@ export default abstract class BaseApiBuilder implements XcDynami
for (const hm of newMeta.hasMany) {
// filter out lookup columns which maps to current col
this.metas[hm.tn].v = this.metas[hm.tn].v?.filter(v => {
- if (v.lookup && v.tn === tn && v.cn === column.cn) {
+ if (v.lk && v.lk.ltn === tn && v.lk.lcn === column.cn) {
relationTableMetas.add(this.metas[hm.tn])
return false;
}
@@ -627,7 +627,7 @@ export default abstract class BaseApiBuilder implements XcDynami
for (const mm of newMeta.manyToMany) {
// filter out lookup columns which maps to current col
this.metas[mm.rtn].v=this.metas[mm.rtn].v?.filter(v => {
- if (v.tn === tn && v.rcn === column.cn) {
+ if (v.lk && v.lk.ltn === tn && v.lk.lcn === column.cn) {
relationTableMetas.add(this.metas[mm.tn])
return false;
}
@@ -904,11 +904,11 @@ export default abstract class BaseApiBuilder implements XcDynami
// filter lookup and relation virtual columns
parentMeta.v = parentMeta.v.filter(({mm, ...rest}) => (!mm || !(mm.tn === parent && mm.rtn === child || mm.tn === child && mm.rtn === parent))
// check for lookup
- && !(rest.type === 'mm' && (rest.relation.tn === parent && rest.relation.rtn === child || rest.relation.tn === child && rest.relation.rtn === parent))
+ && !(rest.lk && rest.lk.type === 'mm' && (rest.lk.tn === parent && rest.lk.rtn === child || rest.lk.tn === child && rest.lk.rtn === parent))
)
childMeta.v = childMeta.v.filter(({mm, ...rest}) => (!mm || !(mm.tn === parent && mm.rtn === child || mm.tn === child && mm.rtn === parent))
// check for lookup
- && !(rest.type === 'mm' && (rest.relation.tn === parent && rest.relation.rtn === child || rest.relation.tn === child && rest.relation.rtn === parent))
+ && !(rest.lk && rest.lk.type === 'mm' && (rest.lk.tn === parent && rest.lk.rtn === child || rest.lk.tn === child && rest.lk.rtn === parent))
)
for (const meta of [parentMeta, childMeta]) {
diff --git a/packages/nocodb/src/lib/noco/gql/GqlApiBuilder.ts b/packages/nocodb/src/lib/noco/gql/GqlApiBuilder.ts
index be39e6776e..7df310e512 100644
--- a/packages/nocodb/src/lib/noco/gql/GqlApiBuilder.ts
+++ b/packages/nocodb/src/lib/noco/gql/GqlApiBuilder.ts
@@ -1380,8 +1380,8 @@ export class GqlApiBuilder extends BaseApiBuilder implements XcMetaMgr {
const oldMeta = JSON.parse(existingModel.meta);
Object.assign(oldMeta, {
hasMany: meta.hasMany,
- v: oldMeta.v.filter(({hm, lookup, relation, type}) => (!hm || hm.rtn !== tnp || hm.tn !== tnc) &&
- !(lookup && relation && type === 'hm' && relation.rtn === tnp && relation.tn === tnc))
+ v: oldMeta.v.filter(({hm, lk}) => (!hm || hm.rtn !== tnp || hm.tn !== tnc) &&
+ !(lk && lk.type === 'hm' && lk.rtn === tnp && lk.tn === tnc))
});
// todo: backup schema
await this.xcMeta.metaUpdate(this.projectId, this.dbAlias, 'nc_models', {
@@ -1430,8 +1430,8 @@ export class GqlApiBuilder extends BaseApiBuilder implements XcMetaMgr {
const oldMeta = JSON.parse(existingModel.meta);
Object.assign(oldMeta, {
belongsTo: meta.belongsTo,
- v: oldMeta.v.filter(({bt, lookup, relation, type}) => (!bt || bt.rtn !== tnp || bt.tn !== tnc) &&
- !(lookup && relation && type === 'bt' && relation.rtn === tnp && relation.tn === tnc))
+ v: oldMeta.v.filter(({bt, lk}) => (!bt || bt.rtn !== tnp || bt.tn !== tnc) &&
+ !(lk && lk.type === 'bt' && lk.rtn === tnp && lk.tn === tnc))
});
await this.xcMeta.metaUpdate(this.projectId, this.dbAlias, 'nc_models', {
title: tnc,
@@ -1963,3 +1963,5 @@ export class GqlApiBuilder extends BaseApiBuilder implements XcMetaMgr {
* along with this program. If not, see .
*
*/
+
+
diff --git a/packages/nocodb/src/lib/noco/rest/RestApiBuilder.ts b/packages/nocodb/src/lib/noco/rest/RestApiBuilder.ts
index cbc4e63009..9b4d33fa3f 100644
--- a/packages/nocodb/src/lib/noco/rest/RestApiBuilder.ts
+++ b/packages/nocodb/src/lib/noco/rest/RestApiBuilder.ts
@@ -1,4 +1,3 @@
-
import fs from 'fs';
import path from 'path';
@@ -34,7 +33,7 @@ const log = debug('nc:api:rest');
const NC_CUSTOM_ROUTE_KEY = '__xc_custom';
export class RestApiBuilder extends BaseApiBuilder {
- public readonly type='rest';
+ public readonly type = 'rest';
private controllers: { [key: string]: RestCtrlBelongsTo | RestCtrl | RestCtrlHasMany | RestCtrlCustom };
private procedureCtrl: RestCtrlProcedure;
private routers: { [key: string]: Router };
@@ -602,7 +601,7 @@ export class RestApiBuilder extends BaseApiBuilder {
public async onTableCreate(tn: string, args?: any): Promise {
- await super.onTableCreate(tn,args);
+ await super.onTableCreate(tn, args);
const columns = args.columns ? {
[tn]: args.columns?.map(({altered: _al, ...rest}) => rest)
@@ -1215,8 +1214,8 @@ export class RestApiBuilder extends BaseApiBuilder {
const oldMeta = JSON.parse(existingModel.meta);
Object.assign(oldMeta, {
hasMany: meta.hasMany,
- v: oldMeta.v.filter(({hm, lookup, relation, type}) => (!hm || hm.rtn !== tnp || hm.tn !== tnc) &&
- !(lookup && relation && type==='hm'&&relation.rtn === tnp && relation.tn === tnc ))
+ v: oldMeta.v.filter(({hm, lk}) => (!hm || hm.rtn !== tnp || hm.tn !== tnc) &&
+ !(lk && lk.type === 'hm' && lk.rtn === tnp && lk.tn === tnc))
});
// todo: delete from query_params
@@ -1252,8 +1251,8 @@ export class RestApiBuilder extends BaseApiBuilder {
Object.assign(oldMeta, {
belongsTo: meta.belongsTo,
- v: oldMeta.v.filter(({bt, relation, lookup,type}) => (!bt || bt.rtn !== tnp || bt.tn !== tnc) &&
- !(lookup && relation && type==='bt'&&relation.rtn === tnp && relation.tn === tnc ))
+ v: oldMeta.v.filter(({bt, lk}) => (!bt || bt.rtn !== tnp || bt.tn !== tnc) &&
+ !(lk && lk.type === 'bt' && lk.rtn === tnp && lk.tn === tnc))
});
// todo: delete from query_params
await this.xcMeta.metaUpdate(this.projectId,