@cloud-app-dev/vidc 4.0.7 → 4.0.9
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/.dumirc.ts +0 -10
- package/.fatherrc.ts +1 -4
- package/es/AppContext/Sync.js +10 -24
- package/es/AppContext/index.js +19 -19
- package/es/AppContext/static.js +0 -6
- package/es/Auth/index.js +2 -5
- package/es/AutoExit/index.js +2 -2
- package/es/CheckGroupFixed/demo.js +0 -2
- package/es/CheckGroupFixed/index.js +25 -42
- package/es/CustomRenderSelect/index.js +2 -2
- package/es/DisableMark/index.js +2 -2
- package/es/DomMove/index.js +31 -42
- package/es/DomMove/utils.js +3 -8
- package/es/Drag/DragAndDropItem.js +28 -45
- package/es/Drag/DropItem.js +11 -21
- package/es/DynamicGridList/Demo.js +1 -13
- package/es/DynamicList/demo.js +1 -10
- package/es/DynamicList/index.js +27 -41
- package/es/ErrorFallback/index.js +1 -3
- package/es/EventTools/index.d.ts +3 -0
- package/es/EventTools/index.js +12 -0
- package/es/GridList/Demo.js +5 -18
- package/es/GridList/utils.js +0 -1
- package/es/HightLevel/index.js +1 -5
- package/es/IconFont/index.js +9 -18
- package/es/InstanceHistory/index.js +0 -2
- package/es/ListWithSizeAnimate/index.js +15 -31
- package/es/LoaderScript/index.js +10 -21
- package/es/LoaderScript/utils.js +2 -2
- package/es/Map/BasicMap/AMapInstance.js +6 -16
- package/es/Map/BasicMap/LeafletInstance.js +16 -26
- package/es/Map/ClusterLayer/hook.js +16 -38
- package/es/Map/ClusterLayer/index.js +2 -6
- package/es/Map/Context/index.js +6 -30
- package/es/Map/FindPio/index.js +0 -2
- package/es/Map/LevelCenter/DragMarker/index.js +6 -9
- package/es/Map/LevelCenter/demo.js +12 -21
- package/es/Map/LevelCenter/index.js +8 -14
- package/es/Map/LoaderMap/index.js +14 -17
- package/es/Map/MapDrawSelect/demo.js +14 -25
- package/es/Map/MapDrawSelect/index.js +14 -20
- package/es/Map/MouseTool/index.js +17 -27
- package/es/Map/MouseTool/useMouseTools.js +12 -35
- package/es/Map/ResetTools/index.js +4 -8
- package/es/Map/SinglePoint/index.js +6 -13
- package/es/Map/hook/useMapEvent.js +3 -7
- package/es/Map/hook/useMapType.js +1 -2
- package/es/Map/useMarker/index.js +17 -30
- package/es/Map/withMap/index.js +4 -6
- package/es/Picture/component/DefaultRects/RectInfo.js +13 -27
- package/es/Picture/component/DefaultRects/index.js +7 -10
- package/es/Picture/component/DrawRect/index.js +10 -13
- package/es/Picture/component/RectMenu/index.js +10 -15
- package/es/Picture/component/RectMenu/utils.js +3 -6
- package/es/Picture/component/WheelScale/index.js +3 -5
- package/es/Picture/loadCaptureRectImage.js +42 -61
- package/es/Picture/useDraw.js +23 -39
- package/es/Player/api/index.js +2 -2
- package/es/Player/context.js +5 -9
- package/es/Player/contraller_bar/bar.js +9 -16
- package/es/Player/contraller_bar/contraller_event.js +7 -25
- package/es/Player/contraller_bar/index.js +7 -9
- package/es/Player/contraller_bar/left_bar.js +17 -29
- package/es/Player/contraller_bar/time.js +5 -14
- package/es/Player/contraller_bar/useBarStatus.js +12 -24
- package/es/Player/contraller_bar/volume.js +9 -29
- package/es/Player/event/eventName.js +1 -1
- package/es/Player/event/index.js +28 -63
- package/es/Player/frontend_player.js +16 -27
- package/es/Player/iconfont.js +6 -12
- package/es/Player/live_heart.js +2 -18
- package/es/Player/message.js +15 -35
- package/es/Player/segment_player.js +48 -86
- package/es/Player/single_player.js +1 -1
- package/es/Player/timeline.js +19 -41
- package/es/PlayerExt/demo.js +15 -25
- package/es/PlayerExt/index.js +29 -51
- package/es/ROI/demo.js +0 -2
- package/es/ScreenPlayer/RatePick.js +8 -10
- package/es/ScreenPlayer/Record.js +11 -32
- package/es/ScreenPlayer/TimeMode.js +1 -3
- package/es/ScreenPlayer/useTimeSlider.js +3 -3
- package/es/ScreenPlayer/useVideoFit.js +8 -21
- package/es/SocketEmitter/eventEmitter.d.ts +27 -0
- package/es/SocketEmitter/eventEmitter.js +87 -0
- package/es/SocketEmitter/index.d.ts +24 -0
- package/es/SocketEmitter/index.js +125 -0
- package/es/SocketEmitter/interface.d.ts +4 -0
- package/es/ThemeAntd/demo.js +0 -2
- package/es/VList/utils.js +2 -3
- package/es/bigNumberTransformCN/index.d.ts +5 -0
- package/es/bigNumberTransformCN/index.js +60 -0
- package/es/cache/index.d.ts +34 -0
- package/es/cache/index.js +94 -0
- package/es/copy/index.d.ts +1 -0
- package/es/copy/index.js +9 -0
- package/es/getThemeStyle/index.d.ts +2 -0
- package/es/getThemeStyle/index.js +5 -0
- package/es/index.d.ts +11 -0
- package/es/index.js +12 -1
- package/es/logger/index.d.ts +7 -0
- package/es/logger/index.js +30 -0
- package/es/nextTick/index.d.ts +1 -0
- package/es/nextTick/index.js +7 -0
- package/es/submidstr/index.d.ts +5 -0
- package/es/submidstr/index.js +14 -0
- package/es/treeHelper/index.d.ts +11 -0
- package/es/treeHelper/index.js +173 -0
- package/es/useEventEmitterHandle/index.js +5 -9
- package/es/useFullscreen/demo.js +8 -18
- package/es/useFullscreen/index.js +7 -28
- package/es/useHistory/index.js +0 -2
- package/es/useRafInterval/index.js +3 -27
- package/es/useSimpleState/index.js +11 -22
- package/es/useVirtualList/index.js +21 -57
- package/es/utils.js +2 -2
- package/es/uuid/index.d.ts +4 -0
- package/es/uuid/index.js +15 -0
- package/package.json +4 -5
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
6
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
7
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
8
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
9
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
11
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
12
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
14
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
16
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
17
|
+
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
18
|
+
import EventEmitter from "./eventEmitter";
|
|
19
|
+
import logger from "../logger";
|
|
20
|
+
import cache from "../cache";
|
|
21
|
+
import io from 'socket.io-client';
|
|
22
|
+
var SocketEmitter = /*#__PURE__*/function (_EventEmitter) {
|
|
23
|
+
_inherits(SocketEmitter, _EventEmitter);
|
|
24
|
+
var _super = _createSuper(SocketEmitter);
|
|
25
|
+
function SocketEmitter() {
|
|
26
|
+
var _this;
|
|
27
|
+
_classCallCheck(this, SocketEmitter);
|
|
28
|
+
_this = _super.call(this);
|
|
29
|
+
_defineProperty(_assertThisInitialized(_this), "sokect", void 0);
|
|
30
|
+
_defineProperty(_assertThisInitialized(_this), "sokectEvents", void 0);
|
|
31
|
+
_defineProperty(_assertThisInitialized(_this), "subActions", void 0);
|
|
32
|
+
_this.sokectEvents = [];
|
|
33
|
+
_this.subActions = {};
|
|
34
|
+
return _this;
|
|
35
|
+
}
|
|
36
|
+
_createClass(SocketEmitter, [{
|
|
37
|
+
key: "connect",
|
|
38
|
+
value: function connect(url, options) {
|
|
39
|
+
if (this.sokect && this.sokect.connected) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
var token = cache.getCache('token', 'session');
|
|
43
|
+
logger.debug('第一次尝试连接socket');
|
|
44
|
+
this.sokect = io(url, _objectSpread({
|
|
45
|
+
path: '/socket.io',
|
|
46
|
+
query: {
|
|
47
|
+
token: token
|
|
48
|
+
},
|
|
49
|
+
transports: ['websocket']
|
|
50
|
+
}, options));
|
|
51
|
+
this.sokect.on('connect', function () {
|
|
52
|
+
logger.debug('socket连接成功');
|
|
53
|
+
});
|
|
54
|
+
this.sokect.on('disconnect', function () {
|
|
55
|
+
logger.debug('socket断开连接');
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
59
|
+
key: "disconnect",
|
|
60
|
+
value: function disconnect() {
|
|
61
|
+
this.clear();
|
|
62
|
+
this.sokect && this.sokect.disconnect();
|
|
63
|
+
this.sokect = null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 抽象socket监听方法
|
|
68
|
+
* @param {*} param0
|
|
69
|
+
*/
|
|
70
|
+
}, {
|
|
71
|
+
key: "subscribe",
|
|
72
|
+
value: function subscribe(eventName, listener) {
|
|
73
|
+
this.on(eventName, listener);
|
|
74
|
+
if (this.sokectEvents.includes(eventName) || !this.sokect) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
this.sokectEvents.push(eventName);
|
|
78
|
+
this.subActions[eventName] = this.subAction(eventName);
|
|
79
|
+
this.sokect && this.sokect.on(eventName, this.subActions[eventName]);
|
|
80
|
+
logger.debug("socket.io listener event -> ".concat(eventName));
|
|
81
|
+
}
|
|
82
|
+
}, {
|
|
83
|
+
key: "subAction",
|
|
84
|
+
value: function subAction(eventName) {
|
|
85
|
+
var _this2 = this;
|
|
86
|
+
return function (data) {
|
|
87
|
+
var json;
|
|
88
|
+
try {
|
|
89
|
+
json = JSON.parse(data);
|
|
90
|
+
} catch (e) {
|
|
91
|
+
json = data;
|
|
92
|
+
}
|
|
93
|
+
_this2.emit(eventName, json);
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* 抽象socket监听方法
|
|
99
|
+
* @param {*} param0
|
|
100
|
+
*/
|
|
101
|
+
}, {
|
|
102
|
+
key: "unsubscribe",
|
|
103
|
+
value: function unsubscribe(eventName, listener) {
|
|
104
|
+
this.off(eventName, listener);
|
|
105
|
+
this.sokect && this.sokect.off(eventName, this.subActions[eventName]);
|
|
106
|
+
delete this.subActions[eventName];
|
|
107
|
+
this.sokectEvents = this.sokectEvents.filter(function (v) {
|
|
108
|
+
return v !== eventName;
|
|
109
|
+
});
|
|
110
|
+
logger.debug("socket.io unlistener event -> ".concat(eventName));
|
|
111
|
+
}
|
|
112
|
+
}]);
|
|
113
|
+
return SocketEmitter;
|
|
114
|
+
}(EventEmitter);
|
|
115
|
+
var _global = window;
|
|
116
|
+
var event = new SocketEmitter();
|
|
117
|
+
var LMEvent = function () {
|
|
118
|
+
if (_global._LM_EVENT_) {
|
|
119
|
+
return _global._LM_EVENT_;
|
|
120
|
+
} else {
|
|
121
|
+
_global._LM_EVENT_ = event;
|
|
122
|
+
return event;
|
|
123
|
+
}
|
|
124
|
+
}();
|
|
125
|
+
export default LMEvent;
|
package/es/ThemeAntd/demo.js
CHANGED
|
@@ -4,7 +4,6 @@ import ThemeAntd from '.';
|
|
|
4
4
|
import "./demo.less";
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
6
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
|
|
8
7
|
var App = function App() {
|
|
9
8
|
var ref = useRef(null);
|
|
10
9
|
return /*#__PURE__*/_jsx(ConfigProvider, {
|
|
@@ -127,5 +126,4 @@ var App = function App() {
|
|
|
127
126
|
})
|
|
128
127
|
});
|
|
129
128
|
};
|
|
130
|
-
|
|
131
129
|
export default App;
|
package/es/VList/utils.js
CHANGED
|
@@ -4,11 +4,10 @@ export function renderRowItem(rowRenderer, renderItem, data) {
|
|
|
4
4
|
if (rowRenderer) {
|
|
5
5
|
return rowRenderer;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
7
|
return function (_ref) {
|
|
9
8
|
var key = _ref.key,
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
index = _ref.index,
|
|
10
|
+
style = _ref.style;
|
|
12
11
|
var item = data[index];
|
|
13
12
|
return /*#__PURE__*/_jsx("div", {
|
|
14
13
|
style: style,
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 大数字转换,将大额数字转换为万、千万、亿等
|
|
3
|
+
* @param value 数字值
|
|
4
|
+
*/
|
|
5
|
+
export default function bigNumberTransformCN(value) {
|
|
6
|
+
var newValue = ['', '', ''];
|
|
7
|
+
var fr = 1000;
|
|
8
|
+
var num = 3;
|
|
9
|
+
var text1 = '';
|
|
10
|
+
var fm = 1;
|
|
11
|
+
while (value / fr >= 1) {
|
|
12
|
+
fr *= 10;
|
|
13
|
+
num += 1;
|
|
14
|
+
// console.log('数字', value / fr, 'num:', num)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (num <= 4) {
|
|
18
|
+
// 千
|
|
19
|
+
newValue[0] = "".concat(Math.round(value / 1000));
|
|
20
|
+
newValue[1] = '千';
|
|
21
|
+
} else if (num <= 8) {
|
|
22
|
+
// 万
|
|
23
|
+
text1 = Math.round(num - 4) / 3 > 1 ? '千万' : '万';
|
|
24
|
+
// tslint:disable-next-line:no-shadowed-variable
|
|
25
|
+
fm = text1 === '万' ? 10000 : 10000000;
|
|
26
|
+
if (value % fm === 0) {
|
|
27
|
+
newValue[0] = Math.round(value / fm) + '';
|
|
28
|
+
} else {
|
|
29
|
+
newValue[0] = Math.round(value / fm).toFixed(2) + '';
|
|
30
|
+
}
|
|
31
|
+
newValue[1] = text1;
|
|
32
|
+
} else if (num <= 16) {
|
|
33
|
+
// 亿
|
|
34
|
+
text1 = (num - 8) / 3 > 1 ? '千亿' : '亿';
|
|
35
|
+
text1 = (num - 8) / 4 > 1 ? '万亿' : text1;
|
|
36
|
+
text1 = (num - 8) / 7 > 1 ? '千万亿' : text1;
|
|
37
|
+
// tslint:disable-next-line:no-shadowed-variable
|
|
38
|
+
fm = 1;
|
|
39
|
+
if (text1 === '亿') {
|
|
40
|
+
fm = 100000000;
|
|
41
|
+
} else if (text1 === '千亿') {
|
|
42
|
+
fm = 100000000000;
|
|
43
|
+
} else if (text1 === '万亿') {
|
|
44
|
+
fm = 1000000000000;
|
|
45
|
+
} else if (text1 === '千万亿') {
|
|
46
|
+
fm = 1000000000000000;
|
|
47
|
+
}
|
|
48
|
+
if (value % fm === 0) {
|
|
49
|
+
newValue[0] = Math.round(value / fm) + '';
|
|
50
|
+
} else {
|
|
51
|
+
newValue[0] = Math.round(value / fm).toFixed(2) + '';
|
|
52
|
+
}
|
|
53
|
+
newValue[1] = text1;
|
|
54
|
+
}
|
|
55
|
+
if (value < 1000) {
|
|
56
|
+
newValue[0] = value + '';
|
|
57
|
+
newValue[1] = '';
|
|
58
|
+
}
|
|
59
|
+
return newValue.join('');
|
|
60
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
declare type CacheType = 'local' | 'session' | 'cookie';
|
|
2
|
+
/**
|
|
3
|
+
* 获取缓存数据
|
|
4
|
+
* @param {string} key
|
|
5
|
+
* @param {string} type: 缓存类型 'local'(默认) / cookie / session;
|
|
6
|
+
*/
|
|
7
|
+
declare function getCache(key: string, type?: CacheType): any;
|
|
8
|
+
/**
|
|
9
|
+
* 获取缓存数据
|
|
10
|
+
* @param {string} key
|
|
11
|
+
* @param {any} value
|
|
12
|
+
* @param {string} type: 缓存类型 'local'(默认) / cookie / session;
|
|
13
|
+
*/
|
|
14
|
+
declare function setCache(key: string, value: any, type?: CacheType): void;
|
|
15
|
+
/**
|
|
16
|
+
* 获取用户缓存
|
|
17
|
+
* @param {*} key
|
|
18
|
+
* @param {*} type
|
|
19
|
+
*/
|
|
20
|
+
declare function getUserCache(key: string, type?: CacheType): any;
|
|
21
|
+
/**
|
|
22
|
+
* 设置用户缓存
|
|
23
|
+
* @param {*} key
|
|
24
|
+
* @param {*} value
|
|
25
|
+
* @param {*} type
|
|
26
|
+
*/
|
|
27
|
+
declare function setUserCache(key: string, value: any, type?: CacheType): void;
|
|
28
|
+
declare const _default: {
|
|
29
|
+
getCache: typeof getCache;
|
|
30
|
+
setCache: typeof setCache;
|
|
31
|
+
getUserCache: typeof getUserCache;
|
|
32
|
+
setUserCache: typeof setUserCache;
|
|
33
|
+
};
|
|
34
|
+
export default _default;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import Cookie from 'js-cookie';
|
|
2
|
+
/**
|
|
3
|
+
* 获取缓存数据
|
|
4
|
+
* @param {string} key
|
|
5
|
+
* @param {string} type: 缓存类型 'local'(默认) / cookie / session;
|
|
6
|
+
*/
|
|
7
|
+
function getCache(key) {
|
|
8
|
+
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'local';
|
|
9
|
+
var data;
|
|
10
|
+
switch (type) {
|
|
11
|
+
case 'cookie':
|
|
12
|
+
data = Cookie.get(key);
|
|
13
|
+
break;
|
|
14
|
+
case 'session':
|
|
15
|
+
// eslint-disable-next-line no-case-declarations
|
|
16
|
+
var strS = sessionStorage.getItem(key);
|
|
17
|
+
try {
|
|
18
|
+
data = JSON.parse(strS);
|
|
19
|
+
} catch (e) {
|
|
20
|
+
data = strS;
|
|
21
|
+
}
|
|
22
|
+
break;
|
|
23
|
+
default:
|
|
24
|
+
// eslint-disable-next-line no-case-declarations
|
|
25
|
+
var strL = localStorage.getItem(key);
|
|
26
|
+
try {
|
|
27
|
+
data = JSON.parse(strL);
|
|
28
|
+
} catch (e) {
|
|
29
|
+
data = strL;
|
|
30
|
+
}
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 获取缓存数据
|
|
38
|
+
* @param {string} key
|
|
39
|
+
* @param {any} value
|
|
40
|
+
* @param {string} type: 缓存类型 'local'(默认) / cookie / session;
|
|
41
|
+
*/
|
|
42
|
+
function setCache(key, value) {
|
|
43
|
+
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'local';
|
|
44
|
+
switch (type) {
|
|
45
|
+
case 'cookie':
|
|
46
|
+
Cookie.set(key, value, {
|
|
47
|
+
expires: 7
|
|
48
|
+
});
|
|
49
|
+
break;
|
|
50
|
+
case 'session':
|
|
51
|
+
sessionStorage.setItem(key, JSON.stringify(value));
|
|
52
|
+
break;
|
|
53
|
+
default:
|
|
54
|
+
localStorage.setItem(key, JSON.stringify(value));
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 获取用户缓存
|
|
61
|
+
* @param {*} key
|
|
62
|
+
* @param {*} type
|
|
63
|
+
*/
|
|
64
|
+
function getUserCache(key) {
|
|
65
|
+
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'local';
|
|
66
|
+
var id = getCache('userId', 'session');
|
|
67
|
+
if (!id) {
|
|
68
|
+
console.error('无法获取用户信息!');
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
return getCache("".concat(id, "-").concat(key), type);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 设置用户缓存
|
|
76
|
+
* @param {*} key
|
|
77
|
+
* @param {*} value
|
|
78
|
+
* @param {*} type
|
|
79
|
+
*/
|
|
80
|
+
function setUserCache(key, value) {
|
|
81
|
+
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'local';
|
|
82
|
+
var id = getCache('userId', 'session');
|
|
83
|
+
if (!id) {
|
|
84
|
+
console.error('无法获取用户信息!');
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
return setCache("".concat(id, "-").concat(key), value, type);
|
|
88
|
+
}
|
|
89
|
+
export default {
|
|
90
|
+
getCache: getCache,
|
|
91
|
+
setCache: setCache,
|
|
92
|
+
getUserCache: getUserCache,
|
|
93
|
+
setUserCache: setUserCache
|
|
94
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function copy(text: string): void;
|
package/es/copy/index.js
ADDED
package/es/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { default as Drag } from './Drag';
|
|
|
11
11
|
export { default as DynamicGridList } from './DynamicGridList';
|
|
12
12
|
export { default as DynamicList } from './DynamicList';
|
|
13
13
|
export { default as ErrorFallback } from './ErrorFallback';
|
|
14
|
+
export { default as EventTools } from './EventTools';
|
|
14
15
|
export { default as FrontendPlayer } from './FrontendPlayer';
|
|
15
16
|
export { default as FullScreen } from './FullScreen';
|
|
16
17
|
export { default as GridList } from './GridList';
|
|
@@ -35,10 +36,19 @@ export { default as RefModal } from './RefModal';
|
|
|
35
36
|
export { default as ScreenPlayer } from './ScreenPlayer';
|
|
36
37
|
export { default as SegmentPlayer } from './SegmentPlayer';
|
|
37
38
|
export { default as Service } from './Service';
|
|
39
|
+
export { default as SocketEmitter } from './SocketEmitter';
|
|
38
40
|
export { default as TableLayout } from './TableLayout';
|
|
39
41
|
export { default as ThemeAntd } from './ThemeAntd';
|
|
40
42
|
export { default as Timeout } from './Timeout';
|
|
41
43
|
export { default as VList } from './VList';
|
|
44
|
+
export { default as bigNumberTransformCN } from './bigNumberTransformCN';
|
|
45
|
+
export { default as cache } from './cache';
|
|
46
|
+
export { default as copy } from './copy';
|
|
47
|
+
export { default as getThemeStyle } from './getThemeStyle';
|
|
48
|
+
export { default as logger } from './logger';
|
|
49
|
+
export { default as nextTick } from './nextTick';
|
|
50
|
+
export { default as submidstr } from './submidstr';
|
|
51
|
+
export { default as treeHelper } from './treeHelper';
|
|
42
52
|
export { default as useDrawROI } from './useDrawROI';
|
|
43
53
|
export { default as useEventEmitterHandle } from './useEventEmitterHandle';
|
|
44
54
|
export { default as useFullscreen } from './useFullscreen';
|
|
@@ -47,3 +57,4 @@ export { default as useInfiniteScroll } from './useInfiniteScroll';
|
|
|
47
57
|
export { default as useRafInterval } from './useRafInterval';
|
|
48
58
|
export { default as useSimpleState } from './useSimpleState';
|
|
49
59
|
export { default as useVirtualList } from './useVirtualList';
|
|
60
|
+
export { default as uuid } from './uuid';
|
package/es/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export { default as Drag } from "./Drag";
|
|
|
11
11
|
export { default as DynamicGridList } from "./DynamicGridList";
|
|
12
12
|
export { default as DynamicList } from "./DynamicList";
|
|
13
13
|
export { default as ErrorFallback } from "./ErrorFallback";
|
|
14
|
+
export { default as EventTools } from "./EventTools";
|
|
14
15
|
export { default as FrontendPlayer } from "./FrontendPlayer";
|
|
15
16
|
export { default as FullScreen } from "./FullScreen";
|
|
16
17
|
export { default as GridList } from "./GridList";
|
|
@@ -35,10 +36,19 @@ export { default as RefModal } from "./RefModal";
|
|
|
35
36
|
export { default as ScreenPlayer } from "./ScreenPlayer";
|
|
36
37
|
export { default as SegmentPlayer } from "./SegmentPlayer";
|
|
37
38
|
export { default as Service } from "./Service";
|
|
39
|
+
export { default as SocketEmitter } from "./SocketEmitter";
|
|
38
40
|
export { default as TableLayout } from "./TableLayout";
|
|
39
41
|
export { default as ThemeAntd } from "./ThemeAntd";
|
|
40
42
|
export { default as Timeout } from "./Timeout";
|
|
41
43
|
export { default as VList } from "./VList";
|
|
44
|
+
export { default as bigNumberTransformCN } from "./bigNumberTransformCN";
|
|
45
|
+
export { default as cache } from "./cache";
|
|
46
|
+
export { default as copy } from "./copy";
|
|
47
|
+
export { default as getThemeStyle } from "./getThemeStyle";
|
|
48
|
+
export { default as logger } from "./logger";
|
|
49
|
+
export { default as nextTick } from "./nextTick";
|
|
50
|
+
export { default as submidstr } from "./submidstr";
|
|
51
|
+
export { default as treeHelper } from "./treeHelper";
|
|
42
52
|
export { default as useDrawROI } from "./useDrawROI";
|
|
43
53
|
export { default as useEventEmitterHandle } from "./useEventEmitterHandle";
|
|
44
54
|
export { default as useFullscreen } from "./useFullscreen";
|
|
@@ -46,4 +56,5 @@ export { default as useHistory } from "./useHistory";
|
|
|
46
56
|
export { default as useInfiniteScroll } from "./useInfiniteScroll";
|
|
47
57
|
export { default as useRafInterval } from "./useRafInterval";
|
|
48
58
|
export { default as useSimpleState } from "./useSimpleState";
|
|
49
|
-
export { default as useVirtualList } from "./useVirtualList";
|
|
59
|
+
export { default as useVirtualList } from "./useVirtualList";
|
|
60
|
+
export { default as uuid } from "./uuid";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
debug: function debug(title) {
|
|
3
|
+
var _console;
|
|
4
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
5
|
+
args[_key - 1] = arguments[_key];
|
|
6
|
+
}
|
|
7
|
+
(_console = console).debug.apply(_console, ["%c[DEBUG] -> ".concat(title), 'color:white;background-color:blue'].concat(args));
|
|
8
|
+
},
|
|
9
|
+
success: function success(title) {
|
|
10
|
+
var _console2;
|
|
11
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
12
|
+
args[_key2 - 1] = arguments[_key2];
|
|
13
|
+
}
|
|
14
|
+
(_console2 = console).debug.apply(_console2, ["%c[SUCCESS] -> ".concat(title), 'color:white;background-color:green'].concat(args));
|
|
15
|
+
},
|
|
16
|
+
error: function error(title) {
|
|
17
|
+
var _console3;
|
|
18
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
19
|
+
args[_key3 - 1] = arguments[_key3];
|
|
20
|
+
}
|
|
21
|
+
(_console3 = console).error.apply(_console3, ["%c[ERROR] -> ".concat(title), 'color:white;background-color:red'].concat(args));
|
|
22
|
+
},
|
|
23
|
+
warn: function warn(title) {
|
|
24
|
+
var _console4;
|
|
25
|
+
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
26
|
+
args[_key4 - 1] = arguments[_key4];
|
|
27
|
+
}
|
|
28
|
+
(_console4 = console).error.apply(_console4, ["%c[WARN] -> ".concat(title), 'color:white;background-color:yellow'].concat(args));
|
|
29
|
+
}
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function nextTick(fn: () => void, mode?: string): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 文字超出中间省略号
|
|
3
|
+
* @param {string} str
|
|
4
|
+
*/
|
|
5
|
+
export default function submidstr(str) {
|
|
6
|
+
var replaceLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 4;
|
|
7
|
+
if (str.length > replaceLength * 2) {
|
|
8
|
+
var arr1 = str.substring(0, replaceLength);
|
|
9
|
+
var arr2 = str.substring(str.length - replaceLength, replaceLength);
|
|
10
|
+
return "".concat(arr1, "...").concat(arr2);
|
|
11
|
+
} else {
|
|
12
|
+
return str;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare function computPlaceTree<T>(list: T[], isNoDeep?: boolean): T[];
|
|
2
|
+
declare function computPlaceTreeHasUnknown<T>(list: T[], isNoDeep?: boolean): T[];
|
|
3
|
+
declare function computTreeList<T>(list: T[], id?: string, pid?: string, isNoDeep?: boolean): T[];
|
|
4
|
+
declare function computTreeList2<T>(list: T[], key?: string, pKey?: string): T[];
|
|
5
|
+
declare const _default: {
|
|
6
|
+
computPlaceTree: typeof computPlaceTree;
|
|
7
|
+
computTreeList: typeof computTreeList;
|
|
8
|
+
computTreeList2: typeof computTreeList2;
|
|
9
|
+
computPlaceTreeHasUnknown: typeof computPlaceTreeHasUnknown;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|