@fbkworks/dashboard 0.0.0-stage → 0.3.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.
Files changed (44) hide show
  1. package/LICENSE +21 -0
  2. package/dist/BarChart.d.ts +31 -0
  3. package/dist/BarChart.vue.mjs +97 -0
  4. package/dist/BarChart.vue.mjs.map +1 -0
  5. package/dist/BarChart2.vue.mjs +5 -0
  6. package/dist/BarChart2.vue.mjs.map +1 -0
  7. package/dist/ChartCard.d.ts +26 -0
  8. package/dist/ChartCard.vue.mjs +54 -0
  9. package/dist/ChartCard.vue.mjs.map +1 -0
  10. package/dist/ChartCard2.vue.mjs +5 -0
  11. package/dist/ChartCard2.vue.mjs.map +1 -0
  12. package/dist/PieChart.d.ts +32 -0
  13. package/dist/PieChart.vue.mjs +117 -0
  14. package/dist/PieChart.vue.mjs.map +1 -0
  15. package/dist/PieChart2.vue.mjs +5 -0
  16. package/dist/PieChart2.vue.mjs.map +1 -0
  17. package/dist/RankList.d.ts +7 -0
  18. package/dist/RankList.vue.mjs +63 -0
  19. package/dist/RankList.vue.mjs.map +1 -0
  20. package/dist/RankList2.vue.mjs +5 -0
  21. package/dist/RankList2.vue.mjs.map +1 -0
  22. package/dist/StatCard.d.ts +32 -0
  23. package/dist/StatCard.vue.mjs +149 -0
  24. package/dist/StatCard.vue.mjs.map +1 -0
  25. package/dist/StatCard2.vue.mjs +5 -0
  26. package/dist/StatCard2.vue.mjs.map +1 -0
  27. package/dist/StatGroup.d.ts +26 -0
  28. package/dist/StatGroup.vue.mjs +27 -0
  29. package/dist/StatGroup.vue.mjs.map +1 -0
  30. package/dist/StatGroup2.vue.mjs +5 -0
  31. package/dist/StatGroup2.vue.mjs.map +1 -0
  32. package/dist/TrendChart.d.ts +34 -0
  33. package/dist/TrendChart.vue.mjs +103 -0
  34. package/dist/TrendChart.vue.mjs.map +1 -0
  35. package/dist/TrendChart2.vue.mjs +5 -0
  36. package/dist/TrendChart2.vue.mjs.map +1 -0
  37. package/dist/index.d.ts +12 -0
  38. package/dist/index.mjs +17 -0
  39. package/dist/index.mjs.map +1 -0
  40. package/dist/style.css +1059 -0
  41. package/dist/styles/index.css +3 -0
  42. package/dist/types.d.ts +126 -0
  43. package/package.json +61 -3
  44. package/README.md +0 -3
