@quicdata/analytics 0.0.4 → 0.0.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/analytics.css +69 -0
- package/core/fetch-data.d.ts +2 -0
- package/core/fetch-data.d.ts.map +1 -1
- package/core/fetch-data.js +5 -0
- package/core/index.d.ts +3 -1
- package/core/index.d.ts.map +1 -1
- package/core/index.js +2 -1
- package/core/seed.d.ts +79 -0
- package/core/seed.d.ts.map +1 -0
- package/core/seed.js +34 -0
- package/filters/widget-toolbar.d.ts +4 -0
- package/filters/widget-toolbar.d.ts.map +1 -1
- package/filters/widget-toolbar.js +116 -82
- package/package.json +21 -2
- package/widgets/analytics-report.d.ts +2 -2
- package/widgets/analytics-report.d.ts.map +1 -1
- package/widgets/analytics-report.js +2 -2
- package/widgets/analytics-widget.d.ts +2 -2
- package/widgets/analytics-widget.d.ts.map +1 -1
- package/widgets/analytics-widget.js +2 -2
- package/widgets/base-chart.d.ts +6 -7
- package/widgets/base-chart.d.ts.map +1 -1
- package/widgets/base-chart.js +14 -25
- package/widgets/table.d.ts +5 -9
- package/widgets/table.d.ts.map +1 -1
- package/widgets/table.js +27 -46
- package/index.d.ts.map +0 -1
- package/workers/widget-transform.worker.d.ts +0 -21
- package/workers/widget-transform.worker.d.ts.map +0 -1
- package/workers/widget-transform.worker.js +0 -30
package/analytics.css
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @quicdata/analytics – default CSS variables
|
|
3
|
+
*
|
|
4
|
+
* Import this file once in your app (e.g. in your root layout or main entry):
|
|
5
|
+
* import '@quicdata/analytics/analytics.css';
|
|
6
|
+
*
|
|
7
|
+
* Override any variable in your own CSS by redefining it on :root or a
|
|
8
|
+
* container that wraps the analytics components.
|
|
9
|
+
*/
|
|
10
|
+
:root {
|
|
11
|
+
/* ----- Filter bar (dashboard & widget toolbar) ----- */
|
|
12
|
+
--analytics-filter-bar-bg: transparent;
|
|
13
|
+
--analytics-filter-bar-border: #e2e8f0;
|
|
14
|
+
--analytics-filter-bar-label-color: #475569;
|
|
15
|
+
--analytics-filter-bar-input-bg: #fff;
|
|
16
|
+
--analytics-filter-bar-input-border: #cbd5e1;
|
|
17
|
+
--analytics-filter-bar-input-color: inherit;
|
|
18
|
+
--analytics-filter-bar-close-color: #64748b;
|
|
19
|
+
--analytics-filter-bar-close-hover-bg: #f1f5f9;
|
|
20
|
+
--analytics-filter-bar-close-hover-color: #334155;
|
|
21
|
+
|
|
22
|
+
/* ----- Report (analytics-report) ----- */
|
|
23
|
+
--analytics-report-border: #e2e8f0;
|
|
24
|
+
--analytics-report-header-bg: #f8fafc;
|
|
25
|
+
--analytics-report-title-color: #1e293b;
|
|
26
|
+
--analytics-report-btn-border: #cbd5e1;
|
|
27
|
+
--analytics-report-btn-bg: #fff;
|
|
28
|
+
--analytics-report-btn-color: #334155;
|
|
29
|
+
--analytics-report-btn-hover-bg: #f1f5f9;
|
|
30
|
+
--analytics-report-btn-hover-color: #0f172a;
|
|
31
|
+
|
|
32
|
+
/* ----- Table widget ----- */
|
|
33
|
+
--table-font-size: 0.875rem;
|
|
34
|
+
--analytics-table-font-size: 0.875rem;
|
|
35
|
+
--analytics-table-border-color: #e5e7eb;
|
|
36
|
+
--analytics-table-header-bg: #f9fafb;
|
|
37
|
+
--analytics-table-header-color: #374151;
|
|
38
|
+
--analytics-table-row-hover-bg: #f9fafb;
|
|
39
|
+
--analytics-table-totals-bg: #f3f4f6;
|
|
40
|
+
--analytics-table-totals-border: #e5e7eb;
|
|
41
|
+
--analytics-table-error-color: #c00;
|
|
42
|
+
--analytics-table-empty-color: #6b7280;
|
|
43
|
+
--analytics-table-placeholder-color: #9ca3af;
|
|
44
|
+
--analytics-table-loading-overlay-bg: rgba(255, 255, 255, 0.65);
|
|
45
|
+
--analytics-table-spinner-border: #e5e7eb;
|
|
46
|
+
--analytics-table-spinner-accent: #3b82f6;
|
|
47
|
+
|
|
48
|
+
/* ----- Charts (base-chart, bar, line, pie) ----- */
|
|
49
|
+
--analytics-chart-title-color: #374151;
|
|
50
|
+
--analytics-chart-error-color: #c00;
|
|
51
|
+
--analytics-chart-loading-overlay-bg: rgba(255, 255, 255, 0.65);
|
|
52
|
+
--analytics-chart-spinner-border: #e5e7eb;
|
|
53
|
+
--analytics-chart-spinner-accent: #3b82f6;
|
|
54
|
+
|
|
55
|
+
/* ----- Widget toolbar (floating filter button + overlay) ----- */
|
|
56
|
+
--analytics-widget-toolbar-z-index: 20;
|
|
57
|
+
--analytics-widget-toolbar-bg: rgba(0, 0, 0, 0.55);
|
|
58
|
+
--analytics-widget-toolbar-border: rgba(255, 255, 255, 0.1);
|
|
59
|
+
--analytics-widget-toolbar-color: rgba(255, 255, 255, 0.9);
|
|
60
|
+
--analytics-widget-toolbar-hover-bg: rgba(255, 255, 255, 0.15);
|
|
61
|
+
--analytics-widget-toolbar-badge-bg: #3b82f6;
|
|
62
|
+
--analytics-widget-toolbar-badge-color: #fff;
|
|
63
|
+
/* Overlay (filter dialog backdrop) */
|
|
64
|
+
--analytics-widget-toolbar-overlay-z-index: 1000;
|
|
65
|
+
--analytics-widget-toolbar-overlay-bg: rgba(0, 0, 0, 0.35);
|
|
66
|
+
--analytics-widget-toolbar-overlay-backdrop-filter: blur(2px);
|
|
67
|
+
/* Dialog (filter panel) */
|
|
68
|
+
--analytics-widget-toolbar-dialog-z-index: 1;
|
|
69
|
+
}
|
package/core/fetch-data.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import type { AnalyticsDataResponse, FilterDefinition } from './types.js';
|
|
|
3
3
|
export declare function buildWidgetDataUrl(apiUrl: string, widgetId: string | number): string;
|
|
4
4
|
/** Build widget definition URL. Path: /widgets/{id} (no data). */
|
|
5
5
|
export declare function buildWidgetDefinitionUrl(apiUrl: string, widgetId: string | number): string;
|
|
6
|
+
/** Build dataset data URL from API base and dataset id. Path: /datasets/{id}/data */
|
|
7
|
+
export declare function buildDatasetDataUrl(apiUrl: string, datasetId: string | number): string;
|
|
6
8
|
/** Build report definition URL. GET /reports/definitions/{id} */
|
|
7
9
|
export declare function buildReportDefinitionUrl(apiUrl: string, reportId: string | number): string;
|
|
8
10
|
/** Build report filters URL (with optional query params for context). GET /reports/definitions/{id}/filters */
|
package/core/fetch-data.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-data.d.ts","sourceRoot":"","sources":["../../../../libs/analytics/src/core/fetch-data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAG1E,kGAAkG;AAClG,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAGpF;AAED,kEAAkE;AAClE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAG1F;AAQD,iEAAiE;AACjE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAE1F;AAED,+GAA+G;AAC/G,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GAAG,MAAM,EACzB,MAAM,CAAC,EAAE,sBAAsB,GAC9B,MAAM,CAUR;AAED,kGAAkG;AAClG,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GAAG,MAAM,EACzB,MAAM,CAAC,EAAE,sBAAsB,GAC9B,MAAM,CAUR;AAED,6EAA6E;AAC7E,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GAAG,MAAM,EACzB,MAAM,CAAC,EAAE,sBAAsB,GAC9B,MAAM,CAUR;AAED,uEAAuE;AACvE,wBAAgB,iBAAiB,CAC/B,MAAM,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AC;AAmBF;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,sBAAsB,GAC9B,OAAO,CAAC,qBAAqB,CAAC,CAehC;AAED,iHAAiH;AACjH,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACjC,IAAI,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;IACtD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wFAAwF;IACxF,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,sBAAsB,GAC9B,OAAO,CAAC,qBAAqB,CAAC,CAmBhC"}
|
package/core/fetch-data.js
CHANGED
|
@@ -9,6 +9,11 @@ export function buildWidgetDefinitionUrl(apiUrl, widgetId) {
|
|
|
9
9
|
const base = (apiUrl || '').replace(/\/$/, '');
|
|
10
10
|
return `${base}/widgets/${widgetId}`;
|
|
11
11
|
}
|
|
12
|
+
/** Build dataset data URL from API base and dataset id. Path: /datasets/{id}/data */
|
|
13
|
+
export function buildDatasetDataUrl(apiUrl, datasetId) {
|
|
14
|
+
const base = (apiUrl || '').replace(/\/$/, '');
|
|
15
|
+
return `${base}/datasets/${datasetId}/data`;
|
|
16
|
+
}
|
|
12
17
|
/** Report definition base path. Path: /reports/definitions/{id} */
|
|
13
18
|
function reportDefinitionBase(apiUrl, reportId) {
|
|
14
19
|
const base = (apiUrl || '').replace(/\/$/, '');
|
package/core/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export { setAnalyticsApiKey, getAnalyticsApiKey, getAnalyticsRequestInit } from './auth.js';
|
|
2
|
-
export { buildWidgetDataUrl, buildWidgetDefinitionUrl, fetchAnalyticsData, fetchWidgetData, fetchWidgetDefinition, buildReportDefinitionUrl, buildReportFiltersUrl, buildReportPreviewUrl, buildReportPdfUrl, buildReportExcelUrl, fetchReportDefinition, fetchReportFilters, } from './fetch-data.js';
|
|
2
|
+
export { buildWidgetDataUrl, buildWidgetDefinitionUrl, buildDatasetDataUrl, fetchAnalyticsData, fetchWidgetData, fetchWidgetDefinition, buildReportDefinitionUrl, buildReportFiltersUrl, buildReportPreviewUrl, buildReportPdfUrl, buildReportExcelUrl, fetchReportDefinition, fetchReportFilters, } from './fetch-data.js';
|
|
3
3
|
export type { AnalyticsRequestParams, WidgetDataApiResponse, WidgetChartType, WidgetDefinitionApiResponse, WidgetDefinitionSubset, ReportDefinitionApiResponse, ReportDefinitionResult, } from './fetch-data.js';
|
|
4
4
|
export type { AnalyticsDataResponse, AnalyticsDataMeta, WidgetDataResponse, WidgetDataOptions, DatetimeGranularity, DimensionRef, MeasureRef, FilterItem, FilterDefinition, FilterOption, CommonChartConfig, BarChartConfig, LineChartConfig, DonutPieChartConfig, NumberKpiChartConfig, TableChartConfig, ChartType, WidgetDefinitionConfig, LazyWidgetOptions, WorkerWidgetOptions, } from './types.js';
|
|
5
5
|
export { observeViewport } from './viewport-observer.js';
|
|
6
6
|
export type { ViewportObserverOptions, ViewportObserverCallbacks } from './viewport-observer.js';
|
|
7
7
|
export { runWidgetTransform } from './widget-transform-runner.js';
|
|
8
8
|
export type { WidgetTransformInput, WidgetTransformOptions } from './widget-transform-runner.js';
|
|
9
|
+
export { seedWidget, seedReport, seedDashboardChild, seedDashboard, seedDataset } from './seed.js';
|
|
10
|
+
export type { SeedId, SeedWidgetConfig, SeedReportConfig, SeedDashboardChildConfig, SeedDashboardConfig, SeedDatasetConfig, } from './seed.js';
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
package/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../libs/analytics/src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAC5F,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,EACf,2BAA2B,EAC3B,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,SAAS,EACT,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,YAAY,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,YAAY,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../libs/analytics/src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAA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sApiKey, getAnalyticsRequestInit } from './auth.js';
|
|
2
|
-
export { buildWidgetDataUrl, buildWidgetDefinitionUrl, fetchAnalyticsData, fetchWidgetData, fetchWidgetDefinition, buildReportDefinitionUrl, buildReportFiltersUrl, buildReportPreviewUrl, buildReportPdfUrl, buildReportExcelUrl, fetchReportDefinition, fetchReportFilters, } from './fetch-data.js';
|
|
2
|
+
export { buildWidgetDataUrl, buildWidgetDefinitionUrl, buildDatasetDataUrl, fetchAnalyticsData, fetchWidgetData, fetchWidgetDefinition, buildReportDefinitionUrl, buildReportFiltersUrl, buildReportPreviewUrl, buildReportPdfUrl, buildReportExcelUrl, fetchReportDefinition, fetchReportFilters, } from './fetch-data.js';
|
|
3
3
|
export { observeViewport } from './viewport-observer.js';
|
|
4
4
|
export { runWidgetTransform } from './widget-transform-runner.js';
|
|
5
|
+
export { seedWidget, seedReport, seedDashboardChild, seedDashboard, seedDataset } from './seed.js';
|
package/core/seed.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seed helpers: build minimal config objects using a predefined id (numeric or string).
|
|
3
|
+
* Use these to seed widget, report, dashboard, or dataset config with a simple id.
|
|
4
|
+
*/
|
|
5
|
+
export type SeedId = string | number;
|
|
6
|
+
/** Config for <analytics-widget>: widgetId + apiUrl and optional overrides. */
|
|
7
|
+
export interface SeedWidgetConfig {
|
|
8
|
+
widgetId: SeedId;
|
|
9
|
+
apiUrl: string;
|
|
10
|
+
title?: string;
|
|
11
|
+
dataParams?: Record<string, string | number | boolean>;
|
|
12
|
+
lazy?: boolean;
|
|
13
|
+
prefetchMargin?: string;
|
|
14
|
+
}
|
|
15
|
+
/** Config for <analytics-report>: reportId + apiUrl and optional overrides. */
|
|
16
|
+
export interface SeedReportConfig {
|
|
17
|
+
reportId: SeedId;
|
|
18
|
+
apiUrl: string;
|
|
19
|
+
customTitle?: string;
|
|
20
|
+
dataParams?: Record<string, string | number | boolean>;
|
|
21
|
+
}
|
|
22
|
+
/** Config for a single dashboard widget (child). */
|
|
23
|
+
export interface SeedDashboardChildConfig {
|
|
24
|
+
widgetId: SeedId;
|
|
25
|
+
type?: string;
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
w: number;
|
|
29
|
+
h: number;
|
|
30
|
+
title?: string;
|
|
31
|
+
lazy?: boolean;
|
|
32
|
+
prefetch_margin?: string;
|
|
33
|
+
}
|
|
34
|
+
/** Config for <analytics-dashboard>: apiUrl + children (each with id) and optional overrides. */
|
|
35
|
+
export interface SeedDashboardConfig {
|
|
36
|
+
apiUrl: string;
|
|
37
|
+
column?: number;
|
|
38
|
+
children?: SeedDashboardChildConfig[];
|
|
39
|
+
filters?: Array<{
|
|
40
|
+
param_name: string;
|
|
41
|
+
label?: string;
|
|
42
|
+
type?: string;
|
|
43
|
+
default_value?: unknown;
|
|
44
|
+
}>;
|
|
45
|
+
hide_filter?: boolean;
|
|
46
|
+
refresh_rate?: number;
|
|
47
|
+
}
|
|
48
|
+
/** Config for dataset-based table/chart: datasetId + apiUrl (builds data URL /datasets/{id}/data). */
|
|
49
|
+
export interface SeedDatasetConfig {
|
|
50
|
+
datasetId: SeedId;
|
|
51
|
+
apiUrl: string;
|
|
52
|
+
dataParams?: Record<string, string | number | boolean>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Seed config for a single widget. Id can be numeric (e.g. 1) or string.
|
|
56
|
+
*/
|
|
57
|
+
export declare function seedWidget(id: SeedId, apiUrl: string, overrides?: Partial<SeedWidgetConfig>): SeedWidgetConfig;
|
|
58
|
+
/**
|
|
59
|
+
* Seed config for a report. Id can be numeric (e.g. 1) or string.
|
|
60
|
+
*/
|
|
61
|
+
export declare function seedReport(id: SeedId, apiUrl: string, overrides?: Partial<SeedReportConfig>): SeedReportConfig;
|
|
62
|
+
/**
|
|
63
|
+
* Seed config for a dashboard child (one widget in the grid). Id can be numeric.
|
|
64
|
+
*/
|
|
65
|
+
export declare function seedDashboardChild(id: SeedId, type: string, position: {
|
|
66
|
+
x: number;
|
|
67
|
+
y: number;
|
|
68
|
+
w: number;
|
|
69
|
+
h: number;
|
|
70
|
+
}, overrides?: Partial<SeedDashboardChildConfig>): SeedDashboardChildConfig;
|
|
71
|
+
/**
|
|
72
|
+
* Seed config for a dashboard. Children use numeric (or string) ids.
|
|
73
|
+
*/
|
|
74
|
+
export declare function seedDashboard(apiUrl: string, children: SeedDashboardChildConfig[], overrides?: Partial<SeedDashboardConfig>): SeedDashboardConfig;
|
|
75
|
+
/**
|
|
76
|
+
* Seed config for a dataset (data URL = /datasets/{id}/data). Id can be numeric.
|
|
77
|
+
*/
|
|
78
|
+
export declare function seedDataset(id: SeedId, apiUrl: string, overrides?: Partial<SeedDatasetConfig>): SeedDatasetConfig;
|
|
79
|
+
//# sourceMappingURL=seed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seed.d.ts","sourceRoot":"","sources":["../../../../libs/analytics/src/core/seed.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAErC,+EAA+E;AAC/E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IACvD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,+EAA+E;AAC/E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC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,CAAC,GAAG,gBAAgB,CAE9G;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EACxD,SAAS,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAC5C,wBAAwB,CAE1B;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,wBAAwB,EAAE,EAAE,SAAS,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAEjJ;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,iBAAiB,CAEjH"}
|
package/core/seed.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seed helpers: build minimal config objects using a predefined id (numeric or string).
|
|
3
|
+
* Use these to seed widget, report, dashboard, or dataset config with a simple id.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Seed config for a single widget. Id can be numeric (e.g. 1) or string.
|
|
7
|
+
*/
|
|
8
|
+
export function seedWidget(id, apiUrl, overrides) {
|
|
9
|
+
return { widgetId: id, apiUrl, ...overrides };
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Seed config for a report. Id can be numeric (e.g. 1) or string.
|
|
13
|
+
*/
|
|
14
|
+
export function seedReport(id, apiUrl, overrides) {
|
|
15
|
+
return { reportId: id, apiUrl, ...overrides };
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Seed config for a dashboard child (one widget in the grid). Id can be numeric.
|
|
19
|
+
*/
|
|
20
|
+
export function seedDashboardChild(id, type, position, overrides) {
|
|
21
|
+
return { widgetId: id, type, x: position.x, y: position.y, w: position.w, h: position.h, ...overrides };
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Seed config for a dashboard. Children use numeric (or string) ids.
|
|
25
|
+
*/
|
|
26
|
+
export function seedDashboard(apiUrl, children, overrides) {
|
|
27
|
+
return { apiUrl, children, ...overrides };
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Seed config for a dataset (data URL = /datasets/{id}/data). Id can be numeric.
|
|
31
|
+
*/
|
|
32
|
+
export function seedDataset(id, apiUrl, overrides) {
|
|
33
|
+
return { datasetId: id, apiUrl, ...overrides };
|
|
34
|
+
}
|
|
@@ -10,6 +10,10 @@ export declare class AnalyticsWidgetToolbar extends LitElement {
|
|
|
10
10
|
values: Record<string, string | number | boolean>;
|
|
11
11
|
activeCount: number;
|
|
12
12
|
private _dialogOpen;
|
|
13
|
+
private _portalRoot;
|
|
14
|
+
updated(changed: Map<string, unknown>): void;
|
|
15
|
+
disconnectedCallback(): void;
|
|
16
|
+
private _renderOverlayPortal;
|
|
13
17
|
private _onFilterIconClick;
|
|
14
18
|
private _onDialogClose;
|
|
15
19
|
private _onFilterChange;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget-toolbar.d.ts","sourceRoot":"","sources":["../../../../libs/analytics/src/filters/widget-toolbar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"widget-toolbar.d.ts","sourceRoot":"","sources":["../../../../libs/analytics/src/filters/widget-toolbar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAiEzD;;;GAGG;AACH,qBACa,sBAAuB,SAAQ,UAAU;IACpD,OAAgB,MAAM,0BA8DpB;IAEyB,OAAO,EAAE,gBAAgB,EAAE,CAAM;IAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAM;IACvD,WAAW,SAAK;IAEnC,OAAO,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,WAAW,CAA4B;IAEtC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAc5C,oBAAoB,IAAI,IAAI;IAQrC,OAAO,CAAC,oBAAoB;IA+B5B,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,iBAAiB;IAIhB,MAAM;CAsBhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,0BAA0B,EAAE,sBAAsB,CAAC;KACpD;CACF"}
|
|
@@ -1,7 +1,69 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { LitElement, html, css } from 'lit';
|
|
3
|
+
import { render } from 'lit';
|
|
3
4
|
import { customElement, property, state } from 'lit/decorators.js';
|
|
4
5
|
import { EVENT_FILTER_CHANGE, EVENT_FILTER_CLOSE } from './filter-bar.js';
|
|
6
|
+
/** Overlay/dialog styles for the body portal (no :host). */
|
|
7
|
+
const overlayPortalStyles = css `
|
|
8
|
+
.overlay {
|
|
9
|
+
position: fixed;
|
|
10
|
+
inset: 0;
|
|
11
|
+
z-index: var(--analytics-widget-toolbar-overlay-z-index, 1000);
|
|
12
|
+
background: var(--analytics-widget-toolbar-overlay-bg, rgba(0, 0, 0, 0.35));
|
|
13
|
+
backdrop-filter: var(--analytics-widget-toolbar-overlay-backdrop-filter, blur(2px));
|
|
14
|
+
-webkit-backdrop-filter: var(--analytics-widget-toolbar-overlay-backdrop-filter, blur(2px));
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: flex-start;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
padding: 2rem;
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
}
|
|
21
|
+
.dialog {
|
|
22
|
+
position: relative;
|
|
23
|
+
z-index: var(--analytics-widget-toolbar-dialog-z-index, 1);
|
|
24
|
+
background: #fff;
|
|
25
|
+
border-radius: 12px;
|
|
26
|
+
border: 1px solid #e2e8f0;
|
|
27
|
+
box-shadow: 0 24px 48px rgba(0, 0, 0, 0.12);
|
|
28
|
+
min-width: 320px;
|
|
29
|
+
max-width: 90vw;
|
|
30
|
+
max-height: 85vh;
|
|
31
|
+
overflow: auto;
|
|
32
|
+
}
|
|
33
|
+
.dialog-close {
|
|
34
|
+
position: absolute;
|
|
35
|
+
top: 0.5rem;
|
|
36
|
+
right: 0.5rem;
|
|
37
|
+
display: inline-flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
width: 2rem;
|
|
41
|
+
height: 2rem;
|
|
42
|
+
padding: 0;
|
|
43
|
+
color: #64748b;
|
|
44
|
+
background: transparent;
|
|
45
|
+
border: none;
|
|
46
|
+
border-radius: 6px;
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
z-index: calc(var(--analytics-widget-toolbar-dialog-z-index, 1) + 1);
|
|
49
|
+
}
|
|
50
|
+
.dialog-close:hover {
|
|
51
|
+
background: #f1f5f9;
|
|
52
|
+
color: #334155;
|
|
53
|
+
}
|
|
54
|
+
.dialog-body {
|
|
55
|
+
padding: 2.5rem 2.5rem 1rem 1rem;
|
|
56
|
+
--analytics-filter-bar-bg: transparent;
|
|
57
|
+
--analytics-filter-bar-border: transparent;
|
|
58
|
+
--analytics-filter-bar-label-color: #475569;
|
|
59
|
+
--analytics-filter-bar-input-bg: #fff;
|
|
60
|
+
--analytics-filter-bar-input-border: #cbd5e1;
|
|
61
|
+
--analytics-filter-bar-input-color: inherit;
|
|
62
|
+
--analytics-filter-bar-close-color: #64748b;
|
|
63
|
+
--analytics-filter-bar-close-hover-bg: #f1f5f9;
|
|
64
|
+
--analytics-filter-bar-close-hover-color: #334155;
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
5
67
|
/**
|
|
6
68
|
* Floating widget toolbar: glass-style bar at top-right, visible on hover.
|
|
7
69
|
* Contains filter icon; click opens a dialog with the filter form.
|
|
@@ -13,13 +75,14 @@ let AnalyticsWidgetToolbar = class AnalyticsWidgetToolbar extends LitElement {
|
|
|
13
75
|
this.values = {};
|
|
14
76
|
this.activeCount = 0;
|
|
15
77
|
this._dialogOpen = false;
|
|
78
|
+
this._portalRoot = null;
|
|
16
79
|
}
|
|
17
80
|
static { this.styles = css `
|
|
18
81
|
:host {
|
|
19
82
|
position: absolute;
|
|
20
83
|
top: 0.5rem;
|
|
21
84
|
right: 0.5rem;
|
|
22
|
-
z-index: 20;
|
|
85
|
+
z-index: var(--analytics-widget-toolbar-z-index, 20);
|
|
23
86
|
opacity: 0;
|
|
24
87
|
transition: opacity 0.2s ease;
|
|
25
88
|
pointer-events: none;
|
|
@@ -76,64 +139,58 @@ let AnalyticsWidgetToolbar = class AnalyticsWidgetToolbar extends LitElement {
|
|
|
76
139
|
color: #fff;
|
|
77
140
|
border-radius: 9999px;
|
|
78
141
|
}
|
|
79
|
-
.overlay {
|
|
80
|
-
position: fixed;
|
|
81
|
-
inset: 0;
|
|
82
|
-
z-index: 1000;
|
|
83
|
-
background: rgba(0, 0, 0, 0.35);
|
|
84
|
-
backdrop-filter: blur(2px);
|
|
85
|
-
display: flex;
|
|
86
|
-
align-items: flex-start;
|
|
87
|
-
justify-content: center;
|
|
88
|
-
padding: 2rem;
|
|
89
|
-
box-sizing: border-box;
|
|
90
|
-
}
|
|
91
|
-
.dialog {
|
|
92
|
-
position: relative;
|
|
93
|
-
background: #fff;
|
|
94
|
-
border-radius: 12px;
|
|
95
|
-
border: 1px solid #e2e8f0;
|
|
96
|
-
box-shadow: 0 24px 48px rgba(0, 0, 0, 0.12);
|
|
97
|
-
min-width: 320px;
|
|
98
|
-
max-width: 90vw;
|
|
99
|
-
max-height: 85vh;
|
|
100
|
-
overflow: auto;
|
|
101
|
-
}
|
|
102
|
-
.dialog-close {
|
|
103
|
-
position: absolute;
|
|
104
|
-
top: 0.5rem;
|
|
105
|
-
right: 0.5rem;
|
|
106
|
-
display: inline-flex;
|
|
107
|
-
align-items: center;
|
|
108
|
-
justify-content: center;
|
|
109
|
-
width: 2rem;
|
|
110
|
-
height: 2rem;
|
|
111
|
-
padding: 0;
|
|
112
|
-
color: #64748b;
|
|
113
|
-
background: transparent;
|
|
114
|
-
border: none;
|
|
115
|
-
border-radius: 6px;
|
|
116
|
-
cursor: pointer;
|
|
117
|
-
z-index: 1;
|
|
118
|
-
}
|
|
119
|
-
.dialog-close:hover {
|
|
120
|
-
background: #f1f5f9;
|
|
121
|
-
color: #334155;
|
|
122
|
-
}
|
|
123
|
-
.dialog-body {
|
|
124
|
-
padding: 2.5rem 2.5rem 1rem 1rem;
|
|
125
|
-
/* Light mode: use filter-bar defaults (light bg, dark text) */
|
|
126
|
-
--analytics-filter-bar-bg: transparent;
|
|
127
|
-
--analytics-filter-bar-border: transparent;
|
|
128
|
-
--analytics-filter-bar-label-color: #475569;
|
|
129
|
-
--analytics-filter-bar-input-bg: #fff;
|
|
130
|
-
--analytics-filter-bar-input-border: #cbd5e1;
|
|
131
|
-
--analytics-filter-bar-input-color: inherit;
|
|
132
|
-
--analytics-filter-bar-close-color: #64748b;
|
|
133
|
-
--analytics-filter-bar-close-hover-bg: #f1f5f9;
|
|
134
|
-
--analytics-filter-bar-close-hover-color: #334155;
|
|
135
|
-
}
|
|
136
142
|
`; }
|
|
143
|
+
updated(changed) {
|
|
144
|
+
if (this._dialogOpen) {
|
|
145
|
+
if (!this._portalRoot) {
|
|
146
|
+
this._portalRoot = document.createElement('div');
|
|
147
|
+
this._portalRoot.className = 'analytics-widget-toolbar-portal';
|
|
148
|
+
document.body.appendChild(this._portalRoot);
|
|
149
|
+
}
|
|
150
|
+
render(this._renderOverlayPortal(), this._portalRoot);
|
|
151
|
+
}
|
|
152
|
+
else if (this._portalRoot) {
|
|
153
|
+
this._portalRoot.remove();
|
|
154
|
+
this._portalRoot = null;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
disconnectedCallback() {
|
|
158
|
+
if (this._portalRoot?.parentNode) {
|
|
159
|
+
this._portalRoot.remove();
|
|
160
|
+
this._portalRoot = null;
|
|
161
|
+
}
|
|
162
|
+
super.disconnectedCallback();
|
|
163
|
+
}
|
|
164
|
+
_renderOverlayPortal() {
|
|
165
|
+
return html `
|
|
166
|
+
<style>${overlayPortalStyles}</style>
|
|
167
|
+
<div
|
|
168
|
+
class="overlay"
|
|
169
|
+
role="dialog"
|
|
170
|
+
aria-modal="true"
|
|
171
|
+
aria-label="Filters"
|
|
172
|
+
@click=${this._onDialogClose}
|
|
173
|
+
>
|
|
174
|
+
<div class="dialog" @click=${(e) => e.stopPropagation()}>
|
|
175
|
+
<button type="button" class="dialog-close" aria-label="Close" @click=${this._onDialogClose}>
|
|
176
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
177
|
+
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
178
|
+
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
179
|
+
</svg>
|
|
180
|
+
</button>
|
|
181
|
+
<div class="dialog-body">
|
|
182
|
+
<analytics-filter-bar
|
|
183
|
+
.filters=${this.filters}
|
|
184
|
+
.values=${this.values}
|
|
185
|
+
.showClose=${false}
|
|
186
|
+
@analytics-filter-change=${this._onFilterChange}
|
|
187
|
+
@analytics-filter-close=${this._onFilterBarClose}
|
|
188
|
+
></analytics-filter-bar>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
192
|
+
`;
|
|
193
|
+
}
|
|
137
194
|
_onFilterIconClick() {
|
|
138
195
|
this._dialogOpen = true;
|
|
139
196
|
}
|
|
@@ -142,6 +199,7 @@ let AnalyticsWidgetToolbar = class AnalyticsWidgetToolbar extends LitElement {
|
|
|
142
199
|
this.dispatchEvent(new CustomEvent(EVENT_FILTER_CLOSE, { bubbles: true, composed: true }));
|
|
143
200
|
}
|
|
144
201
|
_onFilterChange(e) {
|
|
202
|
+
e.stopPropagation();
|
|
145
203
|
this.dispatchEvent(new CustomEvent(EVENT_FILTER_CHANGE, {
|
|
146
204
|
bubbles: true,
|
|
147
205
|
composed: true,
|
|
@@ -171,30 +229,6 @@ let AnalyticsWidgetToolbar = class AnalyticsWidgetToolbar extends LitElement {
|
|
|
171
229
|
${this.activeCount > 0 ? html `<span class="badge">${this.activeCount}</span>` : ''}
|
|
172
230
|
</button>
|
|
173
231
|
</div>
|
|
174
|
-
|
|
175
|
-
${this._dialogOpen
|
|
176
|
-
? html `
|
|
177
|
-
<div class="overlay" role="dialog" aria-modal="true" aria-label="Filters" @click=${this._onDialogClose}>
|
|
178
|
-
<div class="dialog" @click=${(e) => e.stopPropagation()}>
|
|
179
|
-
<button type="button" class="dialog-close" aria-label="Close" @click=${this._onDialogClose}>
|
|
180
|
-
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
181
|
-
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
182
|
-
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
183
|
-
</svg>
|
|
184
|
-
</button>
|
|
185
|
-
<div class="dialog-body">
|
|
186
|
-
<analytics-filter-bar
|
|
187
|
-
.filters=${this.filters}
|
|
188
|
-
.values=${this.values}
|
|
189
|
-
.showClose=${false}
|
|
190
|
-
@analytics-filter-change=${this._onFilterChange}
|
|
191
|
-
@analytics-filter-close=${this._onFilterBarClose}
|
|
192
|
-
></analytics-filter-bar>
|
|
193
|
-
</div>
|
|
194
|
-
</div>
|
|
195
|
-
</div>
|
|
196
|
-
`
|
|
197
|
-
: ''}
|
|
198
232
|
`;
|
|
199
233
|
}
|
|
200
234
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quicdata/analytics",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
7
7
|
"types": "index.d.ts",
|
|
8
|
+
"style": "analytics.css",
|
|
8
9
|
"exports": {
|
|
9
10
|
"./package.json": "./package.json",
|
|
11
|
+
"./analytics.css": "./analytics.css",
|
|
10
12
|
".": {
|
|
11
13
|
"types": "./index.d.ts",
|
|
12
14
|
"import": "./index.js",
|
|
@@ -39,6 +41,16 @@
|
|
|
39
41
|
"lit": "^3.3.0",
|
|
40
42
|
"tslib": "^2.3.0"
|
|
41
43
|
},
|
|
44
|
+
"files": [
|
|
45
|
+
"*.js",
|
|
46
|
+
"*.d.ts",
|
|
47
|
+
"*.css",
|
|
48
|
+
"core",
|
|
49
|
+
"widgets",
|
|
50
|
+
"dashboard",
|
|
51
|
+
"designer",
|
|
52
|
+
"filters"
|
|
53
|
+
],
|
|
42
54
|
"nx": {
|
|
43
55
|
"targets": {
|
|
44
56
|
"build": {
|
|
@@ -47,7 +59,14 @@
|
|
|
47
59
|
"main": "libs/analytics/src/index.ts",
|
|
48
60
|
"outputPath": "dist/libs/analytics",
|
|
49
61
|
"tsConfig": "libs/analytics/tsconfig.lib.json",
|
|
50
|
-
"rootDir": "libs/analytics/src"
|
|
62
|
+
"rootDir": "libs/analytics/src",
|
|
63
|
+
"assets": [
|
|
64
|
+
{
|
|
65
|
+
"input": "libs/analytics/src",
|
|
66
|
+
"glob": "analytics.css",
|
|
67
|
+
"output": "."
|
|
68
|
+
}
|
|
69
|
+
]
|
|
51
70
|
}
|
|
52
71
|
}
|
|
53
72
|
}
|
|
@@ -8,8 +8,8 @@ import './table.js';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class AnalyticsReport extends LitElement {
|
|
10
10
|
static styles: import("lit").CSSResult;
|
|
11
|
-
/** Report definition id (used with apiUrl to load definition and preview). */
|
|
12
|
-
reportId: string;
|
|
11
|
+
/** Report definition id (used with apiUrl to load definition and preview). Accepts string or number for seeding. */
|
|
12
|
+
reportId: string | number;
|
|
13
13
|
/** API base URL (e.g. /api/analytics). */
|
|
14
14
|
apiUrl: string;
|
|
15
15
|
/** Optional title override. When set (non-empty), overrides report name from definition. Use attribute "custom-title" to avoid native title. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics-report.d.ts","sourceRoot":"","sources":["../../../../libs/analytics/src/widgets/analytics-report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,OAAO,EAAE,MAAM,KAAK,CAAC;AAYrD,OAAO,0BAA0B,CAAC;AAClC,OAAO,YAAY,CAAC;AAEpB;;;;GAIG;AACH,qBACa,eAAgB,SAAQ,UAAU;IAC7C,OAAgB,MAAM,0BAyFpB;IAEF,
|
|
1
|
+
{"version":3,"file":"analytics-report.d.ts","sourceRoot":"","sources":["../../../../libs/analytics/src/widgets/analytics-report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,OAAO,EAAE,MAAM,KAAK,CAAC;AAYrD,OAAO,0BAA0B,CAAC;AAClC,OAAO,YAAY,CAAC;AAEpB;;;;GAIG;AACH,qBACa,eAAgB,SAAQ,UAAU;IAC7C,OAAgB,MAAM,0BAyFpB;IAEF,oHAAoH;IACxD,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAEtF,0CAA0C;IACgB,MAAM,EAAE,MAAM,CAAC;IAEzE,gJAAgJ;IACjF,WAAW,EAAE,MAAM,CAAC;IAEnF,6DAA6D;IACzB,KAAK,EAAE,MAAM,CAAC;IAElD,sEAAsE;IAClC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IAE1F,QAAyB,KAAK,CAAS;IACvC,QAAyB,QAAQ,CAAqB;IACtD,QAAyB,OAAO,CAA4C;IAC5E,QAAyB,eAAe,CAAS;IACjD,QAAyB,WAAW,CAAS;IAC7C,QAAyB,aAAa,CAAS;IAC/C,QAAyB,QAAQ,CAAU;IAC3C,QAAyB,MAAM,CAAgB;;IAmBtC,iBAAiB,IAAI,IAAI;IAKzB,oBAAoB,IAAI,IAAI;IAK5B,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;YAevC,WAAW;IAwBzB,wJAAwJ;IACxJ,OAAO,CAAC,+BAA+B;IAWvC,OAAO,CAAC,eAAe;IAMvB,OAAO,KAAK,QAAQ,GAGnB;IAED,OAAO,KAAK,WAAW,GAItB;IAED,OAAO,KAAK,OAAO,GAIlB;IAED,OAAO,KAAK,SAAS,GAIpB;IAED,OAAO,CAAC,MAAM;IAIL,MAAM;CAiDhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,kBAAkB,EAAE,eAAe,CAAC;KACrC;CACF"}
|
|
@@ -126,7 +126,7 @@ let AnalyticsReport = class AnalyticsReport extends LitElement {
|
|
|
126
126
|
this.removeEventListener(EVENT_FILTER_CHANGE, this._onFilterChange);
|
|
127
127
|
}
|
|
128
128
|
updated(changed) {
|
|
129
|
-
if (!this.apiUrl || !this.reportId || this._loading)
|
|
129
|
+
if (!this.apiUrl || (this.reportId !== 0 && !this.reportId) || this._loading)
|
|
130
130
|
return;
|
|
131
131
|
if (changed.has('reportId') || changed.has('apiUrl')) {
|
|
132
132
|
this._name = '';
|
|
@@ -142,7 +142,7 @@ let AnalyticsReport = class AnalyticsReport extends LitElement {
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
async _loadReport() {
|
|
145
|
-
if (!this.apiUrl || !this.reportId || this._loading)
|
|
145
|
+
if (!this.apiUrl || (this.reportId !== 0 && !this.reportId) || this._loading)
|
|
146
146
|
return;
|
|
147
147
|
this._loading = true;
|
|
148
148
|
this._error = null;
|
|
@@ -11,8 +11,8 @@ import './table.js';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare class AnalyticsWidget extends LitElement {
|
|
13
13
|
static styles: import("lit").CSSResult;
|
|
14
|
-
/** Widget id (used with apiUrl to load definition and data). */
|
|
15
|
-
widgetId: string;
|
|
14
|
+
/** Widget id (used with apiUrl to load definition and data). Accepts string or number for seeding. */
|
|
15
|
+
widgetId: string | number;
|
|
16
16
|
/** API base URL (e.g. /api/analytics). Used with widgetId to fetch definition and data. */
|
|
17
17
|
apiUrl: string;
|
|
18
18
|
/** Optional title override. When unset, the inner widget uses the title from the definition. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics-widget.d.ts","sourceRoot":"","sources":["../../../../libs/analytics/src/widgets/analytics-widget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,OAAO,EAAE,MAAM,KAAK,CAAC;AAIrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,gBAAgB,CAAC;AACxB,OAAO,iBAAiB,CAAC;AACzB,OAAO,gBAAgB,CAAC;AACxB,OAAO,YAAY,CAAC;AAapB;;;;GAIG;AACH,qBACa,eAAgB,SAAQ,UAAU;IAC7C,OAAgB,MAAM,0BAmCpB;IAEF,
|
|
1
|
+
{"version":3,"file":"analytics-widget.d.ts","sourceRoot":"","sources":["../../../../libs/analytics/src/widgets/analytics-widget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,OAAO,EAAE,MAAM,KAAK,CAAC;AAIrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,gBAAgB,CAAC;AACxB,OAAO,iBAAiB,CAAC;AACzB,OAAO,gBAAgB,CAAC;AACxB,OAAO,YAAY,CAAC;AAapB;;;;GAIG;AACH,qBACa,eAAgB,SAAQ,UAAU;IAC7C,OAAgB,MAAM,0BAmCpB;IAEF,sGAAsG;IAC1C,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAEtF,2FAA2F;IACjC,MAAM,EAAE,MAAM,CAAC;IAEzE,gGAAgG;IAC5D,KAAK,EAAE,MAAM,CAAC;IAElD,gEAAgE;IAC5B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IAE1F,2EAA2E;IACvC,SAAS,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAEzE,4EAA4E;IACvC,IAAI,EAAE,OAAO,CAAC;IAEnD,yEAAyE;IACP,cAAc,EAAE,MAAM,CAAC;IAEzF,QAAyB,UAAU,CAAuB;IAC1D,QAAyB,WAAW,CAAgC;IACpE,QAAyB,QAAQ,CAAU;IAC3C,QAAyB,MAAM,CAAgB;;IAiBtC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;YAWvC,eAAe;IAqB7B,OAAO,KAAK,SAAS,GAGpB;IAED,OAAO,CAAC,kBAAkB;IA8DjB,MAAM;CAgBhB"}
|
|
@@ -74,7 +74,7 @@ let AnalyticsWidget = class AnalyticsWidget extends LitElement {
|
|
|
74
74
|
this._error = null;
|
|
75
75
|
}
|
|
76
76
|
updated(changed) {
|
|
77
|
-
if (!this.apiUrl || !this.widgetId || this._loading)
|
|
77
|
+
if (!this.apiUrl || (this.widgetId !== 0 && !this.widgetId) || this._loading)
|
|
78
78
|
return;
|
|
79
79
|
if (changed.has('widgetId') || changed.has('apiUrl')) {
|
|
80
80
|
this._chartType = '';
|
|
@@ -86,7 +86,7 @@ let AnalyticsWidget = class AnalyticsWidget extends LitElement {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
async _loadDefinition() {
|
|
89
|
-
if (!this.apiUrl || !this.widgetId || this._loading)
|
|
89
|
+
if (!this.apiUrl || (this.widgetId !== 0 && !this.widgetId) || this._loading)
|
|
90
90
|
return;
|
|
91
91
|
this._loading = true;
|
|
92
92
|
this._error = null;
|
package/widgets/base-chart.d.ts
CHANGED
|
@@ -16,7 +16,8 @@ export declare abstract class BaseChartWidget extends LitElement {
|
|
|
16
16
|
/** API URL to fetch data (e.g. /api/analytics/widgets/1/data). When widgetId + apiUrl are set, this is overridden by buildWidgetDataUrl(apiUrl, widgetId). */
|
|
17
17
|
dataUrl: string;
|
|
18
18
|
/** Widget id (used with apiUrl to build data URL: /widgets/{id}/data). */
|
|
19
|
-
|
|
19
|
+
/** Widget id (with apiUrl builds data URL). Accepts string or number for seeding. */
|
|
20
|
+
widgetId: string | number;
|
|
20
21
|
/** API base URL (host + prefix, e.g. /api/analytics). Used with widgetId to build data URL. */
|
|
21
22
|
apiUrl: string;
|
|
22
23
|
/** Query params for data-url (e.g. date_from, date_to). Widget params override dashboard params for same key. */
|
|
@@ -50,14 +51,12 @@ export declare abstract class BaseChartWidget extends LitElement {
|
|
|
50
51
|
private _hideFilter;
|
|
51
52
|
private _widgetData;
|
|
52
53
|
private _chart;
|
|
53
|
-
private _resizeObserver;
|
|
54
|
-
private _resizeDelayId;
|
|
55
|
-
private _resizeDebounceId;
|
|
56
54
|
private _dashboardEl;
|
|
57
|
-
|
|
55
|
+
private _resizeObserver;
|
|
56
|
+
/** Single debounce: each resize cancels previous, then we wait and call chart.resize() once. */
|
|
57
|
+
private _resizeTimeoutId;
|
|
58
|
+
/** Delay (ms) after last resize event before calling chart.resize(). */
|
|
58
59
|
private static readonly _RESIZE_DELAY_MS;
|
|
59
|
-
/** Debounce (ms) after delay; resize runs only when no signal for this long. */
|
|
60
|
-
private static readonly _RESIZE_DEBOUNCE_MS;
|
|
61
60
|
private _viewportVisible;
|
|
62
61
|
/** Title from widget definition (API). Optional `title` attribute overrides this. */
|
|
63
62
|
private _definitionTitle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-chart.d.ts","sourceRoot":"","sources":["../../../../libs/analytics/src/widgets/base-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAErD,OAA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,OAAO,CAAC,GAAG,IAAI;IA0CrD,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,gBAAgB;IASf,YAAY,IAAI,IAAI;IAoC7B,OAAO,CAAC,oBAAoB;IAO5B,gFAAgF;IAChF,OAAO,KAAK,eAAe,GAE1B;IAED,6FAA6F;IAC7F,OAAO,CAAC,MAAM;IAQd,OAAO,CAAC,mBAAmB;YA2Bb,SAAS;IAiFvB,OAAO,CAAC,YAAY;IAuBpB;;;;OAIG;IACH,WAAW,CACT,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,EACxC,WAAW,CAAC,EAAE,OAAO,GACpB,aAAa;IAShB,OAAO,CAAC,qBAAqB;IAIpB,MAAM;CAiChB"}
|
package/widgets/base-chart.js
CHANGED
|
@@ -101,20 +101,18 @@ export class BaseChartWidget extends LitElement {
|
|
|
101
101
|
min-height: 100px;
|
|
102
102
|
}
|
|
103
103
|
`; }
|
|
104
|
-
/**
|
|
104
|
+
/** Delay (ms) after last resize event before calling chart.resize(). */
|
|
105
105
|
static { this._RESIZE_DELAY_MS = 300; }
|
|
106
|
-
/** Debounce (ms) after delay; resize runs only when no signal for this long. */
|
|
107
|
-
static { this._RESIZE_DEBOUNCE_MS = 300; }
|
|
108
106
|
constructor() {
|
|
109
107
|
super();
|
|
110
108
|
this._loadGeneration = 0;
|
|
111
109
|
this._loadDataScheduled = false;
|
|
112
110
|
this._ignoreNextFilterChange = false;
|
|
113
111
|
this._chart = null;
|
|
114
|
-
this._resizeObserver = null;
|
|
115
|
-
this._resizeDelayId = null;
|
|
116
|
-
this._resizeDebounceId = null;
|
|
117
112
|
this._dashboardEl = null;
|
|
113
|
+
this._resizeObserver = null;
|
|
114
|
+
/** Single debounce: each resize cancels previous, then we wait and call chart.resize() once. */
|
|
115
|
+
this._resizeTimeoutId = null;
|
|
118
116
|
this._hasLoadedOnce = false;
|
|
119
117
|
this._viewportUnobserve = null;
|
|
120
118
|
this._boundOnDashboardFilterChange = (e) => {
|
|
@@ -157,9 +155,9 @@ export class BaseChartWidget extends LitElement {
|
|
|
157
155
|
this._viewportUnobserve?.();
|
|
158
156
|
this._viewportUnobserve = null;
|
|
159
157
|
this._detachDashboard();
|
|
160
|
-
if (this.
|
|
161
|
-
clearTimeout(this.
|
|
162
|
-
this.
|
|
158
|
+
if (this._resizeTimeoutId != null) {
|
|
159
|
+
clearTimeout(this._resizeTimeoutId);
|
|
160
|
+
this._resizeTimeoutId = null;
|
|
163
161
|
}
|
|
164
162
|
this._resizeObserver?.disconnect();
|
|
165
163
|
this._chart?.dispose();
|
|
@@ -227,16 +225,13 @@ export class BaseChartWidget extends LitElement {
|
|
|
227
225
|
const container = this.renderRoot.querySelector('.chart');
|
|
228
226
|
if (container) {
|
|
229
227
|
this._resizeObserver = new ResizeObserver(() => {
|
|
230
|
-
if (this.
|
|
231
|
-
clearTimeout(this.
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
this.
|
|
235
|
-
this.
|
|
236
|
-
this.
|
|
237
|
-
this._resizeDebounceId = null;
|
|
238
|
-
this._chart?.resize();
|
|
239
|
-
}, BaseChartWidget._RESIZE_DEBOUNCE_MS);
|
|
228
|
+
if (this._resizeTimeoutId != null) {
|
|
229
|
+
clearTimeout(this._resizeTimeoutId);
|
|
230
|
+
this._resizeTimeoutId = null;
|
|
231
|
+
}
|
|
232
|
+
this._resizeTimeoutId = setTimeout(() => {
|
|
233
|
+
this._resizeTimeoutId = null;
|
|
234
|
+
this._chart?.resize();
|
|
240
235
|
}, BaseChartWidget._RESIZE_DELAY_MS);
|
|
241
236
|
});
|
|
242
237
|
this._resizeObserver.observe(container);
|
|
@@ -307,12 +302,6 @@ export class BaseChartWidget extends LitElement {
|
|
|
307
302
|
async _loadData() {
|
|
308
303
|
if (this.lazy && !this._viewportVisible)
|
|
309
304
|
return;
|
|
310
|
-
if (this.data != null && !this.widgetId) {
|
|
311
|
-
this._error = null;
|
|
312
|
-
this._loading = false;
|
|
313
|
-
this._renderChart();
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
305
|
const dataUrl = this._getEffectiveDataUrl();
|
|
317
306
|
if (!dataUrl) {
|
|
318
307
|
this._error = null;
|
package/widgets/table.d.ts
CHANGED
|
@@ -15,7 +15,8 @@ export declare class TableWidget extends LitElement {
|
|
|
15
15
|
/** API URL to fetch data (e.g. /api/analytics/widgets/1/data). When widgetId + apiUrl are set, overridden by buildWidgetDataUrl(apiUrl, widgetId). */
|
|
16
16
|
dataUrl: string;
|
|
17
17
|
/** Widget id (used with apiUrl to build data URL: /widgets/{id}/data). */
|
|
18
|
-
|
|
18
|
+
/** Widget id (with apiUrl builds data URL). Accepts string or number for seeding. */
|
|
19
|
+
widgetId: string | number;
|
|
19
20
|
/** API base URL (host + prefix, e.g. /api/analytics). Used with widgetId to build data URL. */
|
|
20
21
|
apiUrl: string;
|
|
21
22
|
/** Query params for data-url (e.g. date_from, date_to). Widget params override dashboard params for same key. */
|
|
@@ -42,25 +43,20 @@ export declare class TableWidget extends LitElement {
|
|
|
42
43
|
private _error;
|
|
43
44
|
private _loadGeneration;
|
|
44
45
|
private _loadDataDebounceId;
|
|
46
|
+
private _loadDataScheduled;
|
|
45
47
|
private _loadDataInFlight;
|
|
46
|
-
private
|
|
48
|
+
private _loadDataPendingRefresh;
|
|
47
49
|
private _dashboardParams;
|
|
48
50
|
private _widgetFilters;
|
|
49
51
|
private _widgetFilterParams;
|
|
50
52
|
private _hideFilter;
|
|
51
53
|
private _dashboardEl;
|
|
54
|
+
private _ignoreNextFilterChange;
|
|
52
55
|
private _viewportVisible;
|
|
53
56
|
/** Title from widget definition (API). Optional `title` attribute overrides this. */
|
|
54
57
|
private _definitionTitle;
|
|
55
58
|
private _hasLoadedOnce;
|
|
56
59
|
private _viewportUnobserve;
|
|
57
|
-
private _resizeObserver;
|
|
58
|
-
private _resizeDelayId;
|
|
59
|
-
private _resizeDebounceId;
|
|
60
|
-
/** Initial delay (ms) before entering debounce; each new resize signal cancels and restarts. */
|
|
61
|
-
private static readonly _RESIZE_DELAY_MS;
|
|
62
|
-
/** Debounce (ms) after delay; resize runs only when no signal for this long. */
|
|
63
|
-
private static readonly _RESIZE_DEBOUNCE_MS;
|
|
64
60
|
constructor();
|
|
65
61
|
private _boundOnDashboardFilterChange;
|
|
66
62
|
private _boundOnDashboardRefresh;
|
package/widgets/table.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../libs/analytics/src/widgets/table.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAGrD,OAAO,KAAK,EAA0B,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAM5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAM9E,OAAO,qBAAqB,CAAC;AAE7B;;;;;GAKG;AACH,qBACa,WAAY,SAAQ,UAAU;IACzC,OAAgB,MAAM,0BA+HpB;IAEF,8FAA8F;IAC1D,KAAK,EAAE,MAAM,CAAC;IAElD,sJAAsJ;IAC3F,OAAO,EAAE,MAAM,CAAC;IAE3E,0EAA0E;
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../libs/analytics/src/widgets/table.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAGrD,OAAO,KAAK,EAA0B,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAM5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAM9E,OAAO,qBAAqB,CAAC;AAE7B;;;;;GAKG;AACH,qBACa,WAAY,SAAQ,UAAU;IACzC,OAAgB,MAAM,0BA+HpB;IAEF,8FAA8F;IAC1D,KAAK,EAAE,MAAM,CAAC;I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OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,kBAAkB,CAA6B;;IAyBvD,OAAO,CAAC,6BAA6B,CAInC;IACF,OAAO,CAAC,wBAAwB,CAG9B;IAEO,iBAAiB,IAAI,IAAI;IAKzB,oBAAoB,IAAI,IAAI;IAW5B,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAuCrD,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,gBAAgB;IASf,YAAY,IAAI,IAAI;IAqB7B,sHAAsH;IACtH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CAAM;IAEpD,yGAAyG;IACzG,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,mBAAmB;IA2B3B,gFAAgF;IAChF,OAAO,KAAK,eAAe,GAE1B;IAED,6FAA6F;IAC7F,OAAO,CAAC,MAAM;YAQA,SAAS;IAoIvB,OAAO,CAAC,qBAAqB;IAM7B,+FAA+F;IAC/F,OAAO,CAAC,WAAW;IASnB,oEAAoE;IACpE,OAAO,CAAC,QAAQ;IAMhB,2FAA2F;IAC3F,OAAO,CAAC,eAAe;IASvB,sEAAsE;IACtE,OAAO,CAAC,eAAe;IASvB,kFAAkF;IAClF,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,YAAY;IAIX,MAAM;IAsEf,OAAO,CAAC,YAAY;IA0BpB,OAAO,CAAC,cAAc;IAmCtB,OAAO,CAAC,WAAW;CAKpB"}
|
package/widgets/table.js
CHANGED
|
@@ -142,22 +142,17 @@ let TableWidget = class TableWidget extends LitElement {
|
|
|
142
142
|
box-sizing: border-box;
|
|
143
143
|
}
|
|
144
144
|
`; }
|
|
145
|
-
/** Initial delay (ms) before entering debounce; each new resize signal cancels and restarts. */
|
|
146
|
-
static { this._RESIZE_DELAY_MS = 300; }
|
|
147
|
-
/** Debounce (ms) after delay; resize runs only when no signal for this long. */
|
|
148
|
-
static { this._RESIZE_DEBOUNCE_MS = 300; }
|
|
149
145
|
constructor() {
|
|
150
146
|
super();
|
|
151
147
|
this._loadGeneration = 0;
|
|
152
148
|
this._loadDataDebounceId = null;
|
|
149
|
+
this._loadDataScheduled = false;
|
|
153
150
|
this._loadDataInFlight = false;
|
|
154
|
-
this.
|
|
151
|
+
this._loadDataPendingRefresh = false;
|
|
155
152
|
this._dashboardEl = null;
|
|
153
|
+
this._ignoreNextFilterChange = false;
|
|
156
154
|
this._hasLoadedOnce = false;
|
|
157
155
|
this._viewportUnobserve = null;
|
|
158
|
-
this._resizeObserver = null;
|
|
159
|
-
this._resizeDelayId = null;
|
|
160
|
-
this._resizeDebounceId = null;
|
|
161
156
|
this._boundOnDashboardFilterChange = (e) => {
|
|
162
157
|
const ce = e;
|
|
163
158
|
this._dashboardParams = { ...(ce.detail?.params ?? {}) };
|
|
@@ -200,16 +195,6 @@ let TableWidget = class TableWidget extends LitElement {
|
|
|
200
195
|
clearTimeout(this._loadDataDebounceId);
|
|
201
196
|
this._loadDataDebounceId = null;
|
|
202
197
|
}
|
|
203
|
-
if (this._resizeDelayId != null) {
|
|
204
|
-
clearTimeout(this._resizeDelayId);
|
|
205
|
-
this._resizeDelayId = null;
|
|
206
|
-
}
|
|
207
|
-
if (this._resizeDebounceId != null) {
|
|
208
|
-
clearTimeout(this._resizeDebounceId);
|
|
209
|
-
this._resizeDebounceId = null;
|
|
210
|
-
}
|
|
211
|
-
this._resizeObserver?.disconnect();
|
|
212
|
-
this._resizeObserver = null;
|
|
213
198
|
this._detachDashboard();
|
|
214
199
|
super.disconnectedCallback();
|
|
215
200
|
}
|
|
@@ -231,15 +216,19 @@ let TableWidget = class TableWidget extends LitElement {
|
|
|
231
216
|
!changed.has('apiUrl') &&
|
|
232
217
|
!changed.has('_dashboardParams');
|
|
233
218
|
if (onlyFilterState && this._ignoreNextFilterChange) {
|
|
234
|
-
this._ignoreNextFilterChange
|
|
219
|
+
// Skip scheduling: this update is from programmatic filter state (e.g. first load merge). Do not clear _ignoreNextFilterChange here; only _onWidgetFilterChange (user manual change) clears it.
|
|
235
220
|
}
|
|
236
221
|
else if (changed.has('dataUrl') ||
|
|
237
222
|
changed.has('dataParams') ||
|
|
238
223
|
changed.has('widgetId') ||
|
|
239
|
-
changed.has('apiUrl')
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
224
|
+
changed.has('apiUrl')) {
|
|
225
|
+
if (this._getEffectiveDataUrl() && !this._loadDataScheduled) {
|
|
226
|
+
this._loadDataScheduled = true;
|
|
227
|
+
queueMicrotask(() => {
|
|
228
|
+
this._loadDataScheduled = false;
|
|
229
|
+
this._loadData();
|
|
230
|
+
});
|
|
231
|
+
}
|
|
243
232
|
}
|
|
244
233
|
if (changed.has('lazy')) {
|
|
245
234
|
this._viewportVisible = !this.lazy;
|
|
@@ -264,23 +253,6 @@ let TableWidget = class TableWidget extends LitElement {
|
|
|
264
253
|
this._dashboardParams = {};
|
|
265
254
|
}
|
|
266
255
|
firstUpdated() {
|
|
267
|
-
const body = this.renderRoot.querySelector('.widget-body');
|
|
268
|
-
if (body && typeof ResizeObserver !== 'undefined') {
|
|
269
|
-
this._resizeObserver = new ResizeObserver(() => {
|
|
270
|
-
if (this._resizeDelayId != null)
|
|
271
|
-
clearTimeout(this._resizeDelayId);
|
|
272
|
-
if (this._resizeDebounceId != null)
|
|
273
|
-
clearTimeout(this._resizeDebounceId);
|
|
274
|
-
this._resizeDelayId = setTimeout(() => {
|
|
275
|
-
this._resizeDelayId = null;
|
|
276
|
-
this._resizeDebounceId = setTimeout(() => {
|
|
277
|
-
this._resizeDebounceId = null;
|
|
278
|
-
this.requestUpdate();
|
|
279
|
-
}, TableWidget_1._RESIZE_DEBOUNCE_MS);
|
|
280
|
-
}, TableWidget_1._RESIZE_DELAY_MS);
|
|
281
|
-
});
|
|
282
|
-
this._resizeObserver.observe(body);
|
|
283
|
-
}
|
|
284
256
|
if (this.lazy) {
|
|
285
257
|
this._viewportVisible = false;
|
|
286
258
|
this._viewportUnobserve = observeViewport(this, {
|
|
@@ -363,12 +335,6 @@ let TableWidget = class TableWidget extends LitElement {
|
|
|
363
335
|
async _loadData() {
|
|
364
336
|
if (this.lazy && !this._viewportVisible)
|
|
365
337
|
return;
|
|
366
|
-
// Skip fetch only when using pure inline data (no dataUrl). When we have dataUrl we must refetch when params change (e.g. report filters).
|
|
367
|
-
if (this.data != null && !this.dataUrl) {
|
|
368
|
-
this._error = null;
|
|
369
|
-
this._loading = false;
|
|
370
|
-
return;
|
|
371
|
-
}
|
|
372
338
|
const dataUrl = this._getEffectiveDataUrl();
|
|
373
339
|
if (!dataUrl) {
|
|
374
340
|
this._error = null;
|
|
@@ -376,6 +342,7 @@ let TableWidget = class TableWidget extends LitElement {
|
|
|
376
342
|
return;
|
|
377
343
|
}
|
|
378
344
|
if (this._loadDataInFlight) {
|
|
345
|
+
this._loadDataPendingRefresh = true;
|
|
379
346
|
return;
|
|
380
347
|
}
|
|
381
348
|
const gen = ++this._loadGeneration;
|
|
@@ -442,6 +409,10 @@ let TableWidget = class TableWidget extends LitElement {
|
|
|
442
409
|
if (hideFilter !== undefined)
|
|
443
410
|
this._hideFilter = hideFilter;
|
|
444
411
|
this._loading = false;
|
|
412
|
+
if (this._loadDataPendingRefresh) {
|
|
413
|
+
this._loadDataPendingRefresh = false;
|
|
414
|
+
this._scheduleLoadData();
|
|
415
|
+
}
|
|
445
416
|
});
|
|
446
417
|
}
|
|
447
418
|
else {
|
|
@@ -481,6 +452,10 @@ let TableWidget = class TableWidget extends LitElement {
|
|
|
481
452
|
if (hideFilter !== undefined)
|
|
482
453
|
this._hideFilter = hideFilter;
|
|
483
454
|
this._loading = false;
|
|
455
|
+
if (this._loadDataPendingRefresh) {
|
|
456
|
+
this._loadDataPendingRefresh = false;
|
|
457
|
+
this._scheduleLoadData();
|
|
458
|
+
}
|
|
484
459
|
});
|
|
485
460
|
}
|
|
486
461
|
}
|
|
@@ -494,11 +469,17 @@ let TableWidget = class TableWidget extends LitElement {
|
|
|
494
469
|
this.data = [];
|
|
495
470
|
this._widgetData = null;
|
|
496
471
|
this._loading = false;
|
|
472
|
+
if (this._loadDataPendingRefresh) {
|
|
473
|
+
this._loadDataPendingRefresh = false;
|
|
474
|
+
this._scheduleLoadData();
|
|
475
|
+
}
|
|
497
476
|
});
|
|
498
477
|
}
|
|
499
478
|
}
|
|
500
479
|
_onWidgetFilterChange(e) {
|
|
480
|
+
this._ignoreNextFilterChange = false;
|
|
501
481
|
this._widgetFilterParams = { ...(e.detail?.params ?? {}) };
|
|
482
|
+
this._scheduleLoadData();
|
|
502
483
|
}
|
|
503
484
|
/** Column keys in display order. From widgetData when present, else derived from data/meta. */
|
|
504
485
|
_getColumns() {
|
package/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../libs/analytics/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,SAAS,EACT,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,eAAe,EACf,cAAc,EACd,eAAe,EACf,cAAc,EACd,WAAW,EACX,eAAe,EACf,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACvG,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Web Worker for widget data transforms (pivot, aggregation, header normalization).
|
|
3
|
-
* Message protocol: { type: 'transform', id, widgetDefinition, data } -> { type: 'result', id, widgetData } | { type: 'error', id, error }.
|
|
4
|
-
*/
|
|
5
|
-
export interface WorkerTransformInput {
|
|
6
|
-
type: 'transform';
|
|
7
|
-
id: number;
|
|
8
|
-
widgetDefinition: Record<string, unknown>;
|
|
9
|
-
data: Record<string, unknown>[];
|
|
10
|
-
}
|
|
11
|
-
export interface WorkerTransformResult {
|
|
12
|
-
type: 'result';
|
|
13
|
-
id: number;
|
|
14
|
-
widgetData: unknown;
|
|
15
|
-
}
|
|
16
|
-
export interface WorkerTransformError {
|
|
17
|
-
type: 'error';
|
|
18
|
-
id: number;
|
|
19
|
-
error: string;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=widget-transform.worker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"widget-transform.worker.d.ts","sourceRoot":"","sources":["../../../../libs/analytics/src/workers/widget-transform.worker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,WAAW,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,QAAQ,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Web Worker for widget data transforms (pivot, aggregation, header normalization).
|
|
3
|
-
* Message protocol: { type: 'transform', id, widgetDefinition, data } -> { type: 'result', id, widgetData } | { type: 'error', id, error }.
|
|
4
|
-
*/
|
|
5
|
-
/** Minimal client-side transform: normalize columns from first row, pass rows through. Extend for pivot/aggregation. */
|
|
6
|
-
function transformInWorker(_widgetDefinition, data) {
|
|
7
|
-
if (!Array.isArray(data) || data.length === 0) {
|
|
8
|
-
return { chartType: 'Table', columns: [], rows: [] };
|
|
9
|
-
}
|
|
10
|
-
const columns = Object.keys(data[0]);
|
|
11
|
-
return { chartType: 'Table', columns, rows: data };
|
|
12
|
-
}
|
|
13
|
-
function handleMessage(e) {
|
|
14
|
-
const msg = e.data;
|
|
15
|
-
if (msg?.type !== 'transform' || typeof msg.id !== 'number')
|
|
16
|
-
return;
|
|
17
|
-
try {
|
|
18
|
-
const widgetData = transformInWorker(msg.widgetDefinition ?? {}, msg.data ?? []);
|
|
19
|
-
postMessage({ type: 'result', id: msg.id, widgetData });
|
|
20
|
-
}
|
|
21
|
-
catch (err) {
|
|
22
|
-
postMessage({
|
|
23
|
-
type: 'error',
|
|
24
|
-
id: msg.id,
|
|
25
|
-
error: err instanceof Error ? err.message : String(err),
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
self.onmessage = handleMessage;
|
|
30
|
-
export {};
|