aloudata-gantt 0.0.4 → 0.0.6

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
@@ -1,6 +1,9 @@
1
1
  ## 开发
2
2
 
3
3
 
4
+ - 需要使用 node16 版本
5
+ - 发线上包,然后迭代平台引入
6
+
4
7
  ```bash
5
8
 
6
9
  yarn
@@ -9,4 +12,6 @@ npm run start:website
9
12
 
10
13
  // 浏览器打开 http://localhost:8001/
11
14
 
15
+ // demo 在 website 里面哈
16
+
12
17
  ```
package/dist/index.esm.js CHANGED
@@ -2,8 +2,8 @@ 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
4
  import classNames from 'classnames';
5
- import { createPortal } from 'react-dom';
6
5
  import dayjs from 'dayjs';
6
+ import { createPortal } from 'react-dom';
7
7
  import { observable, action, computed, runInAction, toJS } from 'mobx';
8
8
  import Tooltip from 'rc-tooltip';
9
9
 
@@ -92,6 +92,132 @@ function _toConsumableArray(arr) {
92
92
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
93
93
  }
94
94
 
95
+ var holiday = {
96
+ '2023-01-01': true,
97
+ '2023-01-02': true,
98
+ '2023-01-07': true,
99
+ '2023-01-08': true,
100
+ '2023-01-14': true,
101
+ '2023-01-15': true,
102
+ '2023-01-21': true,
103
+ '2023-01-22': true,
104
+ '2023-01-23': true,
105
+ '2023-01-24': true,
106
+ '2023-01-25': true,
107
+ '2023-01-26': true,
108
+ '2023-01-27': true,
109
+ '2023-01-28': true,
110
+ '2023-01-29': true,
111
+ '2023-02-04': true,
112
+ '2023-02-05': true,
113
+ '2023-02-11': true,
114
+ '2023-02-12': true,
115
+ '2023-02-18': true,
116
+ '2023-02-19': true,
117
+ '2023-02-25': true,
118
+ '2023-02-26': true,
119
+ '2023-03-04': true,
120
+ '2023-03-05': true,
121
+ '2023-03-11': true,
122
+ '2023-03-12': true,
123
+ '2023-03-18': true,
124
+ '2023-03-19': true,
125
+ '2023-03-25': true,
126
+ '2023-03-26': true,
127
+ '2023-04-01': true,
128
+ '2023-04-02': true,
129
+ '2023-04-05': true,
130
+ '2023-04-08': true,
131
+ '2023-04-09': true,
132
+ '2023-04-15': true,
133
+ '2023-04-16': true,
134
+ '2023-04-22': true,
135
+ '2023-04-23': true,
136
+ '2023-04-29': true,
137
+ '2023-04-30': true,
138
+ '2023-05-01': true,
139
+ '2023-05-02': true,
140
+ '2023-05-03': true,
141
+ '2023-05-06': true,
142
+ '2023-05-07': true,
143
+ '2023-05-13': true,
144
+ '2023-05-14': true,
145
+ '2023-05-20': true,
146
+ '2023-05-21': true,
147
+ '2023-05-27': true,
148
+ '2023-05-28': true,
149
+ '2023-06-03': true,
150
+ '2023-06-04': true,
151
+ '2023-06-10': true,
152
+ '2023-06-11': true,
153
+ '2023-06-17': true,
154
+ '2023-06-18': true,
155
+ '2023-06-22': true,
156
+ '2023-06-23': true,
157
+ '2023-06-24': true,
158
+ '2023-06-25': true,
159
+ '2023-07-01': true,
160
+ '2023-07-02': true,
161
+ '2023-07-08': true,
162
+ '2023-07-09': true,
163
+ '2023-07-15': true,
164
+ '2023-07-16': true,
165
+ '2023-07-22': true,
166
+ '2023-07-23': true,
167
+ '2023-07-29': true,
168
+ '2023-07-30': true,
169
+ '2023-08-05': true,
170
+ '2023-08-06': true,
171
+ '2023-08-12': true,
172
+ '2023-08-13': true,
173
+ '2023-08-19': true,
174
+ '2023-08-20': true,
175
+ '2023-08-26': true,
176
+ '2023-08-27': true,
177
+ '2023-09-02': true,
178
+ '2023-09-03': true,
179
+ '2023-09-09': true,
180
+ '2023-09-10': true,
181
+ '2023-09-16': true,
182
+ '2023-09-17': true,
183
+ '2023-09-23': true,
184
+ '2023-09-24': true,
185
+ '2023-09-29': true,
186
+ '2023-09-30': true,
187
+ '2023-10-01': true,
188
+ '2023-10-02': true,
189
+ '2023-10-03': true,
190
+ '2023-10-04': true,
191
+ '2023-10-05': true,
192
+ '2023-10-06': true,
193
+ '2023-10-07': true,
194
+ '2023-10-08': true,
195
+ '2023-10-14': true,
196
+ '2023-10-15': true,
197
+ '2023-10-21': true,
198
+ '2023-10-22': true,
199
+ '2023-10-28': true,
200
+ '2023-10-29': true,
201
+ '2023-11-04': true,
202
+ '2023-11-05': true,
203
+ '2023-11-11': true,
204
+ '2023-11-12': true,
205
+ '2023-11-18': true,
206
+ '2023-11-19': true,
207
+ '2023-11-25': true,
208
+ '2023-11-26': true,
209
+ '2023-12-02': true,
210
+ '2023-12-03': true,
211
+ '2023-12-09': true,
212
+ '2023-12-10': true,
213
+ '2023-12-16': true,
214
+ '2023-12-17': true,
215
+ '2023-12-23': true,
216
+ '2023-12-24': true,
217
+ '2023-12-30': true,
218
+ '2023-12-31': true
219
+ };
220
+
95
221
  /**
96
222
  * 将树形数据向下递归为一维数组
97
223
  *
@@ -187,8 +313,8 @@ function getWeekday(first, last) {
187
313
  var _last = last.valueOf();
188
314
  var count = 0;
189
315
  for (var i = _first; i <= _last; i += 24 * 3600 * 1000) {
190
- var d = new Date(i);
191
- if (d.getDay() >= 1 && d.getDay() <= 5) {
316
+ var d = dayjs(i).format("YYYY-MM-DD");
317
+ if (!holiday[d]) {
192
318
  count++;
193
319
  }
194
320
  }
@@ -4768,7 +4894,6 @@ var GanttStore = /*#__PURE__*/function () {
4768
4894
  var bodyWidth = this.width;
4769
4895
  var viewWidth = 704;
4770
4896
  var tableWidth = 500;
4771
- this.customTableWidth = 500;
4772
4897
  this.viewWidth = viewWidth;
4773
4898
  this.tableWidth = tableWidth;
4774
4899
  this.translateX = translateX;
@@ -4821,11 +4946,6 @@ var GanttStore = /*#__PURE__*/function () {
4821
4946
  value: function setColumns(columns) {
4822
4947
  this.columns = columns;
4823
4948
  }
4824
- }, {
4825
- key: "setCustomTableWidth",
4826
- value: function setCustomTableWidth(customTableWidth) {
4827
- this.customTableWidth = customTableWidth;
4828
- }
4829
4949
  }, {
4830
4950
  key: "setDependencies",
4831
4951
  value: function setDependencies(dependencies) {
@@ -4877,7 +4997,7 @@ var GanttStore = /*#__PURE__*/function () {
4877
4997
  }, {
4878
4998
  key: "initWidth",
4879
4999
  value: function initWidth() {
4880
- this.tableWidth = this.customTableWidth;
5000
+ this.tableWidth = this.totalColumnWidth || window.customTableWidth || 500;
4881
5001
  this.viewWidth = this.width - this.tableWidth;
4882
5002
  // 图表宽度不能小于 200
4883
5003
  if (this.viewWidth < 200) {
@@ -5445,7 +5565,6 @@ __decorate([observable], GanttStore.prototype, "scrolling", void 0);
5445
5565
  __decorate([observable], GanttStore.prototype, "scrollTop", void 0);
5446
5566
  __decorate([observable], GanttStore.prototype, "collapse", void 0);
5447
5567
  __decorate([observable], GanttStore.prototype, "tableWidth", void 0);
5448
- __decorate([observable], GanttStore.prototype, "customTableWidth", void 0);
5449
5568
  __decorate([observable], GanttStore.prototype, "viewWidth", void 0);
5450
5569
  __decorate([observable], GanttStore.prototype, "width", void 0);
5451
5570
  __decorate([observable], GanttStore.prototype, "height", void 0);
@@ -5462,7 +5581,6 @@ __decorate([action], GanttStore.prototype, "toggleCollapse", null);
5462
5581
  __decorate([action], GanttStore.prototype, "setRowCollapse", null);
5463
5582
  __decorate([action], GanttStore.prototype, "setOnUpdate", null);
5464
5583
  __decorate([action], GanttStore.prototype, "setColumns", null);
5465
- __decorate([action], GanttStore.prototype, "setCustomTableWidth", null);
5466
5584
  __decorate([action], GanttStore.prototype, "setDependencies", null);
5467
5585
  __decorate([action], GanttStore.prototype, "handlePanMove", null);
5468
5586
  __decorate([action], GanttStore.prototype, "handlePanEnd", null);
@@ -5959,6 +6077,10 @@ var Chart = function Chart() {
5959
6077
  translateX = store.translateX,
5960
6078
  chartElementRef = store.chartElementRef;
5961
6079
  var minorList = store.getMinorList();
6080
+ console.log("**********************");
6081
+ console.log({
6082
+ minorList: minorList
6083
+ });
5962
6084
  var handleMouseMove = useCallback(function (event) {
5963
6085
  event.persist();
5964
6086
  store.handleMouseMove(event);
@@ -6001,7 +6123,7 @@ var Chart = function Chart() {
6001
6123
  strokeWidth: '1px',
6002
6124
  y2: '10'
6003
6125
  }))), minorList.map(function (item) {
6004
- return item.isWeek ? /*#__PURE__*/React.createElement("g", {
6126
+ return holiday[dayjs(item.key).format("YYYY-MM-DD")] ? /*#__PURE__*/React.createElement("g", {
6005
6127
  key: item.key,
6006
6128
  stroke: '#f0f0f0'
6007
6129
  }, /*#__PURE__*/React.createElement("path", {
@@ -6773,8 +6895,8 @@ var GanttComponent = function GanttComponent(props) {
6773
6895
  if (isRestDay) store.setIsRestDay(isRestDay);
6774
6896
  }, [isRestDay, store]);
6775
6897
  useEffect(function () {
6776
- store.setCustomTableWidth(customTableWidth || 0);
6777
- }, [customTableWidth, store]);
6898
+ window.customTableWidth = customTableWidth;
6899
+ }, [customTableWidth]);
6778
6900
  useEffect(function () {
6779
6901
  if (unit) store.switchSight(unit);
6780
6902
  }, [unit, store]);
@@ -6818,4 +6940,4 @@ var GanttComponent = function GanttComponent(props) {
6818
6940
  }, /*#__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)));
6819
6941
  };
6820
6942
 
6821
- export { Gantt, GanttComponent as default };
6943
+ export { Gantt, GanttComponent as default, flattenDeep, getMaxRange, getWeekday, transverseData };
@@ -0,0 +1,125 @@
1
+ export declare const holiday: {
2
+ '2023-01-01': boolean;
3
+ '2023-01-02': boolean;
4
+ '2023-01-07': boolean;
5
+ '2023-01-08': boolean;
6
+ '2023-01-14': boolean;
7
+ '2023-01-15': boolean;
8
+ '2023-01-21': boolean;
9
+ '2023-01-22': boolean;
10
+ '2023-01-23': boolean;
11
+ '2023-01-24': boolean;
12
+ '2023-01-25': boolean;
13
+ '2023-01-26': boolean;
14
+ '2023-01-27': boolean;
15
+ '2023-01-28': boolean;
16
+ '2023-01-29': boolean;
17
+ '2023-02-04': boolean;
18
+ '2023-02-05': boolean;
19
+ '2023-02-11': boolean;
20
+ '2023-02-12': boolean;
21
+ '2023-02-18': boolean;
22
+ '2023-02-19': boolean;
23
+ '2023-02-25': boolean;
24
+ '2023-02-26': boolean;
25
+ '2023-03-04': boolean;
26
+ '2023-03-05': boolean;
27
+ '2023-03-11': boolean;
28
+ '2023-03-12': boolean;
29
+ '2023-03-18': boolean;
30
+ '2023-03-19': boolean;
31
+ '2023-03-25': boolean;
32
+ '2023-03-26': boolean;
33
+ '2023-04-01': boolean;
34
+ '2023-04-02': boolean;
35
+ '2023-04-05': boolean;
36
+ '2023-04-08': boolean;
37
+ '2023-04-09': boolean;
38
+ '2023-04-15': boolean;
39
+ '2023-04-16': boolean;
40
+ '2023-04-22': boolean;
41
+ '2023-04-23': boolean;
42
+ '2023-04-29': boolean;
43
+ '2023-04-30': boolean;
44
+ '2023-05-01': boolean;
45
+ '2023-05-02': boolean;
46
+ '2023-05-03': boolean;
47
+ '2023-05-06': boolean;
48
+ '2023-05-07': boolean;
49
+ '2023-05-13': boolean;
50
+ '2023-05-14': boolean;
51
+ '2023-05-20': boolean;
52
+ '2023-05-21': boolean;
53
+ '2023-05-27': boolean;
54
+ '2023-05-28': boolean;
55
+ '2023-06-03': boolean;
56
+ '2023-06-04': boolean;
57
+ '2023-06-10': boolean;
58
+ '2023-06-11': boolean;
59
+ '2023-06-17': boolean;
60
+ '2023-06-18': boolean;
61
+ '2023-06-22': boolean;
62
+ '2023-06-23': boolean;
63
+ '2023-06-24': boolean;
64
+ '2023-06-25': boolean;
65
+ '2023-07-01': boolean;
66
+ '2023-07-02': boolean;
67
+ '2023-07-08': boolean;
68
+ '2023-07-09': boolean;
69
+ '2023-07-15': boolean;
70
+ '2023-07-16': boolean;
71
+ '2023-07-22': boolean;
72
+ '2023-07-23': boolean;
73
+ '2023-07-29': boolean;
74
+ '2023-07-30': boolean;
75
+ '2023-08-05': boolean;
76
+ '2023-08-06': boolean;
77
+ '2023-08-12': boolean;
78
+ '2023-08-13': boolean;
79
+ '2023-08-19': boolean;
80
+ '2023-08-20': boolean;
81
+ '2023-08-26': boolean;
82
+ '2023-08-27': boolean;
83
+ '2023-09-02': boolean;
84
+ '2023-09-03': boolean;
85
+ '2023-09-09': boolean;
86
+ '2023-09-10': boolean;
87
+ '2023-09-16': boolean;
88
+ '2023-09-17': boolean;
89
+ '2023-09-23': boolean;
90
+ '2023-09-24': boolean;
91
+ '2023-09-29': boolean;
92
+ '2023-09-30': boolean;
93
+ '2023-10-01': boolean;
94
+ '2023-10-02': boolean;
95
+ '2023-10-03': boolean;
96
+ '2023-10-04': boolean;
97
+ '2023-10-05': boolean;
98
+ '2023-10-06': boolean;
99
+ '2023-10-07': boolean;
100
+ '2023-10-08': boolean;
101
+ '2023-10-14': boolean;
102
+ '2023-10-15': boolean;
103
+ '2023-10-21': boolean;
104
+ '2023-10-22': boolean;
105
+ '2023-10-28': boolean;
106
+ '2023-10-29': boolean;
107
+ '2023-11-04': boolean;
108
+ '2023-11-05': boolean;
109
+ '2023-11-11': boolean;
110
+ '2023-11-12': boolean;
111
+ '2023-11-18': boolean;
112
+ '2023-11-19': boolean;
113
+ '2023-11-25': boolean;
114
+ '2023-11-26': boolean;
115
+ '2023-12-02': boolean;
116
+ '2023-12-03': boolean;
117
+ '2023-12-09': boolean;
118
+ '2023-12-10': boolean;
119
+ '2023-12-16': boolean;
120
+ '2023-12-17': boolean;
121
+ '2023-12-23': boolean;
122
+ '2023-12-24': boolean;
123
+ '2023-12-30': boolean;
124
+ '2023-12-31': boolean;
125
+ };
@@ -2,3 +2,4 @@ import GanttComponent, { GanttProps, GanttRef } from './Gantt';
2
2
  import { Gantt } from './types';
3
3
  export { GanttProps, Gantt, GanttRef };
4
4
  export default GanttComponent;
5
+ export * from './utils';
@@ -22,7 +22,6 @@ declare class GanttStore {
22
22
  scrollTop: number;
23
23
  collapse: boolean;
24
24
  tableWidth: number;
25
- customTableWidth: number;
26
25
  viewWidth: number;
27
26
  width: number;
28
27
  height: number;
@@ -53,7 +52,6 @@ declare class GanttStore {
53
52
  setRowCollapse(item: Gantt.Item, collapsed: boolean): void;
54
53
  setOnUpdate(onUpdate: GanttProperties['onUpdate']): void;
55
54
  setColumns(columns: Gantt.Column[]): void;
56
- setCustomTableWidth(customTableWidth: number): void;
57
55
  setDependencies(dependencies: Gantt.Dependence[]): void;
58
56
  handlePanMove(translateX: number): void;
59
57
  handlePanEnd(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aloudata-gantt",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "license": "MIT",
5
5
  "module": "dist/index.esm.js",
6
6
  "typings": "dist/types/index.d.ts",