survey-analytics 1.10.4 → 1.10.6

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/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "lint": "eslint ./src --quiet",
21
21
  "pre-push-check": "npm run lint && npm run test"
22
22
  },
23
- "version": "1.10.4",
23
+ "version": "1.10.6",
24
24
  "name": "survey-analytics",
25
25
  "description": "SurveyJS analytics Library.",
26
26
  "main": "survey.analytics.js",
@@ -107,7 +107,7 @@
107
107
  "peerDependencies": {
108
108
  "@types/datatables.net": "^1.10.21",
109
109
  "@types/plotly.js-dist-min": "^2.3.0",
110
- "survey-core": "1.10.4"
110
+ "survey-core": "1.10.6"
111
111
  },
112
112
  "husky": {
113
113
  "hooks": {
@@ -19,11 +19,42 @@ export interface ITableOptions {
19
19
  displayValue: any;
20
20
  }) => void;
21
21
  }
22
+ export type TabulatorFilter = {
23
+ field: string;
24
+ type: string;
25
+ value: any;
26
+ };
27
+ export type TabulatorSortOrder = {
28
+ field: string;
29
+ direction: undefined | "asc" | "desc";
30
+ };
31
+ export type GetDataUsingCallbackFn = (params: {
32
+ filter?: Array<TabulatorFilter>;
33
+ sort?: Array<TabulatorSortOrder>;
34
+ offset?: number;
35
+ limit?: number;
36
+ callback?: (response: {
37
+ data: Array<Object>;
38
+ totalCount: number;
39
+ error?: any;
40
+ }) => void;
41
+ }) => void;
42
+ export type GetDataUsingPromiseFn = (params: {
43
+ filter?: Array<TabulatorFilter>;
44
+ sort?: Array<TabulatorSortOrder>;
45
+ offset?: number;
46
+ limit?: number;
47
+ }) => Promise<{
48
+ data: Array<Object>;
49
+ totalCount: number;
50
+ error?: any;
51
+ }>;
52
+ export type GetDataFn = GetDataUsingCallbackFn | GetDataUsingPromiseFn;
22
53
  export declare class TableEvent extends EventBase<Table> {
23
54
  }
