@cloud-app-dev/vidc 3.2.15 → 3.2.16

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.
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { GridListCell, GridListItemData } from './interface';
3
2
  import './index.less';
3
+ import { GridListCell, GridListItemData } from './interface';
4
4
  export interface GridListProps<P> {
5
5
  items: P[];
6
6
  getGridGap?: (elementWidth: number, windowHeight: number) => number;
@@ -1,7 +1,7 @@
1
1
  import React, { useRef } from 'react';
2
2
  import { useGridListConfigData, useGridListContainerData, useGridListLayoutData, useGridListRenderData, useIntersecting } from "./hook";
3
- import { getGridRowStart } from "./utils";
4
3
  import "./index.less";
4
+ import { getGridRowStart } from "./utils";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  var GridList = /*#__PURE__*/React.forwardRef(function GridList(props, ref) {
7
7
  var containerRef = useRef(null);
@@ -10,8 +10,10 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
10
10
 
11
11
  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; }
12
12
 
13
+ /* eslint-disable react/button-has-type */
14
+
13
15
  /* eslint-disable @typescript-eslint/no-unused-expressions */
14
- import React from 'react';
16
+ import React, { useRef } from 'react';
15
17
  import ListWithSizeAnimate from "./index";
16
18
  import { jsx as _jsx } from "react/jsx-runtime";
17
19
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -52,13 +54,16 @@ function loadPage(d) {
52
54
  }
53
55
 
54
56
  export default function App() {
55
- return /*#__PURE__*/_jsx("div", {
57
+ var ref = useRef(null);
58
+ return /*#__PURE__*/_jsxs("div", {
56
59
  style: {
57
60
  width: '100%',
58
- height: 800
61
+ height: 800,
62
+ position: 'relative'
59
63
  },
60
- children: /*#__PURE__*/_jsx(ListWithSizeAnimate, {
61
- headerSize: 400,
64
+ children: [/*#__PURE__*/_jsx(ListWithSizeAnimate, {
65
+ ref: ref,
66
+ headerSize: 200,
62
67
  header: /*#__PURE__*/_jsx("div", {
63
68
  children: /*#__PURE__*/_jsxs("ul", {
64
69
  children: [/*#__PURE__*/_jsx("li", {
@@ -75,24 +80,6 @@ export default function App() {
75
80
  children: "\u6761\u4EF63"
76
81
  }), /*#__PURE__*/_jsx("li", {
77
82
  children: "\u6761\u4EF63"
78
- }), /*#__PURE__*/_jsx("li", {
79
- children: "\u6761\u4EF63"
80
- }), /*#__PURE__*/_jsx("li", {
81
- children: "\u6761\u4EF63"
82
- }), /*#__PURE__*/_jsx("li", {
83
- children: "\u6761\u4EF63"
84
- }), /*#__PURE__*/_jsx("li", {
85
- children: "\u6761\u4EF63"
86
- }), /*#__PURE__*/_jsx("li", {
87
- children: "\u6761\u4EF63"
88
- }), /*#__PURE__*/_jsx("li", {
89
- children: "\u6761\u4EF63"
90
- }), /*#__PURE__*/_jsx("li", {
91
- children: "\u6761\u4EF63"
92
- }), /*#__PURE__*/_jsx("li", {
93
- children: "\u6761\u4EF63"
94
- }), /*#__PURE__*/_jsx("li", {
95
- children: "\u6761\u4EF63"
96
83
  })]
97
84
  })
98
85
  }),
@@ -132,9 +119,23 @@ export default function App() {
132
119
  loadPage: loadPage,
133
120
  children: /*#__PURE__*/_jsx("div", {
134
121
  style: {
135
- height: 800
136
- }
122
+ height: 100,
123
+ backgroundColor: 'green'
124
+ },
125
+ children: "\u68C0\u7D22\u6761\u4EF6"
137
126
  })
138
- })
127
+ }), /*#__PURE__*/_jsx("button", {
128
+ style: {
129
+ position: 'absolute',
130
+ bottom: 30,
131
+ right: 30
132
+ },
133
+ onClick: function onClick() {
134
+ var _ref$current;
135
+
136
+ return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.backTop();
137
+ },
138
+ children: "\u8FD4\u56DE\u9876\u90E8"
139
+ })]
139
140
  });
140
141
  }
@@ -6,9 +6,10 @@ interface IListWithSizeAnimateProps<T> extends IDynamicGridListProps<T> {
6
6
  children?: React.ReactNode;
7
7
  header?: React.ReactNode;
8
8
  }
9
- interface IListWithSizeAnimateRef {
9
+ export interface IListWithSizeAnimateRef {
10
10
  open: () => void;
11
11
  close: () => void;
12
+ backTop: () => void;
12
13
  }
13
14
  declare const ListWithSizeAnimate: React.ForwardRefExoticComponent<IListWithSizeAnimateProps<unknown> & React.RefAttributes<IListWithSizeAnimateRef>>;
14
15
  export default ListWithSizeAnimate;
@@ -1,5 +1,5 @@
1
1
  import _useEventListener from "ahooks/es/useEventListener";
2
- var _excluded = ["headerSize", "header"];
2
+ var _excluded = ["headerSize", "header", "children"];
3
3
 
4
4
  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; }
5
5
 
@@ -34,6 +34,7 @@ var ListWithSizeAnimate = /*#__PURE__*/React.forwardRef(function ListWithSizeAni
34
34
 
35
35
  var headerSize = _ref.headerSize,
36
36
  header = _ref.header,
37
+ children = _ref.children,
37
38
  props = _objectWithoutProperties(_ref, _excluded);
38
39
 
39
40
  var _useSimpleState = useSimpleState({
@@ -84,6 +85,13 @@ var ListWithSizeAnimate = /*#__PURE__*/React.forwardRef(function ListWithSizeAni
84
85
  return updateState({
85
86
  open: false
86
87
  });
88
+ },
89
+ backTop: function backTop() {
90
+ var _ref$current2, _ref$current2$querySe;
91
+
92
+ return (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : (_ref$current2$querySe = _ref$current2.querySelector('.cloudapp-dynamic-grid-list')) === null || _ref$current2$querySe === void 0 ? void 0 : _ref$current2$querySe.scrollTo({
93
+ top: 0
94
+ });
87
95
  }
88
96
  };
89
97
  }, []);
@@ -100,12 +108,15 @@ var ListWithSizeAnimate = /*#__PURE__*/React.forwardRef(function ListWithSizeAni
100
108
  className: "list-animate-header-content",
101
109
  children: header
102
110
  })
103
- }), /*#__PURE__*/_jsx("div", {
111
+ }), /*#__PURE__*/_jsxs("div", {
104
112
  className: "list-animate-content",
105
113
  style: {
106
114
  height: contentHeight
107
115
  },
108
- children: /*#__PURE__*/_jsx(DynamicGridList, _objectSpread({}, props))
116
+ children: [/*#__PURE__*/_jsx("div", {
117
+ className: "list-animate-content-ext",
118
+ children: children
119
+ }), /*#__PURE__*/_jsx(DynamicGridList, _objectSpread({}, props))]
109
120
  })]
110
121
  });
