yootd 0.0.54 → 0.0.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -172,5 +172,5 @@ export { Zone } from './zones';
172
172
  export { GoBack } from './go-back';
173
173
  export type { GoBackProps } from './go-back';
174
174
  export { VideoPlayer } from './video-player';
175
- export type { VideoPlayerProps } from './video-player';
175
+ export type { VideoPlayerProps, VideoPlayerRef } from './video-player';
176
176
  export type { GetProp, GetProps, GetRef } from './utils/utils';
@@ -2,7 +2,7 @@ import type { TreeDataNode as AntTreeDataNode, TreeProps as AntTreeProps } from
2
2
  import { Tree as AntTree } from 'antd';
3
3
  import React from 'react';
4
4
  import './index.scss';
5
- export type { AntTreeNode, AntTreeNodeCheckedEvent, AntTreeNodeExpandedEvent, AntTreeNodeMouseEvent, AntTreeNodeProps, AntTreeNodeSelectedEvent, AntdTreeNodeAttribute, DirectoryTreeExpandAction, DirectoryTreeProps, EventDataNode, } from 'antd/es/tree';
5
+ export type { AntdTreeNodeAttribute, AntTreeNode, AntTreeNodeCheckedEvent, AntTreeNodeExpandedEvent, AntTreeNodeMouseEvent, AntTreeNodeProps, AntTreeNodeSelectedEvent, DirectoryTreeExpandAction, DirectoryTreeProps, EventDataNode } from 'antd/es/tree';
6
6
  export type TreeProps = AntTreeProps & {
7
7
  showChildNumbers?: boolean;
8
8
  placeholder?: string;
@@ -1,5 +1,9 @@
1
- import { CSSProperties, FC } from 'react';
1
+ import React, { CSSProperties } from 'react';
2
2
  import './index.scss';
3
+ export interface VideoPlayerRef {
4
+ play: () => void;
5
+ pause: () => void;
6
+ }
3
7
  export interface VideoPlayerProps {
4
8
  /**
5
9
  * 视频地址
@@ -67,4 +71,4 @@ export interface VideoPlayerProps {
67
71
  */
68
72
  onPlayStateChange?: (isPlaying: boolean) => void;
69
73
  }
70
- export declare const VideoPlayer: FC<VideoPlayerProps>;
74
+ export declare const VideoPlayer: React.ForwardRefExoticComponent<VideoPlayerProps & React.RefAttributes<VideoPlayerRef>>;
@@ -15,7 +15,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
15
15
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
16
16
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
17
  import * as faceapi from '@vladmandic/face-api';
18
- import React, { useCallback, useEffect, useRef, useState } from 'react';
18
+ import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
19
19
  import { EndPoint } from 'yootd-webrtc-sdk';
20
20
  import { useBem } from "../hooks/useBem";
21
21
  import "./index.scss";
@@ -27,7 +27,7 @@ var MIN_SCORE = 0.5; // minimum score
27
27
  var MAX_RESULTS = 20; // maximum number of results to return
28
28
 
29
29
  var speeds = ['2.0', '1.75', '1.5', '1.25', '1.0', '0.75', '0.5'];
30
- export var VideoPlayer = function VideoPlayer(_ref) {
30
+ export var VideoPlayer = /*#__PURE__*/forwardRef(function (_ref, ref) {
31
31
  var src = _ref.src,
32
32
  isLive = _ref.isLive,
33
33
  controls = _ref.controls,
@@ -135,6 +135,18 @@ export var VideoPlayer = function VideoPlayer(_ref) {
135
135
  _useState36 = _slicedToArray(_useState35, 2),
136
136
  videoEleSize = _useState36[0],
137
137
  setVideoEleSize = _useState36[1];
138
+ useImperativeHandle(ref, function () {
139
+ return {
140
+ play: function play() {
141
+ var _videoRef$current;
142
+ void ((_videoRef$current = videoRef.current) === null || _videoRef$current === void 0 ? void 0 : _videoRef$current.play());
143
+ },
144
+ pause: function pause() {
145
+ var _videoRef$current2;
146
+ (_videoRef$current2 = videoRef.current) === null || _videoRef$current2 === void 0 || _videoRef$current2.pause();
147
+ }
148
+ };
149
+ });
138
150
  var handleFullScreen = function handleFullScreen() {
139
151
  if (containerRef.current != null) {
140
152
  void containerRef.current.requestFullscreen();
@@ -148,7 +160,7 @@ export var VideoPlayer = function VideoPlayer(_ref) {
148
160
  var handleCanPlay = function handleCanPlay(e) {
149
161
  var video = e.target;
150
162
  try {
151
- var _video$audioTracks, _video$audioTracks2;
163
+ var _video$audioTracks;
152
164
  setHasAudio(
153
165
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
154
166
  // @ts-ignore
@@ -159,27 +171,29 @@ export var VideoPlayer = function VideoPlayer(_ref) {
159
171
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
160
172
  // @ts-ignore
161
173
  Boolean((_video$audioTracks = video.audioTracks) === null || _video$audioTracks === void 0 ? void 0 : _video$audioTracks.length));
162
- console.log('是否包含音频: ',
163
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
164
- // @ts-expect-error
165
- video.mozHasAudio ||
166
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
167
- // @ts-expect-error
168
- Boolean(video.webkitAudioDecodedByteCount) ||
169
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
170
- // @ts-expect-error
171
- Boolean((_video$audioTracks2 = video.audioTracks) === null || _video$audioTracks2 === void 0 ? void 0 : _video$audioTracks2.length));
174
+ // console.log(
175
+ // '是否包含音频: ',
176
+ // // eslint-disable-next-line @typescript-eslint/ban-ts-comment
177
+ // // @ts-expect-error
178
+ // video.mozHasAudio ||
179
+ // // eslint-disable-next-line @typescript-eslint/ban-ts-comment
180
+ // // @ts-expect-error
181
+ // Boolean(video.webkitAudioDecodedByteCount) ||
182
+ // // eslint-disable-next-line @typescript-eslint/ban-ts-comment
183
+ // // @ts-expect-error
184
+ // Boolean(video.audioTracks?.length),
185
+ // );
172
186
  } catch (e) {
173
187
  console.log(e);
174
188
  }
175
189
  };
176
190
  var handlePlayAndStop = function handlePlayAndStop() {
177
191
  if (isPlaying) {
178
- var _videoRef$current;
179
- (_videoRef$current = videoRef.current) === null || _videoRef$current === void 0 || _videoRef$current.pause();
192
+ var _videoRef$current3;
193
+ (_videoRef$current3 = videoRef.current) === null || _videoRef$current3 === void 0 || _videoRef$current3.pause();
180
194
  } else {
181
- var _videoRef$current2;
182
- void ((_videoRef$current2 = videoRef.current) === null || _videoRef$current2 === void 0 ? void 0 : _videoRef$current2.play());
195
+ var _videoRef$current4;
196
+ void ((_videoRef$current4 = videoRef.current) === null || _videoRef$current4 === void 0 ? void 0 : _videoRef$current4.play());
183
197
  }
184
198
  };
185
199
  var handleOnPlay = function handleOnPlay() {
@@ -533,12 +547,12 @@ export var VideoPlayer = function VideoPlayer(_ref) {
533
547
  if (lastTime + 1000 <= Date.now()) {
534
548
  lastTime = Date.now();
535
549
  detect()
536
- .catch((e) => {
537
- console.log("error", e);
538
- })
539
- .finally(() => {
540
- handler = requestAnimationFrame(start);
541
- });
550
+ .catch((e) => {
551
+ console.log("error", e);
552
+ })
553
+ .finally(() => {
554
+ handler = requestAnimationFrame(start);
555
+ });
542
556
  } else {
543
557
  handler = requestAnimationFrame(start);
544
558
  }
@@ -872,4 +886,5 @@ export var VideoPlayer = function VideoPlayer(_ref) {
872
886
  transform: "scale(".concat(canvasSize.width / videoEleSize.width, ")")
873
887
  }
874
888
  }) : null));
875
- };
889
+ });
890
+ VideoPlayer.displayName = 'VideoPlayer';
@@ -1,35 +1,35 @@
1
- export interface PageData<T> {
2
- content: T[];
3
- page: {
4
- number: number;
5
- size: number;
6
- totalElements: number;
7
- totalPages: number;
8
- };
9
- }
10
- // 查询学年返回的数据类型
11
- export interface IYearItem {
12
- id: number; // ID
13
- yearName: string; // 学年名称
14
- }
15
- // 查询学期返回的数据类型
16
- export interface ITermItem {
17
- termId: number; // ID
18
- termName: string; // 学期名称
19
- startDate: string; // 开始日期
20
- endDate: string; // 结束日期
21
- }
22
- type YearTermProps = {
23
- type?: 'yearTerm' | 'year' | 'term';
24
- responseType?: 'id' | 'time';
25
- style?: React.CSSProperties;
26
- showSearch?: boolean;
27
- value?: { yearId?: number; termId?: number };
28
- onChange?: (record: {
29
- yearId?: number;
30
- termId?: number;
31
- termTime?: { startDate?: string; endDate?: string };
32
- }) => void;
33
- allowClear?: boolean;
34
- placeholder?: string[];
35
- };
1
+ export interface PageData<T> {
2
+ content: T[];
3
+ page: {
4
+ number: number;
5
+ size: number;
6
+ totalElements: number;
7
+ totalPages: number;
8
+ };
9
+ }
10
+ // 查询学年返回的数据类型
11
+ export interface IYearItem {
12
+ id: number; // ID
13
+ yearName: string; // 学年名称
14
+ }
15
+ // 查询学期返回的数据类型
16
+ export interface ITermItem {
17
+ termId: number; // ID
18
+ termName: string; // 学期名称
19
+ startDate: string; // 开始日期
20
+ endDate: string; // 结束日期
21
+ }
22
+ type YearTermProps = {
23
+ type?: 'yearTerm' | 'year' | 'term';
24
+ responseType?: 'id' | 'time';
25
+ style?: React.CSSProperties;
26
+ showSearch?: boolean;
27
+ value?: { yearId?: number; termId?: number };
28
+ onChange?: (record: {
29
+ yearId?: number;
30
+ termId?: number;
31
+ termTime?: { startDate?: string; endDate?: string };
32
+ }) => void;
33
+ allowClear?: boolean;
34
+ placeholder?: string[];
35
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yootd",
3
- "version": "0.0.54",
3
+ "version": "0.0.55",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",