yootd 0.0.89 → 0.0.91

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
@@ -171,7 +171,6 @@ export { UserDropdown } from './user-dropdown';
171
171
  export type { UserDropdownProps } from './user-dropdown/types/types';
172
172
  export { ConfigProvider } from './config-provider';
173
173
  export type { ConfigProviderProps } from './config-provider';
174
- export { Zone } from './zones';
175
174
  export { GoBack } from './go-back';
176
175
  export type { GoBackProps } from './go-back';
177
176
  export { VideoPlayer } from './video-player';
package/dist/index.js CHANGED
@@ -92,6 +92,7 @@ export { DatePicker } from "./date-picker";
92
92
  export { Teacher } from "./teacher";
93
93
  export { UserDropdown } from "./user-dropdown";
94
94
  export { ConfigProvider } from "./config-provider";
95
- export { Zone } from "./zones";
95
+ // export { Zone } from './zones';
96
+
96
97
  export { GoBack } from "./go-back";
97
98
  export { VideoPlayer } from "./video-player";
@@ -14,6 +14,7 @@ export interface TableProps<T = AnyObject> extends Omit<AntTableProps<T>, 'colum
14
14
  headerBgColor?: string;
15
15
  headerTextColor?: string;
16
16
  showSetting?: boolean;
17
+ persistKeys?: string;
17
18
  }
