wargerm 0.5.29 → 0.5.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.
@@ -0,0 +1,6 @@
1
+ export declare const YEAER_MONTH_FORMAT_ZH = "YYYY\u5E74MM\u6708";
2
+ export declare const YEAER_MONTH_FORMAT_EN = "YYYY-MM";
3
+ export declare const YEAER_MONTH_FORMAT_FULL = "YYYY-MM-DD";
4
+ export declare const WEEk_HEADER: string[];
5
+ export declare const TOTAL_LENGTH: number;
6
+ export declare const INIT_DAYS: number[];
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export default function Tab4(): JSX.Element;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import './index-light.less';
3
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<unknown>>>;
4
+ export default _default;
@@ -0,0 +1,42 @@
1
+ import { Moment } from 'moment';
2
+ export declare function getMonthDays(date?: string | Moment): number;
3
+ /**
4
+ * 获取当前月第一天是星期几
5
+ */
6
+ export declare function getWeekDays(date?: Moment): number;
7
+ /**
8
+ * 获取当前星期第一天到星期天
9
+ */
10
+ export declare function getWeekList(date?: Moment): string[];
11
+ /**
12
+ * 获取上个月份
13
+ */
14
+ export declare function getLastMonth(date?: Moment): string;
15
+ /**
16
+ * 获取下个月份
17
+ */
18
+ export declare function getNextMonth(date?: Moment): string;
19
+ /**
20
+ * 格式化日期为两个单词,例如:‘1’号 格式为 ‘01’
21
+ * @param {*} dateNumber
22
+ */
23
+ export declare const formatDayWithTwoWords: (dateNumber: number) => string | number;
24
+ /**
25
+ * 初始化日历
26
+ */
27
+ export declare function initCalendar(date?: Moment): {
28
+ date: string;
29
+ text: string | number;
30
+ isCurrentMonth: boolean;
31
+ isCurrentDay: boolean;
32
+ }[];
33
+ /**
34
+ * 初始化日历
35
+ */
36
+ export declare function initWeekCalendar(type: string, date?: Moment): ({
37
+ text: string;
38
+ date?: undefined;
39
+ } | {
40
+ date: string;
41
+ text?: undefined;
42
+ })[];
package/dist/index.css CHANGED
@@ -12744,6 +12744,70 @@ button.swiper-pagination-bullet {
12744
12744
  cursor: se-resize;
12745
12745
  z-index: 101;
12746
12746
  }
12747
+ .content_container {
12748
+ width: 100%;
12749
+ height: 100%;
12750
+ }
12751
+ .content_container .toolbar_container {
12752
+ position: relative;
12753
+ display: flex;
12754
+ align-items: center;
12755
+ justify-content: center;
12756
+ height: 94px;
12757
+ background: white;
12758
+ border: 1px solid rgb(215 215 215);
12759
+ }
12760
+ .content_container .calendar_header_wrapper {
12761
+ display: grid;
12762
+ grid-template-columns: repeat(7, 1fr);
12763
+ width: 100%;
12764
+ height: 47px;
12765
+ color: #fff;
12766
+ background: #26958c;
12767
+ border: 1px solid rgb(215 215 215);
12768
+ }
12769
+ .content_container .content_wrapper {
12770
+ display: grid;
12771
+ grid-template-columns: repeat(7, 1fr);
12772
+ border: 1px solid rgb(215 215 215);
12773
+ }
12774
+ .content_container .content_wrapper .day_container {
12775
+ position: relative;
12776
+ display: flex;
12777
+ align-items: center;
12778
+ justify-content: center;
12779
+ height: 100px;
12780
+ color: #333;
12781
+ background: #f6f6f6;
12782
+ border-right: 1px solid rgb(215 215 215);
12783
+ border-bottom: 1px solid rgb(215 215 215);
12784
+ cursor: pointer;
12785
+ }
12786
+ .content_container .content_wrapper .day_container:hover {
12787
+ box-shadow: inset 0px 0px 5px 1px lightgreen;
12788
+ }
12789
+ .content_container .content_wrapper .date_title {
12790
+ display: inline-block;
12791
+ width: 24px;
12792
+ height: 20px;
12793
+ margin-left: 4px;
12794
+ color: rgb(103 113 122);
12795
+ font-weight: 400;
12796
+ font-size: 16px;
12797
+ font-family: PingFangSC-Regular, PingFang SC;
12798
+ line-height: 20px;
12799
+ text-align: center;
12800
+ }
12801
+ .content_container .content_wrapper .isCurrentMonth {
12802
+ color: #000;
12803
+ background: #fff;
12804
+ }
12805
+ .content_container .content_wrapper .isToday {
12806
+ background: lightgreen;
12807
+ }
12808
+ .content_container .content_wrapper .isCurrentDay {
12809
+ box-shadow: inset 0px 0px 5px 1px lightgreen;
12810
+ }
12747
12811
 
12748
12812
  /* Color
12749
12813
  ----------------------- */
@@ -28107,3 +28171,68 @@ button[data-prefers-color='light'] .swiper-pagination-bullet {
28107
28171
  opacity: 1;
28108
28172
  background: #9cd0ef;
28109
28173
  }
28174
+
28175
+ .content_container {
28176
+ width: 100%;
28177
+ height: 100%;
28178
+ }
28179
+ .content_container .toolbar_container {
28180
+ position: relative;
28181
+ display: flex;
28182
+ align-items: center;
28183
+ justify-content: center;
28184
+ height: 94px;
28185
+ background: white;
28186
+ border: 1px solid rgb(215 215 215);
28187
+ }
28188
+ .content_container .calendar_header_wrapper {
28189
+ display: grid;
28190
+ grid-template-columns: repeat(7, 1fr);
28191
+ width: 100%;
28192
+ height: 47px;
28193
+ color: #fff;
28194
+ background: #26958c;
28195
+ border: 1px solid rgb(215 215 215);
28196
+ }
28197
+ .content_container .content_wrapper {
28198
+ display: grid;
28199
+ grid-template-columns: repeat(7, 1fr);
28200
+ border: 1px solid rgb(215 215 215);
28201
+ }
28202
+ .content_container .content_wrapper .day_container {
28203
+ position: relative;
28204
+ display: flex;
28205
+ align-items: center;
28206
+ justify-content: center;
28207
+ height: 100px;
28208
+ color: #333;
28209
+ background: #f6f6f6;
28210
+ border-right: 1px solid rgb(215 215 215);
28211
+ border-bottom: 1px solid rgb(215 215 215);
28212
+ cursor: pointer;
28213
+ }
28214
+ .content_container .content_wrapper .day_container:hover {
28215
+ box-shadow: inset 0px 0px 5px 1px lightgreen;
28216
+ }
28217
+ .content_container .content_wrapper .date_title {
28218
+ display: inline-block;
28219
+ width: 24px;
28220
+ height: 20px;
28221
+ margin-left: 4px;
28222
+ color: rgb(103 113 122);
28223
+ font-weight: 400;
28224
+ font-size: 16px;
28225
+ font-family: PingFangSC-Regular, PingFang SC;
28226
+ line-height: 20px;
28227
+ text-align: center;
28228
+ }
28229
+ .content_container .content_wrapper .isCurrentMonth {
28230
+ color: #000;
28231
+ background: #fff;
28232
+ }
28233
+ .content_container .content_wrapper .isToday {
28234
+ background: lightgreen;
28235
+ }
28236
+ .content_container .content_wrapper .isCurrentDay {
28237
+ box-shadow: inset 0px 0px 5px 1px lightgreen;
28238
+ }
package/dist/index.d.ts CHANGED
@@ -29,6 +29,7 @@ export { default as DragBox } from './components/DragBox';
29
29
  export { default as ModalForm } from './components/ModalForm';
30
30
  export { default as TabelCard } from './components/TabelCard';
31
31
  export { default as Cascader } from './components/Cascader';
