@tradecanvas/chart 2.5.0 → 2.7.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.
- package/README.md +2 -2
- package/dist/Chart.d.ts +6 -0
- package/dist/Chart.d.ts.map +1 -1
- package/dist/{LayoutSession-CE8S2GCG.js → LayoutSession-CO51QKwZ.js} +10 -3
- package/dist/LayoutSession-CO51QKwZ.js.map +1 -0
- package/dist/LayoutSession-DIPjmNVe.cjs +2 -0
- package/dist/LayoutSession-DIPjmNVe.cjs.map +1 -0
- package/dist/{WidgetCommandPalette-B1jLC9oE.js → WidgetCommandPalette-CSIKnTca.js} +2 -2
- package/dist/{WidgetCommandPalette-B1jLC9oE.js.map → WidgetCommandPalette-CSIKnTca.js.map} +1 -1
- package/dist/{WidgetCommandPalette-Cx-UQ9ft.cjs → WidgetCommandPalette-CZ3GhE1O.cjs} +2 -2
- package/dist/{WidgetCommandPalette-Cx-UQ9ft.cjs.map → WidgetCommandPalette-CZ3GhE1O.cjs.map} +1 -1
- package/dist/{WidgetDrawingSettings-ezbzlGqD.js → WidgetDrawingSettings-Cc8PeqEZ.js} +2 -2
- package/dist/{WidgetDrawingSettings-ezbzlGqD.js.map → WidgetDrawingSettings-Cc8PeqEZ.js.map} +1 -1
- package/dist/{WidgetDrawingSettings-BjPR5Wyq.cjs → WidgetDrawingSettings-DutEdVyV.cjs} +2 -2
- package/dist/{WidgetDrawingSettings-BjPR5Wyq.cjs.map → WidgetDrawingSettings-DutEdVyV.cjs.map} +1 -1
- package/dist/{WidgetGoToDate-DJyCaP4H.js → WidgetGoToDate-DnQxxvf1.js} +2 -2
- package/dist/{WidgetGoToDate-DJyCaP4H.js.map → WidgetGoToDate-DnQxxvf1.js.map} +1 -1
- package/dist/{WidgetGoToDate-Vfaztduf.cjs → WidgetGoToDate-hNVxz-Zb.cjs} +2 -2
- package/dist/{WidgetGoToDate-Vfaztduf.cjs.map → WidgetGoToDate-hNVxz-Zb.cjs.map} +1 -1
- package/dist/{WidgetIndicatorPicker-Cw7pFl_l.js → WidgetIndicatorPicker-DNjcuBp6.js} +3 -3
- package/dist/{WidgetIndicatorPicker-Cw7pFl_l.js.map → WidgetIndicatorPicker-DNjcuBp6.js.map} +1 -1
- package/dist/{WidgetIndicatorPicker-Nc-1Rbm_.cjs → WidgetIndicatorPicker-GCesxFMn.cjs} +2 -2
- package/dist/{WidgetIndicatorPicker-Nc-1Rbm_.cjs.map → WidgetIndicatorPicker-GCesxFMn.cjs.map} +1 -1
- package/dist/{WidgetIndicatorSettings-Da_T6bmX.cjs → WidgetIndicatorSettings-CBHWj5z5.cjs} +2 -2
- package/dist/{WidgetIndicatorSettings-Da_T6bmX.cjs.map → WidgetIndicatorSettings-CBHWj5z5.cjs.map} +1 -1
- package/dist/{WidgetIndicatorSettings-DR8Z9RfF.js → WidgetIndicatorSettings-XhHlqyvn.js} +3 -3
- package/dist/{WidgetIndicatorSettings-DR8Z9RfF.js.map → WidgetIndicatorSettings-XhHlqyvn.js.map} +1 -1
- package/dist/{WidgetSettings-DCGCymVY.js → WidgetSettings-B1ay0W6I.js} +3 -3
- package/dist/{WidgetSettings-DCGCymVY.js.map → WidgetSettings-B1ay0W6I.js.map} +1 -1
- package/dist/{WidgetSettings-COljE3G_.cjs → WidgetSettings-CBf6hUSV.cjs} +2 -2
- package/dist/{WidgetSettings-COljE3G_.cjs.map → WidgetSettings-CBf6hUSV.cjs.map} +1 -1
- package/dist/{WidgetSymbolSearch-B8iDwVy8.js → WidgetSymbolSearch-BlQWH3Md.js} +3 -3
- package/dist/{WidgetSymbolSearch-B8iDwVy8.js.map → WidgetSymbolSearch-BlQWH3Md.js.map} +1 -1
- package/dist/{WidgetSymbolSearch-DVIRTJuT.cjs → WidgetSymbolSearch-CxeLjy63.cjs} +2 -2
- package/dist/{WidgetSymbolSearch-DVIRTJuT.cjs.map → WidgetSymbolSearch-CxeLjy63.cjs.map} +1 -1
- package/dist/i18n-BFGknfTa.cjs +2 -0
- package/dist/i18n-BFGknfTa.cjs.map +1 -0
- package/dist/{i18n-DWLKoOBG.js → i18n-BZdkj80c.js} +7 -1
- package/dist/i18n-BZdkj80c.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{indicatorInputWords-VWMPRfzM.js → indicatorInputWords-B8lf8reQ.js} +2 -2
- package/dist/{indicatorInputWords-VWMPRfzM.js.map → indicatorInputWords-B8lf8reQ.js.map} +1 -1
- package/dist/{indicatorInputWords-C4Mefhve.cjs → indicatorInputWords-_kxwKob4.cjs} +2 -2
- package/dist/{indicatorInputWords-C4Mefhve.cjs.map → indicatorInputWords-_kxwKob4.cjs.map} +1 -1
- package/dist/widget/ChartWidget.d.ts.map +1 -1
- package/dist/widget/WidgetDrawingEdit.d.ts +13 -0
- package/dist/widget/WidgetDrawingEdit.d.ts.map +1 -1
- package/dist/widget/WidgetMenus.d.ts +2 -0
- package/dist/widget/WidgetMenus.d.ts.map +1 -1
- package/dist/widget/WidgetObjectTree.d.ts.map +1 -1
- package/dist/widget/WidgetSelectionToolbar.d.ts +4 -0
- package/dist/widget/WidgetSelectionToolbar.d.ts.map +1 -1
- package/dist/widget/drawingMenu.d.ts +3 -1
- package/dist/widget/drawingMenu.d.ts.map +1 -1
- package/dist/widget/index.cjs +4 -3
- package/dist/widget/index.cjs.map +1 -1
- package/dist/widget/index.js +179 -118
- package/dist/widget/index.js.map +1 -1
- package/dist/widget/locales/ar.d.ts.map +1 -1
- package/dist/widget/locales/cs.d.ts.map +1 -1
- package/dist/widget/locales/da.d.ts.map +1 -1
- package/dist/widget/locales/de.d.ts.map +1 -1
- package/dist/widget/locales/el.d.ts.map +1 -1
- package/dist/widget/locales/en.d.ts +3 -0
- package/dist/widget/locales/en.d.ts.map +1 -1
- package/dist/widget/locales/es.d.ts.map +1 -1
- package/dist/widget/locales/et.d.ts.map +1 -1
- package/dist/widget/locales/fa.d.ts.map +1 -1
- package/dist/widget/locales/fr.d.ts.map +1 -1
- package/dist/widget/locales/he.d.ts.map +1 -1
- package/dist/widget/locales/hu.d.ts.map +1 -1
- package/dist/widget/locales/id.d.ts.map +1 -1
- package/dist/widget/locales/index.cjs +1 -1
- package/dist/widget/locales/index.cjs.map +1 -1
- package/dist/widget/locales/index.js +85 -1
- package/dist/widget/locales/index.js.map +1 -1
- package/dist/widget/locales/it.d.ts.map +1 -1
- package/dist/widget/locales/ja.d.ts.map +1 -1
- package/dist/widget/locales/ko.d.ts.map +1 -1
- package/dist/widget/locales/ms.d.ts.map +1 -1
- package/dist/widget/locales/nb.d.ts.map +1 -1
- package/dist/widget/locales/nl.d.ts.map +1 -1
- package/dist/widget/locales/pl.d.ts.map +1 -1
- package/dist/widget/locales/pt.d.ts.map +1 -1
- package/dist/widget/locales/ro.d.ts.map +1 -1
- package/dist/widget/locales/ru.d.ts.map +1 -1
- package/dist/widget/locales/sk.d.ts.map +1 -1
- package/dist/widget/locales/sv.d.ts.map +1 -1
- package/dist/widget/locales/th.d.ts.map +1 -1
- package/dist/widget/locales/tr.d.ts.map +1 -1
- package/dist/widget/locales/vi.d.ts.map +1 -1
- package/dist/widget/locales/zh.d.ts.map +1 -1
- package/dist/widget/locales/zhHant.d.ts.map +1 -1
- package/dist/widget/widgetConfig.d.ts.map +1 -1
- package/dist/widget/widgetFeatures.d.ts.map +1 -1
- package/dist/{widgetFeatures-B-el8UA3.cjs → widgetFeatures-DpBWfQ8D.cjs} +2 -2
- package/dist/widgetFeatures-DpBWfQ8D.cjs.map +1 -0
- package/dist/{widgetFeatures-DsbSG6Pq.js → widgetFeatures-sU-9JOSB.js} +2 -1
- package/dist/widgetFeatures-sU-9JOSB.js.map +1 -0
- package/dist/widgetLocales-BdRQu8wS.cjs +2 -0
- package/dist/widgetLocales-BdRQu8wS.cjs.map +1 -0
- package/dist/{widgetLocales-BX7VRdl5.js → widgetLocales-Bgm5-BB5.js} +13 -1
- package/dist/widgetLocales-Bgm5-BB5.js.map +1 -0
- package/package.json +3 -3
- package/dist/LayoutSession-C9bQsnH2.cjs +0 -2
- package/dist/LayoutSession-C9bQsnH2.cjs.map +0 -1
- package/dist/LayoutSession-CE8S2GCG.js.map +0 -1
- package/dist/i18n-DWLKoOBG.js.map +0 -1
- package/dist/i18n-fgAwciRT.cjs +0 -2
- package/dist/i18n-fgAwciRT.cjs.map +0 -1
- package/dist/widgetFeatures-B-el8UA3.cjs.map +0 -1
- package/dist/widgetFeatures-DsbSG6Pq.js.map +0 -1
- package/dist/widgetLocales-BX7VRdl5.js.map +0 -1
- package/dist/widgetLocales-C_XTkni5.cjs +0 -2
- package/dist/widgetLocales-C_XTkni5.cjs.map +0 -1
package/dist/widget/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { _ as e, a as t, c as n, d as r, f as i, h as a, i as o, l as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m, v as ee } from "../LayoutSession-
|
|
2
|
-
import { _ as h, b as g, g as te, h as _, l as v, m as ne, n as re, t as ie, v as ae, y as oe } from "../widgetLocales-
|
|
1
|
+
import { _ as e, a as t, c as n, d as r, f as i, h as a, i as o, l as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m, v as ee } from "../LayoutSession-CO51QKwZ.js";
|
|
2
|
+
import { _ as h, b as g, g as te, h as _, l as v, m as ne, n as re, t as ie, v as ae, y as oe } from "../widgetLocales-Bgm5-BB5.js";
|
|
3
3
|
import { t as se } from "../monthView-N8yDaTqZ.js";
|
|
4
|
-
import { a as ce, c as le, d as ue, f as de, i as fe, l as pe, n as me, o as y, r as he, s as ge, t as _e, u as ve } from "../widgetFeatures-
|
|
4
|
+
import { a as ce, c as le, d as ue, f as de, i as fe, l as pe, n as me, o as y, r as he, s as ge, t as _e, u as ve } from "../widgetFeatures-sU-9JOSB.js";
|
|
5
5
|
import { a as b, c as ye, i as x, l as be, n as xe, o as Se, r as Ce, s as we } from "../focusTrap-Br9Zfje0.js";
|
|
6
6
|
import { a as Te, d as S, i as Ee, l as De, n as Oe, o as ke, r as Ae, s as je, t as Me, u as Ne } from "../symbolCatalog-B_9kDAjE.js";
|
|
7
7
|
import { a as Pe, c as Fe, f as C, u as Ie } from "../settingsControls-DIjzCFHI.js";
|
|
8
|
-
import { a as Le, c as Re, i as ze, n as Be, o as Ve, r as w, s as He, t as T } from "../i18n-
|
|
9
|
-
import { r as Ue } from "../indicatorInputWords-
|
|
8
|
+
import { a as Le, c as Re, i as ze, n as Be, o as Ve, r as w, s as He, t as T } from "../i18n-BZdkj80c.js";
|
|
9
|
+
import { r as Ue } from "../indicatorInputWords-B8lf8reQ.js";
|
|
10
10
|
import { t as We } from "../platformKeys-Dd1qOCjF.js";
|
|
11
11
|
import { CHART_SPACING as Ge, CHART_STYLE_KEYS as Ke, DARK_THEME as qe, FIGURES_FONT_FAMILY as Je, LIGHT_THEME as Ye, MAX_PRICE_DECIMALS as Xe, PHI as Ze, SANS_FONT_FAMILY as Qe, barTimeUnit as E, evenPx as $e, formatPrice as et, formatVolumeLoc as tt, indicatorSource as nt, isTimeFrame as rt, isValidTimeZone as it, marketStatus as at, offsetAt as ot, ownFillColor as st, parseIndicatorSource as ct, phiStep as lt, readChartStyleOverrides as ut, readChartTypeOptions as dt, readIndicatorPlotStyles as ft, readNews as pt, readQuote as mt, resampleBars as ht, sanitizeDrawingStyle as gt, smallValueDecimals as _t, stepDecimals as vt, symbolTimeZone as yt, tickBarCount as D, tickerOf as O, timeParts as bt, timeframeFollowsDays as xt, timeframeToMs as k, tzLabel as St, wallToUtc as Ct, zoneOffsetMinutes as wt, zonedDateFormatter as Tt } from "@tradecanvas/commons";
|
|
12
12
|
import { ChartStateManager as Et, MARK_ROW_HEIGHT as Dt, MAX_ALERT_BARS as Ot, MIN_ALERT_BARS as kt, RANGE_PRESETS as At, ResamplingAdapter as jt, SYMBOL_INDICATOR_IDS as Mt, adapterFromFeed as Nt, indicatorCategory as Pt, indicatorValuePrecision as Ft, isCrosshairCursor as It, plotColor as Lt, plotShown as Rt, rangePresetStart as zt, servesTimeframe as Bt, sourceParam as Vt, withResampling as A } from "@tradecanvas/core";
|
|
@@ -4365,6 +4365,9 @@ var ka = class {
|
|
|
4365
4365
|
arrow: "Arrow",
|
|
4366
4366
|
parallelChannel: "Parallel Channel",
|
|
4367
4367
|
regressionChannel: "Regression Channel",
|
|
4368
|
+
disjointChannel: "Disjoint Channel",
|
|
4369
|
+
flatTopBottom: "Flat Top/Bottom",
|
|
4370
|
+
rotatedRectangle: "Rotated Rectangle",
|
|
4368
4371
|
pitchfork: "Pitchfork",
|
|
4369
4372
|
fibRetracement: "Fib Retracement",
|
|
4370
4373
|
fibExtension: "Fib Extension",
|
|
@@ -4875,6 +4878,7 @@ var Do = class {
|
|
|
4875
4878
|
e.canAlert,
|
|
4876
4879
|
e.canFill === !0,
|
|
4877
4880
|
e.canText === !0,
|
|
4881
|
+
e.canType === !0,
|
|
4878
4882
|
t.fillColor,
|
|
4879
4883
|
t.textColor
|
|
4880
4884
|
].join("|");
|
|
@@ -4898,6 +4902,7 @@ var Do = class {
|
|
|
4898
4902
|
c("lineStyle", t("drawingSettings.lineStyle"), Oo(i)),
|
|
4899
4903
|
e.canFill ? c("fill", t("drawingSettings.fill"), `<span class="tcw-sel-color tcw-sel-fill" style="background:${S(wo(st(e.style) ?? n))}"></span>`) : "",
|
|
4900
4904
|
e.canText ? c("textColor", t("drawingSettings.textColor"), `<span class="tcw-sel-text" style="--c:${S(wo(e.style.textColor ?? n))}">T</span>`) : "",
|
|
4905
|
+
e.canType ? s("text", t("drawingSettings.text"), x("textEdit", 15)) : "",
|
|
4901
4906
|
"<span class=\"tcw-sel-sep\" aria-hidden=\"true\"></span>",
|
|
4902
4907
|
e.canSettings ? s("settings", t("legend.settings"), x("settings", 15)) : "",
|
|
4903
4908
|
e.canAlert ? s("alert", t("drawingSettings.addAlert"), x("bell", 15)) : "",
|
|
@@ -4938,6 +4943,7 @@ var Do = class {
|
|
|
4938
4943
|
return;
|
|
4939
4944
|
}
|
|
4940
4945
|
if (this.closePop(), n === "settings") this.callbacks.onSettings();
|
|
4946
|
+
else if (n === "text") this.callbacks.onText();
|
|
4941
4947
|
else if (n === "alert") this.callbacks.onAlert();
|
|
4942
4948
|
else if (n === "lock") this.callbacks.onLock(!this.target?.locked);
|
|
4943
4949
|
else if (n === "delete") this.callbacks.onDelete();
|
|
@@ -6384,14 +6390,14 @@ var Ys = class {
|
|
|
6384
6390
|
this.gone = !0, this.part && this.dispose(this.part), this.part = null;
|
|
6385
6391
|
}
|
|
6386
6392
|
}, Y = {
|
|
6387
|
-
settings: J(() => import("../WidgetSettings-
|
|
6388
|
-
indicatorSettings: J(() => import("../WidgetIndicatorSettings-
|
|
6389
|
-
drawingSettings: J(() => import("../WidgetDrawingSettings-
|
|
6390
|
-
goToDate: J(() => import("../WidgetGoToDate-
|
|
6393
|
+
settings: J(() => import("../WidgetSettings-B1ay0W6I.js")),
|
|
6394
|
+
indicatorSettings: J(() => import("../WidgetIndicatorSettings-XhHlqyvn.js")),
|
|
6395
|
+
drawingSettings: J(() => import("../WidgetDrawingSettings-Cc8PeqEZ.js")),
|
|
6396
|
+
goToDate: J(() => import("../WidgetGoToDate-DnQxxvf1.js")),
|
|
6391
6397
|
hotkeySheet: J(() => import("../WidgetHotkeySheet-1lRFSdvt.js")),
|
|
6392
|
-
indicatorPicker: J(() => import("../WidgetIndicatorPicker-
|
|
6393
|
-
commandPalette: J(() => import("../WidgetCommandPalette-
|
|
6394
|
-
symbolSearch: J(() => import("../WidgetSymbolSearch-
|
|
6398
|
+
indicatorPicker: J(() => import("../WidgetIndicatorPicker-DNjcuBp6.js")),
|
|
6399
|
+
commandPalette: J(() => import("../WidgetCommandPalette-CSIKnTca.js")),
|
|
6400
|
+
symbolSearch: J(() => import("../WidgetSymbolSearch-BlQWH3Md.js"))
|
|
6395
6401
|
};
|
|
6396
6402
|
async function Xs() {
|
|
6397
6403
|
await Promise.all(Object.values(Y).map((e) => e.load().catch(() => null)));
|
|
@@ -8045,6 +8051,10 @@ function ll(e, t) {
|
|
|
8045
8051
|
id: "settings",
|
|
8046
8052
|
label: t("drawingMenu.settings"),
|
|
8047
8053
|
icon: "settings"
|
|
8054
|
+
}), e.canText && r && o.push({
|
|
8055
|
+
id: "text",
|
|
8056
|
+
label: t("drawingSettings.text"),
|
|
8057
|
+
icon: "textEdit"
|
|
8048
8058
|
}), e.canAlert && r && o.push({
|
|
8049
8059
|
id: "alert",
|
|
8050
8060
|
label: t("drawingSettings.addAlert"),
|
|
@@ -8118,7 +8128,8 @@ var ul = class {
|
|
|
8118
8128
|
let a = ce(ll({
|
|
8119
8129
|
selected: i,
|
|
8120
8130
|
canConfigure: !0,
|
|
8121
|
-
canAlert: this.host.chart.canAddDrawingAlert(e)
|
|
8131
|
+
canAlert: this.host.chart.canAddDrawingAlert(e),
|
|
8132
|
+
canText: this.host.canTypeDrawingText(e)
|
|
8122
8133
|
}, this.host.t), me, this.host.featureState), o = i.map((e) => e.id), s = r.get(e), c = s ? this.host.options.drawingMenuItems?.({
|
|
8123
8134
|
id: e,
|
|
8124
8135
|
type: s.type,
|
|
@@ -8135,6 +8146,9 @@ var ul = class {
|
|
|
8135
8146
|
case "settings":
|
|
8136
8147
|
this.host.openDrawingSettings(e);
|
|
8137
8148
|
return;
|
|
8149
|
+
case "text":
|
|
8150
|
+
this.host.editDrawingText(e);
|
|
8151
|
+
return;
|
|
8138
8152
|
case "alert":
|
|
8139
8153
|
this.host.alerting.addDrawingAlert(e);
|
|
8140
8154
|
return;
|
|
@@ -9732,8 +9746,8 @@ var Zl = class {
|
|
|
9732
9746
|
restoreSettings(e, t = null, n) {
|
|
9733
9747
|
n !== void 0 && (this.host.comparing.compareScaleHeld = n && this.host.comparing.compares.length > 0), this.applySettings(e), t && t.theme === (this.host.chart.getTheme()?.name ?? "") && this.host.chart.applyOverrides(t.overrides, { layer: "user" }), this.host.settings?.refresh(this.shownSettings());
|
|
9734
9748
|
}
|
|
9735
|
-
}, eu = 13;
|
|
9736
|
-
function
|
|
9749
|
+
}, eu = 13, tu = 8, nu = 6, ru = 1.3, iu = 120, au = 2, ou = 8, su = 20;
|
|
9750
|
+
function cu(e) {
|
|
9737
9751
|
let t = e.filter((e) => e !== null);
|
|
9738
9752
|
if (t.length === 0) return null;
|
|
9739
9753
|
let n = Math.min(...t.map((e) => e.x)), r = Math.min(...t.map((e) => e.y)), i = Math.max(...t.map((e) => e.x + e.width)), a = Math.max(...t.map((e) => e.y + e.height));
|
|
@@ -9744,7 +9758,7 @@ function tu(e) {
|
|
|
9744
9758
|
height: a - r
|
|
9745
9759
|
};
|
|
9746
9760
|
}
|
|
9747
|
-
var
|
|
9761
|
+
var lu = class {
|
|
9748
9762
|
constructor(e) {
|
|
9749
9763
|
this.host = e;
|
|
9750
9764
|
}
|
|
@@ -9775,7 +9789,7 @@ var nu = class {
|
|
|
9775
9789
|
e.hide();
|
|
9776
9790
|
return;
|
|
9777
9791
|
}
|
|
9778
|
-
let i = this.host.chartOffset(), a = r[0], o = (a.paneId === void 0 ? void 0 : this.host.chart.getIndicatorPanes().find((e) => e.instanceId === a.paneId)?.rect) ?? this.host.chart.getPlotRect(), s = this.host.chart.getPlotRect(), c =
|
|
9792
|
+
let i = this.host.chartOffset(), a = r[0], o = (a.paneId === void 0 ? void 0 : this.host.chart.getIndicatorPanes().find((e) => e.instanceId === a.paneId)?.rect) ?? this.host.chart.getPlotRect(), s = this.host.chart.getPlotRect(), c = cu(r.flatMap((e) => [this.host.chart.getDrawingRect(e.id), this.host.chart.getDrawingTextRect?.(e.id) ?? null])) ?? {
|
|
9779
9793
|
x: o.x + o.width / 2,
|
|
9780
9794
|
y: o.y,
|
|
9781
9795
|
width: 0,
|
|
@@ -9800,44 +9814,85 @@ var nu = class {
|
|
|
9800
9814
|
canSettings: this.host.featureState.drawingSettings && r.length === 1,
|
|
9801
9815
|
canAlert: this.host.featureState.alerts && r.length === 1 && this.host.chart.canAddDrawingAlert(a.id),
|
|
9802
9816
|
canFill: this.host.chart.getDrawingToolDescriptor(a.type)?.fill === !0,
|
|
9803
|
-
canText: this.host.chart.getDrawingToolDescriptor(a.type)?.text === !0
|
|
9817
|
+
canText: this.host.chart.getDrawingToolDescriptor(a.type)?.text === !0,
|
|
9818
|
+
canType: r.length === 1 && this.canTypeText(a.id)
|
|
9804
9819
|
});
|
|
9805
9820
|
}
|
|
9821
|
+
canTypeText(e) {
|
|
9822
|
+
let t = this.host.chart.getDrawings().find((t) => t.id === e);
|
|
9823
|
+
return t !== void 0 && !t.locked && (K[t.type] !== void 0 || ko.has(t.type));
|
|
9824
|
+
}
|
|
9825
|
+
isOnDrawingText(e, t, n) {
|
|
9826
|
+
let r = this.host.chart.getDrawingTextRect(e);
|
|
9827
|
+
return r != null && t >= r.x - ou && t <= r.x + r.width + ou && n >= r.y - ou && n <= r.y + r.height + ou;
|
|
9828
|
+
}
|
|
9829
|
+
editDrawingText(e) {
|
|
9830
|
+
this.canTypeText(e) && (this.editTextInPlace(e, !1) || this.openDrawingSettings(e, { tab: "text" }));
|
|
9831
|
+
}
|
|
9832
|
+
placedTextRect(e, t, n) {
|
|
9833
|
+
let r = this.host.chart.getDrawingTextRect(e);
|
|
9834
|
+
if (r) {
|
|
9835
|
+
let t = (this.host.chart.getDrawings().find((t) => t.id === e)?.style.text ?? "").trim(), i = Math.min(su, t.split("\n").length) * n, a = r.height > i + au, o = a ? Math.hypot(r.width, r.height) : r.width, s = a ? i : r.height;
|
|
9836
|
+
return {
|
|
9837
|
+
x: r.x + (r.width - o) / 2 - tu,
|
|
9838
|
+
y: r.y + (r.height - s) / 2 - nu,
|
|
9839
|
+
width: o + tu * 2,
|
|
9840
|
+
height: s + nu * 2
|
|
9841
|
+
};
|
|
9842
|
+
}
|
|
9843
|
+
let i = this.host.chart.getDrawingRect(e);
|
|
9844
|
+
if (!i) return null;
|
|
9845
|
+
let a = n + nu * 2;
|
|
9846
|
+
return {
|
|
9847
|
+
x: i.x + (i.width - iu) / 2,
|
|
9848
|
+
y: t === "rectangle" ? i.y : i.y + i.height / 2 - a,
|
|
9849
|
+
width: iu,
|
|
9850
|
+
height: a
|
|
9851
|
+
};
|
|
9852
|
+
}
|
|
9806
9853
|
editTextInPlace(e, t) {
|
|
9807
9854
|
if (e === this.inlineTextId && this.inlineText?.isOpen()) return !0;
|
|
9808
|
-
let n = this.host.chart.getDrawings().find((t) => t.id === e), r = this.inlineText;
|
|
9809
|
-
if (!n || !r || n.locked || !t && !this.host.chart.beginDrawingEdit(e)) return !1;
|
|
9810
|
-
let
|
|
9855
|
+
let n = this.host.chart.getDrawings().find((t) => t.id === e), r = this.inlineText, i = n ? K[n.type] : void 0, a = n !== void 0 && !i && ko.has(n.type);
|
|
9856
|
+
if (!n || !r || n.locked || !i && !a || !t && !this.host.chart.beginDrawingEdit(e)) return !1;
|
|
9857
|
+
let o = n.style, s = (a ? this.host.chart.getDrawingTextSize(e) : null) || o.fontSize || i?.fontSize || eu, c = o.text ?? "", l = (n) => {
|
|
9811
9858
|
this.inlineTextId = null, t ? n || this.host.chart.takeBackDrawing(e) : this.host.chart.endDrawingEdit(e, { cancel: !n }), this.host.docking.refreshObjects();
|
|
9812
9859
|
};
|
|
9813
9860
|
return r.open({
|
|
9814
9861
|
rect: () => {
|
|
9815
|
-
let t = this.host.chart.getDrawingTextRect(e);
|
|
9862
|
+
let t = a ? this.placedTextRect(e, n.type, s * ru) : this.host.chart.getDrawingTextRect(e);
|
|
9816
9863
|
if (!t) return null;
|
|
9817
|
-
let
|
|
9864
|
+
let r = this.host.chartContainer.getBoundingClientRect();
|
|
9818
9865
|
return {
|
|
9819
|
-
x:
|
|
9820
|
-
y:
|
|
9866
|
+
x: r.left + t.x,
|
|
9867
|
+
y: r.top + t.y,
|
|
9821
9868
|
width: t.width,
|
|
9822
9869
|
height: t.height
|
|
9823
9870
|
};
|
|
9824
9871
|
},
|
|
9825
|
-
text:
|
|
9872
|
+
text: c,
|
|
9826
9873
|
font: {
|
|
9827
|
-
size:
|
|
9828
|
-
bold:
|
|
9829
|
-
italic:
|
|
9874
|
+
size: s,
|
|
9875
|
+
bold: o.bold === !0,
|
|
9876
|
+
italic: o.italic === !0,
|
|
9830
9877
|
family: this.host.chart.getFont?.()?.family ?? this.host.ui.font.family
|
|
9831
9878
|
},
|
|
9832
|
-
color:
|
|
9879
|
+
color: o.textColor ?? Ao[n.type] ?? o.color,
|
|
9833
9880
|
label: this.host.t("drawingSettings.text"),
|
|
9834
|
-
placeholder: this.host.drawingToolName(n.type),
|
|
9881
|
+
placeholder: a ? this.host.t("drawingSettings.text") : this.host.drawingToolName(n.type),
|
|
9835
9882
|
onInput: (n) => t ? this.host.chart.amendNewDrawing(e, { style: { text: n } }) : this.host.chart.updateDrawing(e, { style: { text: n } }),
|
|
9836
9883
|
onCommit: (n) => {
|
|
9837
9884
|
let r = n.replace(/\s+$/, "");
|
|
9838
|
-
|
|
9885
|
+
if (a) {
|
|
9886
|
+
if (r === c) {
|
|
9887
|
+
l(!1);
|
|
9888
|
+
return;
|
|
9889
|
+
}
|
|
9890
|
+
r !== n && this.host.chart.updateDrawing(e, { style: { text: r } }), l(!0);
|
|
9891
|
+
return;
|
|
9892
|
+
}
|
|
9893
|
+
r && r !== n && (t ? this.host.chart.amendNewDrawing(e, { style: { text: r } }) : this.host.chart.updateDrawing(e, { style: { text: r } })), l(r.length > 0);
|
|
9839
9894
|
},
|
|
9840
|
-
onCancel: () =>
|
|
9895
|
+
onCancel: () => l(!1),
|
|
9841
9896
|
returnFocus: () => this.host.chartContainer.querySelector("[tabindex]") ?? this.host.chartContainer
|
|
9842
9897
|
}) ? (this.inlineTextId = e, this.inlineTextNew = t, !0) : (t || this.host.chart.endDrawingEdit(e, { cancel: !0 }), !1);
|
|
9843
9898
|
}
|
|
@@ -9876,7 +9931,7 @@ var nu = class {
|
|
|
9876
9931
|
}
|
|
9877
9932
|
});
|
|
9878
9933
|
}
|
|
9879
|
-
},
|
|
9934
|
+
}, uu = 200, du = class {
|
|
9880
9935
|
constructor(e) {
|
|
9881
9936
|
this.host = e;
|
|
9882
9937
|
}
|
|
@@ -9905,7 +9960,7 @@ var nu = class {
|
|
|
9905
9960
|
for (; o > 0 && n[o - 1].time * r >= a;) o--;
|
|
9906
9961
|
let s = this.host.displayTimezone();
|
|
9907
9962
|
return kn({
|
|
9908
|
-
dayShare: n.slice(-
|
|
9963
|
+
dayShare: n.slice(-uu).some((e) => {
|
|
9909
9964
|
let t = e.time * r, n = new Date(t + ot(s, t) * 6e4).getUTCDay();
|
|
9910
9965
|
return n === 0 || n === 6;
|
|
9911
9966
|
}) ? 1 : 5 / 7,
|
|
@@ -9950,7 +10005,7 @@ var nu = class {
|
|
|
9950
10005
|
handleToggleTimeframeFavorite(e) {
|
|
9951
10006
|
this.host.timeframeFavorites.toggle(e), this.host.toolbar?.setTimeframeFavorites(this.pinnedTimeframes()), this.host.updateUI();
|
|
9952
10007
|
}
|
|
9953
|
-
},
|
|
10008
|
+
}, fu = 600, pu = 24, mu = [
|
|
9954
10009
|
"--tcw-toolbar-h",
|
|
9955
10010
|
"--tcw-control-h",
|
|
9956
10011
|
"--tcw-control-h-sm",
|
|
@@ -9968,33 +10023,33 @@ var nu = class {
|
|
|
9968
10023
|
"--tcw-line-height",
|
|
9969
10024
|
"--tcw-line-xs",
|
|
9970
10025
|
"--tcw-label-size"
|
|
9971
|
-
],
|
|
9972
|
-
function
|
|
10026
|
+
], hu = 48, gu = 5e4, _u = 100;
|
|
10027
|
+
function vu() {
|
|
9973
10028
|
return new Promise((e) => {
|
|
9974
10029
|
if (typeof requestAnimationFrame != "function" || document.hidden) {
|
|
9975
10030
|
setTimeout(e, 0);
|
|
9976
10031
|
return;
|
|
9977
10032
|
}
|
|
9978
|
-
let t = setTimeout(e,
|
|
10033
|
+
let t = setTimeout(e, _u);
|
|
9979
10034
|
requestAnimationFrame(() => setTimeout(() => {
|
|
9980
10035
|
clearTimeout(t), e();
|
|
9981
10036
|
}, 0));
|
|
9982
10037
|
});
|
|
9983
10038
|
}
|
|
9984
|
-
var
|
|
9985
|
-
function
|
|
10039
|
+
var yu = 864e5, bu = 5e3, xu = 2e3, Su = 48, Cu = "rgba(255,255,255,0.03)", wu = "rgba(0,0,0,0.03)", Tu = 2;
|
|
10040
|
+
function Eu(e) {
|
|
9986
10041
|
if (e.ctrlKey || e.metaKey || e.altKey || e.isComposing || e.keyCode === 229 || e.getModifierState?.("AltGraph")) return null;
|
|
9987
10042
|
if (/^[a-z]$/i.test(e.key)) return e.key;
|
|
9988
10043
|
let t = /^Key([A-Z])$/.exec(e.code ?? "");
|
|
9989
10044
|
return t && [...e.key].length === 1 && !/[\s\d]/.test(e.key) ? t[1].toLowerCase() : null;
|
|
9990
10045
|
}
|
|
9991
|
-
var
|
|
10046
|
+
var Du = 1e3, Ou = [
|
|
9992
10047
|
["barCountdown", "barCountdown"],
|
|
9993
10048
|
["logScale", "logScale"],
|
|
9994
10049
|
["legendVisible", "legend"],
|
|
9995
10050
|
["volumeVisible", "volume"]
|
|
9996
|
-
],
|
|
9997
|
-
function
|
|
10051
|
+
], ku = v.filter((e) => Ke[e] !== "color");
|
|
10052
|
+
function Au(e) {
|
|
9998
10053
|
if (!e.feed) return e;
|
|
9999
10054
|
if (e.adapter) throw TypeError("A widget takes an adapter or a feed, not both");
|
|
10000
10055
|
return {
|
|
@@ -10003,9 +10058,9 @@ function Cu(e) {
|
|
|
10003
10058
|
feed: void 0
|
|
10004
10059
|
};
|
|
10005
10060
|
}
|
|
10006
|
-
var
|
|
10007
|
-
intervals = new
|
|
10008
|
-
drawingEdit = new
|
|
10061
|
+
var ju = class {
|
|
10062
|
+
intervals = new du(this.intervalsHost());
|
|
10063
|
+
drawingEdit = new lu(this.drawingEditHost());
|
|
10009
10064
|
chartSettings = new $l(this.chartSettingsHost());
|
|
10010
10065
|
docking = new Wl(this.dockingHost());
|
|
10011
10066
|
layouts = new Vl(this.layoutsHost());
|
|
@@ -10138,7 +10193,7 @@ var wu = class {
|
|
|
10138
10193
|
priceAxisAddDefault = !1;
|
|
10139
10194
|
marksDefault = !0;
|
|
10140
10195
|
constructor(e, t = {}) {
|
|
10141
|
-
let n =
|
|
10196
|
+
let n = Au(t);
|
|
10142
10197
|
this.options = n;
|
|
10143
10198
|
let { isDark: r, resolvedTheme: i, features: a, chartFeatures: o } = this.readOptions(n);
|
|
10144
10199
|
this.buildRoot(e, n, r, i), this.buildToolbar(n, a);
|
|
@@ -10200,7 +10255,7 @@ var wu = class {
|
|
|
10200
10255
|
priceAxisAddButton: this.priceAxisAddDefault && this.featureState["menu.priceAxisAdd"],
|
|
10201
10256
|
marks: o.marks !== !1 && this.featureState.marks
|
|
10202
10257
|
};
|
|
10203
|
-
if (this.marksDefault = o.marks !== !1, this.canExport = o.dataExport !== !1, this.chartSettings.settingsLocked = new Set(
|
|
10258
|
+
if (this.marksDefault = o.marks !== !1, this.canExport = o.dataExport !== !1, this.chartSettings.settingsLocked = new Set(Ou.filter(([, e]) => o[e] === !1).map(([e]) => e)), this.chartSettings.settingsDefaults = {
|
|
10204
10259
|
...this.chartSettings.settingsState,
|
|
10205
10260
|
legendVisible: o.legend !== !1,
|
|
10206
10261
|
volumeVisible: o.volume !== !1,
|
|
@@ -10235,7 +10290,7 @@ var wu = class {
|
|
|
10235
10290
|
}
|
|
10236
10291
|
buildRoot(e, t, n, r) {
|
|
10237
10292
|
ln(), this.root = document.createElement("div"), this.root.className = "tcw-root";
|
|
10238
|
-
let i = t.dir === "ltr" || t.dir === "rtl" ? t.dir :
|
|
10293
|
+
let i = t.dir === "ltr" || t.dir === "rtl" ? t.dir : Bu(t.locale) ? "rtl" : "ltr";
|
|
10239
10294
|
this.root.dir = i, this.portal.dir = i, e.appendChild(this.root), this.tooltip = new mc(this.root), this.portal.className = "tcw-root tcw-portal", this.look = tr({
|
|
10240
10295
|
dark: n,
|
|
10241
10296
|
theme: r
|
|
@@ -10329,8 +10384,8 @@ var wu = class {
|
|
|
10329
10384
|
rail: this.t("dock.rail"),
|
|
10330
10385
|
resize: this.t("dock.resize")
|
|
10331
10386
|
},
|
|
10332
|
-
savedWidth: () =>
|
|
10333
|
-
saveWidth: (e) =>
|
|
10387
|
+
savedWidth: () => Ru(),
|
|
10388
|
+
saveWidth: (e) => zu(e),
|
|
10334
10389
|
railShown: () => this.docking.railShown(),
|
|
10335
10390
|
focusAfterClose: (e) => this.docking.panelFocusTarget(e),
|
|
10336
10391
|
room: () => n.clientWidth
|
|
@@ -10433,7 +10488,7 @@ var wu = class {
|
|
|
10433
10488
|
}
|
|
10434
10489
|
}), this.clockTimer = setInterval(() => {
|
|
10435
10490
|
!Yr() && this.featureState.statusBar && this.featureState["statusBar.clock"] && this.statusBar?.tick();
|
|
10436
|
-
},
|
|
10491
|
+
}, Du), this.chart.on("priceRangeChange", () => this.chartSettings.refreshScaleSwitches()), this.chartSettings.refreshScaleSwitches(), this.goToDatePart = this.lazyPart(Y.goToDate, ({ WidgetGoToDate: e }) => new e(this.overlayHost, () => ({
|
|
10437
10492
|
title: this.t("goTo.title"),
|
|
10438
10493
|
date: this.t("range.date"),
|
|
10439
10494
|
range: this.t("goTo.range"),
|
|
@@ -10593,8 +10648,8 @@ var wu = class {
|
|
|
10593
10648
|
remove: (t, n) => e.remove(t, n)
|
|
10594
10649
|
}
|
|
10595
10650
|
}, this.t)), this.drawingEdit.inlineText = new Vo(this.overlayHost), this.chart.on("drawingDoubleClick", (e) => {
|
|
10596
|
-
let t = e.payload
|
|
10597
|
-
|
|
10651
|
+
let { id: t, x: n, y: r } = e.payload, i = this.chart.getDrawings().find((e) => e.id === t)?.type;
|
|
10652
|
+
i && K[i] && this.drawingEdit.editTextInPlace(t, !1) || i && ko.has(i) && this.drawingEdit.isOnDrawingText(t, n, r) && this.drawingEdit.editTextInPlace(t, !1) || this.drawingEdit.openDrawingSettings(t, i && K[i] ? { tab: "text" } : {});
|
|
10598
10653
|
}), this.chart.on("drawingRemove", (e) => {
|
|
10599
10654
|
let t = e.payload.id;
|
|
10600
10655
|
t === this.drawingEdit.inlineTextId && (this.drawingEdit.inlineText?.close(), this.drawingEdit.inlineTextNew || this.chart.endDrawingEdit(t), this.drawingEdit.inlineTextId = null);
|
|
@@ -10610,7 +10665,7 @@ var wu = class {
|
|
|
10610
10665
|
justDrawn: !0
|
|
10611
10666
|
}));
|
|
10612
10667
|
}, s = () => setTimeout(o, 0);
|
|
10613
|
-
window.addEventListener("pointerup", s), window.addEventListener("pointercancel", s), i = window.setTimeout(o,
|
|
10668
|
+
window.addEventListener("pointerup", s), window.addEventListener("pointercancel", s), i = window.setTimeout(o, fu), this.drawingEdit.cancelTextPrompt = a;
|
|
10614
10669
|
}), this.drawingStyle = new _o(this.root, {
|
|
10615
10670
|
onStyleChange: (e) => {
|
|
10616
10671
|
this.chart.setDrawingStyle(e), this.chart.setSelectedDrawingStyle(e);
|
|
@@ -10637,6 +10692,10 @@ var wu = class {
|
|
|
10637
10692
|
let e = this.chart.getSelectedDrawingIds()[0];
|
|
10638
10693
|
e && this.drawingEdit.openDrawingSettings(e);
|
|
10639
10694
|
},
|
|
10695
|
+
onText: () => {
|
|
10696
|
+
let e = this.chart.getSelectedDrawingIds()[0];
|
|
10697
|
+
e && this.drawingEdit.editDrawingText(e);
|
|
10698
|
+
},
|
|
10640
10699
|
onAlert: () => {
|
|
10641
10700
|
let e = this.chart.getSelectedDrawingIds()[0];
|
|
10642
10701
|
e && this.alerting.addDrawingAlert(e);
|
|
@@ -10890,8 +10949,8 @@ var wu = class {
|
|
|
10890
10949
|
onAction: (e) => this.commands.handleAction(e),
|
|
10891
10950
|
onClose: () => {}
|
|
10892
10951
|
}, this.overlayHost, this.t, {
|
|
10893
|
-
list: () =>
|
|
10894
|
-
add: (e) =>
|
|
10952
|
+
list: () => Fu(),
|
|
10953
|
+
add: (e) => Iu([e, ...Fu().filter((t) => t !== e)])
|
|
10895
10954
|
})), this.boundGlobalKeydown = (e) => {
|
|
10896
10955
|
if (this.handleHostHotkey(e) || this.featureState.hotkeys && this.replay.isOpen() && this.replay.handleReplayKey(e)) return;
|
|
10897
10956
|
let t = L(this.root), n = (e) => this.featureState.hotkeys && this.featureState[e];
|
|
@@ -10912,11 +10971,11 @@ var wu = class {
|
|
|
10912
10971
|
let t = document.activeElement;
|
|
10913
10972
|
if (t && t !== document.body && !this.root.contains(t)) return;
|
|
10914
10973
|
e.preventDefault(), this.intervals.intervalInput.open(e.key);
|
|
10915
|
-
} else if (
|
|
10974
|
+
} else if (Eu(e) !== null) {
|
|
10916
10975
|
if (e.defaultPrevented || !n("symbolTyping") || !this.featureState.symbolSearch || R() || Nr() || !L(this.root, !0)) return;
|
|
10917
10976
|
let t = document.activeElement;
|
|
10918
10977
|
if (t && t !== document.body && !this.root.contains(t)) return;
|
|
10919
|
-
e.preventDefault(), this.openSymbolSearch(
|
|
10978
|
+
e.preventDefault(), this.openSymbolSearch(Eu(e));
|
|
10920
10979
|
} else if (e.altKey && !e.ctrlKey && !e.metaKey && (e.code === "KeyI" || e.code === "KeyG" || e.code === "KeyR")) {
|
|
10921
10980
|
if (R() || !t) return;
|
|
10922
10981
|
if (e.code === "KeyI") {
|
|
@@ -10948,10 +11007,10 @@ var wu = class {
|
|
|
10948
11007
|
this.destroyed || Xs();
|
|
10949
11008
|
}, t = globalThis;
|
|
10950
11009
|
if (t.requestIdleCallback && t.cancelIdleCallback) {
|
|
10951
|
-
let n = t.requestIdleCallback(e, { timeout:
|
|
11010
|
+
let n = t.requestIdleCallback(e, { timeout: bu }), r = t.cancelIdleCallback;
|
|
10952
11011
|
this.stopPreload = () => r(n);
|
|
10953
11012
|
} else {
|
|
10954
|
-
let t = setTimeout(e,
|
|
11013
|
+
let t = setTimeout(e, xu);
|
|
10955
11014
|
this.stopPreload = () => clearTimeout(t);
|
|
10956
11015
|
}
|
|
10957
11016
|
}
|
|
@@ -11113,7 +11172,7 @@ var wu = class {
|
|
|
11113
11172
|
for (let t of [this.root, this.portal]) {
|
|
11114
11173
|
if (Oa(t, e, { variables: this.uiVariables }), this.uiVariables) continue;
|
|
11115
11174
|
let n = Da(e);
|
|
11116
|
-
for (let e of
|
|
11175
|
+
for (let e of mu) this.uiScale === 1 ? t.style.removeProperty(e) : t.style.setProperty(e, n[e]);
|
|
11117
11176
|
}
|
|
11118
11177
|
}
|
|
11119
11178
|
fitScale() {
|
|
@@ -11122,7 +11181,7 @@ var wu = class {
|
|
|
11122
11181
|
if (e !== this.uiScale) {
|
|
11123
11182
|
if (this.ui.scale === "auto") {
|
|
11124
11183
|
let t = this.root.clientWidth;
|
|
11125
|
-
if ((e > this.uiScale ? la(t -
|
|
11184
|
+
if ((e > this.uiScale ? la(t - pu) : la(t + pu)) === this.uiScale) return;
|
|
11126
11185
|
}
|
|
11127
11186
|
this.uiScale = e, this.applyLookTokens(), this.applyLegendFont(), this.applyChartLook(), this.toolbar?.fit();
|
|
11128
11187
|
}
|
|
@@ -11297,13 +11356,13 @@ var wu = class {
|
|
|
11297
11356
|
}
|
|
11298
11357
|
paintWatermark() {
|
|
11299
11358
|
this.chart.setWatermark(De(this.state.symbol).ticker.replace("USDT", " / USDT"), {
|
|
11300
|
-
fontSize:
|
|
11301
|
-
color: this.state.isDark ?
|
|
11359
|
+
fontSize: Su,
|
|
11360
|
+
color: this.state.isDark ? Cu : wu
|
|
11302
11361
|
});
|
|
11303
11362
|
}
|
|
11304
11363
|
keepingLook(e) {
|
|
11305
11364
|
this.chartSettings.settingsEdit && this.settings?.close();
|
|
11306
|
-
let t = this.chart.getOverrides?.({ layer: "user" }) ?? {}, n = Object.fromEntries(
|
|
11365
|
+
let t = this.chart.getOverrides?.({ layer: "user" }) ?? {}, n = Object.fromEntries(ku.filter((e) => t[e] !== void 0).map((e) => [e, t[e]]));
|
|
11307
11366
|
e(), Object.keys(n).length > 0 && this.chart.applyOverrides(n, { layer: "user" });
|
|
11308
11367
|
}
|
|
11309
11368
|
sheetKeyOn(e) {
|
|
@@ -11442,7 +11501,7 @@ var wu = class {
|
|
|
11442
11501
|
from: i(o.from),
|
|
11443
11502
|
to: i(o.to)
|
|
11444
11503
|
},
|
|
11445
|
-
withTime: !(k(this.state.timeframe) >=
|
|
11504
|
+
withTime: !(k(this.state.timeframe) >= yu),
|
|
11446
11505
|
max: s,
|
|
11447
11506
|
today: s
|
|
11448
11507
|
});
|
|
@@ -11507,9 +11566,9 @@ var wu = class {
|
|
|
11507
11566
|
}
|
|
11508
11567
|
async switchLocalTimeframe() {
|
|
11509
11568
|
if (!this.baseSeries) return;
|
|
11510
|
-
let e = ++this.localSeq, t = this.lastLocalSwitchMs >=
|
|
11569
|
+
let e = ++this.localSeq, t = this.lastLocalSwitchMs >= hu || this.baseSeries.length >= gu;
|
|
11511
11570
|
try {
|
|
11512
|
-
if (t && (this.loading.begin(this.chart.getData().length > 0, !0), await
|
|
11571
|
+
if (t && (this.loading.begin(this.chart.getData().length > 0, !0), await vu(), e !== this.localSeq || this.destroyed)) return;
|
|
11513
11572
|
this.applyTimeframeData();
|
|
11514
11573
|
} finally {
|
|
11515
11574
|
e === this.localSeq && this.loading.end();
|
|
@@ -11623,7 +11682,7 @@ var wu = class {
|
|
|
11623
11682
|
defaults: r.descriptor.defaultConfig,
|
|
11624
11683
|
params: r.params,
|
|
11625
11684
|
inputs: r.descriptor.inputs,
|
|
11626
|
-
lineSources:
|
|
11685
|
+
lineSources: Mu(t, n, this.t),
|
|
11627
11686
|
plots: r.descriptor.plots,
|
|
11628
11687
|
colors: i?.colors,
|
|
11629
11688
|
lineWidth: i?.lineWidths[0],
|
|
@@ -11642,7 +11701,7 @@ var wu = class {
|
|
|
11642
11701
|
this.alerting.refreshAlerts(), this.trading.refreshAccountSoon(), this.dataWindow?.isOpen() && this.dataWindow.render(this.docking.buildDataWindowModel());
|
|
11643
11702
|
}
|
|
11644
11703
|
formatMoney(e) {
|
|
11645
|
-
return this.formatNumber(e, Math.min(vt(this.chart.getPriceStep()),
|
|
11704
|
+
return this.formatNumber(e, Math.min(vt(this.chart.getPriceStep()), Tu));
|
|
11646
11705
|
}
|
|
11647
11706
|
formatVolume(e) {
|
|
11648
11707
|
return tt(e, this.chartSettings.settingsState.numberLocale || "en-US");
|
|
@@ -12173,6 +12232,8 @@ var wu = class {
|
|
|
12173
12232
|
return e.objectTree;
|
|
12174
12233
|
},
|
|
12175
12234
|
openDrawingSettings: (...t) => e.drawingEdit.openDrawingSettings(...t),
|
|
12235
|
+
editDrawingText: (...t) => e.drawingEdit.editDrawingText(...t),
|
|
12236
|
+
canTypeDrawingText: (...t) => e.drawingEdit.canTypeText(...t),
|
|
12176
12237
|
openSettings: (...t) => e.chartSettings.openSettings(...t),
|
|
12177
12238
|
get options() {
|
|
12178
12239
|
return e.options;
|
|
@@ -12559,7 +12620,7 @@ var wu = class {
|
|
|
12559
12620
|
};
|
|
12560
12621
|
}
|
|
12561
12622
|
};
|
|
12562
|
-
function
|
|
12623
|
+
function Mu(e, t, n) {
|
|
12563
12624
|
let r = (e) => {
|
|
12564
12625
|
let t = Vt(e.descriptor);
|
|
12565
12626
|
return t && ct(e.params[t])?.instanceId || null;
|
|
@@ -12582,66 +12643,66 @@ function Tu(e, t, n) {
|
|
|
12582
12643
|
}
|
|
12583
12644
|
return a;
|
|
12584
12645
|
}
|
|
12585
|
-
var
|
|
12586
|
-
function
|
|
12646
|
+
var Nu = "tcw:recentCommands", Pu = 10;
|
|
12647
|
+
function Fu() {
|
|
12587
12648
|
try {
|
|
12588
|
-
let e = JSON.parse(Xr()?.getItem(
|
|
12589
|
-
return Array.isArray(e) ? e.filter((e) => typeof e == "string").slice(0,
|
|
12649
|
+
let e = JSON.parse(Xr()?.getItem(Nu) ?? "[]");
|
|
12650
|
+
return Array.isArray(e) ? e.filter((e) => typeof e == "string").slice(0, Pu) : [];
|
|
12590
12651
|
} catch {
|
|
12591
12652
|
return [];
|
|
12592
12653
|
}
|
|
12593
12654
|
}
|
|
12594
|
-
function
|
|
12655
|
+
function Iu(e) {
|
|
12595
12656
|
try {
|
|
12596
|
-
Xr()?.setItem(
|
|
12657
|
+
Xr()?.setItem(Nu, JSON.stringify(e.slice(0, Pu)));
|
|
12597
12658
|
} catch {}
|
|
12598
12659
|
}
|
|
12599
|
-
var
|
|
12600
|
-
function
|
|
12660
|
+
var Lu = "tcw:dockWidth";
|
|
12661
|
+
function Ru() {
|
|
12601
12662
|
try {
|
|
12602
|
-
let e = Number(Xr()?.getItem(
|
|
12663
|
+
let e = Number(Xr()?.getItem(Lu) ?? NaN);
|
|
12603
12664
|
return Number.isFinite(e) && e > 0 ? e : null;
|
|
12604
12665
|
} catch {
|
|
12605
12666
|
return null;
|
|
12606
12667
|
}
|
|
12607
12668
|
}
|
|
12608
|
-
function
|
|
12669
|
+
function zu(e) {
|
|
12609
12670
|
try {
|
|
12610
|
-
Xr()?.setItem(
|
|
12671
|
+
Xr()?.setItem(Lu, String(e));
|
|
12611
12672
|
} catch {}
|
|
12612
12673
|
}
|
|
12613
|
-
function
|
|
12674
|
+
function Bu(e) {
|
|
12614
12675
|
return !!e && /^(ar|he|iw|fa|ur|ps|yi|dv|ckb|sd|ug)(-|$)/i.test(e);
|
|
12615
12676
|
}
|
|
12616
12677
|
//#endregion
|
|
12617
12678
|
//#region src/widget/GridLayoutPicker.ts
|
|
12618
|
-
var
|
|
12679
|
+
var Vu = 2, Hu = 20, Uu = 2, Wu = 16, Gu = 2, Ku = 4, qu = {
|
|
12619
12680
|
left: "grid.layoutBigLeft",
|
|
12620
12681
|
right: "grid.layoutBigRight",
|
|
12621
12682
|
top: "grid.layoutBigTop",
|
|
12622
12683
|
bottom: "grid.layoutBigBottom"
|
|
12623
12684
|
};
|
|
12624
|
-
function
|
|
12625
|
-
let r = (
|
|
12626
|
-
return [
|
|
12685
|
+
function Ju(e, t, n) {
|
|
12686
|
+
let r = (Hu - Uu * (n - 1)) / n;
|
|
12687
|
+
return [Vu + e * (r + Uu), t * r + (t - 1) * Uu];
|
|
12627
12688
|
}
|
|
12628
|
-
function
|
|
12689
|
+
function Yu(e, t = Wu) {
|
|
12629
12690
|
return `<svg width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true">${n(e).map(([t, n, r, i]) => {
|
|
12630
|
-
let [a, o] =
|
|
12691
|
+
let [a, o] = Ju(t, r, e.cols), [s, c] = Ju(n, i, e.rows);
|
|
12631
12692
|
return `<rect x="${a}" y="${s}" width="${o}" height="${c}" rx="1"/>`;
|
|
12632
12693
|
}).join("")}</svg>`;
|
|
12633
12694
|
}
|
|
12634
|
-
function
|
|
12695
|
+
function Xu(e, t) {
|
|
12635
12696
|
let n = f[e], r = s(n);
|
|
12636
12697
|
if (r === 1) return t("grid.single");
|
|
12637
12698
|
let i = m(n);
|
|
12638
|
-
return i ? w(t(
|
|
12699
|
+
return i ? w(t(qu[i]), { count: r }) : w(t("grid.layoutOption"), {
|
|
12639
12700
|
count: r,
|
|
12640
12701
|
cols: n.cols,
|
|
12641
12702
|
rows: n.rows
|
|
12642
12703
|
});
|
|
12643
12704
|
}
|
|
12644
|
-
var
|
|
12705
|
+
var Zu = class {
|
|
12645
12706
|
button;
|
|
12646
12707
|
panel = null;
|
|
12647
12708
|
choices;
|
|
@@ -12658,8 +12719,8 @@ var Wu = class {
|
|
|
12658
12719
|
}), this.render();
|
|
12659
12720
|
}
|
|
12660
12721
|
render() {
|
|
12661
|
-
let { t: e, current: t } = this.options, n = t(), r = `${e("grid.layout")}: ${
|
|
12662
|
-
this.button.innerHTML =
|
|
12722
|
+
let { t: e, current: t } = this.options, n = t(), r = `${e("grid.layout")}: ${Xu(n, e)}`;
|
|
12723
|
+
this.button.innerHTML = Yu(f[n]) + x("chevronDown", 12), this.button.title = r, this.button.setAttribute("aria-label", r);
|
|
12663
12724
|
for (let e of this.items()) e.setAttribute("aria-checked", String(e.dataset.layout === n));
|
|
12664
12725
|
}
|
|
12665
12726
|
isOpen() {
|
|
@@ -12700,15 +12761,15 @@ var Wu = class {
|
|
|
12700
12761
|
return a.className = "tcw-grid-picker-row", a.append(...t.map((e) => this.item(e))), r.append(i, a), r;
|
|
12701
12762
|
}
|
|
12702
12763
|
item(e) {
|
|
12703
|
-
let t =
|
|
12704
|
-
return n.type = "button", n.className = "tcw-btn-icon tcw-grid-picker-item", n.setAttribute("role", "menuitemradio"), n.setAttribute("aria-checked", "false"), n.tabIndex = -1, n.dataset.layout = e, n.title = t, n.setAttribute("aria-label", t), n.innerHTML =
|
|
12764
|
+
let t = Xu(e, this.options.t), n = document.createElement("button");
|
|
12765
|
+
return n.type = "button", n.className = "tcw-btn-icon tcw-grid-picker-item", n.setAttribute("role", "menuitemradio"), n.setAttribute("aria-checked", "false"), n.tabIndex = -1, n.dataset.layout = e, n.title = t, n.setAttribute("aria-label", t), n.innerHTML = Yu(f[e]), n.addEventListener("click", () => this.pick(e)), n;
|
|
12705
12766
|
}
|
|
12706
12767
|
pick(e) {
|
|
12707
12768
|
this.close(), this.options.onPick(e), this.render();
|
|
12708
12769
|
}
|
|
12709
12770
|
place(e) {
|
|
12710
|
-
let { host: t } = this.options, n = this.button.getBoundingClientRect(), r = t.getBoundingClientRect(), i = t.closest("[dir]")?.getAttribute("dir") === "rtl", a = e.offsetWidth, o = i ? n.right - r.left - a : n.left - r.left, s = t.clientWidth - a -
|
|
12711
|
-
e.style.left = `${Math.max(0, Math.min(o, s))}px`, e.style.top = `${n.bottom - r.top +
|
|
12771
|
+
let { host: t } = this.options, n = this.button.getBoundingClientRect(), r = t.getBoundingClientRect(), i = t.closest("[dir]")?.getAttribute("dir") === "rtl", a = e.offsetWidth, o = i ? n.right - r.left - a : n.left - r.left, s = t.clientWidth - a - Ku;
|
|
12772
|
+
e.style.left = `${Math.max(0, Math.min(o, s))}px`, e.style.top = `${n.bottom - r.top + Gu}px`, e.style.maxHeight = `${Math.max(0, t.clientHeight - (n.bottom - r.top) - Gu - Ku)}px`;
|
|
12712
12773
|
}
|
|
12713
12774
|
items() {
|
|
12714
12775
|
return this.panel ? [...this.panel.querySelectorAll("[role=\"menuitemradio\"]")] : [];
|
|
@@ -12739,32 +12800,32 @@ var Wu = class {
|
|
|
12739
12800
|
let o = this.rows(), s = o.findIndex((e) => e.includes(n[r])), c = o[s].indexOf(n[r]), l = o[(s + (t === "ArrowDown" ? 1 : -1) + o.length) % o.length];
|
|
12740
12801
|
return l[Math.min(c, l.length - 1)];
|
|
12741
12802
|
}
|
|
12742
|
-
},
|
|
12803
|
+
}, Qu = {
|
|
12743
12804
|
symbol: !1,
|
|
12744
12805
|
interval: !1,
|
|
12745
12806
|
crosshair: !0,
|
|
12746
12807
|
time: !1,
|
|
12747
12808
|
drawings: !1,
|
|
12748
12809
|
replay: !1
|
|
12749
|
-
},
|
|
12810
|
+
}, $u = [
|
|
12750
12811
|
"symbol",
|
|
12751
12812
|
"interval",
|
|
12752
12813
|
"crosshair",
|
|
12753
12814
|
"time",
|
|
12754
12815
|
"drawings",
|
|
12755
12816
|
"replay"
|
|
12756
|
-
],
|
|
12757
|
-
function
|
|
12817
|
+
], ed = f;
|
|
12818
|
+
function td(e) {
|
|
12758
12819
|
return JSON.parse(JSON.stringify(e));
|
|
12759
12820
|
}
|
|
12760
|
-
function
|
|
12821
|
+
function nd(e) {
|
|
12761
12822
|
if (typeof e != "object" || !e) return null;
|
|
12762
12823
|
let t = e;
|
|
12763
12824
|
if (t.v !== 1 || t.kind !== "grid" || !r(t.layout) || !Array.isArray(t.cells)) return null;
|
|
12764
12825
|
let n = t.cells.map(Us);
|
|
12765
12826
|
if (n.some((e) => e === null)) return null;
|
|
12766
|
-
let i = typeof t.sync == "object" && t.sync !== null ? t.sync : {}, a = { ...
|
|
12767
|
-
for (let e of
|
|
12827
|
+
let i = typeof t.sync == "object" && t.sync !== null ? t.sync : {}, a = { ...Qu };
|
|
12828
|
+
for (let e of $u) typeof i[e] == "boolean" && (a[e] = i[e]);
|
|
12768
12829
|
let o = typeof t.active == "number" && Number.isInteger(t.active) ? t.active : 0;
|
|
12769
12830
|
return {
|
|
12770
12831
|
v: 1,
|
|
@@ -12775,7 +12836,7 @@ function Yu(e) {
|
|
|
12775
12836
|
cells: n
|
|
12776
12837
|
};
|
|
12777
12838
|
}
|
|
12778
|
-
var
|
|
12839
|
+
var rd = class {
|
|
12779
12840
|
root;
|
|
12780
12841
|
cellsEl;
|
|
12781
12842
|
cells = [];
|
|
@@ -12805,7 +12866,7 @@ var Xu = class {
|
|
|
12805
12866
|
};
|
|
12806
12867
|
constructor(e, t = {}) {
|
|
12807
12868
|
this.options = t, this.layout = r(t.layout) ? t.layout : "1x2", this.sync = {
|
|
12808
|
-
...
|
|
12869
|
+
...Qu,
|
|
12809
12870
|
...t.sync
|
|
12810
12871
|
}, this.t = Be(Ve(t.widget?.locale, t.widget?.messages)), ln(), this.root = document.createElement("div"), this.root.className = "tcw-root tcw-grid", this.root.dataset.tcwTheme = t.widget?.theme === "light" ? "light" : "dark", Oa(this.root, U(t.widget?.ui), { variables: t.widget?.ui !== void 0 }), t.bar !== !1 && this.root.appendChild(this.buildBar()), this.cellsEl = document.createElement("div"), this.cellsEl.className = "tcw-grid-cells", this.root.appendChild(this.cellsEl), e.appendChild(this.root), this.stopNarrow = Js(this.root), this.applyShape();
|
|
12811
12872
|
for (let e = 0; e < this.shapeCount(); e++) this.cells.push(this.createCell(e));
|
|
@@ -12933,7 +12994,7 @@ var Xu = class {
|
|
|
12933
12994
|
return JSON.stringify(this.captureLayout());
|
|
12934
12995
|
}
|
|
12935
12996
|
async applyLayoutContent(e) {
|
|
12936
|
-
let t =
|
|
12997
|
+
let t = nd(Ws(e));
|
|
12937
12998
|
return t ? (await this.restoreLayout(t), !0) : !1;
|
|
12938
12999
|
}
|
|
12939
13000
|
destroy() {
|
|
@@ -12955,7 +13016,7 @@ var Xu = class {
|
|
|
12955
13016
|
createCell(e) {
|
|
12956
13017
|
let t = document.createElement("div");
|
|
12957
13018
|
t.className = "tcw-grid-cell", t.setAttribute("role", "region"), t.setAttribute("aria-label", w(this.t("grid.chart"), { n: e + 1 })), i(t, n(f[this.layout])[e]), this.cellsEl.appendChild(t);
|
|
12958
|
-
let r = this.options.widget ?? {}, a = this.options.cells?.[e] ?? {}, o = this.cells[this.active]?.widget, s = {}, c = new
|
|
13019
|
+
let r = this.options.widget ?? {}, a = this.options.cells?.[e] ?? {}, o = this.cells[this.active]?.widget, s = {}, c = new ju(t, {
|
|
12959
13020
|
...r,
|
|
12960
13021
|
...a,
|
|
12961
13022
|
...a.adapter ? { feed: void 0 } : {},
|
|
@@ -13012,7 +13073,7 @@ var Xu = class {
|
|
|
13012
13073
|
t.replaySeekToTime(n);
|
|
13013
13074
|
return;
|
|
13014
13075
|
}
|
|
13015
|
-
let r =
|
|
13076
|
+
let r = id(t.getData(), n);
|
|
13016
13077
|
r >= 0 && t.replayStart({
|
|
13017
13078
|
startIndex: r,
|
|
13018
13079
|
paused: !0
|
|
@@ -13057,7 +13118,7 @@ var Xu = class {
|
|
|
13057
13118
|
copyDrawings(e) {
|
|
13058
13119
|
let t = e.widget.getSymbol(), n = e.widget.getChart().getDrawings();
|
|
13059
13120
|
this.quietly(() => {
|
|
13060
|
-
for (let r of this.cells) r !== e && r.widget.getSymbol() === t && r.widget.getChart().setDrawings(
|
|
13121
|
+
for (let r of this.cells) r !== e && r.widget.getSymbol() === t && r.widget.getChart().setDrawings(td(n));
|
|
13061
13122
|
});
|
|
13062
13123
|
}
|
|
13063
13124
|
mergeDrawings() {
|
|
@@ -13069,7 +13130,7 @@ var Xu = class {
|
|
|
13069
13130
|
let e = /* @__PURE__ */ new Map();
|
|
13070
13131
|
for (let n of t) for (let t of n.widget.getChart().getDrawings()) e.has(t.id) || e.set(t.id, t);
|
|
13071
13132
|
let n = [...e.values()];
|
|
13072
|
-
for (let e of t) e.widget.getChart().setDrawings(
|
|
13133
|
+
for (let e of t) e.widget.getChart().setDrawings(td(n));
|
|
13073
13134
|
}
|
|
13074
13135
|
});
|
|
13075
13136
|
}
|
|
@@ -13106,7 +13167,7 @@ var Xu = class {
|
|
|
13106
13167
|
let t = document.createElement("div");
|
|
13107
13168
|
t.className = "tcw-grid-group", t.setAttribute("role", "group"), t.setAttribute("aria-label", this.t("grid.layout"));
|
|
13108
13169
|
let n = this.options.layoutChoices?.filter(r) ?? l;
|
|
13109
|
-
n.length > 0 && (this.layoutPicker = new
|
|
13170
|
+
n.length > 0 && (this.layoutPicker = new Zu({
|
|
13110
13171
|
host: this.root,
|
|
13111
13172
|
t: this.t,
|
|
13112
13173
|
choices: n,
|
|
@@ -13117,7 +13178,7 @@ var Xu = class {
|
|
|
13117
13178
|
i.className = "tcw-grid-group", i.setAttribute("role", "group"), i.setAttribute("aria-label", this.t("grid.sync"));
|
|
13118
13179
|
let a = document.createElement("span");
|
|
13119
13180
|
a.className = "tcw-grid-label", a.innerHTML = `${x("link", 13)}<span>${S(this.t("grid.sync"))}</span>`, i.appendChild(a);
|
|
13120
|
-
for (let e of
|
|
13181
|
+
for (let e of $u) {
|
|
13121
13182
|
let t = document.createElement("button");
|
|
13122
13183
|
t.type = "button", t.className = "tcw-btn tcw-grid-sync", t.textContent = this.t(`grid.sync.${e}`), t.title = this.t(`grid.sync.${e}.hint`), t.addEventListener("click", () => this.setSync({ [e]: !this.sync[e] })), this.syncButtons.set(e, t), i.appendChild(t);
|
|
13123
13184
|
}
|
|
@@ -13175,12 +13236,12 @@ var Xu = class {
|
|
|
13175
13236
|
this.cells[this.active]?.widget.toast(e, t);
|
|
13176
13237
|
}
|
|
13177
13238
|
};
|
|
13178
|
-
function
|
|
13239
|
+
function id(e, t) {
|
|
13179
13240
|
let n = -1;
|
|
13180
13241
|
for (let r = 0; r < e.length && e[r].time < t; r++) n = r;
|
|
13181
13242
|
return n;
|
|
13182
13243
|
}
|
|
13183
13244
|
//#endregion
|
|
13184
|
-
export { Se as CHART_TYPE_ICONS,
|
|
13245
|
+
export { Se as CHART_TYPE_ICONS, ju as ChartWidget, rd as ChartWidgetGrid, Qu as DEFAULT_GRID_SYNC, we as DRAWING_TOOL_ICONS, Re as EN_MESSAGES, ed as GRID_SHAPES, p as LayoutSession, c as MAX_LAYOUT_NAME, ye as UI_ICONS, He as VI_MESSAGES, he as WIDGET_FEATURES, ba as WIDGET_UI_PRESETS, Oa as applyWidgetUI, d as cleanLayoutName, Ce as createChartTypeIcon, x as createIcon, b as createToolIcon, ze as findWidgetLocale, be as iconSvg, o as localStorageLayouts, t as memoryLayouts, nd as readGridLayout, li as readWatchlists, Us as readWidgetLayout, Le as registerWidgetLocale, U as resolveWidgetUI, Da as widgetUIVariables };
|
|
13185
13246
|
|
|
13186
13247
|
//# sourceMappingURL=index.js.map
|