yootd 0.0.7 → 0.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/dist/index.d.ts CHANGED
@@ -158,4 +158,6 @@ export type { UserDropdownProps } from './user-dropdown/types/types';
158
158
  export { ConfigProvider } from './config-provider';
159
159
  export type { ConfigProviderProps } from './config-provider';
160
160
  export { Zone } from './zones';
161
+ export { VideoPlayer } from './video-player';
162
+ export type { VideoPlayerProps } from './video-player';
161
163
  export type { GetProp, GetProps, GetRef } from './utils/utils';
package/dist/index.js CHANGED
@@ -85,4 +85,5 @@ export { DateRange } from "./date-range";
85
85
  export { Teacher } from "./teacher";
86
86
  export { UserDropdown } from "./user-dropdown";
87
87
  export { ConfigProvider } from "./config-provider";
88
- export { Zone } from "./zones";
88
+ export { Zone } from "./zones";
89
+ export { VideoPlayer } from "./video-player";
@@ -8,8 +8,18 @@
8
8
  }
9
9
  .ant-tabs-nav-wrap {
10
10
  background-color: white;
11
- padding-left: var(--ant-padding-lg);
12
- padding-right: var(--ant-padding-lg);
11
+ padding-left: 1.5rem;
12
+ padding-right: 1.5rem;
13
+ }
14
+ .ant-tabs-nav::before{
15
+ content: '';
16
+ position: absolute;
17
+ right: 1.5rem;
18
+ left: 1.5rem;
19
+ z-index: 10;
20
+ border-bottom-width: var(--ant-line-width);
21
+ border-bottom-style: solid;
22
+ border-bottom-color: #E5E5E5;
13
23
  }
14
24
  }
15
25
  &-small {
@@ -21,8 +31,18 @@
21
31
  }
22
32
  .ant-tabs-nav-wrap {
23
33
  background-color: white;
24
- padding-left: var(--ant-padding);
25
- padding-right: var(--ant-padding);
34
+ padding-left: 1.5rem;
35
+ padding-right: 1.5rem;
36
+ }
37
+ .ant-tabs-nav::before{
38
+ content: '';
39
+ position: absolute;
40
+ right: 1.5rem;
41
+ left: 1.5rem;
42
+ z-index: 10;
43
+ border-bottom-width: var(--ant-line-width);
44
+ border-bottom-style: solid;
45
+ border-bottom-color: #E5E5E5;
26
46
  }
27
47
  }
28
48
  &-capsule {
@@ -1,2 +1,5 @@
1
- export type { CheckableTagProps, TagProps } from 'antd/es/tag';
2
- export declare const Tag: import("antd").TagType;
1
+ import type { TagProps } from 'antd';
2
+ import React from 'react';
3
+ import './index.scss';
4
+ export type { TagProps };
5
+ export declare const Tag: React.FC<TagProps>;
package/dist/tag/index.js CHANGED
@@ -1,2 +1,13 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+ function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
1
3
  import { Tag as AntTag } from 'antd';
2
- export var Tag = AntTag;
4
+ import React from 'react';
5
+ import { useBem } from "../hooks/useBem";
6
+ import "./index.scss";
7
+ export var Tag = function Tag(_ref) {
8
+ var props = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
9
+ var mb = useBem('tag');
10
+ return /*#__PURE__*/React.createElement(AntTag, _extends({
11
+ className: "".concat(mb.e('text'))
12
+ }, props));
13
+ };
@@ -0,0 +1,5 @@
1
+ .yot-tag {
2
+ &__text {
3
+ font-weight: bold;
4
+ }
5
+ }
@@ -7,7 +7,7 @@ declare const FileUpload: React.ForwardRefExoticComponent<import("antd").UploadP
7
7
  accept?: string | undefined;
8
8
  folder?: string | undefined;
9
9
  value?: UploadFile<any>[] | undefined;
10
- fileType?: "image" | "file" | undefined;
10
+ fileType?: "file" | "image" | undefined;
11
11
  onChange?: ((value?: UploadFile<any>[] | undefined) => void) | undefined;
12
12
  } & React.RefAttributes<UploadRef<any>>>;
13
13
  export default FileUpload;