@@ -0,0 +1,149 @@
1
+ import { defineComponent, useAttrs, computed, openBlock, createElementBlock, mergeProps, unref, createElementVNode, toDisplayString, renderSlot, createCommentVNode, createVNode } from "vue";
2
+ import { FbkChart } from "@fbkworks/chart-core";
3
+ const _hoisted_1 = ["data-tone"];
4
+ const _hoisted_2 = { class: "fbk-stat-card__head" };
5
+ const _hoisted_3 = { class: "fbk-stat-card__title" };
6
+ const _hoisted_4 = {
7
+ key: 0,
8
+ class: "fbk-stat-card__icon"
9
+ };
10
+ const _hoisted_5 = { class: "fbk-stat-card__value" };
11
+ const _hoisted_6 = {
12
+ key: 0,
13
+ class: "fbk-stat-card__affix"
14
+ };
15
+ const _hoisted_7 = { class: "fbk-stat-card__number" };
16
+ const _hoisted_8 = {
17
+ key: 1,
18
+ class: "fbk-stat-card__affix"
19
+ };
20
+ const _hoisted_9 = {
21
+ key: 0,
22
+ class: "fbk-stat-card__change"
23
+ };
24
+ const _hoisted_10 = {
25
+ class: "fbk-stat-card__arrow",
26
+ "aria-hidden": "true"
27
+ };
28
+ const _hoisted_11 = { class: "fbk-stat-card__rate" };
29
+ const _hoisted_12 = {
30
+ key: 0,
31
+ class: "fbk-stat-card__change-label"
32
+ };
33
+ const _hoisted_13 = {
34
+ key: 1,
35
+ class: "fbk-stat-card__trend"
36
+ };
37
+ const _hoisted_14 = {
38
+ key: 2,
39
+ class: "fbk-stat-card__footer"
40
+ };
41
+ const _sfc_main = /* @__PURE__ */ defineComponent({
42
+ ...{ name: "FbkStatCard", inheritAttrs: false },
43
+ __name: "StatCard",
44
+ props: {
45
+ title: {},
46
+ value: {},
47
+ prefix: { default: void 0 },
48
+ suffix: { default: void 0 },
49
+ precision: { default: 0 },
50
+ change: { default: null },
51
+ changeTone: { default: "auto" },
52
+ changeLabel: {},
53
+ trend: { default: () => [] },
54
+ loading: { type: Boolean, default: false },
55
+ clickable: { type: Boolean, default: false }
56
+ },
57
+ emits: ["click"],
58
+ setup(__props, { emit: __emit }) {
59
+ const props = __props;
60
+ const attrs = useAttrs();
61
+ const emit = __emit;
62
+ const formattedValue = computed(() => {
63
+ if (typeof props.value === "string") return props.value;
64
+ const formatter = new Intl.NumberFormat("zh-CN", {
65
+ minimumFractionDigits: props.precision,
66
+ maximumFractionDigits: props.precision
67
+ });
68
+ return formatter.format(props.value);
69
+ });
70
+ const direction = computed(() => {
71
+ if (props.change === null || props.change === 0) return "flat";
72
+ return props.change > 0 ? "up" : "down";
73
+ });
74
+ const tone = computed(() => {
75
+ if (props.changeTone !== "auto") return props.changeTone;
76
+ if (direction.value === "flat") return "neutral";
77
+ return direction.value === "up" ? "positive" : "negative";
78
+ });
79
+ const changeText = computed(() => {
80
+ if (props.change === null) return "";
81
+ const sign = props.change > 0 ? "+" : "";
82
+ return `${sign}${props.change.toFixed(1)}%`;
83
+ });
84
+ const arrow = computed(() => {
85
+ if (direction.value === "up") return "↑";
86
+ if (direction.value === "down") return "↓";
87
+ return "—";
88
+ });
89
+ const trendOption = computed(() => ({
90
+ animation: false,
91
+ grid: { left: 0, right: 0, top: 4, bottom: 0 },
92
+ xAxis: { type: "category", show: false, boundaryGap: false },
93
+ yAxis: { type: "value", show: false, min: "dataMin", max: "dataMax" },
94
+ series: [
95
+ {
96
+ type: "line",
97
+ data: props.trend,
98
+ smooth: true,
99
+ showSymbol: false,
100
+ lineStyle: { width: 1.5 },
101
+ areaStyle: { opacity: 0.15 }
102
+ }
103
+ ]
104
+ }));
105
+ function onClick() {
106
+ if (!props.clickable) return;
107
+ emit("click");
108
+ }
109
+ return (_ctx, _cache) => {
110
+ return openBlock(), createElementBlock("div", mergeProps({ class: "fbk-stat-card" }, unref(attrs), {
111
+ class: { "fbk-stat-card--clickable": __props.clickable, "fbk-stat-card--loading": __props.loading },
112
+ "data-tone": tone.value,
113
+ onClick
114
+ }), [
115
+ createElementVNode("div", _hoisted_2, [
116
+ createElementVNode("span", _hoisted_3, toDisplayString(__props.title), 1),
117
+ _ctx.$slots.icon ? (openBlock(), createElementBlock("span", _hoisted_4, [
118
+ renderSlot(_ctx.$slots, "icon")
119
+ ])) : createCommentVNode("", true)
120
+ ]),
121
+ createElementVNode("div", _hoisted_5, [
122
+ __props.prefix ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(__props.prefix), 1)) : createCommentVNode("", true),
123
+ createElementVNode("span", _hoisted_7, toDisplayString(formattedValue.value), 1),
124
+ __props.suffix ? (openBlock(), createElementBlock("span", _hoisted_8, toDisplayString(__props.suffix), 1)) : createCommentVNode("", true)
125
+ ]),
126
+ __props.change !== null ? (openBlock(), createElementBlock("div", _hoisted_9, [
127
+ createElementVNode("span", _hoisted_10, toDisplayString(arrow.value), 1),
128
+ createElementVNode("span", _hoisted_11, toDisplayString(changeText.value), 1),
129
+ __props.changeLabel ? (openBlock(), createElementBlock("span", _hoisted_12, toDisplayString(__props.changeLabel), 1)) : createCommentVNode("", true)
130
+ ])) : createCommentVNode("", true),
131
+ __props.trend.length ? (openBlock(), createElementBlock("div", _hoisted_13, [
132
+ createVNode(unref(FbkChart), {
133
+ option: trendOption.value,
134
+ height: "32px",
135
+ "empty-text": "",
136
+ themed: false
137
+ }, null, 8, ["option"])
138
+ ])) : createCommentVNode("", true),
139
+ _ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_14, [
140
+ renderSlot(_ctx.$slots, "footer")
141
+ ])) : createCommentVNode("", true)
142
+ ], 16, _hoisted_1);
143
+ };
144
+ }
145
+ });
146
+ export {
147
+ _sfc_main as default
148
+ };
149
+ //# sourceMappingURL=StatCard.vue.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StatCard.vue.mjs","sources":["../src/StatCard.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, useAttrs } from 'vue'\nimport { FbkChart } from '@fbkworks/chart-core'\nimport type { StatCardProps, TrendDirection } from './types'\n\n/**\n * 核心指标卡。\n *\n * 设计要点(都来自 docs/design/2026-10-22-dashboard-screen.md):\n * · 数值用等宽数字 —— 否则刷新时宽度跳动,一排卡片会互相推挤\n * · 变化率的方向与语义分开:数值涨不代表\"好\"(如\"退款率\"涨是坏事)\n * · 迷你趋势图只画线不画轴,它是装饰不是图表\n */\ndefineOptions({ name: 'FbkStatCard', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<StatCardProps>(), {\n prefix: undefined,\n suffix: undefined,\n precision: 0,\n change: null,\n changeTone: 'auto',\n trend: () => [],\n loading: false,\n clickable: false,\n})\n\n/* inheritAttrs: false 时必须手动转发 attrs,否则调用方的 class/style 会丢失 */\nconst attrs = useAttrs()\n\nconst emit = defineEmits<{\n click: []\n}>()\n\n/** 千分位 + 固定小数位。用 Intl 而不是手写正则 */\nconst formattedValue = computed(() => {\n if (typeof props.value === 'string') return props.value\n const formatter = new Intl.NumberFormat('zh-CN', {\n minimumFractionDigits: props.precision,\n maximumFractionDigits: props.precision,\n })\n return formatter.format(props.value)\n})\n\nconst direction = computed<TrendDirection>(() => {\n if (props.change === null || props.change === 0) return 'flat'\n return props.change > 0 ? 'up' : 'down'\n})\n\n/**\n * 语义色调。\n *\n * `auto` 的默认规则:涨=好、跌=坏。但\"退款率\"\"错误数\"这类指标相反,\n * 所以提供 changeTone 让业务方显式指定 —— 不能替他们猜。\n */\nconst tone = computed<'positive' | 'negative' | 'neutral'>(() => {\n if (props.changeTone !== 'auto') return props.changeTone\n if (direction.value === 'flat') return 'neutral'\n return direction.value === 'up' ? 'positive' : 'negative'\n})\n\nconst changeText = computed(() => {\n if (props.change === null) return ''\n const sign = props.change > 0 ? '+' : ''\n return `${sign}${props.change.toFixed(1)}%`\n})\n\nconst arrow = computed(() => {\n if (direction.value === 'up') return '↑'\n if (direction.value === 'down') return '↓'\n return '—'\n})\n\n/** 迷你趋势图:只画线,去掉所有轴与交互 */\nconst trendOption = computed(() => ({\n animation: false,\n grid: { left: 0, right: 0, top: 4, bottom: 0 },\n xAxis: { type: 'category', show: false, boundaryGap: false },\n yAxis: { type: 'value', show: false, min: 'dataMin', max: 'dataMax' },\n series: [\n {\n type: 'line',\n data: props.trend,\n smooth: true,\n showSymbol: false,\n lineStyle: { width: 1.5 },\n areaStyle: { opacity: 0.15 },\n },\n ],\n}))\n\nfunction onClick() {\n if (!props.clickable) return\n emit('click')\n}\n</script>\n\n<template>\n <div\n class=\"fbk-stat-card\" v-bind=\"attrs\"\n :class=\"{ 'fbk-stat-card--clickable': clickable, 'fbk-stat-card--loading': loading }\"\n :data-tone=\"tone\"\n @click=\"onClick\"\n >\n <div class=\"fbk-stat-card__head\">\n <span class=\"fbk-stat-card__title\">{{ title }}</span>\n <span v-if=\"$slots.icon\" class=\"fbk-stat-card__icon\">\n <slot name=\"icon\" />\n </span>\n </div>\n\n <div class=\"fbk-stat-card__value\">\n <span v-if=\"prefix\" class=\"fbk-stat-card__affix\">{{ prefix }}</span>\n <span class=\"fbk-stat-card__number\">{{ formattedValue }}</span>\n <span v-if=\"suffix\" class=\"fbk-stat-card__affix\">{{ suffix }}</span>\n </div>\n\n <div v-if=\"change !== null\" class=\"fbk-stat-card__change\">\n <span class=\"fbk-stat-card__arrow\" aria-hidden=\"true\">{{ arrow }}</span>\n <span class=\"fbk-stat-card__rate\">{{ changeText }}</span>\n <span v-if=\"changeLabel\" class=\"fbk-stat-card__change-label\">{{ changeLabel }}</span>\n </div>\n\n <div v-if=\"trend.length\" class=\"fbk-stat-card__trend\">\n <FbkChart :option=\"trendOption\" height=\"32px\" empty-text=\"\" :themed=\"false\" />\n </div>\n\n <div v-if=\"$slots.footer\" class=\"fbk-stat-card__footer\">\n <slot name=\"footer\" />\n </div>\n </div>\n</template>\n"],"names":["_openBlock","_createElementBlock","_mergeProps","_unref","_createElementVNode","_toDisplayString","$slots","_renderSlot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,4BAAZJ,mBAAqF,QAArF,aAAqFI,gBAArB,QAAA,WAAW,GAAA,CAAA;;QAGlE,QAAA,MAAM,UAAjBL,aAAAC,mBAEM,OAFN,aAEM;AAAA,UADJO,YAA8EL,MAAA,QAAA,GAAA;AAAA,YAAnE,QAAQ,YAAA;AAAA,YAAa,QAAO;AAAA,YAAO,cAAW;AAAA,YAAI,QAAQ;AAAA,UAAA;;QAG5DG,KAAAA,OAAO,UAAlBN,aAAAC,mBAEM,OAFN,aAEM;AAAA,UADJM,WAAsB,KAAA,QAAA,QAAA;AAAA,QAAA;;;;;"}
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./StatCard.vue.mjs";
2
+ export {
3
+ _sfc_main as default
4
+ };
5
+ //# sourceMappingURL=StatCard2.vue.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StatCard2.vue.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,26 @@
1
+ import { StatGroupProps } from './types.js';
2
+ declare function __VLS_template(): {
3
+ attrs: Partial<{}>;
4
+ slots: {
5
+ default?(_: {}): any;
6
+ };
7
+ refs: {};
8
+ rootEl: any;
9
+ };
10
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
11
+ declare const __VLS_component: import('vue').DefineComponent<StatGroupProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<StatGroupProps> & Readonly<{}>, {
12
+ columns: number | {
13
+ xs?: number;
14
+ sm?: number;
15
+ md?: number;
16
+ lg?: number;
17
+ };
18
+ gap: "sm" | "md" | "lg";
19
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
20
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
21
+ export default _default;
22
+ type __VLS_WithTemplateSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -0,0 +1,27 @@
1
+ import { defineComponent, useAttrs, computed, openBlock, createElementBlock, mergeProps, unref, renderSlot } from "vue";
2
+ import { resolveColumns } from "@fbkworks/shared";
3
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4
+ ...{ name: "FbkStatGroup", inheritAttrs: false },
5
+ __name: "StatGroup",
6
+ props: {
7
+ columns: { default: 4 },
8
+ gap: { default: "md" }
9
+ },
10
+ setup(__props) {
11
+ const props = __props;
12
+ const attrs = useAttrs();
13
+ const style = computed(() => resolveColumns(props.columns));
14
+ return (_ctx, _cache) => {
15
+ return openBlock(), createElementBlock("div", mergeProps({ class: "fbk-stat-group" }, unref(attrs), {
16
+ class: `fbk-stat-group--gap-${__props.gap}`,
17
+ style: style.value
18
+ }), [
19
+ renderSlot(_ctx.$slots, "default")
20
+ ], 16);
21
+ };
22
+ }
23
+ });
24
+ export {
25
+ _sfc_main as default
26
+ };
27
+ //# sourceMappingURL=StatGroup.vue.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StatGroup.vue.mjs","sources":["../src/StatGroup.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, useAttrs } from 'vue'\nimport { resolveColumns } from '@fbkworks/shared'\nimport type { StatGroupProps } from './types'\n\n/**\n * 指标卡栅格。\n *\n * 列数用 `--fbk-cols-*` 变量 + CSS var() 回退链,\n * 与 QueryForm / FormGenerator 同一套机制(见 @fbkworks/shared 的 resolveColumns)。\n */\ndefineOptions({ name: 'FbkStatGroup', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<StatGroupProps>(), {\n columns: 4,\n gap: 'md',\n})\n\n/* inheritAttrs: false 时必须手动转发 attrs,否则调用方的 class/style 会丢失 */\nconst attrs = useAttrs()\n\nconst style = computed(() => resolveColumns(props.columns))\n</script>\n\n<template>\n <div class=\"fbk-stat-group\" v-bind=\"attrs\" :class=\"`fbk-stat-group--gap-${gap}`\" :style=\"style\">\n <slot />\n </div>\n</template>\n"],"names":["_openBlock","_createElementBlock","_mergeProps","_unref","_renderSlot"],"mappings":";;;;;;;;;;AAaA,UAAM,QAAQ;AAMd,UAAM,QAAQ,SAAA;AAEd,UAAM,QAAQ,SAAS,MAAM,eAAe,MAAM,OAAO,CAAC;;AAIxD,aAAAA,UAAA,GAAAC,mBAEM,OAFNC,WAEM,EAFD,OAAM,iBAAA,GAAyBC,MAAA,KAAA,GAAK;AAAA,QAAG,8BAA8B,QAAA,GAAG;AAAA,QAAK,OAAO,MAAA;AAAA,MAAA;QACvFC,WAAQ,KAAA,QAAA,SAAA;AAAA,MAAA;;;;"}
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./StatGroup.vue.mjs";
2
+ export {
3
+ _sfc_main as default
4
+ };
5
+ //# sourceMappingURL=StatGroup2.vue.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StatGroup2.vue.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,34 @@
1
+ import { TrendChartProps } from './types.js';
2
+ declare function __VLS_template(): {
3
+ attrs: Partial<{}>;
4
+ slots: {
5
+ extra?(_: {}): any;
6
+ };
7
+ refs: {};
8
+ rootEl: any;
9
+ };
10
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
11
+ declare const __VLS_component: import('vue').DefineComponent<TrendChartProps, {
12
+ palette: import('vue').ComputedRef<string[]>;
13
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
14
+ error: (error: unknown) => any;
15
+ }, string, import('vue').PublicProps, Readonly<TrendChartProps> & Readonly<{
16
+ onError?: ((error: unknown) => any) | undefined;
17
+ }>, {
18
+ title: string;
19
+ height: string | number;
20
+ loading: boolean;
21
+ emptyText: string;
22
+ area: boolean;
23
+ smooth: boolean;
24
+ startFromZero: boolean;
25
+ subtitle: string;
26
+ empty: boolean;
27
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
28
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
29
+ export default _default;
30
+ type __VLS_WithTemplateSlots<T, S> = T & {
31
+ new (): {
32
+ $slots: S;
33
+ };
34
+ };
@@ -0,0 +1,103 @@
1
+ import { defineComponent, useAttrs, computed, openBlock, createBlock, mergeProps, unref, createSlots, withCtx, createVNode, renderSlot } from "vue";
2
+ import { CHART_SPLIT_LINE, CHART_AXIS_LABEL, CHART_AXIS_LINE, seriesColor, FBK_CHART_PALETTE_SIZE, chartColor, FbkChart } from "@fbkworks/chart-core";
3
+ import _sfc_main$1 from "./ChartCard.vue.mjs";
4
+ const _sfc_main = /* @__PURE__ */ defineComponent({
5
+ ...{ name: "FbkTrendChart", inheritAttrs: false },
6
+ __name: "TrendChart",
7
+ props: {
8
+ categories: {},
9
+ series: {},
10
+ area: { type: Boolean, default: void 0 },
11
+ smooth: { type: Boolean, default: true },
12
+ startFromZero: { type: Boolean, default: true },
13
+ title: { default: void 0 },
14
+ subtitle: { default: void 0 },
15
+ height: { default: void 0 },
16
+ loading: { type: Boolean, default: false },
17
+ empty: { type: Boolean, default: false },
18
+ emptyText: { default: "暂无数据" }
19
+ },
20
+ emits: ["error"],
21
+ setup(__props, { expose: __expose, emit: __emit }) {
22
+ const emit = __emit;
23
+ const props = __props;
24
+ const attrs = useAttrs();
25
+ const useArea = computed(() => props.area ?? props.series.length <= 1);
26
+ const option = computed(() => ({
27
+ grid: {
28
+ // 右侧留白给最后一项的标签,否则会被裁掉
29
+ left: 8,
30
+ right: 16,
31
+ top: props.series.length > 1 ? 40 : 16,
32
+ bottom: 8,
33
+ containLabel: true
34
+ },
35
+ tooltip: { trigger: "axis" },
36
+ legend: props.series.length > 1 ? { top: 0, right: 0, itemGap: 16, icon: "roundRect" } : void 0,
37
+ xAxis: {
38
+ type: "category",
39
+ data: props.categories,
40
+ boundaryGap: false,
41
+ axisLine: { lineStyle: { color: CHART_AXIS_LINE } },
42
+ axisLabel: { color: CHART_AXIS_LABEL }
43
+ },
44
+ yAxis: {
45
+ type: "value",
46
+ // 不从 0 开始会夸大波动,趋势图默认必须从 0 起
47
+ min: props.startFromZero ? 0 : void 0,
48
+ axisLine: { show: false },
49
+ axisLabel: { color: CHART_AXIS_LABEL },
50
+ splitLine: { lineStyle: { color: CHART_SPLIT_LINE, type: "dashed" } }
51
+ },
52
+ series: props.series.map((s, i) => ({
53
+ name: s.name,
54
+ type: "line",
55
+ data: s.data,
56
+ smooth: props.smooth,
57
+ symbol: "circle",
58
+ symbolSize: 6,
59
+ showSymbol: false,
60
+ itemStyle: { color: seriesColor(i, s.color) },
61
+ lineStyle: { width: 2 },
62
+ areaStyle: useArea.value ? { opacity: "var(--fbk-chart-area-opacity)" } : void 0
63
+ }))
64
+ }));
65
+ const palette = computed(
66
+ () => Array.from({ length: FBK_CHART_PALETTE_SIZE }, (_, i) => chartColor(i))
67
+ );
68
+ __expose({ palette });
69
+ return (_ctx, _cache) => {
70
+ return openBlock(), createBlock(_sfc_main$1, mergeProps(unref(attrs), {
71
+ title: __props.title,
72
+ subtitle: __props.subtitle,
73
+ loading: __props.loading,
74
+ empty: __props.empty,
75
+ "empty-text": __props.emptyText
76
+ }), createSlots({
77
+ default: withCtx(() => [
78
+ createVNode(unref(FbkChart), {
79
+ onError: _cache[0] || (_cache[0] = (e) => emit("error", e)),
80
+ option: option.value,
81
+ height: __props.height,
82
+ loading: __props.loading,
83
+ "is-empty": __props.empty || !__props.categories.length,
84
+ "empty-text": __props.emptyText
85
+ }, null, 8, ["option", "height", "loading", "is-empty", "empty-text"])
86
+ ]),
87
+ _: 2
88
+ }, [
89
+ _ctx.$slots.extra ? {
90
+ name: "extra",
91
+ fn: withCtx(() => [
92
+ renderSlot(_ctx.$slots, "extra")
93
+ ]),
94
+ key: "0"
95
+ } : void 0
96
+ ]), 1040, ["title", "subtitle", "loading", "empty", "empty-text"]);
97
+ };
98
+ }
99
+ });
100
+ export {
101
+ _sfc_main as default
102
+ };
103
+ //# sourceMappingURL=TrendChart.vue.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TrendChart.vue.mjs","sources":["../src/TrendChart.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, useAttrs } from 'vue'\nimport {\n FbkChart,\n CHART_AXIS_LABEL,\n CHART_AXIS_LINE,\n CHART_SPLIT_LINE,\n FBK_CHART_PALETTE_SIZE,\n chartColor,\n seriesColor,\n} from '@fbkworks/chart-core'\nimport FbkChartCard from './ChartCard.vue'\nimport type { TrendChartProps } from './types'\n\n/**\n * 折线 / 面积趋势图。\n *\n * 默认带面积填充:单系列趋势图里,填充比纯线条更容易读出\"量\"的感觉。\n * 多系列时填充会互相遮挡,所以 `area` 默认按系列数自动关闭。\n */\nconst emit = defineEmits<{ error: [error: unknown] }>()\n\ndefineOptions({ name: 'FbkTrendChart', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<TrendChartProps>(), {\n title: undefined,\n subtitle: undefined,\n height: undefined,\n loading: false,\n empty: false,\n emptyText: '暂无数据',\n area: undefined,\n smooth: true,\n startFromZero: true,\n})\n\n/* inheritAttrs: false 时必须手动转发 attrs,否则调用方的 class/style 会丢失 */\nconst attrs = useAttrs()\n\n/** 未显式指定 area 时,单系列开、多系列关 */\nconst useArea = computed(() => props.area ?? props.series.length <= 1)\n\nconst option = computed(() => ({\n grid: {\n // 右侧留白给最后一项的标签,否则会被裁掉\n left: 8,\n right: 16,\n top: props.series.length > 1 ? 40 : 16,\n bottom: 8,\n containLabel: true,\n },\n tooltip: { trigger: 'axis' },\n legend:\n props.series.length > 1\n ? { top: 0, right: 0, itemGap: 16, icon: 'roundRect' }\n : undefined,\n xAxis: {\n type: 'category',\n data: props.categories,\n boundaryGap: false,\n axisLine: { lineStyle: { color: CHART_AXIS_LINE } },\n axisLabel: { color: CHART_AXIS_LABEL },\n },\n yAxis: {\n type: 'value',\n // 不从 0 开始会夸大波动,趋势图默认必须从 0 起\n min: props.startFromZero ? 0 : undefined,\n axisLine: { show: false },\n axisLabel: { color: CHART_AXIS_LABEL },\n splitLine: { lineStyle: { color: CHART_SPLIT_LINE, type: 'dashed' } },\n },\n series: props.series.map((s, i) => ({\n name: s.name,\n type: 'line',\n data: s.data,\n smooth: props.smooth,\n symbol: 'circle',\n symbolSize: 6,\n showSymbol: false,\n itemStyle: { color: seriesColor(i, s.color) },\n lineStyle: { width: 2 },\n areaStyle: useArea.value ? { opacity: 'var(--fbk-chart-area-opacity)' } : undefined,\n })),\n}))\n\n/** 供外部读取色板(如自定义图例) */\nconst palette = computed(() =>\n Array.from({ length: FBK_CHART_PALETTE_SIZE }, (_, i) => chartColor(i)),\n)\ndefineExpose({ palette })\n</script>\n\n<template>\n <FbkChartCard v-bind=\"attrs\"\n :title=\"title\"\n :subtitle=\"subtitle\"\n :loading=\"loading\"\n :empty=\"empty\"\n :empty-text=\"emptyText\"\n >\n <template v-if=\"$slots.extra\" #extra><slot name=\"extra\" /></template>\n <FbkChart\n @error=\"(e: unknown) => emit('error', e)\"\n :option=\"option\"\n :height=\"height\"\n :loading=\"loading\"\n :is-empty=\"empty || !categories.length\"\n :empty-text=\"emptyText\"\n />\n </FbkChartCard>\n</template>\n"],"names":["_createBlock","FbkChartCard","_mergeProps","_unref","_createVNode","$slots","_renderSlot"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA,UAAM,OAAO;AAIb,UAAM,QAAQ;AAad,UAAM,QAAQ,SAAA;AAGd,UAAM,UAAU,SAAS,MAAM,MAAM,QAAQ,MAAM,OAAO,UAAU,CAAC;AAErE,UAAM,SAAS,SAAS,OAAO;AAAA,MAC7B,MAAM;AAAA;AAAA,QAEJ,MAAM;AAAA,QACN,OAAO;AAAA,QACP,KAAK,MAAM,OAAO,SAAS,IAAI,KAAK;AAAA,QACpC,QAAQ;AAAA,QACR,cAAc;AAAA,MAAA;AAAA,MAEhB,SAAS,EAAE,SAAS,OAAA;AAAA,MACpB,QACE,MAAM,OAAO,SAAS,IAClB,EAAE,KAAK,GAAG,OAAO,GAAG,SAAS,IAAI,MAAM,gBACvC;AAAA,MACN,OA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YACtC,QAAQ,OAAA;AAAA,YACR,QAAQ,QAAA;AAAA,YACR,SAAS,QAAA;AAAA,YACT,YAAU,QAAA,SAAK,CAAK,QAAA,WAAW;AAAA,YAC/B,cAAY,QAAA;AAAA,UAAA;;;;QAPCE,KAAAA,OAAO;gBAAQ;AAAA,sBAAM,MAAqB;AAAA,YAArBC,WAAqB,KAAA,QAAA,OAAA;AAAA,UAAA;;;;;;;"}
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./TrendChart.vue.mjs";
2
+ export {
3
+ _sfc_main as default
4
+ };
5
+ //# sourceMappingURL=TrendChart2.vue.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TrendChart2.vue.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 数据看板组件。Barrel 只做 re-export,不 import CSS —— 保证 tree-shaking。
3
+ * 样式按需导入:`@fbkworks/dashboard/style.css`
4
+ */
5
+ export { default as FbkStatCard } from './StatCard.js';
6
+ export { default as FbkStatGroup } from './StatGroup.js';
7
+ export { default as FbkChartCard } from './ChartCard.js';
8
+ export { default as FbkTrendChart } from './TrendChart.js';
9
+ export { default as FbkBarChart } from './BarChart.js';
10
+ export { default as FbkPieChart } from './PieChart.js';
11
+ export { default as FbkRankList } from './RankList.js';
12
+ export type { BarChartProps, ChangeTone, ChartCardProps, ChartCardSlots, PieChartProps, PieDatum, RankItem, RankListProps, StatCardProps, StatCardSlots, StatGroupProps, TrendChartProps, TrendDirection, TrendSeries, } from './types.js';
package/dist/index.mjs ADDED
@@ -0,0 +1,17 @@
1
+ import { default as default2 } from "./StatCard.vue.mjs";
2
+ import { default as default3 } from "./StatGroup.vue.mjs";
3
+ import { default as default4 } from "./ChartCard.vue.mjs";
4
+ import { default as default5 } from "./TrendChart.vue.mjs";
5
+ import { default as default6 } from "./BarChart.vue.mjs";
6
+ import { default as default7 } from "./PieChart.vue.mjs";
7
+ import { default as default8 } from "./RankList.vue.mjs";
8
+ export {
9
+ default6 as FbkBarChart,
10
+ default4 as FbkChartCard,
11
+ default7 as FbkPieChart,
12
+ default8 as FbkRankList,
13
+ default2 as FbkStatCard,
14
+ default3 as FbkStatGroup,
15
+ default5 as FbkTrendChart
16
+ };
17
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}