@363045841yyt/klinechart 0.7.5 → 0.7.6
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/components/DrawingStyleToolbar.vue.d.ts +1 -15
- package/dist/components/DrawingStyleToolbar.vue.d.ts.map +1 -1
- package/dist/components/IndicatorParams.vue.d.ts.map +1 -1
- package/dist/components/IndicatorSelector.vue.d.ts.map +1 -1
- package/dist/components/KLineChart.vue.d.ts +5 -6
- package/dist/components/KLineChart.vue.d.ts.map +1 -1
- package/dist/components/KLineTooltip.vue.d.ts +1 -1
- package/dist/components/KLineTooltip.vue.d.ts.map +1 -1
- package/dist/components/MarkerTooltip.vue.d.ts +1 -12
- package/dist/components/MarkerTooltip.vue.d.ts.map +1 -1
- package/dist/composables/useFullscreenTeleportTarget.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/{klinechart.css → index.css} +1 -2
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +544 -617
- package/dist/version.d.ts +1 -1
- package/dist/web-component.d.ts +18 -0
- package/dist/web-component.d.ts.map +1 -0
- package/package.json +10 -2
- package/src/__tests__/_mockController.ts +11 -1
- package/src/components/DrawingStyleToolbar.vue +1 -14
- package/src/components/IndicatorParams.vue +2 -1
- package/src/components/IndicatorSelector.vue +3 -5
- package/src/components/KLineChart.vue +198 -428
- package/src/components/KLineTooltip.vue +2 -2
- package/src/components/MarkerTooltip.vue +1 -12
- package/src/composables/useFullscreenTeleportTarget.ts +0 -2
- package/src/web-component.ts +14 -0
|
@@ -70,7 +70,7 @@ export interface KLineData {
|
|
|
70
70
|
const props = defineProps<{
|
|
71
71
|
k: KLineData | null
|
|
72
72
|
index: number | null
|
|
73
|
-
data: KLineData
|
|
73
|
+
data: ReadonlyArray<KLineData>
|
|
74
74
|
pos: { x: number; y: number }
|
|
75
75
|
useAnchor?: boolean
|
|
76
76
|
anchorPlacement?: 'right-bottom' | 'left-bottom'
|
|
@@ -109,7 +109,7 @@ const UP_COLOR = '#ef4444'
|
|
|
109
109
|
const DOWN_COLOR = '#22c55e'
|
|
110
110
|
const NEUTRAL_COLOR = '#6b7280'
|
|
111
111
|
|
|
112
|
-
function calcDirection(k: KLineData, data: KLineData
|
|
112
|
+
function calcDirection(k: KLineData, data: ReadonlyArray<KLineData>, idx: number | null): number {
|
|
113
113
|
if (k.close >= k.open) return 1
|
|
114
114
|
const prev = typeof idx === 'number' && idx > 0 ? data[idx - 1] : undefined
|
|
115
115
|
if (prev && k.close > prev.close) return 1
|
|
@@ -19,18 +19,7 @@
|
|
|
19
19
|
<script setup lang="ts">
|
|
20
20
|
import { computed } from 'vue'
|
|
21
21
|
import type { ComponentPublicInstance } from 'vue'
|
|
22
|
-
|
|
23
|
-
interface MarkerEntity {
|
|
24
|
-
markerType: string
|
|
25
|
-
metadata: Record<string, unknown>
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface CustomMarkerEntity {
|
|
29
|
-
date: string
|
|
30
|
-
shape: string
|
|
31
|
-
label?: { text: string }
|
|
32
|
-
metadata: Record<string, unknown>
|
|
33
|
-
}
|
|
22
|
+
import type { MarkerEntity, CustomMarkerEntity } from '@363045841yyt/klinechart-core/engine/marker/registry'
|
|
34
23
|
|
|
35
24
|
const MARKER_TYPE_LABELS: Record<string, string> = {
|
|
36
25
|
support: '支撑位',
|
|
@@ -8,11 +8,9 @@ export function provideFullscreenTeleportTarget(targetRef: Ref<HTMLElement | nul
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export function useFullscreenTeleportTarget() {
|
|
11
|
-
// null = no provider in ancestor tree (degraded scenario)
|
|
12
11
|
const targetRef = inject(FULLSCREEN_TARGET_KEY, null)
|
|
13
12
|
|
|
14
13
|
return computed<HTMLElement | string>(() => {
|
|
15
|
-
// targetRef null → no provider; targetRef.value null → container not mounted yet
|
|
16
14
|
return targetRef?.value ?? 'body'
|
|
17
15
|
})
|
|
18
16
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineCustomElement } from 'vue'
|
|
2
|
+
import KLineChartVue from './components/KLineChart.vue'
|
|
3
|
+
import type { SemanticChartConfig, DataFetcher } from '@363045841yyt/klinechart-core/semantic'
|
|
4
|
+
|
|
5
|
+
const KLineChartElement = defineCustomElement(KLineChartVue, {
|
|
6
|
+
shadowRoot: true,
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
customElements.define('kline-chart', KLineChartElement)
|
|
10
|
+
|
|
11
|
+
export { KLineChartElement }
|
|
12
|
+
export default KLineChartElement
|
|
13
|
+
|
|
14
|
+
export type { SemanticChartConfig, DataFetcher }
|