candleview 1.1.2 → 1.1.3

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/index.mjs CHANGED
@@ -3388,11 +3388,10 @@ class ua extends $.Component {
3388
3388
  onChartTypeClick: c,
3389
3389
  onFullscreenClick: d,
3390
3390
  onTimezoneClick: p,
3391
- showToolbar: f = !0,
3392
- onCameraClick: k,
3393
- i18n: P
3391
+ onCameraClick: f,
3392
+ i18n: k
3394
3393
  } = this.props;
3395
- return f ? this.isMobileView() ? /* @__PURE__ */ m.jsxs("div", { style: {
3394
+ return this.isMobileView() ? /* @__PURE__ */ m.jsxs("div", { style: {
3396
3395
  background: t.panel.backgroundColor,
3397
3396
  borderBottom: `1px solid ${t.panel.borderColor}`,
3398
3397
  padding: "9px 13px",
@@ -3425,11 +3424,11 @@ class ua extends $.Component {
3425
3424
  transition: "all 0.2s ease",
3426
3425
  minHeight: "31px"
3427
3426
  },
3428
- onMouseEnter: (_) => {
3429
- h || (_.currentTarget.style.background = t.toolbar.button.hover);
3427
+ onMouseEnter: (P) => {
3428
+ h || (P.currentTarget.style.background = t.toolbar.button.hover);
3430
3429
  },
3431
- onMouseLeave: (_) => {
3432
- h || (_.currentTarget.style.background = "transparent");
3430
+ onMouseLeave: (P) => {
3431
+ h || (P.currentTarget.style.background = "transparent");
3433
3432
  },
3434
3433
  children: /* @__PURE__ */ m.jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
3435
3434
  /* @__PURE__ */ m.jsx("line", { x1: "3", y1: "6", x2: "21", y2: "6" }),
@@ -3463,11 +3462,11 @@ class ua extends $.Component {
3463
3462
  transition: "all 0.3s ease",
3464
3463
  position: "relative"
3465
3464
  },
3466
- onMouseEnter: (_) => {
3467
- _.currentTarget.style.background = t.toolbar.button.hover;
3465
+ onMouseEnter: (P) => {
3466
+ P.currentTarget.style.background = t.toolbar.button.hover;
3468
3467
  },
3469
- onMouseLeave: (_) => {
3470
- _.currentTarget.style.background = "transparent";
3468
+ onMouseLeave: (P) => {
3469
+ P.currentTarget.style.background = "transparent";
3471
3470
  },
3472
3471
  children: /* @__PURE__ */ m.jsx("div", { style: {
3473
3472
  width: "16px",
@@ -3528,11 +3527,11 @@ class ua extends $.Component {
3528
3527
  transition: "all 0.2s ease",
3529
3528
  minHeight: "31px"
3530
3529
  },
3531
- onMouseEnter: (_) => {
3532
- n || (_.currentTarget.style.background = t.toolbar.button.hover);
3530
+ onMouseEnter: (P) => {
3531
+ n || (P.currentTarget.style.background = t.toolbar.button.hover);
3533
3532
  },
3534
- onMouseLeave: (_) => {
3535
- n || (_.currentTarget.style.background = "transparent");
3533
+ onMouseLeave: (P) => {
3534
+ n || (P.currentTarget.style.background = "transparent");
3536
3535
  },
3537
3536
  children: e
3538
3537
  }
@@ -3566,11 +3565,11 @@ class ua extends $.Component {
3566
3565
  transition: "all 0.2s ease",
3567
3566
  minHeight: "31px"
3568
3567
  },
3569
- onMouseEnter: (_) => {
3570
- o || (_.currentTarget.style.background = t.toolbar.button.hover);
3568
+ onMouseEnter: (P) => {
3569
+ o || (P.currentTarget.style.background = t.toolbar.button.hover);
3571
3570
  },
3572
- onMouseLeave: (_) => {
3573
- o || (_.currentTarget.style.background = "transparent");
3571
+ onMouseLeave: (P) => {
3572
+ o || (P.currentTarget.style.background = "transparent");
3574
3573
  },
3575
3574
  children: [
3576
3575
  /* @__PURE__ */ m.jsxs("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
@@ -3610,11 +3609,11 @@ class ua extends $.Component {
3610
3609
  transition: "all 0.2s ease",
3611
3610
  minHeight: "31px"
3612
3611
  },
3613
- onMouseEnter: (_) => {
3614
- a || (_.currentTarget.style.background = t.toolbar.button.hover);
3612
+ onMouseEnter: (P) => {
3613
+ a || (P.currentTarget.style.background = t.toolbar.button.hover);
3615
3614
  },
3616
- onMouseLeave: (_) => {
3617
- a || (_.currentTarget.style.background = "transparent");
3615
+ onMouseLeave: (P) => {
3616
+ a || (P.currentTarget.style.background = "transparent");
3618
3617
  },
3619
3618
  children: oe(i, {
3620
3619
  size: 17
@@ -3650,11 +3649,11 @@ class ua extends $.Component {
3650
3649
  transition: "all 0.2s ease",
3651
3650
  minHeight: "31px"
3652
3651
  },
3653
- onMouseEnter: (_) => {
3654
- s || (_.currentTarget.style.background = t.toolbar.button.hover);
3652
+ onMouseEnter: (P) => {
3653
+ s || (P.currentTarget.style.background = t.toolbar.button.hover);
3655
3654
  },
3656
- onMouseLeave: (_) => {
3657
- s || (_.currentTarget.style.background = "transparent");
3655
+ onMouseLeave: (P) => {
3656
+ s || (P.currentTarget.style.background = "transparent");
3658
3657
  },
3659
3658
  children: [
3660
3659
  /* @__PURE__ */ m.jsx(
@@ -3664,7 +3663,7 @@ class ua extends $.Component {
3664
3663
  color: s ? t.toolbar.button.activeTextColor || t.layout.textColor : t.toolbar.button.color
3665
3664
  }
3666
3665
  ),
3667
- P.Indicators
3666
+ k.Indicators
3668
3667
  ]
3669
3668
  }
3670
3669
  ),
@@ -3680,7 +3679,7 @@ class ua extends $.Component {
3680
3679
  /* @__PURE__ */ m.jsx(
3681
3680
  "button",
3682
3681
  {
3683
- title: P.toolbarButtons.fullScreen,
3682
+ title: k.toolbarButtons.fullScreen,
3684
3683
  onClick: d,
3685
3684
  style: {
3686
3685
  background: "transparent",
@@ -3696,11 +3695,11 @@ class ua extends $.Component {
3696
3695
  minHeight: "31px",
3697
3696
  minWidth: "31px"
3698
3697
  },
3699
- onMouseEnter: (_) => {
3700
- _.currentTarget.style.background = t.toolbar.button.hover;
3698
+ onMouseEnter: (P) => {
3699
+ P.currentTarget.style.background = t.toolbar.button.hover;
3701
3700
  },
3702
- onMouseLeave: (_) => {
3703
- _.currentTarget.style.background = "transparent";
3701
+ onMouseLeave: (P) => {
3702
+ P.currentTarget.style.background = "transparent";
3704
3703
  },
3705
3704
  children: /* @__PURE__ */ m.jsx(we, { size: 17, color: t.toolbar.button.color })
3706
3705
  }
@@ -3714,8 +3713,8 @@ class ua extends $.Component {
3714
3713
  /* @__PURE__ */ m.jsx(
3715
3714
  "button",
3716
3715
  {
3717
- title: P.toolbarButtons.screenshot,
3718
- onClick: k,
3716
+ title: k.toolbarButtons.screenshot,
3717
+ onClick: f,
3719
3718
  style: {
3720
3719
  background: "transparent",
3721
3720
  border: "none",
@@ -3730,11 +3729,11 @@ class ua extends $.Component {
3730
3729
  minHeight: "31px",
3731
3730
  minWidth: "31px"
3732
3731
  },
3733
- onMouseEnter: (_) => {
3734
- _.currentTarget.style.background = t.toolbar.button.hover;
3732
+ onMouseEnter: (P) => {
3733
+ P.currentTarget.style.background = t.toolbar.button.hover;
3735
3734
  },
3736
- onMouseLeave: (_) => {
3737
- _.currentTarget.style.background = "transparent";
3735
+ onMouseLeave: (P) => {
3736
+ P.currentTarget.style.background = "transparent";
3738
3737
  },
3739
3738
  children: /* @__PURE__ */ m.jsx(ve, { size: 17, color: t.toolbar.button.color })
3740
3739
  }
@@ -3764,11 +3763,11 @@ class ua extends $.Component {
3764
3763
  transition: "all 0.3s ease",
3765
3764
  position: "relative"
3766
3765
  },
3767
- onMouseEnter: (_) => {
3768
- _.currentTarget.style.background = t.toolbar.button.hover;
3766
+ onMouseEnter: (P) => {
3767
+ P.currentTarget.style.background = t.toolbar.button.hover;
3769
3768
  },
3770
- onMouseLeave: (_) => {
3771
- _.currentTarget.style.background = "transparent";
3769
+ onMouseLeave: (P) => {
3770
+ P.currentTarget.style.background = "transparent";
3772
3771
  },
3773
3772
  children: /* @__PURE__ */ m.jsx("div", { style: {
3774
3773
  width: "16px",
@@ -3792,7 +3791,7 @@ class ua extends $.Component {
3792
3791
  ] }) })
3793
3792
  }
3794
3793
  ) })
3795
- ] }) : null;
3794
+ ] });
3796
3795
  }
3797
3796
  }
3798
3797
  class Ri {
@@ -48210,8 +48209,7 @@ class Lo extends $.Component {
48210
48209
  return null;
48211
48210
  }
48212
48211
  render() {
48213
- const { showToolbar: t = !0 } = this.props;
48214
- return t ? /* @__PURE__ */ m.jsxs("div", { style: { position: "relative" }, children: [
48212
+ return /* @__PURE__ */ m.jsxs("div", { style: { position: "relative" }, children: [
48215
48213
  /* @__PURE__ */ m.jsx("div", { style: {
48216
48214
  background: this.props.currentTheme.panel.backgroundColor,
48217
48215
  borderRight: `1px solid ${this.props.currentTheme.panel.borderColor}`,
@@ -48255,7 +48253,7 @@ class Lo extends $.Component {
48255
48253
  this.renderProjectInfoModal(),
48256
48254
  this.renderIrregularShapeModal(),
48257
48255
  this.renderTextToolModal()
48258
- ] }) : null;
48256
+ ] });
48259
48257
  }
48260
48258
  }
48261
48259
  class kt extends $.Component {
@@ -49931,11 +49929,7 @@ const qo = {
49931
49929
  class Zo extends $.Component {
49932
49930
  // ===================== Internal Data Buffer =====================
49933
49931
  constructor(t) {
49934
- super({
49935
- showLeftPanel: !1,
49936
- showTopPanel: !1,
49937
- ...t
49938
- }), this.candleViewContainerRef = $.createRef(), this.chartRef = $.createRef(), this.chartContainerRef = $.createRef(), this.drawingLayerRef = $.createRef(), this.chart = null, this.resizeObserver = null, this.realTimeInterval = null, this.currentSeries = null, this.chartManager = null, this.updateTimeout = null, this.viewportManager = null, this.chartEventManager = null, this.preparedData = [], this.originalData = [], this.loadDataAsync = (e) => {
49932
+ super(t), this.candleViewContainerRef = $.createRef(), this.chartRef = $.createRef(), this.chartContainerRef = $.createRef(), this.drawingLayerRef = $.createRef(), this.chart = null, this.resizeObserver = null, this.realTimeInterval = null, this.currentSeries = null, this.chartManager = null, this.updateTimeout = null, this.viewportManager = null, this.chartEventManager = null, this.preparedData = [], this.originalData = [], this.loadDataAsync = (e) => {
49939
49933
  this.setState({
49940
49934
  dataLoadProgress: 0,
49941
49935
  isDataLoading: !0
@@ -50264,8 +50258,6 @@ class Zo extends $.Component {
50264
50258
  isTimeFormatModalOpen: !1,
50265
50259
  isCloseTimeModalOpen: !1,
50266
50260
  isTradingDayModalOpen: !1,
50267
- currentCloseTime: "17:00",
50268
- currentTradingDayType: "trading-session",
50269
50261
  // time
50270
50262
  activeTimeframe: x.ONE_DAY,
50271
50263
  timeframe: Uo(t.timeframe) || x.ONE_DAY,
@@ -50277,7 +50269,9 @@ class Zo extends $.Component {
50277
50269
  displayData: [],
50278
50270
  isDataLoading: !1,
50279
50271
  dataLoadProgress: 0,
50280
- loadError: null
50272
+ loadError: null,
50273
+ showTopPanel: t.showTopPanel || !1,
50274
+ showLeftPanel: t.showLeftPanel || !1
50281
50275
  }, this.chartEventManager = new Ri();
50282
50276
  }
50283
50277
  // ======================================== life cycle start ========================================
@@ -50293,10 +50287,11 @@ class Zo extends $.Component {
50293
50287
  const r = this.props.theme || "dark";
50294
50288
  this.setState({
50295
50289
  currentTheme: this.getThemeConfig(r)
50296
- }), this.updateChartTheme();
50297
- return;
50290
+ }), this.handleThemeToggle();
50298
50291
  }
50299
- if (t.data !== this.props.data || t.url !== this.props.url) {
50292
+ if (t.i18n !== this.props.i18n && (this.setState({
50293
+ currentI18N: this.getI18nConfig(this.props.i18n || "en")
50294
+ }), this.updateChartI18n(this.props.i18n || "en")), t.data !== this.props.data || t.url !== this.props.url) {
50300
50295
  this.setState({
50301
50296
  isDataLoading: !0,
50302
50297
  dataLoadProgress: 0
@@ -50398,6 +50393,13 @@ class Zo extends $.Component {
50398
50393
  }
50399
50394
  }), this.resizeObserver.observe(this.chartContainerRef.current));
50400
50395
  }
50396
+ updateChartI18n(t) {
50397
+ this.chart && this.chart.applyOptions({
50398
+ localization: {
50399
+ locale: t
50400
+ }
50401
+ });
50402
+ }
50401
50403
  updateChartTheme() {
50402
50404
  const { currentTheme: t } = this.state;
50403
50405
  if (this.chart)
@@ -50435,7 +50437,7 @@ class Zo extends $.Component {
50435
50437
  return t === "en" ? le : Ho;
50436
50438
  }
50437
50439
  render() {
50438
- const { currentTheme: t, isDataLoading: e } = this.state, { height: i = 500, showToolbar: r = !0 } = this.props, n = `
50440
+ const { currentTheme: t, isDataLoading: e } = this.state, { height: i = 500 } = this.props, r = `
50439
50441
  .custom-scrollbar::-webkit-scrollbar {
50440
50442
  width: 6px;
50441
50443
  }
@@ -50463,7 +50465,7 @@ class Zo extends $.Component {
50463
50465
  .modal-scrollbar::-webkit-scrollbar-thumb:hover {
50464
50466
  background: ${t.toolbar.button.color}60;
50465
50467
  }
50466
- `, s = this.state.isTimeframeModalOpen || this.state.isIndicatorModalOpen || this.state.isTradeModalOpen || this.state.isChartTypeModalOpen || this.state.isSubChartModalOpen || this.state.isTimezoneModalOpen || this.state.isTimeFormatModalOpen || this.state.isCloseTimeModalOpen || this.state.isTradingDayModalOpen || this.state.isMobileMenuOpen, a = this.state.currentI18N === le ? "Loading data..." : "正在加载数据...", o = this.state.currentI18N === le ? "Load failed" : "加载失败";
50468
+ `, n = this.state.isTimeframeModalOpen || this.state.isIndicatorModalOpen || this.state.isTradeModalOpen || this.state.isChartTypeModalOpen || this.state.isSubChartModalOpen || this.state.isTimezoneModalOpen || this.state.isTimeFormatModalOpen || this.state.isCloseTimeModalOpen || this.state.isTradingDayModalOpen || this.state.isMobileMenuOpen, s = this.state.currentI18N === le ? "Loading data..." : "正在加载数据...", a = this.state.currentI18N === le ? "Load failed" : "加载失败";
50467
50469
  return /* @__PURE__ */ m.jsxs(
50468
50470
  "div",
50469
50471
  {
@@ -50481,7 +50483,7 @@ class Zo extends $.Component {
50481
50483
  "candleview-container": "true",
50482
50484
  onContextMenu: this.handleContextMenu,
50483
50485
  children: [
50484
- /* @__PURE__ */ m.jsx("style", { children: n }),
50486
+ /* @__PURE__ */ m.jsx("style", { children: r }),
50485
50487
  e && /* @__PURE__ */ m.jsx(
50486
50488
  "div",
50487
50489
  {
@@ -50528,7 +50530,7 @@ class Zo extends $.Component {
50528
50530
  fontSize: "16px",
50529
50531
  fontWeight: 500,
50530
50532
  textAlign: "center"
50531
- }, children: a }),
50533
+ }, children: s }),
50532
50534
  this.state.dataLoadProgress > 0 && /* @__PURE__ */ m.jsxs("div", { style: {
50533
50535
  width: "240px",
50534
50536
  marginTop: "8px",
@@ -50584,7 +50586,7 @@ class Zo extends $.Component {
50584
50586
  borderRadius: "6px",
50585
50587
  maxWidth: "320px"
50586
50588
  }, children: [
50587
- o,
50589
+ a,
50588
50590
  ": ",
50589
50591
  this.state.loadError
50590
50592
  ] })
@@ -50599,7 +50601,7 @@ class Zo extends $.Component {
50599
50601
  100% { transform: rotate(360deg); }
50600
50602
  }
50601
50603
  ` }),
50602
- s && /* @__PURE__ */ m.jsx(
50604
+ n && /* @__PURE__ */ m.jsx(
50603
50605
  "div",
50604
50606
  {
50605
50607
  style: {
@@ -50614,7 +50616,7 @@ class Zo extends $.Component {
50614
50616
  onClick: this.handleCloseModals
50615
50617
  }
50616
50618
  ),
50617
- this.props.showTopPanel && /* @__PURE__ */ m.jsx(
50619
+ this.state.showTopPanel && /* @__PURE__ */ m.jsx(
50618
50620
  ua,
50619
50621
  {
50620
50622
  currentTheme: t,
@@ -50639,7 +50641,6 @@ class Zo extends $.Component {
50639
50641
  onTimezoneSelect: this.handleTimezoneSelect,
50640
50642
  handleSelectedSubChartIndicator: this.handleSelectedSubChartIndicator,
50641
50643
  handleSelectedMainChartIndicator: this.handleSelectedMainChartIndicator,
50642
- showToolbar: r,
50643
50644
  onCloseModals: this.handleCloseModals,
50644
50645
  onSubChartClick: this.handleSubChartClick,
50645
50646
  selectedSubChartIndicators: this.state.selectedSubChartIndicators,
@@ -50652,8 +50653,6 @@ class Zo extends $.Component {
50652
50653
  onTimeFormatClick: this.handleTimeFormatClick,
50653
50654
  onCloseTimeClick: this.handleCloseTimeClick,
50654
50655
  onTradingDayClick: this.handleTradingDayClick,
50655
- currentCloseTime: this.state.currentCloseTime,
50656
- currentTradingDayType: this.state.currentTradingDayType,
50657
50656
  isMobileMenuOpen: this.state.isMobileMenuOpen,
50658
50657
  onMobileMenuToggle: this.handleMobileMenuToggle
50659
50658
  }
@@ -50664,14 +50663,13 @@ class Zo extends $.Component {
50664
50663
  minHeight: 0,
50665
50664
  position: "relative"
50666
50665
  }, children: [
50667
- this.props.showLeftPanel && /* @__PURE__ */ m.jsx(
50666
+ this.state.showLeftPanel && /* @__PURE__ */ m.jsx(
50668
50667
  Lo,
50669
50668
  {
50670
50669
  currentTheme: t,
50671
50670
  activeTool: this.state.activeTool,
50672
50671
  onToolSelect: this.handleToolSelect,
50673
50672
  onTradeClick: this.handleTradeClick,
50674
- showToolbar: r,
50675
50673
  drawingLayerRef: this.drawingLayerRef,
50676
50674
  selectedEmoji: this.state.selectedEmoji,
50677
50675
  onEmojiSelect: this.handleEmojiSelect,
@@ -50746,11 +50744,11 @@ class Zo extends $.Component {
50746
50744
  opacity: 0,
50747
50745
  transition: "opacity 0.3s ease"
50748
50746
  },
50749
- onMouseEnter: (h) => {
50750
- h.currentTarget.style.opacity = "1";
50747
+ onMouseEnter: (o) => {
50748
+ o.currentTarget.style.opacity = "1";
50751
50749
  },
50752
- onMouseLeave: (h) => {
50753
- h.currentTarget.style.opacity = "0";
50750
+ onMouseLeave: (o) => {
50751
+ o.currentTarget.style.opacity = "0";
50754
50752
  },
50755
50753
  children: [
50756
50754
  /* @__PURE__ */ m.jsx(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "candleview",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "A data visualization charts and draw graph engine for the financial industry.",
5
5
  "keywords": [
6
6
  "Finance",