@sentropic/dataviz-vue 0.1.0 → 0.2.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.
- package/dist/adapter.d.ts +31 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +46 -0
- package/dist/adapter.js.map +1 -0
- package/dist/index.d.ts +26 -28
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -43
- package/dist/index.js.map +1 -1
- package/dist/lib/CrossfilteredBarChart.d.ts +144 -0
- package/dist/lib/CrossfilteredBarChart.d.ts.map +1 -0
- package/dist/lib/CrossfilteredBarChart.js +50 -0
- package/dist/lib/CrossfilteredBarChart.js.map +1 -0
- package/dist/lib/DashboardFilterBar.d.ts +57 -0
- package/dist/lib/DashboardFilterBar.d.ts.map +1 -0
- package/dist/lib/DashboardFilterBar.js +45 -0
- package/dist/lib/DashboardFilterBar.js.map +1 -0
- package/dist/lib/DrillBarChart.d.ts +117 -0
- package/dist/lib/DrillBarChart.d.ts.map +1 -0
- package/dist/lib/DrillBarChart.js +56 -0
- package/dist/lib/DrillBarChart.js.map +1 -0
- package/dist/lib/DrillBreadcrumb.d.ts +77 -0
- package/dist/lib/DrillBreadcrumb.d.ts.map +1 -0
- package/dist/lib/DrillBreadcrumb.js +42 -0
- package/dist/lib/DrillBreadcrumb.js.map +1 -0
- package/dist/lib/FieldPane.d.ts +91 -0
- package/dist/lib/FieldPane.d.ts.map +1 -0
- package/dist/lib/FieldPane.js +36 -0
- package/dist/lib/FieldPane.js.map +1 -0
- package/dist/lib/KpiCardGroup.d.ts +100 -0
- package/dist/lib/KpiCardGroup.d.ts.map +1 -0
- package/dist/lib/KpiCardGroup.js +42 -0
- package/dist/lib/KpiCardGroup.js.map +1 -0
- package/dist/lib/PivotDataTable.d.ts +88 -0
- package/dist/lib/PivotDataTable.d.ts.map +1 -0
- package/dist/lib/PivotDataTable.js +54 -0
- package/dist/lib/PivotDataTable.js.map +1 -0
- package/dist/lib/RecordsTable.d.ts +87 -0
- package/dist/lib/RecordsTable.d.ts.map +1 -0
- package/dist/lib/RecordsTable.js +52 -0
- package/dist/lib/RecordsTable.js.map +1 -0
- package/dist/lib/SelectionLegend.d.ts +57 -0
- package/dist/lib/SelectionLegend.d.ts.map +1 -0
- package/dist/lib/SelectionLegend.js +34 -0
- package/dist/lib/SelectionLegend.js.map +1 -0
- package/dist/lib/SmallMultiples.d.ts +109 -0
- package/dist/lib/SmallMultiples.d.ts.map +1 -0
- package/dist/lib/SmallMultiples.js +67 -0
- package/dist/lib/SmallMultiples.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import { type BarChartTone } from '@sentropic/design-system-vue';
|
|
3
|
+
import { type DashboardStore } from '@sentropic/dataviz-core';
|
|
4
|
+
export type DrillBarChartProps = {
|
|
5
|
+
/** The dashboard store to bind to. */
|
|
6
|
+
store: DashboardStore;
|
|
7
|
+
/** This view's id (drill state + cross-filter scope live under it). */
|
|
8
|
+
viewId: string;
|
|
9
|
+
/** Ordered dimension hierarchy; bars group by the current drill level. */
|
|
10
|
+
hierarchy: string[];
|
|
11
|
+
/** Measure id aggregated into each bar's value. */
|
|
12
|
+
measure: string;
|
|
13
|
+
/** Accessible label of the chart. */
|
|
14
|
+
label: string;
|
|
15
|
+
tone?: BarChartTone;
|
|
16
|
+
orientation?: 'vertical' | 'horizontal';
|
|
17
|
+
width?: number;
|
|
18
|
+
height?: number;
|
|
19
|
+
class?: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A bar chart that drills through a dimension hierarchy: clicking a bar filters
|
|
23
|
+
* the clicked value and pushes the next level as group-by. At the deepest level
|
|
24
|
+
* a click toggles this view's selection (brushing) instead.
|
|
25
|
+
*/
|
|
26
|
+
export declare const DrillBarChart: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
27
|
+
store: {
|
|
28
|
+
type: PropType<DashboardStore>;
|
|
29
|
+
required: true;
|
|
30
|
+
};
|
|
31
|
+
viewId: {
|
|
32
|
+
type: StringConstructor;
|
|
33
|
+
required: true;
|
|
34
|
+
};
|
|
35
|
+
hierarchy: {
|
|
36
|
+
type: PropType<string[]>;
|
|
37
|
+
required: true;
|
|
38
|
+
};
|
|
39
|
+
measure: {
|
|
40
|
+
type: StringConstructor;
|
|
41
|
+
required: true;
|
|
42
|
+
};
|
|
43
|
+
label: {
|
|
44
|
+
type: StringConstructor;
|
|
45
|
+
required: true;
|
|
46
|
+
};
|
|
47
|
+
tone: {
|
|
48
|
+
type: PropType<BarChartTone>;
|
|
49
|
+
default: undefined;
|
|
50
|
+
};
|
|
51
|
+
orientation: {
|
|
52
|
+
type: PropType<"vertical" | "horizontal">;
|
|
53
|
+
default: string;
|
|
54
|
+
};
|
|
55
|
+
width: {
|
|
56
|
+
type: NumberConstructor;
|
|
57
|
+
default: undefined;
|
|
58
|
+
};
|
|
59
|
+
height: {
|
|
60
|
+
type: NumberConstructor;
|
|
61
|
+
default: undefined;
|
|
62
|
+
};
|
|
63
|
+
class: {
|
|
64
|
+
type: StringConstructor;
|
|
65
|
+
default: undefined;
|
|
66
|
+
};
|
|
67
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
68
|
+
[key: string]: any;
|
|
69
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
70
|
+
store: {
|
|
71
|
+
type: PropType<DashboardStore>;
|
|
72
|
+
required: true;
|
|
73
|
+
};
|
|
74
|
+
viewId: {
|
|
75
|
+
type: StringConstructor;
|
|
76
|
+
required: true;
|
|
77
|
+
};
|
|
78
|
+
hierarchy: {
|
|
79
|
+
type: PropType<string[]>;
|
|
80
|
+
required: true;
|
|
81
|
+
};
|
|
82
|
+
measure: {
|
|
83
|
+
type: StringConstructor;
|
|
84
|
+
required: true;
|
|
85
|
+
};
|
|
86
|
+
label: {
|
|
87
|
+
type: StringConstructor;
|
|
88
|
+
required: true;
|
|
89
|
+
};
|
|
90
|
+
tone: {
|
|
91
|
+
type: PropType<BarChartTone>;
|
|
92
|
+
default: undefined;
|
|
93
|
+
};
|
|
94
|
+
orientation: {
|
|
95
|
+
type: PropType<"vertical" | "horizontal">;
|
|
96
|
+
default: string;
|
|
97
|
+
};
|
|
98
|
+
width: {
|
|
99
|
+
type: NumberConstructor;
|
|
100
|
+
default: undefined;
|
|
101
|
+
};
|
|
102
|
+
height: {
|
|
103
|
+
type: NumberConstructor;
|
|
104
|
+
default: undefined;
|
|
105
|
+
};
|
|
106
|
+
class: {
|
|
107
|
+
type: StringConstructor;
|
|
108
|
+
default: undefined;
|
|
109
|
+
};
|
|
110
|
+
}>> & Readonly<{}>, {
|
|
111
|
+
class: string;
|
|
112
|
+
tone: BarChartTone;
|
|
113
|
+
orientation: "vertical" | "horizontal";
|
|
114
|
+
width: number;
|
|
115
|
+
height: number;
|
|
116
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
117
|
+
//# sourceMappingURL=DrillBarChart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DrillBarChart.d.ts","sourceRoot":"","sources":["../../src/lib/DrillBarChart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AACxD,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAA+B,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG3F,MAAM,MAAM,kBAAkB,GAAG;IAC/B,sCAAsC;IACtC,KAAK,EAAE,cAAc,CAAC;IACtB,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,WAAW,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa;;cAGG,QAAQ,CAAC,cAAc,CAAC;;;;;;;;cAErB,QAAQ,CAAC,MAAM,EAAE,CAAC;;;;;;;;;;;;cAGtB,QAAQ,CAAC,YAAY,CAAC;;;;cACf,QAAQ,CAAC,UAAU,GAAG,YAAY,CAAC;;;;;;;;;;;;;;;;;;;cANzC,QAAQ,CAAC,cAAc,CAAC;;;;;;;;cAErB,QAAQ,CAAC,MAAM,EAAE,CAAC;;;;;;;;;;;;cAGtB,QAAQ,CAAC,YAAY,CAAC;;;;cACf,QAAQ,CAAC,UAAU,GAAG,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;4EA0CpE,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { defineComponent, h } from 'vue';
|
|
2
|
+
import { BarChart, } from '@sentropic/design-system-vue';
|
|
3
|
+
import { findMeasure, groupAggregate } from '@sentropic/dataviz-core';
|
|
4
|
+
import { useDashboard } from '../adapter.js';
|
|
5
|
+
/**
|
|
6
|
+
* A bar chart that drills through a dimension hierarchy: clicking a bar filters
|
|
7
|
+
* the clicked value and pushes the next level as group-by. At the deepest level
|
|
8
|
+
* a click toggles this view's selection (brushing) instead.
|
|
9
|
+
*/
|
|
10
|
+
export const DrillBarChart = defineComponent({
|
|
11
|
+
name: 'DrillBarChart',
|
|
12
|
+
props: {
|
|
13
|
+
store: { type: Object, required: true },
|
|
14
|
+
viewId: { type: String, required: true },
|
|
15
|
+
hierarchy: { type: Array, required: true },
|
|
16
|
+
measure: { type: String, required: true },
|
|
17
|
+
label: { type: String, required: true },
|
|
18
|
+
tone: { type: String, default: undefined },
|
|
19
|
+
orientation: { type: String, default: 'vertical' },
|
|
20
|
+
width: { type: Number, default: undefined },
|
|
21
|
+
height: { type: Number, default: undefined },
|
|
22
|
+
class: { type: String, default: undefined },
|
|
23
|
+
},
|
|
24
|
+
setup(props) {
|
|
25
|
+
const state = useDashboard(props.store);
|
|
26
|
+
return () => {
|
|
27
|
+
const level = Math.min((state.value.drill[props.viewId] ?? []).length, Math.max(props.hierarchy.length - 1, 0));
|
|
28
|
+
const currentDim = props.hierarchy[level];
|
|
29
|
+
const canDrill = level < props.hierarchy.length - 1;
|
|
30
|
+
const m = findMeasure(props.store.model, props.measure);
|
|
31
|
+
const data = m && currentDim
|
|
32
|
+
? groupAggregate(props.store.applyCrossfilter(props.viewId), currentDim, m).map(({ key, value }) => props.tone ? { label: key, value, tone: props.tone } : { label: key, value })
|
|
33
|
+
: [];
|
|
34
|
+
const onSelect = (key) => {
|
|
35
|
+
if (canDrill) {
|
|
36
|
+
props.store.setFilter(currentDim, { kind: 'include', values: [key] });
|
|
37
|
+
props.store.drillDown(props.viewId, props.hierarchy[level + 1]);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
props.store.toggleSelection(props.viewId, key);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
return h(BarChart, {
|
|
44
|
+
data,
|
|
45
|
+
label: props.label,
|
|
46
|
+
orientation: props.orientation,
|
|
47
|
+
width: props.width,
|
|
48
|
+
height: props.height,
|
|
49
|
+
class: props.class,
|
|
50
|
+
selectedKeys: canDrill ? [] : (state.value.selections[props.viewId] ?? []),
|
|
51
|
+
onSelect,
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=DrillBarChart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DrillBarChart.js","sourceRoot":"","sources":["../../src/lib/DrillBarChart.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,GAAG,CAAC,CAAC,CAAC,CAAC;gBAClE,CAAC;qBAAM,CAAC;oBACN,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;gBACjD,CAAC;YACH,CAAC,CAAC;YACF,OAAO,CAAC,CAAC,QAAQ,EAAE;gBACjB,IAAI;gBACJ,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,WAAW,EAAE,KAAK,CAAC,WAAW;gBAC9B,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBAC1E,QAAQ;aACT,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import { type DashboardStore } from '@sentropic/dataviz-core';
|
|
3
|
+
export type DrillBreadcrumbProps = {
|
|
4
|
+
/** The dashboard store to bind to. */
|
|
5
|
+
store: DashboardStore;
|
|
6
|
+
/** This view's id (must match the DrillBarChart it accompanies). */
|
|
7
|
+
viewId: string;
|
|
8
|
+
/** The same ordered dimension hierarchy used by the DrillBarChart. */
|
|
9
|
+
hierarchy: string[];
|
|
10
|
+
/** Aria-label of the breadcrumb trail. */
|
|
11
|
+
label?: string;
|
|
12
|
+
/** Label of the "go up one level" button. */
|
|
13
|
+
backLabel?: string;
|
|
14
|
+
class?: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Drill trail (design-system Breadcrumb) plus a "go up one level" button that
|
|
18
|
+
* pops the drill path and clears the value-filter applied at that level.
|
|
19
|
+
*/
|
|
20
|
+
export declare const DrillBreadcrumb: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
21
|
+
store: {
|
|
22
|
+
type: PropType<DashboardStore>;
|
|
23
|
+
required: true;
|
|
24
|
+
};
|
|
25
|
+
viewId: {
|
|
26
|
+
type: StringConstructor;
|
|
27
|
+
required: true;
|
|
28
|
+
};
|
|
29
|
+
hierarchy: {
|
|
30
|
+
type: PropType<string[]>;
|
|
31
|
+
required: true;
|
|
32
|
+
};
|
|
33
|
+
label: {
|
|
34
|
+
type: StringConstructor;
|
|
35
|
+
default: string;
|
|
36
|
+
};
|
|
37
|
+
backLabel: {
|
|
38
|
+
type: StringConstructor;
|
|
39
|
+
default: string;
|
|
40
|
+
};
|
|
41
|
+
class: {
|
|
42
|
+
type: StringConstructor;
|
|
43
|
+
default: undefined;
|
|
44
|
+
};
|
|
45
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
48
|
+
store: {
|
|
49
|
+
type: PropType<DashboardStore>;
|
|
50
|
+
required: true;
|
|
51
|
+
};
|
|
52
|
+
viewId: {
|
|
53
|
+
type: StringConstructor;
|
|
54
|
+
required: true;
|
|
55
|
+
};
|
|
56
|
+
hierarchy: {
|
|
57
|
+
type: PropType<string[]>;
|
|
58
|
+
required: true;
|
|
59
|
+
};
|
|
60
|
+
label: {
|
|
61
|
+
type: StringConstructor;
|
|
62
|
+
default: string;
|
|
63
|
+
};
|
|
64
|
+
backLabel: {
|
|
65
|
+
type: StringConstructor;
|
|
66
|
+
default: string;
|
|
67
|
+
};
|
|
68
|
+
class: {
|
|
69
|
+
type: StringConstructor;
|
|
70
|
+
default: undefined;
|
|
71
|
+
};
|
|
72
|
+
}>> & Readonly<{}>, {
|
|
73
|
+
label: string;
|
|
74
|
+
class: string;
|
|
75
|
+
backLabel: string;
|
|
76
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
77
|
+
//# sourceMappingURL=DrillBreadcrumb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DrillBreadcrumb.d.ts","sourceRoot":"","sources":["../../src/lib/DrillBreadcrumb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AAExD,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG7E,MAAM,MAAM,oBAAoB,GAAG;IACjC,sCAAsC;IACtC,KAAK,EAAE,cAAc,CAAC;IACtB,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe;;cAGC,QAAQ,CAAC,cAAc,CAAC;;;;;;;;cAErB,QAAQ,CAAC,MAAM,EAAE,CAAC;;;;;;;;;;;;;;;;;;;cAFrB,QAAQ,CAAC,cAAc,CAAC;;;;;;;;cAErB,QAAQ,CAAC,MAAM,EAAE,CAAC;;;;;;;;;;;;;;;;;;;4EA0BhD,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { defineComponent, h } from 'vue';
|
|
2
|
+
import { Breadcrumb, Button, Inline } from '@sentropic/design-system-vue';
|
|
3
|
+
import { findDimension } from '@sentropic/dataviz-core';
|
|
4
|
+
import { useDashboard } from '../adapter.js';
|
|
5
|
+
/**
|
|
6
|
+
* Drill trail (design-system Breadcrumb) plus a "go up one level" button that
|
|
7
|
+
* pops the drill path and clears the value-filter applied at that level.
|
|
8
|
+
*/
|
|
9
|
+
export const DrillBreadcrumb = defineComponent({
|
|
10
|
+
name: 'DrillBreadcrumb',
|
|
11
|
+
props: {
|
|
12
|
+
store: { type: Object, required: true },
|
|
13
|
+
viewId: { type: String, required: true },
|
|
14
|
+
hierarchy: { type: Array, required: true },
|
|
15
|
+
label: { type: String, default: 'Chemin de drill' },
|
|
16
|
+
backLabel: { type: String, default: 'Remonter' },
|
|
17
|
+
class: { type: String, default: undefined },
|
|
18
|
+
},
|
|
19
|
+
setup(props) {
|
|
20
|
+
const state = useDashboard(props.store);
|
|
21
|
+
const dimLabel = (id) => findDimension(props.store.model, id)?.label ?? id;
|
|
22
|
+
const back = () => {
|
|
23
|
+
const p = props.store.getState().drill[props.viewId] ?? [];
|
|
24
|
+
if (p.length === 0)
|
|
25
|
+
return;
|
|
26
|
+
props.store.drillUp(props.viewId);
|
|
27
|
+
props.store.clearFilter(props.hierarchy[p.length - 1]);
|
|
28
|
+
};
|
|
29
|
+
return () => {
|
|
30
|
+
const path = state.value.drill[props.viewId] ?? [];
|
|
31
|
+
const items = props.hierarchy
|
|
32
|
+
.slice(0, path.length + 1)
|
|
33
|
+
.map((dim, i) => ({ label: dimLabel(dim), current: i === path.length }));
|
|
34
|
+
const children = [h(Breadcrumb, { items, label: props.label })];
|
|
35
|
+
if (path.length > 0) {
|
|
36
|
+
children.push(h(Button, { variant: 'ghost', onClick: back }, { default: () => props.backLabel }));
|
|
37
|
+
}
|
|
38
|
+
return h(Inline, { gap: 2, class: props.class }, { default: () => children });
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=DrillBreadcrumb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DrillBreadcrumb.js","sourceRoot":"","sources":["../../src/lib/DrillBreadcrumb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,CAAC,EAAiB,MAAM,KAAK,CAAC;AACxD,OAAO,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
+
import { type TreeViewProps } from '@sentropic/design-system-vue';
|
|
3
|
+
import { type DataModel, type FieldId } from '@sentropic/dataviz-core';
|
|
4
|
+
export type FieldPaneProps = {
|
|
5
|
+
model: DataModel;
|
|
6
|
+
includeDimensions?: boolean;
|
|
7
|
+
includeMeasures?: boolean;
|
|
8
|
+
selectedId?: FieldId | string;
|
|
9
|
+
expandedIds?: TreeViewProps['expandedIds'];
|
|
10
|
+
defaultExpandedIds?: TreeViewProps['defaultExpandedIds'];
|
|
11
|
+
label?: string;
|
|
12
|
+
class?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const FieldPane: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
15
|
+
model: {
|
|
16
|
+
type: PropType<DataModel>;
|
|
17
|
+
required: true;
|
|
18
|
+
};
|
|
19
|
+
includeDimensions: {
|
|
20
|
+
type: BooleanConstructor;
|
|
21
|
+
default: undefined;
|
|
22
|
+
};
|
|
23
|
+
includeMeasures: {
|
|
24
|
+
type: BooleanConstructor;
|
|
25
|
+
default: undefined;
|
|
26
|
+
};
|
|
27
|
+
selectedId: {
|
|
28
|
+
type: PropType<FieldId | string>;
|
|
29
|
+
default: undefined;
|
|
30
|
+
};
|
|
31
|
+
expandedIds: {
|
|
32
|
+
type: PropType<TreeViewProps["expandedIds"]>;
|
|
33
|
+
default: undefined;
|
|
34
|
+
};
|
|
35
|
+
defaultExpandedIds: {
|
|
36
|
+
type: PropType<TreeViewProps["defaultExpandedIds"]>;
|
|
37
|
+
default: undefined;
|
|
38
|
+
};
|
|
39
|
+
label: {
|
|
40
|
+
type: StringConstructor;
|
|
41
|
+
default: string;
|
|
42
|
+
};
|
|
43
|
+
class: {
|
|
44
|
+
type: StringConstructor;
|
|
45
|
+
default: undefined;
|
|
46
|
+
};
|
|
47
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
48
|
+
[key: string]: any;
|
|
49
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
50
|
+
model: {
|
|
51
|
+
type: PropType<DataModel>;
|
|
52
|
+
required: true;
|
|
53
|
+
};
|
|
54
|
+
includeDimensions: {
|
|
55
|
+
type: BooleanConstructor;
|
|
56
|
+
default: undefined;
|
|
57
|
+
};
|
|
58
|
+
includeMeasures: {
|
|
59
|
+
type: BooleanConstructor;
|
|
60
|
+
default: undefined;
|
|
61
|
+
};
|
|
62
|
+
selectedId: {
|
|
63
|
+
type: PropType<FieldId | string>;
|
|
64
|
+
default: undefined;
|
|
65
|
+
};
|
|
66
|
+
expandedIds: {
|
|
67
|
+
type: PropType<TreeViewProps["expandedIds"]>;
|
|
68
|
+
default: undefined;
|
|
69
|
+
};
|
|
70
|
+
defaultExpandedIds: {
|
|
71
|
+
type: PropType<TreeViewProps["defaultExpandedIds"]>;
|
|
72
|
+
default: undefined;
|
|
73
|
+
};
|
|
74
|
+
label: {
|
|
75
|
+
type: StringConstructor;
|
|
76
|
+
default: string;
|
|
77
|
+
};
|
|
78
|
+
class: {
|
|
79
|
+
type: StringConstructor;
|
|
80
|
+
default: undefined;
|
|
81
|
+
};
|
|
82
|
+
}>> & Readonly<{}>, {
|
|
83
|
+
label: string;
|
|
84
|
+
class: string;
|
|
85
|
+
expandedIds: string[] | undefined;
|
|
86
|
+
defaultExpandedIds: string[] | undefined;
|
|
87
|
+
includeDimensions: boolean;
|
|
88
|
+
includeMeasures: boolean;
|
|
89
|
+
selectedId: string;
|
|
90
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
91
|
+
//# sourceMappingURL=FieldPane.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldPane.d.ts","sourceRoot":"","sources":["../../src/lib/FieldPane.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AACxD,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,OAAO,EACb,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,SAAS,CAAC;IACjB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC9B,WAAW,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IAC3C,kBAAkB,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,SAAS;;cAGO,QAAQ,CAAC,SAAS,CAAC;;;;;;;;;;;;cAGd,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC;;;;cACf,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;;;;cAEnD,QAAQ,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAC;;;;;;;;;;;;;;;cANhD,QAAQ,CAAC,SAAS,CAAC;;;;;;;;;;;;cAGd,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC;;;;cACf,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;;;;cAEnD,QAAQ,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;4EAuB3E,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineComponent, h } from 'vue';
|
|
2
|
+
import { TreeView, } from '@sentropic/design-system-vue';
|
|
3
|
+
import { buildFieldPaneTree, } from '@sentropic/dataviz-core';
|
|
4
|
+
export const FieldPane = defineComponent({
|
|
5
|
+
name: 'FieldPane',
|
|
6
|
+
props: {
|
|
7
|
+
model: { type: Object, required: true },
|
|
8
|
+
includeDimensions: { type: Boolean, default: undefined },
|
|
9
|
+
includeMeasures: { type: Boolean, default: undefined },
|
|
10
|
+
selectedId: { type: String, default: undefined },
|
|
11
|
+
expandedIds: { type: Array, default: undefined },
|
|
12
|
+
defaultExpandedIds: {
|
|
13
|
+
type: Array,
|
|
14
|
+
default: undefined,
|
|
15
|
+
},
|
|
16
|
+
label: { type: String, default: 'Fields' },
|
|
17
|
+
class: { type: String, default: undefined },
|
|
18
|
+
},
|
|
19
|
+
setup(props) {
|
|
20
|
+
return () => {
|
|
21
|
+
const tree = buildFieldPaneTree(props.model, {
|
|
22
|
+
includeDimensions: props.includeDimensions,
|
|
23
|
+
includeMeasures: props.includeMeasures,
|
|
24
|
+
});
|
|
25
|
+
return h(TreeView, {
|
|
26
|
+
nodes: tree.nodes,
|
|
27
|
+
selectedId: props.selectedId,
|
|
28
|
+
expandedIds: props.expandedIds,
|
|
29
|
+
defaultExpandedIds: props.defaultExpandedIds ?? tree.defaultExpandedIds,
|
|
30
|
+
class: props.class,
|
|
31
|
+
'aria-label': props.label,
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=FieldPane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldPane.js","sourceRoot":"","sources":["../../src/lib/FieldPane.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,CAAC,EAAiB,MAAM,KAAK,CAAC;AACxD,OAAO,EACL,QAAQ,GAET,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,kBAAkB,GAGnB,MAAM,yBAAyB,CAAC;AAajC,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAC;IACvC,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE;QACL,KAAK,EAAE,EAAE,IAAI,EAAE,MAA6B,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC9D,iBAAiB,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE;QACxD,eAAe,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE;QACtD,UAAU,EAAE,EAAE,IAAI,EAAE,MAAoC,EAAE,OAAO,EAAE,SAAS,EAAE;QAC9E,WAAW,EAAE,EAAE,IAAI,EAAE,KAA0D,EAAE,OAAO,EAAE,SAAS,EAAE;QACrG,kBAAkB,EAAE;YAClB,IAAI,EAAE,KAAiE;YACvE,OAAO,EAAE,SAAS;SACnB;QACD,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE;QAC1C,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE;KAC5C;IACD,KAAK,CAAC,KAAK;QACT,OAAO,GAAG,EAAE;YACV,MAAM,IAAI,GAAG,kBAAkB,CAAC,KAAK,CAAC,KAAK,EAAE;gBAC3C,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;gBAC1C,eAAe,EAAE,KAAK,CAAC,eAAe;aACvC,CAAC,CAAC;YAEH,OAAO,CAAC,CAAC,QAAQ,EAAE;gBACjB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,UAAU,EAAE,KAAK,CAAC,UAAU;gBAC5B,WAAW,EAAE,KAAK,CAAC,WAAW;gBAC9B,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,IAAI,IAAI,CAAC,kBAAkB;gBACvE,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,YAAY,EAAE,KAAK,CAAC,KAAK;aAC1B,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import { type KpiCardDeltaFormat, type KpiCardFormat, type KpiCardSize, type KpiCardTone } from '@sentropic/design-system-vue';
|
|
3
|
+
import { type DashboardStore, type KpiCardConfig, type Row } from '@sentropic/dataviz-core';
|
|
4
|
+
export type KpiCardGroupProps = {
|
|
5
|
+
store: DashboardStore;
|
|
6
|
+
viewId?: string;
|
|
7
|
+
configs: KpiCardConfig[];
|
|
8
|
+
comparisonData?: readonly Row[];
|
|
9
|
+
format?: KpiCardFormat;
|
|
10
|
+
deltaFormat?: KpiCardDeltaFormat;
|
|
11
|
+
size?: KpiCardSize;
|
|
12
|
+
tone?: KpiCardTone;
|
|
13
|
+
class?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const KpiCardGroup: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
16
|
+
store: {
|
|
17
|
+
type: PropType<DashboardStore>;
|
|
18
|
+
required: true;
|
|
19
|
+
};
|
|
20
|
+
viewId: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
default: undefined;
|
|
23
|
+
};
|
|
24
|
+
configs: {
|
|
25
|
+
type: PropType<KpiCardConfig[]>;
|
|
26
|
+
required: true;
|
|
27
|
+
};
|
|
28
|
+
comparisonData: {
|
|
29
|
+
type: PropType<readonly Row[]>;
|
|
30
|
+
default: undefined;
|
|
31
|
+
};
|
|
32
|
+
format: {
|
|
33
|
+
type: PropType<KpiCardFormat>;
|
|
34
|
+
default: undefined;
|
|
35
|
+
};
|
|
36
|
+
deltaFormat: {
|
|
37
|
+
type: PropType<KpiCardDeltaFormat>;
|
|
38
|
+
default: string;
|
|
39
|
+
};
|
|
40
|
+
size: {
|
|
41
|
+
type: PropType<KpiCardSize>;
|
|
42
|
+
default: undefined;
|
|
43
|
+
};
|
|
44
|
+
tone: {
|
|
45
|
+
type: PropType<KpiCardTone>;
|
|
46
|
+
default: undefined;
|
|
47
|
+
};
|
|
48
|
+
class: {
|
|
49
|
+
type: StringConstructor;
|
|
50
|
+
default: undefined;
|
|
51
|
+
};
|
|
52
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
53
|
+
[key: string]: any;
|
|
54
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
55
|
+
store: {
|
|
56
|
+
type: PropType<DashboardStore>;
|
|
57
|
+
required: true;
|
|
58
|
+
};
|
|
59
|
+
viewId: {
|
|
60
|
+
type: StringConstructor;
|
|
61
|
+
default: undefined;
|
|
62
|
+
};
|
|
63
|
+
configs: {
|
|
64
|
+
type: PropType<KpiCardConfig[]>;
|
|
65
|
+
required: true;
|
|
66
|
+
};
|
|
67
|
+
comparisonData: {
|
|
68
|
+
type: PropType<readonly Row[]>;
|
|
69
|
+
default: undefined;
|
|
70
|
+
};
|
|
71
|
+
format: {
|
|
72
|
+
type: PropType<KpiCardFormat>;
|
|
73
|
+
default: undefined;
|
|
74
|
+
};
|
|
75
|
+
deltaFormat: {
|
|
76
|
+
type: PropType<KpiCardDeltaFormat>;
|
|
77
|
+
default: string;
|
|
78
|
+
};
|
|
79
|
+
size: {
|
|
80
|
+
type: PropType<KpiCardSize>;
|
|
81
|
+
default: undefined;
|
|
82
|
+
};
|
|
83
|
+
tone: {
|
|
84
|
+
type: PropType<KpiCardTone>;
|
|
85
|
+
default: undefined;
|
|
86
|
+
};
|
|
87
|
+
class: {
|
|
88
|
+
type: StringConstructor;
|
|
89
|
+
default: undefined;
|
|
90
|
+
};
|
|
91
|
+
}>> & Readonly<{}>, {
|
|
92
|
+
class: string;
|
|
93
|
+
size: KpiCardSize;
|
|
94
|
+
tone: KpiCardTone;
|
|
95
|
+
viewId: string;
|
|
96
|
+
comparisonData: readonly Row[];
|
|
97
|
+
format: KpiCardFormat;
|
|
98
|
+
deltaFormat: KpiCardDeltaFormat;
|
|
99
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
100
|
+
//# sourceMappingURL=KpiCardGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KpiCardGroup.d.ts","sourceRoot":"","sources":["../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,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;4EA6B/C,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { defineComponent, h } from 'vue';
|
|
2
|
+
import { KpiCard, } from '@sentropic/design-system-vue';
|
|
3
|
+
import { buildKpiCards, } from '@sentropic/dataviz-core';
|
|
4
|
+
import { useDashboard } from '../adapter.js';
|
|
5
|
+
function finite(value) {
|
|
6
|
+
return value === undefined || !Number.isFinite(value) ? undefined : value;
|
|
7
|
+
}
|
|
8
|
+
export const KpiCardGroup = defineComponent({
|
|
9
|
+
name: 'KpiCardGroup',
|
|
10
|
+
props: {
|
|
11
|
+
store: { type: Object, required: true },
|
|
12
|
+
viewId: { type: String, default: undefined },
|
|
13
|
+
configs: { type: Array, required: true },
|
|
14
|
+
comparisonData: { type: Array, default: undefined },
|
|
15
|
+
format: { type: String, default: undefined },
|
|
16
|
+
deltaFormat: { type: String, default: 'percent' },
|
|
17
|
+
size: { type: String, default: undefined },
|
|
18
|
+
tone: { type: String, default: undefined },
|
|
19
|
+
class: { type: String, default: undefined },
|
|
20
|
+
},
|
|
21
|
+
setup(props) {
|
|
22
|
+
const state = useDashboard(props.store);
|
|
23
|
+
return () => {
|
|
24
|
+
void state.value;
|
|
25
|
+
const cards = buildKpiCards(props.store.model, props.store.applyCrossfilter(props.viewId), props.configs, {
|
|
26
|
+
comparisonData: props.comparisonData,
|
|
27
|
+
});
|
|
28
|
+
return h('div', { class: props.class }, cards.map((card) => h(KpiCard, {
|
|
29
|
+
key: card.id,
|
|
30
|
+
value: card.value,
|
|
31
|
+
label: card.label,
|
|
32
|
+
delta: finite(props.deltaFormat === 'absolute' ? card.delta : card.deltaPercent),
|
|
33
|
+
deltaFormat: props.deltaFormat,
|
|
34
|
+
format: props.format,
|
|
35
|
+
size: props.size,
|
|
36
|
+
tone: props.tone,
|
|
37
|
+
sparkline: card.sparkline?.map((point) => point.value),
|
|
38
|
+
})));
|
|
39
|
+
};
|
|
40
|
+
},
|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