18
19
  export interface ColumnType<T = AnyObject> extends Omit<AntColumnType<T>, 'key'> {
19
20
  key: React.Key;
@@ -1,4 +1,4 @@
1
- var _excluded = ["type", "showSetting", "columns", "components", "headerBgColor", "headerTextColor"];
1
+ var _excluded = ["type", "showSetting", "columns", "components", "persistKeys", "headerBgColor", "headerTextColor"];
2
2
  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); }
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -29,6 +29,7 @@ var InternalTable = function InternalTable(_ref, ref) {
29
29
  showSetting = _ref.showSetting,
30
30
  columns = _ref.columns,
31
31
  components = _ref.components,
32
+ persistKeys = _ref.persistKeys,
32
33
  headerBgColor = _ref.headerBgColor,
33
34
  headerTextColor = _ref.headerTextColor,
34
35
  rest = _objectWithoutProperties(_ref, _excluded);
@@ -103,6 +104,14 @@ var InternalTable = function InternalTable(_ref, ref) {
103
104
  };
104
105
  var updateKeys = function updateKeys(keys) {
105
106
  setKeys(keys);
107
+ // 检查浏览器是否支持 localStorage
108
+ try {
109
+ if (typeof localStorage !== 'undefined' && persistKeys != null && persistKeys !== '') {
110
+ localStorage.setItem(persistKeys, JSON.stringify(keys));
111
+ }
112
+ } catch (e) {
113
+ console.error(e);
114
+ }
106
115
  };
107
116
  var filterColumns = function filterColumns(columns, keys) {
108
117
  return columns.filter(function (c) {
@@ -119,6 +128,19 @@ var InternalTable = function InternalTable(_ref, ref) {
119
128
  setInnerColumns(_columns);
120
129
  setKeys(_keys);
121
130
  }, [columns]);
131
+ useEffect(function () {
132
+ try {
133
+ if (typeof localStorage !== 'undefined' && persistKeys != null && persistKeys !== '') {
134
+ // 获取当前在代码中的行号
135
+ var _keys2 = localStorage.getItem(persistKeys);
136
+ if (_keys2) {
137
+ setKeys(JSON.parse(_keys2));
138
+ }
139
+ }
140
+ } catch (error) {
141
+ console.error(error);
142
+ }
143
+ }, [persistKeys]);
122
144
  return /*#__PURE__*/React.createElement(TableRowContext.Provider, {
123
145
  value: {
124
146
  columns: innerColumns,
@@ -146,8 +146,8 @@ export var VideoPlayer = /*#__PURE__*/forwardRef(function (_ref, ref) {
146
146
  setOptions = _useState34[1];
147
147
  var _useState35 = useState(false),
148
148
  _useState36 = _slicedToArray(_useState35, 2),
149
- faceApiInited = _useState36[0],
150
- setFaceApiInited = _useState36[1];
149
+ faceApiInitialized = _useState36[0],
150
+ setFaceApiInitialized = _useState36[1];
151
151
  var _useState37 = useState({
152
152
  width: 0,
153
153
  height: 0
@@ -168,7 +168,6 @@ export var VideoPlayer = /*#__PURE__*/forwardRef(function (_ref, ref) {
168
168
  setIsSeeking = _useState42[1];
169
169
  var _useState43 = useState(false),
170
170
  _useState44 = _slicedToArray(_useState43, 2),
171
- isError = _useState44[0],
172
171
  setIsError = _useState44[1];
173
172
  var _useState45 = useState(),
174
173
  _useState46 = _slicedToArray(_useState45, 2),
@@ -449,9 +448,9 @@ export var VideoPlayer = /*#__PURE__*/forwardRef(function (_ref, ref) {
449
448
  }
450
449
  if (faceFeature.emotion) {
451
450
  var _emotionMap;
452
- ctx.fillText("\u8868\u60C5: ".concat(Math.round(100 * expression[0][1]), "% ").concat( // eslint-disable-next-line @typescript-eslint/ban-ts-comment
451
+ ctx.fillText("".concat( // eslint-disable-next-line @typescript-eslint/ban-ts-comment
453
452
  // @ts-expect-error
454
- (_emotionMap = emotionMap[expression[0][0]]) !== null && _emotionMap !== void 0 ? _emotionMap : ''), person.detection.box.x, person.detection.box.y - 20
453
+ (_emotionMap = emotionMap[expression[0][0]]) !== null && _emotionMap !== void 0 ? _emotionMap : '', " ").concat(Math.round(100 * expression[0][1]), "% "), person.detection.box.x, person.detection.box.y - 20
455
454
  // person.detection.box.y - 42
456
455
  );
457
456
  }
@@ -480,7 +479,7 @@ export var VideoPlayer = /*#__PURE__*/forwardRef(function (_ref, ref) {
480
479
  }, []);
481
480
  var detectFaces = useCallback(function () {
482
481
  return new Promise(function (resolve, reject) {
483
- if (videoRef.current != null && detectAllFacesRef.current != null && options != null && faceApiInited) {
482
+ if (videoRef.current != null && detectAllFacesRef.current != null && options != null && faceApiInitialized) {
484
483
  var t0 = performance.now();
485
484
  detectAllFacesRef.current(videoRef.current, options).withFaceLandmarks().withFaceExpressions().withAgeAndGender()
486
485
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -500,7 +499,7 @@ export var VideoPlayer = /*#__PURE__*/forwardRef(function (_ref, ref) {
500
499
  });
501
500
 
502
501
  // 肢体检测
503
- }, [drawFaces, faceApiInited, aiFeature, options]);
502
+ }, [drawFaces, faceApiInitialized, aiFeature, options]);
504
503
  var drawKeyPoints = function drawKeyPoints(keypoints, ctx) {
505
504
  keypoints.forEach(function (keypoint) {
506
505
  if (keypoint.score && keypoint.score > 0.3) {
@@ -619,6 +618,7 @@ export var VideoPlayer = /*#__PURE__*/forwardRef(function (_ref, ref) {
619
618
 
620
619
  // 获取具体的错误代码
621
620
  var error = video.error;
621
+ console.log('发生错误', error);
622
622
  setIsError(true);
623
623
  if (error) {
624
624
  switch (error.code) {
@@ -677,7 +677,7 @@ export var VideoPlayer = /*#__PURE__*/forwardRef(function (_ref, ref) {
677
677
  console.error('tensorflow 加载失败: ', _context2.t0);
678
678
  case 17:
679
679
  _context2.prev = 17;
680
- if (!((aiFeature.anchor || aiFeature.emotion || aiFeature.character) && !faceApiInited)) {
680
+ if (!((aiFeature.anchor || aiFeature.emotion || aiFeature.character) && !faceApiInitialized)) {
681
681
  _context2.next = 35;
682
682
  break;
683
683
  }
@@ -705,7 +705,7 @@ export var VideoPlayer = /*#__PURE__*/forwardRef(function (_ref, ref) {
705
705
  maxResults: MAX_RESULTS
706
706
  }));
707
707
  detectAllFacesRef.current = faceapi.detectAllFaces;
708
- setFaceApiInited(true);
708
+ setFaceApiInitialized(true);
709
709
  case 35:
710
710
  _context2.next = 40;
711
711
  break;
@@ -752,7 +752,7 @@ export var VideoPlayer = /*#__PURE__*/forwardRef(function (_ref, ref) {
752
752
  return function () {
753
753
  loaded = false;
754
754
  };
755
- }, [aiFeature, faceApiInited, poseDetector, tfInitialized]);
755
+ }, [aiFeature, faceApiInitialized, poseDetector, tfInitialized]);
756
756
  useEffect(function () {
757
757
  var player = null;
758
758
  if (isLive && videoRef.current != null) {
@@ -908,7 +908,7 @@ export var VideoPlayer = /*#__PURE__*/forwardRef(function (_ref, ref) {
908
908
  ,
909
909
  onSeeked: handleSeeked,
910
910
  onError: handleVideoError
911
- })), controls === true && show && !isError && /*#__PURE__*/React.createElement("div", {
911
+ })), controls === true && show && /*#__PURE__*/React.createElement("div", {
912
912
  className: "".concat(bem.b('container').e('controls'))
913
913
  }, /*#__PURE__*/React.createElement("div", {
914
914
  className: "".concat(bem.b('container').e('mask')),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yootd",
3
- "version": "0.0.89",
3
+ "version": "0.0.91",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",