dbgate-datalib 5.0.3 → 5.0.4-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -100,6 +100,7 @@ export declare abstract class GridDisplay {
100
100
  getChangeSetRow(row: any, insertedRowIndex: any): ChangeSetRowDefinition;
101
101
  createSelect(options?: {}): Select;
102
102
  processReferences(select: Select, displayedColumnInfo: DisplayedColumnInfo, options: any): void;
103
+ createColumnExpression(col: any, source: any, alias?: any): any;
103
104
  createSelectBase(name: NamedObjectInfo, columns: ColumnInfo[], options: any): Select;
104
105
  getRowNumberOverSelect(select: Select, offset: number, count: number): Select;
105
106
  getPageQuery(offset: number, count: number): Select;
@@ -339,6 +339,16 @@ class GridDisplay {
339
339
  return null;
340
340
  }
341
341
  processReferences(select, displayedColumnInfo, options) { }
342
+ createColumnExpression(col, source, alias) {
343
+ let expr = null;
344
+ if (this.dialect.createColumnViewExpression) {
345
+ expr = this.dialect.createColumnViewExpression(col.columnName, col.dataType, source, alias);
346
+ if (expr) {
347
+ return expr;
348
+ }
349
+ }
350
+ return Object.assign({ exprType: 'column', alias: alias || col.columnName, source }, col);
351
+ }
342
352
  createSelectBase(name, columns, options) {
343
353
  if (!columns)
344
354
  return null;
@@ -349,7 +359,7 @@ class GridDisplay {
349
359
  name: lodash_1.default.pick(name, ['schemaName', 'pureName']),
350
360
  alias: 'basetbl',
351
361
  },
352
- columns: columns.map(col => (Object.assign({ exprType: 'column', alias: col.columnName, source: { alias: 'basetbl' } }, col))),
362
+ columns: columns.map(col => this.createColumnExpression(col, { alias: 'basetbl' })),
353
363
  orderBy: [
354
364
  {
355
365
  exprType: 'column',
@@ -188,12 +188,7 @@ class TableGridDisplay extends GridDisplay_1.GridDisplay {
188
188
  addAddedColumnsToSelect(select, columns, parentAlias, displayedColumnInfo) {
189
189
  for (const column of columns) {
190
190
  if (this.addAllExpandedColumnsToSelected || this.config.addedColumns.includes(column.uniqueName)) {
191
- select.columns.push({
192
- exprType: 'column',
193
- columnName: column.columnName,
194
- alias: column.uniqueName,
195
- source: { name: column, alias: parentAlias },
196
- });
191
+ select.columns.push(this.createColumnExpression(column, { name: column, alias: parentAlias }, column.uniqueName));
197
192
  displayedColumnInfo[column.uniqueName] = Object.assign(Object.assign({}, column), { sourceAlias: parentAlias });
198
193
  }
199
194
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.0.3",
2
+ "version": "5.0.4-alpha.8",
3
3
  "name": "dbgate-datalib",
4
4
  "main": "lib/index.js",
5
5
  "typings": "lib/index.d.ts",
@@ -11,11 +11,11 @@
11
11
  "lib"
12
12
  ],
13
13
  "dependencies": {
14
- "dbgate-sqltree": "^5.0.3",
15
- "dbgate-filterparser": "^5.0.3"
14
+ "dbgate-sqltree": "^5.0.4-alpha.8",
15
+ "dbgate-filterparser": "^5.0.4-alpha.8"
16
16
  },
17
17
  "devDependencies": {
18
- "dbgate-types": "^5.0.3",
18
+ "dbgate-types": "^5.0.4-alpha.8",
19
19
  "@types/node": "^13.7.0",
20
20
  "typescript": "^4.4.3"
21
21
  }