@orderly.network/ui-tradingview 3.0.0 → 3.0.1-alpha.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/dist/index.d.mts +44 -2
- package/dist/index.d.ts +44 -2
- package/dist/index.js +117 -48
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +114 -45
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -11
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import React3, { forwardRef, useRef, useState, useMemo, useEffect, useCallback } from 'react';
|
|
3
3
|
import { useTranslation, Trans, useLocaleCode, i18n } from '@orderly.network/i18n';
|
|
4
|
-
import { injectable, cn, Flex, Divider, useScreen, useOrderlyTheme, Box, useThemeAttribute, toast, modal, DropdownMenuRoot, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuContent
|
|
4
|
+
import { injectable, cn, Flex, Divider, useScreen, useOrderlyTheme, Text, Switch, Box, useThemeAttribute, toast, modal, DropdownMenuRoot, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuContent } from '@orderly.network/ui';
|
|
5
5
|
import { useMediaQuery, useConfig, useAccount, useSymbolsInfo, useLocalStorage, useOrderEntry_deprecated, useMarginModeBySymbol, useWS, usePositionStream, useOrderStream, useEventEmitter } from '@orderly.network/hooks';
|
|
6
6
|
import { MEDIA_TABLET, OrderSide, TradingviewFullscreenKey, OrderType, AccountStatusEnum, OrderStatus, ORDER_ENTRY_EST_LIQ_PRICE_CHANGE, MarginMode } from '@orderly.network/types';
|
|
7
7
|
import { Decimal, commify, getTrailingStopPrice, getPrecisionByNumber } from '@orderly.network/utils';
|
|
@@ -621,10 +621,47 @@ var init_timeInterval = __esm({
|
|
|
621
621
|
};
|
|
622
622
|
}
|
|
623
623
|
});
|
|
624
|
-
var DesktopDisplayControl;
|
|
624
|
+
var DesktopDisplayControlMenuListTarget, DesktopDisplayControlMenuList, InjectableDesktopDisplayControlMenuList, DesktopDisplayControl;
|
|
625
625
|
var init_displayControl_desktop = __esm({
|
|
626
626
|
"src/components/displayControl/displayControl.desktop.tsx"() {
|
|
627
627
|
init_icons();
|
|
628
|
+
DesktopDisplayControlMenuListTarget = "TradingView.DisplayControl.DesktopMenuList";
|
|
629
|
+
DesktopDisplayControlMenuList = ({ items }) => {
|
|
630
|
+
return /* @__PURE__ */ jsx(Fragment, { children: items.map((item) => /* @__PURE__ */ jsxs(
|
|
631
|
+
Flex,
|
|
632
|
+
{
|
|
633
|
+
justify: "between",
|
|
634
|
+
itemAlign: "center",
|
|
635
|
+
className: "oui-w-full",
|
|
636
|
+
children: [
|
|
637
|
+
/* @__PURE__ */ jsx(
|
|
638
|
+
Text,
|
|
639
|
+
{
|
|
640
|
+
className: cn(
|
|
641
|
+
"oui-text-sm oui-text-base-contrast-80",
|
|
642
|
+
!(item.checked ?? true) && "oui-text-base-contrast-36"
|
|
643
|
+
),
|
|
644
|
+
children: item.label
|
|
645
|
+
}
|
|
646
|
+
),
|
|
647
|
+
/* @__PURE__ */ jsx(
|
|
648
|
+
Switch,
|
|
649
|
+
{
|
|
650
|
+
className: "oui-h-4 oui-w-8",
|
|
651
|
+
checked: item.checked ?? true,
|
|
652
|
+
disabled: item.disabled,
|
|
653
|
+
onCheckedChange: (checked) => item.onCheckedChange?.(checked)
|
|
654
|
+
}
|
|
655
|
+
)
|
|
656
|
+
]
|
|
657
|
+
},
|
|
658
|
+
item.id
|
|
659
|
+
)) });
|
|
660
|
+
};
|
|
661
|
+
InjectableDesktopDisplayControlMenuList = injectable(
|
|
662
|
+
DesktopDisplayControlMenuList,
|
|
663
|
+
DesktopDisplayControlMenuListTarget
|
|
664
|
+
);
|
|
628
665
|
DesktopDisplayControl = (props) => {
|
|
629
666
|
const { displayControlState, changeDisplayControlState } = props;
|
|
630
667
|
const [open, setOpen] = useState(false);
|
|
@@ -633,38 +670,94 @@ var init_displayControl_desktop = __esm({
|
|
|
633
670
|
return [
|
|
634
671
|
{
|
|
635
672
|
label: t("common.position"),
|
|
636
|
-
id: "position"
|
|
673
|
+
id: "position",
|
|
674
|
+
checked: displayControlState.position ?? true,
|
|
675
|
+
onCheckedChange: (checked) => {
|
|
676
|
+
changeDisplayControlState({
|
|
677
|
+
...displayControlState,
|
|
678
|
+
position: checked
|
|
679
|
+
});
|
|
680
|
+
}
|
|
637
681
|
},
|
|
638
682
|
{
|
|
639
683
|
label: t("tradingView.displayControl.buySell"),
|
|
640
|
-
id: "buySell"
|
|
684
|
+
id: "buySell",
|
|
685
|
+
checked: displayControlState.buySell ?? true,
|
|
686
|
+
onCheckedChange: (checked) => {
|
|
687
|
+
changeDisplayControlState({
|
|
688
|
+
...displayControlState,
|
|
689
|
+
buySell: checked
|
|
690
|
+
});
|
|
691
|
+
}
|
|
641
692
|
},
|
|
642
693
|
{
|
|
643
694
|
label: t("tradingView.displayControl.limitOrders"),
|
|
644
|
-
id: "limitOrders"
|
|
695
|
+
id: "limitOrders",
|
|
696
|
+
checked: displayControlState.limitOrders ?? true,
|
|
697
|
+
onCheckedChange: (checked) => {
|
|
698
|
+
changeDisplayControlState({
|
|
699
|
+
...displayControlState,
|
|
700
|
+
limitOrders: checked
|
|
701
|
+
});
|
|
702
|
+
}
|
|
645
703
|
},
|
|
646
704
|
{
|
|
647
705
|
label: t("tradingView.displayControl.stopOrders"),
|
|
648
|
-
id: "stopOrders"
|
|
706
|
+
id: "stopOrders",
|
|
707
|
+
checked: displayControlState.stopOrders ?? true,
|
|
708
|
+
onCheckedChange: (checked) => {
|
|
709
|
+
changeDisplayControlState({
|
|
710
|
+
...displayControlState,
|
|
711
|
+
stopOrders: checked
|
|
712
|
+
});
|
|
713
|
+
}
|
|
649
714
|
},
|
|
650
715
|
{
|
|
651
716
|
label: t("common.tpsl"),
|
|
652
|
-
id: "tpsl"
|
|
717
|
+
id: "tpsl",
|
|
718
|
+
checked: displayControlState.tpsl ?? true,
|
|
719
|
+
onCheckedChange: (checked) => {
|
|
720
|
+
changeDisplayControlState({
|
|
721
|
+
...displayControlState,
|
|
722
|
+
tpsl: checked
|
|
723
|
+
});
|
|
724
|
+
}
|
|
653
725
|
},
|
|
654
726
|
{
|
|
655
727
|
label: t("tpsl.positionTpsl"),
|
|
656
|
-
id: "positionTpsl"
|
|
728
|
+
id: "positionTpsl",
|
|
729
|
+
checked: displayControlState.positionTpsl ?? true,
|
|
730
|
+
onCheckedChange: (checked) => {
|
|
731
|
+
changeDisplayControlState({
|
|
732
|
+
...displayControlState,
|
|
733
|
+
positionTpsl: checked
|
|
734
|
+
});
|
|
735
|
+
}
|
|
657
736
|
},
|
|
658
737
|
{
|
|
659
738
|
label: t("orderEntry.orderType.trailingStop"),
|
|
660
|
-
id: "trailingStop"
|
|
739
|
+
id: "trailingStop",
|
|
740
|
+
checked: displayControlState.trailingStop ?? true,
|
|
741
|
+
onCheckedChange: (checked) => {
|
|
742
|
+
changeDisplayControlState({
|
|
743
|
+
...displayControlState,
|
|
744
|
+
trailingStop: checked
|
|
745
|
+
});
|
|
746
|
+
}
|
|
661
747
|
},
|
|
662
748
|
{
|
|
663
749
|
label: t("tradingView.displayControl.liquidationPrice"),
|
|
664
|
-
id: "liquidationPrice"
|
|
750
|
+
id: "liquidationPrice",
|
|
751
|
+
checked: displayControlState.liquidationPrice ?? true,
|
|
752
|
+
onCheckedChange: (checked) => {
|
|
753
|
+
changeDisplayControlState({
|
|
754
|
+
...displayControlState,
|
|
755
|
+
liquidationPrice: checked
|
|
756
|
+
});
|
|
757
|
+
}
|
|
665
758
|
}
|
|
666
759
|
];
|
|
667
|
-
}, [t]);
|
|
760
|
+
}, [changeDisplayControlState, displayControlState, t]);
|
|
668
761
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(DropdownMenuRoot, { open, onOpenChange: setOpen, children: [
|
|
669
762
|
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
670
763
|
Flex,
|
|
@@ -711,40 +804,12 @@ var init_displayControl_desktop = __esm({
|
|
|
711
804
|
width: 240,
|
|
712
805
|
justify: "start",
|
|
713
806
|
itemAlign: "start",
|
|
714
|
-
children:
|
|
715
|
-
|
|
807
|
+
children: /* @__PURE__ */ jsx(
|
|
808
|
+
InjectableDesktopDisplayControlMenuList,
|
|
716
809
|
{
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
children: [
|
|
721
|
-
/* @__PURE__ */ jsx(
|
|
722
|
-
Text,
|
|
723
|
-
{
|
|
724
|
-
className: cn(
|
|
725
|
-
"oui-text-sm oui-text-base-contrast-80",
|
|
726
|
-
!(displayControlState[item.id] ?? true) && "oui-text-base-contrast-36"
|
|
727
|
-
),
|
|
728
|
-
children: item.label
|
|
729
|
-
}
|
|
730
|
-
),
|
|
731
|
-
/* @__PURE__ */ jsx(
|
|
732
|
-
Switch,
|
|
733
|
-
{
|
|
734
|
-
className: "oui-h-4 oui-w-8",
|
|
735
|
-
checked: displayControlState[item.id] ?? true,
|
|
736
|
-
onCheckedChange: (checked) => {
|
|
737
|
-
changeDisplayControlState({
|
|
738
|
-
...displayControlState,
|
|
739
|
-
[item.id]: checked
|
|
740
|
-
});
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
)
|
|
744
|
-
]
|
|
745
|
-
},
|
|
746
|
-
item.id
|
|
747
|
-
))
|
|
810
|
+
items: displayControlMap
|
|
811
|
+
}
|
|
812
|
+
)
|
|
748
813
|
}
|
|
749
814
|
)
|
|
750
815
|
}
|
|
@@ -883,6 +948,7 @@ var init_displayControl_mobile = __esm({
|
|
|
883
948
|
var displayControl_exports = {};
|
|
884
949
|
__export(displayControl_exports, {
|
|
885
950
|
DesktopDisplayControl: () => DesktopDisplayControl,
|
|
951
|
+
DesktopDisplayControlMenuListTarget: () => DesktopDisplayControlMenuListTarget,
|
|
886
952
|
MobileDisplayControl: () => MobileDisplayControl
|
|
887
953
|
});
|
|
888
954
|
var init_displayControl = __esm({
|
|
@@ -4997,6 +5063,9 @@ var TradingviewWidget = forwardRef((props, ref) => {
|
|
|
4997
5063
|
return /* @__PURE__ */ jsx(TradingviewUI, { ...state });
|
|
4998
5064
|
});
|
|
4999
5065
|
|
|
5000
|
-
|
|
5066
|
+
// src/index.ts
|
|
5067
|
+
init_displayControl();
|
|
5068
|
+
|
|
5069
|
+
export { DesktopDisplayControl, DesktopDisplayControlMenuListTarget, InjectableTradingviewDesktop, MobileDisplayControl, TradingviewUI, TradingviewWidget, useTradingviewScript };
|
|
5001
5070
|
//# sourceMappingURL=index.mjs.map
|
|
5002
5071
|
//# sourceMappingURL=index.mjs.map
|