@flux-ui/statistics 3.0.0-next.74 → 3.0.0-next.75
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/component/FluxStatisticsLegend.vue.d.ts +7 -1
- package/dist/composable/index.d.ts +2 -0
- package/dist/composable/useLegendVariant.d.ts +3 -0
- package/dist/index.css +38 -0
- package/dist/index.js +23 -5
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/component/FluxStatisticsLegend.vue +23 -3
- package/src/component/FluxStatisticsLegendItem.vue +9 -2
- package/src/composable/index.ts +2 -0
- package/src/composable/useLegendVariant.ts +5 -0
- package/src/css/Legend.module.scss +45 -0
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { FluxDirection } from '@flux-ui/types';
|
|
2
|
+
import { FluxStatisticsLegendVariant } from '../composable';
|
|
1
3
|
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
4
|
+
type __VLS_Props = {
|
|
5
|
+
readonly direction?: FluxDirection;
|
|
6
|
+
readonly variant?: FluxStatisticsLegendVariant;
|
|
7
|
+
};
|
|
2
8
|
declare var __VLS_1: {};
|
|
3
9
|
type __VLS_Slots = {} & {
|
|
4
10
|
default?: (props: typeof __VLS_1) => any;
|
|
5
11
|
};
|
|
6
|
-
declare const __VLS_base: DefineComponent<
|
|
12
|
+
declare const __VLS_base: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
7
13
|
declare const _default: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
8
14
|
export default _default;
|
|
9
15
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -10,3 +10,5 @@ export type { UseChartSlicesSetupReturn } from './useChartSlicesSetup';
|
|
|
10
10
|
export { useChartSlicesSetup } from './useChartSlicesSetup';
|
|
11
11
|
export type { EChartsInstance, EChartsOption, UseEChartsReturn } from './useECharts';
|
|
12
12
|
export { useECharts } from './useECharts';
|
|
13
|
+
export type { FluxStatisticsLegendVariant } from './useLegendVariant';
|
|
14
|
+
export { FluxStatisticsLegendVariantInjectionKey } from './useLegendVariant';
|
package/dist/index.css
CHANGED
|
@@ -513,6 +513,44 @@
|
|
|
513
513
|
right: 0;
|
|
514
514
|
content: "";
|
|
515
515
|
border-top: 1px dashed var(--surface-stroke);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
.statistics-legend-compact {
|
|
519
|
+
display: flex;
|
|
520
|
+
user-select: none;
|
|
521
|
+
}
|
|
522
|
+
.statistics-legend-compact.is-horizontal {
|
|
523
|
+
flex-flow: row wrap;
|
|
524
|
+
gap: 12px 18px;
|
|
525
|
+
}
|
|
526
|
+
.statistics-legend-compact.is-vertical {
|
|
527
|
+
flex-flow: column;
|
|
528
|
+
gap: 12px;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.statistics-legend-item-compact {
|
|
532
|
+
--color: var(--primary-600);
|
|
533
|
+
display: flex;
|
|
534
|
+
align-items: center;
|
|
535
|
+
flex-flow: row nowrap;
|
|
536
|
+
gap: 6px;
|
|
537
|
+
font-size: 14px;
|
|
538
|
+
line-height: 1;
|
|
539
|
+
white-space: nowrap;
|
|
540
|
+
}
|
|
541
|
+
.statistics-legend-item-compact .statistics-legend-item-color {
|
|
542
|
+
margin: 0;
|
|
543
|
+
border-radius: var(--radius-full);
|
|
544
|
+
}
|
|
545
|
+
.statistics-legend-item-compact .statistics-legend-item-icon {
|
|
546
|
+
margin: 0;
|
|
547
|
+
}
|
|
548
|
+
.statistics-legend-item-compact .statistics-legend-item-label {
|
|
549
|
+
flex-grow: 0;
|
|
550
|
+
font-weight: 400;
|
|
551
|
+
}
|
|
552
|
+
.statistics-legend-item-compact .statistics-legend-item-value {
|
|
553
|
+
margin-left: 0;
|
|
516
554
|
}.statistics-meter {
|
|
517
555
|
--color: var(--primary-600);
|
|
518
556
|
--percentage: 0%;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createVNode, customRef, defineComponent, inject, markRaw, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, onScopeDispose, openBlock, provide, ref, renderList, renderSlot, toDisplayString, toValue, unref, useSlots, useTemplateRef, watch, watchEffect, withCtx } from "vue";
|
|
1
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createVNode, customRef, defineComponent, inject, markRaw, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, onScopeDispose, openBlock, provide, ref, renderList, renderSlot, toDisplayString, toRef, toValue, unref, useSlots, useTemplateRef, watch, watchEffect, withCtx } from "vue";
|
|
2
2
|
import { useI18n } from "vue-i18n";
|
|
3
3
|
import { FluxIcon, FluxPane, FluxToolbar, FluxTooltip, iconRegistry } from "@flux-ui/components";
|
|
4
4
|
import { merge } from "lodash-es";
|
|
@@ -11325,6 +11325,9 @@ function useECharts(target, options) {
|
|
|
11325
11325
|
resize: () => chartInstance.value?.resize()
|
|
11326
11326
|
};
|
|
11327
11327
|
}
|
|
11328
|
+
//#endregion
|
|
11329
|
+
//#region src/composable/useLegendVariant.ts
|
|
11330
|
+
var FluxStatisticsLegendVariantInjectionKey = Symbol("flux-statistics-legend-variant");
|
|
11328
11331
|
var Chart_module_default = {
|
|
11329
11332
|
pane: `pane`,
|
|
11330
11333
|
statisticsChart: `statistics-chart`,
|
|
@@ -12135,7 +12138,11 @@ var Legend_module_default = {
|
|
|
12135
12138
|
statisticsLegendItemColor: `statistics-legend-item-color`,
|
|
12136
12139
|
statisticsLegendItemIcon: `statistics-legend-item-icon`,
|
|
12137
12140
|
statisticsLegendItemLabel: `statistics-legend-item-label`,
|
|
12138
|
-
statisticsLegendItemValue: `statistics-legend-item-value
|
|
12141
|
+
statisticsLegendItemValue: `statistics-legend-item-value`,
|
|
12142
|
+
statisticsLegendCompact: `statistics-legend-compact`,
|
|
12143
|
+
isHorizontal: `is-horizontal`,
|
|
12144
|
+
isVertical: `is-vertical`,
|
|
12145
|
+
statisticsLegendItemCompact: `statistics-legend-item-compact`
|
|
12139
12146
|
};
|
|
12140
12147
|
//#endregion
|
|
12141
12148
|
//#region src/component/FluxStatisticsLegendItem.vue
|
|
@@ -12149,6 +12156,8 @@ var FluxStatisticsLegendItem_default = /* @__PURE__ */ defineComponent({
|
|
|
12149
12156
|
value: {}
|
|
12150
12157
|
},
|
|
12151
12158
|
setup(__props) {
|
|
12159
|
+
const variantRef = inject(FluxStatisticsLegendVariantInjectionKey, null);
|
|
12160
|
+
const variant = computed(() => variantRef?.value ?? "detailed");
|
|
12152
12161
|
const colorValue = computed(() => {
|
|
12153
12162
|
if (!__props.color) return;
|
|
12154
12163
|
if ([
|
|
@@ -12163,7 +12172,7 @@ var FluxStatisticsLegendItem_default = /* @__PURE__ */ defineComponent({
|
|
|
12163
12172
|
});
|
|
12164
12173
|
return (_ctx, _cache) => {
|
|
12165
12174
|
return openBlock(), createElementBlock("div", {
|
|
12166
|
-
class: normalizeClass(unref(clsx)(unref(Legend_module_default).statisticsLegendItem, __props.isHovered && unref(Legend_module_default).isHovered)),
|
|
12175
|
+
class: normalizeClass(unref(clsx)(variant.value === "compact" ? unref(Legend_module_default).statisticsLegendItemCompact : unref(Legend_module_default).statisticsLegendItem, variant.value !== "compact" && __props.isHovered && unref(Legend_module_default).isHovered)),
|
|
12167
12176
|
style: normalizeStyle({ "--color": colorValue.value })
|
|
12168
12177
|
}, [
|
|
12169
12178
|
__props.icon ? (openBlock(), createBlock(unref(FluxIcon), {
|
|
@@ -12191,11 +12200,20 @@ var FluxStatisticsLegendItem_default = /* @__PURE__ */ defineComponent({
|
|
|
12191
12200
|
//#region src/component/FluxStatisticsLegend.vue
|
|
12192
12201
|
var FluxStatisticsLegend_default = /* @__PURE__ */ defineComponent({
|
|
12193
12202
|
__name: "FluxStatisticsLegend",
|
|
12203
|
+
props: {
|
|
12204
|
+
direction: { default: "horizontal" },
|
|
12205
|
+
variant: { default: "detailed" }
|
|
12206
|
+
},
|
|
12194
12207
|
setup(__props) {
|
|
12195
12208
|
const slots = useSlots();
|
|
12196
12209
|
const legendContext = inject(FluxStatisticsChartLegendInjectionKey, null);
|
|
12197
12210
|
const hasSlot = computed(() => !!slots.default);
|
|
12198
12211
|
const autoItems = computed(() => legendContext?.items.value ?? []);
|
|
12212
|
+
const containerClass = computed(() => {
|
|
12213
|
+
if (__props.variant === "compact") return clsx(Legend_module_default.statisticsLegendCompact, __props.direction === "vertical" ? Legend_module_default.isVertical : Legend_module_default.isHorizontal);
|
|
12214
|
+
return Legend_module_default.statisticsLegend;
|
|
12215
|
+
});
|
|
12216
|
+
provide(FluxStatisticsLegendVariantInjectionKey, toRef(() => __props.variant));
|
|
12199
12217
|
function onItemMouseEnter(index) {
|
|
12200
12218
|
if (legendContext) legendContext.hoveredIndex.value = index;
|
|
12201
12219
|
}
|
|
@@ -12203,7 +12221,7 @@ var FluxStatisticsLegend_default = /* @__PURE__ */ defineComponent({
|
|
|
12203
12221
|
if (legendContext) legendContext.hoveredIndex.value = null;
|
|
12204
12222
|
}
|
|
12205
12223
|
return (_ctx, _cache) => {
|
|
12206
|
-
return openBlock(), createElementBlock("div", { class: normalizeClass(
|
|
12224
|
+
return openBlock(), createElementBlock("div", { class: normalizeClass(containerClass.value) }, [hasSlot.value ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(autoItems.value, (item, index) => {
|
|
12207
12225
|
return openBlock(), createBlock(FluxStatisticsLegendItem_default, {
|
|
12208
12226
|
key: item.label,
|
|
12209
12227
|
color: item.color,
|
|
@@ -12766,6 +12784,6 @@ var CHART_COLORFUL_COLORS = [
|
|
|
12766
12784
|
xr
|
|
12767
12785
|
];
|
|
12768
12786
|
//#endregion
|
|
12769
|
-
export { CHART_COLORFUL_COLORS, CHART_COLORS, FluxStatisticsAreaChart_default as FluxStatisticsAreaChart, FluxStatisticsBarChart_default as FluxStatisticsBarChart, FluxStatisticsBase_default as FluxStatisticsBase, FluxStatisticsBoxPlotChart_default as FluxStatisticsBoxPlotChart, FluxStatisticsBubbleChart_default as FluxStatisticsBubbleChart, FluxStatisticsCandlestickChart_default as FluxStatisticsCandlestickChart, FluxStatisticsChange_default as FluxStatisticsChange, FluxStatisticsChart_default as FluxStatisticsChart, FluxStatisticsChartLegendInjectionKey, FluxStatisticsChartPane_default as FluxStatisticsChartPane, FluxStatisticsComparison_default as FluxStatisticsComparison, FluxStatisticsDetailsTable_default as FluxStatisticsDetailsTable, FluxStatisticsDetailsTableRow_default as FluxStatisticsDetailsTableRow, FluxStatisticsDonutChart_default as FluxStatisticsDonutChart, FluxStatisticsEmpty_default as FluxStatisticsEmpty, FluxStatisticsGrid_default as FluxStatisticsGrid, FluxStatisticsHeatmapChart_default as FluxStatisticsHeatmapChart, FluxStatisticsKpi_default as FluxStatisticsKpi, FluxStatisticsLegend_default as FluxStatisticsLegend, FluxStatisticsLegendItem_default as FluxStatisticsLegendItem, FluxStatisticsLegendScope_default as FluxStatisticsLegendScope, FluxStatisticsLineChart_default as FluxStatisticsLineChart, FluxStatisticsMeter_default as FluxStatisticsMeter, FluxStatisticsMetric_default as FluxStatisticsMetric, FluxStatisticsMixedChart_default as FluxStatisticsMixedChart, FluxStatisticsPercentageBar_default as FluxStatisticsPercentageBar, FluxStatisticsPieChart_default as FluxStatisticsPieChart, FluxStatisticsPolarAreaChart_default as FluxStatisticsPolarAreaChart, FluxStatisticsRadarChart_default as FluxStatisticsRadarChart, FluxStatisticsRadialBar_default as FluxStatisticsRadialBar, FluxStatisticsScatterChart_default as FluxStatisticsScatterChart, FluxStatisticsSparkline_default as FluxStatisticsSparkline, FluxStatisticsTreemapChart_default as FluxStatisticsTreemapChart, createChartLegendContext, useChartBaseSetup, useChartHoverSync, useChartSeriesSetup, useChartSlicesSetup, useECharts };
|
|
12787
|
+
export { CHART_COLORFUL_COLORS, CHART_COLORS, FluxStatisticsAreaChart_default as FluxStatisticsAreaChart, FluxStatisticsBarChart_default as FluxStatisticsBarChart, FluxStatisticsBase_default as FluxStatisticsBase, FluxStatisticsBoxPlotChart_default as FluxStatisticsBoxPlotChart, FluxStatisticsBubbleChart_default as FluxStatisticsBubbleChart, FluxStatisticsCandlestickChart_default as FluxStatisticsCandlestickChart, FluxStatisticsChange_default as FluxStatisticsChange, FluxStatisticsChart_default as FluxStatisticsChart, FluxStatisticsChartLegendInjectionKey, FluxStatisticsChartPane_default as FluxStatisticsChartPane, FluxStatisticsComparison_default as FluxStatisticsComparison, FluxStatisticsDetailsTable_default as FluxStatisticsDetailsTable, FluxStatisticsDetailsTableRow_default as FluxStatisticsDetailsTableRow, FluxStatisticsDonutChart_default as FluxStatisticsDonutChart, FluxStatisticsEmpty_default as FluxStatisticsEmpty, FluxStatisticsGrid_default as FluxStatisticsGrid, FluxStatisticsHeatmapChart_default as FluxStatisticsHeatmapChart, FluxStatisticsKpi_default as FluxStatisticsKpi, FluxStatisticsLegend_default as FluxStatisticsLegend, FluxStatisticsLegendItem_default as FluxStatisticsLegendItem, FluxStatisticsLegendScope_default as FluxStatisticsLegendScope, FluxStatisticsLegendVariantInjectionKey, FluxStatisticsLineChart_default as FluxStatisticsLineChart, FluxStatisticsMeter_default as FluxStatisticsMeter, FluxStatisticsMetric_default as FluxStatisticsMetric, FluxStatisticsMixedChart_default as FluxStatisticsMixedChart, FluxStatisticsPercentageBar_default as FluxStatisticsPercentageBar, FluxStatisticsPieChart_default as FluxStatisticsPieChart, FluxStatisticsPolarAreaChart_default as FluxStatisticsPolarAreaChart, FluxStatisticsRadarChart_default as FluxStatisticsRadarChart, FluxStatisticsRadialBar_default as FluxStatisticsRadialBar, FluxStatisticsScatterChart_default as FluxStatisticsScatterChart, FluxStatisticsSparkline_default as FluxStatisticsSparkline, FluxStatisticsTreemapChart_default as FluxStatisticsTreemapChart, createChartLegendContext, useChartBaseSetup, useChartHoverSync, useChartSeriesSetup, useChartSlicesSetup, useECharts };
|
|
12770
12788
|
|
|
12771
12789
|
//# sourceMappingURL=index.js.map
|