@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,88 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import { type DashboardStore, type PivotConfig } from '@sentropic/dataviz-core';
|
|
3
|
+
export type PivotDataTableProps = {
|
|
4
|
+
store: DashboardStore;
|
|
5
|
+
viewId?: string;
|
|
6
|
+
rows: PivotConfig['rows'];
|
|
7
|
+
columns?: PivotConfig['columns'];
|
|
8
|
+
measures: PivotConfig['measures'];
|
|
9
|
+
caption?: string;
|
|
10
|
+
size?: 'sm' | 'md' | 'lg';
|
|
11
|
+
class?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const PivotDataTable: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
14
|
+
store: {
|
|
15
|
+
type: PropType<DashboardStore>;
|
|
16
|
+
required: true;
|
|
17
|
+
};
|
|
18
|
+
viewId: {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
default: undefined;
|
|
21
|
+
};
|
|
22
|
+
rows: {
|
|
23
|
+
type: PropType<PivotConfig["rows"]>;
|
|
24
|
+
required: true;
|
|
25
|
+
};
|
|
26
|
+
columns: {
|
|
27
|
+
type: PropType<PivotConfig["columns"]>;
|
|
28
|
+
default: undefined;
|
|
29
|
+
};
|
|
30
|
+
measures: {
|
|
31
|
+
type: PropType<PivotConfig["measures"]>;
|
|
32
|
+
required: true;
|
|
33
|
+
};
|
|
34
|
+
caption: {
|
|
35
|
+
type: StringConstructor;
|
|
36
|
+
default: undefined;
|
|
37
|
+
};
|
|
38
|
+
size: {
|
|
39
|
+
type: PropType<"sm" | "md" | "lg">;
|
|
40
|
+
default: undefined;
|
|
41
|
+
};
|
|
42
|
+
class: {
|
|
43
|
+
type: StringConstructor;
|
|
44
|
+
default: undefined;
|
|
45
|
+
};
|
|
46
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
49
|
+
store: {
|
|
50
|
+
type: PropType<DashboardStore>;
|
|
51
|
+
required: true;
|
|
52
|
+
};
|
|
53
|
+
viewId: {
|
|
54
|
+
type: StringConstructor;
|
|
55
|
+
default: undefined;
|
|
56
|
+
};
|
|
57
|
+
rows: {
|
|
58
|
+
type: PropType<PivotConfig["rows"]>;
|
|
59
|
+
required: true;
|
|
60
|
+
};
|
|
61
|
+
columns: {
|
|
62
|
+
type: PropType<PivotConfig["columns"]>;
|
|
63
|
+
default: undefined;
|
|
64
|
+
};
|
|
65
|
+
measures: {
|
|
66
|
+
type: PropType<PivotConfig["measures"]>;
|
|
67
|
+
required: true;
|
|
68
|
+
};
|
|
69
|
+
caption: {
|
|
70
|
+
type: StringConstructor;
|
|
71
|
+
default: undefined;
|
|
72
|
+
};
|
|
73
|
+
size: {
|
|
74
|
+
type: PropType<"sm" | "md" | "lg">;
|
|
75
|
+
default: undefined;
|
|
76
|
+
};
|
|
77
|
+
class: {
|
|
78
|
+
type: StringConstructor;
|
|
79
|
+
default: undefined;
|
|
80
|
+
};
|
|
81
|
+
}>> & Readonly<{}>, {
|
|
82
|
+
class: string;
|
|
83
|
+
caption: string;
|
|
84
|
+
size: "sm" | "md" | "lg";
|
|
85
|
+
viewId: string;
|
|
86
|
+
columns: string[] | undefined;
|
|
87
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
88
|
+
//# sourceMappingURL=PivotDataTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PivotDataTable.d.ts","sourceRoot":"","sources":["../../src/lib/PivotDataTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AAMxD,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAGjC,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,cAAc,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1B,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACjC,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAWF,eAAO,MAAM,cAAc;;cAGE,QAAQ,CAAC,cAAc,CAAC;;;;;;;;cAEf,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;;;;cAC1B,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;;;;cAC/B,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;;;;;;;;cAE/C,QAAQ,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;;;;;;;;;;;cAN3B,QAAQ,CAAC,cAAc,CAAC;;;;;;;;cAEf,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;;;;cAC1B,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;;;;cAC/B,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;;;;;;;;cAE/C,QAAQ,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;;;;;;;;;;;;;4EA8BtD,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { defineComponent, h } from 'vue';
|
|
2
|
+
import { DataTable, } from '@sentropic/design-system-vue';
|
|
3
|
+
import { buildPivotTable, } from '@sentropic/dataviz-core';
|
|
4
|
+
import { useDashboard } from '../adapter.js';
|
|
5
|
+
function toColumns(columns) {
|
|
6
|
+
return columns.map((column) => ({
|
|
7
|
+
key: column.key,
|
|
8
|
+
label: column.label,
|
|
9
|
+
sortable: true,
|
|
10
|
+
align: column.kind === 'value' ? 'end' : 'start',
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
export const PivotDataTable = defineComponent({
|
|
14
|
+
name: 'PivotDataTable',
|
|
15
|
+
props: {
|
|
16
|
+
store: { type: Object, required: true },
|
|
17
|
+
viewId: { type: String, default: undefined },
|
|
18
|
+
rows: { type: Array, required: true },
|
|
19
|
+
columns: { type: Array, default: undefined },
|
|
20
|
+
measures: { type: Array, required: true },
|
|
21
|
+
caption: { type: String, default: undefined },
|
|
22
|
+
size: { type: String, default: undefined },
|
|
23
|
+
class: { type: String, default: undefined },
|
|
24
|
+
},
|
|
25
|
+
setup(props) {
|
|
26
|
+
const state = useDashboard(props.store);
|
|
27
|
+
return () => {
|
|
28
|
+
void state.value;
|
|
29
|
+
let columns = [];
|
|
30
|
+
let rows = [];
|
|
31
|
+
try {
|
|
32
|
+
const pivot = buildPivotTable(props.store.model, props.store.applyCrossfilter(props.viewId), {
|
|
33
|
+
rows: props.rows,
|
|
34
|
+
columns: props.columns,
|
|
35
|
+
measures: props.measures,
|
|
36
|
+
});
|
|
37
|
+
columns = toColumns(pivot.columns);
|
|
38
|
+
rows = pivot.rows;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
columns = [];
|
|
42
|
+
rows = [];
|
|
43
|
+
}
|
|
44
|
+
return h(DataTable, {
|
|
45
|
+
columns,
|
|
46
|
+
rows,
|
|
47
|
+
caption: props.caption,
|
|
48
|
+
size: props.size,
|
|
49
|
+
class: props.class,
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=PivotDataTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PivotDataTable.js","sourceRoot":"","sources":["../../src/lib/PivotDataTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,CAAC,EAAiB,MAAM,KAAK,CAAC;AACxD,OAAO,EACL,SAAS,GAGV,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,eAAe,GAGhB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAa7C,SAAS,SAAS,CAAC,OAAsD;IACvE,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC9B,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO;KACjD,CAAC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAC;IAC5C,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE;QACL,KAAK,EAAE,EAAE,IAAI,EAAE,MAAkC,EAAE,QAAQ,EAAE,IAAI,EAAE;QACnE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE;QAC5C,IAAI,EAAE,EAAE,IAAI,EAAE,KAAiD,EAAE,QAAQ,EAAE,IAAI,EAAE;QACjF,OAAO,EAAE,EAAE,IAAI,EAAE,KAAoD,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nB,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import { type DashboardStore } from '@sentropic/dataviz-core';
|
|
3
|
+
export type RecordsTableProps = {
|
|
4
|
+
/** The dashboard store to bind to. */
|
|
5
|
+
store: DashboardStore;
|
|
6
|
+
/** This view's id in the cross-filter graph (rows shown are its visible rows). */
|
|
7
|
+
viewId?: string;
|
|
8
|
+
/** Field ids (and order) to show as columns; defaults to all model fields. */
|
|
9
|
+
fields?: string[];
|
|
10
|
+
caption?: string;
|
|
11
|
+
size?: 'sm' | 'md' | 'lg';
|
|
12
|
+
pageSize?: number;
|
|
13
|
+
class?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The underlying ("show records") rows for a view — the cross-filtered data
|
|
17
|
+
* rendered as a design-system DataTable. Columns come from the data model.
|
|
18
|
+
*/
|
|
19
|
+
export declare const RecordsTable: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
20
|
+
store: {
|
|
21
|
+
type: PropType<DashboardStore>;
|
|
22
|
+
required: true;
|
|
23
|
+
};
|
|
24
|
+
viewId: {
|
|
25
|
+
type: StringConstructor;
|
|
26
|
+
default: undefined;
|
|
27
|
+
};
|
|
28
|
+
fields: {
|
|
29
|
+
type: PropType<string[]>;
|
|
30
|
+
default: undefined;
|
|
31
|
+
};
|
|
32
|
+
caption: {
|
|
33
|
+
type: StringConstructor;
|
|
34
|
+
default: undefined;
|
|
35
|
+
};
|
|
36
|
+
size: {
|
|
37
|
+
type: PropType<"sm" | "md" | "lg">;
|
|
38
|
+
default: undefined;
|
|
39
|
+
};
|
|
40
|
+
pageSize: {
|
|
41
|
+
type: NumberConstructor;
|
|
42
|
+
default: undefined;
|
|
43
|
+
};
|
|
44
|
+
class: {
|
|
45
|
+
type: StringConstructor;
|
|
46
|
+
default: undefined;
|
|
47
|
+
};
|
|
48
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
49
|
+
[key: string]: any;
|
|
50
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
51
|
+
store: {
|
|
52
|
+
type: PropType<DashboardStore>;
|
|
53
|
+
required: true;
|
|
54
|
+
};
|
|
55
|
+
viewId: {
|
|
56
|
+
type: StringConstructor;
|
|
57
|
+
default: undefined;
|
|
58
|
+
};
|
|
59
|
+
fields: {
|
|
60
|
+
type: PropType<string[]>;
|
|
61
|
+
default: undefined;
|
|
62
|
+
};
|
|
63
|
+
caption: {
|
|
64
|
+
type: StringConstructor;
|
|
65
|
+
default: undefined;
|
|
66
|
+
};
|
|
67
|
+
size: {
|
|
68
|
+
type: PropType<"sm" | "md" | "lg">;
|
|
69
|
+
default: undefined;
|
|
70
|
+
};
|
|
71
|
+
pageSize: {
|
|
72
|
+
type: NumberConstructor;
|
|
73
|
+
default: undefined;
|
|
74
|
+
};
|
|
75
|
+
class: {
|
|
76
|
+
type: StringConstructor;
|
|
77
|
+
default: undefined;
|
|
78
|
+
};
|
|
79
|
+
}>> & Readonly<{}>, {
|
|
80
|
+
class: string;
|
|
81
|
+
caption: string;
|
|
82
|
+
size: "sm" | "md" | "lg";
|
|
83
|
+
viewId: string;
|
|
84
|
+
pageSize: number;
|
|
85
|
+
fields: string[];
|
|
86
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
87
|
+
//# sourceMappingURL=RecordsTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecordsTable.d.ts","sourceRoot":"","sources":["../../src/lib/RecordsTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AAMxD,OAAO,EAAe,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG3E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,sCAAsC;IACtC,KAAK,EAAE,cAAc,CAAC;IACtB,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY;;cAGI,QAAQ,CAAC,cAAc,CAAC;;;;;;;;cAExB,QAAQ,CAAC,MAAM,EAAE,CAAC;;;;;;;;cAEnB,QAAQ,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;;;;;;;;;;;;;;;cAJ3B,QAAQ,CAAC,cAAc,CAAC;;;;;;;;cAExB,QAAQ,CAAC,MAAM,EAAE,CAAC;;;;;;;;cAEnB,QAAQ,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;;;;;;;;;;;;;;;;;;4EAmCtD,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { defineComponent, h } from 'vue';
|
|
2
|
+
import { DataTable, } from '@sentropic/design-system-vue';
|
|
3
|
+
import { findMeasure } from '@sentropic/dataviz-core';
|
|
4
|
+
import { useDashboard } from '../adapter.js';
|
|
5
|
+
/**
|
|
6
|
+
* The underlying ("show records") rows for a view — the cross-filtered data
|
|
7
|
+
* rendered as a design-system DataTable. Columns come from the data model.
|
|
8
|
+
*/
|
|
9
|
+
export const RecordsTable = defineComponent({
|
|
10
|
+
name: 'RecordsTable',
|
|
11
|
+
props: {
|
|
12
|
+
store: { type: Object, required: true },
|
|
13
|
+
viewId: { type: String, default: undefined },
|
|
14
|
+
fields: { type: Array, default: undefined },
|
|
15
|
+
caption: { type: String, default: undefined },
|
|
16
|
+
size: { type: String, default: undefined },
|
|
17
|
+
pageSize: { type: Number, default: undefined },
|
|
18
|
+
class: { type: String, default: undefined },
|
|
19
|
+
},
|
|
20
|
+
setup(props) {
|
|
21
|
+
const state = useDashboard(props.store);
|
|
22
|
+
return () => {
|
|
23
|
+
void state.value;
|
|
24
|
+
const ids = props.fields ?? [
|
|
25
|
+
...props.store.model.dimensions.map((d) => d.id),
|
|
26
|
+
...props.store.model.measures.map((m) => m.id),
|
|
27
|
+
];
|
|
28
|
+
const columns = ids.map((id) => {
|
|
29
|
+
const dim = props.store.model.dimensions.find((d) => d.id === id);
|
|
30
|
+
const meas = findMeasure(props.store.model, id);
|
|
31
|
+
return {
|
|
32
|
+
key: id,
|
|
33
|
+
label: dim?.label ?? meas?.label ?? id,
|
|
34
|
+
sortable: true,
|
|
35
|
+
align: meas ? 'end' : 'start',
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
const rows = props.store
|
|
39
|
+
.applyCrossfilter(props.viewId)
|
|
40
|
+
.map((row, i) => ({ ...row, id: String(i) }));
|
|
41
|
+
return h(DataTable, {
|
|
42
|
+
columns,
|
|
43
|
+
rows,
|
|
44
|
+
caption: props.caption,
|
|
45
|
+
size: props.size,
|
|
46
|
+
pageSize: props.pageSize,
|
|
47
|
+
class: props.class,
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=RecordsTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecordsTable.js","sourceRoot":"","sources":["../../src/lib/RecordsTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,CAAC,EAAiB,MAAM,KAAK,CAAC;AACxD,OAAO,EACL,SAAS,GAGV,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,WAAW,EAAuB,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,C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UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;gBAClE,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;gBAChD,OAAO;oBACL,GAAG,EAAE,EAAE;oBACP,KAAK,EAAE,GAAG,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,EAAE;oBACtC,QAAQ,EAAE,IAAI;oBACd,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO;iBAC9B,CAAC;YACJ,CAAC,CAAC,CAAC;YACH,MAAM,IAAI,GAAmB,KAAK,CAAC,KAAK;iBACrC,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC;iBAC9B,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAChD,OAAO,CAAC,CAAC,SAAS,EAAE;gBAClB,OAAO;gBACP,IAAI;gBACJ,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,KAAK,EAAE,KAAK,CAAC,KAAK;aACnB,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import { type DashboardStore } from '@sentropic/dataviz-core';
|
|
3
|
+
export type SelectionLegendProps = {
|
|
4
|
+
/** The dashboard store to bind to. */
|
|
5
|
+
store: DashboardStore;
|
|
6
|
+
/** Map of viewId -> human label for the legend chips (falls back to the id). */
|
|
7
|
+
labels?: Record<string, string>;
|
|
8
|
+
/** Aria-label of the legend group. */
|
|
9
|
+
label?: string;
|
|
10
|
+
class?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Per-view selections rendered as design-system `SelectionChip`s. Renders
|
|
14
|
+
* nothing while there is no active selection.
|
|
15
|
+
*/
|
|
16
|
+
export declare const SelectionLegend: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
17
|
+
store: {
|
|
18
|
+
type: PropType<DashboardStore>;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
labels: {
|
|
22
|
+
type: PropType<Record<string, string>>;
|
|
23
|
+
default: () => {};
|
|
24
|
+
};
|
|
25
|
+
label: {
|
|
26
|
+
type: StringConstructor;
|
|
27
|
+
default: string;
|
|
28
|
+
};
|
|
29
|
+
class: {
|
|
30
|
+
type: StringConstructor;
|
|
31
|
+
default: undefined;
|
|
32
|
+
};
|
|
33
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
36
|
+
store: {
|
|
37
|
+
type: PropType<DashboardStore>;
|
|
38
|
+
required: true;
|
|
39
|
+
};
|
|
40
|
+
labels: {
|
|
41
|
+
type: PropType<Record<string, string>>;
|
|
42
|
+
default: () => {};
|
|
43
|
+
};
|
|
44
|
+
label: {
|
|
45
|
+
type: StringConstructor;
|
|
46
|
+
default: string;
|
|
47
|
+
};
|
|
48
|
+
class: {
|
|
49
|
+
type: StringConstructor;
|
|
50
|
+
default: undefined;
|
|
51
|
+
};
|
|
52
|
+
}>> & Readonly<{}>, {
|
|
53
|
+
label: string;
|
|
54
|
+
class: string;
|
|
55
|
+
labels: Record<string, string>;
|
|
56
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
57
|
+
//# sourceMappingURL=SelectionLegend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionLegend.d.ts","sourceRoot":"","sources":["../../src/lib/SelectionLegend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AAExD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D,MAAM,MAAM,oBAAoB,GAAG;IACjC,sCAAsC;IACtC,KAAK,EAAE,cAAc,CAAC;IACtB,gFAAgF;IAChF,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe;;cAGC,QAAQ,CAAC,cAAc,CAAC;;;;cACvB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;;;;;;;;;;;;;;cADjC,QAAQ,CAAC,cAAc,CAAC;;;;cACvB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;;;;;;;;;;;;;;4EA0B5D,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineComponent, h } from 'vue';
|
|
2
|
+
import { Inline, SelectionChip } from '@sentropic/design-system-vue';
|
|
3
|
+
import {} from '@sentropic/dataviz-core';
|
|
4
|
+
import { useDashboard } from '../adapter.js';
|
|
5
|
+
/**
|
|
6
|
+
* Per-view selections rendered as design-system `SelectionChip`s. Renders
|
|
7
|
+
* nothing while there is no active selection.
|
|
8
|
+
*/
|
|
9
|
+
export const SelectionLegend = defineComponent({
|
|
10
|
+
name: 'SelectionLegend',
|
|
11
|
+
props: {
|
|
12
|
+
store: { type: Object, required: true },
|
|
13
|
+
labels: { type: Object, default: () => ({}) },
|
|
14
|
+
label: { type: String, default: 'Sélections actives' },
|
|
15
|
+
class: { type: String, default: undefined },
|
|
16
|
+
},
|
|
17
|
+
setup(props) {
|
|
18
|
+
const state = useDashboard(props.store);
|
|
19
|
+
return () => {
|
|
20
|
+
const entries = Object.entries(state.value.selections).filter(([, keys]) => keys.length > 0);
|
|
21
|
+
if (entries.length === 0)
|
|
22
|
+
return null;
|
|
23
|
+
return h(Inline, { role: 'group', 'aria-label': props.label, gap: 2, wrap: true, class: props.class }, {
|
|
24
|
+
default: () => entries.map(([viewId, keys]) => h(SelectionChip, {
|
|
25
|
+
key: viewId,
|
|
26
|
+
label: props.labels[viewId] ?? viewId,
|
|
27
|
+
count: keys.length,
|
|
28
|
+
onClear: () => props.store.clearSelection(viewId),
|
|
29
|
+
})),
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=SelectionLegend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionLegend.js","sourceRoot":"","sources":["../../src/lib/SelectionLegend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,CAAC,EAAiB,MAAM,KAAK,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAuB,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAY7C;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;IAC7C,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE;QACL,KAAK,EAAE,EAAE,IAAI,EAAE,MAAkC,EAAE,QAAQ,EAAE,IAAI,EAAE;QACnE,MAAM,EAAE,EAAE,IAAI,EAAE,MAA0C,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE;QACjF,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,EAAE;QACtD,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE;KAC5C;IACD,KAAK,CAAC,KAAK;QACT,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACxC,OAAO,GAAG,EAAE;YACV,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAC7F,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAC;YACtC,OAAO,CAAC,CACN,MAAM,EACN,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,EACpF;gBACE,OAAO,EAAE,GAAG,EAAE,CACZ,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAC7B,CAAC,CAAC,aAAa,EAAE;oBACf,GAAG,EAAE,MAAM;oBACX,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,MAAM;oBACrC,KAAK,EAAE,IAAI,CAAC,MAAM;oBAClB,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC;iBAClD,CAAC,CACH;aACJ,CACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
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 SmallMultiplesProps = {
|
|
5
|
+
/** The dashboard store to bind to. */
|
|
6
|
+
store: DashboardStore;
|
|
7
|
+
/** This view's id in the cross-filter graph. */
|
|
8
|
+
viewId: string;
|
|
9
|
+
/** Dimension whose distinct values each produce one facet (panel). */
|
|
10
|
+
facetBy: string;
|
|
11
|
+
/** Dimension to group rows by inside each facet (bar categories). */
|
|
12
|
+
dimension: string;
|
|
13
|
+
/** Measure id aggregated into each bar's value. */
|
|
14
|
+
measure: string;
|
|
15
|
+
/** Accessible label; each facet chart is "<label> — <facet key>". */
|
|
16
|
+
label: string;
|
|
17
|
+
/** Number of grid columns (design-system Grid). Defaults to 2. */
|
|
18
|
+
columns?: number;
|
|
19
|
+
/** Bar colour tone from the design system. */
|
|
20
|
+
tone?: BarChartTone;
|
|
21
|
+
class?: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Faceting / trellis: one design-system `BarChart` per distinct `facetBy`
|
|
25
|
+
* value, laid out in a `Grid`, all sharing a single value `domain` so the
|
|
26
|
+
* facets are visually comparable.
|
|
27
|
+
*/
|
|
28
|
+
export declare const SmallMultiples: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
29
|
+
store: {
|
|
30
|
+
type: PropType<DashboardStore>;
|
|
31
|
+
required: true;
|
|
32
|
+
};
|
|
33
|
+
viewId: {
|
|
34
|
+
type: StringConstructor;
|
|
35
|
+
required: true;
|
|
36
|
+
};
|
|
37
|
+
facetBy: {
|
|
38
|
+
type: StringConstructor;
|
|
39
|
+
required: true;
|
|
40
|
+
};
|
|
41
|
+
dimension: {
|
|
42
|
+
type: StringConstructor;
|
|
43
|
+
required: true;
|
|
44
|
+
};
|
|
45
|
+
measure: {
|
|
46
|
+
type: StringConstructor;
|
|
47
|
+
required: true;
|
|
48
|
+
};
|
|
49
|
+
label: {
|
|
50
|
+
type: StringConstructor;
|
|
51
|
+
required: true;
|
|
52
|
+
};
|
|
53
|
+
columns: {
|
|
54
|
+
type: NumberConstructor;
|
|
55
|
+
default: number;
|
|
56
|
+
};
|
|
57
|
+
tone: {
|
|
58
|
+
type: PropType<BarChartTone>;
|
|
59
|
+
default: undefined;
|
|
60
|
+
};
|
|
61
|
+
class: {
|
|
62
|
+
type: StringConstructor;
|
|
63
|
+
default: undefined;
|
|
64
|
+
};
|
|
65
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
66
|
+
[key: string]: any;
|
|
67
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
68
|
+
store: {
|
|
69
|
+
type: PropType<DashboardStore>;
|
|
70
|
+
required: true;
|
|
71
|
+
};
|
|
72
|
+
viewId: {
|
|
73
|
+
type: StringConstructor;
|
|
74
|
+
required: true;
|
|
75
|
+
};
|
|
76
|
+
facetBy: {
|
|
77
|
+
type: StringConstructor;
|
|
78
|
+
required: true;
|
|
79
|
+
};
|
|
80
|
+
dimension: {
|
|
81
|
+
type: StringConstructor;
|
|
82
|
+
required: true;
|
|
83
|
+
};
|
|
84
|
+
measure: {
|
|
85
|
+
type: StringConstructor;
|
|
86
|
+
required: true;
|
|
87
|
+
};
|
|
88
|
+
label: {
|
|
89
|
+
type: StringConstructor;
|
|
90
|
+
required: true;
|
|
91
|
+
};
|
|
92
|
+
columns: {
|
|
93
|
+
type: NumberConstructor;
|
|
94
|
+
default: number;
|
|
95
|
+
};
|
|
96
|
+
tone: {
|
|
97
|
+
type: PropType<BarChartTone>;
|
|
98
|
+
default: undefined;
|
|
99
|
+
};
|
|
100
|
+
class: {
|
|
101
|
+
type: StringConstructor;
|
|
102
|
+
default: undefined;
|
|
103
|
+
};
|
|
104
|
+
}>> & Readonly<{}>, {
|
|
105
|
+
class: string;
|
|
106
|
+
tone: BarChartTone;
|
|
107
|
+
columns: number;
|
|
108
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
109
|
+
//# sourceMappingURL=SmallMultiples.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmallMultiples.d.ts","sourceRoot":"","sources":["../../src/lib/SmallMultiples.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AACxD,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAGjC,MAAM,MAAM,mBAAmB,GAAG;IAChC,sCAAsC;IACtC,KAAK,EAAE,cAAc,CAAC;IACtB,gDAAgD;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAIF;;;;GAIG;AACH,eAAO,MAAM,cAAc;;cAGE,QAAQ,CAAC,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAOzB,QAAQ,CAAC,YAAY,CAAC;;;;;;;;;;;cAPrB,QAAQ,CAAC,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAOzB,QAAQ,CAAC,YAAY,CAAC;;;;;;;;;;;4EAmDhD,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { defineComponent, h } from 'vue';
|
|
2
|
+
import { Grid, BarChart, } from '@sentropic/design-system-vue';
|
|
3
|
+
import { findDimension, findMeasure, groupAggregate, } from '@sentropic/dataviz-core';
|
|
4
|
+
import { useDashboard } from '../adapter.js';
|
|
5
|
+
const keyOf = (v) => (v == null ? 'null' : String(v));
|
|
6
|
+
/**
|
|
7
|
+
* Faceting / trellis: one design-system `BarChart` per distinct `facetBy`
|
|
8
|
+
* value, laid out in a `Grid`, all sharing a single value `domain` so the
|
|
9
|
+
* facets are visually comparable.
|
|
10
|
+
*/
|
|
11
|
+
export const SmallMultiples = defineComponent({
|
|
12
|
+
name: 'SmallMultiples',
|
|
13
|
+
props: {
|
|
14
|
+
store: { type: Object, required: true },
|
|
15
|
+
viewId: { type: String, required: true },
|
|
16
|
+
facetBy: { type: String, required: true },
|
|
17
|
+
dimension: { type: String, required: true },
|
|
18
|
+
measure: { type: String, required: true },
|
|
19
|
+
label: { type: String, required: true },
|
|
20
|
+
columns: { type: Number, default: 2 },
|
|
21
|
+
tone: { type: String, default: undefined },
|
|
22
|
+
class: { type: String, default: undefined },
|
|
23
|
+
},
|
|
24
|
+
setup(props) {
|
|
25
|
+
const state = useDashboard(props.store);
|
|
26
|
+
return () => {
|
|
27
|
+
void state.value;
|
|
28
|
+
const fdim = findDimension(props.store.model, props.facetBy);
|
|
29
|
+
const dim = findDimension(props.store.model, props.dimension);
|
|
30
|
+
const m = findMeasure(props.store.model, props.measure);
|
|
31
|
+
let panels = [];
|
|
32
|
+
let domain;
|
|
33
|
+
if (fdim && dim && m) {
|
|
34
|
+
const rows = props.store.applyCrossfilter(props.viewId);
|
|
35
|
+
const keys = [];
|
|
36
|
+
const seen = new Set();
|
|
37
|
+
for (const row of rows) {
|
|
38
|
+
const k = keyOf(row[props.facetBy]);
|
|
39
|
+
if (!seen.has(k)) {
|
|
40
|
+
seen.add(k);
|
|
41
|
+
keys.push(k);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
let max = 0;
|
|
45
|
+
panels = keys.map((k) => {
|
|
46
|
+
const facetRows = rows.filter((row) => keyOf(row[props.facetBy]) === k);
|
|
47
|
+
const data = groupAggregate(facetRows, props.dimension, m).map(({ key: barKey, value }) => {
|
|
48
|
+
if (value > max)
|
|
49
|
+
max = value;
|
|
50
|
+
return props.tone ? { label: barKey, value, tone: props.tone } : { label: barKey, value };
|
|
51
|
+
});
|
|
52
|
+
return { key: k, data };
|
|
53
|
+
});
|
|
54
|
+
domain = panels.length ? [0, max] : undefined;
|
|
55
|
+
}
|
|
56
|
+
return h(Grid, { columns: props.columns, gap: 4, class: props.class, role: 'group', 'aria-label': props.label }, {
|
|
57
|
+
default: () => panels.map((panel) => h(BarChart, {
|
|
58
|
+
key: panel.key,
|
|
59
|
+
data: panel.data,
|
|
60
|
+
label: `${props.label} — ${panel.key}`,
|
|
61
|
+
domain,
|
|
62
|
+
})),
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=SmallMultiples.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmallMultiples.js","sourceRoot":"","sources":["../../src/lib/SmallMultiples.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,CAAC,EAAiB,MAAM,KAAK,CAAC;AACxD,OAAO,EACL,IAAI,EACJ,QAAQ,GAGT,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,aAAa,EACb,WAAW,EACX,cAAc,GAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAsB7C,MAAM,KAAK,GAAG,CAAC,CAAU,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/D;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAC;IAC5C,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE;QACL,KAAK,EAAE,EAAE,IAAI,EAAE,MAAkC,EAAE,QAAQ,EAAE,IAAI,EAAE;QACnE,MAAM,EAAE,EA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AG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YAChD,CAAC;YACD,OAAO,CAAC,CACN,IAAI,EACJ,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,CAAC,KAAK,EAAE,EAChG;gBACE,OAAO,EAAE,GAAG,EAAE,CACZ,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACnB,CAAC,CAAC,QAAQ,EAAE;oBACV,GAAG,EAAE,KAAK,CAAC,GAAG;oBACd,IAAI,EAAE,KAAK,CAAC,IAAI;oBAChB,KAAK,EAAE,GAAG,KAAK,CAAC,KAAK,MAAM,KAAK,CAAC,GAAG,EAAE;oBACtC,MAAM;iBACP,CAAC,CACH;aACJ,CACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentropic/dataviz-vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Vue 3 adapter for @sentropic/dataviz-core, built on @sentropic/design-system-vue.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"test": "vitest run"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@sentropic/dataviz-core": "0.
|
|
31
|
-
"@sentropic/design-system-vue": "0.
|
|
30
|
+
"@sentropic/dataviz-core": "0.2.0",
|
|
31
|
+
"@sentropic/design-system-vue": "0.18.0",
|
|
32
32
|
"@sentropic/design-system-themes": "0.11.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|