wargerm 0.4.26 → 0.4.29
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/Card/index.d.ts +1 -0
- package/dist/components/LineEcharts/index.d.ts +15 -0
- package/dist/components/ReactECharts/RAF.d.ts +13 -0
- package/dist/components/ReactECharts/index.d.ts +16 -0
- package/dist/components/ReactECharts/theme.d.ts +138 -0
- package/dist/components/ReactECharts/useRAF.d.ts +4 -0
- package/dist/components/VideoPlayer/example/demo1.d.ts +3 -0
- package/dist/components/VideoPlayer/example/demo2.d.ts +3 -0
- package/dist/components/VideoPlayer/index.d.ts +1 -0
- package/dist/components/WForm/index.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +634 -15
- package/dist/index.js +655 -14
- package/dist/utils/index.d.ts +2 -0
- package/package.json +6 -2
package/dist/index.js
CHANGED
@@ -56,9 +56,34 @@ var Player = require('xgplayer');
|
|
56
56
|
var FlvPlayer = require('xgplayer-flv.js');
|
57
57
|
var HlsJsPlayer = require('xgplayer-hls.js');
|
58
58
|
var lodash = require('lodash');
|
59
|
+
var ReactEChartsCore = require('echarts-for-react/lib/core');
|
60
|
+
var echarts = require('echarts/core');
|
61
|
+
var charts = require('echarts/charts');
|
62
|
+
var components = require('echarts/components');
|
63
|
+
var renderers = require('echarts/renderers');
|
59
64
|
|
60
65
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
61
66
|
|
67
|
+
function _interopNamespace(e) {
|
68
|
+
if (e && e.__esModule) return e;
|
69
|
+
var n = Object.create(null);
|
70
|
+
if (e) {
|
71
|
+
Object.keys(e).forEach(function (k) {
|
72
|
+
if (k !== 'default') {
|
73
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
74
|
+
Object.defineProperty(n, k, d.get ? d : {
|
75
|
+
enumerable: true,
|
76
|
+
get: function () {
|
77
|
+
return e[k];
|
78
|
+
}
|
79
|
+
});
|
80
|
+
}
|
81
|
+
});
|
82
|
+
}
|
83
|
+
n['default'] = e;
|
84
|
+
return Object.freeze(n);
|
85
|
+
}
|
86
|
+
|
62
87
|
var _Button__default = /*#__PURE__*/_interopDefaultLegacy(_Button);
|
63
88
|
var _Dropdown__default = /*#__PURE__*/_interopDefaultLegacy(_Dropdown);
|
64
89
|
var _Menu__default = /*#__PURE__*/_interopDefaultLegacy(_Menu);
|
@@ -90,6 +115,8 @@ var ProTable__default = /*#__PURE__*/_interopDefaultLegacy(ProTable);
|
|
90
115
|
var Player__default = /*#__PURE__*/_interopDefaultLegacy(Player);
|
91
116
|
var FlvPlayer__default = /*#__PURE__*/_interopDefaultLegacy(FlvPlayer);
|
92
117
|
var HlsJsPlayer__default = /*#__PURE__*/_interopDefaultLegacy(HlsJsPlayer);
|
118
|
+
var ReactEChartsCore__default = /*#__PURE__*/_interopDefaultLegacy(ReactEChartsCore);
|
119
|
+
var echarts__namespace = /*#__PURE__*/_interopNamespace(echarts);
|
93
120
|
|
94
121
|
function ownKeys(object, enumerableOnly) {
|
95
122
|
var keys = Object.keys(object);
|
@@ -578,8 +605,8 @@ Index$3.Group = _Checkbox__default['default'].Group;
|
|
578
605
|
/*
|
579
606
|
* @Author: lijin
|
580
607
|
* @Date: 2021-10-27 22:18:49
|
581
|
-
* @LastEditTime:
|
582
|
-
* @LastEditors:
|
608
|
+
* @LastEditTime: 2022-06-30 16:51:49
|
609
|
+
* @LastEditors: caldelle 793238465@qq.com
|
583
610
|
* @Description:
|
584
611
|
* @FilePath: \wargerm\src\utils\index.ts
|
585
612
|
* 可以输入预定的版权声明、个性签名、空行等
|
@@ -639,6 +666,12 @@ function getArrayLayer(arr, attr) {
|
|
639
666
|
|
640
667
|
return newIndex;
|
641
668
|
}
|
669
|
+
var calcWidth = function calcWidth(width) {
|
670
|
+
return document.body.clientWidth / 3840 * width;
|
671
|
+
};
|
672
|
+
var calcHeight = function calcHeight(height) {
|
673
|
+
return document.body.clientHeight / 2160 * height;
|
674
|
+
};
|
642
675
|
|
643
676
|
var _excluded$1 = ["className", "frameStyle", "style", "direction", "children"];
|
644
677
|
function FrameBox(_ref) {
|
@@ -6785,7 +6818,7 @@ var WCascader = function WCascader(props) {
|
|
6785
6818
|
}, extraProps));
|
6786
6819
|
};
|
6787
6820
|
|
6788
|
-
var _excluded$6 = ["columns", "extraColumns", "className", "style", "search", "disabled", "disabledHideInSearch", "disabledRuler", "onFormChange", "onSubmit", "onReset"];
|
6821
|
+
var _excluded$6 = ["columns", "extraColumns", "className", "style", "search", "disabled", "disabledHideInSearch", "disabledRuler", "onFormChange", "onSubmit", "onReset", "setForm"];
|
6789
6822
|
var RangePicker$2 = Index$5.RangePicker;
|
6790
6823
|
|
6791
6824
|
var WForm = function WForm(props, ref) {
|
@@ -6800,6 +6833,7 @@ var WForm = function WForm(props, ref) {
|
|
6800
6833
|
onFormChange = props.onFormChange,
|
6801
6834
|
onSubmit = props.onSubmit,
|
6802
6835
|
onReset = props.onReset,
|
6836
|
+
setForm = props.setForm,
|
6803
6837
|
extraProps = _objectWithoutProperties(props, _excluded$6);
|
6804
6838
|
|
6805
6839
|
var _Form$useForm = _Form__default['default'].useForm(),
|
@@ -7933,6 +7967,17 @@ var WForm = function WForm(props, ref) {
|
|
7933
7967
|
setFieldsValue: setFieldsValue
|
7934
7968
|
};
|
7935
7969
|
});
|
7970
|
+
React.useEffect(function () {
|
7971
|
+
if (form) {
|
7972
|
+
setForm && setForm(form);
|
7973
|
+
}
|
7974
|
+
|
7975
|
+
return function () {
|
7976
|
+
if (form) {
|
7977
|
+
setForm && setForm(null);
|
7978
|
+
}
|
7979
|
+
};
|
7980
|
+
}, []);
|
7936
7981
|
return /*#__PURE__*/React__default['default'].createElement(_Form__default['default'], _objectSpread2({
|
7937
7982
|
style: {
|
7938
7983
|
marginBottom: '20px',
|
@@ -9620,7 +9665,7 @@ var Index$b = function Index(_ref) {
|
|
9620
9665
|
var _excluded$d = ["title", "className", "headerTail", "headerCenter", "sliderTabs"];
|
9621
9666
|
|
9622
9667
|
var Index$c = function Index(_ref, ref) {
|
9623
|
-
var _classNames;
|
9668
|
+
var _classNames, _sliderTabs$component;
|
9624
9669
|
|
9625
9670
|
var title = _ref.title,
|
9626
9671
|
_ref$className = _ref.className,
|
@@ -9655,14 +9700,15 @@ var Index$c = function Index(_ref, ref) {
|
|
9655
9700
|
className: "dot"
|
9656
9701
|
}), title), headerCenter, headerTail) : null, /*#__PURE__*/React__default['default'].createElement("div", {
|
9657
9702
|
className: "body"
|
9658
|
-
}, sliderTabs ? sliderTabs.components[activeTab]
|
9703
|
+
}, (sliderTabs === null || sliderTabs === void 0 ? void 0 : (_sliderTabs$component = sliderTabs.components) === null || _sliderTabs$component === void 0 ? void 0 : _sliderTabs$component[activeTab]) || props.children)), sliderTabs && /*#__PURE__*/React__default['default'].createElement("div", {
|
9659
9704
|
className: "sliderTabs ".concat(sliderTabs.direction == 'left' ? "left ".concat(sliderTabs.className || '') : "right ".concat(sliderTabs.className || ''))
|
9660
9705
|
}, sliderTabs.tabs.map(function (item, index) {
|
9661
9706
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
9662
9707
|
className: "tab ".concat(index == activeTab ? 'active' : '', " ").concat(sliderTabs.tabClassName || '', " ").concat(sliderTabs.activeTabClassName || '')
|
9663
9708
|
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
9664
9709
|
onClick: function onClick() {
|
9665
|
-
|
9710
|
+
setActiveTab(index);
|
9711
|
+
sliderTabs.onChange && (sliderTabs === null || sliderTabs === void 0 ? void 0 : sliderTabs.onChange(index));
|
9666
9712
|
}
|
9667
9713
|
}, item));
|
9668
9714
|
}))));
|
@@ -11270,8 +11316,10 @@ function VideoPlayer(_ref, ref) {
|
|
11270
11316
|
config = _ref$config === void 0 ? {} : _ref$config,
|
11271
11317
|
layoutIndex = _ref.layoutIndex,
|
11272
11318
|
_ref$url = _ref.url,
|
11273
|
-
url = _ref$url === void 0 ? [] : _ref$url
|
11274
|
-
|
11319
|
+
url = _ref$url === void 0 ? [] : _ref$url,
|
11320
|
+
_ref$layouts = _ref.layouts,
|
11321
|
+
layouts = _ref$layouts === void 0 ? [] : _ref$layouts;
|
11322
|
+
var basicLayouts = [{
|
11275
11323
|
title: '1x1布局',
|
11276
11324
|
style: {
|
11277
11325
|
gridTemplateColumns: '1fr',
|
@@ -11303,6 +11351,7 @@ function VideoPlayer(_ref, ref) {
|
|
11303
11351
|
}),
|
11304
11352
|
span: 9
|
11305
11353
|
}];
|
11354
|
+
var allLayouts = [].concat(_toConsumableArray(layouts), basicLayouts);
|
11306
11355
|
|
11307
11356
|
var _useState = React.useState(layoutIndex || 0),
|
11308
11357
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -11314,7 +11363,7 @@ function VideoPlayer(_ref, ref) {
|
|
11314
11363
|
urls = _useState4[0],
|
11315
11364
|
setUrls = _useState4[1];
|
11316
11365
|
|
11317
|
-
var initPlayerIndex =
|
11366
|
+
var initPlayerIndex = allLayouts[layoutIndex || 0].span >= url.length ? url.length - 1 >= 0 ? url.length - 1 : 0 : allLayouts[layoutIndex || 0].span - 1;
|
11318
11367
|
|
11319
11368
|
var _useState5 = React.useState(initPlayerIndex),
|
11320
11369
|
_useState6 = _slicedToArray(_useState5, 2),
|
@@ -11330,7 +11379,7 @@ function VideoPlayer(_ref, ref) {
|
|
11330
11379
|
setPlayers = _useState8[1];
|
11331
11380
|
|
11332
11381
|
var renderDom = React.useMemo(function () {
|
11333
|
-
var arr = new Array(
|
11382
|
+
var arr = new Array(allLayouts[currentLayoutIndex].span).fill(0);
|
11334
11383
|
return arr.map(function (item, index) {
|
11335
11384
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
11336
11385
|
key: index,
|
@@ -11411,22 +11460,24 @@ function VideoPlayer(_ref, ref) {
|
|
11411
11460
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
11412
11461
|
ref: domRef,
|
11413
11462
|
className: "videoContainer-grid",
|
11414
|
-
style:
|
11463
|
+
style: allLayouts[currentLayoutIndex].style
|
11415
11464
|
}, renderDom), footer ? /*#__PURE__*/React__default['default'].createElement("div", {
|
11416
11465
|
className: "tools"
|
11417
|
-
},
|
11466
|
+
}, allLayouts.map(function (item, index) {
|
11418
11467
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
11419
11468
|
key: index,
|
11420
11469
|
className: "btnbox",
|
11421
11470
|
onClick: function onClick() {
|
11422
|
-
var playerIndex =
|
11471
|
+
var playerIndex = allLayouts[index || 0].span > url.length ? url.length - 1 >= 0 ? url.length : 0 : allLayouts[index || 0].span - 1;
|
11423
11472
|
setCurrentPlayerIndex(playerIndex);
|
11424
11473
|
setCurrentLayoutIndex(index);
|
11425
11474
|
}
|
11426
11475
|
}, /*#__PURE__*/React__default['default'].createElement(_Tooltip__default['default'], {
|
11427
11476
|
placement: "top",
|
11428
11477
|
title: item.title
|
11429
|
-
}, item.icon
|
11478
|
+
}, item.icon || /*#__PURE__*/React__default['default'].createElement(IconFont, {
|
11479
|
+
type: "icon-dantupailie"
|
11480
|
+
})));
|
11430
11481
|
})) : null));
|
11431
11482
|
}
|
11432
11483
|
|
@@ -11662,6 +11713,595 @@ var index$4 = (function (_ref) {
|
|
11662
11713
|
});
|
11663
11714
|
});
|
11664
11715
|
|
11716
|
+
/*
|
11717
|
+
* @Author: lijin
|
11718
|
+
* @Date: 2021-08-04 13:22:21
|
11719
|
+
* @LastEditTime: 2021-08-04 13:25:19
|
11720
|
+
* @LastEditors: lijin
|
11721
|
+
* @Description:
|
11722
|
+
* @FilePath: \big-screen\src\components\ReactECharts\theme.ts
|
11723
|
+
* 可以输入预定的版权声明、个性签名、空行等
|
11724
|
+
*/
|
11725
|
+
var contrastColor = '#9EA1A7';
|
11726
|
+
var backgroundColor = 'transparent';
|
11727
|
+
|
11728
|
+
var axisCommon = function axisCommon() {
|
11729
|
+
return {
|
11730
|
+
axisLine: {
|
11731
|
+
lineStyle: {
|
11732
|
+
color: contrastColor
|
11733
|
+
}
|
11734
|
+
},
|
11735
|
+
splitLine: {
|
11736
|
+
lineStyle: {
|
11737
|
+
color: '#2c3641'
|
11738
|
+
}
|
11739
|
+
},
|
11740
|
+
splitArea: {
|
11741
|
+
areaStyle: {
|
11742
|
+
color: ['rgba(255,255,255,0.02)', 'rgba(255,255,255,0.05)']
|
11743
|
+
}
|
11744
|
+
},
|
11745
|
+
minorSplitLine: {
|
11746
|
+
lineStyle: {
|
11747
|
+
color: '#20203B'
|
11748
|
+
}
|
11749
|
+
}
|
11750
|
+
};
|
11751
|
+
};
|
11752
|
+
|
11753
|
+
var colorPalette = ['#4992ff', '#7cffb2', '#fddd60', '#ff6e76', '#58d9f9', '#05c091', '#ff8a45', '#8d48e3', '#dd79ff'];
|
11754
|
+
var theme = {
|
11755
|
+
darkMode: true,
|
11756
|
+
color: colorPalette,
|
11757
|
+
backgroundColor: backgroundColor,
|
11758
|
+
axisPointer: {
|
11759
|
+
lineStyle: {
|
11760
|
+
color: '#817f91'
|
11761
|
+
},
|
11762
|
+
crossStyle: {
|
11763
|
+
color: '#817f91'
|
11764
|
+
},
|
11765
|
+
label: {
|
11766
|
+
color: contrastColor,
|
11767
|
+
backgroundColor: '#104873'
|
11768
|
+
}
|
11769
|
+
},
|
11770
|
+
legend: {
|
11771
|
+
textStyle: {
|
11772
|
+
color: contrastColor
|
11773
|
+
}
|
11774
|
+
},
|
11775
|
+
textStyle: {
|
11776
|
+
color: contrastColor
|
11777
|
+
},
|
11778
|
+
title: {
|
11779
|
+
textStyle: {
|
11780
|
+
color: '#EEF1FA'
|
11781
|
+
},
|
11782
|
+
subtextStyle: {
|
11783
|
+
color: '#B9B8CE'
|
11784
|
+
}
|
11785
|
+
},
|
11786
|
+
toolbox: {
|
11787
|
+
iconStyle: {
|
11788
|
+
borderColor: contrastColor
|
11789
|
+
}
|
11790
|
+
},
|
11791
|
+
dataZoom: {
|
11792
|
+
borderColor: '#71708A',
|
11793
|
+
textStyle: {
|
11794
|
+
color: contrastColor
|
11795
|
+
},
|
11796
|
+
brushStyle: {
|
11797
|
+
color: 'rgba(135,163,206,0.3)'
|
11798
|
+
},
|
11799
|
+
handleStyle: {
|
11800
|
+
color: '#353450',
|
11801
|
+
borderColor: '#C5CBE3'
|
11802
|
+
},
|
11803
|
+
moveHandleStyle: {
|
11804
|
+
color: '#B0B6C3',
|
11805
|
+
opacity: 0.3
|
11806
|
+
},
|
11807
|
+
fillerColor: 'rgba(135,163,206,0.2)',
|
11808
|
+
emphasis: {
|
11809
|
+
handleStyle: {
|
11810
|
+
borderColor: '#91B7F2',
|
11811
|
+
color: '#4D587D'
|
11812
|
+
},
|
11813
|
+
moveHandleStyle: {
|
11814
|
+
color: '#636D9A',
|
11815
|
+
opacity: 0.7
|
11816
|
+
}
|
11817
|
+
},
|
11818
|
+
dataBackground: {
|
11819
|
+
lineStyle: {
|
11820
|
+
color: '#71708A',
|
11821
|
+
width: 1
|
11822
|
+
},
|
11823
|
+
areaStyle: {
|
11824
|
+
color: '#71708A'
|
11825
|
+
}
|
11826
|
+
},
|
11827
|
+
selectedDataBackground: {
|
11828
|
+
lineStyle: {
|
11829
|
+
color: '#87A3CE'
|
11830
|
+
},
|
11831
|
+
areaStyle: {
|
11832
|
+
color: '#87A3CE'
|
11833
|
+
}
|
11834
|
+
}
|
11835
|
+
},
|
11836
|
+
visualMap: {
|
11837
|
+
textStyle: {
|
11838
|
+
color: contrastColor
|
11839
|
+
}
|
11840
|
+
},
|
11841
|
+
timeline: {
|
11842
|
+
lineStyle: {
|
11843
|
+
color: contrastColor
|
11844
|
+
},
|
11845
|
+
label: {
|
11846
|
+
color: contrastColor
|
11847
|
+
},
|
11848
|
+
controlStyle: {
|
11849
|
+
color: contrastColor,
|
11850
|
+
borderColor: contrastColor
|
11851
|
+
}
|
11852
|
+
},
|
11853
|
+
calendar: {
|
11854
|
+
itemStyle: {
|
11855
|
+
color: backgroundColor
|
11856
|
+
},
|
11857
|
+
dayLabel: {
|
11858
|
+
color: contrastColor
|
11859
|
+
},
|
11860
|
+
monthLabel: {
|
11861
|
+
color: contrastColor
|
11862
|
+
},
|
11863
|
+
yearLabel: {
|
11864
|
+
color: contrastColor
|
11865
|
+
}
|
11866
|
+
},
|
11867
|
+
timeAxis: axisCommon(),
|
11868
|
+
logAxis: axisCommon(),
|
11869
|
+
valueAxis: axisCommon(),
|
11870
|
+
categoryAxis: axisCommon(),
|
11871
|
+
line: {
|
11872
|
+
symbol: 'circle'
|
11873
|
+
},
|
11874
|
+
graph: {
|
11875
|
+
color: colorPalette
|
11876
|
+
},
|
11877
|
+
gauge: {
|
11878
|
+
title: {
|
11879
|
+
color: contrastColor
|
11880
|
+
}
|
11881
|
+
},
|
11882
|
+
candlestick: {
|
11883
|
+
itemStyle: {
|
11884
|
+
color: '#FD1050',
|
11885
|
+
color0: '#0CF49B',
|
11886
|
+
borderColor: '#FD1050',
|
11887
|
+
borderColor0: '#0CF49B'
|
11888
|
+
}
|
11889
|
+
}
|
11890
|
+
};
|
11891
|
+
theme.categoryAxis.splitLine.show = false;
|
11892
|
+
|
11893
|
+
var RAF = /*#__PURE__*/function () {
|
11894
|
+
function RAF() {
|
11895
|
+
_classCallCheck(this, RAF);
|
11896
|
+
|
11897
|
+
this._timerIdMap = void 0;
|
11898
|
+
this._timerIdMap = {
|
11899
|
+
timeout: {},
|
11900
|
+
interval: {}
|
11901
|
+
};
|
11902
|
+
}
|
11903
|
+
|
11904
|
+
_createClass(RAF, [{
|
11905
|
+
key: "run",
|
11906
|
+
value: function run() {
|
11907
|
+
var _this = this;
|
11908
|
+
|
11909
|
+
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'interval';
|
11910
|
+
var cb = arguments.length > 1 ? arguments[1] : undefined;
|
11911
|
+
var interval = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 16.7;
|
11912
|
+
// 每16.7毫秒刷新一次(一帧)
|
11913
|
+
var now = Date.now;
|
11914
|
+
var startTime = now();
|
11915
|
+
var endTime = startTime;
|
11916
|
+
var timerSymbol = Symbol();
|
11917
|
+
|
11918
|
+
var loop = function loop() {
|
11919
|
+
_this.setIdMap(timerSymbol, type, loop);
|
11920
|
+
|
11921
|
+
endTime = now();
|
11922
|
+
|
11923
|
+
if (endTime - startTime >= interval) {
|
11924
|
+
if (type === 'interval') {
|
11925
|
+
startTime = now();
|
11926
|
+
endTime = startTime;
|
11927
|
+
}
|
11928
|
+
|
11929
|
+
cb();
|
11930
|
+
type === 'timeout' && _this.clearTimeout(timerSymbol);
|
11931
|
+
}
|
11932
|
+
};
|
11933
|
+
|
11934
|
+
this.setIdMap(timerSymbol, type, loop);
|
11935
|
+
return timerSymbol;
|
11936
|
+
}
|
11937
|
+
}, {
|
11938
|
+
key: "setIdMap",
|
11939
|
+
value: function setIdMap(timerSymbol, type, loop) {
|
11940
|
+
var id = requestAnimationFrame(loop);
|
11941
|
+
this._timerIdMap[type][timerSymbol] = id;
|
11942
|
+
}
|
11943
|
+
}, {
|
11944
|
+
key: "setTimeout",
|
11945
|
+
value: function setTimeout(cb, interval) {
|
11946
|
+
return this.run('timeout', cb, interval);
|
11947
|
+
}
|
11948
|
+
}, {
|
11949
|
+
key: "clearTimeout",
|
11950
|
+
value: function clearTimeout(timer) {
|
11951
|
+
cancelAnimationFrame(this._timerIdMap.timeout[timer]);
|
11952
|
+
}
|
11953
|
+
}, {
|
11954
|
+
key: "setInterval",
|
11955
|
+
value: function setInterval(cb, interval) {
|
11956
|
+
return this.run('interval', cb, interval);
|
11957
|
+
}
|
11958
|
+
}, {
|
11959
|
+
key: "clearInterval",
|
11960
|
+
value: function clearInterval(timer) {
|
11961
|
+
cancelAnimationFrame(this._timerIdMap.interval[timer]);
|
11962
|
+
}
|
11963
|
+
}]);
|
11964
|
+
|
11965
|
+
return RAF;
|
11966
|
+
}();
|
11967
|
+
|
11968
|
+
/*
|
11969
|
+
* @Author: lijin
|
11970
|
+
* @Date: 2022-06-20 15:27:46
|
11971
|
+
* @LastEditTime: 2022-06-30 17:32:49
|
11972
|
+
* @LastEditors: caldelle 793238465@qq.com
|
11973
|
+
* @Description:
|
11974
|
+
* @FilePath: \hefeihz-web-bigscreen\src\hooks\useRAF.ts
|
11975
|
+
* 可以输入预定的版权声明、个性签名、空行等
|
11976
|
+
*/
|
11977
|
+
function useRAF() {
|
11978
|
+
var raf = React.useMemo(function () {
|
11979
|
+
return new RAF();
|
11980
|
+
}, []);
|
11981
|
+
return {
|
11982
|
+
raf: raf
|
11983
|
+
};
|
11984
|
+
}
|
11985
|
+
|
11986
|
+
echarts.use([components.TitleComponent, components.TooltipComponent, components.GridComponent, charts.BarChart, renderers.CanvasRenderer, charts.LineChart, charts.PieChart, charts.RadarChart, components.LegendComponent, components.LegendPlainComponent, components.MarkLineComponent, charts.PictorialBarChart, charts.CustomChart, components.LegendScrollComponent, components.PolarComponent, components.GraphicComponent, components.ToolboxComponent]);
|
11987
|
+
echarts.registerTheme('my_theme', theme); // The usage of ReactEChartsCore are same with above.
|
11988
|
+
|
11989
|
+
var ReactECharts = /*#__PURE__*/React__default['default'].memo(function (_ref) {
|
11990
|
+
var _option$highlightData, _option$highlightData2, _option$highlightData3;
|
11991
|
+
|
11992
|
+
var option = _ref.option,
|
11993
|
+
_ref$onChartReady = _ref.onChartReady,
|
11994
|
+
onChartReady = _ref$onChartReady === void 0 ? function () {} : _ref$onChartReady,
|
11995
|
+
_ref$EventsDict = _ref.EventsDict,
|
11996
|
+
EventsDict = _ref$EventsDict === void 0 ? {} : _ref$EventsDict,
|
11997
|
+
_ref$style = _ref.style,
|
11998
|
+
style = _ref$style === void 0 ? {} : _ref$style,
|
11999
|
+
ref = _ref.ref,
|
12000
|
+
_ref$autoLoop = _ref.autoLoop,
|
12001
|
+
autoLoop = _ref$autoLoop === void 0 ? true : _ref$autoLoop,
|
12002
|
+
_ref$duration = _ref.duration,
|
12003
|
+
duration = _ref$duration === void 0 ? 2000 : _ref$duration,
|
12004
|
+
_ref$seriesIndex = _ref.seriesIndex,
|
12005
|
+
seriesIndex = _ref$seriesIndex === void 0 ? 0 : _ref$seriesIndex,
|
12006
|
+
opts = _ref.opts,
|
12007
|
+
otherProps = _ref.otherProps;
|
12008
|
+
|
12009
|
+
var _useRAF = useRAF(),
|
12010
|
+
raf = _useRAF.raf;
|
12011
|
+
|
12012
|
+
var _useState = React.useState(-1),
|
12013
|
+
_useState2 = _slicedToArray(_useState, 2),
|
12014
|
+
currentIndex = _useState2[0],
|
12015
|
+
setCurrentIndex = _useState2[1];
|
12016
|
+
|
12017
|
+
var instance = React.useRef(null);
|
12018
|
+
var timer = React.useRef(null);
|
12019
|
+
var timeoutTimer = React.useRef(null);
|
12020
|
+
|
12021
|
+
var _useState3 = React.useState(false),
|
12022
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
12023
|
+
Flag = _useState4[0],
|
12024
|
+
setFlag = _useState4[1];
|
12025
|
+
|
12026
|
+
var length = (_option$highlightData = option === null || option === void 0 ? void 0 : (_option$highlightData2 = option.highlightData) === null || _option$highlightData2 === void 0 ? void 0 : _option$highlightData2.length) !== null && _option$highlightData !== void 0 ? _option$highlightData : 0;
|
12027
|
+
var current = option === null || option === void 0 ? void 0 : (_option$highlightData3 = option.highlightData) === null || _option$highlightData3 === void 0 ? void 0 : _option$highlightData3[currentIndex];
|
12028
|
+
var currentName = typeof current === 'string' ? current : current === null || current === void 0 ? void 0 : current.name;
|
12029
|
+
React.useEffect(function () {
|
12030
|
+
if (autoLoop && length > 1) {
|
12031
|
+
timer.current = raf.setInterval(function () {
|
12032
|
+
setCurrentIndex(function (index) {
|
12033
|
+
return index >= length - 1 ? 0 : index + 1;
|
12034
|
+
});
|
12035
|
+
}, duration);
|
12036
|
+
} else {
|
12037
|
+
setCurrentIndex(-1);
|
12038
|
+
timer.current && raf.clearInterval(timer.current);
|
12039
|
+
}
|
12040
|
+
|
12041
|
+
return function () {
|
12042
|
+
timer.current && raf.clearInterval(timer.current);
|
12043
|
+
};
|
12044
|
+
}, [autoLoop, duration, raf, length]);
|
12045
|
+
React.useEffect(function () {
|
12046
|
+
if (!instance.current) {
|
12047
|
+
return;
|
12048
|
+
}
|
12049
|
+
|
12050
|
+
instance.current.dispatchAction({
|
12051
|
+
type: 'downplay'
|
12052
|
+
});
|
12053
|
+
instance.current.dispatchAction({
|
12054
|
+
type: 'hideTip'
|
12055
|
+
});
|
12056
|
+
|
12057
|
+
if (currentIndex > -1) {
|
12058
|
+
instance.current.dispatchAction({
|
12059
|
+
type: 'showTip',
|
12060
|
+
seriesIndex: seriesIndex,
|
12061
|
+
dataIndex: currentIndex
|
12062
|
+
});
|
12063
|
+
currentName && instance.current.dispatchAction({
|
12064
|
+
type: 'highlight',
|
12065
|
+
name: currentName
|
12066
|
+
});
|
12067
|
+
}
|
12068
|
+
}, [currentIndex, instance, seriesIndex, currentName]);
|
12069
|
+
|
12070
|
+
var onChartReadyCallback = function onChartReadyCallback(chart) {
|
12071
|
+
instance.current = chart;
|
12072
|
+
onChartReady(chart, option);
|
12073
|
+
timeoutTimer.current = raf.setTimeout(function () {
|
12074
|
+
instance.current.resize();
|
12075
|
+
}, 20);
|
12076
|
+
};
|
12077
|
+
|
12078
|
+
React.useEffect(function () {
|
12079
|
+
filter(option);
|
12080
|
+
}, [option]);
|
12081
|
+
|
12082
|
+
var filter = function filter(option) {
|
12083
|
+
var _option$series;
|
12084
|
+
|
12085
|
+
var flag = option === null || option === void 0 ? void 0 : (_option$series = option.series) === null || _option$series === void 0 ? void 0 : _option$series.every(function (item) {
|
12086
|
+
return !item.data || item.data.length == 0;
|
12087
|
+
});
|
12088
|
+
setFlag(flag);
|
12089
|
+
return option;
|
12090
|
+
};
|
12091
|
+
|
12092
|
+
React.useEffect(function () {
|
12093
|
+
var resizeHandler = function resizeHandler() {
|
12094
|
+
if (instance.current) {
|
12095
|
+
instance.current.resize();
|
12096
|
+
}
|
12097
|
+
};
|
12098
|
+
|
12099
|
+
window.addEventListener('resize', resizeHandler);
|
12100
|
+
return function () {
|
12101
|
+
timeoutTimer.current && raf.clearTimeout(timeoutTimer.current);
|
12102
|
+
window.removeEventListener('resize', resizeHandler);
|
12103
|
+
};
|
12104
|
+
}, []);
|
12105
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(ReactEChartsCore__default['default'], _objectSpread2({
|
12106
|
+
ref: ref,
|
12107
|
+
echarts: echarts__namespace,
|
12108
|
+
option: option,
|
12109
|
+
notMerge: true,
|
12110
|
+
lazyUpdate: true,
|
12111
|
+
style: style,
|
12112
|
+
theme: 'my_theme',
|
12113
|
+
onChartReady: onChartReadyCallback,
|
12114
|
+
onEvents: EventsDict,
|
12115
|
+
opts: opts || {}
|
12116
|
+
}, otherProps)));
|
12117
|
+
});
|
12118
|
+
|
12119
|
+
var lineOption = function lineOption(_ref) {
|
12120
|
+
var list = _ref.list,
|
12121
|
+
xdata = _ref.xdata;
|
12122
|
+
return {
|
12123
|
+
grid: {
|
12124
|
+
top: '18%',
|
12125
|
+
bottom: 1,
|
12126
|
+
left: 20,
|
12127
|
+
right: 20,
|
12128
|
+
containLabel: true
|
12129
|
+
},
|
12130
|
+
tooltip: {
|
12131
|
+
trigger: 'axis',
|
12132
|
+
backgroundColor: '#012536',
|
12133
|
+
borderColor: 'rgba(81,190,246,1)',
|
12134
|
+
textStyle: {
|
12135
|
+
color: '#daeef7',
|
12136
|
+
fontSize: calcWidth(24)
|
12137
|
+
},
|
12138
|
+
position: function position(point, params, dom, rect, size) {
|
12139
|
+
// 其中point为当前鼠标的位置,size中有两个属性:viewSize和contentSize,分别为外层div和tooltip提示框的大小
|
12140
|
+
var x = point[0]; //
|
12141
|
+
|
12142
|
+
var y = point[1];
|
12143
|
+
var viewWidth = size.viewSize[0];
|
12144
|
+
var viewHeight = size.viewSize[1];
|
12145
|
+
var boxWidth = size.contentSize[0];
|
12146
|
+
var boxHeight = size.contentSize[1];
|
12147
|
+
var posX = 0; // x坐标位置
|
12148
|
+
|
12149
|
+
var posY = 0; // y坐标位置
|
12150
|
+
|
12151
|
+
if (x < boxWidth) {
|
12152
|
+
// 左边放不开
|
12153
|
+
posX = 5;
|
12154
|
+
} else {
|
12155
|
+
// 左边放的下
|
12156
|
+
posX = x - boxWidth;
|
12157
|
+
}
|
12158
|
+
|
12159
|
+
if (y < boxHeight) {
|
12160
|
+
// 上边放不开
|
12161
|
+
posY = 5;
|
12162
|
+
} else {
|
12163
|
+
// 上边放得下
|
12164
|
+
posY = y - boxHeight;
|
12165
|
+
}
|
12166
|
+
|
12167
|
+
return [posX, posY];
|
12168
|
+
},
|
12169
|
+
axisPointer: {
|
12170
|
+
lineStyle: {
|
12171
|
+
color: {
|
12172
|
+
type: 'linear',
|
12173
|
+
x: 0,
|
12174
|
+
y: 0,
|
12175
|
+
x2: 0,
|
12176
|
+
y2: 1,
|
12177
|
+
colorStops: [{
|
12178
|
+
offset: 0,
|
12179
|
+
color: 'rgba(255,255,255,0)' // 0% 处的颜色
|
12180
|
+
|
12181
|
+
}, {
|
12182
|
+
offset: 0.5,
|
12183
|
+
color: 'rgba(255,255,255,1)' // 100% 处的颜色
|
12184
|
+
|
12185
|
+
}, {
|
12186
|
+
offset: 1,
|
12187
|
+
color: 'rgba(255,255,255,0)' // 100% 处的颜色
|
12188
|
+
|
12189
|
+
}],
|
12190
|
+
global: false // 缺省为 false
|
12191
|
+
|
12192
|
+
}
|
12193
|
+
}
|
12194
|
+
},
|
12195
|
+
formatter: function formatter(params) {
|
12196
|
+
if (params.length == 0) {
|
12197
|
+
return null;
|
12198
|
+
}
|
12199
|
+
|
12200
|
+
var dom = '';
|
12201
|
+
params.map(function (item) {
|
12202
|
+
dom = dom + " <div><?xml version=\"1.0\" standalone=\"no\"?><!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n <svg t=\"1655805829921\" class=\"icon\" viewBox=\"0 0 1024 1024\" fill=\"".concat(item.color, "\"; version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"5439\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"").concat(calcWidth(20), "px\" height=\"").concat(calcHeight(20), "px\" style=\"margin-right:").concat(calcWidth(10), "px\">\n <defs><style type=\"text/css\">@font-face { font-family: feedback-iconfont; src: url(\"//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff2?t=1630033759944\") format(\"woff2\"), url(\"//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff?t=1630033759944\") format(\"woff\"), url(\"//at.alicdn.com/t/font_1031158_u69w8yhxdu.ttf?t=1630033759944\") format(\"truetype\"); }\n </style></defs><path d=\"M512 512m-256 0a256 256 0 1 0 512 0 256 256 0 1 0-512 0Z\" p-id=\"5440\"></path><path d=\"M512 20.48C239.616 20.48 20.48 239.616 20.48 512s219.136 491.52 491.52 491.52 491.52-219.136 491.52-491.52S784.384 20.48 512 20.48z m0 899.072C286.72 919.552 104.448 737.28 104.448 512 104.448 286.72 286.72 104.448 512 104.448 737.28 104.448 919.552 286.72 919.552 512c0 225.28-182.272 407.552-407.552 407.552z\" p-id=\"5441\"></path></svg>").concat(item.seriesName, " : ").concat(item.value, "</div>");
|
12203
|
+
});
|
12204
|
+
return dom;
|
12205
|
+
}
|
12206
|
+
},
|
12207
|
+
legend: {
|
12208
|
+
top: 0,
|
12209
|
+
itemGap: calcWidth(20),
|
12210
|
+
show: true,
|
12211
|
+
textStyle: {
|
12212
|
+
fontSize: calcWidth(24),
|
12213
|
+
color: '#ccf8fb',
|
12214
|
+
lineHeight: calcHeight(20)
|
12215
|
+
},
|
12216
|
+
data: list === null || list === void 0 ? void 0 : list.map(function (item) {
|
12217
|
+
return {
|
12218
|
+
name: item.name,
|
12219
|
+
icon: "path://M512 512m-256 0a256 256 0 1 0 512 0 256 256 0 1 0-512 0Z,M512 20.48C239.616 20.48 20.48 239.616 20.48 512s219.136 491.52 491.52 491.52 491.52-219.136 491.52-491.52S784.384 20.48 512 20.48z m0 899.072C286.72 919.552 104.448 737.28 104.448 512 104.448 286.72 286.72 104.448 512 104.448 737.28 104.448 919.552 286.72 919.552 512c0 225.28-182.272 407.552-407.552 407.552z"
|
12220
|
+
};
|
12221
|
+
}),
|
12222
|
+
itemWidth: calcWidth(20),
|
12223
|
+
itemHeight: calcHeight(20)
|
12224
|
+
},
|
12225
|
+
xAxis: [{
|
12226
|
+
type: 'category',
|
12227
|
+
axisLabel: {
|
12228
|
+
formatter: '{value}',
|
12229
|
+
// interval: 0,
|
12230
|
+
fontSize: calcWidth(24),
|
12231
|
+
color: '#ccf8fb',
|
12232
|
+
margin: 20
|
12233
|
+
},
|
12234
|
+
axisLine: {
|
12235
|
+
lineStyle: {
|
12236
|
+
color: '#2c3641'
|
12237
|
+
}
|
12238
|
+
},
|
12239
|
+
splitLine: {
|
12240
|
+
show: false,
|
12241
|
+
lineStyle: {
|
12242
|
+
color: '#2c3641'
|
12243
|
+
}
|
12244
|
+
},
|
12245
|
+
axisTick: {
|
12246
|
+
show: false
|
12247
|
+
},
|
12248
|
+
data: xdata
|
12249
|
+
}],
|
12250
|
+
yAxis: [{
|
12251
|
+
type: 'value',
|
12252
|
+
splitLine: {
|
12253
|
+
lineStyle: {
|
12254
|
+
color: '#2c3641'
|
12255
|
+
}
|
12256
|
+
},
|
12257
|
+
axisLabel: {
|
12258
|
+
fontSize: calcWidth(24),
|
12259
|
+
color: '#ccf8fb',
|
12260
|
+
margin: 20
|
12261
|
+
},
|
12262
|
+
axisLine: {
|
12263
|
+
show: true,
|
12264
|
+
lineStyle: {
|
12265
|
+
color: '#2c3641'
|
12266
|
+
}
|
12267
|
+
},
|
12268
|
+
axisTick: {
|
12269
|
+
show: false
|
12270
|
+
}
|
12271
|
+
}],
|
12272
|
+
series: list === null || list === void 0 ? void 0 : list.map(function (item) {
|
12273
|
+
return {
|
12274
|
+
name: item.name,
|
12275
|
+
type: 'line',
|
12276
|
+
sampling: 'lttb',
|
12277
|
+
symbolSize: 8,
|
12278
|
+
itemStyle: {
|
12279
|
+
color: item.color
|
12280
|
+
},
|
12281
|
+
zlevel: 3,
|
12282
|
+
lineStyle: {
|
12283
|
+
normal: {
|
12284
|
+
width: calcWidth(2),
|
12285
|
+
color: item.color
|
12286
|
+
}
|
12287
|
+
},
|
12288
|
+
data: item.data
|
12289
|
+
};
|
12290
|
+
})
|
12291
|
+
};
|
12292
|
+
};
|
12293
|
+
|
12294
|
+
function LineEcharts(_ref2) {
|
12295
|
+
var config = _ref2.config;
|
12296
|
+
console.log(config);
|
12297
|
+
return /*#__PURE__*/React__default['default'].createElement(ReactECharts, {
|
12298
|
+
option: lineOption(config),
|
12299
|
+
style: {
|
12300
|
+
height: '100%'
|
12301
|
+
}
|
12302
|
+
});
|
12303
|
+
}
|
12304
|
+
|
11665
12305
|
exports.AutoScroll = Index$9;
|
11666
12306
|
exports.Breadcrumb = Index$b;
|
11667
12307
|
exports.Button = WButton;
|
@@ -11673,6 +12313,7 @@ exports.DatePicker = Index$1;
|
|
11673
12313
|
exports.IconFont = index;
|
11674
12314
|
exports.Input = Index;
|
11675
12315
|
exports.InputNumber = WInputNumber;
|
12316
|
+
exports.LineEcharts = LineEcharts;
|
11676
12317
|
exports.Modal = Modal;
|
11677
12318
|
exports.ModalForm = ModalForm$1;
|
11678
12319
|
exports.ModalTips = Modal$1;
|