@@ -119,9 +119,7 @@ var InternalUpload = function InternalUpload(props, ref) {
119
119
  var filteredList = _fileList.filter(function (item) {
120
120
  return !(item.uid === file.uid && item.status === 'error');
121
121
  });
122
- var filterError = _fileList.filter(function (item) {
123
- return item.status === 'done';
124
- });
122
+ // const filterError = _fileList.filter((item) => item.status === 'done');
125
123
  var _list = Array.from([]);
126
124
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
127
125
  // @ts-expect-error
@@ -134,16 +132,9 @@ var InternalUpload = function InternalUpload(props, ref) {
134
132
  status: 'done'
135
133
  });
136
134
  });
137
- var _url = Array.from([]);
138
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
139
- // @ts-expect-error
140
- fileList === null || fileList === void 0 || fileList.map(function (item) {
141
- return _url.push(item.preview);
142
- });
143
- onChange === null || onChange === void 0 || onChange([].concat(_toConsumableArray(filterError), _list));
144
- setFileList([].concat(_toConsumableArray(filteredList), _list));
135
+ onChange === null || onChange === void 0 || onChange([].concat(_toConsumableArray(filteredList), _list));
136
+ // setFileList([...filteredList, ..._list]);
145
137
  }).catch(function () {
146
- // const msg = e?.response?.data?.[0]?.message;
147
138
  var _fileList = Array.from([]);
148
139
  _fileList.push({
149
140
  name: file.name,
@@ -155,7 +146,8 @@ var InternalUpload = function InternalUpload(props, ref) {
155
146
  type: file.type,
156
147
  originFileObj: file
157
148
  });
158
- setFileList([].concat(_toConsumableArray(fileList), _fileList));
149
+ onChange === null || onChange === void 0 || onChange([].concat(_toConsumableArray(fileList), _fileList));
150
+ // setFileList([...fileList, ..._fileList]);
159
151
  var msg = '上传失败!';
160
152
  void messageApi.error(msg);
161
153
  });
@@ -166,7 +158,7 @@ var InternalUpload = function InternalUpload(props, ref) {
166
158
  return item.uid !== file.uid;
167
159
  });
168
160
  onChange === null || onChange === void 0 || onChange(newFileList);
169
- setFileList(newFileList);
161
+ // setFileList(newFileList);
170
162
  };
171
163
  var ReUpload = function ReUpload(file) {
172
164
  if (file.originFileObj) {
@@ -186,28 +178,24 @@ var InternalUpload = function InternalUpload(props, ref) {
186
178
  }
187
179
  }
188
180
  var newFileList = useMemo(function () {
189
- return fileList != null && fileList !== null && fileList !== void 0 && fileList.every(function (item) {
190
- return item.url;
191
- }) ? fileList === null || fileList === void 0 ? void 0 : fileList.map(function (item) {
181
+ return fileList != null ? fileList === null || fileList === void 0 ? void 0 : fileList.map(function (item) {
192
182
  return _objectSpread(_objectSpread({}, item), {}, {
193
183
  url: "".concat(assetsURL, "/").concat(item.url)
194
184
  });
195
185
  }) : [];
196
186
  }, [fileList]);
197
187
  useEffect(function () {
198
- if (value != null && fileList.length === 0 && Array.isArray(value)) {
199
- var _value$filter;
188
+ if (value != null) {
200
189
  var _fileList = Array.from([]);
201
- value === null || value === void 0 || (_value$filter = value.filter(function (item) {
202
- return item.url != null;
203
- })) === null || _value$filter === void 0 || _value$filter.map(function (item) {
204
- return _fileList.push({
205
- uid: "".concat(Date.now(), ".fileUid"),
190
+ value === null || value === void 0 || value.map(function (item, index) {
191
+ var _item$uid, _item$status;
192
+ return _fileList.push(_objectSpread(_objectSpread({}, item), {}, {
193
+ uid: (_item$uid = item.uid) !== null && _item$uid !== void 0 ? _item$uid : "".concat(Date.now(), "-").concat(index),
206
194
  name: item.name,
207
- status: 'done',
195
+ status: (_item$status = item.status) !== null && _item$status !== void 0 ? _item$status : 'done',
208
196
  url: item.url,
209
197
  preview: item.url
210
- });
198
+ }));
211
199
  });
212
200
  setFileList(_fileList);
213
201
  }
@@ -250,7 +238,9 @@ var InternalUpload = function InternalUpload(props, ref) {
250
238
  },
251
239
  showRemoveIcon: false
252
240
  }
253
- }, props), (fileList === null || fileList === void 0 || (_fileList$filter = fileList.filter(function (item) {
241
+ }, props, {
242
+ onChange: undefined
243
+ }), (fileList === null || fileList === void 0 || (_fileList$filter = fileList.filter(function (item) {
254
244
  return item.url != null;
255
245
  })) === null || _fileList$filter === void 0 ? void 0 : _fileList$filter.length) >= (maxCount != null ? maxCount : 1) ? null : uploadButton));
256
246
  };
@@ -7,7 +7,7 @@ declare const ImageUpload: React.ForwardRefExoticComponent<import("antd").Upload
7
7
  accept?: string | undefined;
8
8
  folder?: string | undefined;
9
9
  value?: UploadFile<any>[] | undefined;
10
- fileType?: "image" | "file" | undefined;
10
+ fileType?: "file" | "image" | undefined;
11
11
  onChange?: ((value?: UploadFile<any>[] | undefined) => void) | undefined;
12
12
  } & React.RefAttributes<UploadRef<any>>>;
13
13
  export default ImageUpload;
@@ -127,28 +127,20 @@ var InternalUpload = function InternalUpload(props, ref) {
127
127
  status: 'done'
128
128
  });
129
129
  });
