dbgate-datalib 7.0.6 → 7.1.0

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.
@@ -1,7 +1,7 @@
1
1
  import { GridDisplay, ChangeCacheFunc, ChangeConfigFunc } from './GridDisplay';
2
2
  import type { EngineDriver, CollectionInfo } from 'dbgate-types';
3
3
  import { GridConfig, GridCache } from './GridConfig';
4
- export declare function analyseCollectionDisplayColumns(rows: any, display: any): any[];
4
+ export declare function analyseCollectionDisplayColumns(rows: any, display: any): any;
5
5
  export declare class CollectionGridDisplay extends GridDisplay {
6
6
  collection: CollectionInfo;
7
7
  constructor(collection: CollectionInfo, driver: EngineDriver, config: GridConfig, setConfig: ChangeConfigFunc, cache: GridCache, setCache: ChangeCacheFunc, loadedRows: any, changeSet: any, readOnly?: boolean, currentSettings?: any);
@@ -79,7 +79,7 @@ function getDisplayColumn(basePath, columnName, display) {
79
79
  };
80
80
  }
81
81
  function analyseCollectionDisplayColumns(rows, display) {
82
- var _a;
82
+ var _a, _b;
83
83
  const res = [];
84
84
  const addedColumns = (_a = display === null || display === void 0 ? void 0 : display.config) === null || _a === void 0 ? void 0 : _a.addedColumns;
85
85
  for (const row of rows || []) {
@@ -90,7 +90,9 @@ function analyseCollectionDisplayColumns(rows, display) {
90
90
  continue;
91
91
  res.push(getDisplayColumn([], added, display));
92
92
  }
93
- return (res.map(col => (Object.assign(Object.assign({}, col), { isChecked: display.isColumnChecked(col) }))) || []);
93
+ // Use driver-specific column sorting if available
94
+ const sortedColumns = ((_b = display === null || display === void 0 ? void 0 : display.driver) === null || _b === void 0 ? void 0 : _b.sortCollectionDisplayColumns) ? display.driver.sortCollectionDisplayColumns(res) : res;
95
+ return (sortedColumns.map(col => (Object.assign(Object.assign({}, col), { isChecked: display.isColumnChecked(col) }))) || []);
94
96
  }
95
97
  exports.analyseCollectionDisplayColumns = analyseCollectionDisplayColumns;
96
98
  class CollectionGridDisplay extends GridDisplay_1.GridDisplay {
@@ -4,7 +4,9 @@ import { GridConfig, GridCache } from './GridConfig';
4
4
  import { FreeTableModel } from './FreeTableModel';
5
5
  export declare class FreeTableGridDisplay extends GridDisplay {
6
6
  model: FreeTableModel;
7
- constructor(model: FreeTableModel, config: GridConfig, setConfig: ChangeConfigFunc, cache: GridCache, setCache: ChangeCacheFunc);
7
+ constructor(model: FreeTableModel, config: GridConfig, setConfig: ChangeConfigFunc, cache: GridCache, setCache: ChangeCacheFunc, options?: {
8
+ filterable?: boolean;
9
+ });
8
10
  getDisplayColumns(model: FreeTableModel): {
9
11
  isChecked: boolean;
10
12
  pureName: string;
@@ -5,17 +5,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.FreeTableGridDisplay = void 0;
7
7
  const lodash_1 = __importDefault(require("lodash"));
8
+ const dbgate_tools_1 = require("dbgate-tools");
8
9
  const GridDisplay_1 = require("./GridDisplay");
9
10
  const _1 = require(".");
10
11
  class FreeTableGridDisplay extends GridDisplay_1.GridDisplay {
11
- constructor(model, config, setConfig, cache, setCache) {
12
- var _a;
12
+ constructor(model, config, setConfig, cache, setCache, options = {}) {
13
+ var _a, _b;
13
14
  super(config, setConfig, cache, setCache);
14
15
  this.model = model;
15
16
  this.columns = ((_a = model === null || model === void 0 ? void 0 : model.structure) === null || _a === void 0 ? void 0 : _a.__isDynamicStructure)
16
17
  ? (0, _1.analyseCollectionDisplayColumns)(model === null || model === void 0 ? void 0 : model.rows, this)
17
18
  : this.getDisplayColumns(model);
18
- this.filterable = false;
19
+ this.filterable = (_b = options.filterable) !== null && _b !== void 0 ? _b : false;
20
+ this.filterBehaviourOverride = dbgate_tools_1.evalFilterBehaviour;
19
21
  this.sortable = false;
20
22
  }
21
23
  getDisplayColumns(model) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "7.0.6",
2
+ "version": "7.1.0",
3
3
  "name": "dbgate-datalib",
4
4
  "main": "lib/index.js",
5
5
  "typings": "lib/index.d.ts",
@@ -19,14 +19,14 @@
19
19
  ],
20
20
  "dependencies": {
21
21
  "date-fns": "^4.1.0",
22
- "dbgate-filterparser": "^7.0.6",
23
- "dbgate-sqltree": "^7.0.6",
24
- "dbgate-tools": "^7.0.6",
22
+ "dbgate-filterparser": "^7.1.0",
23
+ "dbgate-sqltree": "^7.1.0",
24
+ "dbgate-tools": "^7.1.0",
25
25
  "uuid": "^3.4.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^13.7.0",
29
- "dbgate-types": "^7.0.6",
29
+ "dbgate-types": "^7.1.0",
30
30
  "jest": "^28.1.3",
31
31
  "ts-jest": "^28.0.7",
32
32
  "typescript": "^4.4.3"