aloudata-gantt 0.0.13 → 0.0.15

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/README.md CHANGED
@@ -19,10 +19,22 @@ npm run start:website
19
19
  ## 部署
20
20
 
21
21
  ```bash
22
+ # 更新下版本号
23
+ 修改 package.json 中的version 把最后一位加 1 比如 0.0.14 -> 0.0.15
24
+
25
+ # 构建产物
22
26
 
23
27
  npm run build
24
28
 
25
29
  # 目前是部署在公网的,没有部署在私有仓库
26
30
  npm publish --access public
27
31
 
28
- ```
32
+ ```
33
+
34
+ ## 更新假期
35
+ ‒ 代码地址:src/config/test.js
36
+ - 假期数据来源: https://timor.tech/api/holiday/year/2026?week=Y
37
+ ‒ 进入到 src/config,把 year 变量改成你想要更新的年份
38
+ - 执行 node run test.js
39
+ - 会自动把数据写入到同级目录下的 holiday.ts 中,然后把hasHolidayLists中加入新的年份
40
+ - 执行上面的部署流程即可,然后再迭代平台项目中去升级下版本~
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', '2026'];
95
96
  var holiday = {
96
97
  '2023-01-01': true,
97
98
  '2023-01-02': true,
@@ -442,7 +443,125 @@ var holiday = {
442
443
  '2025-12-20': true,
443
444
  '2025-12-21': true,
444
445
  '2025-12-27': true,
445
- '2025-12-28': true
446
+ '2025-12-28': true,
447
+ // 2026
448
+ '2026-01-01': true,
449
+ '2026-01-02': true,
450
+ '2026-01-03': true,
451
+ '2026-01-10': true,
452
+ '2026-01-11': true,
453
+ '2026-01-17': true,
454
+ '2026-01-18': true,
455
+ '2026-01-24': true,
456
+ '2026-01-25': true,
457
+ '2026-01-31': true,
458
+ '2026-02-01': true,
459
+ '2026-02-07': true,
460
+ '2026-02-08': true,
461
+ '2026-02-15': true,
462
+ '2026-02-16': true,
463
+ '2026-02-17': true,
464
+ '2026-02-18': true,
465
+ '2026-02-19': true,
466
+ '2026-02-20': true,
467
+ '2026-02-21': true,
468
+ '2026-02-22': true,
469
+ '2026-02-23': true,
470
+ '2026-03-01': true,
471
+ '2026-03-07': true,
472
+ '2026-03-08': true,
473
+ '2026-03-14': true,
474
+ '2026-03-15': true,
475
+ '2026-03-21': true,
476
+ '2026-03-22': true,
477
+ '2026-03-28': true,
478
+ '2026-03-29': true,
479
+ '2026-04-04': true,
480
+ '2026-04-05': true,
481
+ '2026-04-06': true,
482
+ '2026-04-11': true,
483
+ '2026-04-12': true,
484
+ '2026-04-18': true,
485
+ '2026-04-19': true,
486
+ '2026-04-25': true,
487
+ '2026-04-26': true,
488
+ '2026-05-01': true,
489
+ '2026-05-02': true,
490
+ '2026-05-03': true,
491
+ '2026-05-04': true,
492
+ '2026-05-05': true,
493
+ '2026-05-10': true,
494
+ '2026-05-16': true,
495
+ '2026-05-17': true,
496
+ '2026-05-23': true,
497
+ '2026-05-24': true,
498
+ '2026-05-30': true,
499
+ '2026-05-31': true,
500
+ '2026-06-06': true,
501
+ '2026-06-07': true,
502
+ '2026-06-13': true,
503
+ '2026-06-14': true,
504
+ '2026-06-19': true,
505
+ '2026-06-20': true,
506
+ '2026-06-21': true,
507
+ '2026-06-27': true,
508
+ '2026-06-28': true,
509
+ '2026-07-04': true,
510
+ '2026-07-05': true,
511
+ '2026-07-11': true,
512
+ '2026-07-12': true,
513
+ '2026-07-18': true,
514
+ '2026-07-19': true,
515
+ '2026-07-25': true,
516
+ '2026-07-26': true,
517
+ '2026-08-01': true,
518
+ '2026-08-02': true,
519
+ '2026-08-08': true,
520
+ '2026-08-09': true,
521
+ '2026-08-15': true,
522
+ '2026-08-16': true,
523
+ '2026-08-22': true,
524
+ '2026-08-23': true,
525
+ '2026-08-29': true,
526
+ '2026-08-30': true,
527
+ '2026-09-05': true,
528
+ '2026-09-06': true,
529
+ '2026-09-12': true,
530
+ '2026-09-13': true,
531
+ '2026-09-19': true,
532
+ '2026-09-25': true,
533
+ '2026-09-26': true,
534
+ '2026-09-27': true,
535
+ '2026-10-01': true,
536
+ '2026-10-02': true,
537
+ '2026-10-03': true,
538
+ '2026-10-04': true,
539
+ '2026-10-05': true,
540
+ '2026-10-06': true,
541
+ '2026-10-07': true,
542
+ '2026-10-11': true,
543
+ '2026-10-17': true,
544
+ '2026-10-18': true,
545
+ '2026-10-24': true,
546
+ '2026-10-25': true,
547
+ '2026-10-31': true,
548
+ '2026-11-01': true,
549
+ '2026-11-07': true,
550
+ '2026-11-08': true,
551
+ '2026-11-14': true,
552
+ '2026-11-15': true,
553
+ '2026-11-21': true,
554
+ '2026-11-22': true,
555
+ '2026-11-28': true,
556
+ '2026-11-29': true,
557
+ '2026-12-05': true,
558
+ '2026-12-06': true,
559
+ '2026-12-12': true,
560
+ '2026-12-13': true,
561
+ '2026-12-19': true,
562
+ '2026-12-20': true,
563
+ '2026-12-26': true,
564
+ '2026-12-27': true
446
565
  };
447
566
 
448
567
  /**
@@ -535,23 +654,18 @@ function transverseData() {
535
654
  }
536
655
  return result;
537
656
  }
538
- var hasHolidayLists = ['2023', '2024'];
539
657
  function getWeekday(first, last) {
540
658
  var _first = first.valueOf();
541
659
  var _last = last.valueOf();
542
660
  var count = 0;
543
661
  for (var i = _first; i <= _last; i += 24 * 3600 * 1000) {
544
- var year = dayjs(i).format("YYYY");
662
+ var year = dayjs(i).format('YYYY');
545
663
  if (hasHolidayLists.includes(year)) {
546
- var d = dayjs(i).format("YYYY-MM-DD");
547
- if (!holiday[d]) {
548
- count++;
549
- }
664
+ var d = dayjs(i).format('YYYY-MM-DD');
665
+ if (!holiday[d]) count++;
550
666
  } else {
551
667
  var _d = new Date(i);
552
- if (_d.getDay() >= 1 && _d.getDay() <= 5) {
553
- count++;
554
- }
668
+ if (_d.getDay() >= 1 && _d.getDay() <= 5) count++;
555
669
  }
556
670
  }
557
671
  return count;
@@ -1466,7 +1580,7 @@ function _asyncToGenerator(fn) {
1466
1580
  };
1467
1581
  }
1468
1582
 
1469
- /******************************************************************************
1583
+ /*! *****************************************************************************
1470
1584
  Copyright (c) Microsoft Corporation.
1471
1585
 
1472
1586
  Permission to use, copy, modify, and/or distribute this software for any
@@ -5056,9 +5170,9 @@ var GanttStore = /*#__PURE__*/function () {
5056
5170
  var dayRect = function dayRect() {
5057
5171
  var stAmp = date.startOf('day');
5058
5172
  var endAmp = date.endOf('day');
5059
- // @ts-ignore
5173
+ // @ts-expect-error
5060
5174
  var left = stAmp / _this.pxUnitAmp;
5061
- // @ts-ignore
5175
+ // @ts-expect-error
5062
5176
  var width = (endAmp - stAmp) / _this.pxUnitAmp;
5063
5177
  return {
5064
5178
  left: left,
@@ -5261,9 +5375,7 @@ var GanttStore = /*#__PURE__*/function () {
5261
5375
  key: "setNewData",
5262
5376
  value: function setNewData(data) {
5263
5377
  var updateNodeInTree = function updateNodeInTree(treeList, obj) {
5264
- if (!treeList || !treeList.length) {
5265
- return;
5266
- }
5378
+ if (!treeList || !treeList.length) return;
5267
5379
  for (var i = 0; i < treeList.length; i++) {
5268
5380
  if (treeList[i].record.id == data.id) {
5269
5381
  treeList[i].record = obj;
@@ -6374,12 +6486,8 @@ var Chart = function Chart() {
6374
6486
  y2: '10'
6375
6487
  }))), minorList.map(function (item) {
6376
6488
  var isWeek = false;
6377
- var year = dayjs(item.key).format("YYYY");
6378
- if (hasHolidayLists.includes(year)) {
6379
- isWeek = !!holiday[dayjs(item.key).format("YYYY-MM-DD")];
6380
- } else {
6381
- isWeek = item.isWeek;
6382
- }
6489
+ var year = dayjs(item.key).format('YYYY');
6490
+ if (hasHolidayLists.includes(year)) isWeek = !!holiday[dayjs(item.key).format('YYYY-MM-DD')];else isWeek = item.isWeek;
6383
6491
  return isWeek ? /*#__PURE__*/React.createElement("g", {
6384
6492
  key: item.key,
6385
6493
  stroke: '#f0f0f0'
@@ -7200,4 +7308,4 @@ var GanttComponent = function GanttComponent(props) {
7200
7308
  }, /*#__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
7309
  };
7202
7310
 
7203
- export { Gantt, GanttComponent as default, flattenDeep, getMaxRange, getWeekday, hasHolidayLists, transverseData };
7311
+ export { Gantt, GanttComponent as default, flattenDeep, getMaxRange, getWeekday, transverseData };
@@ -1,9 +1,10 @@
1
- import { Dayjs } from 'dayjs';
1
+ import type { Dayjs } from 'dayjs';
2
2
  import React from 'react';
3
- import { GanttContext } from './context';
3
+ import { type GanttContext } from './context';
4
4
  import './Gantt.less';
5
- import { DefaultRecordType, Gantt } from './types';
5
+ import { type DefaultRecordType, type Gantt } from './types';
6
6
  export interface GanttProps<RecordType = DefaultRecordType> {
7
+ holidayUrl?: string;
7
8
  data: Gantt.Record<RecordType>[];
8
9
  columns: Gantt.Column[];
9
10
  dependencies?: Gantt.Dependence[];
@@ -1,3 +1,4 @@
1
+ export declare const hasHolidayLists: string[];
1
2
  export declare const holiday: {
2
3
  '2023-01-01': boolean;
3
4
  '2023-01-02': boolean;
@@ -347,4 +348,121 @@ export declare const holiday: {
347
348
  '2025-12-21': boolean;
348
349
  '2025-12-27': boolean;
349
350
  '2025-12-28': boolean;
351
+ '2026-01-01': boolean;
352
+ '2026-01-02': boolean;
353
+ '2026-01-03': boolean;
354
+ '2026-01-10': boolean;
355
+ '2026-01-11': boolean;
356
+ '2026-01-17': boolean;
357
+ '2026-01-18': boolean;
358
+ '2026-01-24': boolean;
359
+ '2026-01-25': boolean;
360
+ '2026-01-31': boolean;
361
+ '2026-02-01': boolean;
362
+ '2026-02-07': boolean;
363
+ '2026-02-08': boolean;
364
+ '2026-02-15': boolean;
365
+ '2026-02-16': boolean;
366
+ '2026-02-17': boolean;
367
+ '2026-02-18': boolean;
368
+ '2026-02-19': boolean;
369
+ '2026-02-20': boolean;
370
+ '2026-02-21': boolean;
371
+ '2026-02-22': boolean;
372
+ '2026-02-23': boolean;
373
+ '2026-03-01': boolean;
374
+ '2026-03-07': boolean;
375
+ '2026-03-08': boolean;
376
+ '2026-03-14': boolean;
377
+ '2026-03-15': boolean;
378
+ '2026-03-21': boolean;
379
+ '2026-03-22': boolean;
380
+ '2026-03-28': boolean;
381
+ '2026-03-29': boolean;
382
+ '2026-04-04': boolean;
383
+ '2026-04-05': boolean;
384
+ '2026-04-06': boolean;
385
+ '2026-04-11': boolean;
386
+ '2026-04-12': boolean;
387
+ '2026-04-18': boolean;
388
+ '2026-04-19': boolean;
389
+ '2026-04-25': boolean;
390
+ '2026-04-26': boolean;
391
+ '2026-05-01': boolean;
392
+ '2026-05-02': boolean;
393
+ '2026-05-03': boolean;
394
+ '2026-05-04': boolean;
395
+ '2026-05-05': boolean;
396
+ '2026-05-10': boolean;
397
+ '2026-05-16': boolean;
398
+ '2026-05-17': boolean;
399
+ '2026-05-23': boolean;
400
+ '2026-05-24': boolean;
401
+ '2026-05-30': boolean;
402
+ '2026-05-31': boolean;
403
+ '2026-06-06': boolean;
404
+ '2026-06-07': boolean;
405
+ '2026-06-13': boolean;
406
+ '2026-06-14': boolean;
407
+ '2026-06-19': boolean;
408
+ '2026-06-20': boolean;
409
+ '2026-06-21': boolean;
410
+ '2026-06-27': boolean;
411
+ '2026-06-28': boolean;
412
+ '2026-07-04': boolean;
413
+ '2026-07-05': boolean;
414
+ '2026-07-11': boolean;
415
+ '2026-07-12': boolean;
416
+ '2026-07-18': boolean;
417
+ '2026-07-19': boolean;
418
+ '2026-07-25': boolean;
419
+ '2026-07-26': boolean;
420
+ '2026-08-01': boolean;
421
+ '2026-08-02': boolean;
422
+ '2026-08-08': boolean;
423
+ '2026-08-09': boolean;
424
+ '2026-08-15': boolean;
425
+ '2026-08-16': boolean;
426
+ '2026-08-22': boolean;
427
+ '2026-08-23': boolean;
428
+ '2026-08-29': boolean;
429
+ '2026-08-30': boolean;
430
+ '2026-09-05': boolean;
431
+ '2026-09-06': boolean;
432
+ '2026-09-12': boolean;
433
+ '2026-09-13': boolean;
434
+ '2026-09-19': boolean;
435
+ '2026-09-25': boolean;
436
+ '2026-09-26': boolean;
437
+ '2026-09-27': boolean;
438
+ '2026-10-01': boolean;
439
+ '2026-10-02': boolean;
440
+ '2026-10-03': boolean;
441
+ '2026-10-04': boolean;
442
+ '2026-10-05': boolean;
443
+ '2026-10-06': boolean;
444
+ '2026-10-07': boolean;
445
+ '2026-10-11': boolean;
446
+ '2026-10-17': boolean;
447
+ '2026-10-18': boolean;
448
+ '2026-10-24': boolean;
449
+ '2026-10-25': boolean;
450
+ '2026-10-31': boolean;
451
+ '2026-11-01': boolean;
452
+ '2026-11-07': boolean;
453
+ '2026-11-08': boolean;
454
+ '2026-11-14': boolean;
455
+ '2026-11-15': boolean;
456
+ '2026-11-21': boolean;
457
+ '2026-11-22': boolean;
458
+ '2026-11-28': boolean;
459
+ '2026-11-29': boolean;
460
+ '2026-12-05': boolean;
461
+ '2026-12-06': boolean;
462
+ '2026-12-12': boolean;
463
+ '2026-12-13': boolean;
464
+ '2026-12-19': boolean;
465
+ '2026-12-20': boolean;
466
+ '2026-12-26': boolean;
467
+ '2026-12-27': boolean;
350
468
  };
@@ -1,7 +1,7 @@
1
1
  /// <reference types="lodash" />
2
- import { Dayjs } from 'dayjs';
3
- import React from 'react';
4
- import { GanttProps as GanttProperties } from './Gantt';
2
+ import type { Dayjs } from 'dayjs';
3
+ import type React from 'react';
4
+ import type { GanttProps as GanttProperties } from './Gantt';
5
5
  import { Gantt } from './types';
6
6
  export declare const ONE_DAY_MS = 86400000;
7
7
  export declare const viewTypeList: Gantt.SightConfig[];
@@ -1,5 +1,5 @@
1
- import { Gantt } from './types';
2
- import { Dayjs } from "dayjs";
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aloudata-gantt",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "license": "MIT",
5
5
  "module": "dist/index.esm.js",
6
6
  "typings": "dist/types/index.d.ts",