@yoka-ui/ui 1.0.6 → 1.0.7

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 (123) hide show
  1. package/@Docs-yoka/exports.generated.md +3 -3
  2. package/README.md +6 -6
  3. package/dist/es/assets/image/skills.zip +0 -0
  4. package/dist/es/business/Empty/index.js.map +1 -1
  5. package/dist/es/business/YkCharts/Area.d.ts +18 -0
  6. package/dist/es/business/YkCharts/Area.js +336 -0
  7. package/dist/es/business/YkCharts/Area.js.map +7 -0
  8. package/dist/es/business/YkCharts/Bar.d.ts +21 -0
  9. package/dist/es/business/YkCharts/Bar.js +316 -0
  10. package/dist/es/business/YkCharts/Bar.js.map +7 -0
  11. package/dist/es/business/YkCharts/BarProperty.d.ts +21 -0
  12. package/dist/es/business/YkCharts/BarProperty.js +357 -0
  13. package/dist/es/business/YkCharts/BarProperty.js.map +7 -0
  14. package/dist/es/business/YkCharts/BarTotal.d.ts +21 -0
  15. package/dist/es/business/YkCharts/BarTotal.js +288 -0
  16. package/dist/es/business/YkCharts/BarTotal.js.map +7 -0
  17. package/dist/es/business/YkCharts/Line.d.ts +21 -0
  18. package/dist/es/business/YkCharts/Line.js +342 -0
  19. package/dist/es/business/YkCharts/Line.js.map +7 -0
  20. package/dist/es/business/YkCharts/Pie.d.ts +19 -0
  21. package/dist/es/business/YkCharts/Pie.js +107 -0
  22. package/dist/es/business/YkCharts/Pie.js.map +7 -0
  23. package/dist/es/business/YkCharts/PieProperty.d.ts +18 -0
  24. package/dist/es/business/YkCharts/PieProperty.js +180 -0
  25. package/dist/es/business/YkCharts/PieProperty.js.map +7 -0
  26. package/dist/es/business/YkCharts/Pies.d.ts +26 -0
  27. package/dist/es/business/YkCharts/Pies.js +348 -0
  28. package/dist/es/business/YkCharts/Pies.js.map +7 -0
  29. package/dist/es/business/YkCharts/constants.d.ts +1 -0
  30. package/dist/es/business/YkCharts/constants.js +47 -0
  31. package/dist/es/business/YkCharts/constants.js.map +7 -0
  32. package/dist/es/business/YkCharts/hooks.d.ts +4 -0
  33. package/dist/es/business/YkCharts/hooks.js +37 -0
  34. package/dist/es/business/YkCharts/hooks.js.map +7 -0
  35. package/dist/es/business/YkCharts/index.d.ts +9 -0
  36. package/dist/es/business/YkCharts/index.js +20 -0
  37. package/dist/es/business/YkCharts/index.js.map +7 -0
  38. package/dist/es/business/YkCharts/index.module.less +164 -0
  39. package/dist/es/business/YkCharts/tooltip.less +92 -0
  40. package/dist/es/business/YkCharts/transformData.js +16 -0
  41. package/dist/es/business/YkCharts/transformData.js.map +7 -0
  42. package/dist/es/business/YkCharts/typing.d.ts +74 -0
  43. package/dist/es/business/YkCharts/typing.js +1 -0
  44. package/dist/es/business/YkCharts/typing.js.map +7 -0
  45. package/dist/es/business/YkCharts/utils.d.ts +4 -0
  46. package/dist/es/business/YkCharts/utils.js +109 -0
  47. package/dist/es/business/YkCharts/utils.js.map +7 -0
  48. package/dist/es/business/YkCharts/variables.less +13 -0
  49. package/dist/es/components/YKMarkdown/index.d.ts +11 -0
  50. package/dist/es/components/YKMarkdown/index.js +236 -0
  51. package/dist/es/components/YKMarkdown/index.js.map +7 -0
  52. package/dist/es/components/YKMarkdown/index.module.less +83 -0
  53. package/dist/es/components/YkDateRangePicker/YkDateRangePicker.mdx +3 -3
  54. package/dist/es/creative/GlassSegmentedRadio/index.d.ts +1 -1
  55. package/dist/es/creative/SkillsWriter/index.d.ts +3 -0
  56. package/dist/es/creative/SkillsWriter/index.js +191 -0
  57. package/dist/es/creative/SkillsWriter/index.js.map +7 -0
  58. package/dist/es/creative/SkillsWriter/index.module.less +21 -0
  59. package/dist/es/index.less +6 -1
  60. package/dist/es/utils/ykStorybookDoc.d.ts +15 -0
  61. package/dist/es/utils/ykStorybookDoc.js +24 -2
  62. package/dist/es/utils/ykStorybookDoc.js.map +2 -2
  63. package/dist/lib/assets/image/skills.zip +0 -0
  64. package/dist/lib/business/Empty/index.js.map +1 -1
  65. package/dist/lib/business/YkCharts/Area.d.ts +18 -0
  66. package/dist/lib/business/YkCharts/Area.js +346 -0
  67. package/dist/lib/business/YkCharts/Area.js.map +7 -0
  68. package/dist/lib/business/YkCharts/Bar.d.ts +21 -0
  69. package/dist/lib/business/YkCharts/Bar.js +323 -0
  70. package/dist/lib/business/YkCharts/Bar.js.map +7 -0
  71. package/dist/lib/business/YkCharts/BarProperty.d.ts +21 -0
  72. package/dist/lib/business/YkCharts/BarProperty.js +370 -0
  73. package/dist/lib/business/YkCharts/BarProperty.js.map +7 -0
  74. package/dist/lib/business/YkCharts/BarTotal.d.ts +21 -0
  75. package/dist/lib/business/YkCharts/BarTotal.js +295 -0
  76. package/dist/lib/business/YkCharts/BarTotal.js.map +7 -0
  77. package/dist/lib/business/YkCharts/Line.d.ts +21 -0
  78. package/dist/lib/business/YkCharts/Line.js +349 -0
  79. package/dist/lib/business/YkCharts/Line.js.map +7 -0
  80. package/dist/lib/business/YkCharts/Pie.d.ts +19 -0
  81. package/dist/lib/business/YkCharts/Pie.js +117 -0
  82. package/dist/lib/business/YkCharts/Pie.js.map +7 -0
  83. package/dist/lib/business/YkCharts/PieProperty.d.ts +18 -0
  84. package/dist/lib/business/YkCharts/PieProperty.js +193 -0
  85. package/dist/lib/business/YkCharts/PieProperty.js.map +7 -0
  86. package/dist/lib/business/YkCharts/Pies.d.ts +26 -0
  87. package/dist/lib/business/YkCharts/Pies.js +337 -0
  88. package/dist/lib/business/YkCharts/Pies.js.map +7 -0
  89. package/dist/lib/business/YkCharts/constants.d.ts +1 -0
  90. package/dist/lib/business/YkCharts/constants.js +71 -0
  91. package/dist/lib/business/YkCharts/constants.js.map +7 -0
  92. package/dist/lib/business/YkCharts/hooks.d.ts +4 -0
  93. package/dist/lib/business/YkCharts/hooks.js +62 -0
  94. package/dist/lib/business/YkCharts/hooks.js.map +7 -0
  95. package/dist/lib/business/YkCharts/index.d.ts +9 -0
  96. package/dist/lib/business/YkCharts/index.js +61 -0
  97. package/dist/lib/business/YkCharts/index.js.map +7 -0
  98. package/dist/lib/business/YkCharts/index.module.less +164 -0
  99. package/dist/lib/business/YkCharts/tooltip.less +92 -0
  100. package/dist/lib/business/YkCharts/transformData.js +40 -0
  101. package/dist/lib/business/YkCharts/transformData.js.map +7 -0
  102. package/dist/lib/business/YkCharts/typing.d.ts +74 -0
  103. package/dist/lib/business/YkCharts/typing.js +18 -0
  104. package/dist/lib/business/YkCharts/typing.js.map +7 -0
  105. package/dist/lib/business/YkCharts/utils.d.ts +4 -0
  106. package/dist/lib/business/YkCharts/utils.js +143 -0
  107. package/dist/lib/business/YkCharts/utils.js.map +7 -0
  108. package/dist/lib/business/YkCharts/variables.less +13 -0
  109. package/dist/lib/components/YKMarkdown/index.d.ts +11 -0
  110. package/dist/lib/components/YKMarkdown/index.js +188 -0
  111. package/dist/lib/components/YKMarkdown/index.js.map +7 -0
  112. package/dist/lib/components/YKMarkdown/index.module.less +83 -0
  113. package/dist/lib/components/YkDateRangePicker/YkDateRangePicker.mdx +3 -3
  114. package/dist/lib/creative/GlassSegmentedRadio/index.d.ts +1 -1
  115. package/dist/lib/creative/SkillsWriter/index.d.ts +3 -0
  116. package/dist/lib/creative/SkillsWriter/index.js +200 -0
  117. package/dist/lib/creative/SkillsWriter/index.js.map +7 -0
  118. package/dist/lib/creative/SkillsWriter/index.module.less +21 -0
  119. package/dist/lib/index.less +6 -1
  120. package/dist/lib/utils/ykStorybookDoc.d.ts +15 -0
  121. package/dist/lib/utils/ykStorybookDoc.js +23 -1
  122. package/dist/lib/utils/ykStorybookDoc.js.map +2 -2
  123. package/package.json +152 -143