111
122
  });
@@ -10,5 +10,10 @@
10
10
  background-color: blue;
11
11
  overflow: hidden;
12
12
  transition: height 0.3s;
13
+ display: flex;
14
+ flex-direction: column;
15
+ .cloudapp-dynamic-grid-list {
16
+ flex: 1;
17
+ }
13
18
  }
14
19
  }
@@ -204,7 +204,7 @@ function LivePlayer(_ref) {
204
204
  var _item$url;
205
205
 
206
206
  return /*#__PURE__*/_createElement(LivePlayerWithExt, _objectSpread(_objectSpread({}, item), {}, {
207
- mode: item.cid ? state.modes[item.cid] : item.mode,
207
+ mode: item.cid && state.modes[item.cid] ? state.modes[item.cid] : item.mode,
208
208
  key: (_item$url = item.url) !== null && _item$url !== void 0 ? _item$url : "".concat(index),
209
209
  updatePlayer: function updatePlayer(player) {
210
210
  if (item.cid) {
@@ -236,7 +236,7 @@ function LivePlayer(_ref) {
236
236
  toggleFit: toggleFit,
237
237
  getPlayerItem: getPlayerItem,
238
238
  screenNum: screenNum,
239
- mode: state.modes[state.selectIndex],
239
+ mode: segmentItem !== null && segmentItem !== void 0 && segmentItem.cid ? state.modes[segmentItem === null || segmentItem === void 0 ? void 0 : segmentItem.cid] : segmentItem === null || segmentItem === void 0 ? void 0 : segmentItem.mode,
240
240
  containerRef: domRef,
241
241
  updateState: updateState,
242
242
  snapshot: props.snapshot,
@@ -8,7 +8,7 @@ interface IToolsProps {
8
8
  mode?: PlayModeType;
9
9
  }) => void;
10
10
  screenNum: number;
11
- mode: PlayModeType;
11
+ mode?: PlayModeType;
12
12
  getPlayerItem: () => ExportPlayerType | undefined;
13
13
  fit?: string;
14
14
  toggleFit?: () => void;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "private": false,
3
3
  "name": "@cloud-app-dev/vidc",
4
4
  "description": "Video Image Data Componennts",
5
- "version": "3.2.15",
5
+ "version": "3.2.16",
6
6
  "scripts": {
7
7
  "docs:deploy": "gh-pages -d docs-dist",
8
8
  "build": "npm run entry && father build",