@xpyjs/gantt-react 0.0.1-beta.0 → 0.0.1-beta.2
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.cjs +20 -2
- package/dist/index.d.ts +11 -0
- package/dist/index.js +20 -2
- package/package.json +6 -2
package/dist/index.cjs
CHANGED
|
@@ -129,6 +129,18 @@ const XGanttReact = react.forwardRef(
|
|
|
129
129
|
}
|
|
130
130
|
return false;
|
|
131
131
|
}, []);
|
|
132
|
+
const getDataChain = react.useCallback((id) => {
|
|
133
|
+
if (ganttInstanceRef.current) {
|
|
134
|
+
return ganttInstanceRef.current.getDataChain(id);
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
prev: { chain: [], nodes: [], links: [] },
|
|
138
|
+
next: { chain: [], nodes: [], links: [] },
|
|
139
|
+
allNodes: [],
|
|
140
|
+
allLinks: [],
|
|
141
|
+
current: void 0
|
|
142
|
+
};
|
|
143
|
+
}, []);
|
|
132
144
|
const destroyGantt = react.useCallback(() => {
|
|
133
145
|
if (ganttInstanceRef.current) {
|
|
134
146
|
ganttInstanceRef.current.destroy();
|
|
@@ -137,7 +149,8 @@ const XGanttReact = react.forwardRef(
|
|
|
137
149
|
}, []);
|
|
138
150
|
react.useImperativeHandle(ref, () => ({
|
|
139
151
|
getInstance: () => ganttInstanceRef.current,
|
|
140
|
-
jumpTo
|
|
152
|
+
jumpTo,
|
|
153
|
+
getDataChain
|
|
141
154
|
}), [jumpTo]);
|
|
142
155
|
react.useEffect(() => {
|
|
143
156
|
initGantt();
|
|
@@ -178,10 +191,15 @@ function useXGantt() {
|
|
|
178
191
|
var _a;
|
|
179
192
|
return ((_a = ganttRef.current) == null ? void 0 : _a.jumpTo(date)) || false;
|
|
180
193
|
}, []);
|
|
194
|
+
const getDataChain = react.useCallback((id) => {
|
|
195
|
+
var _a;
|
|
196
|
+
return ((_a = ganttRef.current) == null ? void 0 : _a.getDataChain(id)) || [];
|
|
197
|
+
}, []);
|
|
181
198
|
return {
|
|
182
199
|
ganttRef,
|
|
183
200
|
getInstance,
|
|
184
|
-
jumpTo
|
|
201
|
+
jumpTo,
|
|
202
|
+
getDataChain
|
|
185
203
|
};
|
|
186
204
|
}
|
|
187
205
|
Object.defineProperty(exports, "colorjs", {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Colorjs } from '@xpyjs/gantt-core';
|
|
2
2
|
import { colorjs } from '@xpyjs/gantt-core';
|
|
3
|
+
import { DataChain } from '@xpyjs/gantt-core';
|
|
3
4
|
import { Dayjs } from '@xpyjs/gantt-core';
|
|
4
5
|
import { dayjs } from '@xpyjs/gantt-core';
|
|
5
6
|
import { default as default_2 } from 'react';
|
|
@@ -10,6 +11,7 @@ import { generateId } from '@xpyjs/gantt-core';
|
|
|
10
11
|
import { ILink } from '@xpyjs/gantt-core';
|
|
11
12
|
import { IOptionConfig } from '@xpyjs/gantt-core';
|
|
12
13
|
import { IOptions } from '@xpyjs/gantt-core';
|
|
14
|
+
import { LinkType } from '@xpyjs/gantt-core';
|
|
13
15
|
import { RefObject } from 'react';
|
|
14
16
|
import { XGantt } from '@xpyjs/gantt-core';
|
|
15
17
|
import { XGanttUnit } from '@xpyjs/gantt-core';
|
|
@@ -18,6 +20,8 @@ export { Colorjs }
|
|
|
18
20
|
|
|
19
21
|
export { colorjs }
|
|
20
22
|
|
|
23
|
+
export { DataChain }
|
|
24
|
+
|
|
21
25
|
export { Dayjs }
|
|
22
26
|
|
|
23
27
|
export { dayjs }
|
|
@@ -36,6 +40,8 @@ export { IOptionConfig }
|
|
|
36
40
|
|
|
37
41
|
export { IOptions }
|
|
38
42
|
|
|
43
|
+
export { LinkType }
|
|
44
|
+
|
|
39
45
|
/**
|
|
40
46
|
* 使用甘特图的 Hook
|
|
41
47
|
*
|
|
@@ -77,6 +83,7 @@ export declare function useXGantt(): {
|
|
|
77
83
|
ganttRef: RefObject<XGanttReactRef>;
|
|
78
84
|
getInstance: () => XGantt | null;
|
|
79
85
|
jumpTo: (date?: any) => boolean;
|
|
86
|
+
getDataChain: (id: string) => DataChain | never[];
|
|
80
87
|
};
|
|
81
88
|
|
|
82
89
|
/**
|
|
@@ -363,6 +370,10 @@ export declare interface XGanttReactRef {
|
|
|
363
370
|
* ```
|
|
364
371
|
*/
|
|
365
372
|
jumpTo: (date?: any) => boolean;
|
|
373
|
+
/**
|
|
374
|
+
* 获取指定任务的所有相关联的完整路径,包含所有连接线与任务节点
|
|
375
|
+
*/
|
|
376
|
+
getDataChain(id: string): DataChain;
|
|
366
377
|
}
|
|
367
378
|
|
|
368
379
|
export { XGanttUnit }
|
package/dist/index.js
CHANGED
|
@@ -128,6 +128,18 @@ const XGanttReact = forwardRef(
|
|
|
128
128
|
}
|
|
129
129
|
return false;
|
|
130
130
|
}, []);
|
|
131
|
+
const getDataChain = useCallback((id) => {
|
|
132
|
+
if (ganttInstanceRef.current) {
|
|
133
|
+
return ganttInstanceRef.current.getDataChain(id);
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
prev: { chain: [], nodes: [], links: [] },
|
|
137
|
+
next: { chain: [], nodes: [], links: [] },
|
|
138
|
+
allNodes: [],
|
|
139
|
+
allLinks: [],
|
|
140
|
+
current: void 0
|
|
141
|
+
};
|
|
142
|
+
}, []);
|
|
131
143
|
const destroyGantt = useCallback(() => {
|
|
132
144
|
if (ganttInstanceRef.current) {
|
|
133
145
|
ganttInstanceRef.current.destroy();
|
|
@@ -136,7 +148,8 @@ const XGanttReact = forwardRef(
|
|
|
136
148
|
}, []);
|
|
137
149
|
useImperativeHandle(ref, () => ({
|
|
138
150
|
getInstance: () => ganttInstanceRef.current,
|
|
139
|
-
jumpTo
|
|
151
|
+
jumpTo,
|
|
152
|
+
getDataChain
|
|
140
153
|
}), [jumpTo]);
|
|
141
154
|
useEffect(() => {
|
|
142
155
|
initGantt();
|
|
@@ -177,10 +190,15 @@ function useXGantt() {
|
|
|
177
190
|
var _a;
|
|
178
191
|
return ((_a = ganttRef.current) == null ? void 0 : _a.jumpTo(date)) || false;
|
|
179
192
|
}, []);
|
|
193
|
+
const getDataChain = useCallback((id) => {
|
|
194
|
+
var _a;
|
|
195
|
+
return ((_a = ganttRef.current) == null ? void 0 : _a.getDataChain(id)) || [];
|
|
196
|
+
}, []);
|
|
180
197
|
return {
|
|
181
198
|
ganttRef,
|
|
182
199
|
getInstance,
|
|
183
|
-
jumpTo
|
|
200
|
+
jumpTo,
|
|
201
|
+
getDataChain
|
|
184
202
|
};
|
|
185
203
|
}
|
|
186
204
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xpyjs/gantt-react",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "React wrapper for x-gantt",
|
|
6
6
|
"author": "JeremyJone",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"README.md"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@xpyjs/gantt-core": "0.0.1-beta.
|
|
26
|
+
"@xpyjs/gantt-core": "0.0.1-beta.2"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react": ">=16.8.0",
|
|
@@ -61,6 +61,10 @@
|
|
|
61
61
|
"bugs": {
|
|
62
62
|
"url": "https://github.com/xpyjs/gantt/issues"
|
|
63
63
|
},
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"access": "public",
|
|
66
|
+
"registry": "https://registry.npmjs.org/"
|
|
67
|
+
},
|
|
64
68
|
"scripts": {
|
|
65
69
|
"dev": "tsc && vite build --watch",
|
|
66
70
|
"build": "tsc && vite build",
|