32
+ export { default as Calendar } from './components/Calendar';
32
33
  export { default as WebsocketHeart } from './components/WebsocketHeart';
33
34
  export { default as VideoPlayer } from './components/VideoPlayer';
34
35
  export { default as Video } from './components/Video';
@@ -12744,6 +12744,70 @@ button.swiper-pagination-bullet {
12744
12744
  cursor: se-resize;
12745
12745
  z-index: 101;
12746
12746
  }
12747
+ .content_container {
12748
+ width: 100%;
12749
+ height: 100%;
12750
+ }
12751
+ .content_container .toolbar_container {
12752
+ position: relative;
12753
+ display: flex;
12754
+ align-items: center;
12755
+ justify-content: center;
12756
+ height: 94px;
12757
+ background: white;
12758
+ border: 1px solid rgb(215 215 215);
12759
+ }
12760
+ .content_container .calendar_header_wrapper {
12761
+ display: grid;
12762
+ grid-template-columns: repeat(7, 1fr);
12763
+ width: 100%;
12764
+ height: 47px;
12765
+ color: #fff;
12766
+ background: #26958c;
12767
+ border: 1px solid rgb(215 215 215);
12768
+ }
12769
+ .content_container .content_wrapper {
12770
+ display: grid;
12771
+ grid-template-columns: repeat(7, 1fr);
12772
+ border: 1px solid rgb(215 215 215);
12773
+ }
12774
+ .content_container .content_wrapper .day_container {
12775
+ position: relative;
12776
+ display: flex;
12777
+ align-items: center;
12778
+ justify-content: center;
12779
+ height: 100px;
12780
+ color: #333;
12781
+ background: #f6f6f6;
12782
+ border-right: 1px solid rgb(215 215 215);
12783
+ border-bottom: 1px solid rgb(215 215 215);
12784
+ cursor: pointer;
12785
+ }
12786
+ .content_container .content_wrapper .day_container:hover {
12787
+ box-shadow: inset 0px 0px 5px 1px lightgreen;
12788
+ }
12789
+ .content_container .content_wrapper .date_title {
12790
+ display: inline-block;
12791
+ width: 24px;
12792
+ height: 20px;
12793
+ margin-left: 4px;
12794
+ color: rgb(103 113 122);
12795
+ font-weight: 400;
12796
+ font-size: 16px;
12797
+ font-family: PingFangSC-Regular, PingFang SC;
12798
+ line-height: 20px;
12799
+ text-align: center;
12800
+ }
12801
+ .content_container .content_wrapper .isCurrentMonth {
12802
+ color: #000;
12803
+ background: #fff;
12804
+ }
12805
+ .content_container .content_wrapper .isToday {
12806
+ background: lightgreen;
12807
+ }
12808
+ .content_container .content_wrapper .isCurrentDay {
12809
+ box-shadow: inset 0px 0px 5px 1px lightgreen;
12810
+ }
12747
12811
 
12748
12812
  /* Color
12749
12813
  ----------------------- */
@@ -28107,3 +28171,68 @@ button[data-prefers-color='light'] .swiper-pagination-bullet {
28107
28171
  opacity: 1;
28108
28172
  background: #9cd0ef;
28109
28173
  }
28174
+
28175
+ .content_container {
28176
+ width: 100%;
28177
+ height: 100%;
28178
+ }
28179
+ .content_container .toolbar_container {
28180
+ position: relative;
28181
+ display: flex;
28182
+ align-items: center;
28183
+ justify-content: center;
28184
+ height: 94px;
28185
+ background: white;
28186
+ border: 1px solid rgb(215 215 215);
28187
+ }
28188
+ .content_container .calendar_header_wrapper {
28189
+ display: grid;
28190
+ grid-template-columns: repeat(7, 1fr);
28191
+ width: 100%;
28192
+ height: 47px;
28193
+ color: #fff;
28194
+ background: #26958c;
28195
+ border: 1px solid rgb(215 215 215);
28196
+ }
28197
+ .content_container .content_wrapper {
28198
+ display: grid;
28199
+ grid-template-columns: repeat(7, 1fr);
28200
+ border: 1px solid rgb(215 215 215);
28201
+ }
28202
+ .content_container .content_wrapper .day_container {
28203
+ position: relative;
28204
+ display: flex;
28205
+ align-items: center;
28206
+ justify-content: center;
28207
+ height: 100px;
28208
+ color: #333;
28209
+ background: #f6f6f6;
28210
+ border-right: 1px solid rgb(215 215 215);
28211
+ border-bottom: 1px solid rgb(215 215 215);
28212
+ cursor: pointer;
28213
+ }
28214
+ .content_container .content_wrapper .day_container:hover {
28215
+ box-shadow: inset 0px 0px 5px 1px lightgreen;
28216
+ }
28217
+ .content_container .content_wrapper .date_title {
28218
+ display: inline-block;
28219
+ width: 24px;
28220
+ height: 20px;
28221
+ margin-left: 4px;
28222
+ color: rgb(103 113 122);
28223
+ font-weight: 400;
28224
+ font-size: 16px;
28225
+ font-family: PingFangSC-Regular, PingFang SC;
28226
+ line-height: 20px;
28227
+ text-align: center;
28228
+ }
28229
+ .content_container .content_wrapper .isCurrentMonth {
28230
+ color: #000;
28231
+ background: #fff;
28232
+ }
28233
+ .content_container .content_wrapper .isToday {
28234
+ background: lightgreen;
28235
+ }
28236
+ .content_container .content_wrapper .isCurrentDay {
28237
+ box-shadow: inset 0px 0px 5px 1px lightgreen;
28238
+ }
package/dist/index.esm.js CHANGED
@@ -6,7 +6,7 @@ import 'antd/es/dropdown/style';
6
6
  import _Dropdown from 'antd/es/dropdown';
7
7
  import 'antd/es/menu/style';
8
8
  import _Menu from 'antd/es/menu';
