wargerm 0.7.30 → 0.7.32
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/components/Calendar/example/demo3.d.ts +2 -0
- package/dist/components/Calendar/utils.d.ts +4 -0
- package/dist/components/Swiper/index.d.ts +1 -0
- package/dist/components/TableEdit/example/demo3.d.ts +5 -0
- package/dist/components/Upload/example/UploadBigFile/api.d.ts +0 -0
- package/dist/components/Upload/example/UploadBigFile/index.d.ts +0 -0
- package/dist/components/Upload/example/UploadBigFile/utils/hash.d.ts +0 -0
- package/dist/components/Video/index.d.ts +5 -14
- package/dist/components/WForm/example/demo4.d.ts +3 -0
- package/dist/components/WForm/example/demo5.d.ts +3 -0
- package/dist/index.esm.js +174 -138
- package/dist/index.js +173 -137
- package/package.json +1 -1
@@ -30,6 +30,10 @@ export declare function initCalendar(date?: Dayjs): {
|
|
30
30
|
isCurrentMonth: boolean;
|
31
31
|
isCurrentDay: boolean;
|
32
32
|
}[];
|
33
|
+
/**
|
34
|
+
* 初始化日历 自定义前缀
|
35
|
+
*/
|
36
|
+
export declare function initCustomPrefixCalendar(date?: Dayjs, content?: any): any[];
|
33
37
|
/**
|
34
38
|
* 初始化日历
|
35
39
|
*/
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,14 +1,5 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
interface PlayerProps extends Player {
|
4
|
-
currentVideoIndex?: number;
|
5
|
-
video?: {
|
6
|
-
duration: number;
|
7
|
-
};
|
8
|
-
on: (eventName: string | symbol, listener: (...args: any[]) => void) => this;
|
9
|
-
off: (eventName: string | symbol, listener: (...args: any[]) => void) => this;
|
10
|
-
emit: (eventName: string | symbol, ...args: any[]) => boolean;
|
11
|
-
}
|
1
|
+
import { CSSProperties } from 'react';
|
2
|
+
import { IPlayerOptions } from 'xgplayer';
|
12
3
|
/** 清晰度视频项目,name 为清晰度,url 为视频源 */
|
13
4
|
export interface DefinitionItemProps {
|
14
5
|
name: string;
|
@@ -22,10 +13,10 @@ interface VideoProps extends Omit<IPlayerOptions, 'url' | 'loop'> {
|
|
22
13
|
videoUrls: string[];
|
23
14
|
/** 清晰度视频数组,顺序应与 videoUrls 保持一致 */
|
24
15
|
definitionList?: DefinitionItemProps[][];
|
25
|
-
/** 是否循环播放
|
16
|
+
/** 是否循环播放 */
|
26
17
|
isLoop?: boolean;
|
27
18
|
/** 是否可见 */
|
28
|
-
|
19
|
+
open?: boolean;
|
29
20
|
/** 是否静音播放 */
|
30
21
|
muted?: boolean;
|
31
22
|
/** 初始化显示首帧 */
|
@@ -40,5 +31,5 @@ interface VideoProps extends Omit<IPlayerOptions, 'url' | 'loop'> {
|
|
40
31
|
style?: CSSProperties;
|
41
32
|
className?: string;
|
42
33
|
}
|
43
|
-
declare const _default:
|
34
|
+
declare const _default: ({ id, videoUrls, definitionList, isLoop, muted, currentIndex: parentIndex, setCurrentIndex: setParentIndex, className, style, open, autoplay, videoInit, enableMemory, lastPlayTimeHideDelay, ...props }: VideoProps) => JSX.Element;
|
44
35
|
export default _default;
|
package/dist/index.esm.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import 'antd/dist/reset.css';
|
2
2
|
import React, { useRef, useEffect, useMemo, useState, useCallback, useImperativeHandle, memo, forwardRef, createRef } from 'react';
|
3
|
-
import { cloneDeep, uniqBy, isEmpty } from 'lodash-es';
|
3
|
+
import { cloneDeep, uniqBy, chunk, isEmpty } from 'lodash-es';
|
4
4
|
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
5
5
|
import { Menu, Dropdown, Button, Input, Upload as Upload$1, Modal as Modal$2, message, InputNumber, DatePicker, Radio, Space, Checkbox, Select, Switch, Tooltip, TreeSelect as TreeSelect$1, Cascader, Form, Row, Col, Spin, Pagination, Breadcrumb, ConfigProvider, notification } from 'antd';
|
6
6
|
import { createFromIconfontCN, PlusOutlined, CloseCircleOutlined, SearchOutlined, ReloadOutlined, EllipsisOutlined, ExclamationCircleOutlined, EyeOutlined, EditOutlined, DeleteOutlined, LeftOutlined, RightOutlined, CloseOutlined } from '@ant-design/icons';
|
@@ -5316,7 +5316,7 @@ var Index$b = function Index(_ref) {
|
|
5316
5316
|
}, none || '暂无数据');
|
5317
5317
|
};
|
5318
5318
|
|
5319
|
-
var _excluded$f = ["data", "onClick", "slidesPerView", "rowKey", "onSwiperChange", "renderItem"];
|
5319
|
+
var _excluded$f = ["data", "onClick", "slidesPerView", "rowKey", "onSwiperChange", "renderItem", "noMove"];
|
5320
5320
|
|
5321
5321
|
SwiperCore.use([Pagination$1, Navigation, Autoplay, Virtual]);
|
5322
5322
|
var Index$c = /*#__PURE__*/forwardRef(function (props, ref) {
|
@@ -5327,6 +5327,7 @@ var Index$c = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
5327
5327
|
rowKey = props.rowKey,
|
5328
5328
|
onSwiperChange = props.onSwiperChange,
|
5329
5329
|
renderItem = props.renderItem,
|
5330
|
+
noMove = props.noMove,
|
5330
5331
|
extraProps = _objectWithoutProperties(props, _excluded$f);
|
5331
5332
|
|
5332
5333
|
var _useState = useState(null),
|
@@ -5372,7 +5373,7 @@ var Index$c = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
5372
5373
|
height: '100%'
|
5373
5374
|
},
|
5374
5375
|
onClick: function onClick(event) {
|
5375
|
-
if (controlledSwiper) {
|
5376
|
+
if (controlledSwiper && !noMove) {
|
5376
5377
|
if (controlledSwiper.clickedIndex - slidesPerView > data.length) {
|
5377
5378
|
controlledSwiper.slideNext();
|
5378
5379
|
} else {
|
@@ -7559,22 +7560,32 @@ var TabelCard = function TabelCard(props, ref) {
|
|
7559
7560
|
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : _actionRef$current6.reload(true);
|
7560
7561
|
};
|
7561
7562
|
|
7563
|
+
var onKeyUpSubmit = function onKeyUpSubmit(values) {
|
7564
|
+
if (values.keyCode === 13) {
|
7565
|
+
var _searchFormRef$curren, _searchFormRef$curren2, _actionRef$current7;
|
7566
|
+
|
7567
|
+
(searchFormConfig === null || searchFormConfig === void 0 ? void 0 : searchFormConfig.handleSubmit) && searchFormConfig.handleSubmit((_searchFormRef$curren = searchFormRef.current) === null || _searchFormRef$curren === void 0 ? void 0 : _searchFormRef$curren.getFormValues());
|
7568
|
+
formSearchRef.current = (_searchFormRef$curren2 = searchFormRef.current) === null || _searchFormRef$curren2 === void 0 ? void 0 : _searchFormRef$curren2.getFormValues();
|
7569
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : _actionRef$current7.reload(true);
|
7570
|
+
}
|
7571
|
+
};
|
7572
|
+
|
7562
7573
|
var onReset = function onReset(values) {
|
7563
|
-
var _actionRef$
|
7574
|
+
var _actionRef$current8;
|
7564
7575
|
|
7565
7576
|
(searchFormConfig === null || searchFormConfig === void 0 ? void 0 : searchFormConfig.onReset) && searchFormConfig.onReset();
|
7566
7577
|
formSearchRef.current = _objectSpread2({}, values);
|
7567
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$
|
7578
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : _actionRef$current8.reload(true);
|
7568
7579
|
};
|
7569
7580
|
|
7570
7581
|
useEffect(function () {
|
7571
|
-
var _searchFormRef$
|
7582
|
+
var _searchFormRef$curren3, _searchFormRef$curren4;
|
7572
7583
|
|
7573
|
-
if ((_searchFormRef$
|
7574
|
-
var _searchFormRef$
|
7584
|
+
if ((_searchFormRef$curren3 = searchFormRef.current) === null || _searchFormRef$curren3 === void 0 ? void 0 : (_searchFormRef$curren4 = _searchFormRef$curren3.form) === null || _searchFormRef$curren4 === void 0 ? void 0 : _searchFormRef$curren4.getFieldsValue) {
|
7585
|
+
var _searchFormRef$curren5;
|
7575
7586
|
|
7576
7587
|
var obj = // filterObj(searchFormRef.current?.form?.getFieldsValue()) || {};
|
7577
|
-
filterObj((_searchFormRef$
|
7588
|
+
filterObj((_searchFormRef$curren5 = searchFormRef.current) === null || _searchFormRef$curren5 === void 0 ? void 0 : _searchFormRef$curren5.handleSearch(true)) || {};
|
7578
7589
|
(columns || []).filter(function (c) {
|
7579
7590
|
return c.notInitialValueInSearch;
|
7580
7591
|
}).forEach(function (item) {
|
@@ -7720,6 +7731,7 @@ var TabelCard = function TabelCard(props, ref) {
|
|
7720
7731
|
}),
|
7721
7732
|
onSubmit: onSubmit,
|
7722
7733
|
onReset: onReset,
|
7734
|
+
onKeyUp: onKeyUpSubmit,
|
7723
7735
|
columns: formSearchColumn.reduce(function (pre, column) {
|
7724
7736
|
if (column.type == 'group') {
|
7725
7737
|
return [].concat(_toConsumableArray(pre), _toConsumableArray(column.children));
|
@@ -7945,6 +7957,73 @@ function initCalendar(date) {
|
|
7945
7957
|
|
7946
7958
|
return [].concat(_toConsumableArray(lastDays.reverse()), currentDays, nextDays);
|
7947
7959
|
}
|
7960
|
+
/**
|
7961
|
+
* 初始化日历 自定义前缀
|
7962
|
+
*/
|
7963
|
+
|
7964
|
+
function initCustomPrefixCalendar(date, content) {
|
7965
|
+
// 当前月天数
|
7966
|
+
var totalDaysInMonth = getMonthDays(date); // 上个月天数
|
7967
|
+
|
7968
|
+
var totalDaysInLastMonth = getMonthDays(getLastMonth(date)); // 下个月开始日期
|
7969
|
+
|
7970
|
+
var nextFirstDate = 1;
|
7971
|
+
var lastDays = [],
|
7972
|
+
currentDays = [],
|
7973
|
+
nextDays = []; // 当前月第一天是星期几(索引值)
|
7974
|
+
|
7975
|
+
/**
|
7976
|
+
* 这里的索引值刚刚好是需要填充的上月的天数
|
7977
|
+
*/
|
7978
|
+
|
7979
|
+
var currentWeekDay = getWeekDays(date);
|
7980
|
+
|
7981
|
+
for (var i = 0, len = 42; i < len; i++) {
|
7982
|
+
// 填充上个月的天数
|
7983
|
+
if (i < currentWeekDay) {
|
7984
|
+
// lastDays.push(totalDaysInLastMonth);
|
7985
|
+
var daySting = dayjs(dayjs(date).subtract(1, 'month').format(YEAER_MONTH_FORMAT_EN) + '-' + totalDaysInLastMonth).format('YYYY-MM-DD');
|
7986
|
+
lastDays.push({
|
7987
|
+
date: daySting,
|
7988
|
+
text: formatDayWithTwoWords(totalDaysInLastMonth),
|
7989
|
+
isCurrentMonth: false,
|
7990
|
+
isCurrentDay: dayjs().format('YYYY-MM-DD') == daySting
|
7991
|
+
});
|
7992
|
+
totalDaysInLastMonth--;
|
7993
|
+
} // 填充下个月的天数
|
7994
|
+
else if (i >= totalDaysInMonth + currentWeekDay) {
|
7995
|
+
// nextDays.push(nextFirstDate);
|
7996
|
+
var _daySting3 = dayjs(dayjs(date).add(1, 'month').format(YEAER_MONTH_FORMAT_EN) + '-' + nextFirstDate).format('YYYY-MM-DD');
|
7997
|
+
|
7998
|
+
nextDays.push({
|
7999
|
+
date: _daySting3,
|
8000
|
+
text: formatDayWithTwoWords(nextFirstDate),
|
8001
|
+
isCurrentMonth: false,
|
8002
|
+
isCurrentDay: dayjs().format('YYYY-MM-DD') == _daySting3
|
8003
|
+
});
|
8004
|
+
nextFirstDate++;
|
8005
|
+
} // 填充当前月天数
|
8006
|
+
else {
|
8007
|
+
// currentDays.push(i - currentWeekDay + 1);
|
8008
|
+
var _daySting4 = dayjs(dayjs(date).format(YEAER_MONTH_FORMAT_EN) + '-' + (i - currentWeekDay + 1)).format('YYYY-MM-DD');
|
8009
|
+
|
8010
|
+
currentDays.push({
|
8011
|
+
date: _daySting4,
|
8012
|
+
text: formatDayWithTwoWords(i - currentWeekDay + 1),
|
8013
|
+
isCurrentMonth: true,
|
8014
|
+
isCurrentDay: dayjs().format('YYYY-MM-DD') == _daySting4
|
8015
|
+
});
|
8016
|
+
}
|
8017
|
+
} // 上个月需要倒序显示
|
8018
|
+
|
8019
|
+
|
8020
|
+
var dayArr = [].concat(_toConsumableArray(lastDays.reverse()), currentDays, nextDays);
|
8021
|
+
return chunk(dayArr, 7).map(function (day) {
|
8022
|
+
return [{
|
8023
|
+
content: content
|
8024
|
+
}].concat(_toConsumableArray(day));
|
8025
|
+
}).flat();
|
8026
|
+
}
|
7948
8027
|
/**
|
7949
8028
|
* 初始化日历
|
7950
8029
|
*/
|
@@ -7986,7 +8065,8 @@ function Calendar(_ref, ref) {
|
|
7986
8065
|
onCell = _ref.onCell,
|
7987
8066
|
calendarBodyClassName = _ref.calendarBodyClassName,
|
7988
8067
|
hiddenWeekLabel = _ref.hiddenWeekLabel,
|
7989
|
-
dateString = _ref.dateString
|
8068
|
+
dateString = _ref.dateString,
|
8069
|
+
customPrefix = _ref.customPrefix;
|
7990
8070
|
|
7991
8071
|
var _useState = useState(initCalendar()),
|
7992
8072
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -8003,7 +8083,8 @@ function Calendar(_ref, ref) {
|
|
8003
8083
|
oneWeekDays = _useState6[0],
|
8004
8084
|
setOneWeekDays = _useState6[1];
|
8005
8085
|
|
8006
|
-
var
|
8086
|
+
var customHeader = customPrefix ? [customPrefix.header] : [];
|
8087
|
+
var weekLabelArray = [].concat(customHeader, ['周一', '周二', '周三', '周四', '周五', '周六', '周日']);
|
8007
8088
|
|
8008
8089
|
var getweekDay = function getweekDay(date) {
|
8009
8090
|
var index = dayjs(date).day();
|
@@ -8020,14 +8101,14 @@ function Calendar(_ref, ref) {
|
|
8020
8101
|
if (type == 'day') {
|
8021
8102
|
setOneWeekDays(['时间'].concat(_toConsumableArray(getweekDay(datevalue))));
|
8022
8103
|
} else {
|
8023
|
-
setOneWeekDays(getWeekList(datevalue));
|
8104
|
+
setOneWeekDays(_toConsumableArray(getWeekList(datevalue)));
|
8024
8105
|
}
|
8025
8106
|
|
8026
8107
|
setDays(initWeekCalendar(type, datevalue));
|
8027
8108
|
} else {
|
8028
|
-
setDays(initCalendar(dateString || datevalue));
|
8109
|
+
setDays((customPrefix === null || customPrefix === void 0 ? void 0 : customPrefix.content) ? initCustomPrefixCalendar(dateString || datevalue, customPrefix === null || customPrefix === void 0 ? void 0 : customPrefix.content) : initCalendar(dateString || datevalue));
|
8029
8110
|
}
|
8030
|
-
}, [type, datevalue, dateString]);
|
8111
|
+
}, [type, datevalue, dateString, customPrefix]);
|
8031
8112
|
useEffect(function () {
|
8032
8113
|
setDatevalue(value || dayjs());
|
8033
8114
|
}, [value]);
|
@@ -8172,14 +8253,20 @@ function Calendar(_ref, ref) {
|
|
8172
8253
|
key: index
|
8173
8254
|
}, dateCellRender ? dateCellRender(day) : day.text) : null;
|
8174
8255
|
}))) : /*#__PURE__*/React.createElement(React.Fragment, null, !hiddenWeekLabel && /*#__PURE__*/React.createElement("div", {
|
8175
|
-
className: "calendar_header_wrapper"
|
8256
|
+
className: "calendar_header_wrapper",
|
8257
|
+
style: {
|
8258
|
+
gridTemplateColumns: "repeat(".concat(weekLabelArray.length, ", 1fr)")
|
8259
|
+
}
|
8176
8260
|
}, weekLabelArray.map(function (weekLabel) {
|
8177
8261
|
return /*#__PURE__*/React.createElement("div", {
|
8178
8262
|
key: weekLabel,
|
8179
8263
|
className: "flex ai-c jc-c"
|
8180
8264
|
}, weekLabel);
|
8181
8265
|
})), /*#__PURE__*/React.createElement("div", {
|
8182
|
-
className: "content_wrapper ".concat(calendarBodyClassName)
|
8266
|
+
className: "content_wrapper ".concat(calendarBodyClassName),
|
8267
|
+
style: {
|
8268
|
+
gridTemplateColumns: "repeat(".concat(weekLabelArray.length, ", 1fr)")
|
8269
|
+
}
|
8183
8270
|
}, days === null || days === void 0 ? void 0 : days.map(function (day, index) {
|
8184
8271
|
return /*#__PURE__*/React.createElement("div", {
|
8185
8272
|
onClick: function onClick() {
|
@@ -8187,7 +8274,7 @@ function Calendar(_ref, ref) {
|
|
8187
8274
|
},
|
8188
8275
|
className: "day_container ".concat(day.isCurrentDay ? 'isCurrentDay' : '', " ").concat(day.isCurrentMonth ? 'isCurrentMonth' : ''),
|
8189
8276
|
key: index
|
8190
|
-
}, dateCellRender ? dateCellRender(day) : day.text);
|
8277
|
+
}, (day === null || day === void 0 ? void 0 : day.content) ? day.content : dateCellRender ? dateCellRender(day) : day.text);
|
8191
8278
|
})))));
|
8192
8279
|
}
|
8193
8280
|
|
@@ -11409,14 +11496,14 @@ function DhPlayer(_ref, ref) {
|
|
11409
11496
|
|
11410
11497
|
var index$7 = /*#__PURE__*/forwardRef(DhPlayer);
|
11411
11498
|
|
11412
|
-
var _excluded$m = ["id", "videoUrls", "definitionList", "isLoop", "muted", "currentIndex", "setCurrentIndex", "className", "style", "
|
11499
|
+
var _excluded$m = ["id", "videoUrls", "definitionList", "isLoop", "muted", "currentIndex", "setCurrentIndex", "className", "style", "open", "autoplay", "videoInit", "enableMemory", "lastPlayTimeHideDelay"];
|
11413
11500
|
|
11414
11501
|
var DEFAULT_PLAY_BACK_RATE = [0.5, 0.75, 1, 1.5, 2]; // 默认记忆提示文字展示时长(s)
|
11415
11502
|
|
11416
11503
|
var DEFAULT_LAST_PLAY_TIME_DELAY = 5; // 默认音量大小
|
11417
11504
|
|
11418
11505
|
var DEFAULT_VOLUME = 0.6;
|
11419
|
-
var index$8 =
|
11506
|
+
var index$8 = (function (_ref) {
|
11420
11507
|
var id = _ref.id,
|
11421
11508
|
_ref$videoUrls = _ref.videoUrls,
|
11422
11509
|
videoUrls = _ref$videoUrls === void 0 ? [] : _ref$videoUrls,
|
@@ -11430,8 +11517,8 @@ var index$8 = /*#__PURE__*/forwardRef(function (_ref, playerRef) {
|
|
11430
11517
|
setParentIndex = _ref.setCurrentIndex,
|
11431
11518
|
className = _ref.className,
|
11432
11519
|
style = _ref.style,
|
11433
|
-
_ref$
|
11434
|
-
|
11520
|
+
_ref$open = _ref.open,
|
11521
|
+
open = _ref$open === void 0 ? true : _ref$open,
|
11435
11522
|
_ref$autoplay = _ref.autoplay,
|
11436
11523
|
autoplay = _ref$autoplay === void 0 ? false : _ref$autoplay,
|
11437
11524
|
_ref$videoInit = _ref.videoInit,
|
@@ -11443,26 +11530,19 @@ var index$8 = /*#__PURE__*/forwardRef(function (_ref, playerRef) {
|
|
11443
11530
|
props = _objectWithoutProperties(_ref, _excluded$m);
|
11444
11531
|
|
11445
11532
|
var player = useRef();
|
11446
|
-
|
11447
|
-
var _useState = useState(true),
|
11448
|
-
_useState2 = _slicedToArray(_useState, 2),
|
11449
|
-
firstRender = _useState2[0],
|
11450
|
-
setFirstRender = _useState2[1];
|
11451
|
-
|
11452
|
-
var _useState3 = useState(false),
|
11453
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
11454
|
-
ready = _useState4[0],
|
11455
|
-
setReady = _useState4[1];
|
11456
|
-
|
11457
11533
|
var currentPlayerIndex = useRef(0); // 内置的 index 状态管理
|
11458
11534
|
|
11459
|
-
var
|
11460
|
-
|
11461
|
-
videoIndex =
|
11462
|
-
setVideoIndex =
|
11463
|
-
|
11464
|
-
var currentIndex =
|
11465
|
-
|
11535
|
+
var _useState = useState(0),
|
11536
|
+
_useState2 = _slicedToArray(_useState, 2),
|
11537
|
+
videoIndex = _useState2[0],
|
11538
|
+
setVideoIndex = _useState2[1];
|
11539
|
+
|
11540
|
+
var currentIndex = useMemo(function () {
|
11541
|
+
return parentIndex !== null && parentIndex !== void 0 ? parentIndex : videoIndex;
|
11542
|
+
}, [parentIndex, videoIndex]);
|
11543
|
+
var setCurrentIndex = useMemo(function () {
|
11544
|
+
return setParentIndex !== null && setParentIndex !== void 0 ? setParentIndex : setVideoIndex;
|
11545
|
+
}, [setParentIndex, setVideoIndex]);
|
11466
11546
|
var config = useRef(_objectSpread2({
|
11467
11547
|
url: videoUrls[0],
|
11468
11548
|
playbackRate: DEFAULT_PLAY_BACK_RATE,
|
@@ -11476,52 +11556,25 @@ var index$8 = /*#__PURE__*/forwardRef(function (_ref, playerRef) {
|
|
11476
11556
|
}, props));
|
11477
11557
|
/** 设置当前播放 index */
|
11478
11558
|
|
11479
|
-
var handleSetCurrentIndex = useCallback(function (
|
11480
|
-
var currentIdx = _ref2.currentIdx,
|
11481
|
-
videoUrls = _ref2.videoUrls;
|
11559
|
+
var handleSetCurrentIndex = useCallback(function (currentIdx) {
|
11482
11560
|
var newIdx = currentIdx !== null && currentIdx !== void 0 ? currentIdx : currentPlayerIndex.current + 1;
|
11483
11561
|
|
11484
11562
|
if (newIdx >= videoUrls.length) {
|
11485
|
-
|
11563
|
+
if (isLoop) {
|
11564
|
+
// 允许循环则播放起始视频
|
11565
|
+
newIdx = 0;
|
11566
|
+
} else if (player.current && player.current.video) {
|
11567
|
+
// 不允许循环则进度条快进到最后
|
11568
|
+
player.current.currentTime = player.current.video.duration;
|
11569
|
+
return;
|
11570
|
+
}
|
11486
11571
|
}
|
11487
11572
|
|
11488
11573
|
setCurrentIndex(newIdx);
|
11489
|
-
}, [setCurrentIndex]);
|
11490
|
-
/** 结束事件 */
|
11491
|
-
|
11492
|
-
var onEnd = useCallback(function (isLoop, videoUrls) {
|
11493
|
-
return function () {
|
11494
|
-
// 如果是循环或有其他视频未播放完,继续播放下一个
|
11495
|
-
if (isLoop || !isLoop && currentPlayerIndex.current < videoUrls.length - 1) {
|
11496
|
-
setTimeout(function () {
|
11497
|
-
var _player$current;
|
11498
|
-
|
11499
|
-
return (_player$current = player.current) === null || _player$current === void 0 ? void 0 : _player$current.play();
|
11500
|
-
});
|
11501
|
-
}
|
11502
|
-
|
11503
|
-
handleSetCurrentIndex({
|
11504
|
-
videoUrls: videoUrls
|
11505
|
-
});
|
11506
|
-
};
|
11507
|
-
}, [handleSetCurrentIndex]);
|
11508
|
-
/** 点击下一个事件 */
|
11509
|
-
|
11510
|
-
var onPlayNextBtnClick = useCallback(function (videoUrls) {
|
11511
|
-
return function () {
|
11512
|
-
if (player.current) {
|
11513
|
-
// 防止 next 按钮消失
|
11514
|
-
player.current.currentVideoIndex = videoUrls.length - 2;
|
11515
|
-
}
|
11516
|
-
|
11517
|
-
handleSetCurrentIndex({
|
11518
|
-
videoUrls: videoUrls
|
11519
|
-
});
|
11520
|
-
};
|
11521
|
-
}, [handleSetCurrentIndex]);
|
11574
|
+
}, [isLoop, setCurrentIndex, videoUrls.length]);
|
11522
11575
|
/** 播放下一个 */
|
11523
11576
|
|
11524
|
-
var handlePlayNext = useCallback(function (currentIdx
|
11577
|
+
var handlePlayNext = useCallback(function (currentIdx) {
|
11525
11578
|
if (!player.current) {
|
11526
11579
|
return;
|
11527
11580
|
}
|
@@ -11535,7 +11588,7 @@ var index$8 = /*#__PURE__*/forwardRef(function (_ref, playerRef) {
|
|
11535
11588
|
// 防止 next 按钮消失
|
11536
11589
|
player.current.currentVideoIndex = -videoUrls.length;
|
11537
11590
|
}
|
11538
|
-
}, [videoUrls]);
|
11591
|
+
}, [videoUrls, isLoop]);
|
11539
11592
|
/** 重置视频 */
|
11540
11593
|
|
11541
11594
|
var handleReset = useCallback(function () {
|
@@ -11551,47 +11604,47 @@ var index$8 = /*#__PURE__*/forwardRef(function (_ref, playerRef) {
|
|
11551
11604
|
/** 弹窗中的视频关闭以后重置 */
|
11552
11605
|
|
11553
11606
|
useEffect(function () {
|
11554
|
-
if (!
|
11607
|
+
if (!open) {
|
11555
11608
|
handleReset();
|
11556
11609
|
}
|
11557
|
-
}, [handleReset,
|
11610
|
+
}, [handleReset, open]);
|
11558
11611
|
/** 当 currentIndex 改变以后自动播放下一个 */
|
11559
11612
|
|
11560
11613
|
useEffect(function () {
|
11561
|
-
if (!player.current || !
|
11614
|
+
if (!player.current || !open) {
|
11562
11615
|
return;
|
11563
11616
|
}
|
11564
11617
|
|
11565
|
-
handlePlayNext(currentIndex !== null && currentIndex !== void 0 ? currentIndex : currentPlayerIndex.current
|
11566
|
-
}, [currentIndex, handlePlayNext,
|
11618
|
+
handlePlayNext(currentIndex !== null && currentIndex !== void 0 ? currentIndex : currentPlayerIndex.current);
|
11619
|
+
}, [currentIndex, handlePlayNext, open]);
|
11567
11620
|
/** 播放器初始化并绑定事件 */
|
11568
11621
|
|
11569
11622
|
useEffect(function () {
|
11570
|
-
|
11571
|
-
|
11572
|
-
if (!visible || isEmpty(videoUrls) || player.current) {
|
11623
|
+
if (!open || isEmpty(videoUrls) || player.current) {
|
11573
11624
|
return;
|
11574
11625
|
}
|
11575
11626
|
|
11576
|
-
|
11577
|
-
|
11578
|
-
|
11579
|
-
|
11580
|
-
|
11581
|
-
|
11627
|
+
player.current = new Player(config.current);
|
11628
|
+
player.current.currentVideoIndex = -videoUrls.length;
|
11629
|
+
player.current.on('ended', function () {
|
11630
|
+
// 如果是循环或有其他视频未播放完,继续播放下一个
|
11631
|
+
if (isLoop || !isLoop && currentPlayerIndex.current < videoUrls.length - 1) {
|
11632
|
+
handleSetCurrentIndex();
|
11633
|
+
setTimeout(function () {
|
11634
|
+
var _player$current;
|
11582
11635
|
|
11583
|
-
|
11584
|
-
|
11636
|
+
return (_player$current = player.current) === null || _player$current === void 0 ? void 0 : _player$current.play();
|
11637
|
+
});
|
11638
|
+
} else {
|
11639
|
+
var _player$current2;
|
11585
11640
|
|
11586
|
-
|
11587
|
-
|
11588
|
-
|
11641
|
+
(_player$current2 = player.current) === null || _player$current2 === void 0 ? void 0 : _player$current2.pause();
|
11642
|
+
}
|
11643
|
+
}); // 播放记忆缓存
|
11589
11644
|
|
11590
11645
|
if (enableMemory) {
|
11591
|
-
var _player$current2;
|
11592
|
-
|
11593
11646
|
var videoPlayedTimeObj = JSON.parse(localStorage.getItem('videoPlayedTime') || '{}');
|
11594
|
-
|
11647
|
+
player.current.on('timeupdate', function () {
|
11595
11648
|
var _player$current3;
|
11596
11649
|
|
11597
11650
|
if (currentPlayerIndex.current === -1) {
|
@@ -11605,23 +11658,27 @@ var index$8 = /*#__PURE__*/forwardRef(function (_ref, playerRef) {
|
|
11605
11658
|
});
|
11606
11659
|
}
|
11607
11660
|
|
11608
|
-
|
11609
|
-
|
11661
|
+
player.current.on('playNextBtnClick', function () {
|
11662
|
+
if (!isLoop && player.current) {
|
11663
|
+
// 防止 next 按钮消失
|
11664
|
+
player.current.currentVideoIndex = videoUrls.length - 2;
|
11665
|
+
}
|
11666
|
+
|
11667
|
+
handleSetCurrentIndex();
|
11668
|
+
});
|
11669
|
+
}, [autoplay, enableMemory, handleSetCurrentIndex, id, isLoop, videoUrls, videoUrls.length, open]);
|
11610
11670
|
/** 读取缓存的播放记忆并跳转 */
|
11611
11671
|
|
11612
11672
|
useEffect(function () {
|
11613
|
-
if (enableMemory &&
|
11673
|
+
if (enableMemory && open) {
|
11614
11674
|
var _JSON$parse;
|
11615
11675
|
|
11616
|
-
var
|
11617
|
-
lastPlayTime =
|
11618
|
-
_videoIndex =
|
11676
|
+
var _ref2 = ((_JSON$parse = JSON.parse(localStorage.getItem('videoPlayedTime') || '{}')) === null || _JSON$parse === void 0 ? void 0 : _JSON$parse[id]) || {},
|
11677
|
+
lastPlayTime = _ref2.lastPlayTime,
|
11678
|
+
_videoIndex = _ref2.videoIndex;
|
11619
11679
|
|
11620
11680
|
setTimeout(function () {
|
11621
|
-
handleSetCurrentIndex(
|
11622
|
-
currentIdx: _videoIndex,
|
11623
|
-
videoUrls: videoUrls
|
11624
|
-
});
|
11681
|
+
handleSetCurrentIndex(_videoIndex);
|
11625
11682
|
setTimeout(function () {
|
11626
11683
|
if (player.current) {
|
11627
11684
|
player.current.currentTime = lastPlayTime;
|
@@ -11629,7 +11686,7 @@ var index$8 = /*#__PURE__*/forwardRef(function (_ref, playerRef) {
|
|
11629
11686
|
});
|
11630
11687
|
});
|
11631
11688
|
}
|
11632
|
-
}, [
|
11689
|
+
}, [open, enableMemory, handleSetCurrentIndex, id]);
|
11633
11690
|
/** 加载清晰度配置 */
|
11634
11691
|
|
11635
11692
|
useEffect(function () {
|
@@ -11637,23 +11694,10 @@ var index$8 = /*#__PURE__*/forwardRef(function (_ref, playerRef) {
|
|
11637
11694
|
player.current.emit('resourceReady', definitionList[currentIndex]);
|
11638
11695
|
}
|
11639
11696
|
}, [currentIndex, definitionList]);
|
11640
|
-
|
11641
|
-
|
11642
|
-
|
11643
|
-
if (firstRender) {
|
11644
|
-
return;
|
11645
|
-
}
|
11646
|
-
|
11647
|
-
(_player$current5 = player.current) === null || _player$current5 === void 0 ? void 0 : _player$current5.off('ended', onEnd(isLoop, videoUrls));
|
11648
|
-
(_player$current6 = player.current) === null || _player$current6 === void 0 ? void 0 : _player$current6.off('playNextBtnClick', onPlayNextBtnClick(videoUrls));
|
11649
|
-
(_player$current7 = player.current) === null || _player$current7 === void 0 ? void 0 : _player$current7.destroy();
|
11650
|
-
player.current = undefined;
|
11651
|
-
setReady(true); // eslint-disable-next-line react-hooks/exhaustive-deps
|
11652
|
-
}, [muted, isLoop, videoUrls, autoplay, videoInit, onEnd, onPlayNextBtnClick]);
|
11653
|
-
var getRef = useCallback(function (r) {
|
11654
|
-
if (r && visible) {
|
11697
|
+
var getRef = useCallback(function (ref) {
|
11698
|
+
if (ref && open) {
|
11655
11699
|
var newConfig = _objectSpread2(_objectSpread2({}, config.current), {}, {
|
11656
|
-
el:
|
11700
|
+
el: ref,
|
11657
11701
|
url: videoUrls[0],
|
11658
11702
|
playNext: {
|
11659
11703
|
urlList: videoUrls.slice(1)
|
@@ -11663,8 +11707,8 @@ var index$8 = /*#__PURE__*/forwardRef(function (_ref, playerRef) {
|
|
11663
11707
|
if (enableMemory) {
|
11664
11708
|
var _JSON$parse2;
|
11665
11709
|
|
11666
|
-
var
|
11667
|
-
lastPlayTime =
|
11710
|
+
var _ref3 = ((_JSON$parse2 = JSON.parse(localStorage.getItem('videoPlayedTime') || '{}')) === null || _JSON$parse2 === void 0 ? void 0 : _JSON$parse2[id]) || {},
|
11711
|
+
lastPlayTime = _ref3.lastPlayTime;
|
11668
11712
|
|
11669
11713
|
Object.assign(newConfig, {
|
11670
11714
|
lastPlayTime: lastPlayTime,
|
@@ -11674,15 +11718,7 @@ var index$8 = /*#__PURE__*/forwardRef(function (_ref, playerRef) {
|
|
11674
11718
|
|
11675
11719
|
config.current = newConfig;
|
11676
11720
|
}
|
11677
|
-
|
11678
|
-
if (playerRef) {
|
11679
|
-
if (typeof playerRef === 'function') {
|
11680
|
-
playerRef(player.current);
|
11681
|
-
} else {
|
11682
|
-
playerRef.current = player.current;
|
11683
|
-
}
|
11684
|
-
}
|
11685
|
-
}, [visible, playerRef, videoUrls, enableMemory, id, lastPlayTimeHideDelay]);
|
11721
|
+
}, [open, id, videoUrls, lastPlayTimeHideDelay, enableMemory]);
|
11686
11722
|
return /*#__PURE__*/React.createElement("div", {
|
11687
11723
|
className: className,
|
11688
11724
|
ref: getRef,
|
package/dist/index.js
CHANGED
@@ -5360,7 +5360,7 @@ var Index$b = function Index(_ref) {
|
|
5360
5360
|
}, none || '暂无数据');
|
5361
5361
|
};
|
5362
5362
|
|
5363
|
-
var _excluded$f = ["data", "onClick", "slidesPerView", "rowKey", "onSwiperChange", "renderItem"];
|
5363
|
+
var _excluded$f = ["data", "onClick", "slidesPerView", "rowKey", "onSwiperChange", "renderItem", "noMove"];
|
5364
5364
|
|
5365
5365
|
SwiperCore__default['default'].use([SwiperCore.Pagination, SwiperCore.Navigation, SwiperCore.Autoplay, SwiperCore.Virtual]);
|
5366
5366
|
var Index$c = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
@@ -5371,6 +5371,7 @@ var Index$c = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
5371
5371
|
rowKey = props.rowKey,
|
5372
5372
|
onSwiperChange = props.onSwiperChange,
|
5373
5373
|
renderItem = props.renderItem,
|
5374
|
+
noMove = props.noMove,
|
5374
5375
|
extraProps = _objectWithoutProperties(props, _excluded$f);
|
5375
5376
|
|
5376
5377
|
var _useState = React.useState(null),
|
@@ -5416,7 +5417,7 @@ var Index$c = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
5416
5417
|
height: '100%'
|
5417
5418
|
},
|
5418
5419
|
onClick: function onClick(event) {
|
5419
|
-
if (controlledSwiper) {
|
5420
|
+
if (controlledSwiper && !noMove) {
|
5420
5421
|
if (controlledSwiper.clickedIndex - slidesPerView > data.length) {
|
5421
5422
|
controlledSwiper.slideNext();
|
5422
5423
|
} else {
|
@@ -7603,22 +7604,32 @@ var TabelCard = function TabelCard(props, ref) {
|
|
7603
7604
|
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : _actionRef$current6.reload(true);
|
7604
7605
|
};
|
7605
7606
|
|
7607
|
+
var onKeyUpSubmit = function onKeyUpSubmit(values) {
|
7608
|
+
if (values.keyCode === 13) {
|
7609
|
+
var _searchFormRef$curren, _searchFormRef$curren2, _actionRef$current7;
|
7610
|
+
|
7611
|
+
(searchFormConfig === null || searchFormConfig === void 0 ? void 0 : searchFormConfig.handleSubmit) && searchFormConfig.handleSubmit((_searchFormRef$curren = searchFormRef.current) === null || _searchFormRef$curren === void 0 ? void 0 : _searchFormRef$curren.getFormValues());
|
7612
|
+
formSearchRef.current = (_searchFormRef$curren2 = searchFormRef.current) === null || _searchFormRef$curren2 === void 0 ? void 0 : _searchFormRef$curren2.getFormValues();
|
7613
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : _actionRef$current7.reload(true);
|
7614
|
+
}
|
7615
|
+
};
|
7616
|
+
|
7606
7617
|
var onReset = function onReset(values) {
|
7607
|
-
var _actionRef$
|
7618
|
+
var _actionRef$current8;
|
7608
7619
|
|
7609
7620
|
(searchFormConfig === null || searchFormConfig === void 0 ? void 0 : searchFormConfig.onReset) && searchFormConfig.onReset();
|
7610
7621
|
formSearchRef.current = _objectSpread2({}, values);
|
7611
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$
|
7622
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : _actionRef$current8.reload(true);
|
7612
7623
|
};
|
7613
7624
|
|
7614
7625
|
React.useEffect(function () {
|
7615
|
-
var _searchFormRef$
|
7626
|
+
var _searchFormRef$curren3, _searchFormRef$curren4;
|
7616
7627
|
|
7617
|
-
if ((_searchFormRef$
|
7618
|
-
var _searchFormRef$
|
7628
|
+
if ((_searchFormRef$curren3 = searchFormRef.current) === null || _searchFormRef$curren3 === void 0 ? void 0 : (_searchFormRef$curren4 = _searchFormRef$curren3.form) === null || _searchFormRef$curren4 === void 0 ? void 0 : _searchFormRef$curren4.getFieldsValue) {
|
7629
|
+
var _searchFormRef$curren5;
|
7619
7630
|
|
7620
7631
|
var obj = // filterObj(searchFormRef.current?.form?.getFieldsValue()) || {};
|
7621
|
-
filterObj((_searchFormRef$
|
7632
|
+
filterObj((_searchFormRef$curren5 = searchFormRef.current) === null || _searchFormRef$curren5 === void 0 ? void 0 : _searchFormRef$curren5.handleSearch(true)) || {};
|
7622
7633
|
(columns || []).filter(function (c) {
|
7623
7634
|
return c.notInitialValueInSearch;
|
7624
7635
|
}).forEach(function (item) {
|
@@ -7764,6 +7775,7 @@ var TabelCard = function TabelCard(props, ref) {
|
|
7764
7775
|
}),
|
7765
7776
|
onSubmit: onSubmit,
|
7766
7777
|
onReset: onReset,
|
7778
|
+
onKeyUp: onKeyUpSubmit,
|
7767
7779
|
columns: formSearchColumn.reduce(function (pre, column) {
|
7768
7780
|
if (column.type == 'group') {
|
7769
7781
|
return [].concat(_toConsumableArray(pre), _toConsumableArray(column.children));
|
@@ -7989,6 +8001,73 @@ function initCalendar(date) {
|
|
7989
8001
|
|
7990
8002
|
return [].concat(_toConsumableArray(lastDays.reverse()), currentDays, nextDays);
|
7991
8003
|
}
|
8004
|
+
/**
|
8005
|
+
* 初始化日历 自定义前缀
|
8006
|
+
*/
|
8007
|
+
|
8008
|
+
function initCustomPrefixCalendar(date, content) {
|
8009
|
+
// 当前月天数
|
8010
|
+
var totalDaysInMonth = getMonthDays(date); // 上个月天数
|
8011
|
+
|
8012
|
+
var totalDaysInLastMonth = getMonthDays(getLastMonth(date)); // 下个月开始日期
|
8013
|
+
|
8014
|
+
var nextFirstDate = 1;
|
8015
|
+
var lastDays = [],
|
8016
|
+
currentDays = [],
|
8017
|
+
nextDays = []; // 当前月第一天是星期几(索引值)
|
8018
|
+
|
8019
|
+
/**
|
8020
|
+
* 这里的索引值刚刚好是需要填充的上月的天数
|
8021
|
+
*/
|
8022
|
+
|
8023
|
+
var currentWeekDay = getWeekDays(date);
|
8024
|
+
|
8025
|
+
for (var i = 0, len = 42; i < len; i++) {
|
8026
|
+
// 填充上个月的天数
|
8027
|
+
if (i < currentWeekDay) {
|
8028
|
+
// lastDays.push(totalDaysInLastMonth);
|
8029
|
+
var daySting = dayjs__default['default'](dayjs__default['default'](date).subtract(1, 'month').format(YEAER_MONTH_FORMAT_EN) + '-' + totalDaysInLastMonth).format('YYYY-MM-DD');
|
8030
|
+
lastDays.push({
|
8031
|
+
date: daySting,
|
8032
|
+
text: formatDayWithTwoWords(totalDaysInLastMonth),
|
8033
|
+
isCurrentMonth: false,
|
8034
|
+
isCurrentDay: dayjs__default['default']().format('YYYY-MM-DD') == daySting
|
8035
|
+
});
|
8036
|
+
totalDaysInLastMonth--;
|
8037
|
+
} // 填充下个月的天数
|
8038
|
+
else if (i >= totalDaysInMonth + currentWeekDay) {
|
8039
|
+
// nextDays.push(nextFirstDate);
|
8040
|
+
var _daySting3 = dayjs__default['default'](dayjs__default['default'](date).add(1, 'month').format(YEAER_MONTH_FORMAT_EN) + '-' + nextFirstDate).format('YYYY-MM-DD');
|
8041
|
+
|
8042
|
+
nextDays.push({
|
8043
|
+
date: _daySting3,
|
8044
|
+
text: formatDayWithTwoWords(nextFirstDate),
|
8045
|
+
isCurrentMonth: false,
|
8046
|
+
isCurrentDay: dayjs__default['default']().format('YYYY-MM-DD') == _daySting3
|
8047
|
+
});
|
8048
|
+
nextFirstDate++;
|
8049
|
+
} // 填充当前月天数
|
8050
|
+
else {
|
8051
|
+
// currentDays.push(i - currentWeekDay + 1);
|
8052
|
+
var _daySting4 = dayjs__default['default'](dayjs__default['default'](date).format(YEAER_MONTH_FORMAT_EN) + '-' + (i - currentWeekDay + 1)).format('YYYY-MM-DD');
|
8053
|
+
|
8054
|
+
currentDays.push({
|
8055
|
+
date: _daySting4,
|
8056
|
+
text: formatDayWithTwoWords(i - currentWeekDay + 1),
|
8057
|
+
isCurrentMonth: true,
|
8058
|
+
isCurrentDay: dayjs__default['default']().format('YYYY-MM-DD') == _daySting4
|
8059
|
+
});
|
8060
|
+
}
|
8061
|
+
} // 上个月需要倒序显示
|
8062
|
+
|
8063
|
+
|
8064
|
+
var dayArr = [].concat(_toConsumableArray(lastDays.reverse()), currentDays, nextDays);
|
8065
|
+
return lodashEs.chunk(dayArr, 7).map(function (day) {
|
8066
|
+
return [{
|
8067
|
+
content: content
|
8068
|
+
}].concat(_toConsumableArray(day));
|
8069
|
+
}).flat();
|
8070
|
+
}
|
7992
8071
|
/**
|
7993
8072
|
* 初始化日历
|
7994
8073
|
*/
|
@@ -8030,7 +8109,8 @@ function Calendar(_ref, ref) {
|
|
8030
8109
|
onCell = _ref.onCell,
|
8031
8110
|
calendarBodyClassName = _ref.calendarBodyClassName,
|
8032
8111
|
hiddenWeekLabel = _ref.hiddenWeekLabel,
|
8033
|
-
dateString = _ref.dateString
|
8112
|
+
dateString = _ref.dateString,
|
8113
|
+
customPrefix = _ref.customPrefix;
|
8034
8114
|
|
8035
8115
|
var _useState = React.useState(initCalendar()),
|
8036
8116
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -8047,7 +8127,8 @@ function Calendar(_ref, ref) {
|
|
8047
8127
|
oneWeekDays = _useState6[0],
|
8048
8128
|
setOneWeekDays = _useState6[1];
|
8049
8129
|
|
8050
|
-
var
|
8130
|
+
var customHeader = customPrefix ? [customPrefix.header] : [];
|
8131
|
+
var weekLabelArray = [].concat(customHeader, ['周一', '周二', '周三', '周四', '周五', '周六', '周日']);
|
8051
8132
|
|
8052
8133
|
var getweekDay = function getweekDay(date) {
|
8053
8134
|
var index = dayjs__default['default'](date).day();
|
@@ -8064,14 +8145,14 @@ function Calendar(_ref, ref) {
|
|
8064
8145
|
if (type == 'day') {
|
8065
8146
|
setOneWeekDays(['时间'].concat(_toConsumableArray(getweekDay(datevalue))));
|
8066
8147
|
} else {
|
8067
|
-
setOneWeekDays(getWeekList(datevalue));
|
8148
|
+
setOneWeekDays(_toConsumableArray(getWeekList(datevalue)));
|
8068
8149
|
}
|
8069
8150
|
|
8070
8151
|
setDays(initWeekCalendar(type, datevalue));
|
8071
8152
|
} else {
|
8072
|
-
setDays(initCalendar(dateString || datevalue));
|
8153
|
+
setDays((customPrefix === null || customPrefix === void 0 ? void 0 : customPrefix.content) ? initCustomPrefixCalendar(dateString || datevalue, customPrefix === null || customPrefix === void 0 ? void 0 : customPrefix.content) : initCalendar(dateString || datevalue));
|
8073
8154
|
}
|
8074
|
-
}, [type, datevalue, dateString]);
|
8155
|
+
}, [type, datevalue, dateString, customPrefix]);
|
8075
8156
|
React.useEffect(function () {
|
8076
8157
|
setDatevalue(value || dayjs__default['default']());
|
8077
8158
|
}, [value]);
|
@@ -8216,14 +8297,20 @@ function Calendar(_ref, ref) {
|
|
8216
8297
|
key: index
|
8217
8298
|
}, dateCellRender ? dateCellRender(day) : day.text) : null;
|
8218
8299
|
}))) : /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, !hiddenWeekLabel && /*#__PURE__*/React__default['default'].createElement("div", {
|
8219
|
-
className: "calendar_header_wrapper"
|
8300
|
+
className: "calendar_header_wrapper",
|
8301
|
+
style: {
|
8302
|
+
gridTemplateColumns: "repeat(".concat(weekLabelArray.length, ", 1fr)")
|
8303
|
+
}
|
8220
8304
|
}, weekLabelArray.map(function (weekLabel) {
|
8221
8305
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
8222
8306
|
key: weekLabel,
|
8223
8307
|
className: "flex ai-c jc-c"
|
8224
8308
|
}, weekLabel);
|
8225
8309
|
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
8226
|
-
className: "content_wrapper ".concat(calendarBodyClassName)
|
8310
|
+
className: "content_wrapper ".concat(calendarBodyClassName),
|
8311
|
+
style: {
|
8312
|
+
gridTemplateColumns: "repeat(".concat(weekLabelArray.length, ", 1fr)")
|
8313
|
+
}
|
8227
8314
|
}, days === null || days === void 0 ? void 0 : days.map(function (day, index) {
|
8228
8315
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
8229
8316
|
onClick: function onClick() {
|
@@ -8231,7 +8318,7 @@ function Calendar(_ref, ref) {
|
|
8231
8318
|
},
|
8232
8319
|
className: "day_container ".concat(day.isCurrentDay ? 'isCurrentDay' : '', " ").concat(day.isCurrentMonth ? 'isCurrentMonth' : ''),
|
8233
8320
|
key: index
|
8234
|
-
}, dateCellRender ? dateCellRender(day) : day.text);
|
8321
|
+
}, (day === null || day === void 0 ? void 0 : day.content) ? day.content : dateCellRender ? dateCellRender(day) : day.text);
|
8235
8322
|
})))));
|
8236
8323
|
}
|
8237
8324
|
|
@@ -11453,14 +11540,14 @@ function DhPlayer(_ref, ref) {
|
|
11453
11540
|
|
11454
11541
|
var index$7 = /*#__PURE__*/React.forwardRef(DhPlayer);
|
11455
11542
|
|
11456
|
-
var _excluded$m = ["id", "videoUrls", "definitionList", "isLoop", "muted", "currentIndex", "setCurrentIndex", "className", "style", "
|
11543
|
+
var _excluded$m = ["id", "videoUrls", "definitionList", "isLoop", "muted", "currentIndex", "setCurrentIndex", "className", "style", "open", "autoplay", "videoInit", "enableMemory", "lastPlayTimeHideDelay"];
|
11457
11544
|
|
11458
11545
|
var DEFAULT_PLAY_BACK_RATE = [0.5, 0.75, 1, 1.5, 2]; // 默认记忆提示文字展示时长(s)
|
11459
11546
|
|
11460
11547
|
var DEFAULT_LAST_PLAY_TIME_DELAY = 5; // 默认音量大小
|
11461
11548
|
|
11462
11549
|
var DEFAULT_VOLUME = 0.6;
|
11463
|
-
var index$8 =
|
11550
|
+
var index$8 = (function (_ref) {
|
11464
11551
|
var id = _ref.id,
|
11465
11552
|
_ref$videoUrls = _ref.videoUrls,
|
11466
11553
|
videoUrls = _ref$videoUrls === void 0 ? [] : _ref$videoUrls,
|
@@ -11474,8 +11561,8 @@ var index$8 = /*#__PURE__*/React.forwardRef(function (_ref, playerRef) {
|
|
11474
11561
|
setParentIndex = _ref.setCurrentIndex,
|
11475
11562
|
className = _ref.className,
|
11476
11563
|
style = _ref.style,
|
11477
|
-
_ref$
|
11478
|
-
|
11564
|
+
_ref$open = _ref.open,
|
11565
|
+
open = _ref$open === void 0 ? true : _ref$open,
|
11479
11566
|
_ref$autoplay = _ref.autoplay,
|
11480
11567
|
autoplay = _ref$autoplay === void 0 ? false : _ref$autoplay,
|
11481
11568
|
_ref$videoInit = _ref.videoInit,
|
@@ -11487,26 +11574,19 @@ var index$8 = /*#__PURE__*/React.forwardRef(function (_ref, playerRef) {
|
|
11487
11574
|
props = _objectWithoutProperties(_ref, _excluded$m);
|
11488
11575
|
|
11489
11576
|
var player = React.useRef();
|
11490
|
-
|
11491
|
-
var _useState = React.useState(true),
|
11492
|
-
_useState2 = _slicedToArray(_useState, 2),
|
11493
|
-
firstRender = _useState2[0],
|
11494
|
-
setFirstRender = _useState2[1];
|
11495
|
-
|
11496
|
-
var _useState3 = React.useState(false),
|
11497
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
11498
|
-
ready = _useState4[0],
|
11499
|
-
setReady = _useState4[1];
|
11500
|
-
|
11501
11577
|
var currentPlayerIndex = React.useRef(0); // 内置的 index 状态管理
|
11502
11578
|
|
11503
|
-
var
|
11504
|
-
|
11505
|
-
videoIndex =
|
11506
|
-
setVideoIndex =
|
11507
|
-
|
11508
|
-
var currentIndex =
|
11509
|
-
|
11579
|
+
var _useState = React.useState(0),
|
11580
|
+
_useState2 = _slicedToArray(_useState, 2),
|
11581
|
+
videoIndex = _useState2[0],
|
11582
|
+
setVideoIndex = _useState2[1];
|
11583
|
+
|
11584
|
+
var currentIndex = React.useMemo(function () {
|
11585
|
+
return parentIndex !== null && parentIndex !== void 0 ? parentIndex : videoIndex;
|
11586
|
+
}, [parentIndex, videoIndex]);
|
11587
|
+
var setCurrentIndex = React.useMemo(function () {
|
11588
|
+
return setParentIndex !== null && setParentIndex !== void 0 ? setParentIndex : setVideoIndex;
|
11589
|
+
}, [setParentIndex, setVideoIndex]);
|
11510
11590
|
var config = React.useRef(_objectSpread2({
|
11511
11591
|
url: videoUrls[0],
|
11512
11592
|
playbackRate: DEFAULT_PLAY_BACK_RATE,
|
@@ -11520,52 +11600,25 @@ var index$8 = /*#__PURE__*/React.forwardRef(function (_ref, playerRef) {
|
|
11520
11600
|
}, props));
|
11521
11601
|
/** 设置当前播放 index */
|
11522
11602
|
|
11523
|
-
var handleSetCurrentIndex = React.useCallback(function (
|
11524
|
-
var currentIdx = _ref2.currentIdx,
|
11525
|
-
videoUrls = _ref2.videoUrls;
|
11603
|
+
var handleSetCurrentIndex = React.useCallback(function (currentIdx) {
|
11526
11604
|
var newIdx = currentIdx !== null && currentIdx !== void 0 ? currentIdx : currentPlayerIndex.current + 1;
|
11527
11605
|
|
11528
11606
|
if (newIdx >= videoUrls.length) {
|
11529
|
-
|
11607
|
+
if (isLoop) {
|
11608
|
+
// 允许循环则播放起始视频
|
11609
|
+
newIdx = 0;
|
11610
|
+
} else if (player.current && player.current.video) {
|
11611
|
+
// 不允许循环则进度条快进到最后
|
11612
|
+
player.current.currentTime = player.current.video.duration;
|
11613
|
+
return;
|
11614
|
+
}
|
11530
11615
|
}
|
11531
11616
|
|
11532
11617
|
setCurrentIndex(newIdx);
|
11533
|
-
}, [setCurrentIndex]);
|
11534
|
-
/** 结束事件 */
|
11535
|
-
|
11536
|
-
var onEnd = React.useCallback(function (isLoop, videoUrls) {
|
11537
|
-
return function () {
|
11538
|
-
// 如果是循环或有其他视频未播放完,继续播放下一个
|
11539
|
-
if (isLoop || !isLoop && currentPlayerIndex.current < videoUrls.length - 1) {
|
11540
|
-
setTimeout(function () {
|
11541
|
-
var _player$current;
|
11542
|
-
|
11543
|
-
return (_player$current = player.current) === null || _player$current === void 0 ? void 0 : _player$current.play();
|
11544
|
-
});
|
11545
|
-
}
|
11546
|
-
|
11547
|
-
handleSetCurrentIndex({
|
11548
|
-
videoUrls: videoUrls
|
11549
|
-
});
|
11550
|
-
};
|
11551
|
-
}, [handleSetCurrentIndex]);
|
11552
|
-
/** 点击下一个事件 */
|
11553
|
-
|
11554
|
-
var onPlayNextBtnClick = React.useCallback(function (videoUrls) {
|
11555
|
-
return function () {
|
11556
|
-
if (player.current) {
|
11557
|
-
// 防止 next 按钮消失
|
11558
|
-
player.current.currentVideoIndex = videoUrls.length - 2;
|
11559
|
-
}
|
11560
|
-
|
11561
|
-
handleSetCurrentIndex({
|
11562
|
-
videoUrls: videoUrls
|
11563
|
-
});
|
11564
|
-
};
|
11565
|
-
}, [handleSetCurrentIndex]);
|
11618
|
+
}, [isLoop, setCurrentIndex, videoUrls.length]);
|
11566
11619
|
/** 播放下一个 */
|
11567
11620
|
|
11568
|
-
var handlePlayNext = React.useCallback(function (currentIdx
|
11621
|
+
var handlePlayNext = React.useCallback(function (currentIdx) {
|
11569
11622
|
if (!player.current) {
|
11570
11623
|
return;
|
11571
11624
|
}
|
@@ -11579,7 +11632,7 @@ var index$8 = /*#__PURE__*/React.forwardRef(function (_ref, playerRef) {
|
|
11579
11632
|
// 防止 next 按钮消失
|
11580
11633
|
player.current.currentVideoIndex = -videoUrls.length;
|
11581
11634
|
}
|
11582
|
-
}, [videoUrls]);
|
11635
|
+
}, [videoUrls, isLoop]);
|
11583
11636
|
/** 重置视频 */
|
11584
11637
|
|
11585
11638
|
var handleReset = React.useCallback(function () {
|
@@ -11595,47 +11648,47 @@ var index$8 = /*#__PURE__*/React.forwardRef(function (_ref, playerRef) {
|
|
11595
11648
|
/** 弹窗中的视频关闭以后重置 */
|
11596
11649
|
|
11597
11650
|
React.useEffect(function () {
|
11598
|
-
if (!
|
11651
|
+
if (!open) {
|
11599
11652
|
handleReset();
|
11600
11653
|
}
|
11601
|
-
}, [handleReset,
|
11654
|
+
}, [handleReset, open]);
|
11602
11655
|
/** 当 currentIndex 改变以后自动播放下一个 */
|
11603
11656
|
|
11604
11657
|
React.useEffect(function () {
|
11605
|
-
if (!player.current || !
|
11658
|
+
if (!player.current || !open) {
|
11606
11659
|
return;
|
11607
11660
|
}
|
11608
11661
|
|
11609
|
-
handlePlayNext(currentIndex !== null && currentIndex !== void 0 ? currentIndex : currentPlayerIndex.current
|
11610
|
-
}, [currentIndex, handlePlayNext,
|
11662
|
+
handlePlayNext(currentIndex !== null && currentIndex !== void 0 ? currentIndex : currentPlayerIndex.current);
|
11663
|
+
}, [currentIndex, handlePlayNext, open]);
|
11611
11664
|
/** 播放器初始化并绑定事件 */
|
11612
11665
|
|
11613
11666
|
React.useEffect(function () {
|
11614
|
-
|
11615
|
-
|
11616
|
-
if (!visible || lodashEs.isEmpty(videoUrls) || player.current) {
|
11667
|
+
if (!open || lodashEs.isEmpty(videoUrls) || player.current) {
|
11617
11668
|
return;
|
11618
11669
|
}
|
11619
11670
|
|
11620
|
-
|
11621
|
-
|
11622
|
-
|
11623
|
-
|
11624
|
-
|
11625
|
-
|
11671
|
+
player.current = new Player__default['default'](config.current);
|
11672
|
+
player.current.currentVideoIndex = -videoUrls.length;
|
11673
|
+
player.current.on('ended', function () {
|
11674
|
+
// 如果是循环或有其他视频未播放完,继续播放下一个
|
11675
|
+
if (isLoop || !isLoop && currentPlayerIndex.current < videoUrls.length - 1) {
|
11676
|
+
handleSetCurrentIndex();
|
11677
|
+
setTimeout(function () {
|
11678
|
+
var _player$current;
|
11626
11679
|
|
11627
|
-
|
11628
|
-
|
11680
|
+
return (_player$current = player.current) === null || _player$current === void 0 ? void 0 : _player$current.play();
|
11681
|
+
});
|
11682
|
+
} else {
|
11683
|
+
var _player$current2;
|
11629
11684
|
|
11630
|
-
|
11631
|
-
|
11632
|
-
|
11685
|
+
(_player$current2 = player.current) === null || _player$current2 === void 0 ? void 0 : _player$current2.pause();
|
11686
|
+
}
|
11687
|
+
}); // 播放记忆缓存
|
11633
11688
|
|
11634
11689
|
if (enableMemory) {
|
11635
|
-
var _player$current2;
|
11636
|
-
|
11637
11690
|
var videoPlayedTimeObj = JSON.parse(localStorage.getItem('videoPlayedTime') || '{}');
|
11638
|
-
|
11691
|
+
player.current.on('timeupdate', function () {
|
11639
11692
|
var _player$current3;
|
11640
11693
|
|
11641
11694
|
if (currentPlayerIndex.current === -1) {
|
@@ -11649,23 +11702,27 @@ var index$8 = /*#__PURE__*/React.forwardRef(function (_ref, playerRef) {
|
|
11649
11702
|
});
|
11650
11703
|
}
|
11651
11704
|
|
11652
|
-
|
11653
|
-
|
11705
|
+
player.current.on('playNextBtnClick', function () {
|
11706
|
+
if (!isLoop && player.current) {
|
11707
|
+
// 防止 next 按钮消失
|
11708
|
+
player.current.currentVideoIndex = videoUrls.length - 2;
|
11709
|
+
}
|
11710
|
+
|
11711
|
+
handleSetCurrentIndex();
|
11712
|
+
});
|
11713
|
+
}, [autoplay, enableMemory, handleSetCurrentIndex, id, isLoop, videoUrls, videoUrls.length, open]);
|
11654
11714
|
/** 读取缓存的播放记忆并跳转 */
|
11655
11715
|
|
11656
11716
|
React.useEffect(function () {
|
11657
|
-
if (enableMemory &&
|
11717
|
+
if (enableMemory && open) {
|
11658
11718
|
var _JSON$parse;
|
11659
11719
|
|
11660
|
-
var
|
11661
|
-
lastPlayTime =
|
11662
|
-
_videoIndex =
|
11720
|
+
var _ref2 = ((_JSON$parse = JSON.parse(localStorage.getItem('videoPlayedTime') || '{}')) === null || _JSON$parse === void 0 ? void 0 : _JSON$parse[id]) || {},
|
11721
|
+
lastPlayTime = _ref2.lastPlayTime,
|
11722
|
+
_videoIndex = _ref2.videoIndex;
|
11663
11723
|
|
11664
11724
|
setTimeout(function () {
|
11665
|
-
handleSetCurrentIndex(
|
11666
|
-
currentIdx: _videoIndex,
|
11667
|
-
videoUrls: videoUrls
|
11668
|
-
});
|
11725
|
+
handleSetCurrentIndex(_videoIndex);
|
11669
11726
|
setTimeout(function () {
|
11670
11727
|
if (player.current) {
|
11671
11728
|
player.current.currentTime = lastPlayTime;
|
@@ -11673,7 +11730,7 @@ var index$8 = /*#__PURE__*/React.forwardRef(function (_ref, playerRef) {
|
|
11673
11730
|
});
|
11674
11731
|
});
|
11675
11732
|
}
|
11676
|
-
}, [
|
11733
|
+
}, [open, enableMemory, handleSetCurrentIndex, id]);
|
11677
11734
|
/** 加载清晰度配置 */
|
11678
11735
|
|
11679
11736
|
React.useEffect(function () {
|
@@ -11681,23 +11738,10 @@ var index$8 = /*#__PURE__*/React.forwardRef(function (_ref, playerRef) {
|
|
11681
11738
|
player.current.emit('resourceReady', definitionList[currentIndex]);
|
11682
11739
|
}
|
11683
11740
|
}, [currentIndex, definitionList]);
|
11684
|
-
React.
|
11685
|
-
|
11686
|
-
|
11687
|
-
if (firstRender) {
|
11688
|
-
return;
|
11689
|
-
}
|
11690
|
-
|
11691
|
-
(_player$current5 = player.current) === null || _player$current5 === void 0 ? void 0 : _player$current5.off('ended', onEnd(isLoop, videoUrls));
|
11692
|
-
(_player$current6 = player.current) === null || _player$current6 === void 0 ? void 0 : _player$current6.off('playNextBtnClick', onPlayNextBtnClick(videoUrls));
|
11693
|
-
(_player$current7 = player.current) === null || _player$current7 === void 0 ? void 0 : _player$current7.destroy();
|
11694
|
-
player.current = undefined;
|
11695
|
-
setReady(true); // eslint-disable-next-line react-hooks/exhaustive-deps
|
11696
|
-
}, [muted, isLoop, videoUrls, autoplay, videoInit, onEnd, onPlayNextBtnClick]);
|
11697
|
-
var getRef = React.useCallback(function (r) {
|
11698
|
-
if (r && visible) {
|
11741
|
+
var getRef = React.useCallback(function (ref) {
|
11742
|
+
if (ref && open) {
|
11699
11743
|
var newConfig = _objectSpread2(_objectSpread2({}, config.current), {}, {
|
11700
|
-
el:
|
11744
|
+
el: ref,
|
11701
11745
|
url: videoUrls[0],
|
11702
11746
|
playNext: {
|
11703
11747
|
urlList: videoUrls.slice(1)
|
@@ -11707,8 +11751,8 @@ var index$8 = /*#__PURE__*/React.forwardRef(function (_ref, playerRef) {
|
|
11707
11751
|
if (enableMemory) {
|
11708
11752
|
var _JSON$parse2;
|
11709
11753
|
|
11710
|
-
var
|
11711
|
-
lastPlayTime =
|
11754
|
+
var _ref3 = ((_JSON$parse2 = JSON.parse(localStorage.getItem('videoPlayedTime') || '{}')) === null || _JSON$parse2 === void 0 ? void 0 : _JSON$parse2[id]) || {},
|
11755
|
+
lastPlayTime = _ref3.lastPlayTime;
|
11712
11756
|
|
11713
11757
|
Object.assign(newConfig, {
|
11714
11758
|
lastPlayTime: lastPlayTime,
|
@@ -11718,15 +11762,7 @@ var index$8 = /*#__PURE__*/React.forwardRef(function (_ref, playerRef) {
|
|
11718
11762
|
|
11719
11763
|
config.current = newConfig;
|
11720
11764
|
}
|
11721
|
-
|
11722
|
-
if (playerRef) {
|
11723
|
-
if (typeof playerRef === 'function') {
|
11724
|
-
playerRef(player.current);
|
11725
|
-
} else {
|
11726
|
-
playerRef.current = player.current;
|
11727
|
-
}
|
11728
|
-
}
|
11729
|
-
}, [visible, playerRef, videoUrls, enableMemory, id, lastPlayTimeHideDelay]);
|
11765
|
+
}, [open, id, videoUrls, lastPlayTimeHideDelay, enableMemory]);
|
11730
11766
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
11731
11767
|
className: className,
|
11732
11768
|
ref: getRef,
|