@emuanalytics/flow-rdf-ui 4.1.0-preview.12 → 4.1.0-preview.14
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/components/chart/chart.component.mjs +18 -2
- package/dist/components/chart/chart.styles.mjs +20 -1
- package/dist/components/query-builder/helpers.mjs +15 -1
- package/dist/custom-elements.json +875 -819
- package/dist/index.d.mts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.mjs +1 -1
- package/dist/package.json.mjs +1 -1
- package/dist/vscode.html-custom-data.json +84 -79
- package/package.json +1 -1
- package/themes/dark.css +4 -4
- package/themes/dark.styles.js +4 -4
- package/themes/light.css +3 -3
- package/themes/light.styles.js +3 -3
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Chart } from 'chart.js';
|
|
2
|
-
import { html } from 'lit';
|
|
2
|
+
import { html, nothing } from 'lit';
|
|
3
3
|
import { property } from 'lit/decorators.js';
|
|
4
4
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
5
5
|
import FlowRdfElement from '../../internal/flow-ui-rdf-element.mjs';
|
|
6
6
|
import { watch } from '../../internal/watch.mjs';
|
|
7
7
|
import styles from './chart.styles.mjs';
|
|
8
|
+
import { HasSlotController } from '../../internal/slot.mjs';
|
|
9
|
+
import { isStringFull } from '../../internal/type-checks.mjs';
|
|
8
10
|
import { initializeChartJs } from './chartjs-support.mjs';
|
|
9
11
|
|
|
10
12
|
var __defProp = Object.defineProperty;
|
|
@@ -21,7 +23,9 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
21
23
|
class FlowUiChart extends FlowRdfElement {
|
|
22
24
|
constructor() {
|
|
23
25
|
super(...arguments);
|
|
26
|
+
this.hasSlotController = new HasSlotController(this, "label");
|
|
24
27
|
this._chartRef = createRef();
|
|
28
|
+
this.label = "";
|
|
25
29
|
this.plugins = [];
|
|
26
30
|
}
|
|
27
31
|
/** The Chart.js chart instance. */
|
|
@@ -54,14 +58,26 @@ class FlowUiChart extends FlowRdfElement {
|
|
|
54
58
|
}
|
|
55
59
|
}
|
|
56
60
|
render() {
|
|
61
|
+
const hasHeader = isStringFull(this.label) || this.hasSlotController.test("label");
|
|
57
62
|
return html`
|
|
58
63
|
<div part="base" class="chart">
|
|
59
|
-
|
|
64
|
+
${hasHeader ? html`
|
|
65
|
+
<header part="header" class="chart__header">
|
|
66
|
+
<span part="label" class="chart__label"><slot name="label">${this.label}</slot></span>
|
|
67
|
+
</header>
|
|
68
|
+
` : nothing}
|
|
69
|
+
|
|
70
|
+
<div class="chart_container">
|
|
71
|
+
<canvas ${ref(this._chartRef)}></canvas>
|
|
72
|
+
</div>
|
|
60
73
|
</div>
|
|
61
74
|
`;
|
|
62
75
|
}
|
|
63
76
|
}
|
|
64
77
|
FlowUiChart.styles = styles;
|
|
78
|
+
__decorateClass([
|
|
79
|
+
property()
|
|
80
|
+
], FlowUiChart.prototype, "label", 2);
|
|
65
81
|
__decorateClass([
|
|
66
82
|
property()
|
|
67
83
|
], FlowUiChart.prototype, "type", 2);
|
|
@@ -66,14 +66,33 @@ const styles = css`
|
|
|
66
66
|
|
|
67
67
|
--dataset-stroke-color-9: var(--flow-ui-chart-stroke-color-9, hsl(292.1 88.4% 57.7%));
|
|
68
68
|
--dataset-fill-color-9: var(--flow-ui-chart-fill-color-9, hsl(292.1 88.4% 57.7%));
|
|
69
|
+
|
|
70
|
+
--header-padding: var(--flow-ui-chart-header-padding, var(--flow-ui-spacing-x-small));
|
|
71
|
+
--header-height: var(--flow-ui-chart-header-height, var(--flow-ui-control-height-medium));
|
|
72
|
+
--header-font-size: var(--flow-ui-chart-header-font-size, var(--flow-ui-font-size-medium));
|
|
73
|
+
--header-color: var(--flow-ui-chart-header-color, var(--flow-ui-color-text));
|
|
69
74
|
}
|
|
70
75
|
|
|
71
76
|
.chart {
|
|
77
|
+
height: 100%;
|
|
72
78
|
background-color: var(--background-color);
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.chart__header {
|
|
84
|
+
flex: 0 0 auto;
|
|
85
|
+
padding: var(--header-padding);
|
|
86
|
+
height: var(--header-height);
|
|
87
|
+
font-size: var(--header-font-size);
|
|
88
|
+
color: var(--header-color);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.chart_container {
|
|
92
|
+
flex: 1;
|
|
73
93
|
position: relative;
|
|
74
94
|
width: 100%;
|
|
75
95
|
height: 100%;
|
|
76
|
-
/* padding: var(--flow-ui-spacing-x-small); */
|
|
77
96
|
}
|
|
78
97
|
`;
|
|
79
98
|
|
|
@@ -35,8 +35,22 @@ function transformRuleSet(ruleSet, transformFn, clone = true) {
|
|
|
35
35
|
}).filter(isRuleOrRuleset);
|
|
36
36
|
return ruleSet;
|
|
37
37
|
}
|
|
38
|
+
function countRuleSet(ruleset) {
|
|
39
|
+
const activeFilters = (ruleSet) => {
|
|
40
|
+
let count = 0;
|
|
41
|
+
for (const rule of ruleSet.rules) {
|
|
42
|
+
if (isRule(rule) && rule.field && rule.enabled) {
|
|
43
|
+
count += 1;
|
|
44
|
+
} else if (isRuleSet(rule)) {
|
|
45
|
+
count += activeFilters(rule);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return count;
|
|
49
|
+
};
|
|
50
|
+
return activeFilters(ruleset);
|
|
51
|
+
}
|
|
38
52
|
const isRule = (r) => isObjectFull(r) && "field" in r;
|
|
39
53
|
const isRuleSet = (r) => isObjectFull(r) && "rules" in r;
|
|
40
54
|
const isRuleOrRuleset = (r) => isRule(r) || isRuleSet(r);
|
|
41
55
|
|
|
42
|
-
export { filterRuleSet, isRule, isRuleOrRuleset, isRuleSet, renameRuleSetFields, transformRuleSet };
|
|
56
|
+
export { countRuleSet, filterRuleSet, isRule, isRuleOrRuleset, isRuleSet, renameRuleSetFields, transformRuleSet };
|