9
- import { createFromIconfontCN, PlusOutlined, SearchOutlined, ReloadOutlined, CloseCircleOutlined, EllipsisOutlined, ExclamationCircleOutlined, EyeOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons';
9
+ import { createFromIconfontCN, PlusOutlined, SearchOutlined, ReloadOutlined, CloseCircleOutlined, EllipsisOutlined, ExclamationCircleOutlined, EyeOutlined, EditOutlined, DeleteOutlined, LeftOutlined, RightOutlined } from '@ant-design/icons';
10
10
  import 'antd/es/input/style';
11
11
  import _Input from 'antd/es/input';
12
12
  import 'antd/es/modal/style';
@@ -53,6 +53,8 @@ import 'antd/es/breadcrumb/style';
53
53
  import _Breadcrumb from 'antd/es/breadcrumb';
54
54
  import ReactDOM from 'react-dom';
55
55
  import ProTable from '@ant-design/pro-table';
56
+ import 'antd/es/space/style';
57
+ import _Space from 'antd/es/space';
56
58
  import Player from 'xgplayer';
57
59
  import FlvPlayer from 'xgplayer-flv.js';
58
60
  import HlsJsPlayer from 'xgplayer-hls.js';
@@ -317,6 +319,10 @@ function _slicedToArray(arr, i) {
317
319
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
318
320
  }
319
321
 
322
+ function _toArray(arr) {
323
+ return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
324
+ }
325
+
320
326
  function _toConsumableArray(arr) {
321
327
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
322
328
  }
@@ -10701,11 +10707,7 @@ var TabelCard = function TabelCard(props, ref) {
10701
10707
  modalFormConfig = _useState4[0],
10702
10708
  setModalFormConfig = _useState4[1];
10703
10709
 
10704
- var _useState5 = useState({}),
10705
- _useState6 = _slicedToArray(_useState5, 2),
10706
- formSearch = _useState6[0],
10707
- setFormSearch = _useState6[1];
10708
-
10710
+ var formSearchRef = useRef({});
10709
10711
  var modalFormColumn = deepCopy(columns) || [];
10710
10712
  var formSearchColumn = deepCopy(columns) || [];
10711
10713
  useImperativeHandle(ref, function () {
@@ -11101,14 +11103,14 @@ var TabelCard = function TabelCard(props, ref) {
11101
11103
  var onSubmit = function onSubmit(values) {
11102
11104
  var _actionRef$current6;
11103
11105
 
11104
- setFormSearch(values);
11106
+ formSearchRef.current = values;
11105
11107
  actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : _actionRef$current6.reload(true);
11106
11108
  };
11107
11109
 
11108
11110
  var onReset = function onReset() {
11109
11111
  var _actionRef$current7;
11110
11112
 
11111
- setFormSearch({});
11113
+ formSearchRef.current = {};
11112
11114
  actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : _actionRef$current7.reload(true);
11113
11115
  };
11114
11116
 
@@ -11124,7 +11126,7 @@ var TabelCard = function TabelCard(props, ref) {
11124
11126
  }).forEach(function (item) {
11125
11127
  delete obj[item.dataIndex];
11126
11128
  });
11127
- setFormSearch(obj);
11129
+ formSearchRef.current = obj;
11128
11130
  }
11129
11131
  }, [columns]);
11130
11132
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ModalForm$1, _objectSpread2(_objectSpread2({
@@ -11220,7 +11222,7 @@ var TabelCard = function TabelCard(props, ref) {
11220
11222
  return [].concat(_toConsumableArray(pre), [column]);
11221
11223
  }
11222
11224
  }, [])
11223
- }, searchFormConfig || {})), /*#__PURE__*/React.createElement(ProTable, _objectSpread2(_objectSpread2({
11225
+ }, searchFormConfig || {})), columns && columns.length && /*#__PURE__*/React.createElement(ProTable, _objectSpread2(_objectSpread2({
11224
11226
  actionRef: actionRef,
11225
11227
  rowKey: "id",
11226
11228
  bordered: !noBordered,
@@ -11234,7 +11236,7 @@ var TabelCard = function TabelCard(props, ref) {
11234
11236
  switch (_context9.prev = _context9.next) {
11235
11237
  case 0:
11236
11238
  _context9.next = 2;
11237
- return _request(_objectSpread2(_objectSpread2({}, params), formSearch));
11239
+ return _request(_objectSpread2(_objectSpread2({}, params), formSearchRef.current));
11238
11240
 
11239
11241
  case 2:
11240
11242
  return _context9.abrupt("return", _context9.sent);
@@ -11294,6 +11296,356 @@ var TabelCard = function TabelCard(props, ref) {
11294
11296
 
11295
11297
  var index$3 = /*#__PURE__*/React.forwardRef(TabelCard);
11296
11298
 
11299
+ var YEAER_MONTH_FORMAT_EN = 'YYYY-MM';
11300
+
11301
+ var _moment$weekdaysMin = hooks.weekdaysMin(),
11302
+ _moment$weekdaysMin2 = _toArray(_moment$weekdaysMin),
11303
+ _ = _moment$weekdaysMin2[0],
11304
+ rest = _moment$weekdaysMin2.slice(1); // 将星期天放置数组最后
11305
+
11306
+
11307
+ var WEEk_HEADER = [].concat(_toConsumableArray(rest), [_]); // 日历布局为6 * 7单元格
11308
+
11309
+ var TOTAL_LENGTH = 6 * 7; // 初始化一下下
11310
+
11311
+ var INIT_DAYS = Array(TOTAL_LENGTH).fill(0).map(function (_, index) {
11312
+ return +index + 1;
11313
+ });
11314
+
11315
+ /**
11316
+ * 获取当前月的天数
11317
+ */
11318
+
11319
+ console.log(hooks().format('YYYY-MM-DD'), 'moment()');
11320
+ function getMonthDays(date) {
11321
+ return hooks(date).daysInMonth();
11322
+ }
11323
+ /**
11324
+ * 获取当前月第一天是星期几
11325
+ */
11326
+
11327
+ function getWeekDays(date) {
11328
+ return hooks(date).startOf('month').weekday();
11329
+ }
11330
+ /**
11331
+ * 获取当前星期第一天到星期天
11332
+ */
11333
+
11334
+ function getWeekList(date) {
11335
+ var weekOfDay = parseInt(hooks(date).format('E')); //计算今天是这周第几天
11336
+ // let last_monday = moment().startOf('day').subtract(weekOfDay - 1, 'days').format('YYYY-MM-DD');//周一日期
11337
+ // let last_sunday = moment().startOf('day').subtract(weekOfDay - 7, 'days').format('YYYY-MM-DD');//周日日期
11338
+
11339
+ return ['时间'].concat(_toConsumableArray(new Array(7).fill('').map(function (item, index) {
11340
+ return hooks(date).startOf('day').subtract(weekOfDay - (index + 1), 'days').format('YYYY-MM-DD');
11341
+ })));
11342
+ }
11343
+ /**
11344
+ * 获取上个月份
11345
+ */
11346
+
11347
+ function getLastMonth(date) {
11348
+ return hooks(date).subtract(1, 'month').format(YEAER_MONTH_FORMAT_EN);
11349
+ }
11350
+ /**
11351
+ * 格式化日期为两个单词,例如:‘1’号 格式为 ‘01’
11352
+ * @param {*} dateNumber
11353
+ */
11354
+
11355
+ var formatDayWithTwoWords = function formatDayWithTwoWords(dateNumber) {
11356
+ if (dateNumber < 10) {
11357
+ return '0' + dateNumber;
11358
+ }
11359
+
11360
+ return dateNumber;
11361
+ };
11362
+ /**
11363
+ * 初始化日历
11364
+ */
11365
+
11366
+ function initCalendar(date) {
11367
+ // 当前月天数
11368
+ var totalDaysInMonth = getMonthDays(date); // 上个月天数
11369
+
11370
+ var totalDaysInLastMonth = getMonthDays(getLastMonth(date)); // 下个月开始日期
11371
+
11372
+ var nextFirstDate = 1;
11373
+ var lastDays = [],
11374
+ currentDays = [],
11375
+ nextDays = []; // 当前月第一天是星期几(索引值)
11376
+
11377
+ /**
11378
+ * 这里的索引值刚刚好是需要填充的上月的天数
11379
+ */
11380
+
11381
+ var currentWeekDay = getWeekDays(date);
11382
+
11383
+ for (var i = 0, len = 42; i < len; i++) {
11384
+ // 填充上个月的天数
11385
+ if (i < currentWeekDay) {
11386
+ // lastDays.push(totalDaysInLastMonth);
11387
+ var daySting = hooks(hooks(date).subtract(1, 'month').format(YEAER_MONTH_FORMAT_EN) + '-' + totalDaysInLastMonth).format('YYYY-MM-DD');
11388
+ lastDays.push({
11389
+ date: daySting,
11390
+ text: formatDayWithTwoWords(totalDaysInLastMonth),
11391
+ isCurrentMonth: false,
11392
+ isCurrentDay: hooks().format('YYYY-MM-DD') == daySting
11393
+ });
11394
+ totalDaysInLastMonth--;
11395
+ } // 填充下个月的天数
11396
+ else if (i >= totalDaysInMonth + currentWeekDay) {
11397
+ // nextDays.push(nextFirstDate);
11398
+ var _daySting = hooks(hooks(date).add(1, 'month').format(YEAER_MONTH_FORMAT_EN) + '-' + nextFirstDate).format('YYYY-MM-DD');
11399
+
11400
+ nextDays.push({
11401
+ date: _daySting,
11402
+ text: formatDayWithTwoWords(nextFirstDate),
11403
+ isCurrentMonth: false,
11404
+ isCurrentDay: hooks().format('YYYY-MM-DD') == _daySting
11405
+ });
11406
+ nextFirstDate++;
11407
+ } // 填充当前月天数
11408
+ else {
11409
+ // currentDays.push(i - currentWeekDay + 1);
11410
+ var _daySting2 = hooks(hooks(date).format(YEAER_MONTH_FORMAT_EN) + '-' + (i - currentWeekDay + 1)).format('YYYY-MM-DD');
11411
+
11412
+ currentDays.push({
11413
+ date: _daySting2,
11414
+ text: formatDayWithTwoWords(i - currentWeekDay + 1),
11415
+ isCurrentMonth: true,
11416
+ isCurrentDay: hooks().format('YYYY-MM-DD') == _daySting2
11417
+ });
11418
+ }
11419
+ } // 上个月需要倒序显示
11420
+
11421
+
11422
+ return [].concat(_toConsumableArray(lastDays.reverse()), currentDays, nextDays);
11423
+ }
11424
+ /**
11425
+ * 初始化日历
11426
+ */
11427
+
11428
+ function initWeekCalendar(type, date) {
11429
+ var weekLength = type == 'week' ? 8 : 2;
11430
+ var dayTime = ['08:00', '08:30', '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '12:00', '12:30', '13:00', '13:30', '14:00', '14:30', '15:00', '15:30', '16:00', '16:30', '17:00', '17:30'];
11431
+ var weekOfDay = parseInt(hooks(date).format('E')); //计算今天是这周第几天
11432
+
11433
+ var days = [];
11434
+
11435
+ for (var i = 0, len = weekLength * 20; i < len; i++) {
11436
+ var timeIndex = Math.floor(i / weekLength);
11437
+
11438
+ if (i % weekLength == 0) {
11439
+ days.push({
11440
+ text: dayTime[timeIndex]
11441
+ });
11442
+ } else {
11443
+ days.push({
11444
+ date: type == 'week' ? hooks(date).startOf('day').subtract(weekOfDay - i % weekLength, 'days').format('YYYY-MM-DD') + " ".concat(dayTime[timeIndex]) : hooks(date).format('YYYY-MM-DD') + " ".concat(dayTime[timeIndex])
11445
+ });
11446
+ }
11447
+ }
11448
+
11449
+ return days;
11450
+ }
11451
+
11452
+ function Calendar(_ref, ref) {
11453
+ var value = _ref.value,
11454
+ onChange = _ref.onChange,
11455
+ click = _ref.click,
11456
+ type = _ref.type,
11457
+ toolBarSolt = _ref.toolBarSolt,
11458
+ dateCellRender = _ref.dateCellRender,
11459
+ calendarBodyClassName = _ref.calendarBodyClassName;
11460
+
11461
+ var _useState = useState(initCalendar()),
11462
+ _useState2 = _slicedToArray(_useState, 2),
11463
+ days = _useState2[0],
11464
+ setDays = _useState2[1];
11465
+
11466
+ var _useState3 = useState(hooks()),
11467
+ _useState4 = _slicedToArray(_useState3, 2),
11468
+ datevalue = _useState4[0],
11469
+ setDatevalue = _useState4[1];
11470
+
11471
+ var _useState5 = useState(getWeekList()),
11472
+ _useState6 = _slicedToArray(_useState5, 2),
11473
+ oneWeekDays = _useState6[0],
11474
+ setOneWeekDays = _useState6[1];
11475
+
11476
+ var weekLabelArray = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'];
11477
+
11478
+ var getweekDay = function getweekDay(date) {
11479
+ var index = hooks(date).day();
11480
+ return [weekLabelArray[index - 1]];
11481
+ };
11482
+
11483
+ useEffect(function () {
11484
+ if (type == 'day' || type == 'week') {
11485
+ if (type == 'day') {
11486
+ setOneWeekDays(['时间'].concat(_toConsumableArray(getweekDay(datevalue))));
11487
+ } else {
11488
+ setOneWeekDays(getWeekList(datevalue));
11489
+ }
11490
+
11491
+ setDays(initWeekCalendar(type, datevalue));
11492
+ } else {
11493
+ setDays(initCalendar(datevalue));
11494
+ }
11495
+ }, [type, datevalue]);
11496
+ useEffect(function () {
11497
+ setDatevalue(value || hooks());
11498
+ }, [value]);
11499
+ useEffect(function () {
11500
+ onChange && onChange(datevalue);
11501
+ }, [datevalue]);
11502
+
11503
+ var handleUp = function handleUp() {
11504
+ if (type == 'day' || type == 'week') {
11505
+ if (type == 'day') {
11506
+ var lastDay = hooks(datevalue).subtract(1, 'days');
11507
+ setOneWeekDays(['时间'].concat(_toConsumableArray(getweekDay(lastDay))));
11508
+ setDays(initWeekCalendar(type, lastDay));
11509
+ setDatevalue(lastDay);
11510
+ } else {
11511
+ var lastWeek = hooks().week(hooks(datevalue).week() - 1);
11512
+ setOneWeekDays(getWeekList(lastWeek));
11513
+ setDays(initWeekCalendar(type, lastWeek));
11514
+ setDatevalue(lastWeek);
11515
+ }
11516
+ } else {
11517
+ var lastMonth = hooks(datevalue).subtract(1, 'month');
11518
+ setDays(initCalendar(lastMonth));
11519
+ setDatevalue(lastMonth);
11520
+ }
11521
+ };
11522
+
11523
+ var handleDown = function handleDown() {
11524
+ if (type == 'day' || type == 'week') {
11525
+ if (type == 'day') {
11526
+ var lastDay = hooks(datevalue).add(1, 'days');
11527
+ setOneWeekDays(['时间'].concat(_toConsumableArray(getweekDay(lastDay))));
11528
+ setDays(initWeekCalendar(type, lastDay));
11529
+ setDatevalue(lastDay);
11530
+ } else {
11531
+ var lastWeek = hooks().week(hooks(datevalue).week() + 1);
11532
+ setOneWeekDays(getWeekList(lastWeek));
11533
+ setDays(initWeekCalendar(type, lastWeek));
11534
+ setDatevalue(lastWeek);
11535
+ }
11536
+ } else {
11537
+ var lastMonth = hooks(datevalue).add(1, 'month');
11538
+ setDays(initCalendar(lastMonth));
11539
+ setDatevalue(lastMonth);
11540
+ }
11541
+ };
11542
+
11543
+ var cellClick = function cellClick(info) {
11544
+ console.log(info);
11545
+ click && click(info);
11546
+ };
11547
+
11548
+ useImperativeHandle(ref, function () {
11549
+ return {
11550
+ datevalue: datevalue,
11551
+ handleUp: handleUp,
11552
+ handleDown: handleDown
11553
+ };
11554
+ });
11555
+ return /*#__PURE__*/React.createElement("div", {
11556
+ className: "content_container"
11557
+ }, /*#__PURE__*/React.createElement("div", {
11558
+ className: "toolbar_container"
11559
+ }, /*#__PURE__*/React.createElement(_Space, null, /*#__PURE__*/React.createElement(_Button, {
11560
+ icon: /*#__PURE__*/React.createElement(LeftOutlined, null),
11561
+ type: "text",
11562
+ onClick: handleUp
11563
+ }), type == 'day' ? /*#__PURE__*/React.createElement(_DatePicker, {
11564
+ value: datevalue,
11565
+ onChange: function onChange(date) {
11566
+ setOneWeekDays(['时间'].concat(_toConsumableArray(getweekDay(date))));
11567
+ setDays(initWeekCalendar(type, date));
11568
+ setDatevalue(date);
11569
+ },
11570
+ style: {
11571
+ width: '250px'
11572
+ }
11573
+ }) : type == 'week' ? /*#__PURE__*/React.createElement(_DatePicker, {
11574
+ value: datevalue,
11575
+ style: {
11576
+ width: '250px'
11577
+ },
11578
+ format: "".concat(hooks(datevalue).startOf('week').format('YYYY-MM-DD'), " ~ ").concat(hooks(datevalue).endOf('week').format('YYYY-MM-DD')),
11579
+ picker: "week",
11580
+ onChange: function onChange(date) {
11581
+ setOneWeekDays(getWeekList(date));
11582
+ setDays(initWeekCalendar(type, date));
11583
+ setDatevalue(date);
11584
+ }
11585
+ }) : /*#__PURE__*/React.createElement(_DatePicker, {
11586
+ value: datevalue,
11587
+ picker: "month",
11588
+ onChange: function onChange(date) {
11589
+ setDays(initCalendar(date));
11590
+ setDatevalue(date);
11591
+ },
11592
+ style: {
11593
+ width: '250px'
11594
+ }
11595
+ }), /*#__PURE__*/React.createElement(_Button, {
11596
+ icon: /*#__PURE__*/React.createElement(RightOutlined, null),
11597
+ type: "text",
11598
+ onClick: handleDown
11599
+ })), /*#__PURE__*/React.createElement("div", {
11600
+ className: "pa r30 flex h100p ai-c ",
11601
+ style: {
11602
+ margin: 'auto 0'
11603
+ }
11604
+ }, toolBarSolt)), type == 'week' || type == 'day' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
11605
+ className: "calendar_header_wrapper",
11606
+ style: {
11607
+ gridTemplateColumns: type == 'week' ? 'repeat(8, 1fr)' : '1fr 7fr'
11608
+ }
11609
+ }, oneWeekDays.map(function (weekLabel) {
11610
+ return /*#__PURE__*/React.createElement("div", {
11611
+ key: weekLabel,
11612
+ className: "flex ai-c jc-c"
11613
+ }, weekLabel);
11614
+ })), /*#__PURE__*/React.createElement("div", {
11615
+ className: "content_wrapper ".concat(calendarBodyClassName),
11616
+ style: {
11617
+ gridTemplateColumns: type == 'week' ? 'repeat(8, 1fr)' : '1fr 7fr'
11618
+ }
11619
+ }, days === null || days === void 0 ? void 0 : days.map(function (day, index) {
11620
+ return /*#__PURE__*/React.createElement("div", {
11621
+ onClick: function onClick() {
11622
+ return cellClick(day);
11623
+ },
11624
+ className: "day_container ".concat(day.isCurrentDay ? 'isCurrentDay' : '', " ").concat(day.isCurrentMonth ? 'isCurrentMonth' : ''),
11625
+ key: index
11626
+ }, dateCellRender ? dateCellRender(day) : day.text);
11627
+ }))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
11628
+ className: "calendar_header_wrapper"
11629
+ }, weekLabelArray.map(function (weekLabel) {
11630
+ return /*#__PURE__*/React.createElement("div", {
11631
+ key: weekLabel,
11632
+ className: "flex ai-c jc-c"
11633
+ }, weekLabel);
11634
+ })), /*#__PURE__*/React.createElement("div", {
11635
+ className: "content_wrapper ".concat(calendarBodyClassName)
11636
+ }, days === null || days === void 0 ? void 0 : days.map(function (day, index) {
11637
+ return /*#__PURE__*/React.createElement("div", {
11638
+ onClick: function onClick() {
11639
+ return cellClick(day);
11640
+ },
11641
+ className: "day_container ".concat(day.isCurrentDay ? 'isCurrentDay' : '', " ").concat(day.isCurrentMonth ? 'isCurrentMonth' : ''),
11642
+ key: index
11643
+ }, dateCellRender ? dateCellRender(day) : day.text);
11644
+ }))));
11645
+ }
11646
+
11647
+ var index$4 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(Calendar));
11648
+
11297
11649
  var WebsocketHeart = /*#__PURE__*/_createClass(function WebsocketHeart(_ref) {
11298
11650
  var _this = this;
11299
11651
 
@@ -11728,7 +12080,7 @@ function VideoPlayer(_ref, ref) {
11728
12080
  })) : null));
11729
12081
  }