24
55
  export declare abstract class Table {
25
56
  protected _survey: SurveyModel;
26
- protected data: Array<Object>;
57
+ protected data: Array<Object> | GetDataFn;
27
58
  protected _options: ITableOptions;
28
59
  protected _columnsData: Array<IColumnData>;
29
60
  static showFilesAsImages: boolean;
@@ -32,7 +63,7 @@ export declare abstract class Table {
32
63
  protected extensions: TableExtensions;
33
64
  private haveCommercialLicense;
34
65
  protected _columns: Array<IColumn>;
35
- constructor(_survey: SurveyModel, data: Array<Object>, _options?: ITableOptions, _columnsData?: Array<IColumnData>);
66
+ constructor(_survey: SurveyModel, data: Array<Object> | GetDataFn, _options?: ITableOptions, _columnsData?: Array<IColumnData>);
36
67
  protected renderResult: HTMLElement;
37
68
  protected currentPageSize: number;
38
69
  protected currentPageNumber: number;
@@ -46,7 +77,7 @@ export declare abstract class Table {
46
77
  onColumnsLocationChanged: TableEvent;
47
78
  onRowRemoved: TableEvent;
48
79
  renderDetailActions: (container: HTMLElement, row: TableRow) => HTMLElement;
49
- getData(): Object[];
80
+ getData(): Object[] | GetDataFn;
50
81
  get survey(): SurveyModel;
51
82
  get options(): ITableOptions;
52
83
  abstract applyFilter(value: string): void;
@@ -74,7 +105,8 @@ export declare abstract class Table {
74
105
  set columns(columns: Array<IColumn>);
75
106
  get isInitTableDataProcessing(): boolean;
76
107
  private isInitTableDataProcessingValue;
77
- protected initTableData(data: Array<any>): void;
108
+ protected processLoadedDataItem(item: any): any;
109
+ protected initTableData(data: Array<any> | GetDataFn): void;
78
110
  moveColumn(from: number, to: number): void;
79
111
  setColumnLocation(columnName: string, location: QuestionLocation): void;
80
112
  getColumnByName(columnName: string): IColumn;
@@ -19,11 +19,42 @@ export interface ITableOptions {
19
19
  displayValue: any;
20
20
  }) => void;
21
21
  }
22
+ export type TabulatorFilter = {
23
+ field: string;
24
+ type: string;
25
+ value: any;
26
+ };
27
+ export type TabulatorSortOrder = {
28
+ field: string;
29
+ direction: undefined | "asc" | "desc";
30
+ };
31
+ export type GetDataUsingCallbackFn = (params: {
32
+ filter?: Array<TabulatorFilter>;
33
+ sort?: Array<TabulatorSortOrder>;
34
+ offset?: number;
35
+ limit?: number;
36
+ callback?: (response: {
37
+ data: Array<Object>;
38
+ totalCount: number;
39
+ error?: any;
40
+ }) => void;
41
+ }) => void;
42
+ export type GetDataUsingPromiseFn = (params: {
43
+ filter?: Array<TabulatorFilter>;
44
+ sort?: Array<TabulatorSortOrder>;
45
+ offset?: number;
46
+ limit?: number;
47
+ }) => Promise<{
48
+ data: Array<Object>;
49
+ totalCount: number;
50
+ error?: any;
51
+ }>;
52
+ export type GetDataFn = GetDataUsingCallbackFn | GetDataUsingPromiseFn;
22
53
  export declare class TableEvent extends EventBase<Table> {
23
54
  }
24
55
  export declare abstract class Table {
25
56
  protected _survey: SurveyModel;
26
- protected data: Array<Object>;
57
+ protected data: Array<Object> | GetDataFn;
27
58
  protected _options: ITableOptions;
28
59
  protected _columnsData: Array<IColumnData>;
29
60
  static showFilesAsImages: boolean;
@@ -32,7 +63,7 @@ export declare abstract class Table {
32
63
  protected extensions: TableExtensions;
33
64
  private haveCommercialLicense;
34
65
  protected _columns: Array<IColumn>;
35
- constructor(_survey: SurveyModel, data: Array<Object>, _options?: ITableOptions, _columnsData?: Array<IColumnData>);
66
+ constructor(_survey: SurveyModel, data: Array<Object> | GetDataFn, _options?: ITableOptions, _columnsData?: Array<IColumnData>);
36
67
  protected renderResult: HTMLElement;
37
68
  protected currentPageSize: number;
38
69
  protected currentPageNumber: number;
@@ -46,7 +77,7 @@ export declare abstract class Table {
46
77
  onColumnsLocationChanged: TableEvent;
47
78
  onRowRemoved: TableEvent;
48
79
  renderDetailActions: (container: HTMLElement, row: TableRow) => HTMLElement;
49
- getData(): Object[];
80
+ getData(): Object[] | GetDataFn;
50
81
  get survey(): SurveyModel;
51
82
  get options(): ITableOptions;
52
83
  abstract applyFilter(value: string): void;
@@ -74,7 +105,8 @@ export declare abstract class Table {
74
105
  set columns(columns: Array<IColumn>);
75
106
  get isInitTableDataProcessing(): boolean;
76
107
  private isInitTableDataProcessingValue;
77
- protected initTableData(data: Array<any>): void;
108
+ protected processLoadedDataItem(item: any): any;
109
+ protected initTableData(data: Array<any> | GetDataFn): void;
78
110
  moveColumn(from: number, to: number): void;
79
111
  setColumnLocation(columnName: string, location: QuestionLocation): void;
80
112
  getColumnByName(columnName: string): IColumn;
@@ -1,4 +1,4 @@
1
- import { ITableOptions, Table, TableRow } from "./table";
1
+ import { GetDataFn, ITableOptions, Table, TableRow } from "./table";
2
2
  import { SurveyModel } from "survey-core";
3
3
  import { IColumnData, QuestionLocation } from "./config";
4
4
  interface ITabulatorOptions extends ITableOptions {
@@ -41,7 +41,7 @@ export declare const defaultDownloadOptions: {
41
41
  export declare const defaultOptions: ITabulatorOptions;
42
42
  export declare class Tabulator extends Table {
43
43
  static set haveCommercialLicense(val: boolean);
44
- constructor(survey: SurveyModel, data: Array<Object>, options?: ITabulatorOptions, _columnsData?: Array<IColumnData>);
44
+ constructor(survey: SurveyModel, data: Array<Object> | GetDataFn, options?: ITabulatorOptions, _columnsData?: Array<IColumnData>);
45
45
  private readonly COLUMN_MIN_WIDTH;
46
46
  tabulatorTables: any;
47
47
  private tableContainer;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS Dashboard library v1.10.4
2
+ * surveyjs - SurveyJS Dashboard library v1.10.6
3
3
  * Copyright (c) 2015-2024 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS Dashboard library v1.10.4
2
+ * surveyjs - SurveyJS Dashboard library v1.10.6
3
3
  * Copyright (c) 2015-2024 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: MIT (http://www.opensource.org/licenses/mit-license.php)
5
5
  */