dbgate-datalib 5.2.7-alpha.1 → 5.2.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.
- package/lib/DataDuplicator.js +3 -3
- package/lib/FreeTableGridDisplay.d.ts +63 -0
- package/lib/FreeTableGridDisplay.js +32 -0
- package/lib/FreeTableModel.d.ts +16 -0
- package/lib/FreeTableModel.js +24 -0
- package/lib/GridConfig.d.ts +1 -1
- package/lib/GridDisplay.d.ts +2 -2
- package/lib/PerspectiveConfig.d.ts +2 -2
- package/lib/PerspectiveDataPattern.d.ts +2 -2
- package/lib/TableGridDisplay.d.ts +5 -1
- package/lib/ViewGridDisplay.d.ts +4 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/package.json +5 -5
package/lib/DataDuplicator.js
CHANGED
|
@@ -29,6 +29,9 @@ class DuplicatorReference {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
class DuplicatorItemHolder {
|
|
32
|
+
get name() {
|
|
33
|
+
return this.item.name;
|
|
34
|
+
}
|
|
32
35
|
constructor(item, duplicator) {
|
|
33
36
|
var _a, _b, _c, _d, _e;
|
|
34
37
|
this.item = item;
|
|
@@ -45,9 +48,6 @@ class DuplicatorItemHolder {
|
|
|
45
48
|
this.autoColumn = null;
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
|
-
get name() {
|
|
49
|
-
return this.item.name;
|
|
50
|
-
}
|
|
51
51
|
initializeReferences() {
|
|
52
52
|
var _a, _b;
|
|
53
53
|
for (const fk of this.table.foreignKeys) {
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { ColumnInfo } from 'dbgate-types';
|
|
2
|
+
import { GridDisplay, ChangeCacheFunc, ChangeConfigFunc } from './GridDisplay';
|
|
3
|
+
import { GridConfig, GridCache } from './GridConfig';
|
|
4
|
+
import { FreeTableModel } from './FreeTableModel';
|
|
5
|
+
export declare class FreeTableGridDisplay extends GridDisplay {
|
|
6
|
+
model: FreeTableModel;
|
|
7
|
+
constructor(model: FreeTableModel, config: GridConfig, setConfig: ChangeConfigFunc, cache: GridCache, setCache: ChangeCacheFunc);
|
|
8
|
+
getDisplayColumns(model: FreeTableModel): {
|
|
9
|
+
isChecked: boolean;
|
|
10
|
+
pureName: string;
|
|
11
|
+
schemaName: string;
|
|
12
|
+
headerText: string;
|
|
13
|
+
uniqueName: string;
|
|
14
|
+
uniquePath: string[];
|
|
15
|
+
pairingId?: string;
|
|
16
|
+
columnName: string;
|
|
17
|
+
notNull?: boolean;
|
|
18
|
+
autoIncrement?: boolean;
|
|
19
|
+
dataType: string;
|
|
20
|
+
precision?: number;
|
|
21
|
+
scale?: number;
|
|
22
|
+
length?: number;
|
|
23
|
+
computedExpression?: string;
|
|
24
|
+
isPersisted?: boolean;
|
|
25
|
+
isSparse?: boolean;
|
|
26
|
+
defaultValue?: string;
|
|
27
|
+
defaultConstraint?: string;
|
|
28
|
+
columnComment?: string;
|
|
29
|
+
isUnsigned?: boolean;
|
|
30
|
+
isZerofill?: boolean;
|
|
31
|
+
options?: [];
|
|
32
|
+
canSelectMultipleOptions?: boolean;
|
|
33
|
+
contentHash?: string;
|
|
34
|
+
engine?: string;
|
|
35
|
+
}[];
|
|
36
|
+
getDisplayColumn(col: ColumnInfo): {
|
|
37
|
+
pureName: string;
|
|
38
|
+
schemaName: string;
|
|
39
|
+
headerText: string;
|
|
40
|
+
uniqueName: string;
|
|
41
|
+
uniquePath: string[];
|
|
42
|
+
pairingId?: string;
|
|
43
|
+
columnName: string;
|
|
44
|
+
notNull?: boolean;
|
|
45
|
+
autoIncrement?: boolean;
|
|
46
|
+
dataType: string;
|
|
47
|
+
precision?: number;
|
|
48
|
+
scale?: number;
|
|
49
|
+
length?: number;
|
|
50
|
+
computedExpression?: string;
|
|
51
|
+
isPersisted?: boolean;
|
|
52
|
+
isSparse?: boolean;
|
|
53
|
+
defaultValue?: string;
|
|
54
|
+
defaultConstraint?: string;
|
|
55
|
+
columnComment?: string;
|
|
56
|
+
isUnsigned?: boolean;
|
|
57
|
+
isZerofill?: boolean;
|
|
58
|
+
options?: [];
|
|
59
|
+
canSelectMultipleOptions?: boolean;
|
|
60
|
+
contentHash?: string;
|
|
61
|
+
engine?: string;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FreeTableGridDisplay = void 0;
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const GridDisplay_1 = require("./GridDisplay");
|
|
9
|
+
const _1 = require(".");
|
|
10
|
+
class FreeTableGridDisplay extends GridDisplay_1.GridDisplay {
|
|
11
|
+
constructor(model, config, setConfig, cache, setCache) {
|
|
12
|
+
var _a;
|
|
13
|
+
super(config, setConfig, cache, setCache);
|
|
14
|
+
this.model = model;
|
|
15
|
+
this.columns = ((_a = model === null || model === void 0 ? void 0 : model.structure) === null || _a === void 0 ? void 0 : _a.__isDynamicStructure)
|
|
16
|
+
? (0, _1.analyseCollectionDisplayColumns)(model === null || model === void 0 ? void 0 : model.rows, this)
|
|
17
|
+
: this.getDisplayColumns(model);
|
|
18
|
+
this.filterable = false;
|
|
19
|
+
this.sortable = false;
|
|
20
|
+
}
|
|
21
|
+
getDisplayColumns(model) {
|
|
22
|
+
var _a, _b, _c;
|
|
23
|
+
return lodash_1.default.uniqBy(((_c = (_b = (_a = model === null || model === void 0 ? void 0 : model.structure) === null || _a === void 0 ? void 0 : _a.columns) === null || _b === void 0 ? void 0 : _b.map(col => this.getDisplayColumn(col))) === null || _c === void 0 ? void 0 : _c.map(col => (Object.assign(Object.assign({}, col), { isChecked: this.isColumnChecked(col) })))) || [], col => col.uniqueName);
|
|
24
|
+
}
|
|
25
|
+
getDisplayColumn(col) {
|
|
26
|
+
const uniquePath = [col.columnName];
|
|
27
|
+
const uniqueName = uniquePath.join('.');
|
|
28
|
+
return Object.assign(Object.assign({}, col), { pureName: 'data', schemaName: '', headerText: col.columnName, uniqueName,
|
|
29
|
+
uniquePath });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.FreeTableGridDisplay = FreeTableGridDisplay;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TableInfo } from 'dbgate-types';
|
|
2
|
+
export interface FreeTableModel {
|
|
3
|
+
structure: TableInfo;
|
|
4
|
+
rows: any[];
|
|
5
|
+
}
|
|
6
|
+
export declare function createFreeTableModel(): {
|
|
7
|
+
structure: {
|
|
8
|
+
columns: {
|
|
9
|
+
columnName: string;
|
|
10
|
+
}[];
|
|
11
|
+
foreignKeys: any[];
|
|
12
|
+
};
|
|
13
|
+
rows: {
|
|
14
|
+
col1: string;
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFreeTableModel = void 0;
|
|
4
|
+
function createFreeTableModel() {
|
|
5
|
+
return {
|
|
6
|
+
structure: {
|
|
7
|
+
columns: [
|
|
8
|
+
{
|
|
9
|
+
columnName: 'col1',
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
foreignKeys: [],
|
|
13
|
+
},
|
|
14
|
+
rows: [
|
|
15
|
+
{
|
|
16
|
+
col1: 'val1',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
col1: 'val2',
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
exports.createFreeTableModel = createFreeTableModel;
|
package/lib/GridConfig.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface GridReferenceDefinition {
|
|
|
11
11
|
refName: string;
|
|
12
12
|
}[];
|
|
13
13
|
}
|
|
14
|
-
export
|
|
14
|
+
export type GroupFunc = 'GROUP' | 'MAX' | 'MIN' | 'SUM' | 'AVG' | 'COUNT' | 'COUNT DISTINCT' | 'NULL';
|
|
15
15
|
export interface GridConfig extends GridConfigColumns {
|
|
16
16
|
filters: {
|
|
17
17
|
[uniqueName: string]: string;
|
package/lib/GridDisplay.d.ts
CHANGED
|
@@ -27,8 +27,8 @@ export interface DisplayedColumnEx extends DisplayColumn {
|
|
|
27
27
|
export interface DisplayedColumnInfo {
|
|
28
28
|
[uniqueName: string]: DisplayedColumnEx;
|
|
29
29
|
}
|
|
30
|
-
export
|
|
31
|
-
export
|
|
30
|
+
export type ChangeCacheFunc = (changeFunc: (cache: GridCache) => GridCache) => void;
|
|
31
|
+
export type ChangeConfigFunc = (changeFunc: (config: GridConfig) => GridConfig) => void;
|
|
32
32
|
export declare abstract class GridDisplay {
|
|
33
33
|
config: GridConfig;
|
|
34
34
|
protected setConfig: ChangeConfigFunc;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DatabaseInfo, ForeignKeyInfo } from 'dbgate-types';
|
|
2
|
-
export
|
|
2
|
+
export type PerspectiveDatabaseEngineType = 'sqldb' | 'docdb';
|
|
3
3
|
export interface PerspectiveDatabaseConfig {
|
|
4
4
|
conid: string;
|
|
5
5
|
database: string;
|
|
@@ -76,7 +76,7 @@ export declare function createPerspectiveConfig(rootObject?: {
|
|
|
76
76
|
schemaName?: string;
|
|
77
77
|
pureName: string;
|
|
78
78
|
}): PerspectiveConfig;
|
|
79
|
-
export
|
|
79
|
+
export type ChangePerspectiveConfigFunc = (changeFunc: (config: PerspectiveConfig) => PerspectiveConfig, reload?: boolean) => void;
|
|
80
80
|
export declare function extractPerspectiveDatabases({ conid, database }: {
|
|
81
81
|
conid: any;
|
|
82
82
|
database: any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type PerspectiveDataPatternColumnType = 'null' | 'oid' | 'string' | 'number' | 'boolean' | 'json';
|
|
2
2
|
export interface PerspectiveDataPatternColumn {
|
|
3
3
|
name: string;
|
|
4
4
|
types: PerspectiveDataPatternColumnType[];
|
|
@@ -11,7 +11,7 @@ export interface PerspectiveDataPattern {
|
|
|
11
11
|
pureName: string;
|
|
12
12
|
columns: PerspectiveDataPatternColumn[];
|
|
13
13
|
}
|
|
14
|
-
export
|
|
14
|
+
export type PerspectiveDataPatternDict = {
|
|
15
15
|
[designerId: string]: PerspectiveDataPattern;
|
|
16
16
|
};
|
|
17
17
|
export declare function analyseDataPattern(patternBase: Omit<PerspectiveDataPattern, 'columns'>, rows: any[]): PerspectiveDataPattern;
|
|
@@ -7,7 +7,7 @@ export interface DictionaryDescription {
|
|
|
7
7
|
columns: string[];
|
|
8
8
|
delimiter: string;
|
|
9
9
|
}
|
|
10
|
-
export
|
|
10
|
+
export type DictionaryDescriptionFunc = (table: TableInfo) => DictionaryDescription;
|
|
11
11
|
export declare class TableGridDisplay extends GridDisplay {
|
|
12
12
|
tableName: NamedObjectInfo;
|
|
13
13
|
displayOptions: any;
|
|
@@ -50,6 +50,8 @@ export declare class TableGridDisplay extends GridDisplay {
|
|
|
50
50
|
columnComment?: string;
|
|
51
51
|
isUnsigned?: boolean;
|
|
52
52
|
isZerofill?: boolean;
|
|
53
|
+
options?: [];
|
|
54
|
+
canSelectMultipleOptions?: boolean;
|
|
53
55
|
contentHash?: string;
|
|
54
56
|
engine?: string;
|
|
55
57
|
}[];
|
|
@@ -88,6 +90,8 @@ export declare class TableGridDisplay extends GridDisplay {
|
|
|
88
90
|
columnComment?: string;
|
|
89
91
|
isUnsigned?: boolean;
|
|
90
92
|
isZerofill?: boolean;
|
|
93
|
+
options?: [];
|
|
94
|
+
canSelectMultipleOptions?: boolean;
|
|
91
95
|
contentHash?: string;
|
|
92
96
|
engine?: string;
|
|
93
97
|
};
|
package/lib/ViewGridDisplay.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export declare class ViewGridDisplay extends GridDisplay {
|
|
|
27
27
|
columnComment?: string;
|
|
28
28
|
isUnsigned?: boolean;
|
|
29
29
|
isZerofill?: boolean;
|
|
30
|
+
options?: [];
|
|
31
|
+
canSelectMultipleOptions?: boolean;
|
|
30
32
|
contentHash?: string;
|
|
31
33
|
engine?: string;
|
|
32
34
|
}[];
|
|
@@ -52,6 +54,8 @@ export declare class ViewGridDisplay extends GridDisplay {
|
|
|
52
54
|
columnComment?: string;
|
|
53
55
|
isUnsigned?: boolean;
|
|
54
56
|
isZerofill?: boolean;
|
|
57
|
+
options?: [];
|
|
58
|
+
canSelectMultipleOptions?: boolean;
|
|
55
59
|
contentHash?: string;
|
|
56
60
|
engine?: string;
|
|
57
61
|
};
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -35,3 +35,5 @@ __exportStar(require("./PerspectiveDataPattern"), exports);
|
|
|
35
35
|
__exportStar(require("./PerspectiveDataLoader"), exports);
|
|
36
36
|
__exportStar(require("./perspectiveTools"), exports);
|
|
37
37
|
__exportStar(require("./DataDuplicator"), exports);
|
|
38
|
+
__exportStar(require("./FreeTableGridDisplay"), exports);
|
|
39
|
+
__exportStar(require("./FreeTableModel"), exports);
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "5.2.
|
|
2
|
+
"version": "5.2.8",
|
|
3
3
|
"name": "dbgate-datalib",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"typings": "lib/index.d.ts",
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"lib"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"dbgate-sqltree": "^5.2.
|
|
17
|
-
"dbgate-tools": "^5.2.
|
|
18
|
-
"dbgate-filterparser": "^5.2.
|
|
16
|
+
"dbgate-sqltree": "^5.2.8",
|
|
17
|
+
"dbgate-tools": "^5.2.8",
|
|
18
|
+
"dbgate-filterparser": "^5.2.8"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"dbgate-types": "^5.2.
|
|
21
|
+
"dbgate-types": "^5.2.8",
|
|
22
22
|
"@types/node": "^13.7.0",
|
|
23
23
|
"jest": "^28.1.3",
|
|
24
24
|
"ts-jest": "^28.0.7",
|