11730
12082
 
11731
- var index$4 = /*#__PURE__*/forwardRef(VideoPlayer);
12083
+ var index$5 = /*#__PURE__*/forwardRef(VideoPlayer);
11732
12084
 
11733
12085
  var _excluded$j = ["id", "videoUrls", "definitionList", "isLoop", "muted", "currentIndex", "setCurrentIndex", "className", "style", "visible", "autoplay", "videoInit", "enableMemory", "lastPlayTimeHideDelay"];
11734
12086
 
@@ -11737,7 +12089,7 @@ var DEFAULT_PLAY_BACK_RATE = [0.5, 0.75, 1, 1.5, 2]; // 默认记忆提示文字
11737
12089
  var DEFAULT_LAST_PLAY_TIME_DELAY = 5; // 默认音量大小
11738
12090
 
11739
12091
  var DEFAULT_VOLUME = 0.6;
11740
- var index$5 = (function (_ref) {
12092
+ var index$6 = (function (_ref) {
11741
12093
  var id = _ref.id,
11742
12094
  _ref$videoUrls = _ref.videoUrls,
11743
12095
  videoUrls = _ref$videoUrls === void 0 ? [] : _ref$videoUrls,
@@ -12739,4 +13091,4 @@ function WaterLevelCharts(config) {
12739
13091
  });
12740
13092
  }
12741
13093
 
12742
- export { Index$a as AutoScroll, Index$c as Breadcrumb, WButton as Button, index$2 as Card, WCascader as Cascader, Index$4 as Checkbox, Index$9 as CountUp, Index$2 as DatePicker, DragBox, index as IconFont, Index as Input, WInputNumber as InputNumber, LineEcharts, Modal, ModalForm$1 as ModalForm, Modal$1 as ModalTips, Index$8 as Number, NumericInput, Index$3 as Radio, Select, Index$b as Swiper, WSwitch as Switch, index$3 as TabelCard, index$1 as Table, Index$7 as TreeSelect, Upload, index$5 as Video, index$4 as VideoPlayer, Index$6 as WDatePicker, WForm$1 as WForm, WaterLevelCharts, WebsocketHeart, useEventEmitter };
13094
+ export { Index$a as AutoScroll, Index$c as Breadcrumb, WButton as Button, index$4 as Calendar, index$2 as Card, WCascader as Cascader, Index$4 as Checkbox, Index$9 as CountUp, Index$2 as DatePicker, DragBox, index as IconFont, Index as Input, WInputNumber as InputNumber, LineEcharts, Modal, ModalForm$1 as ModalForm, Modal$1 as ModalTips, Index$8 as Number, NumericInput, Index$3 as Radio, Select, Index$b as Swiper, WSwitch as Switch, index$3 as TabelCard, index$1 as Table, Index$7 as TreeSelect, Upload, index$6 as Video, index$5 as VideoPlayer, Index$6 as WDatePicker, WForm$1 as WForm, WaterLevelCharts, WebsocketHeart, useEventEmitter };
package/dist/index.js CHANGED
@@ -57,6 +57,8 @@ require('antd/es/breadcrumb/style');
57
57
  var _Breadcrumb = require('antd/es/breadcrumb');
58
58
  var ReactDOM = require('react-dom');
59
59
  var ProTable = require('@ant-design/pro-table');
60
+ require('antd/es/space/style');
61
+ var _Space = require('antd/es/space');
60
62
  var Player = require('xgplayer');
61
63
  var FlvPlayer = require('xgplayer-flv.js');
62
64
  var HlsJsPlayer = require('xgplayer-hls.js');
@@ -118,6 +120,7 @@ var SwiperCore__default = /*#__PURE__*/_interopDefaultLegacy(SwiperCore);
118
120
  var _Breadcrumb__default = /*#__PURE__*/_interopDefaultLegacy(_Breadcrumb);
119
121
  var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
120
122
  var ProTable__default = /*#__PURE__*/_interopDefaultLegacy(ProTable);
123
+ var _Space__default = /*#__PURE__*/_interopDefaultLegacy(_Space);
121
124
  var Player__default = /*#__PURE__*/_interopDefaultLegacy(Player);
122
125
  var FlvPlayer__default = /*#__PURE__*/_interopDefaultLegacy(FlvPlayer);
123
126
  var HlsJsPlayer__default = /*#__PURE__*/_interopDefaultLegacy(HlsJsPlayer);
@@ -378,6 +381,10 @@ function _slicedToArray(arr, i) {
378
381
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
379
382
  }
380
383
 
384
+ function _toArray(arr) {
385
+ return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
386
+ }
387
+
381
388
  function _toConsumableArray(arr) {
382
389
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
383
390
  }
@@ -10762,11 +10769,7 @@ var TabelCard = function TabelCard(props, ref) {
10762
10769
  modalFormConfig = _useState4[0],
10763
10770
  setModalFormConfig = _useState4[1];
10764
10771
 
10765
- var _useState5 = React.useState({}),
10766
- _useState6 = _slicedToArray(_useState5, 2),
10767
- formSearch = _useState6[0],
10768
- setFormSearch = _useState6[1];
10769
-
10772
+ var formSearchRef = React.useRef({});
10770
10773
  var modalFormColumn = deepCopy(columns) || [];
10771
10774
  var formSearchColumn = deepCopy(columns) || [];
10772
10775
  React.useImperativeHandle(ref, function () {
@@ -11162,14 +11165,14 @@ var TabelCard = function TabelCard(props, ref) {
11162
11165
  var onSubmit = function onSubmit(values) {
11163
11166
  var _actionRef$current6;
11164
11167
 
11165
- setFormSearch(values);
11168
+ formSearchRef.current = values;
11166
11169
  actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : _actionRef$current6.reload(true);
11167
11170
  };
11168
11171
 
11169
11172
  var onReset = function onReset() {
11170
11173
  var _actionRef$current7;
11171
11174
 
11172
- setFormSearch({});
11175
+ formSearchRef.current = {};
11173
11176
  actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : _actionRef$current7.reload(true);
11174
11177
  };
11175
11178
 
@@ -11185,7 +11188,7 @@ var TabelCard = function TabelCard(props, ref) {
11185
11188
  }).forEach(function (item) {
11186
11189
  delete obj[item.dataIndex];
11187
11190
  });
11188
- setFormSearch(obj);
11191
+ formSearchRef.current = obj;
11189
11192
  }
11190
11193
  }, [columns]);
11191
11194
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(ModalForm$1, _objectSpread2(_objectSpread2({
@@ -11281,7 +11284,7 @@ var TabelCard = function TabelCard(props, ref) {
11281
11284
  return [].concat(_toConsumableArray(pre), [column]);
11282
11285
  }
11283
11286
  }, [])
11284
- }, searchFormConfig || {})), /*#__PURE__*/React__default['default'].createElement(ProTable__default['default'], _objectSpread2(_objectSpread2({
11287
+ }, searchFormConfig || {})), columns && columns.length && /*#__PURE__*/React__default['default'].createElement(ProTable__default['default'], _objectSpread2(_objectSpread2({
11285
11288
  actionRef: actionRef,
11286
11289
  rowKey: "id",
11287
11290
  bordered: !noBordered,
@@ -11295,7 +11298,7 @@ var TabelCard = function TabelCard(props, ref) {
11295
11298
  switch (_context9.prev = _context9.next) {
11296
11299
  case 0:
11297
11300
  _context9.next = 2;
11298
- return _request(_objectSpread2(_objectSpread2({}, params), formSearch));
11301
+ return _request(_objectSpread2(_objectSpread2({}, params), formSearchRef.current));
11299
11302
 
11300
11303
  case 2:
11301
11304
  return _context9.abrupt("return", _context9.sent);
@@ -11355,6 +11358,356 @@ var TabelCard = function TabelCard(props, ref) {
11355
11358
 
11356
11359
  var index$3 = /*#__PURE__*/React__default['default'].forwardRef(TabelCard);
11357
11360
 
11361
+ var YEAER_MONTH_FORMAT_EN = 'YYYY-MM';
11362
+
11363
+ var _moment$weekdaysMin = hooks.weekdaysMin(),
11364
+ _moment$weekdaysMin2 = _toArray(_moment$weekdaysMin),
11365
+ _ = _moment$weekdaysMin2[0],
11366
+ rest = _moment$weekdaysMin2.slice(1); // 将星期天放置数组最后
11367
+
11368
+
11369
+ var WEEk_HEADER = [].concat(_toConsumableArray(rest), [_]); // 日历布局为6 * 7单元格
11370
+
11371
+ var TOTAL_LENGTH = 6 * 7; // 初始化一下下
11372
+
11373
+ var INIT_DAYS = Array(TOTAL_LENGTH).fill(0).map(function (_, index) {
11374
+ return +index + 1;
11375
+ });
11376
+
11377
+ /**
11378
+ * 获取当前月的天数
11379
+ */
11380
+
11381
+ console.log(hooks().format('YYYY-MM-DD'), 'moment()');
11382
+ function getMonthDays(date) {
11383
+ return hooks(date).daysInMonth();
11384
+ }
11385
+ /**
11386
+ * 获取当前月第一天是星期几
11387
+ */
11388
+
11389
+ function getWeekDays(date) {
11390
+ return hooks(date).startOf('month').weekday();
11391
+ }
11392
+ /**
11393
+ * 获取当前星期第一天到星期天
11394
+ */
11395
+
11396
+ function getWeekList(date) {
11397
+ var weekOfDay = parseInt(hooks(date).format('E')); //计算今天是这周第几天
11398
+ // let last_monday = moment().startOf('day').subtract(weekOfDay - 1, 'days').format('YYYY-MM-DD');//周一日期
11399
+ // let last_sunday = moment().startOf('day').subtract(weekOfDay - 7, 'days').format('YYYY-MM-DD');//周日日期
11400
+
11401
+ return ['时间'].concat(_toConsumableArray(new Array(7).fill('').map(function (item, index) {
11402
+ return hooks(date).startOf('day').subtract(weekOfDay - (index + 1), 'days').format('YYYY-MM-DD');
11403
+ })));
11404
+ }
11405
+ /**
11406
+ * 获取上个月份
11407
+ */
11408
+
11409
+ function getLastMonth(date) {
11410
+ return hooks(date).subtract(1, 'month').format(YEAER_MONTH_FORMAT_EN);
11411
+ }
11412
+ /**
11413
+ * 格式化日期为两个单词,例如:‘1’号 格式为 ‘01’
11414
+ * @param {*} dateNumber
11415
+ */
11416
+
11417
+ var formatDayWithTwoWords = function formatDayWithTwoWords(dateNumber) {
11418
+ if (dateNumber < 10) {
11419
+ return '0' + dateNumber;
11420
+ }
11421
+
11422
+ return dateNumber;
11423
+ };
11424
+ /**
11425
+ * 初始化日历
11426
+ */
11427
+
11428
+ function initCalendar(date) {
11429
+ // 当前月天数
11430
+ var totalDaysInMonth = getMonthDays(date); // 上个月天数
11431
+
11432
+ var totalDaysInLastMonth = getMonthDays(getLastMonth(date)); // 下个月开始日期
11433
+
11434
+ var nextFirstDate = 1;
11435
+ var lastDays = [],
11436
+ currentDays = [],
11437
+ nextDays = []; // 当前月第一天是星期几(索引值)
11438
+
11439
+ /**
11440
+ * 这里的索引值刚刚好是需要填充的上月的天数
11441
+ */
11442
+
11443
+ var currentWeekDay = getWeekDays(date);
11444
+
11445
+ for (var i = 0, len = 42; i < len; i++) {
11446
+ // 填充上个月的天数
11447
+ if (i < currentWeekDay) {
11448
+ // lastDays.push(totalDaysInLastMonth);
11449
+ var daySting = hooks(hooks(date).subtract(1, 'month').format(YEAER_MONTH_FORMAT_EN) + '-' + totalDaysInLastMonth).format('YYYY-MM-DD');
11450
+ lastDays.push({
11451
+ date: daySting,
11452
+ text: formatDayWithTwoWords(totalDaysInLastMonth),
11453
+ isCurrentMonth: false,
11454
+ isCurrentDay: hooks().format('YYYY-MM-DD') == daySting
11455
+ });
11456
+ totalDaysInLastMonth--;
11457
+ } // 填充下个月的天数
11458
+ else if (i >= totalDaysInMonth + currentWeekDay) {
11459
+ // nextDays.push(nextFirstDate);
11460
+ var _daySting = hooks(hooks(date).add(1, 'month').format(YEAER_MONTH_FORMAT_EN) + '-' + nextFirstDate).format('YYYY-MM-DD');
11461
+
11462
+ nextDays.push({
11463
+ date: _daySting,
11464
+ text: formatDayWithTwoWords(nextFirstDate),
11465
+ isCurrentMonth: false,
11466
+ isCurrentDay: hooks().format('YYYY-MM-DD') == _daySting
11467
+ });
11468
+ nextFirstDate++;
11469
+ } // 填充当前月天数
11470
+ else {
11471
+ // currentDays.push(i - currentWeekDay + 1);
11472
+ var _daySting2 = hooks(hooks(date).format(YEAER_MONTH_FORMAT_EN) + '-' + (i - currentWeekDay + 1)).format('YYYY-MM-DD');
11473
+
11474
+ currentDays.push({
11475
+ date: _daySting2,
11476
+ text: formatDayWithTwoWords(i - currentWeekDay + 1),
11477
+ isCurrentMonth: true,
11478
+ isCurrentDay: hooks().format('YYYY-MM-DD') == _daySting2
11479
+ });
11480
+ }
11481
+ } // 上个月需要倒序显示
11482
+
11483
+
11484
+ return [].concat(_toConsumableArray(lastDays.reverse()), currentDays, nextDays);
11485
+ }
11486
+ /**
11487
+ * 初始化日历
11488
+ */
11489
+
11490
+ function initWeekCalendar(type, date) {
11491
+ var weekLength = type == 'week' ? 8 : 2;
11492
+ var dayTime = ['08:00', '08:30', '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '12:00', '12:30', '13:00', '13:30', '14:00', '14:30', '15:00', '15:30', '16:00', '16:30', '17:00', '17:30'];
11493
+ var weekOfDay = parseInt(hooks(date).format('E')); //计算今天是这周第几天
11494
+
11495
+ var days = [];
11496
+
11497
+ for (var i = 0, len = weekLength * 20; i < len; i++) {
11498
+ var timeIndex = Math.floor(i / weekLength);
11499
+
11500
+ if (i % weekLength == 0) {
11501
+ days.push({
11502
+ text: dayTime[timeIndex]
11503
+ });
11504
+ } else {
11505
+ days.push({
11506
+ date: type == 'week' ? hooks(date).startOf('day').subtract(weekOfDay - i % weekLength, 'days').format('YYYY-MM-DD') + " ".concat(dayTime[timeIndex]) : hooks(date).format('YYYY-MM-DD') + " ".concat(dayTime[timeIndex])
11507
+ });
11508
+ }
11509
+ }
11510
+
11511
+ return days;
11512
+ }
11513
+
11514
+ function Calendar(_ref, ref) {
11515
+ var value = _ref.value,
11516
+ onChange = _ref.onChange,
11517
+ click = _ref.click,
11518
+ type = _ref.type,
11519
+ toolBarSolt = _ref.toolBarSolt,
11520
+ dateCellRender = _ref.dateCellRender,
11521
+ calendarBodyClassName = _ref.calendarBodyClassName;
11522
+
11523
+ var _useState = React.useState(initCalendar()),
11524
+ _useState2 = _slicedToArray(_useState, 2),
11525
+ days = _useState2[0],
11526
+ setDays = _useState2[1];
11527
+
11528
+ var _useState3 = React.useState(hooks()),
11529
+ _useState4 = _slicedToArray(_useState3, 2),
11530
+ datevalue = _useState4[0],
11531
+ setDatevalue = _useState4[1];
11532
+
11533
+ var _useState5 = React.useState(getWeekList()),
11534
+ _useState6 = _slicedToArray(_useState5, 2),
11535
+ oneWeekDays = _useState6[0],
11536
+ setOneWeekDays = _useState6[1];
11537
+
11538
+ var weekLabelArray = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'];
11539
+
11540
+ var getweekDay = function getweekDay(date) {
11541
+ var index = hooks(date).day();
11542
+ return [weekLabelArray[index - 1]];
11543
+ };
11544
+
11545
+ React.useEffect(function () {
11546
+ if (type == 'day' || type == 'week') {
11547
+ if (type == 'day') {
11548
+ setOneWeekDays(['时间'].concat(_toConsumableArray(getweekDay(datevalue))));
11549
+ } else {
11550
+ setOneWeekDays(getWeekList(datevalue));
11551
+ }
11552
+
11553
+ setDays(initWeekCalendar(type, datevalue));
11554
+ } else {
11555
+ setDays(initCalendar(datevalue));
11556
+ }
11557
+ }, [type, datevalue]);
11558
+ React.useEffect(function () {
11559
+ setDatevalue(value || hooks());
11560
+ }, [value]);
11561
+ React.useEffect(function () {
11562
+ onChange && onChange(datevalue);
11563
+ }, [datevalue]);
11564
+
11565
+ var handleUp = function handleUp() {
11566
+ if (type == 'day' || type == 'week') {
11567
+ if (type == 'day') {
11568
+ var lastDay = hooks(datevalue).subtract(1, 'days');
11569
+ setOneWeekDays(['时间'].concat(_toConsumableArray(getweekDay(lastDay))));
11570
+ setDays(initWeekCalendar(type, lastDay));
11571
+ setDatevalue(lastDay);
11572
+ } else {
11573
+ var lastWeek = hooks().week(hooks(datevalue).week() - 1);
11574
+ setOneWeekDays(getWeekList(lastWeek));
11575
+ setDays(initWeekCalendar(type, lastWeek));
11576
+ setDatevalue(lastWeek);
11577
+ }
11578
+ } else {
11579
+ var lastMonth = hooks(datevalue).subtract(1, 'month');
11580
+ setDays(initCalendar(lastMonth));
11581
+ setDatevalue(lastMonth);
11582
+ }
11583
+ };
11584
+
11585
+ var handleDown = function handleDown() {
11586
+ if (type == 'day' || type == 'week') {
11587
+ if (type == 'day') {
11588
+ var lastDay = hooks(datevalue).add(1, 'days');
11589
+ setOneWeekDays(['时间'].concat(_toConsumableArray(getweekDay(lastDay))));
11590
+ setDays(initWeekCalendar(type, lastDay));
11591
+ setDatevalue(lastDay);
11592
+ } else {
11593
+ var lastWeek = hooks().week(hooks(datevalue).week() + 1);
11594
+ setOneWeekDays(getWeekList(lastWeek));
11595
+ setDays(initWeekCalendar(type, lastWeek));
11596
+ setDatevalue(lastWeek);
11597
+ }
11598
+ } else {
11599
+ var lastMonth = hooks(datevalue).add(1, 'month');
11600
+ setDays(initCalendar(lastMonth));
11601
+ setDatevalue(lastMonth);
11602
+ }
11603
+ };
11604
+
11605
+ var cellClick = function cellClick(info) {
11606
+ console.log(info);
11607
+ click && click(info);
11608
+ };
11609
+
11610
+ React.useImperativeHandle(ref, function () {
11611
+ return {
11612
+ datevalue: datevalue,
11613
+ handleUp: handleUp,
11614
+ handleDown: handleDown
11615
+ };
11616
+ });
11617
+ return /*#__PURE__*/React__default['default'].createElement("div", {
11618
+ className: "content_container"
11619
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
11620
+ className: "toolbar_container"
11621
+ }, /*#__PURE__*/React__default['default'].createElement(_Space__default['default'], null, /*#__PURE__*/React__default['default'].createElement(_Button__default['default'], {
11622
+ icon: /*#__PURE__*/React__default['default'].createElement(icons.LeftOutlined, null),
11623
+ type: "text",
11624
+ onClick: handleUp
11625
+ }), type == 'day' ? /*#__PURE__*/React__default['default'].createElement(_DatePicker__default['default'], {
11626
+ value: datevalue,
11627
+ onChange: function onChange(date) {
11628
+ setOneWeekDays(['时间'].concat(_toConsumableArray(getweekDay(date))));
11629
+ setDays(initWeekCalendar(type, date));
11630
+ setDatevalue(date);
11631
+ },
11632
+ style: {
11633
+ width: '250px'
11634
+ }
11635
+ }) : type == 'week' ? /*#__PURE__*/React__default['default'].createElement(_DatePicker__default['default'], {
11636
+ value: datevalue,
11637
+ style: {
11638
+ width: '250px'
11639
+ },
11640
+ format: "".concat(hooks(datevalue).startOf('week').format('YYYY-MM-DD'), " ~ ").concat(hooks(datevalue).endOf('week').format('YYYY-MM-DD')),
11641
+ picker: "week",
11642
+ onChange: function onChange(date) {
11643
+ setOneWeekDays(getWeekList(date));
11644
+ setDays(initWeekCalendar(type, date));
11645
+ setDatevalue(date);
11646
+ }
11647
+ }) : /*#__PURE__*/React__default['default'].createElement(_DatePicker__default['default'], {
11648
+ value: datevalue,
11649
+ picker: "month",
11650
+ onChange: function onChange(date) {
11651
+ setDays(initCalendar(date));
11652
+ setDatevalue(date);
11653
+ },
11654
+ style: {
11655
+ width: '250px'
11656
+ }
11657
+ }), /*#__PURE__*/React__default['default'].createElement(_Button__default['default'], {
11658
+ icon: /*#__PURE__*/React__default['default'].createElement(icons.RightOutlined, null),
11659
+ type: "text",
11660
+ onClick: handleDown
11661
+ })), /*#__PURE__*/React__default['default'].createElement("div", {
11662
+ className: "pa r30 flex h100p ai-c ",
11663
+ style: {
11664
+ margin: 'auto 0'
11665
+ }
11666
+ }, toolBarSolt)), type == 'week' || type == 'day' ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
11667
+ className: "calendar_header_wrapper",
11668
+ style: {
11669
+ gridTemplateColumns: type == 'week' ? 'repeat(8, 1fr)' : '1fr 7fr'
11670
+ }
11671
+ }, oneWeekDays.map(function (weekLabel) {
11672
+ return /*#__PURE__*/React__default['default'].createElement("div", {
11673
+ key: weekLabel,
11674
+ className: "flex ai-c jc-c"
11675
+ }, weekLabel);
11676
+ })), /*#__PURE__*/React__default['default'].createElement("div", {
11677
+ className: "content_wrapper ".concat(calendarBodyClassName),
11678
+ style: {
11679
+ gridTemplateColumns: type == 'week' ? 'repeat(8, 1fr)' : '1fr 7fr'
11680
+ }
11681
+ }, days === null || days === void 0 ? void 0 : days.map(function (day, index) {
11682
+ return /*#__PURE__*/React__default['default'].createElement("div", {
11683
+ onClick: function onClick() {
11684
+ return cellClick(day);
11685
+ },
11686
+ className: "day_container ".concat(day.isCurrentDay ? 'isCurrentDay' : '', " ").concat(day.isCurrentMonth ? 'isCurrentMonth' : ''),
11687
+ key: index
11688
+ }, dateCellRender ? dateCellRender(day) : day.text);
11689
+ }))) : /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
11690
+ className: "calendar_header_wrapper"
11691
+ }, weekLabelArray.map(function (weekLabel) {
11692
+ return /*#__PURE__*/React__default['default'].createElement("div", {
11693
+ key: weekLabel,
11694
+ className: "flex ai-c jc-c"
11695
+ }, weekLabel);
11696
+ })), /*#__PURE__*/React__default['default'].createElement("div", {
11697
+ className: "content_wrapper ".concat(calendarBodyClassName)
11698
+ }, days === null || days === void 0 ? void 0 : days.map(function (day, index) {
11699
+ return /*#__PURE__*/React__default['default'].createElement("div", {
11700
+ onClick: function onClick() {
11701
+ return cellClick(day);
11702
+ },
11703
+ className: "day_container ".concat(day.isCurrentDay ? 'isCurrentDay' : '', " ").concat(day.isCurrentMonth ? 'isCurrentMonth' : ''),
11704
+ key: index
11705
+ }, dateCellRender ? dateCellRender(day) : day.text);
11706
+ }))));
11707
+ }
11708
+
11709
+ var index$4 = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(Calendar));
11710
+
11358
11711
  var WebsocketHeart = /*#__PURE__*/_createClass(function WebsocketHeart(_ref) {
11359
11712
  var _this = this;
11360
11713
 
@@ -11789,7 +12142,7 @@ function VideoPlayer(_ref, ref) {
11789
12142
  })) : null));