@@ -0,0 +1,164 @@
1
+ @import './variables.less';
2
+
3
+ .chartBody {
4
+ position: relative;
5
+ display: flex;
6
+ flex-direction: column;
7
+ width: 100%;
8
+
9
+ .chartBodyHeader {
10
+ position: relative;
11
+ display: flex;
12
+ flex-wrap: wrap;
13
+ gap: 10px;
14
+ margin-bottom: 20px;
15
+
16
+ .chartType {
17
+ position: relative;
18
+ margin-left: auto;
19
+
20
+ .radioButton {
21
+ position: relative;
22
+ height: 30px;
23
+ line-height: 28px;
24
+
25
+ &:first-child {
26
+ border-start-start-radius: 2px;
27
+ border-end-start-radius: 2px;
28
+ }
29
+
30
+ &:last-child {
31
+ border-start-end-radius: 2px;
32
+ border-end-end-radius: 2px;
33
+ }
34
+ }
35
+ }
36
+ }
37
+
38
+ .chartBodyContent {
39
+ position: relative;
40
+ display: flex;
41
+ flex: 1;
42
+ align-items: center;
43
+ justify-content: center;
44
+ min-height: 300px;
45
+ }
46
+ }
47
+
48
+ .echarts {
49
+ position: relative;
50
+ flex: 1;
51
+ }
52
+
53
+ .tooltip {
54
+ position: relative;
55
+ min-width: 200px;
56
+ padding: 10px 0 0 10px;
57
+ box-shadow: rgb(71 71 71 / 10%) 0 2px 12px 0;
58
+
59
+ .title {
60
+ position: relative;
61
+ z-index: 2;
62
+ display: flex;
63
+ gap: 10px;
64
+ align-items: center;
65
+ justify-content: space-between;
66
+ margin-bottom: 10px;
67
+ color: #333;
68
+ font-weight: 600;
69
+ font-size: 12px;
70
+ }
71
+
72
+ .content {
73
+ position: relative;
74
+ max-height: 200px;
75
+ overflow-y: auto;
76
+
77
+ .item {
78
+ position: relative;
79
+ display: flex;
80
+ align-items: center;
81
+ height: 20px;
82
+ margin-bottom: 5px;
83
+ padding: 0 0 0 10px;
84
+ padding-right: 10px;
85
+ color: #666;
86
+ font-weight: 400;
87
+ font-size: 12px;
88
+ line-height: 20px;
89
+ border-radius: 4px;
90
+
91
+ .point {
92
+ position: relative;
93
+ display: flex;
94
+ align-items: center;
95
+ justify-content: center;
96
+ width: 13px;
97
+ height: 2px;
98
+ margin-right: 10px;
99
+ border-top-width: 2px;
100
+
101
+ &.pointBar {
102
+ width: 10px;
103
+ height: 10px;
104
+ border-radius: 2px;
105
+ }
106
+ }
107
+
108
+ .category {
109
+ margin-right: 20px;
110
+ white-space: nowrap;
111
+ }
112
+
113
+ .value {
114
+ flex: 1;
115
+ color: #333;
116
+ text-align: right;
117
+ }
118
+ }
119
+ }
120
+ }
121
+
122
+ .pieLegend {
123
+ position: relative;
124
+ width: 100%;
125
+ height: 100%;
126
+
127
+ .pieSlider {
128
+ width: 100%;
129
+ overflow: hidden;
130
+ }
131
+
132
+ :global {
133
+ .swiper-button-prev::after,
134
+ .swiper-button-next::after {
135
+ font-size: 30px !important;
136
+ }
137
+ }
138
+ }
139
+
140
+ .empty {
141
+ display: flex;
142
+ flex-direction: column;
143
+ justify-content: center;
144
+ height: 100%;
145
+ }
146
+
147
+ .percentRadio {
148
+ position: relative;
149
+ margin-left: auto;
150
+
151
+ .radioButton {
152
+ position: relative;
153
+
154
+ &:first-child {
155
+ border-start-start-radius: 2px;
156
+ border-end-start-radius: 2px;
157
+ }
158
+
159
+ &:last-child {
160
+ border-start-end-radius: 2px;
161
+ border-end-end-radius: 2px;
162
+ }
163
+ }
164
+ }
@@ -0,0 +1,92 @@
1
+ @import './variables.less';
2
+
3
+ .g2-tooltip {
4
+ background-color: transparent !important;
5
+ box-shadow: none !important;
6
+ }
7
+
8
+ .yk-charts-tooltip {
9
+ position: relative;
10
+ margin-bottom: 0;
11
+ padding: 15px 20px 5px 15px;
12
+ border: none;
13
+ box-shadow: rgb(71 71 71 / 10%) 0 2px 12px 0;
14
+
15
+ .ant-card-body {
16
+ position: relative;
17
+ display: flex;
18
+ flex-direction: column;
19
+ gap: 5px;
20
+ padding: 0;
21
+ }
22
+
23
+ .yk-charts-tooltip-title {
24
+ margin-bottom: 10px;
25
+ color: #333;
26
+ font-weight: 600;
27
+ font-size: 12px;
28
+ font-family: @ykFontFamilyMedium;
29
+ }
30
+
31
+ .yk-charts-tooltip-box {
32
+ margin-bottom: 5px;
33
+
34
+ .yk-charts-tooltip-item {
35
+ position: relative;
36
+ display: flex;
37
+ align-items: center;
38
+ height: 20px;
39
+ margin-bottom: 5px;
40
+ padding: 0 0 0 10px;
41
+ color: #666;
42
+ font-weight: 400;
43
+ font-size: 12px;
44
+ font-family: @ykFontFamilyRegular;
45
+ line-height: 20px;
46
+ border-radius: 4px;
47
+
48
+ .item-point {
49
+ position: relative;
50
+ display: flex;
51
+ align-items: center;
52
+ justify-content: center;
53
+ width: 13px;
54
+ height: 1px;
55
+ margin-right: 10px;
56
+ border-top-width: 2px;
57
+
58
+ &-svg {
59
+ width: 14px;
60
+ height: 5px;
61
+ margin-right: 10px;
62
+ }
63
+ }
64
+
65
+ .item-square {
66
+ position: relative;
67
+ display: flex;
68
+ align-items: center;
69
+ justify-content: center;
70
+ width: 10px;
71
+ height: 10px;
72
+ margin-right: 10px;
73
+ background-size: 5px 5px !important;
74
+ border-top-width: 2px;
75
+ }
76
+
77
+ .item-key {
78
+ margin-right: 5px;
79
+ }
80
+
81
+ .item-category {
82
+ margin-right: 30px;
83
+ white-space: nowrap;
84
+ }
85
+
86
+ .item-value {
87
+ flex: 1;
88
+ text-align: right;
89
+ }
90
+ }
91
+ }
92
+ }
@@ -0,0 +1,16 @@
1
+ // src/business/YkCharts/transformData.js
2
+ var transformBaseToSeries = (baseData) => {
3
+ const intervals = Object.keys(baseData[0]).filter((key) => key !== "数据日期" && key !== "设备数");
4
+ return intervals.map((interval) => ({
5
+ name: interval,
6
+ type: "line",
7
+ smooth: true,
8
+ areaStyle: {},
9
+ showSymbol: false,
10
+ data: baseData.map((item) => item[interval])
11
+ }));
12
+ };
13
+ export {
14
+ transformBaseToSeries
15
+ };
16
+ //# sourceMappingURL=transformData.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/business/YkCharts/transformData.js"],
4
+ "sourcesContent": ["/**\n * 将base数据转换为series格式\n * @param {Array} baseData - 原始数据数组\n * @returns {Array} - 转换后的series数据\n */\nexport const transformBaseToSeries = (baseData) => {\n // 获取所有区间名称(排除数据日期和设备数字段)\n const intervals = Object.keys(baseData[0]).filter((key) => key !== '数据日期' && key !== '设备数');\n\n // 为每个区间创建series对象\n return intervals.map((interval) => ({\n name: interval,\n type: 'line',\n smooth: true,\n areaStyle: {},\n showSymbol: false,\n data: baseData.map((item) => item[interval]),\n }));\n};\n"],
5
+ "mappings": ";AAKO,IAAM,wBAAwB,CAAC,aAAa;AAEjD,QAAM,YAAY,OAAO,KAAK,SAAS,CAAC,CAAC,EAAE,OAAO,CAAC,QAAQ,QAAQ,UAAU,QAAQ,KAAK;AAG1F,SAAO,UAAU,IAAI,CAAC,cAAc;AAAA,IAClC,MAAM;AAAA,IACN,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW,CAAC;AAAA,IACZ,YAAY;AAAA,IACZ,MAAM,SAAS,IAAI,CAAC,SAAS,KAAK,QAAQ,CAAC;AAAA,EAC7C,EAAE;AACJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,74 @@
1
+ export type GroupByItem = {
2
+ key: string;
3
+ options: string[];
4
+ selected: string[];
5
+ };
6
+ export type Format = 'integer' | 'string' | 'datetime' | 'decimal' | 'percent' | 'currency';
7
+ export type ColumnConfig = {
8
+ width?: number;
9
+ tooltip?: string;
10
+ sortable?: 'number' | 'string';
11
+ fixed?: 'left' | 'right';
12
+ hide_compare?: boolean;
13
+ align?: 'left' | 'right' | 'center';
14
+ name_group?: string;
15
+ format?: Format;
16
+ is_heatmap?: boolean;
17
+ sort_order?: 'ascend' | 'descend';
18
+ is_heap?: boolean;
19
+ hidden?: boolean;
20
+ resize?: boolean;
21
+ disable_sort?: boolean;
22
+ sort_method?: 'number' | 'string' | '';
23
+ show_icon?: boolean;
24
+ titletip?: string;
25
+ tip_id?: string | string;
26
+ type?: 'string' | 'numeric' | 'date' | 'boolean' | 'number';
27
+ };
28
+ type Compare = {
29
+ end: string;
30
+ start: string;
31
+ value: number | null;
32
+ label: string;
33
+ time: string;
34
+ };
35
+ type KpiData = {
36
+ huan_bi: Compare;
37
+ tong_bi: Compare;
38
+ last: Compare;
39
+ };
40
+ export type TableData = {
41
+ ds_id: number;
42
+ metric: string[];
43
+ group_by: string[] | null;
44
+ chart_types: string[];
45
+ column_config: ColumnConfig[];
46
+ x: string[];
47
+ x_field: string;
48
+ table_summary: (string | number)[];
49
+ table_body: (string | number | boolean)[][];
50
+ table_head: string[];
51
+ kpi_data?: KpiData;
52
+ last_refresh_time?: string;
53
+ total_column?: string;
54
+ duration_ms?: number;
55
+ debug_sql?: string;
56
+ meta_data?: SqlMetaConfig[];
57
+ };
58
+ export type SqlFormatType = 'normal' | 'number' | 'percent' | 'currency';
59
+ export type SqlFormat = {
60
+ type: SqlFormatType;
61
+ decimals: number;
62
+ thousand_separator: boolean;
63
+ unit: number;
64
+ prefix?: string;
65
+ suffix?: string;
66
+ };
67
+ export type SqlMetaConfig = {
68
+ show: boolean;
69
+ field: string;
70
+ display_name: string;
71
+ is_numeric: boolean;
72
+ format: SqlFormat;
73
+ };
74
+ export {};
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=typing.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,4 @@
1
+ import type { Format, SqlFormat } from './typing';
2
+ export declare const formatValue: (value: string | number, format: Format | undefined | null) => string;
3
+ export declare function formatNumber(num: number | string, isInteger?: boolean): [string, string];
4
+ export declare function sqlFormat(value: string | number | boolean, format: SqlFormat | undefined | null): string;
@@ -0,0 +1,109 @@
1
+ var __pow = Math.pow;
2
+
3
+ // src/business/YkCharts/utils.ts
4
+ import Decimal from "decimal.js";
5
+ var formatValue = (value, format) => {
6
+ if (value === null || value === void 0 || value === "-") {
7
+ return "-";
8
+ }
9
+ if (!format || format === null) {
10
+ return value.toString();
11
+ }
12
+ const numValue = Number(value);
13
+ if (format === "percent") {
14
+ return new Decimal(numValue).mul(100).toFixed(2) + "%";
15
+ }
16
+ if (format === "decimal") {
17
+ return new Decimal(numValue).toFixed(2);
18
+ }
19
+ if (format === "integer") {
20
+ return new Intl.NumberFormat().format(numValue);
21
+ }
22
+ return numValue.toString();
23
+ };
24
+ function formatNumber(num, isInteger = false) {
25
+ const numberValue = typeof num === "string" ? parseFloat(num) : num;
26
+ if (isNaN(numberValue)) {
27
+ return [(num == null ? void 0 : num.toString()) || "", ""];
28
+ }
29
+ let result = "";
30
+ let unit = "";
31
+ function setFixed(v, dot) {
32
+ const multiplier = __pow(10, dot);
33
+ return Math.floor(v * multiplier) / multiplier;
34
+ }
35
+ if (numberValue < 1e3) {
36
+ result = new Decimal(numberValue).toFixed(1);
37
+ } else if (numberValue < 1e4) {
38
+ result = numberValue.toLocaleString("en-US", {
39
+ minimumFractionDigits: isInteger ? 0 : 1,
40
+ maximumFractionDigits: isInteger ? 0 : 1
41
+ });
42
+ } else if (numberValue < 1e8) {
43
+ const v = setFixed(numberValue / 1e4, 2);
44
+ result = v.toLocaleString("en-US", {
45
+ minimumFractionDigits: isInteger ? 1 : 2,
46
+ maximumFractionDigits: isInteger ? 1 : 2
47
+ });
48
+ unit = " 万";
49
+ } else {
50
+ const v = setFixed(numberValue / 1e8, 2);
51
+ result = v.toLocaleString("en-US", {
52
+ minimumFractionDigits: isInteger ? 1 : 2,
53
+ maximumFractionDigits: isInteger ? 1 : 2
54
+ });
55
+ unit = " 亿";
56
+ }
57
+ if (isInteger) {
58
+ result = result.replace(/\.0+(?=\D*$)/, "");
59
+ }
60
+ return [result, unit];
61
+ }
62
+ function sqlFormat(value, format) {
63
+ if (value === null || value === void 0 || value === "-") {
64
+ return "-";
65
+ }
66
+ if (!format) {
67
+ return value == null ? void 0 : value.toString();
68
+ }
69
+ if (typeof value === "boolean") {
70
+ return value == null ? void 0 : value.toString();
71
+ }
72
+ const { type, decimals = 0, thousand_separator = true, unit = 0, prefix = "", suffix = "" } = format;
73
+ switch (type) {
74
+ case "number": {
75
+ let result;
76
+ if (thousand_separator) {
77
+ result = value ? value == null ? void 0 : value.toLocaleString("en-US", {
78
+ minimumFractionDigits: decimals,
79
+ maximumFractionDigits: decimals
80
+ }) : "0";
81
+ } else {
82
+ result = new Decimal(value || 0).toFixed(decimals);
83
+ }
84
+ return `${prefix}${result}${suffix}`;
85
+ }
86
+ case "percent": {
87
+ const result = new Decimal(value || 0).mul(100).toFixed(decimals) + "%";
88
+ return `${prefix}${result}${suffix}`;
89
+ }
90
+ case "currency": {
91
+ const numericValue = new Decimal(value || 0).div(__pow(10, unit)).toNumber();
92
+ const unitValue = numericValue.toLocaleString("en-US", {
93
+ minimumFractionDigits: decimals,
94
+ maximumFractionDigits: decimals
95
+ });
96
+ const unitLabel = unit === 0 ? "" : unit === 4 ? "万" : unit === 8 ? "亿" : "";
97
+ return `${prefix}${unitValue}${unitLabel}${suffix}`;
98
+ }
99
+ case "normal":
100
+ default:
101
+ return (value == null ? void 0 : value.toString()) || "-";
102
+ }
103
+ }
104
+ export {
105
+ formatNumber,
106
+ formatValue,
107
+ sqlFormat
108
+ };
109
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/business/YkCharts/utils.ts"],
4
+ "sourcesContent": ["import Decimal from 'decimal.js';\nimport type { Format, SqlFormat } from './typing';\n\nexport const formatValue = (value: string | number, format: Format | undefined | null): string => {\n if (value === null || value === undefined || value === '-') {\n return '-';\n }\n if (!format || format === null) {\n return value.toString();\n }\n const numValue = Number(value);\n if (format === 'percent') {\n return new Decimal(numValue).mul(100).toFixed(2) + '%';\n }\n if (format === 'decimal') {\n return new Decimal(numValue).toFixed(2);\n }\n if (format === 'integer') {\n return new Intl.NumberFormat().format(numValue);\n }\n return numValue.toString();\n};\n\nexport function formatNumber(num: number | string, isInteger: boolean = false): [string, string] {\n const numberValue = typeof num === 'string' ? parseFloat(num) : num;\n if (isNaN(numberValue)) {\n return [num?.toString() || '', ''];\n }\n let result: string = '';\n let unit: string = '';\n function setFixed(v: number, dot: number) {\n const multiplier = 10 ** dot;\n return Math.floor(v * multiplier) / multiplier;\n }\n if (numberValue < 1000) {\n result = new Decimal(numberValue).toFixed(1);\n } else if (numberValue < 10000) {\n result = numberValue.toLocaleString('en-US', {\n minimumFractionDigits: isInteger ? 0 : 1,\n maximumFractionDigits: isInteger ? 0 : 1,\n });\n } else if (numberValue < 100000000) {\n const v = setFixed(numberValue / 10000, 2);\n result = v.toLocaleString('en-US', {\n minimumFractionDigits: isInteger ? 1 : 2,\n maximumFractionDigits: isInteger ? 1 : 2,\n });\n unit = ' 万';\n } else {\n const v = setFixed(numberValue / 100000000, 2);\n result = v.toLocaleString('en-US', {\n minimumFractionDigits: isInteger ? 1 : 2,\n maximumFractionDigits: isInteger ? 1 : 2,\n });\n unit = ' 亿';\n }\n if (isInteger) {\n result = result.replace(/\\.0+(?=\\D*$)/, '');\n }\n return [result, unit];\n}\n\nexport function sqlFormat(value: string | number | boolean, format: SqlFormat | undefined | null): string {\n if (value === null || value === undefined || value === '-') {\n return '-';\n }\n if (!format) {\n return value?.toString();\n }\n if (typeof value === 'boolean') {\n return value?.toString();\n }\n const { type, decimals = 0, thousand_separator = true, unit = 0, prefix = '', suffix = '' } = format;\n switch (type) {\n case 'number': {\n let result: string;\n if (thousand_separator) {\n result = value\n ? value?.toLocaleString('en-US', {\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n })\n : '0';\n } else {\n result = new Decimal(value || 0).toFixed(decimals);\n }\n return `${prefix}${result}${suffix}`;\n }\n case 'percent': {\n const result = new Decimal(value || 0).mul(100).toFixed(decimals) + '%';\n return `${prefix}${result}${suffix}`;\n }\n case 'currency': {\n const numericValue = new Decimal(value || 0).div(10 ** unit).toNumber();\n const unitValue = numericValue.toLocaleString('en-US', {\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n });\n const unitLabel = unit === 0 ? '' : unit === 4 ? '万' : unit === 8 ? '亿' : '';\n return `${prefix}${unitValue}${unitLabel}${suffix}`;\n }\n case 'normal':\n default:\n return value?.toString() || '-';\n }\n}\n"],
5
+ "mappings": ";;;AAAA,OAAO,aAAa;AAGb,IAAM,cAAc,CAAC,OAAwB,WAA8C;AAChG,MAAI,U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,MACzB,CAAC;AACD,YAAM,YAAY,SAAS,IAAI,KAAK,SAAS,IAAI,MAAM,SAAS,IAAI,MAAM;AAC1E,aAAO,GAAG,SAAS,YAAY,YAAY;AAAA,IAC7C;AAAA,IACA,KAAK;AAAA,IACL;AACE,cAAO,+BAAO,eAAc;AAAA,EAChC;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,13 @@
1
+ @primaryColor: #3b86f9;
2
+ @iconPrimaryColor: #0a6bfd;
3
+ @fontPrimaryColor: #0a6bfd;
4
+ @borderPrimaryColor: #b0cffe;
5
+ @globalBgColor: #edeff4;
6
+
7
+ @ykFontFamilySemibold: 'PingFangSC-Semibold', 'PingFang SC', 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial,
8
+ sans-serif;
9
+ @ykFontFamilyRegular: 'PingFangSC-Regular', 'PingFang SC', 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial,
10
+ sans-serif;
11
+ @ykFontFamilyMedium: 'PingFangSC-Medium', 'PingFang SC', 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial,
12
+ sans-serif;
13
+
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Markdown 渲染器组件
3
+ */
4
+ import React from 'react';
5
+ export interface YKMarkdownProps {
6
+ markdown: string;
7
+ showToc?: boolean;
8
+ language?: string;
9
+ }
10
+ declare const YKMarkdown: React.FC<YKMarkdownProps>;
11
+ export default YKMarkdown;