130
- var _url = Array.from([]);
131
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
132
- // @ts-expect-error
133
- fileList === null || fileList === void 0 || fileList.map(function (item) {
134
- return _url.push(item.preview);
135
- });
136
130
  onChange === null || onChange === void 0 || onChange([].concat(_toConsumableArray(fileList), _fileList));
137
- setFileList([].concat(_toConsumableArray(fileList), _fileList));
131
+ // setFileList([...fileList, ..._fileList]);
138
132
  }).catch(function () {
139
- // const msg = e?.response?.data?.[0]?.message;
140
133
  var msg = '上传失败!';
141
134
  void messageApi.error(msg);
142
135
  });
143
136
  return false;
144
137
  }
145
138
  var onRemove = function onRemove(file) {
146
- var _newFileList = fileList === null || fileList === void 0 ? void 0 : fileList.filter(function (item) {
139
+ var newFileList = fileList === null || fileList === void 0 ? void 0 : fileList.filter(function (item) {
147
140
  return item.uid !== file.uid;
148
141
  });
149
- console.log('onRemove', _newFileList);
150
- onChange === null || onChange === void 0 || onChange(_newFileList);
151
- setFileList(_newFileList);
142
+ onChange === null || onChange === void 0 || onChange(newFileList);
143
+ // setFileList(newFileList);
152
144
  };
153
145
  function handlePreview(file) {
154
146
  if (file.url != null) {
@@ -161,9 +153,7 @@ var InternalUpload = function InternalUpload(props, ref) {
161
153
  }
162
154
  }
163
155
  var newFileList = useMemo(function () {
164
- return fileList != null && fileList !== null && fileList !== void 0 && fileList.every(function (item) {
165
- return item.url;
166
- }) ? fileList === null || fileList === void 0 ? void 0 : fileList.map(function (item) {
156
+ return fileList != null ? fileList === null || fileList === void 0 ? void 0 : fileList.map(function (item) {
167
157
  return _objectSpread(_objectSpread({}, item), {}, {
168
158
  url: "".concat(assetsURL, "/").concat(item.url)
169
159
  });
@@ -189,18 +179,16 @@ var InternalUpload = function InternalUpload(props, ref) {
189
179
  }
190
180
  };
191
181
  useEffect(function () {
192
- if (value != null && fileList.length === 0 && Array.isArray(value)) {
193
- var _value$filter;
182
+ if (value != null) {
194
183
  var _fileList = Array.from([]);
195
- value === null || value === void 0 || (_value$filter = value.filter(function (item) {
196
- return item.url != null;
197
- })) === null || _value$filter === void 0 || _value$filter.map(function (item) {
184
+ value === null || value === void 0 || value.map(function (items, index) {
185
+ var _items$uid, _items$status;
198
186
  return _fileList.push({
199
- uid: "".concat(Date.now(), ".fileUid"),
200
- name: item.name,
201
- status: 'done',
202
- url: item.url,
203
- preview: item.url
187
+ uid: (_items$uid = items.uid) !== null && _items$uid !== void 0 ? _items$uid : "".concat(Date.now(), "-").concat(index),
188
+ name: items.name,
189
+ status: (_items$status = items.status) !== null && _items$status !== void 0 ? _items$status : 'done',
190
+ url: items.url,
191
+ preview: items.url
204
192
  });
205
193
  });
206
194
  setFileList(_fileList);
@@ -222,7 +210,9 @@ var InternalUpload = function InternalUpload(props, ref) {
222
210
  accept: accept,
223
211
  maxCount: maxCount,
224
212
  itemRender: itemRender
225
- }, props), (fileList === null || fileList === void 0 || (_fileList$filter = fileList.filter(function (item) {
213
+ }, props, {
214
+ onChange: undefined
215
+ }), (fileList === null || fileList === void 0 || (_fileList$filter = fileList.filter(function (item) {
226
216
  return item.url != null;
227
217
  })) === null || _fileList$filter === void 0 ? void 0 : _fileList$filter.length) >= (maxCount != null ? maxCount : 1) ? null : uploadButton), (previewFile === null || previewFile === void 0 ? void 0 : previewFile.url) != null ? /*#__PURE__*/React.createElement(Image, {
228
218
  wrapperStyle: {
@@ -0,0 +1 @@
1
+ <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1698128671512" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="906" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M177.26002244 1020.68826978c-8.39476931 0-16.78529945-2.08703457-24.36334146-6.21023633-16.33313206-8.95150085-26.50548539-26.04060047-26.50548539-44.65859052L126.39119559 54.20316557c0-18.61799004 10.17235194-35.76219902 26.50548539-44.66565629 16.27661148-8.95291345 36.21436639-8.18564235 51.88479014 1.88214681L916.92809291 469.23344724c14.54989766 9.35562463 23.34737815 25.48528291 23.34737816 42.77785771 0 17.29257478-8.79748049 33.42081908-23.34737816 42.78209687L204.78147112 1012.60153981C196.38528784 1017.94559264 186.82618801 1020.68826978 177.26002244 1020.68826978L177.26002244 1020.68826978zM177.26002244 1020.68826978" fill="#ffffff" p-id="907"></path></svg>
@@ -0,0 +1,70 @@
1
+ import { CSSProperties, FC } from 'react';
2
+ import './index.scss';
3
+ export interface VideoPlayerProps {
4
+ /**
5
+ * 视频地址
6
+ */
7
+ src: string;
8
+ /**
9
+ * 是否为直播视频
10
+ */
11
+ isLive?: boolean;
12
+ /**
13
+ * 是否展示控制面板
14
+ */
15
+ controls?: boolean;
16
+ /**
17
+ * 是否自动播放
18
+ */
19
+ autoPlay?: boolean;
20
+ /**
21
+ * 是否获取视频流
22
+ */
23
+ videoEnable?: boolean;
24
+ /**
25
+ * 是否获取音频流
26
+ */
27
+ audioEnable?: boolean;
28
+ /**
29
+ * 是否静音
30
+ */
31
+ muted?: boolean;
32
+ /**
33
+ * 是否在微信小程序中使用
34
+ */
35
+ miniProgram?: boolean;
36
+ /**
37
+ * 是否旋转全屏
38
+ */
39
+ rotateWhenFullScreen?: boolean;
40
+ /**
41
+ * 视频封面
42
+ */
43
+ poster?: string;
44
+ /**
45
+ * 截图回调
46
+ */
47
+ onCapture?: (base64: string) => void;
48
+ /**
49
+ * 是否重试
50
+ */
51
+ retry?: boolean;
52
+ /**
53
+ * 重试间隔
54
+ */
55
+ retryInterval?: number;
56
+ /**
57
+ * 额外样式
58
+ */
59
+ style?: CSSProperties;
60
+ /**
61
+ * 类名,用于覆盖默认样式
62
+ */
63
+ className?: string;
64
+ /**
65
+ * 播放状态变化回调
66
+ * @param isPlaying
67
+ */
68
+ onPlayStateChange?: (isPlaying: boolean) => void;
69
+ }
70
+ export declare const VideoPlayer: FC<VideoPlayerProps>;