11790
12143
  }
11791
12144
 
11792
- var index$4 = /*#__PURE__*/React.forwardRef(VideoPlayer);
12145
+ var index$5 = /*#__PURE__*/React.forwardRef(VideoPlayer);
11793
12146
 
11794
12147
  var _excluded$j = ["id", "videoUrls", "definitionList", "isLoop", "muted", "currentIndex", "setCurrentIndex", "className", "style", "visible", "autoplay", "videoInit", "enableMemory", "lastPlayTimeHideDelay"];
11795
12148
 
@@ -11798,7 +12151,7 @@ var DEFAULT_PLAY_BACK_RATE = [0.5, 0.75, 1, 1.5, 2]; // 默认记忆提示文字
11798
12151
  var DEFAULT_LAST_PLAY_TIME_DELAY = 5; // 默认音量大小
11799
12152
 
11800
12153
  var DEFAULT_VOLUME = 0.6;
11801
- var index$5 = (function (_ref) {
12154
+ var index$6 = (function (_ref) {
11802
12155
  var id = _ref.id,
11803
12156
  _ref$videoUrls = _ref.videoUrls,
11804
12157
  videoUrls = _ref$videoUrls === void 0 ? [] : _ref$videoUrls,
@@ -12803,6 +13156,7 @@ function WaterLevelCharts(config) {
12803
13156
  exports.AutoScroll = Index$a;
12804
13157
  exports.Breadcrumb = Index$c;
12805
13158
  exports.Button = WButton;
13159
+ exports.Calendar = index$4;
12806
13160
  exports.Card = index$2;
12807
13161
  exports.Cascader = WCascader;
12808
13162
  exports.Checkbox = Index$4;
@@ -12826,8 +13180,8 @@ exports.TabelCard = index$3;
12826
13180
  exports.Table = index$1;
12827
13181
  exports.TreeSelect = Index$7;
12828
13182
  exports.Upload = Upload;
12829
- exports.Video = index$5;
12830
- exports.VideoPlayer = index$4;
13183
+ exports.Video = index$6;
13184
+ exports.VideoPlayer = index$5;
12831
13185
  exports.WDatePicker = Index$6;
12832
13186
  exports.WForm = WForm$1;
12833
13187
  exports.WaterLevelCharts = WaterLevelCharts;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "wargerm",
4
- "version": "0.5.29",
4
+ "version": "0.5.32",
5
5
  "scripts": {
6
6
  "dev": "dumi dev",
7
7
  "docs:build": "dumi build",