@xpyjs/gantt-core 0.0.1-alpha.4 → 0.0.1-beta.0

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xpyjs/gantt-core",
3
3
  "private": false,
4
- "version": "0.0.1-alpha.4",
4
+ "version": "0.0.1-beta.0",
5
5
  "description": "A powerful and flexible Gantt chart component library for modern web applications with TypeScript support",
6
6
  "type": "module",
7
7
  "main": "./dist/x-gantt.umd.cjs",
@@ -74,4 +74,5 @@ export declare class Task {
74
74
  getEmitData(): EmitData;
75
75
  getAllChildren(): Task[];
76
76
  isMilestone(): boolean;
77
+ isSummary(): boolean;
77
78
  }
@@ -0,0 +1,36 @@
1
+ import Konva from "konva";
2
+ import { IContext } from "@/types/render";
3
+ /**
4
+ * 标志日期的渲染
5
+ */
6
+ export declare class FlagGroup {
7
+ private context;
8
+ private layer;
9
+ private width;
10
+ private height;
11
+ private offsetX;
12
+ private offsetY;
13
+ private flagGroup;
14
+ constructor(context: IContext, layer: Konva.Layer);
15
+ /**
16
+ * 调整标志日期大小
17
+ */
18
+ resize(width: number, height: number): void;
19
+ /**
20
+ * 设置偏移量 (响应滚动)
21
+ */
22
+ setOffset(x: number, y: number): void;
23
+ /**
24
+ * 渲染标志日期
25
+ */
26
+ render(): void;
27
+ /**
28
+ * 销毁标志日期层
29
+ */
30
+ destroy(): void;
31
+ private clearFlag;
32
+ /**
33
+ * 计算标志日期
34
+ */
35
+ private calculateFlag;
36
+ }
@@ -50,6 +50,7 @@ export declare class LinkGroup {
50
50
  */
51
51
  private calculateLinks;
52
52
  private createId;
53
+ private getPoints;
53
54
  /** 生成 FS 连线 */
54
55
  private createFS;
55
56
  /** 生成 FF 连线 */
@@ -6,6 +6,7 @@ export declare class ChartToday {
6
6
  private headerLayer;
7
7
  private arrowAnimation?;
8
8
  private todayLine?;
9
+ private todayTextGroup?;
9
10
  private triangle?;
10
11
  private width;
11
12
  private height;
@@ -9,6 +9,7 @@ export declare class Chart {
9
9
  private gridGroup;
10
10
  private weekendGroup;
11
11
  private holidayGroup;
12
+ private flagGroup;
12
13
  private todayLayer;
13
14
  private linkGroup;
14
15
  private baselineGroup;
@@ -20,8 +20,6 @@ export declare class TimeAxis {
20
20
  private strictStart;
21
21
  /** 固定截止日期 */
22
22
  private strictEnd;
23
- /** 是否锁定时间范围 */
24
- private isStrict;
25
23
  /** 是否自适应宽度 */
26
24
  private isAuto;
27
25
  /** 表头的日期列表 */
@@ -63,6 +63,18 @@ export interface IGanttOptions {
63
63
  key: string;
64
64
  /** 是否展示关联线。不支持单独配置 */
65
65
  show: boolean;
66
+ /** 移动相关设置 */
67
+ move: {
68
+ /**
69
+ * 是否允许移动连线到新节点。
70
+ *
71
+ * @default false
72
+ *
73
+ * @description 开启时,所有连线将按照 from 与 to 属性规则允许移动
74
+ * @description 需要注意的是,开启移动后,需要主动添加对应 'update:link' 事件,否则会导致显示异常
75
+ */
76
+ enabled: boolean;
77
+ };
66
78
  /** 创建相关设置 */
67
79
  create: {
68
80
  /**
@@ -387,6 +399,34 @@ export interface IGanttOptions {
387
399
  };
388
400
  };
389
401
 
402
+ /** 汇总集合配置 */
403
+ summary: {
404
+ /**
405
+ * 是否启用汇总集合
406
+ *
407
+ * @default false
408
+ *
409
+ * @description 启用后,所有标记为汇总集合的任务将会被特殊处理。
410
+ */
411
+ show: boolean;
412
+ /** 汇总集合的颜色。默认与 bar 颜色保持一致 */
413
+ color?: string | ((row: EmitData) => string | undefined);
414
+ /** 移动相关配置 */
415
+ move: {
416
+ /** 是否启用移动。默认情况,汇总是不允许主动移动的 */
417
+ enabled: boolean;
418
+ };
419
+ /**
420
+ * 展示模式
421
+ *
422
+ * @default 'expand'
423
+ *
424
+ * - 'always' 永远展示为汇总集合形式
425
+ * - 'expand' 展开时展示为汇总集合形式,当任务收起后,展示为普通类型
426
+ */
427
+ mode: "always" | "expand"
428
+ };
429
+
390
430
  /** 主色调。默认 #eca710 */
391
431
  primaryColor: string;
392
432
 
@@ -736,6 +776,25 @@ export interface IGanttOptions {
736
776
  * @default 1
737
777
  */
738
778
  width: number;
779
+ /**
780
+ * 今日时间线的文本
781
+ */
782
+ text?: {
783
+ /** 是否显示文本 */
784
+ show?: boolean;
785
+ /** 文本内容。默认为 '今天' */
786
+ content?: string;
787
+ /** 文本颜色 */
788
+ color?: string;
789
+ /** 背景颜色 */
790
+ backgroundColor?: string;
791
+ /** 透明度 */
792
+ opacity?: number;
793
+ /** 文本字体大小 */
794
+ fontSize?: number;
795
+ /** 文本字体 */
796
+ fontFamily?: string;
797
+ }
739
798
  };
740
799
 
741
800
  /** 周末配置 */
@@ -783,10 +842,92 @@ export interface IGanttOptions {
783
842
  date: Date | number | string | Array<Date | number | string>;
784
843
  backgroundColor?: string;
785
844
  opacity?: number;
845
+ /**
846
+ * 自定义节假日期的文本
847
+ */
848
+ text?: {
849
+ /** 是否显示文本 */
850
+ show?: boolean;
851
+ /** 文本内容 */
852
+ content?: string;
853
+ /** 文本颜色 */
854
+ color?: string;
855
+ /** 背景颜色 */
856
+ backgroundColor?: string;
857
+ /** 透明度 */
858
+ opacity?: number;
859
+ /** 文本字体大小 */
860
+ fontSize?: number;
861
+ /** 文本字体 */
862
+ fontFamily?: string;
863
+ }
786
864
  } & IPattern
787
865
  >;
788
866
  } & IPattern;
789
867
 
868
+ /** 标志配置。它用于配置一个或多个标志性日期 */
869
+ flag?: {
870
+ /**
871
+ * 是否展示标志
872
+ *
873
+ * @default false
874
+ */
875
+ show: boolean;
876
+ /**
877
+ * 标志的背景颜色。默认使用主色调
878
+ */
879
+ backgroundColor?: string;
880
+ /**
881
+ * 透明度
882
+ *
883
+ * @description 它会影响标志的整体透明度
884
+ */
885
+ opacity?: number;
886
+ /** 文本颜色 */
887
+ color?: string;
888
+ /** 文本字体大小 */
889
+ fontSize?: number;
890
+ /** 文本字体 */
891
+ fontFamily?: string;
892
+ /** 标志日期的数据以及配置 */
893
+ data: Array<{
894
+ /**
895
+ * 标志的背景颜色
896
+ */
897
+ backgroundColor?: string;
898
+ /**
899
+ * 透明度
900
+ *
901
+ * @description 它会影响标志的整体透明度
902
+ */
903
+ opacity?: number;
904
+ /**
905
+ * 标志时间。支持精准时间,会根据最精度位置展示
906
+ */
907
+ date: Date | number | string;
908
+ /** 文本内容。展示文本就是普通文本旗帜 */
909
+ content?: string;
910
+ /**
911
+ * 如果不展示文本,支持几种特殊旗帜符号
912
+ *
913
+ * @description 它与文本内容互斥,如果 content 不为空,则不会展示特殊旗帜
914
+ *
915
+ * @param banner 横幅旗(比带文本旗帜略小)
916
+ * @param pennant 三角信号旗
917
+ * @param tag 矩形带缺口旗
918
+ * @param wedge 锥形旗
919
+ * @param ribbon 丝带旗
920
+ */
921
+ flag?: "banner" | "pennant" | "tag" | "wedge" | "ribbon";
922
+ /** 文本颜色 */
923
+ color?: string;
924
+ /** 文本字体大小 */
925
+ fontSize?: number;
926
+ /** 文本字体 */
927
+ fontFamily?: string;
928
+ }>
929
+ }
930
+
790
931
  /** 滚动条配置 */
791
932
  scrollbar?: {
792
933
  /** 是否显示水平滚动条 */