aloudata-gantt 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +9 -17
- package/dist/types/config/holiday.d.ts +1 -0
- package/dist/types/utils.d.ts +2 -3
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { usePersistFn, useClickAway, useSize } from 'ahooks';
|
|
2
2
|
import React, { createContext, useContext, useState, useMemo, useRef, useCallback, createRef, useEffect, useImperativeHandle } from 'react';
|
|
3
3
|
import { observer } from 'mobx-react-lite';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
4
|
import dayjs from 'dayjs';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
7
7
|
import { observable, action, computed, runInAction, toJS } from 'mobx';
|
|
8
8
|
import Tooltip from 'rc-tooltip';
|
|
@@ -92,6 +92,7 @@ function _toConsumableArray(arr) {
|
|
|
92
92
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
var hasHolidayLists = ['2023', '2024', '2025'];
|
|
95
96
|
var holiday = {
|
|
96
97
|
'2023-01-01': true,
|
|
97
98
|
'2023-01-02': true,
|
|
@@ -535,23 +536,18 @@ function transverseData() {
|
|
|
535
536
|
}
|
|
536
537
|
return result;
|
|
537
538
|
}
|
|
538
|
-
var hasHolidayLists = ['2023', '2024'];
|
|
539
539
|
function getWeekday(first, last) {
|
|
540
540
|
var _first = first.valueOf();
|
|
541
541
|
var _last = last.valueOf();
|
|
542
542
|
var count = 0;
|
|
543
543
|
for (var i = _first; i <= _last; i += 24 * 3600 * 1000) {
|
|
544
|
-
var year = dayjs(i).format(
|
|
544
|
+
var year = dayjs(i).format('YYYY');
|
|
545
545
|
if (hasHolidayLists.includes(year)) {
|
|
546
|
-
var d = dayjs(i).format(
|
|
547
|
-
if (!holiday[d])
|
|
548
|
-
count++;
|
|
549
|
-
}
|
|
546
|
+
var d = dayjs(i).format('YYYY-MM-DD');
|
|
547
|
+
if (!holiday[d]) count++;
|
|
550
548
|
} else {
|
|
551
549
|
var _d = new Date(i);
|
|
552
|
-
if (_d.getDay() >= 1 && _d.getDay() <= 5)
|
|
553
|
-
count++;
|
|
554
|
-
}
|
|
550
|
+
if (_d.getDay() >= 1 && _d.getDay() <= 5) count++;
|
|
555
551
|
}
|
|
556
552
|
}
|
|
557
553
|
return count;
|
|
@@ -6374,12 +6370,8 @@ var Chart = function Chart() {
|
|
|
6374
6370
|
y2: '10'
|
|
6375
6371
|
}))), minorList.map(function (item) {
|
|
6376
6372
|
var isWeek = false;
|
|
6377
|
-
var year = dayjs(item.key).format(
|
|
6378
|
-
if (hasHolidayLists.includes(year))
|
|
6379
|
-
isWeek = !!holiday[dayjs(item.key).format("YYYY-MM-DD")];
|
|
6380
|
-
} else {
|
|
6381
|
-
isWeek = item.isWeek;
|
|
6382
|
-
}
|
|
6373
|
+
var year = dayjs(item.key).format('YYYY');
|
|
6374
|
+
if (hasHolidayLists.includes(year)) isWeek = !!holiday[dayjs(item.key).format('YYYY-MM-DD')];else isWeek = item.isWeek;
|
|
6383
6375
|
return isWeek ? /*#__PURE__*/React.createElement("g", {
|
|
6384
6376
|
key: item.key,
|
|
6385
6377
|
stroke: '#f0f0f0'
|
|
@@ -7200,4 +7192,4 @@ var GanttComponent = function GanttComponent(props) {
|
|
|
7200
7192
|
}, /*#__PURE__*/React.createElement(SelectionIndicator$1, null), /*#__PURE__*/React.createElement(TableBody$1, null), /*#__PURE__*/React.createElement(Chart$1, null)), /*#__PURE__*/React.createElement(Divider$1, null), showBackToday && /*#__PURE__*/React.createElement(TimeIndicator$1, null), showUnitSwitch && /*#__PURE__*/React.createElement(TimeAxisScaleSelect$1, null), /*#__PURE__*/React.createElement(ScrollBar$1, null), scrollTop && /*#__PURE__*/React.createElement(ScrollTop$1, null)));
|
|
7201
7193
|
};
|
|
7202
7194
|
|
|
7203
|
-
export { Gantt, GanttComponent as default, flattenDeep, getMaxRange, getWeekday,
|
|
7195
|
+
export { Gantt, GanttComponent as default, flattenDeep, getMaxRange, getWeekday, transverseData };
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Dayjs } from 'dayjs';
|
|
2
|
+
import type { Gantt } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* 将树形数据向下递归为一维数组
|
|
5
5
|
*
|
|
@@ -11,5 +11,4 @@ export declare function getMaxRange(bar: Gantt.Bar): {
|
|
|
11
11
|
width: number;
|
|
12
12
|
};
|
|
13
13
|
export declare function transverseData(data: Gantt.Record[], startDateKey: string, endDateKey: string): Gantt.Item<import("./types").DefaultRecordType>[];
|
|
14
|
-
export declare const hasHolidayLists: string[];
|
|
15
14
|
export declare function getWeekday(first: Dayjs, last: Dayjs): number;
|