@cloud-app-dev/vidc 3.1.2 → 3.1.4
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/es/PlayerExt/index.d.ts +5 -1
- package/es/PlayerExt/index.js +20 -3
- package/es/ScreenPlayer/PlayerWithExt.d.ts +4 -2
- package/es/ScreenPlayer/PlayerWithExt.js +8 -4
- package/es/ScreenPlayer/Record.d.ts +1 -1
- package/es/ScreenPlayer/Record.js +23 -7
- package/es/ScreenPlayer/demo2.js +14 -1
- package/es/ScreenPlayer/interface.d.ts +4 -0
- package/es/ScreenPlayer/useRecordList.d.ts +6 -1
- package/es/ScreenPlayer/useRecordList.js +60 -34
- package/es/ThemeAntd/index.css +13 -0
- package/es/ThemeAntd/style/picker.css +10 -0
- package/es/ThemeAntd/style/table.css +3 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/useSimpleState/index.d.ts +3 -0
- package/es/useSimpleState/index.js +41 -0
- package/package.json +1 -1
package/es/PlayerExt/index.d.ts
CHANGED
|
@@ -20,6 +20,10 @@ export interface IPluginProps {
|
|
|
20
20
|
* @default ''
|
|
21
21
|
*/
|
|
22
22
|
pluginParams?: string;
|
|
23
|
+
/**
|
|
24
|
+
* 正在获取视频数据
|
|
25
|
+
*/
|
|
26
|
+
loading?: boolean;
|
|
23
27
|
}
|
|
24
28
|
/**
|
|
25
29
|
* 客户端插件模式,随机端口
|
|
@@ -40,5 +44,5 @@ export declare function getLocalPlayPath(url: string, params?: string): string;
|
|
|
40
44
|
export declare function usePlugin(mode: PlayModeType, key: any): {
|
|
41
45
|
needInstall: boolean;
|
|
42
46
|
};
|
|
43
|
-
export declare function ExtModel({ url, children, mode, pluginDownloadUrl, segments, pluginParams }: IPluginProps): JSX.Element;
|
|
47
|
+
export declare function ExtModel({ url, children, mode, pluginDownloadUrl, segments, pluginParams, loading }: IPluginProps): JSX.Element;
|
|
44
48
|
export { ExtModel as default };
|
package/es/PlayerExt/index.js
CHANGED
|
@@ -10,6 +10,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
10
10
|
|
|
11
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
12
|
|
|
13
|
+
/* eslint-disable jsx-a11y/anchor-is-valid */
|
|
13
14
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
14
15
|
import IconFont from '../Player/iconfont';
|
|
15
16
|
import "./index.css";
|
|
@@ -78,7 +79,8 @@ export function ExtModel(_ref) {
|
|
|
78
79
|
mode = _ref.mode,
|
|
79
80
|
pluginDownloadUrl = _ref.pluginDownloadUrl,
|
|
80
81
|
segments = _ref.segments,
|
|
81
|
-
pluginParams = _ref.pluginParams
|
|
82
|
+
pluginParams = _ref.pluginParams,
|
|
83
|
+
loading = _ref.loading;
|
|
82
84
|
|
|
83
85
|
var _useState3 = useState({
|
|
84
86
|
forceKey: Date.now()
|
|
@@ -94,7 +96,8 @@ export function ExtModel(_ref) {
|
|
|
94
96
|
}, [url, segments]);
|
|
95
97
|
|
|
96
98
|
var _usePlugin = usePlugin(mode, state.forceKey),
|
|
97
|
-
needInstall = _usePlugin.needInstall;
|
|
99
|
+
needInstall = _usePlugin.needInstall; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
100
|
+
|
|
98
101
|
|
|
99
102
|
var playUrl = useMemo(function () {
|
|
100
103
|
return mode === 2 && url ? getLocalPlayPath(url, pluginParams) : url;
|
|
@@ -105,7 +108,8 @@ export function ExtModel(_ref) {
|
|
|
105
108
|
url: v.url ? getLocalPlayPath(v.url, pluginParams) : v.url
|
|
106
109
|
});
|
|
107
110
|
}) : segments;
|
|
108
|
-
},
|
|
111
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
112
|
+
[segments, mode]);
|
|
109
113
|
|
|
110
114
|
if (needInstall) {
|
|
111
115
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -140,6 +144,19 @@ export function ExtModel(_ref) {
|
|
|
140
144
|
}, "\u91CD\u8BD5")))));
|
|
141
145
|
}
|
|
142
146
|
|
|
147
|
+
if (loading) {
|
|
148
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
149
|
+
className: "lm-player-ext-layout"
|
|
150
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
151
|
+
style: {
|
|
152
|
+
marginTop: -60,
|
|
153
|
+
textAlign: 'center'
|
|
154
|
+
}
|
|
155
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(IconFont, {
|
|
156
|
+
type: "lm-player-PlaySource"
|
|
157
|
+
})), /*#__PURE__*/React.createElement("div", null, "\u6B63\u5728\u83B7\u53D6\u89C6\u9891\u6570\u636E\uFF0C\u8BF7\u7A0D\u7B49...")));
|
|
158
|
+
}
|
|
159
|
+
|
|
143
160
|
if (!hasUrl) {
|
|
144
161
|
return /*#__PURE__*/React.createElement("div", {
|
|
145
162
|
className: "lm-player-ext-layout"
|
|
@@ -14,11 +14,13 @@ interface ISegmentPlayerWithExtProps extends Omit<ILivePlayerWithExtProps, 'url'
|
|
|
14
14
|
begin?: number;
|
|
15
15
|
fpsDelay?: number;
|
|
16
16
|
fps?: number;
|
|
17
|
+
httpLoading: boolean;
|
|
17
18
|
}
|
|
18
|
-
export declare function SegmentPlayerWithExt({ begin, style, className, segments, updatePlayer, onClick, mode, fpsDelay, fps, ...props }: ISegmentPlayerWithExtProps): JSX.Element;
|
|
19
|
+
export declare function SegmentPlayerWithExt({ begin, style, className, segments, updatePlayer, onClick, mode, fpsDelay, fps, httpLoading, ...props }: ISegmentPlayerWithExtProps): JSX.Element;
|
|
19
20
|
interface IFrontendPlayerWithExtProps extends Omit<ILivePlayerWithExtProps, 'url'> {
|
|
20
21
|
segments?: ISegmentType[];
|
|
21
22
|
begin?: number;
|
|
23
|
+
httpLoading: boolean;
|
|
22
24
|
}
|
|
23
|
-
export declare function FrontendPlayerWithExt({ mode, style, className, segments, updatePlayer, onClick, pluginDownloadUrl }: IFrontendPlayerWithExtProps): JSX.Element;
|
|
25
|
+
export declare function FrontendPlayerWithExt({ mode, style, className, segments, updatePlayer, onClick, pluginDownloadUrl, httpLoading, }: IFrontendPlayerWithExtProps): JSX.Element;
|
|
24
26
|
export {};
|
|
@@ -76,7 +76,8 @@ export function SegmentPlayerWithExt(_a) {
|
|
|
76
76
|
mode = _a.mode,
|
|
77
77
|
fpsDelay = _a.fpsDelay,
|
|
78
78
|
fps = _a.fps,
|
|
79
|
-
|
|
79
|
+
httpLoading = _a.httpLoading,
|
|
80
|
+
props = __rest(_a, ["begin", "style", "className", "segments", "updatePlayer", "onClick", "mode", "fpsDelay", "fps", "httpLoading"]);
|
|
80
81
|
|
|
81
82
|
var forceUpdate = _useUpdate();
|
|
82
83
|
|
|
@@ -98,7 +99,8 @@ export function SegmentPlayerWithExt(_a) {
|
|
|
98
99
|
onDoubleClick: toggleFullscreen
|
|
99
100
|
}, /*#__PURE__*/React.createElement(ExtModel, {
|
|
100
101
|
segments: segments,
|
|
101
|
-
mode: mode
|
|
102
|
+
mode: mode,
|
|
103
|
+
loading: httpLoading
|
|
102
104
|
}, /*#__PURE__*/React.createElement(SegmentPlayer, Object.assign({}, props, {
|
|
103
105
|
segments: segments,
|
|
104
106
|
type: "hls",
|
|
@@ -118,7 +120,8 @@ export function FrontendPlayerWithExt(_ref) {
|
|
|
118
120
|
segments = _ref.segments,
|
|
119
121
|
updatePlayer = _ref.updatePlayer,
|
|
120
122
|
onClick = _ref.onClick,
|
|
121
|
-
pluginDownloadUrl = _ref.pluginDownloadUrl
|
|
123
|
+
pluginDownloadUrl = _ref.pluginDownloadUrl,
|
|
124
|
+
httpLoading = _ref.httpLoading;
|
|
122
125
|
|
|
123
126
|
var _a;
|
|
124
127
|
|
|
@@ -186,7 +189,8 @@ export function FrontendPlayerWithExt(_ref) {
|
|
|
186
189
|
}, /*#__PURE__*/React.createElement(ExtModel, {
|
|
187
190
|
segments: segments,
|
|
188
191
|
mode: mode,
|
|
189
|
-
pluginDownloadUrl: pluginDownloadUrl
|
|
192
|
+
pluginDownloadUrl: pluginDownloadUrl,
|
|
193
|
+
loading: httpLoading
|
|
190
194
|
}, /*#__PURE__*/React.createElement(FrontendPlayer, {
|
|
191
195
|
onSeek: seekTo,
|
|
192
196
|
url: state.url,
|
|
@@ -6,5 +6,5 @@ import './index.less';
|
|
|
6
6
|
* @param param0
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
|
-
declare function RecordPlayer({ list, children, queryRecord, onIndexChange, onClose, onCloseAll, download, snapshot, defaultScreen, screenChange, defaultSelectIndex, oneWinExtTools, allWinExtTools, fpsDelay, fps, ...options }: IRecordPlayerProps): JSX.Element;
|
|
9
|
+
declare function RecordPlayer({ list, children, queryRecord, onIndexChange, onClose, onCloseAll, download, snapshot, defaultScreen, screenChange, defaultSelectIndex, oneWinExtTools, allWinExtTools, fpsDelay, fps, queryRecordErrorHandle, ...options }: IRecordPlayerProps): JSX.Element;
|
|
10
10
|
export default RecordPlayer;
|
|
@@ -7,6 +7,8 @@ import _usePrevious from "ahooks/es/usePrevious";
|
|
|
7
7
|
|
|
8
8
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
9
9
|
|
|
10
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
11
|
+
|
|
10
12
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
11
13
|
|
|
12
14
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -15,8 +17,6 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
15
17
|
|
|
16
18
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
17
19
|
|
|
18
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
19
|
-
|
|
20
20
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
21
|
|
|
22
22
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -48,7 +48,8 @@ var defaultState = {
|
|
|
48
48
|
loading: false,
|
|
49
49
|
seekTo: 0,
|
|
50
50
|
mergeSegments: [],
|
|
51
|
-
timeMode: 24
|
|
51
|
+
timeMode: 24,
|
|
52
|
+
winLoadingStatus: []
|
|
52
53
|
};
|
|
53
54
|
/**
|
|
54
55
|
* @desc 录像设计的时间全部需要到毫秒
|
|
@@ -74,7 +75,8 @@ function RecordPlayer(_a) {
|
|
|
74
75
|
allWinExtTools = _a.allWinExtTools,
|
|
75
76
|
fpsDelay = _a.fpsDelay,
|
|
76
77
|
fps = _a.fps,
|
|
77
|
-
|
|
78
|
+
queryRecordErrorHandle = _a.queryRecordErrorHandle,
|
|
79
|
+
options = __rest(_a, ["list", "children", "queryRecord", "onIndexChange", "onClose", "onCloseAll", "download", "snapshot", "defaultScreen", "screenChange", "defaultSelectIndex", "oneWinExtTools", "allWinExtTools", "fpsDelay", "fps", "queryRecordErrorHandle"]);
|
|
78
80
|
|
|
79
81
|
var _useState = useState(Object.assign(Object.assign({}, cloneDeep(defaultState)), {
|
|
80
82
|
screenNum: defaultScreen !== null && defaultScreen !== void 0 ? defaultScreen : defaultState.screenNum
|
|
@@ -117,7 +119,19 @@ function RecordPlayer(_a) {
|
|
|
117
119
|
var prevListKey = _usePrevious(listKey); // 所有窗口播放信息
|
|
118
120
|
|
|
119
121
|
|
|
120
|
-
var recordList = useRecordList(state.mergeSegments, queryRecord
|
|
122
|
+
var recordList = useRecordList(state.mergeSegments, queryRecord, {
|
|
123
|
+
errorCallback: queryRecordErrorHandle !== null && queryRecordErrorHandle !== void 0 ? queryRecordErrorHandle : function () {},
|
|
124
|
+
loaddingCallback: function loaddingCallback(idx, loadding) {
|
|
125
|
+
return setState(function (old) {
|
|
126
|
+
var status = _toConsumableArray(old.winLoadingStatus);
|
|
127
|
+
|
|
128
|
+
status[idx] = loadding;
|
|
129
|
+
return Object.assign(Object.assign({}, old), {
|
|
130
|
+
winLoadingStatus: status
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}); // 缓存所有player对象
|
|
121
135
|
|
|
122
136
|
var playerRef = useRef([]); // 获取选中player对象
|
|
123
137
|
|
|
@@ -418,7 +432,8 @@ function RecordPlayer(_a) {
|
|
|
418
432
|
},
|
|
419
433
|
mode: (_d = item.mode) !== null && _d !== void 0 ? _d : state.modes[index],
|
|
420
434
|
fps: fps,
|
|
421
|
-
fpsDelay: fpsDelay
|
|
435
|
+
fpsDelay: fpsDelay,
|
|
436
|
+
httpLoading: state.winLoadingStatus[index]
|
|
422
437
|
})) : /*#__PURE__*/React.createElement(FrontendPlayerWithExt, Object.assign({}, item, {
|
|
423
438
|
className: state.selectIndex === index ? 'player-current-index' : '',
|
|
424
439
|
segments: ((_e = recordList[index]) === null || _e === void 0 ? void 0 : _e.segments) || [],
|
|
@@ -437,7 +452,8 @@ function RecordPlayer(_a) {
|
|
|
437
452
|
style: {
|
|
438
453
|
width: screenType.width,
|
|
439
454
|
height: screenType.height
|
|
440
|
-
}
|
|
455
|
+
},
|
|
456
|
+
httpLoading: state.winLoadingStatus[index]
|
|
441
457
|
}));
|
|
442
458
|
})), /*#__PURE__*/React.createElement("div", {
|
|
443
459
|
className: "player-tools-group"
|
package/es/ScreenPlayer/demo2.js
CHANGED
|
@@ -35,7 +35,10 @@ var query = function query(_ref) {
|
|
|
35
35
|
var cid = _ref.cid,
|
|
36
36
|
date = _ref.date,
|
|
37
37
|
recordType = _ref.recordType;
|
|
38
|
-
|
|
38
|
+
// return new Promise((reslove) => {
|
|
39
|
+
// setTimeout(() => reslove([]), 2000);
|
|
40
|
+
// });
|
|
41
|
+
// console.log(cid, date, recordType);
|
|
39
42
|
var m = moment(date);
|
|
40
43
|
var beginTime = m.set({
|
|
41
44
|
hours: 0,
|
|
@@ -111,6 +114,7 @@ export default function App() {
|
|
|
111
114
|
second: 0
|
|
112
115
|
}) : undefined;
|
|
113
116
|
}, [state.list, state.idx]);
|
|
117
|
+
console.log(state.list);
|
|
114
118
|
return /*#__PURE__*/React.createElement(_ConfigProvider, {
|
|
115
119
|
prefixCls: "cloudapp"
|
|
116
120
|
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_DatePicker, {
|
|
@@ -149,6 +153,15 @@ export default function App() {
|
|
|
149
153
|
});
|
|
150
154
|
});
|
|
151
155
|
},
|
|
156
|
+
queryRecordErrorHandle: function queryRecordErrorHandle(idx) {
|
|
157
|
+
var list = state.list;
|
|
158
|
+
list[idx] = undefined;
|
|
159
|
+
setState(function (old) {
|
|
160
|
+
return Object.assign(Object.assign({}, old), {
|
|
161
|
+
list: _toConsumableArray(list)
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
},
|
|
152
165
|
onClose: function onClose() {
|
|
153
166
|
var list = state.list;
|
|
154
167
|
list[state.idx] = undefined;
|
|
@@ -24,6 +24,8 @@ export interface IRecordPlayerProps {
|
|
|
24
24
|
*/
|
|
25
25
|
queryRecord: (options: { cid: string; date: number; recordType: 1 | 2 }) => Promise<ISegmentType[]>;
|
|
26
26
|
|
|
27
|
+
queryRecordErrorHandle?: (index: number) => void;
|
|
28
|
+
|
|
27
29
|
/**
|
|
28
30
|
* 窗口索引变化,后续基于索引传入播放必要数据
|
|
29
31
|
*/
|
|
@@ -122,6 +124,8 @@ export interface IRecordPlayerState {
|
|
|
122
124
|
* 录像时间轴单页绘制时长单位(hour)
|
|
123
125
|
*/
|
|
124
126
|
timeMode: number;
|
|
127
|
+
|
|
128
|
+
winLoadingStatus: boolean[];
|
|
125
129
|
}
|
|
126
130
|
|
|
127
131
|
export type ScreenItemLivePlayerType = {
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { ISegmentType } from '../Player/player';
|
|
2
2
|
import { RecordItem } from './interface';
|
|
3
|
-
|
|
3
|
+
interface IUseRecordOptions {
|
|
4
|
+
loaddingCallback: (index: number, loading: boolean) => void;
|
|
5
|
+
errorCallback: (index: number) => void;
|
|
6
|
+
}
|
|
7
|
+
declare function useRecordList(list: RecordItem[], queryRecord: (options: any) => Promise<ISegmentType[]>, options: IUseRecordOptions): RecordItem[];
|
|
8
|
+
export default useRecordList;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
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
2
|
|
|
3
3
|
import _useAsyncEffect from "ahooks/es/useAsyncEffect";
|
|
4
|
+
import _useMemoizedFn from "ahooks/es/useMemoizedFn";
|
|
4
5
|
import _usePrevious from "ahooks/es/usePrevious";
|
|
5
6
|
|
|
6
7
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
@@ -31,7 +32,8 @@ import { __awaiter } from "tslib";
|
|
|
31
32
|
import { differenceBy, orderBy, uniqBy } from 'lodash-es';
|
|
32
33
|
import { useMemo, useState } from 'react';
|
|
33
34
|
import { differenceWithIndexs, FILTER_KEY } from './utils';
|
|
34
|
-
|
|
35
|
+
|
|
36
|
+
function useRecordList(list, queryRecord, options) {
|
|
35
37
|
var _this = this;
|
|
36
38
|
|
|
37
39
|
var _useState = useState({
|
|
@@ -51,6 +53,10 @@ export default function useRecordList(list, queryRecord) {
|
|
|
51
53
|
|
|
52
54
|
var prevListKey = _usePrevious(listKey);
|
|
53
55
|
|
|
56
|
+
var loaddingCallback = _useMemoizedFn(options.loaddingCallback);
|
|
57
|
+
|
|
58
|
+
var errorCallback = _useMemoizedFn(options.errorCallback);
|
|
59
|
+
|
|
54
60
|
_useAsyncEffect(function () {
|
|
55
61
|
return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
56
62
|
var diffIndexs, arr, _iterator, _step, dif, index, item, record, segments, _segments, _segments2, _segments3;
|
|
@@ -78,7 +84,7 @@ export default function useRecordList(list, queryRecord) {
|
|
|
78
84
|
|
|
79
85
|
case 7:
|
|
80
86
|
if ((_step = _iterator.n()).done) {
|
|
81
|
-
_context.next =
|
|
87
|
+
_context.next = 52;
|
|
82
88
|
break;
|
|
83
89
|
}
|
|
84
90
|
|
|
@@ -99,84 +105,90 @@ export default function useRecordList(list, queryRecord) {
|
|
|
99
105
|
type: 'delete',
|
|
100
106
|
segments: []
|
|
101
107
|
});
|
|
102
|
-
_context.next =
|
|
108
|
+
_context.next = 50;
|
|
103
109
|
break;
|
|
104
110
|
|
|
105
111
|
case 16:
|
|
106
|
-
if (
|
|
107
|
-
_context.next =
|
|
112
|
+
if (item.cid && item.date) {
|
|
113
|
+
_context.next = 18;
|
|
108
114
|
break;
|
|
109
115
|
}
|
|
110
116
|
|
|
117
|
+
return _context.abrupt("continue", 50);
|
|
118
|
+
|
|
119
|
+
case 18:
|
|
120
|
+
_context.prev = 18;
|
|
121
|
+
loaddingCallback(index, true);
|
|
122
|
+
|
|
111
123
|
if (record) {
|
|
112
|
-
_context.next =
|
|
124
|
+
_context.next = 27;
|
|
113
125
|
break;
|
|
114
126
|
}
|
|
115
127
|
|
|
116
|
-
_context.next =
|
|
128
|
+
_context.next = 23;
|
|
117
129
|
return queryRecord({
|
|
118
130
|
cid: item.cid,
|
|
119
131
|
date: item.date,
|
|
120
132
|
recordType: item.recordType
|
|
121
133
|
});
|
|
122
134
|
|
|
123
|
-
case
|
|
135
|
+
case 23:
|
|
124
136
|
segments = _context.sent;
|
|
125
137
|
arr.push({
|
|
126
138
|
idx: index,
|
|
127
139
|
type: 'add',
|
|
128
140
|
segments: segments
|
|
129
141
|
});
|
|
130
|
-
_context.next =
|
|
142
|
+
_context.next = 42;
|
|
131
143
|
break;
|
|
132
144
|
|
|
133
|
-
case
|
|
145
|
+
case 27:
|
|
134
146
|
if (!(record.cid !== item.cid || record.recordType !== item.recordType)) {
|
|
135
|
-
_context.next =
|
|
147
|
+
_context.next = 34;
|
|
136
148
|
break;
|
|
137
149
|
}
|
|
138
150
|
|
|
139
|
-
_context.next =
|
|
151
|
+
_context.next = 30;
|
|
140
152
|
return queryRecord({
|
|
141
153
|
cid: item.cid,
|
|
142
154
|
date: item.date,
|
|
143
155
|
recordType: item.recordType
|
|
144
156
|
});
|
|
145
157
|
|
|
146
|
-
case
|
|
158
|
+
case 30:
|
|
147
159
|
_segments = _context.sent;
|
|
148
160
|
arr.push({
|
|
149
161
|
idx: index,
|
|
150
162
|
type: 'add',
|
|
151
163
|
segments: _segments
|
|
152
164
|
});
|
|
153
|
-
_context.next =
|
|
165
|
+
_context.next = 42;
|
|
154
166
|
break;
|
|
155
167
|
|
|
156
|
-
case
|
|
168
|
+
case 34:
|
|
157
169
|
if (!(record.date !== item.date)) {
|
|
158
|
-
_context.next =
|
|
170
|
+
_context.next = 41;
|
|
159
171
|
break;
|
|
160
172
|
}
|
|
161
173
|
|
|
162
|
-
_context.next =
|
|
174
|
+
_context.next = 37;
|
|
163
175
|
return queryRecord({
|
|
164
176
|
cid: item.cid,
|
|
165
177
|
date: item.date,
|
|
166
178
|
recordType: item.recordType
|
|
167
179
|
});
|
|
168
180
|
|
|
169
|
-
case
|
|
181
|
+
case 37:
|
|
170
182
|
_segments2 = _context.sent;
|
|
171
183
|
arr.push({
|
|
172
184
|
idx: index,
|
|
173
185
|
type: 'modify',
|
|
174
186
|
segments: _segments2
|
|
175
187
|
});
|
|
176
|
-
_context.next =
|
|
188
|
+
_context.next = 42;
|
|
177
189
|
break;
|
|
178
190
|
|
|
179
|
-
case
|
|
191
|
+
case 41:
|
|
180
192
|
if (Array.isArray(item.segments) && item.segments.length > 0) {
|
|
181
193
|
// 时间轴更新
|
|
182
194
|
_segments3 = item.segments;
|
|
@@ -189,28 +201,40 @@ export default function useRecordList(list, queryRecord) {
|
|
|
189
201
|
console.debug('无变化!跳过~');
|
|
190
202
|
}
|
|
191
203
|
|
|
192
|
-
case
|
|
204
|
+
case 42:
|
|
205
|
+
loaddingCallback(index, false);
|
|
206
|
+
_context.next = 50;
|
|
207
|
+
break;
|
|
208
|
+
|
|
209
|
+
case 45:
|
|
210
|
+
_context.prev = 45;
|
|
211
|
+
_context.t0 = _context["catch"](18);
|
|
212
|
+
console.error(_context.t0);
|
|
213
|
+
errorCallback(index);
|
|
214
|
+
loaddingCallback(index, false);
|
|
215
|
+
|
|
216
|
+
case 50:
|
|
193
217
|
_context.next = 7;
|
|
194
218
|
break;
|
|
195
219
|
|
|
196
|
-
case
|
|
197
|
-
_context.next =
|
|
220
|
+
case 52:
|
|
221
|
+
_context.next = 57;
|
|
198
222
|
break;
|
|
199
223
|
|
|
200
|
-
case
|
|
201
|
-
_context.prev =
|
|
202
|
-
_context.
|
|
224
|
+
case 54:
|
|
225
|
+
_context.prev = 54;
|
|
226
|
+
_context.t1 = _context["catch"](5);
|
|
203
227
|
|
|
204
|
-
_iterator.e(_context.
|
|
228
|
+
_iterator.e(_context.t1);
|
|
205
229
|
|
|
206
|
-
case
|
|
207
|
-
_context.prev =
|
|
230
|
+
case 57:
|
|
231
|
+
_context.prev = 57;
|
|
208
232
|
|
|
209
233
|
_iterator.f();
|
|
210
234
|
|
|
211
|
-
return _context.finish(
|
|
235
|
+
return _context.finish(57);
|
|
212
236
|
|
|
213
|
-
case
|
|
237
|
+
case 60:
|
|
214
238
|
setState(function (old) {
|
|
215
239
|
var flag = false; //标记是否更新
|
|
216
240
|
|
|
@@ -271,14 +295,16 @@ export default function useRecordList(list, queryRecord) {
|
|
|
271
295
|
});
|
|
272
296
|
});
|
|
273
297
|
|
|
274
|
-
case
|
|
298
|
+
case 61:
|
|
275
299
|
case "end":
|
|
276
300
|
return _context.stop();
|
|
277
301
|
}
|
|
278
302
|
}
|
|
279
|
-
}, _callee, null, [[5,
|
|
303
|
+
}, _callee, null, [[5, 54, 57, 60], [18, 45]]);
|
|
280
304
|
}));
|
|
281
305
|
}, [list, listKey, prevListKey]);
|
|
282
306
|
|
|
283
307
|
return state.cidSegments;
|
|
284
|
-
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export default useRecordList;
|
package/es/ThemeAntd/index.css
CHANGED
|
@@ -267,6 +267,7 @@ div .cloudapp-pagination-options-quick-jumper input-focused {
|
|
|
267
267
|
div .cloudapp-picker {
|
|
268
268
|
background-color: var(--form-bg);
|
|
269
269
|
border-radius: var(--radius1);
|
|
270
|
+
border-color: var(--form-bd);
|
|
270
271
|
color: inherit;
|
|
271
272
|
}
|
|
272
273
|
div .cloudapp-picker:hover,
|
|
@@ -352,6 +353,15 @@ div .cloudapp-picker-separator {
|
|
|
352
353
|
div .cloudapp-picker-range .cloudapp-picker-active-bar {
|
|
353
354
|
background-color: var(--form-active-bg);
|
|
354
355
|
}
|
|
356
|
+
div .cloudapp-picker-time-panel-column > li.cloudapp-picker-time-panel-cell .cloudapp-picker-time-panel-cell-inner {
|
|
357
|
+
color: inherit;
|
|
358
|
+
}
|
|
359
|
+
div .cloudapp-picker-time-panel-column > li.cloudapp-picker-time-panel-cell-selected .cloudapp-picker-time-panel-cell-inner {
|
|
360
|
+
background-color: var(--form-active-bg);
|
|
361
|
+
}
|
|
362
|
+
div .cloudapp-picker-time-panel-column > li.cloudapp-picker-time-panel-cell .cloudapp-picker-time-panel-cell-inner:hover {
|
|
363
|
+
background-color: var(--form-active-bg);
|
|
364
|
+
}
|
|
355
365
|
div .cloudapp-popover-inner {
|
|
356
366
|
border-radius: var(--radius1);
|
|
357
367
|
}
|
|
@@ -567,6 +577,9 @@ div .cloudapp-table-row-expand-icon:hover {
|
|
|
567
577
|
div .cloudapp-empty-normal {
|
|
568
578
|
color: inherit;
|
|
569
579
|
}
|
|
580
|
+
div .cloudapp-table-tbody > tr.cloudapp-table-placeholder:hover > td {
|
|
581
|
+
background-color: var(--table-row-hover-color);
|
|
582
|
+
}
|
|
570
583
|
:root {
|
|
571
584
|
color: var(--color);
|
|
572
585
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
div .cloudapp-picker {
|
|
2
2
|
background-color: var(--form-bg);
|
|
3
3
|
border-radius: var(--radius1);
|
|
4
|
+
border-color: var(--form-bd);
|
|
4
5
|
color: inherit;
|
|
5
6
|
}
|
|
6
7
|
div .cloudapp-picker:hover,
|
|
@@ -86,3 +87,12 @@ div .cloudapp-picker-separator {
|
|
|
86
87
|
div .cloudapp-picker-range .cloudapp-picker-active-bar {
|
|
87
88
|
background-color: var(--form-active-bg);
|
|
88
89
|
}
|
|
90
|
+
div .cloudapp-picker-time-panel-column > li.cloudapp-picker-time-panel-cell .cloudapp-picker-time-panel-cell-inner {
|
|
91
|
+
color: inherit;
|
|
92
|
+
}
|
|
93
|
+
div .cloudapp-picker-time-panel-column > li.cloudapp-picker-time-panel-cell-selected .cloudapp-picker-time-panel-cell-inner {
|
|
94
|
+
background-color: var(--form-active-bg);
|
|
95
|
+
}
|
|
96
|
+
div .cloudapp-picker-time-panel-column > li.cloudapp-picker-time-panel-cell .cloudapp-picker-time-panel-cell-inner:hover {
|
|
97
|
+
background-color: var(--form-active-bg);
|
|
98
|
+
}
|
package/es/index.d.ts
CHANGED
|
@@ -43,4 +43,5 @@ export { default as useFullscreen } from './useFullscreen';
|
|
|
43
43
|
export { default as useHistory } from './useHistory';
|
|
44
44
|
export { default as useInfiniteScroll } from './useInfiniteScroll';
|
|
45
45
|
export { default as useRafInterval } from './useRafInterval';
|
|
46
|
+
export { default as useSimpleState } from './useSimpleState';
|
|
46
47
|
export { default as useVirtualList } from './useVirtualList';
|
package/es/index.js
CHANGED
|
@@ -43,4 +43,5 @@ export { default as useFullscreen } from './useFullscreen';
|
|
|
43
43
|
export { default as useHistory } from './useHistory';
|
|
44
44
|
export { default as useInfiniteScroll } from './useInfiniteScroll';
|
|
45
45
|
export { default as useRafInterval } from './useRafInterval';
|
|
46
|
+
export { default as useSimpleState } from './useSimpleState';
|
|
46
47
|
export { default as useVirtualList } from './useVirtualList';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _useMemoizedFn from "ahooks/es/useMemoizedFn";
|
|
2
|
+
import _useSafeState3 from "ahooks/es/useSafeState";
|
|
3
|
+
|
|
4
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
|
+
|
|
6
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
|
|
8
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
|
+
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
11
|
+
|
|
12
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
13
|
+
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
|
|
16
|
+
import { isFunction, isObjectLike } from 'lodash-es';
|
|
17
|
+
import { useMemo } from 'react';
|
|
18
|
+
|
|
19
|
+
function useSimpleState(s) {
|
|
20
|
+
var _useSafeState = _useSafeState3(s),
|
|
21
|
+
_useSafeState2 = _slicedToArray(_useSafeState, 2),
|
|
22
|
+
state = _useSafeState2[0],
|
|
23
|
+
setState = _useSafeState2[1];
|
|
24
|
+
|
|
25
|
+
var stateChange = _useMemoizedFn(function (d) {
|
|
26
|
+
return setState(function (old) {
|
|
27
|
+
return Object.assign(Object.assign({}, old), d);
|
|
28
|
+
});
|
|
29
|
+
}); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
var isObject = useMemo(function () {
|
|
33
|
+
return isObjectLike(s) || isFunction(s);
|
|
34
|
+
}, []);
|
|
35
|
+
var result = useMemo(function () {
|
|
36
|
+
return [state, isObject ? stateChange : setState, setState];
|
|
37
|
+
}, [isObject, setState, state, stateChange]);
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default useSimpleState;
|