@design.estate/dees-catalog 3.55.2 → 3.55.4
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_bundle/bundle.js +2527 -1286
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/00group-chart/dees-chart-area/styles.js +12 -10
- package/dist_ts_web/elements/00group-chart/dees-chart-bar/component.d.ts +26 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-bar/component.js +200 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-bar/demo.d.ts +3 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-bar/demo.js +116 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-bar/index.d.ts +1 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-bar/index.js +2 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-bar/styles.d.ts +1 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-bar/styles.js +7 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-bar/template.d.ts +3 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-bar/template.js +12 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-donut/component.d.ts +25 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-donut/component.js +188 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-donut/demo.d.ts +3 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-donut/demo.js +122 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-donut/index.d.ts +1 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-donut/index.js +2 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-donut/styles.d.ts +1 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-donut/styles.js +11 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-donut/template.d.ts +3 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-donut/template.js +12 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-echarts-base.d.ts +22 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-echarts-base.js +140 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-echarts-styles.d.ts +1 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-echarts-styles.js +36 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-echarts-theme.d.ts +15 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-echarts-theme.js +67 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-gauge/component.d.ts +25 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-gauge/component.js +224 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-gauge/demo.d.ts +3 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-gauge/demo.js +124 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-gauge/index.d.ts +1 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-gauge/index.js +2 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-gauge/styles.d.ts +1 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-gauge/styles.js +11 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-gauge/template.d.ts +3 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-gauge/template.js +12 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-log/dees-chart-log.js +25 -25
- package/dist_ts_web/elements/00group-chart/dees-chart-radar/component.d.ts +28 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-radar/component.js +176 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-radar/demo.d.ts +3 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-radar/demo.js +113 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-radar/index.d.ts +1 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-radar/index.js +2 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-radar/styles.d.ts +1 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-radar/styles.js +7 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-radar/template.d.ts +3 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-radar/template.js +12 -0
- package/dist_ts_web/elements/00group-chart/index.d.ts +4 -0
- package/dist_ts_web/elements/00group-chart/index.js +5 -1
- package/dist_ts_web/elements/00group-dataview/dees-dataview-codebox/dees-dataview-codebox.d.ts +1 -0
- package/dist_ts_web/elements/00group-dataview/dees-dataview-codebox/dees-dataview-codebox.js +12 -7
- package/dist_ts_web/elements/00group-dataview/dees-dataview-statusobject/dees-dataview-statusobject.js +12 -12
- package/dist_ts_web/elements/00group-dataview/dees-statsgrid/dees-statsgrid.js +19 -19
- package/dist_ts_web/elements/00group-dataview/dees-table/styles.js +27 -27
- package/dist_ts_web/elements/00group-input/dees-input-code/dees-input-code.js +16 -16
- package/dist_ts_web/elements/00group-input/dees-input-richtext/styles.js +23 -21
- package/dist_ts_web/elements/00group-layout/dees-tile/dees-tile.js +7 -7
- package/dist_ts_web/elements/00group-media/dees-pdf-viewer/styles.js +5 -3
- package/dist_ts_web/elements/00group-overlay/dees-modal/dees-modal.js +11 -11
- package/dist_ts_web/elements/00group-simple/dees-shopping-productcard/dees-shopping-productcard.js +4 -4
- package/dist_ts_web/elements/00group-workspace/dees-workspace-terminal-preview/dees-workspace-terminal-preview.js +6 -6
- package/dist_ts_web/services/DeesServiceLibLoader.d.ts +31 -1
- package/dist_ts_web/services/DeesServiceLibLoader.js +31 -1
- package/dist_ts_web/services/index.d.ts +1 -1
- package/dist_ts_web/services/versions.d.ts +1 -0
- package/dist_ts_web/services/versions.js +2 -1
- package/dist_watch/bundle.js +2527 -1286
- package/dist_watch/bundle.js.map +4 -4
- package/package.json +2 -1
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/00group-chart/dees-chart-area/styles.ts +11 -9
- package/ts_web/elements/00group-chart/dees-chart-bar/component.ts +142 -0
- package/ts_web/elements/00group-chart/dees-chart-bar/demo.ts +120 -0
- package/ts_web/elements/00group-chart/dees-chart-bar/index.ts +1 -0
- package/ts_web/elements/00group-chart/dees-chart-bar/styles.ts +7 -0
- package/ts_web/elements/00group-chart/dees-chart-bar/template.ts +13 -0
- package/ts_web/elements/00group-chart/dees-chart-donut/component.ts +132 -0
- package/ts_web/elements/00group-chart/dees-chart-donut/demo.ts +127 -0
- package/ts_web/elements/00group-chart/dees-chart-donut/index.ts +1 -0
- package/ts_web/elements/00group-chart/dees-chart-donut/styles.ts +11 -0
- package/ts_web/elements/00group-chart/dees-chart-donut/template.ts +13 -0
- package/ts_web/elements/00group-chart/dees-chart-echarts-base.ts +107 -0
- package/ts_web/elements/00group-chart/dees-chart-echarts-styles.ts +36 -0
- package/ts_web/elements/00group-chart/dees-chart-echarts-theme.ts +72 -0
- package/ts_web/elements/00group-chart/dees-chart-gauge/component.ts +161 -0
- package/ts_web/elements/00group-chart/dees-chart-gauge/demo.ts +125 -0
- package/ts_web/elements/00group-chart/dees-chart-gauge/index.ts +1 -0
- package/ts_web/elements/00group-chart/dees-chart-gauge/styles.ts +11 -0
- package/ts_web/elements/00group-chart/dees-chart-gauge/template.ts +13 -0
- package/ts_web/elements/00group-chart/dees-chart-log/dees-chart-log.ts +24 -24
- package/ts_web/elements/00group-chart/dees-chart-radar/component.ts +130 -0
- package/ts_web/elements/00group-chart/dees-chart-radar/demo.ts +119 -0
- package/ts_web/elements/00group-chart/dees-chart-radar/index.ts +1 -0
- package/ts_web/elements/00group-chart/dees-chart-radar/styles.ts +7 -0
- package/ts_web/elements/00group-chart/dees-chart-radar/template.ts +13 -0
- package/ts_web/elements/00group-chart/index.ts +4 -0
- package/ts_web/elements/00group-dataview/dees-dataview-codebox/dees-dataview-codebox.ts +12 -5
- package/ts_web/elements/00group-dataview/dees-dataview-statusobject/dees-dataview-statusobject.ts +11 -11
- package/ts_web/elements/00group-dataview/dees-statsgrid/dees-statsgrid.ts +18 -18
- package/ts_web/elements/00group-dataview/dees-table/styles.ts +26 -26
- package/ts_web/elements/00group-input/dees-input-code/dees-input-code.ts +15 -15
- package/ts_web/elements/00group-input/dees-input-richtext/styles.ts +22 -20
- package/ts_web/elements/00group-layout/dees-tile/dees-tile.ts +6 -6
- package/ts_web/elements/00group-media/dees-pdf-viewer/styles.ts +4 -2
- package/ts_web/elements/00group-overlay/dees-modal/dees-modal.ts +10 -10
- package/ts_web/elements/00group-simple/dees-shopping-productcard/dees-shopping-productcard.ts +3 -3
- package/ts_web/elements/00group-workspace/dees-workspace-terminal-preview/dees-workspace-terminal-preview.ts +5 -5
- package/ts_web/services/DeesServiceLibLoader.ts +58 -1
- package/ts_web/services/index.ts +1 -1
- package/ts_web/services/versions.ts +1 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DeesElement,
|
|
3
|
+
property,
|
|
4
|
+
html,
|
|
5
|
+
type TemplateResult,
|
|
6
|
+
} from '@design.estate/dees-element';
|
|
7
|
+
|
|
8
|
+
import * as domtools from '@design.estate/dees-domtools';
|
|
9
|
+
import { DeesServiceLibLoader, type IEchartsBundle, type IEchartsInstance } from '../../services/index.js';
|
|
10
|
+
import { getEchartsThemeOptions } from './dees-chart-echarts-theme.js';
|
|
11
|
+
import '../00group-layout/dees-tile/dees-tile.js';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Abstract base class for ECharts-based chart components.
|
|
15
|
+
* Handles library loading, chart lifecycle, resize observation, and theme switching.
|
|
16
|
+
* Subclasses implement `buildOption()` to define their chart configuration.
|
|
17
|
+
*/
|
|
18
|
+
export abstract class DeesChartEchartsBase extends DeesElement {
|
|
19
|
+
@property()
|
|
20
|
+
accessor label: string = 'Untitled Chart';
|
|
21
|
+
|
|
22
|
+
protected chartInstance: IEchartsInstance | null = null;
|
|
23
|
+
protected echartsBundle: IEchartsBundle | null = null;
|
|
24
|
+
private resizeObserver: ResizeObserver | null = null;
|
|
25
|
+
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
domtools.elementBasic.setup();
|
|
29
|
+
this.registerGarbageFunction(async () => {
|
|
30
|
+
if (this.resizeObserver) {
|
|
31
|
+
this.resizeObserver.disconnect();
|
|
32
|
+
this.resizeObserver = null;
|
|
33
|
+
}
|
|
34
|
+
if (this.chartInstance) {
|
|
35
|
+
try {
|
|
36
|
+
this.chartInstance.dispose();
|
|
37
|
+
this.chartInstance = null;
|
|
38
|
+
} catch (e) {
|
|
39
|
+
console.error('Error disposing ECharts instance:', e);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public render(): TemplateResult {
|
|
46
|
+
return html`
|
|
47
|
+
<dees-tile>
|
|
48
|
+
<div slot="header" class="chartHeader">
|
|
49
|
+
<span class="chartLabel">${this.label}</span>
|
|
50
|
+
</div>
|
|
51
|
+
<div class="chartContainer"></div>
|
|
52
|
+
</dees-tile>
|
|
53
|
+
`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public async firstUpdated() {
|
|
57
|
+
await this.domtoolsPromise;
|
|
58
|
+
this.echartsBundle = await DeesServiceLibLoader.getInstance().loadEcharts();
|
|
59
|
+
await new Promise(resolve => requestAnimationFrame(resolve));
|
|
60
|
+
|
|
61
|
+
const chartContainer = this.shadowRoot!.querySelector('.chartContainer') as HTMLDivElement;
|
|
62
|
+
if (!chartContainer) return;
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
this.chartInstance = this.echartsBundle.init(chartContainer);
|
|
66
|
+
this.updateChart();
|
|
67
|
+
|
|
68
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
69
|
+
this.chartInstance?.resize();
|
|
70
|
+
});
|
|
71
|
+
this.resizeObserver.observe(chartContainer);
|
|
72
|
+
} catch (error) {
|
|
73
|
+
console.error('Failed to initialize ECharts:', error);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public async updated(changedProperties: Map<string, any>) {
|
|
78
|
+
super.updated(changedProperties);
|
|
79
|
+
if (changedProperties.has('goBright') && this.chartInstance) {
|
|
80
|
+
this.applyTheme();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
protected abstract buildOption(): Record<string, any>;
|
|
85
|
+
|
|
86
|
+
protected updateChart(): void {
|
|
87
|
+
if (!this.chartInstance) return;
|
|
88
|
+
const themeOptions = getEchartsThemeOptions(this.goBright);
|
|
89
|
+
const chartOption = this.buildOption();
|
|
90
|
+
// Merge theme defaults with chart-specific options
|
|
91
|
+
const merged = {
|
|
92
|
+
...themeOptions,
|
|
93
|
+
...chartOption,
|
|
94
|
+
textStyle: { ...themeOptions.textStyle, ...(chartOption.textStyle || {}) },
|
|
95
|
+
tooltip: { ...themeOptions.tooltip, ...(chartOption.tooltip || {}) },
|
|
96
|
+
};
|
|
97
|
+
this.chartInstance.setOption(merged, true);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
protected applyTheme(): void {
|
|
101
|
+
this.updateChart();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
public async forceResize(): Promise<void> {
|
|
105
|
+
this.chartInstance?.resize();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { css, cssManager } from '@design.estate/dees-element';
|
|
2
|
+
import { themeDefaultStyles } from '../00theme.js';
|
|
3
|
+
|
|
4
|
+
export const echartsBaseStyles = [
|
|
5
|
+
themeDefaultStyles,
|
|
6
|
+
cssManager.defaultStyles,
|
|
7
|
+
css`
|
|
8
|
+
:host {
|
|
9
|
+
display: block;
|
|
10
|
+
height: 400px;
|
|
11
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
|
|
12
|
+
color: var(--dees-color-text-primary);
|
|
13
|
+
font-size: 14px;
|
|
14
|
+
}
|
|
15
|
+
dees-tile {
|
|
16
|
+
height: 100%;
|
|
17
|
+
}
|
|
18
|
+
.chartHeader {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
height: 32px;
|
|
22
|
+
padding: 0 8px 0 16px;
|
|
23
|
+
}
|
|
24
|
+
.chartLabel {
|
|
25
|
+
flex: 1;
|
|
26
|
+
font-size: 14px;
|
|
27
|
+
font-weight: 500;
|
|
28
|
+
letter-spacing: -0.01em;
|
|
29
|
+
color: var(--dees-color-text-secondary);
|
|
30
|
+
}
|
|
31
|
+
.chartContainer {
|
|
32
|
+
position: absolute;
|
|
33
|
+
inset: 0;
|
|
34
|
+
}
|
|
35
|
+
`,
|
|
36
|
+
];
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared theme utilities for ECharts-based chart components.
|
|
3
|
+
* Uses the centralized themeDefaults tokens so chart colors stay in sync
|
|
4
|
+
* with the rest of the dees-catalog design system.
|
|
5
|
+
*
|
|
6
|
+
* ECharts renders on <canvas> and cannot read CSS custom properties,
|
|
7
|
+
* so we reference the TypeScript source-of-truth (themeDefaults) directly.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { themeDefaults } from '../00theme.js';
|
|
11
|
+
|
|
12
|
+
const light = themeDefaults.colors.light;
|
|
13
|
+
const dark = themeDefaults.colors.dark;
|
|
14
|
+
|
|
15
|
+
const SERIES_COLORS = {
|
|
16
|
+
dark: [
|
|
17
|
+
dark.accentPrimary, // blue
|
|
18
|
+
'hsl(173.4 80.4% 40%)', // teal (no token yet)
|
|
19
|
+
'hsl(280.3 87.4% 66.7%)', // purple (no token yet)
|
|
20
|
+
dark.accentWarning, // orange/amber
|
|
21
|
+
dark.accentSuccess, // green
|
|
22
|
+
dark.accentError, // rose/red
|
|
23
|
+
],
|
|
24
|
+
light: [
|
|
25
|
+
light.accentPrimary,
|
|
26
|
+
'hsl(142.1 76.2% 36.3%)', // teal (no token yet)
|
|
27
|
+
'hsl(280.3 47.7% 50.2%)', // purple (no token yet)
|
|
28
|
+
light.accentWarning,
|
|
29
|
+
light.accentSuccess,
|
|
30
|
+
light.accentError,
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export function getEchartsSeriesColors(goBright: boolean): string[] {
|
|
35
|
+
return goBright ? SERIES_COLORS.light : SERIES_COLORS.dark;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function getEchartsThemeOptions(goBright: boolean): Record<string, any> {
|
|
39
|
+
const colors = goBright ? light : dark;
|
|
40
|
+
return {
|
|
41
|
+
backgroundColor: 'transparent',
|
|
42
|
+
textStyle: {
|
|
43
|
+
color: colors.textSecondary,
|
|
44
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
|
|
45
|
+
fontSize: 12,
|
|
46
|
+
},
|
|
47
|
+
color: goBright ? SERIES_COLORS.light : SERIES_COLORS.dark,
|
|
48
|
+
tooltip: {
|
|
49
|
+
backgroundColor: colors.bgPrimary,
|
|
50
|
+
borderColor: colors.borderDefault,
|
|
51
|
+
textStyle: {
|
|
52
|
+
color: colors.textPrimary,
|
|
53
|
+
fontSize: 12,
|
|
54
|
+
},
|
|
55
|
+
confine: true,
|
|
56
|
+
},
|
|
57
|
+
legend: {
|
|
58
|
+
textStyle: {
|
|
59
|
+
color: colors.textSecondary,
|
|
60
|
+
fontSize: 12,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Helper to get the resolved theme colors object for use in buildOption().
|
|
68
|
+
* Components can use this instead of hardcoding dark/light color values.
|
|
69
|
+
*/
|
|
70
|
+
export function getThemeColors(goBright: boolean) {
|
|
71
|
+
return goBright ? light : dark;
|
|
72
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import {
|
|
2
|
+
customElement,
|
|
3
|
+
property,
|
|
4
|
+
type TemplateResult,
|
|
5
|
+
} from '@design.estate/dees-element';
|
|
6
|
+
|
|
7
|
+
import { DeesChartEchartsBase } from '../dees-chart-echarts-base.js';
|
|
8
|
+
import { demoFunc } from './demo.js';
|
|
9
|
+
import { gaugeStyles } from './styles.js';
|
|
10
|
+
import { renderChartGauge } from './template.js';
|
|
11
|
+
import { getEchartsSeriesColors, getThemeColors } from '../dees-chart-echarts-theme.js';
|
|
12
|
+
|
|
13
|
+
export interface IGaugeThreshold {
|
|
14
|
+
value: number;
|
|
15
|
+
color: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare global {
|
|
19
|
+
interface HTMLElementTagNameMap {
|
|
20
|
+
'dees-chart-gauge': DeesChartGauge;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@customElement('dees-chart-gauge')
|
|
25
|
+
export class DeesChartGauge extends DeesChartEchartsBase {
|
|
26
|
+
public static demo = demoFunc;
|
|
27
|
+
public static demoGroups = ['Chart'];
|
|
28
|
+
|
|
29
|
+
@property({ type: Number })
|
|
30
|
+
accessor value: number = 0;
|
|
31
|
+
|
|
32
|
+
@property({ type: Number })
|
|
33
|
+
accessor min: number = 0;
|
|
34
|
+
|
|
35
|
+
@property({ type: Number })
|
|
36
|
+
accessor max: number = 100;
|
|
37
|
+
|
|
38
|
+
@property({ type: String })
|
|
39
|
+
accessor unit: string = '%';
|
|
40
|
+
|
|
41
|
+
@property({ type: Array })
|
|
42
|
+
accessor thresholds: IGaugeThreshold[] = [];
|
|
43
|
+
|
|
44
|
+
@property({ type: Boolean })
|
|
45
|
+
accessor showTicks: boolean = true;
|
|
46
|
+
|
|
47
|
+
public static styles = gaugeStyles;
|
|
48
|
+
|
|
49
|
+
public render(): TemplateResult {
|
|
50
|
+
return renderChartGauge(this);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public async updated(changedProperties: Map<string, any>) {
|
|
54
|
+
super.updated(changedProperties);
|
|
55
|
+
if (
|
|
56
|
+
this.chartInstance &&
|
|
57
|
+
(changedProperties.has('value') ||
|
|
58
|
+
changedProperties.has('min') ||
|
|
59
|
+
changedProperties.has('max') ||
|
|
60
|
+
changedProperties.has('unit') ||
|
|
61
|
+
changedProperties.has('thresholds') ||
|
|
62
|
+
changedProperties.has('showTicks'))
|
|
63
|
+
) {
|
|
64
|
+
this.updateChart();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
protected buildOption(): Record<string, any> {
|
|
69
|
+
const colors = getThemeColors(this.goBright);
|
|
70
|
+
const seriesColors = getEchartsSeriesColors(this.goBright);
|
|
71
|
+
const primaryColor = seriesColors[0];
|
|
72
|
+
|
|
73
|
+
// Build axis line color stops from thresholds
|
|
74
|
+
let axisLineColors: Array<[number, string]>;
|
|
75
|
+
if (this.thresholds.length > 0) {
|
|
76
|
+
const sorted = [...this.thresholds].sort((a, b) => a.value - b.value);
|
|
77
|
+
axisLineColors = sorted.map((t) => [
|
|
78
|
+
(t.value - this.min) / (this.max - this.min),
|
|
79
|
+
t.color,
|
|
80
|
+
]);
|
|
81
|
+
// Ensure we end at 1
|
|
82
|
+
if (axisLineColors[axisLineColors.length - 1][0] < 1) {
|
|
83
|
+
axisLineColors.push([1, sorted[sorted.length - 1].color]);
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
axisLineColors = [[1, primaryColor]];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
series: [
|
|
91
|
+
{
|
|
92
|
+
type: 'gauge',
|
|
93
|
+
min: this.min,
|
|
94
|
+
max: this.max,
|
|
95
|
+
startAngle: 220,
|
|
96
|
+
endAngle: -40,
|
|
97
|
+
progress: {
|
|
98
|
+
show: true,
|
|
99
|
+
width: 14,
|
|
100
|
+
roundCap: true,
|
|
101
|
+
},
|
|
102
|
+
pointer: {
|
|
103
|
+
show: true,
|
|
104
|
+
length: '60%',
|
|
105
|
+
width: 5,
|
|
106
|
+
itemStyle: {
|
|
107
|
+
color: 'auto',
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
axisLine: {
|
|
111
|
+
lineStyle: {
|
|
112
|
+
width: 14,
|
|
113
|
+
color: axisLineColors,
|
|
114
|
+
opacity: 0.3,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
axisTick: {
|
|
118
|
+
show: this.showTicks,
|
|
119
|
+
distance: -20,
|
|
120
|
+
length: 6,
|
|
121
|
+
lineStyle: {
|
|
122
|
+
color: colors.borderStrong,
|
|
123
|
+
width: 1,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
splitLine: {
|
|
127
|
+
show: this.showTicks,
|
|
128
|
+
distance: -24,
|
|
129
|
+
length: 10,
|
|
130
|
+
lineStyle: {
|
|
131
|
+
color: colors.textMuted,
|
|
132
|
+
width: 2,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
axisLabel: {
|
|
136
|
+
show: this.showTicks,
|
|
137
|
+
distance: 30,
|
|
138
|
+
color: colors.textMuted,
|
|
139
|
+
fontSize: 11,
|
|
140
|
+
},
|
|
141
|
+
detail: {
|
|
142
|
+
valueAnimation: true,
|
|
143
|
+
fontSize: 28,
|
|
144
|
+
fontWeight: 600,
|
|
145
|
+
offsetCenter: [0, '65%'],
|
|
146
|
+
color: colors.textPrimary,
|
|
147
|
+
formatter: `{value}${this.unit}`,
|
|
148
|
+
},
|
|
149
|
+
title: {
|
|
150
|
+
show: false,
|
|
151
|
+
},
|
|
152
|
+
data: [
|
|
153
|
+
{
|
|
154
|
+
value: this.value,
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { html, css, cssManager } from '@design.estate/dees-element';
|
|
2
|
+
import type { DeesChartGauge } from './component.js';
|
|
3
|
+
import '@design.estate/dees-wcctools/demotools';
|
|
4
|
+
import './component.js';
|
|
5
|
+
|
|
6
|
+
export const demoFunc = () => {
|
|
7
|
+
const defaultThresholds = [
|
|
8
|
+
{ value: 60, color: 'hsl(142 76% 36%)' },
|
|
9
|
+
{ value: 80, color: 'hsl(38 92% 50%)' },
|
|
10
|
+
{ value: 100, color: 'hsl(0 72% 50%)' },
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
return html`
|
|
14
|
+
<dees-demowrapper .runAfterRender=${async (elementArg: HTMLElement) => {
|
|
15
|
+
const cpuGauge = elementArg.querySelector('#cpu-gauge') as DeesChartGauge;
|
|
16
|
+
const memGauge = elementArg.querySelector('#mem-gauge') as DeesChartGauge;
|
|
17
|
+
const slaGauge = elementArg.querySelector('#sla-gauge') as DeesChartGauge;
|
|
18
|
+
|
|
19
|
+
let animInterval: number | null = null;
|
|
20
|
+
|
|
21
|
+
const buttons = elementArg.querySelectorAll('dees-button');
|
|
22
|
+
buttons.forEach((button: any) => {
|
|
23
|
+
const text = button.text?.trim();
|
|
24
|
+
if (text === 'Animate') {
|
|
25
|
+
button.addEventListener('click', () => {
|
|
26
|
+
if (animInterval) return;
|
|
27
|
+
animInterval = window.setInterval(() => {
|
|
28
|
+
cpuGauge.value = Math.round(30 + Math.random() * 60);
|
|
29
|
+
memGauge.value = Math.round(40 + Math.random() * 50);
|
|
30
|
+
slaGauge.value = Math.round((95 + Math.random() * 5) * 100) / 100;
|
|
31
|
+
}, 2000);
|
|
32
|
+
});
|
|
33
|
+
} else if (text === 'Stop') {
|
|
34
|
+
button.addEventListener('click', () => {
|
|
35
|
+
if (animInterval) {
|
|
36
|
+
window.clearInterval(animInterval);
|
|
37
|
+
animInterval = null;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
} else if (text === 'Spike') {
|
|
41
|
+
button.addEventListener('click', () => {
|
|
42
|
+
cpuGauge.value = 95;
|
|
43
|
+
memGauge.value = 88;
|
|
44
|
+
slaGauge.value = 96.5;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}}>
|
|
49
|
+
<style>
|
|
50
|
+
${css`
|
|
51
|
+
.demoBox {
|
|
52
|
+
position: relative;
|
|
53
|
+
background: ${cssManager.bdTheme('hsl(0 0% 95%)', 'hsl(0 0% 9%)')};
|
|
54
|
+
height: 100%;
|
|
55
|
+
width: 100%;
|
|
56
|
+
padding: 40px;
|
|
57
|
+
box-sizing: border-box;
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
gap: 24px;
|
|
61
|
+
}
|
|
62
|
+
.gaugeRow {
|
|
63
|
+
display: grid;
|
|
64
|
+
grid-template-columns: 1fr 1fr 1fr;
|
|
65
|
+
gap: 24px;
|
|
66
|
+
}
|
|
67
|
+
.controls {
|
|
68
|
+
display: flex;
|
|
69
|
+
gap: 12px;
|
|
70
|
+
margin-bottom: 8px;
|
|
71
|
+
}
|
|
72
|
+
.info {
|
|
73
|
+
color: ${cssManager.bdTheme('hsl(215.4 16.3% 56.9%)', 'hsl(215 20.2% 55.1%)')};
|
|
74
|
+
font-size: 12px;
|
|
75
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Geist Sans', sans-serif;
|
|
76
|
+
text-align: center;
|
|
77
|
+
margin-top: 8px;
|
|
78
|
+
}
|
|
79
|
+
`}
|
|
80
|
+
</style>
|
|
81
|
+
<div class="demoBox">
|
|
82
|
+
<div class="controls">
|
|
83
|
+
<dees-button-group label="Actions:">
|
|
84
|
+
<dees-button>Animate</dees-button>
|
|
85
|
+
<dees-button>Stop</dees-button>
|
|
86
|
+
<dees-button>Spike</dees-button>
|
|
87
|
+
</dees-button-group>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<div class="gaugeRow">
|
|
91
|
+
<dees-chart-gauge
|
|
92
|
+
id="cpu-gauge"
|
|
93
|
+
.label=${'CPU Usage'}
|
|
94
|
+
.value=${42}
|
|
95
|
+
.unit=${'%'}
|
|
96
|
+
.thresholds=${defaultThresholds}
|
|
97
|
+
></dees-chart-gauge>
|
|
98
|
+
|
|
99
|
+
<dees-chart-gauge
|
|
100
|
+
id="mem-gauge"
|
|
101
|
+
.label=${'Memory Usage'}
|
|
102
|
+
.value=${67}
|
|
103
|
+
.unit=${'%'}
|
|
104
|
+
.thresholds=${defaultThresholds}
|
|
105
|
+
></dees-chart-gauge>
|
|
106
|
+
|
|
107
|
+
<dees-chart-gauge
|
|
108
|
+
id="sla-gauge"
|
|
109
|
+
.label=${'SLA Uptime'}
|
|
110
|
+
.value=${99.8}
|
|
111
|
+
.min=${95}
|
|
112
|
+
.max=${100}
|
|
113
|
+
.unit=${'%'}
|
|
114
|
+
.showTicks=${true}
|
|
115
|
+
></dees-chart-gauge>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<div class="info">
|
|
119
|
+
Gauge chart with animated value transitions and threshold coloring •
|
|
120
|
+
Click 'Animate' for live updates, 'Spike' to simulate high load
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</dees-demowrapper>
|
|
124
|
+
`;
|
|
125
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './component.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { html, type TemplateResult } from '@design.estate/dees-element';
|
|
2
|
+
import type { DeesChartGauge } from './component.js';
|
|
3
|
+
|
|
4
|
+
export const renderChartGauge = (component: DeesChartGauge): TemplateResult => {
|
|
5
|
+
return html`
|
|
6
|
+
<dees-tile>
|
|
7
|
+
<div slot="header" class="chartHeader">
|
|
8
|
+
<span class="chartLabel">${component.label}</span>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="chartContainer"></div>
|
|
11
|
+
</dees-tile>
|
|
12
|
+
`;
|
|
13
|
+
};
|
|
@@ -106,7 +106,7 @@ export class DeesChartLog extends DeesElement {
|
|
|
106
106
|
display: block;
|
|
107
107
|
height: 400px;
|
|
108
108
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
109
|
-
color:
|
|
109
|
+
color: var(--dees-color-text-primary);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
dees-tile {
|
|
@@ -124,7 +124,7 @@ export class DeesChartLog extends DeesElement {
|
|
|
124
124
|
.title {
|
|
125
125
|
font-weight: 500;
|
|
126
126
|
font-size: 14px;
|
|
127
|
-
color:
|
|
127
|
+
color: var(--dees-color-text-primary);
|
|
128
128
|
white-space: nowrap;
|
|
129
129
|
}
|
|
130
130
|
|
|
@@ -141,10 +141,10 @@ export class DeesChartLog extends DeesElement {
|
|
|
141
141
|
flex: 1;
|
|
142
142
|
padding: 4px 8px;
|
|
143
143
|
font-size: 12px;
|
|
144
|
-
border: 1px solid
|
|
144
|
+
border: 1px solid var(--dees-color-border-default);
|
|
145
145
|
border-radius: 4px;
|
|
146
|
-
background:
|
|
147
|
-
color:
|
|
146
|
+
background: var(--dees-color-bg-primary);
|
|
147
|
+
color: var(--dees-color-text-primary);
|
|
148
148
|
outline: none;
|
|
149
149
|
}
|
|
150
150
|
|
|
@@ -153,7 +153,7 @@ export class DeesChartLog extends DeesElement {
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
.search-box input::placeholder {
|
|
156
|
-
color:
|
|
156
|
+
color: var(--dees-color-text-muted);
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
.search-nav {
|
|
@@ -164,35 +164,35 @@ export class DeesChartLog extends DeesElement {
|
|
|
164
164
|
.search-nav button {
|
|
165
165
|
padding: 4px 6px;
|
|
166
166
|
font-size: 11px;
|
|
167
|
-
background:
|
|
168
|
-
border: 1px solid
|
|
167
|
+
background: var(--dees-color-bg-primary);
|
|
168
|
+
border: 1px solid var(--dees-color-border-default);
|
|
169
169
|
border-radius: 3px;
|
|
170
|
-
color:
|
|
170
|
+
color: var(--dees-color-text-muted);
|
|
171
171
|
cursor: pointer;
|
|
172
172
|
line-height: 1;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
.search-nav button:hover {
|
|
176
|
-
background:
|
|
177
|
-
color:
|
|
176
|
+
background: var(--dees-color-hover);
|
|
177
|
+
color: var(--dees-color-text-primary);
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
.filter-toggle {
|
|
181
181
|
padding: 4px 8px;
|
|
182
182
|
font-size: 11px;
|
|
183
183
|
font-weight: 500;
|
|
184
|
-
background:
|
|
185
|
-
border: 1px solid
|
|
184
|
+
background: var(--dees-color-bg-primary);
|
|
185
|
+
border: 1px solid var(--dees-color-border-default);
|
|
186
186
|
border-radius: 4px;
|
|
187
|
-
color:
|
|
187
|
+
color: var(--dees-color-text-muted);
|
|
188
188
|
cursor: pointer;
|
|
189
189
|
transition: all 0.15s;
|
|
190
190
|
white-space: nowrap;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
.filter-toggle:hover {
|
|
194
|
-
background:
|
|
195
|
-
color:
|
|
194
|
+
background: var(--dees-color-hover);
|
|
195
|
+
color: var(--dees-color-text-primary);
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
.filter-toggle.active {
|
|
@@ -208,11 +208,11 @@ export class DeesChartLog extends DeesElement {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
.control-button {
|
|
211
|
-
background:
|
|
212
|
-
border: 1px solid
|
|
211
|
+
background: var(--dees-color-bg-primary);
|
|
212
|
+
border: 1px solid var(--dees-color-border-default);
|
|
213
213
|
border-radius: 4px;
|
|
214
214
|
padding: 4px 10px;
|
|
215
|
-
color:
|
|
215
|
+
color: var(--dees-color-text-muted);
|
|
216
216
|
cursor: pointer;
|
|
217
217
|
font-size: 12px;
|
|
218
218
|
font-weight: 500;
|
|
@@ -220,9 +220,9 @@ export class DeesChartLog extends DeesElement {
|
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
.control-button:hover {
|
|
223
|
-
background:
|
|
224
|
-
border-color:
|
|
225
|
-
color:
|
|
223
|
+
background: var(--dees-color-hover);
|
|
224
|
+
border-color: var(--dees-color-border-strong);
|
|
225
|
+
color: var(--dees-color-text-primary);
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
.control-button.active {
|
|
@@ -247,7 +247,7 @@ export class DeesChartLog extends DeesElement {
|
|
|
247
247
|
align-items: center;
|
|
248
248
|
justify-content: center;
|
|
249
249
|
height: 100%;
|
|
250
|
-
color:
|
|
250
|
+
color: var(--dees-color-text-muted);
|
|
251
251
|
font-style: italic;
|
|
252
252
|
font-size: 13px;
|
|
253
253
|
}
|
|
@@ -299,7 +299,7 @@ export class DeesChartLog extends DeesElement {
|
|
|
299
299
|
|
|
300
300
|
.metric.rate {
|
|
301
301
|
margin-left: auto;
|
|
302
|
-
color:
|
|
302
|
+
color: var(--dees-color-text-muted);
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
.metric.rate::before {
|