@design.estate/dees-catalog 21.27.0 → 21.28.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_bundle/bundle.js +2551 -2510
- package/dist_bundle/bundle.js.map +1 -1
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/demos/charts.d.ts +1 -0
- package/dist_ts_web/demos/charts.js +18 -5
- package/dist_ts_web/elements/00group-chart/dees-chart-donut/styles.js +5 -1
- package/dist_ts_web/elements/00group-chart/dees-chart-echarts-base.d.ts +25 -4
- package/dist_ts_web/elements/00group-chart/dees-chart-echarts-base.js +46 -9
- package/dist_ts_web/elements/00group-chart/dees-chart-echarts-styles.js +17 -4
- package/package.json +2 -1
- package/readme.md +23 -0
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/demos/charts.ts +17 -4
- package/ts_web/elements/00group-chart/dees-chart-donut/styles.ts +4 -0
- package/ts_web/elements/00group-chart/dees-chart-echarts-base.ts +40 -7
- package/ts_web/elements/00group-chart/dees-chart-echarts-styles.ts +16 -3
|
@@ -20,11 +20,20 @@ import { dcLocalize } from '../../i18n/localize.js';
|
|
|
20
20
|
* Handles library loading, chart lifecycle, resize observation, and theme switching.
|
|
21
21
|
* Subclasses implement `buildOption()` to define their chart configuration.
|
|
22
22
|
*
|
|
23
|
-
* A chart is a tile (`dees-tile`): its `label` heads it in the standard header bar
|
|
24
|
-
* a `dees-legend` whose items switch their series, is in the
|
|
25
|
-
*
|
|
26
|
-
*
|
|
23
|
+
* A chart is a tile (`dees-tile`): its `label` heads it in the standard header bar, with `meta` at
|
|
24
|
+
* the bar's end, and its legend, a `dees-legend` whose items switch their series, is in the
|
|
25
|
+
* standard footer bar. Rows of the host's own about the chart (a notice, what the chart leaves out,
|
|
26
|
+
* figures it does not end on) go into the slots `above` and `below`, over and under the plot: at
|
|
27
|
+
* the tile's inset, the header's, with the legend still the tile's last row at its full width. A
|
|
28
|
+
* host so needs no tile of its own around a chart: the chart is the tile. One header per tile: a
|
|
29
|
+
* chart in a pane that heads it already hands its title to the pane's header and leaves `label`
|
|
30
|
+
* and `meta` empty, and then draws no header row of its own; `summary` still names it to a screen
|
|
27
31
|
* reader.
|
|
32
|
+
*
|
|
33
|
+
* The host's height holds the whole tile (400px by default): the header, the rows, the plot and the
|
|
34
|
+
* legend, the plot taking what the rest leaves. A chart whose rows vary takes `height: auto`, and
|
|
35
|
+
* its plot is then `--dees-chart-plot-height` tall (320px by default, what the default height
|
|
36
|
+
* leaves the plot under a header and a legend of one row).
|
|
28
37
|
*/
|
|
29
38
|
export abstract class DeesChartEchartsBase extends DeesElement {
|
|
30
39
|
/** The chart's words and formats, in the reader's language. */
|
|
@@ -38,6 +47,14 @@ export abstract class DeesChartEchartsBase extends DeesElement {
|
|
|
38
47
|
@property({ reflect: true })
|
|
39
48
|
accessor label: string = '';
|
|
40
49
|
|
|
50
|
+
/**
|
|
51
|
+
* A short text at the end of the header bar, beside `label`: what the chart covers or in which
|
|
52
|
+
* terms ("Fiscal year 2026 to date · net of VAT"). Muted, as a table's `heading2`; where the tile
|
|
53
|
+
* is too narrow for both it wraps under the label, at its start, and the bar grows by that line.
|
|
54
|
+
*/
|
|
55
|
+
@property({ reflect: true })
|
|
56
|
+
accessor meta: string = '';
|
|
57
|
+
|
|
41
58
|
/** Drop the chart's outer frame and surface: the host already owns the surface. */
|
|
42
59
|
@property({ type: Boolean, reflect: true })
|
|
43
60
|
accessor frameless: boolean = false;
|
|
@@ -139,18 +156,34 @@ export abstract class DeesChartEchartsBase extends DeesElement {
|
|
|
139
156
|
off: !this.legendShown(item.name),
|
|
140
157
|
}));
|
|
141
158
|
return html`<dees-tile .frameless=${this.frameless}>
|
|
142
|
-
${this.label ? html`<div slot="header" class="chartHeader
|
|
143
|
-
|
|
159
|
+
${this.label || this.meta ? html`<div slot="header" class="chartHeader ${this.meta ? 'hasMeta' : ''}">${this.label
|
|
160
|
+
? html`<h2 class="chartLabel">${this.label}</h2>`
|
|
161
|
+
: ''}${this.meta ? html`<span class="chartMeta">${this.meta}</span>` : ''}</div>` : ''}
|
|
162
|
+
${this.renderRows('above')}
|
|
163
|
+
<div class="chartArea">
|
|
164
|
+
<div class="chartContainer" aria-hidden="true"><div class="chartPlot"></div></div>
|
|
165
|
+
${message ? html`<div class="chartState" role="status">${message}</div>` : ''}
|
|
166
|
+
</div>
|
|
167
|
+
${this.renderRows('below')}
|
|
144
168
|
<p class="chartSummary">${this.summary || this.dataSummary()}</p>
|
|
145
169
|
${legend.length ? html`<div slot="footer" class="chartLegend"><dees-legend interactive label=${this.t('chart.series')} .items=${legend} @item-toggle=${(event: CustomEvent<IDeesLegendToggleDetail>) => {
|
|
146
170
|
const hidden = new Set(this.hiddenSeries);
|
|
147
171
|
if (event.detail.on) hidden.delete(event.detail.item.label); else hidden.add(event.detail.item.label);
|
|
148
172
|
this.hiddenSeries = hidden; this.updateChart();
|
|
149
173
|
}}></dees-legend></div>` : ''}
|
|
150
|
-
${message ? html`<div class="chartState" role="status">${message}</div>` : ''}
|
|
151
174
|
</dees-tile>`;
|
|
152
175
|
}
|
|
153
176
|
|
|
177
|
+
/**
|
|
178
|
+
* The host's rows over or under the plot, from the slot `above` or `below`; no row, and no room,
|
|
179
|
+
* while nothing is slotted there. Read from the light DOM as each render runs, so the first frame
|
|
180
|
+
* already has them; a `slotchange` renders again.
|
|
181
|
+
*/
|
|
182
|
+
private renderRows(placeArg: 'above' | 'below'): TemplateResult {
|
|
183
|
+
const slotted = this.querySelector(`:scope > [slot="${placeArg}"]`) !== null;
|
|
184
|
+
return html`<div class="chartRows ${placeArg} ${slotted ? '' : 'empty'}"><slot name=${placeArg} @slotchange=${() => this.requestUpdate()}></slot></div>`;
|
|
185
|
+
}
|
|
186
|
+
|
|
154
187
|
public async updated(changedProperties: Map<PropertyKey, unknown>) {
|
|
155
188
|
super.updated(changedProperties);
|
|
156
189
|
if (changedProperties.has('goBright') && this.chartInstance) {
|
|
@@ -20,6 +20,11 @@ export const chartFrameStyles = css`
|
|
|
20
20
|
dees-tile::part(outer) { border-color: var(--dees-color-border-subtle); }
|
|
21
21
|
.chartHeader { ${tileHeaderBar} }
|
|
22
22
|
.chartLabel { flex: 1; min-width: 0; margin: 0; font: inherit; overflow-wrap: anywhere; }
|
|
23
|
+
/* The meta text at the end of the header's line, muted as a table's subtitle; where the tile is
|
|
24
|
+
too narrow for both it wraps under the title, at its start, and the bar grows by that line. */
|
|
25
|
+
.chartHeader.hasMeta { flex-wrap: wrap; gap: var(--dees-spacing-2xs) var(--dees-spacing-md); }
|
|
26
|
+
.chartHeader.hasMeta .chartLabel { flex: 1 1 auto; }
|
|
27
|
+
.chartMeta { min-width: 0; color: var(--dees-color-text-muted); font-weight: 400; overflow-wrap: anywhere; }
|
|
23
28
|
.chartLegend { ${tileFooterBar} }
|
|
24
29
|
.chartContainer { position: absolute; inset: 0; }
|
|
25
30
|
.chartState { position: absolute; inset: 0; display: grid; place-content: center; padding: 24px; text-align: center; color: var(--dees-color-text-muted); background: var(--dees-color-bg-primary); }
|
|
@@ -30,11 +35,19 @@ export const chartFrameStyles = css`
|
|
|
30
35
|
@media (pointer: coarse) { .expandBtn { width: var(--dees-control-height-touch); height: var(--dees-control-height-touch); } }
|
|
31
36
|
`;
|
|
32
37
|
/**
|
|
33
|
-
* The
|
|
34
|
-
*
|
|
35
|
-
*
|
|
38
|
+
* The tile's content is a column: the host's rows above, the plot, the host's rows below. The rows
|
|
39
|
+
* keep their height and sit at the tile's inset, the header's; the plot takes the rest of the
|
|
40
|
+
* host's height, or, while the host's height is `auto`, `--dees-chart-plot-height`.
|
|
41
|
+
*
|
|
42
|
+
* The element ECharts draws into fills the plot's frame, whatever position ECharts writes on it.
|
|
43
|
+
* ECharts insets its plot by 16px itself; under a region inset the frame adds the rest, so axes
|
|
44
|
+
* and labels line up with the header.
|
|
36
45
|
*/
|
|
37
46
|
const echartsPlotStyles = css`
|
|
47
|
+
dees-tile::part(content) { display: flex; flex-direction: column; }
|
|
48
|
+
.chartArea { position: relative; flex: 1 1 var(--dees-chart-plot-height, 320px); min-height: 0; }
|
|
49
|
+
.chartRows { flex: none; display: flex; flex-direction: column; gap: var(--dees-spacing-md); padding: var(--dees-spacing-md) var(--chart-inset-inline, var(--dees-spacing-lg)); }
|
|
50
|
+
.chartRows.empty { display: none; }
|
|
38
51
|
.chartContainer { inset-inline: calc(var(--chart-inset-inline, 16px) - 16px); }
|
|
39
52
|
.chartPlot { width: 100%; height: 100%; }
|
|
40
53
|
`;
|