@visactor/vtable-gantt 1.17.3-alpha.11 → 1.17.3-alpha.12

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.
@@ -26541,811 +26541,6 @@
26541
26541
  registed || (registed = !0, preLoadAllModule(), isBrowserEnv() ? loadBrowserEnv(container) : isNodeEnv() && loadNodeEnv(container), registerArc(), registerCircle(), registerGroup(), registerImage(), registerLine(), registerRect(), registerRichtext(), registerShadowRoot(), registerSymbol(), registerText(), registerFlexLayoutPlugin(), loadPoptip(), registerFlexLayoutPlugin());
26542
26542
  }
26543
26543
 
26544
- const defaultTaskBarStyle = {
26545
- barColor: 'blue',
26546
- completedBarColor: 'gray',
26547
- width: 30,
26548
- cornerRadius: 3,
26549
- borderWidth: 0,
26550
- fontFamily: 'Arial',
26551
- fontSize: 14
26552
- };
26553
- function setWidthToDefaultTaskBarStyle(width) {
26554
- defaultTaskBarStyle.width = width;
26555
- }
26556
- const isNode$1 = typeof window === 'undefined' || typeof window.window === 'undefined';
26557
- const DayTimes = 1000 * 60 * 60 * 24;
26558
- function getDateIndexByX(x, gantt) {
26559
- const totalX = x + gantt.stateManager.scroll.horizontalBarPos;
26560
- const firstDateColWidth = gantt.getDateColWidth(0);
26561
- const dateIndex = Math.floor((totalX - firstDateColWidth) / gantt.parsedOptions.timelineColWidth) + 1;
26562
- return dateIndex;
26563
- }
26564
- function generateMarkLine(markLine) {
26565
- if (!markLine) {
26566
- return [];
26567
- }
26568
- if (markLine === true) {
26569
- return [
26570
- {
26571
- date: createDateAtMidnight().toLocaleDateString(),
26572
- scrollToMarkLine: true,
26573
- position: 'left',
26574
- style: {
26575
- lineColor: 'red',
26576
- lineWidth: 1
26577
- }
26578
- }
26579
- ];
26580
- }
26581
- else if (Array.isArray(markLine)) {
26582
- return markLine.map((item, index) => {
26583
- return {
26584
- ...item,
26585
- date: item.date,
26586
- scrollToMarkLine: item.scrollToMarkLine,
26587
- position: item.position ?? 'left',
26588
- style: {
26589
- lineColor: item.style?.lineColor || 'red',
26590
- lineWidth: item.style?.lineWidth || 1,
26591
- lineDash: item.style?.lineDash
26592
- }
26593
- };
26594
- });
26595
- }
26596
- return [
26597
- {
26598
- ...markLine,
26599
- date: markLine.date,
26600
- scrollToMarkLine: markLine.scrollToMarkLine ?? true,
26601
- position: markLine.position ?? 'left',
26602
- style: {
26603
- lineColor: markLine.style?.lineColor || 'red',
26604
- lineWidth: markLine.style?.lineWidth || 1,
26605
- lineDash: markLine.style?.lineDash
26606
- }
26607
- }
26608
- ];
26609
- }
26610
- function getHorizontalScrollBarSize$1(scrollStyle) {
26611
- if (scrollStyle?.hoverOn ||
26612
- (scrollStyle?.horizontalVisible && scrollStyle?.horizontalVisible === 'none') ||
26613
- (!scrollStyle?.horizontalVisible && scrollStyle?.visible === 'none')) {
26614
- return 0;
26615
- }
26616
- return scrollStyle?.width ?? 7;
26617
- }
26618
- function getVerticalScrollBarSize$1(scrollStyle) {
26619
- if (scrollStyle?.hoverOn ||
26620
- (scrollStyle?.verticalVisible && scrollStyle?.verticalVisible === 'none') ||
26621
- (!scrollStyle?.verticalVisible && scrollStyle?.visible === 'none')) {
26622
- return 0;
26623
- }
26624
- return scrollStyle?.width ?? 7;
26625
- }
26626
- function initOptions(gantt) {
26627
- const options = gantt.options;
26628
- gantt.parsedOptions.tasksShowMode = options?.tasksShowMode ?? TasksShowMode.Tasks_Separate;
26629
- gantt.parsedOptions.pixelRatio = options?.pixelRatio ?? 1;
26630
- gantt.parsedOptions.rowHeight = options?.rowHeight ?? 40;
26631
- gantt.parsedOptions.timelineColWidth = options?.timelineHeader?.colWidth ?? 60;
26632
- gantt.parsedOptions.startDateField = options.taskBar?.startDateField ?? 'startDate';
26633
- gantt.parsedOptions.endDateField = options.taskBar?.endDateField ?? 'endDate';
26634
- gantt.parsedOptions.progressField = options.taskBar?.progressField ?? 'progress';
26635
- const { unit: minTimeUnit, startOfWeek, step } = gantt.parsedOptions.reverseSortedTimelineScales[0];
26636
- gantt.parsedOptions.minDate = options?.minDate
26637
- ? getStartDateByTimeUnit(new Date(options.minDate), minTimeUnit, startOfWeek)
26638
- : undefined;
26639
- gantt.parsedOptions.maxDate = options?.maxDate
26640
- ? getEndDateByTimeUnit(gantt.parsedOptions.minDate, new Date(options.maxDate), minTimeUnit, step)
26641
- : undefined;
26642
- gantt.parsedOptions._minDateTime = gantt.parsedOptions.minDate?.getTime();
26643
- gantt.parsedOptions._maxDateTime = gantt.parsedOptions.maxDate?.getTime();
26644
- gantt.parsedOptions.overscrollBehavior = options?.overscrollBehavior ?? 'auto';
26645
- gantt.parsedOptions.underlayBackgroundColor = options?.underlayBackgroundColor ?? '#FFF';
26646
- gantt.parsedOptions.scrollStyle = Object.assign({}, {
26647
- scrollRailColor: 'rgba(100, 100, 100, 0.2)',
26648
- scrollSliderColor: 'rgba(100, 100, 100, 0.5)',
26649
- scrollSliderCornerRadius: 4,
26650
- width: 10,
26651
- visible: 'always',
26652
- hoverOn: true,
26653
- barToSide: false
26654
- }, options?.scrollStyle);
26655
- gantt.parsedOptions.timelineHeaderHorizontalLineStyle = options?.timelineHeader?.horizontalLine;
26656
- gantt.parsedOptions.timelineHeaderVerticalLineStyle = options?.timelineHeader?.verticalLine;
26657
- gantt.parsedOptions.timelineHeaderBackgroundColor = options?.timelineHeader?.backgroundColor;
26658
- gantt.parsedOptions.timeLineHeaderRowHeights = [];
26659
- gantt.parsedOptions.timelineHeaderStyles = [];
26660
- for (let i = 0; i < gantt.parsedOptions.sortedTimelineScales.length ?? 0; i++) {
26661
- const style = gantt.parsedOptions.sortedTimelineScales[i].style;
26662
- gantt.parsedOptions.timelineHeaderStyles.push(Object.assign({
26663
- fontSize: 20,
26664
- fontWeight: 'bold',
26665
- textAlign: 'center',
26666
- textBaseline: 'middle',
26667
- color: '#000',
26668
- backgroundColor: '#fff'
26669
- }, style));
26670
- gantt.parsedOptions.timeLineHeaderRowHeights.push(gantt.parsedOptions.sortedTimelineScales[i].rowHeight ?? options?.headerRowHeight ?? 40);
26671
- }
26672
- gantt.parsedOptions.grid = Object.assign({}, options?.grid);
26673
- setWidthToDefaultTaskBarStyle((gantt.parsedOptions.rowHeight * 3) / 4);
26674
- gantt.parsedOptions.taskBarStyle =
26675
- options?.taskBar?.barStyle && typeof options?.taskBar?.barStyle === 'function'
26676
- ? options.taskBar.barStyle
26677
- : Object.assign({}, defaultTaskBarStyle, options?.taskBar?.barStyle);
26678
- gantt.parsedOptions.taskBarMilestoneStyle = Object.assign(typeof gantt.parsedOptions.taskBarStyle === 'function'
26679
- ? {}
26680
- : {
26681
- width: gantt.parsedOptions.taskBarStyle.width,
26682
- borderColor: gantt.parsedOptions.taskBarStyle.borderColor,
26683
- borderLineWidth: gantt.parsedOptions.taskBarStyle.borderLineWidth ?? 1,
26684
- fillColor: gantt.parsedOptions.taskBarStyle.barColor,
26685
- cornerRadius: 0
26686
- }, options?.taskBar?.milestoneStyle);
26687
- gantt.parsedOptions.taskBarMilestoneHypotenuse = gantt.parsedOptions.taskBarMilestoneStyle.width * Math.sqrt(2);
26688
- gantt.parsedOptions.dateFormat = options?.dateFormat;
26689
- gantt.parsedOptions.taskBarHoverStyle = Object.assign({
26690
- barOverlayColor: 'rgba(99, 144, 0, 0.4)'
26691
- }, options?.taskBar?.hoverBarStyle);
26692
- gantt.parsedOptions.taskBarSelectable = options?.taskBar?.selectable ?? true;
26693
- gantt.parsedOptions.taskBarSelectedStyle = Object.assign(typeof gantt.parsedOptions.taskBarStyle === 'function'
26694
- ? {
26695
- shadowBlur: 6,
26696
- shadowOffsetX: 0,
26697
- shadowOffsetY: 0,
26698
- borderLineWidth: 1
26699
- }
26700
- : {
26701
- shadowBlur: 6,
26702
- shadowOffsetX: 0,
26703
- shadowOffsetY: 0,
26704
- shadowColor: gantt.parsedOptions.taskBarStyle.barColor,
26705
- borderColor: gantt.parsedOptions.taskBarStyle.barColor,
26706
- borderLineWidth: 1
26707
- }, options?.taskBar?.selectedBarStyle);
26708
- gantt.parsedOptions.taskBarLabelText = options?.taskBar?.labelText ?? '';
26709
- gantt.parsedOptions.taskBarMoveable = options?.taskBar?.moveable ?? true;
26710
- gantt.parsedOptions.moveTaskBarToExtendDateRange = options?.taskBar?.moveToExtendDateRange ?? true;
26711
- gantt.parsedOptions.taskBarResizable = options?.taskBar?.resizable ?? true;
26712
- gantt.parsedOptions.taskBarDragOrder = options?.taskBar?.dragOrder ?? true;
26713
- gantt.parsedOptions.taskBarLabelStyle = {
26714
- fontFamily: options?.taskBar?.labelTextStyle?.fontFamily ?? 'Arial',
26715
- fontSize: options?.taskBar?.labelTextStyle?.fontSize ?? 20,
26716
- color: options?.taskBar?.labelTextStyle?.color ?? '#F01',
26717
- textAlign: options?.taskBar?.labelTextStyle?.textAlign ?? 'left',
26718
- textBaseline: options?.taskBar?.labelTextStyle?.textBaseline ?? 'middle',
26719
- padding: options?.taskBar?.labelTextStyle?.padding ?? [0, 0, 0, 10],
26720
- textOverflow: options?.taskBar?.labelTextStyle?.textOverflow
26721
- };
26722
- gantt.parsedOptions.taskBarCustomLayout = options?.taskBar?.customLayout;
26723
- gantt.parsedOptions.taskBarCreatable =
26724
- options?.taskBar?.scheduleCreatable ??
26725
- !!(gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Separate ||
26726
- gantt.parsedOptions.tasksShowMode === TasksShowMode.Tasks_Separate);
26727
- gantt.parsedOptions.taskBarCreationButtonStyle = Object.assign({
26728
- lineColor: 'rgb(99, 144, 0)',
26729
- lineWidth: 1,
26730
- lineDash: [5, 5],
26731
- cornerRadius: 4,
26732
- backgroundColor: '#FFF'
26733
- }, options?.taskBar?.scheduleCreation?.buttonStyle);
26734
- gantt.parsedOptions.taskBarCreationCustomLayout = options?.taskBar?.scheduleCreation?.customLayout;
26735
- gantt.parsedOptions.taskBarCreationMaxWidth = options?.taskBar?.scheduleCreation?.maxWidth;
26736
- gantt.parsedOptions.taskBarCreationMinWidth = options?.taskBar?.scheduleCreation?.minWidth;
26737
- gantt.parsedOptions.outerFrameStyle = Object.assign({
26738
- borderColor: '#e1e4e8',
26739
- borderLineWidth: 1,
26740
- cornerRadius: 4
26741
- }, options.frame?.outerFrameStyle);
26742
- gantt.parsedOptions.markLine = generateMarkLine(options?.markLine);
26743
- if (gantt.parsedOptions.markLine?.length ?? 0) {
26744
- if (gantt.parsedOptions.markLine?.every(item => item.scrollToMarkLine === undefined)) {
26745
- gantt.parsedOptions.markLine[0].scrollToMarkLine = true;
26746
- }
26747
- if (gantt.parsedOptions.markLine?.find(item => item.scrollToMarkLine)) {
26748
- gantt.parsedOptions.scrollToMarkLineDate = getStartDateByTimeUnit(new Date(gantt.parsedOptions.markLine?.find(item => item.scrollToMarkLine).date), minTimeUnit, startOfWeek);
26749
- }
26750
- }
26751
- gantt.parsedOptions.verticalSplitLineHighlight = options.frame?.verticalSplitLineHighlight;
26752
- gantt.parsedOptions.verticalSplitLine = Object.assign({
26753
- lineColor: gantt.parsedOptions.outerFrameStyle?.borderColor,
26754
- lineWidth: gantt.parsedOptions.outerFrameStyle?.borderLineWidth
26755
- }, options.frame?.verticalSplitLine);
26756
- gantt.parsedOptions.horizontalSplitLine = options.frame?.horizontalSplitLine;
26757
- gantt.parsedOptions.verticalSplitLineMoveable = options.frame?.verticalSplitLineMoveable;
26758
- gantt.parsedOptions.taskKeyField = options.taskKeyField ?? 'id';
26759
- gantt.parsedOptions.dependencyLinks = options.dependency?.links ?? [];
26760
- gantt.parsedOptions.dependencyLinkCreatable = options.dependency?.linkCreatable ?? false;
26761
- gantt.parsedOptions.dependencyLinkSelectable = options.dependency?.linkSelectable ?? true;
26762
- gantt.parsedOptions.dependencyLinkDeletable = options.dependency?.linkDeletable ?? false;
26763
- gantt.parsedOptions.dependencyLinkLineStyle = Object.assign({
26764
- lineColor: 'red',
26765
- lineWidth: 1
26766
- }, options.dependency?.linkLineStyle);
26767
- gantt.parsedOptions.dependencyLinkSelectedLineStyle = Object.assign({
26768
- shadowBlur: 4,
26769
- shadowOffset: 0,
26770
- shadowColor: gantt.parsedOptions.dependencyLinkLineStyle.lineColor,
26771
- lineColor: gantt.parsedOptions.dependencyLinkLineStyle.lineColor,
26772
- lineWidth: gantt.parsedOptions.dependencyLinkLineStyle.lineWidth
26773
- }, options?.dependency?.linkSelectedLineStyle);
26774
- gantt.parsedOptions.dependencyLinkLineCreatePointStyle = Object.assign({
26775
- strokeColor: 'red',
26776
- fillColor: 'white',
26777
- radius: 5,
26778
- strokeWidth: 1
26779
- }, options?.dependency?.linkCreatePointStyle);
26780
- gantt.parsedOptions.dependencyLinkLineCreatingPointStyle = Object.assign({
26781
- strokeColor: 'red',
26782
- fillColor: 'red',
26783
- radius: 5,
26784
- strokeWidth: 1
26785
- }, options?.dependency?.linkCreatingPointStyle);
26786
- gantt.parsedOptions.dependencyLinkLineCreatingStyle = Object.assign({
26787
- lineColor: 'red',
26788
- lineWidth: 1,
26789
- lineDash: [5, 5]
26790
- }, options?.dependency?.linkCreatingLineStyle);
26791
- gantt.parsedOptions.eventOptions = options?.eventOptions;
26792
- gantt.parsedOptions.keyboardOptions = options?.keyboardOptions;
26793
- gantt.parsedOptions.markLineCreateOptions = options?.markLineCreateOptions;
26794
- }
26795
- function updateOptionsWhenScaleChanged(gantt) {
26796
- const options = gantt.options;
26797
- const { unit: minTimeUnit, startOfWeek, step } = gantt.parsedOptions.reverseSortedTimelineScales[0];
26798
- gantt.parsedOptions.minDate = getStartDateByTimeUnit(new Date(gantt.parsedOptions.minDate), minTimeUnit, startOfWeek);
26799
- gantt.parsedOptions.maxDate = getEndDateByTimeUnit(gantt.parsedOptions.minDate, new Date(gantt.parsedOptions.maxDate), minTimeUnit, step);
26800
- gantt.parsedOptions._minDateTime = gantt.parsedOptions.minDate?.getTime();
26801
- gantt.parsedOptions._maxDateTime = gantt.parsedOptions.maxDate?.getTime();
26802
- gantt.parsedOptions.timeLineHeaderRowHeights = [];
26803
- gantt.parsedOptions.timelineHeaderStyles = [];
26804
- for (let i = 0; i < gantt.parsedOptions.sortedTimelineScales.length ?? 0; i++) {
26805
- const style = gantt.parsedOptions.sortedTimelineScales[i].style;
26806
- gantt.parsedOptions.timelineHeaderStyles.push(Object.assign({
26807
- fontSize: 20,
26808
- fontWeight: 'bold',
26809
- textAlign: 'center',
26810
- textBaseline: 'middle',
26811
- color: '#000',
26812
- backgroundColor: '#fff'
26813
- }, style));
26814
- gantt.parsedOptions.timeLineHeaderRowHeights.push(gantt.parsedOptions.sortedTimelineScales[i].rowHeight ?? options?.headerRowHeight ?? 40);
26815
- }
26816
- }
26817
- function generateTimeLineDate(currentDate, endDate, scale) {
26818
- const { unit, step, format } = scale;
26819
- const timelineDates = [];
26820
- while (currentDate < endDate) {
26821
- if (unit === 'day') {
26822
- const year = currentDate.getFullYear();
26823
- const month = currentDate.getMonth();
26824
- const day = currentDate.getDate();
26825
- const end = createDateAtLastHour(new Date(year, month, day + step - 1), true);
26826
- if (end.getTime() > endDate.getTime()) {
26827
- end.setTime(endDate.getTime());
26828
- }
26829
- const start = currentDate;
26830
- const formattedDate = format?.({ dateIndex: day, startDate: start, endDate: end });
26831
- const columnTitle = formattedDate || day.toString();
26832
- const dayCellConfig = {
26833
- days: Math.abs(end.getTime() - currentDate.getTime() + 1) / DayTimes,
26834
- startDate: start,
26835
- endDate: end,
26836
- step,
26837
- unit: 'day',
26838
- title: columnTitle,
26839
- dateIndex: day
26840
- };
26841
- timelineDates.push(dayCellConfig);
26842
- currentDate = new Date(year, month, day + step);
26843
- }
26844
- else if (unit === 'month') {
26845
- const year = currentDate.getFullYear();
26846
- const month = currentDate.getMonth();
26847
- const end = createDateAtLastHour(new Date(year, month + step, 0), true);
26848
- if (end.getTime() > endDate.getTime()) {
26849
- end.setTime(endDate.getTime());
26850
- }
26851
- const start = currentDate;
26852
- const formattedDate = format?.({ dateIndex: month + 1, startDate: start, endDate: end });
26853
- const columnTitle = formattedDate || (month + 1).toString();
26854
- const dayCellConfig = {
26855
- days: Math.abs(end.getTime() - currentDate.getTime() + 1) / DayTimes,
26856
- startDate: start,
26857
- step,
26858
- unit: 'month',
26859
- endDate: end,
26860
- title: columnTitle,
26861
- dateIndex: month + 1
26862
- };
26863
- timelineDates.push(dayCellConfig);
26864
- currentDate = new Date(year, month + step, 1);
26865
- }
26866
- else if (unit === 'quarter') {
26867
- const year = currentDate.getFullYear();
26868
- const quarter = Math.floor(currentDate.getMonth() / 3);
26869
- const end = createDateAtLastHour(new Date(year, (quarter + step) * 3, 0), true);
26870
- if (end.getTime() > endDate.getTime()) {
26871
- end.setTime(endDate.getTime());
26872
- }
26873
- const start = currentDate;
26874
- const formattedDate = format?.({ dateIndex: quarter + 1, startDate: start, endDate: end });
26875
- const columnTitle = formattedDate || (quarter + 1).toString();
26876
- const dayCellConfig = {
26877
- days: Math.abs(end.getTime() - currentDate.getTime() + 1) / (1000 * 60 * 60 * 24),
26878
- startDate: start,
26879
- step,
26880
- unit: 'quarter',
26881
- endDate: end,
26882
- title: columnTitle,
26883
- dateIndex: quarter + 1
26884
- };
26885
- timelineDates.push(dayCellConfig);
26886
- currentDate = new Date(year, (quarter + step) * 3, 1);
26887
- }
26888
- else if (unit === 'year') {
26889
- const year = currentDate.getFullYear();
26890
- const end = createDateAtLastHour(new Date(year + step - 1, 11, 31), true);
26891
- if (end.getTime() > endDate.getTime()) {
26892
- end.setTime(endDate.getTime());
26893
- }
26894
- const start = currentDate;
26895
- const formattedDate = format?.({ dateIndex: year, startDate: start, endDate: end });
26896
- const columnTitle = formattedDate || year.toString();
26897
- const dayCellConfig = {
26898
- days: Math.abs(end.getTime() - currentDate.getTime() + 1) / DayTimes,
26899
- startDate: start,
26900
- endDate: end,
26901
- step,
26902
- unit: 'year',
26903
- title: columnTitle,
26904
- dateIndex: year
26905
- };
26906
- timelineDates.push(dayCellConfig);
26907
- currentDate = new Date(year + step, 0, 1);
26908
- }
26909
- else if (unit === 'week') {
26910
- const startOfWeekSetting = scale.startOfWeek ?? 'monday';
26911
- let dayOfWeek = currentDate.getDay();
26912
- if (startOfWeekSetting === 'monday') {
26913
- dayOfWeek = dayOfWeek === 0 ? 6 : dayOfWeek - 1;
26914
- }
26915
- const startOfWeek = createDateAtMidnight(currentDate);
26916
- const dateEnd = createDateAtLastHour(currentDate.getTime() + (7 * step - dayOfWeek) * 24 * 60 * 60 * 1000 - 1, true);
26917
- if (dateEnd > endDate) {
26918
- dateEnd.setTime(endDate.getTime());
26919
- }
26920
- const weekNumber = getWeekNumber(startOfWeek);
26921
- const columnTitle = format?.({ dateIndex: weekNumber, startDate: startOfWeek, endDate: dateEnd }) || weekNumber.toString();
26922
- const dayCellConfig = {
26923
- days: (dateEnd.getTime() - startOfWeek.getTime() + 1) / DayTimes,
26924
- startDate: startOfWeek,
26925
- endDate: dateEnd,
26926
- step,
26927
- unit: 'week',
26928
- title: columnTitle,
26929
- dateIndex: weekNumber
26930
- };
26931
- timelineDates.push(dayCellConfig);
26932
- currentDate.setTime(createDateAtMidnight(currentDate.getTime() + (7 * step - dayOfWeek) * 24 * 60 * 60 * 1000, true).getTime());
26933
- }
26934
- else if (unit === 'hour') {
26935
- const year = currentDate.getFullYear();
26936
- const month = currentDate.getMonth();
26937
- const day = currentDate.getDate();
26938
- const hour = currentDate.getHours();
26939
- const end = createDateAtLastMinute(new Date(year, month, day, hour + step - 1), true);
26940
- if (end.getTime() > endDate.getTime()) {
26941
- end.setTime(endDate.getTime());
26942
- }
26943
- const start = currentDate;
26944
- const formattedDate = format?.({ dateIndex: hour, startDate: start, endDate: end });
26945
- const columnTitle = formattedDate || hour.toString();
26946
- const dayCellConfig = {
26947
- days: Math.abs(end.getTime() - currentDate.getTime() + 1) / DayTimes,
26948
- startDate: start,
26949
- endDate: end,
26950
- step,
26951
- unit: 'hour',
26952
- title: columnTitle,
26953
- dateIndex: currentDate.getHours()
26954
- };
26955
- timelineDates.push(dayCellConfig);
26956
- currentDate = new Date(year, month, day, hour + step);
26957
- }
26958
- else if (unit === 'minute') {
26959
- const year = currentDate.getFullYear();
26960
- const month = currentDate.getMonth();
26961
- const day = currentDate.getDate();
26962
- const hour = currentDate.getHours();
26963
- const minute = currentDate.getMinutes();
26964
- const end = createDateAtLastSecond(new Date(year, month, day, hour, minute + step - 1), true);
26965
- if (end.getTime() > endDate.getTime()) {
26966
- end.setTime(endDate.getTime());
26967
- }
26968
- const start = currentDate;
26969
- const formattedDate = format?.({ dateIndex: minute, startDate: start, endDate: end });
26970
- const columnTitle = formattedDate || minute.toString();
26971
- const dayCellConfig = {
26972
- days: Math.abs(end.getTime() - currentDate.getTime() + 1) / DayTimes,
26973
- startDate: start,
26974
- endDate: end,
26975
- step,
26976
- unit: 'minute',
26977
- title: columnTitle,
26978
- dateIndex: currentDate.getMinutes()
26979
- };
26980
- timelineDates.push(dayCellConfig);
26981
- currentDate = new Date(year, month, day, hour, minute + step);
26982
- }
26983
- else if (unit === 'second') {
26984
- const year = currentDate.getFullYear();
26985
- const month = currentDate.getMonth();
26986
- const day = currentDate.getDate();
26987
- const hour = currentDate.getHours();
26988
- const minute = currentDate.getMinutes();
26989
- const second = currentDate.getSeconds();
26990
- const end = createDateAtLastMillisecond(new Date(year, month, day, hour, minute, second + step - 1), true);
26991
- if (end.getTime() > endDate.getTime()) {
26992
- end.setTime(endDate.getTime());
26993
- }
26994
- const start = currentDate;
26995
- const formattedDate = format?.({ dateIndex: second, startDate: start, endDate: end });
26996
- const columnTitle = formattedDate || second.toString();
26997
- const dayCellConfig = {
26998
- days: Math.abs(end.getTime() - currentDate.getTime() + 1) / DayTimes,
26999
- startDate: start,
27000
- endDate: end,
27001
- step,
27002
- unit: 'second',
27003
- title: columnTitle,
27004
- dateIndex: currentDate.getSeconds()
27005
- };
27006
- timelineDates.push(dayCellConfig);
27007
- currentDate = new Date(year, month, day, hour, minute, second + step);
27008
- }
27009
- }
27010
- return timelineDates;
27011
- }
27012
- function getTextPos(padding, textAlign, textBaseline, width, height) {
27013
- let textX = padding[3] ?? 10;
27014
- if (textAlign === 'right' || textAlign === 'end') {
27015
- textX = width - 0 - (padding[1] ?? 10);
27016
- }
27017
- else if (textAlign === 'center') {
27018
- textX = 0 + (width - 0 + (padding[3] ?? 10) - (padding[1] ?? 10)) / 2;
27019
- }
27020
- let textY = 0 + (padding[0] ?? 10);
27021
- if (textBaseline === 'bottom' || textBaseline === 'alphabetic' || textBaseline === 'ideographic') {
27022
- textY = height - 0 - (padding[2] ?? 10);
27023
- }
27024
- else if (textBaseline === 'middle') {
27025
- textY = 0 + (height - 0 - (padding[0] ?? 10) - (padding[2] ?? 10)) / 2 + (padding[0] ?? 10);
27026
- }
27027
- return {
27028
- x: textX,
27029
- y: textY
27030
- };
27031
- }
27032
- function convertProgress(progress) {
27033
- if (typeof progress === 'string') {
27034
- progress = progress.replace('%', '');
27035
- progress = parseFloat(progress);
27036
- }
27037
- return Math.round(progress);
27038
- }
27039
- function createSplitLineAndResizeLine(gantt) {
27040
- if (gantt.taskListTableInstance) {
27041
- gantt.verticalSplitResizeLine = document.createElement('div');
27042
- gantt.verticalSplitResizeLine.style.position = 'absolute';
27043
- gantt.verticalSplitResizeLine.style.top = gantt.tableY + 'px';
27044
- gantt.verticalSplitResizeLine.style.left =
27045
- (gantt.taskTableWidth ? gantt.taskTableWidth - 7 + gantt.parsedOptions.verticalSplitLine.lineWidth / 2 : 0) +
27046
- 'px';
27047
- gantt.verticalSplitResizeLine.style.width = '14px';
27048
- gantt.verticalSplitResizeLine.style.height = gantt.drawHeight + 'px';
27049
- gantt.verticalSplitResizeLine.style.backgroundColor = 'rgba(0,0,0,0)';
27050
- gantt.verticalSplitResizeLine.style.zIndex = '100';
27051
- gantt.parsedOptions.verticalSplitLineMoveable && (gantt.verticalSplitResizeLine.style.cursor = 'col-resize');
27052
- gantt.verticalSplitResizeLine.style.userSelect = 'none';
27053
- gantt.verticalSplitResizeLine.style.opacity = '1';
27054
- const verticalSplitLine = document.createElement('div');
27055
- verticalSplitLine.style.position = 'absolute';
27056
- verticalSplitLine.style.top = '0px';
27057
- verticalSplitLine.style.left = `${(14 - gantt.parsedOptions.verticalSplitLine.lineWidth) / 2}px`;
27058
- verticalSplitLine.style.width = gantt.parsedOptions.verticalSplitLine.lineWidth + 'px';
27059
- verticalSplitLine.style.height = '100%';
27060
- verticalSplitLine.style.backgroundColor = gantt.parsedOptions.verticalSplitLine.lineColor;
27061
- verticalSplitLine.style.zIndex = '100';
27062
- verticalSplitLine.style.userSelect = 'none';
27063
- verticalSplitLine.style.pointerEvents = 'none';
27064
- verticalSplitLine.style.transition = 'background-color 0.3s';
27065
- gantt.verticalSplitResizeLine.appendChild(verticalSplitLine);
27066
- if (gantt.parsedOptions.verticalSplitLineHighlight) {
27067
- const highlightLine = document.createElement('div');
27068
- highlightLine.style.position = 'absolute';
27069
- highlightLine.style.top = '0px';
27070
- highlightLine.style.left = `${(14 - gantt.parsedOptions.verticalSplitLineHighlight.lineWidth ?? 2) / 2}px`;
27071
- highlightLine.style.width = (gantt.parsedOptions.verticalSplitLineHighlight.lineWidth ?? 2) + 'px';
27072
- highlightLine.style.height = '100%';
27073
- highlightLine.style.backgroundColor = gantt.parsedOptions.verticalSplitLineHighlight.lineColor;
27074
- highlightLine.style.zIndex = '100';
27075
- highlightLine.style.cursor = 'col-resize';
27076
- highlightLine.style.userSelect = 'none';
27077
- highlightLine.style.pointerEvents = 'none';
27078
- highlightLine.style.opacity = '0';
27079
- highlightLine.style.transition = 'background-color 0.3s';
27080
- gantt.verticalSplitResizeLine.appendChild(highlightLine);
27081
- }
27082
- gantt.container.appendChild(gantt.verticalSplitResizeLine);
27083
- }
27084
- }
27085
- function updateSplitLineAndResizeLine(gantt) {
27086
- if (gantt.verticalSplitResizeLine) {
27087
- gantt.verticalSplitResizeLine.style.position = 'absolute';
27088
- gantt.verticalSplitResizeLine.style.top = gantt.tableY + 'px';
27089
- gantt.verticalSplitResizeLine.style.left = gantt.taskTableWidth
27090
- ? `${gantt.taskTableWidth - 7 + gantt.parsedOptions.verticalSplitLine.lineWidth / 2}px`
27091
- : '0px';
27092
- gantt.verticalSplitResizeLine.style.width = '14px';
27093
- gantt.verticalSplitResizeLine.style.height = gantt.drawHeight + 'px';
27094
- gantt.verticalSplitResizeLine.style.backgroundColor = 'rgba(0,0,0,0)';
27095
- gantt.verticalSplitResizeLine.style.zIndex = '100';
27096
- gantt.parsedOptions.verticalSplitLineMoveable && (gantt.verticalSplitResizeLine.style.cursor = 'col-resize');
27097
- gantt.verticalSplitResizeLine.style.userSelect = 'none';
27098
- gantt.verticalSplitResizeLine.style.opacity = '1';
27099
- const verticalSplitLine = gantt.verticalSplitResizeLine.childNodes[0];
27100
- verticalSplitLine.style.position = 'absolute';
27101
- verticalSplitLine.style.top = '0px';
27102
- verticalSplitLine.style.left = `${(14 - gantt.parsedOptions.verticalSplitLine.lineWidth) / 2}px`;
27103
- verticalSplitLine.style.width = gantt.parsedOptions.verticalSplitLine.lineWidth + 'px';
27104
- verticalSplitLine.style.height = '100%';
27105
- verticalSplitLine.style.backgroundColor = gantt.parsedOptions.verticalSplitLine.lineColor;
27106
- verticalSplitLine.style.zIndex = '100';
27107
- verticalSplitLine.style.userSelect = 'none';
27108
- verticalSplitLine.style.pointerEvents = 'none';
27109
- verticalSplitLine.style.transition = 'background-color 0.3s';
27110
- if (gantt.verticalSplitResizeLine.childNodes[1]) {
27111
- const highlightLine = gantt.verticalSplitResizeLine.childNodes[1];
27112
- highlightLine.style.position = 'absolute';
27113
- highlightLine.style.top = '0px';
27114
- highlightLine.style.left = `${(14 - gantt.parsedOptions.verticalSplitLineHighlight.lineWidth ?? 2) / 2}px`;
27115
- highlightLine.style.width = (gantt.parsedOptions.verticalSplitLineHighlight.lineWidth ?? 2) + 'px';
27116
- highlightLine.style.height = '100%';
27117
- highlightLine.style.backgroundColor = gantt.parsedOptions.verticalSplitLineHighlight.lineColor;
27118
- highlightLine.style.zIndex = '100';
27119
- highlightLine.style.cursor = 'col-resize';
27120
- highlightLine.style.userSelect = 'none';
27121
- highlightLine.style.pointerEvents = 'none';
27122
- highlightLine.style.opacity = '0';
27123
- highlightLine.style.transition = 'background-color 0.3s';
27124
- }
27125
- }
27126
- }
27127
- function findRecordByTaskKey(records, taskKeyField, taskKey, childrenField = 'children') {
27128
- for (let i = 0; i < records.length; i++) {
27129
- if ((Array.isArray(taskKey) && taskKey.length === 1 && records[i][taskKeyField] === taskKey[0]) ||
27130
- records[i][taskKeyField] === taskKey) {
27131
- return { record: records[i], index: [i] };
27132
- }
27133
- else if (records[i][childrenField]?.length) {
27134
- if (Array.isArray(taskKey) && taskKey[0] === records[i][taskKeyField]) {
27135
- const result = findRecordByTaskKey(records[i][childrenField], taskKeyField, taskKey.slice(1));
27136
- if (result) {
27137
- result.index.unshift(i);
27138
- return result;
27139
- }
27140
- }
27141
- else if (!Array.isArray(taskKey)) {
27142
- const result = findRecordByTaskKey(records[i][childrenField], taskKeyField, taskKey);
27143
- if (result) {
27144
- result.index.unshift(i);
27145
- return result;
27146
- }
27147
- }
27148
- }
27149
- }
27150
- }
27151
- function clearRecordLinkInfos(records, childrenField = 'children') {
27152
- for (let i = 0; i < records.length; i++) {
27153
- if (records[i][childrenField]?.length) {
27154
- clearRecordLinkInfos(records[i][childrenField], childrenField);
27155
- }
27156
- else {
27157
- delete records[i].vtable_gantt_linkedTo;
27158
- delete records[i].vtable_gantt_linkedFrom;
27159
- }
27160
- }
27161
- }
27162
- function clearRecordShowIndex(records, childrenField = 'children') {
27163
- for (let i = 0; i < records.length; i++) {
27164
- if (records[i][childrenField]?.length) {
27165
- clearRecordShowIndex(records[i][childrenField], childrenField);
27166
- }
27167
- else {
27168
- delete records[i].vtable_gantt_showIndex;
27169
- }
27170
- }
27171
- }
27172
- function getTaskIndexsByTaskY(y, gantt) {
27173
- let task_index;
27174
- let sub_task_index;
27175
- if (gantt.taskListTableInstance) {
27176
- const rowInfo = gantt.taskListTableInstance.getTargetRowAt(y + gantt.headerHeight);
27177
- if (rowInfo) {
27178
- const { row } = rowInfo;
27179
- task_index = row - gantt.taskListTableInstance.columnHeaderLevelCount;
27180
- const beforeRowsHeight = gantt.getRowsHeightByIndex(0, task_index - 1);
27181
- if (gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Inline ||
27182
- gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Arrange ||
27183
- gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Compact ||
27184
- gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Separate) {
27185
- sub_task_index = Math.floor((y - beforeRowsHeight) / gantt.parsedOptions.rowHeight);
27186
- }
27187
- }
27188
- }
27189
- else {
27190
- task_index = Math.floor(y / gantt.parsedOptions.rowHeight);
27191
- }
27192
- return { task_index, sub_task_index };
27193
- }
27194
- function computeRowsCountByRecordDateForCompact(gantt, record) {
27195
- if (!record.children || record.children.length === 1) {
27196
- if (record.children?.length === 1) {
27197
- record.children[0].vtable_gantt_showIndex = 0;
27198
- }
27199
- else {
27200
- record.vtable_gantt_showIndex = 0;
27201
- }
27202
- return 1;
27203
- }
27204
- const sortedChildren = record.children.slice().sort((a, b) => {
27205
- const { startDate: aStartDate } = formatRecordDateConsiderHasHour(gantt, a);
27206
- const { startDate: bStartDate } = formatRecordDateConsiderHasHour(gantt, b);
27207
- return aStartDate.getTime() - bStartDate.getTime();
27208
- });
27209
- const rows = [];
27210
- for (let i = 0; i <= sortedChildren.length - 1; i++) {
27211
- const newRecord = sortedChildren[i];
27212
- const { startDate, endDate } = formatRecordDateConsiderHasHour(gantt, newRecord);
27213
- let placed = false;
27214
- for (let j = 0; j < rows.length; j++) {
27215
- if (startDate.getTime() > rows[j]) {
27216
- rows[j] = endDate.getTime();
27217
- placed = true;
27218
- newRecord.vtable_gantt_showIndex = j;
27219
- break;
27220
- }
27221
- }
27222
- if (!placed) {
27223
- rows.push(endDate.getTime());
27224
- newRecord.vtable_gantt_showIndex = rows.length - 1;
27225
- }
27226
- }
27227
- return rows.length;
27228
- }
27229
- function isOverlapping(startDate, endDate, rowTasks, gantt) {
27230
- return rowTasks.some(rowTask => {
27231
- const { startDate: startDate2, endDate: endDate2 } = formatRecordDateConsiderHasHour(gantt, rowTask);
27232
- return startDate <= endDate2 && startDate2 <= endDate;
27233
- });
27234
- }
27235
- function computeRowsCountByRecordDate(gantt, record) {
27236
- if (!record.children || record.children.length === 1) {
27237
- if (record.children?.length === 1) {
27238
- record.children[0].vtable_gantt_showIndex = 0;
27239
- }
27240
- else {
27241
- record.vtable_gantt_showIndex = 0;
27242
- }
27243
- return 1;
27244
- }
27245
- const rows = [];
27246
- for (let i = 0; i <= record.children.length - 1; i++) {
27247
- const newRecord = record.children[i];
27248
- const { startDate, endDate } = formatRecordDateConsiderHasHour(gantt, newRecord);
27249
- let placed = false;
27250
- for (let j = 0; j < rows.length; j++) {
27251
- const rowTasks = record.children.filter((t) => t !== newRecord && t.vtable_gantt_showIndex === j);
27252
- if (!isOverlapping(startDate, endDate, rowTasks, gantt)) {
27253
- rows[j] = endDate.getTime();
27254
- placed = true;
27255
- newRecord.vtable_gantt_showIndex = j;
27256
- break;
27257
- }
27258
- }
27259
- if (!placed) {
27260
- rows.push(endDate.getTime());
27261
- newRecord.vtable_gantt_showIndex = rows.length - 1;
27262
- }
27263
- }
27264
- return rows.length;
27265
- }
27266
- function formatRecordDateConsiderHasHour(gantt, record) {
27267
- const { timeScaleIncludeHour, startDateField, endDateField } = gantt.parsedOptions;
27268
- const startDate = record[startDateField];
27269
- const endDate = record[endDateField];
27270
- if (timeScaleIncludeHour) {
27271
- return { startDate: createDateAtMidnight(startDate), endDate: createDateAtLastHour(endDate) };
27272
- }
27273
- return { startDate: createDateAtMidnight(startDate, true), endDate: createDateAtLastHour(endDate, true) };
27274
- }
27275
- function updateOptionsWhenRecordChanged(gantt) {
27276
- const options = gantt.options;
27277
- const { unit: minTimeUnit, startOfWeek } = gantt.parsedOptions.reverseSortedTimelineScales[0];
27278
- gantt.parsedOptions.markLine = generateMarkLine(options?.markLine);
27279
- if (gantt.parsedOptions.markLine?.length ?? 0) {
27280
- if (gantt.parsedOptions.markLine?.every(item => item.scrollToMarkLine === undefined)) {
27281
- gantt.parsedOptions.markLine[0].scrollToMarkLine = true;
27282
- }
27283
- if (gantt.parsedOptions.markLine?.find(item => item.scrollToMarkLine)) {
27284
- gantt.parsedOptions.scrollToMarkLineDate = getStartDateByTimeUnit(new Date(gantt.parsedOptions.markLine?.find(item => item.scrollToMarkLine).date), minTimeUnit, startOfWeek);
27285
- }
27286
- }
27287
- gantt.parsedOptions.dependencyLinks = options.dependency?.links;
27288
- }
27289
- function updateOptionsWhenDateRangeChanged(gantt) {
27290
- const options = gantt.options;
27291
- const { unit: minTimeUnit, startOfWeek, step } = gantt.parsedOptions.reverseSortedTimelineScales[0];
27292
- gantt.parsedOptions.minDate = options?.minDate
27293
- ? getStartDateByTimeUnit(new Date(options.minDate), minTimeUnit, startOfWeek)
27294
- : undefined;
27295
- gantt.parsedOptions.maxDate = options?.maxDate
27296
- ? getEndDateByTimeUnit(gantt.parsedOptions.minDate, new Date(options.maxDate), minTimeUnit, step)
27297
- : undefined;
27298
- gantt.parsedOptions._minDateTime = gantt.parsedOptions.minDate?.getTime();
27299
- gantt.parsedOptions._maxDateTime = gantt.parsedOptions.maxDate?.getTime();
27300
- }
27301
- function updateOptionsWhenMarkLineChanged(gantt) {
27302
- const options = gantt.options;
27303
- gantt.parsedOptions.markLine = generateMarkLine(options?.markLine);
27304
- }
27305
- function _getTaskInfoByXYForCreateSchedule(eventX, eventY, gantt) {
27306
- const taskIndex = getTaskIndexsByTaskY(eventY - gantt.headerHeight + gantt.stateManager.scrollTop, gantt);
27307
- const recordParent = gantt.getRecordByIndex(taskIndex.task_index);
27308
- const dateIndex = getDateIndexByX(eventX, gantt);
27309
- const dateRange = gantt.getDateRangeByIndex(dateIndex);
27310
- if (recordParent?.children) {
27311
- const taskIndex = getTaskIndexsByTaskY(eventY - gantt.headerHeight + gantt.stateManager.scrollTop, gantt);
27312
- for (let i = 0; i < recordParent.children.length; i++) {
27313
- const { startDate, endDate, taskDays, progress, taskRecord } = gantt.getTaskInfoByTaskListIndex(taskIndex.task_index, i);
27314
- if (((gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Compact ||
27315
- gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Arrange) &&
27316
- taskRecord.vtable_gantt_showIndex === taskIndex.sub_task_index) ||
27317
- gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Inline) {
27318
- if (dateRange.startDate.getTime() >= startDate.getTime() && dateRange.endDate.getTime() <= endDate.getTime()) {
27319
- return { startDate, endDate, taskDays, progress, taskRecord };
27320
- }
27321
- }
27322
- }
27323
- }
27324
- }
27325
- function getNodeClickPos(marklineIconNode, gantt) {
27326
- const left = marklineIconNode.globalTransMatrix.e +
27327
- gantt.taskListTableInstance.tableNoFrameWidth +
27328
- gantt.taskListTableInstance.tableX +
27329
- gantt.tableX;
27330
- const top = marklineIconNode.globalTransMatrix.f;
27331
- const width = marklineIconNode.attribute.width;
27332
- const height = marklineIconNode.attribute.height;
27333
- return {
27334
- left,
27335
- top,
27336
- width,
27337
- height
27338
- };
27339
- }
27340
- function judgeIfHasMarkLine(data, markLine) {
27341
- const beginTime = data.startDate.getTime();
27342
- const endTime = data.endDate.getTime();
27343
- return markLine.some(item => {
27344
- const marklineTime = new Date(item.date).getTime();
27345
- return marklineTime >= beginTime && marklineTime <= endTime;
27346
- });
27347
- }
27348
-
27349
26544
  function throttle$1(func, delay) {
27350
26545
  let timer = null;
27351
26546
  return function (...args) {
@@ -27825,11 +27020,9 @@
27825
27020
  case 'quarter':
27826
27021
  difference =
27827
27022
  (adjusted_date.getFullYear() - startDate.getFullYear()) * 4 +
27828
- Math.floor(adjusted_date.getMonth() / 3) -
27829
- Math.floor(startDate.getMonth() / 3);
27023
+ (adjusted_date.getMonth() - startDate.getMonth()) / 3;
27830
27024
  difference +=
27831
- (adjusted_date.getTime() - startDate.getTime()) /
27832
- DayTimes /
27025
+ (adjusted_date.getDate() - startDate.getDate()) /
27833
27026
  (3 * new Date(adjusted_date.getFullYear(), adjusted_date.getMonth() + 1, 0).getDate());
27834
27027
  break;
27835
27028
  case 'year':
@@ -27999,592 +27192,1397 @@
27999
27192
  }
28000
27193
  }
28001
27194
  else {
28002
- const horizontalLine_style = gridStyle.horizontalLine;
28003
- let y = 0;
28004
- if (horizontalLine_style.lineWidth & 1) {
28005
- y += 0.5;
28006
- }
28007
- for (let i = 0; i < this.rowCount - 1; i++) {
28008
- y = y + this._scene._gantt.getRowHeightByIndex(i);
28009
- const line = createLine({
28010
- pickable: false,
28011
- stroke: horizontalLine_style.lineColor,
28012
- lineWidth: horizontalLine_style.lineWidth,
28013
- points: [
28014
- { x: 0, y },
28015
- { x: this.allGridWidth, y }
28016
- ]
28017
- });
28018
- this.horizontalLineGroup.appendChild(line);
28019
- }
27195
+ const horizontalLine_style = gridStyle.horizontalLine;
27196
+ let y = 0;
27197
+ if (horizontalLine_style.lineWidth & 1) {
27198
+ y += 0.5;
27199
+ }
27200
+ for (let i = 0; i < this.rowCount - 1; i++) {
27201
+ y = y + this._scene._gantt.getRowHeightByIndex(i);
27202
+ const line = createLine({
27203
+ pickable: false,
27204
+ stroke: horizontalLine_style.lineColor,
27205
+ lineWidth: horizontalLine_style.lineWidth,
27206
+ points: [
27207
+ { x: 0, y },
27208
+ { x: this.allGridWidth, y }
27209
+ ]
27210
+ });
27211
+ this.horizontalLineGroup.appendChild(line);
27212
+ }
27213
+ }
27214
+ }
27215
+ }
27216
+ createVerticalBackgroundRects() {
27217
+ const verticalBackgroundColor = this._scene._gantt.parsedOptions.grid.verticalBackgroundColor;
27218
+ const weekendBackgroundColor = this._scene._gantt.parsedOptions.grid.weekendBackgroundColor;
27219
+ if (verticalBackgroundColor || weekendBackgroundColor) {
27220
+ this.verticalBackgroundRectsGroup = new Group$2({
27221
+ x: 0,
27222
+ y: 0,
27223
+ width: this.allGridWidth,
27224
+ height: this.allGridHeight
27225
+ });
27226
+ this.verticalBackgroundRectsGroup.name = 'grid-vertical-background';
27227
+ this.group.appendChild(this.verticalBackgroundRectsGroup);
27228
+ const { timelineDates, unit, step } = this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];
27229
+ const timelineColWidth = this._scene._gantt.parsedOptions.timelineColWidth;
27230
+ if (verticalBackgroundColor || weekendBackgroundColor) {
27231
+ for (let i = 0; i <= timelineDates?.length - 1; i++) {
27232
+ let backgroundColor;
27233
+ if (weekendBackgroundColor &&
27234
+ unit === 'day' &&
27235
+ step === 1 &&
27236
+ (timelineDates[i].startDate.getDay() === 0 || timelineDates[i].startDate.getDay() === 6)) {
27237
+ backgroundColor = weekendBackgroundColor;
27238
+ }
27239
+ else if (typeof verticalBackgroundColor === 'function') {
27240
+ backgroundColor = verticalBackgroundColor({
27241
+ index: i,
27242
+ dateIndex: timelineDates[i].dateIndex,
27243
+ date: timelineDates[i].endDate,
27244
+ ganttInstance: this._scene._gantt
27245
+ });
27246
+ }
27247
+ else if (verticalBackgroundColor) {
27248
+ backgroundColor = verticalBackgroundColor[i % verticalBackgroundColor.length];
27249
+ }
27250
+ if (backgroundColor) {
27251
+ const x = Math.ceil(timelineColWidth * i);
27252
+ const rect = createRect({
27253
+ pickable: false,
27254
+ fill: backgroundColor,
27255
+ x,
27256
+ y: 0,
27257
+ width: timelineColWidth,
27258
+ height: this.allGridHeight
27259
+ });
27260
+ this.verticalBackgroundRectsGroup.appendChild(rect);
27261
+ }
27262
+ }
27263
+ }
27264
+ }
27265
+ }
27266
+ createHorizontalBackgroundRects() {
27267
+ const horizontalBackgroundColor = this._scene._gantt.parsedOptions.grid.horizontalBackgroundColor;
27268
+ if (horizontalBackgroundColor) {
27269
+ this.horizontalBackgroundRectsGroup = new Group$2({
27270
+ x: 0,
27271
+ y: 0,
27272
+ width: this.allGridWidth,
27273
+ height: this.allGridHeight
27274
+ });
27275
+ this.horizontalBackgroundRectsGroup.name = 'grid-horizontal-background';
27276
+ this.group.appendChild(this.horizontalBackgroundRectsGroup);
27277
+ let y = 0;
27278
+ for (let i = 0; i <= this.rowCount - 1; i++) {
27279
+ let backgroundColor;
27280
+ if (typeof horizontalBackgroundColor === 'function') {
27281
+ backgroundColor = horizontalBackgroundColor({
27282
+ index: i,
27283
+ ganttInstance: this._scene._gantt
27284
+ });
27285
+ }
27286
+ else {
27287
+ backgroundColor = horizontalBackgroundColor[i % horizontalBackgroundColor.length];
27288
+ }
27289
+ const rect = createRect({
27290
+ pickable: false,
27291
+ fill: backgroundColor,
27292
+ x: 0,
27293
+ y,
27294
+ width: this.allGridWidth,
27295
+ height: this._scene._gantt.getRowHeightByIndex(i)
27296
+ });
27297
+ this.horizontalBackgroundRectsGroup.appendChild(rect);
27298
+ y += this._scene._gantt.getRowHeightByIndex(i);
27299
+ }
27300
+ }
27301
+ }
27302
+ refresh() {
27303
+ this.width = this._scene.ganttGroup.attribute.width;
27304
+ this.height = this._scene.ganttGroup.attribute.height - this._scene.timelineHeader.group.attribute.height;
27305
+ this.group.setAttributes({
27306
+ width: this.width,
27307
+ height: this.height,
27308
+ y: this._scene._gantt.getAllHeaderRowsHeight()
27309
+ });
27310
+ this.rowCount = this._scene._gantt.itemCount;
27311
+ this.allGridWidth = this._scene._gantt.getAllDateColsWidth();
27312
+ this.allGridHeight = this._scene._gantt.getAllTaskBarsHeight();
27313
+ this.group.removeAllChild();
27314
+ this.createVerticalBackgroundRects();
27315
+ this.createHorizontalBackgroundRects();
27316
+ this.createVerticalLines();
27317
+ this.createHorizontalLines();
27318
+ this.createTimeLineHeaderBottomLine();
27319
+ }
27320
+ setX(x) {
27321
+ this.verticalLineGroup?.setAttribute('x', x);
27322
+ this.horizontalLineGroup?.setAttribute('x', x);
27323
+ this.verticalBackgroundRectsGroup?.setAttribute('x', x);
27324
+ this.horizontalBackgroundRectsGroup?.setAttribute('x', x);
27325
+ }
27326
+ setY(y) {
27327
+ this.verticalLineGroup?.setAttribute('y', y);
27328
+ this.horizontalLineGroup?.setAttribute('y', y);
27329
+ this.verticalBackgroundRectsGroup?.setAttribute('y', y);
27330
+ this.horizontalBackgroundRectsGroup?.setAttribute('y', y);
27331
+ }
27332
+ resize() {
27333
+ this.width = this._scene.ganttGroup.attribute.width;
27334
+ this.height = this._scene.ganttGroup.attribute.height - this._scene.timelineHeader.group.attribute.height;
27335
+ this.group.setAttribute('width', this.width);
27336
+ this.group.setAttribute('height', this.height);
27337
+ }
27338
+ }
27339
+
27340
+ let Env$1 = class Env {
27341
+ static _mode;
27342
+ static get mode() {
27343
+ if (!Env._mode) {
27344
+ Env._mode = defaultMode$1();
27345
+ }
27346
+ return Env._mode;
27347
+ }
27348
+ static set mode(mode) {
27349
+ Env._mode = mode;
27350
+ }
27351
+ static dpr = 0;
27352
+ static CreateCanvas;
27353
+ static LoadImage;
27354
+ static RequestAnimationFrame;
27355
+ static CancelAnimationFrame;
27356
+ static RegisterCreateCanvas(func) {
27357
+ Env.CreateCanvas = func;
27358
+ }
27359
+ static RegisterLoadImage(func) {
27360
+ Env.LoadImage = func;
27361
+ }
27362
+ static GetCreateCanvasFunc() {
27363
+ if (Env.CreateCanvas) {
27364
+ return Env.CreateCanvas;
27365
+ }
27366
+ if (Env.mode === 'worker') {
27367
+ return (width = 200, height = 200) => new OffscreenCanvas(width, height);
27368
+ }
27369
+ return undefined;
27370
+ }
27371
+ static RegisterRequestAnimationFrame(func) {
27372
+ Env.RequestAnimationFrame = func();
27373
+ }
27374
+ static GetRequestAnimationFrame() {
27375
+ if (Env.RequestAnimationFrame) {
27376
+ return Env.RequestAnimationFrame;
27377
+ }
27378
+ return undefined;
27379
+ }
27380
+ static RegisterCancelAnimationFrame(func) {
27381
+ Env.CancelAnimationFrame = func();
27382
+ }
27383
+ static GetCancelAnimationFrame() {
27384
+ if (Env.CancelAnimationFrame) {
27385
+ return Env.CancelAnimationFrame;
27386
+ }
27387
+ return undefined;
27388
+ }
27389
+ };
27390
+ function defaultMode$1() {
27391
+ let mode = 'browser';
27392
+ try {
27393
+ if (window.type === 'node') {
27394
+ mode = 'node';
27395
+ }
27396
+ else if (typeof window !== 'undefined' && !window.performance) {
27397
+ mode = 'miniApp';
27398
+ }
27399
+ else if (typeof window === 'undefined') {
27400
+ mode = 'node';
27401
+ }
27402
+ }
27403
+ catch (err) {
27404
+ mode = 'node';
27405
+ }
27406
+ return mode;
27407
+ }
27408
+
27409
+ class ScrollBarComponent {
27410
+ hScrollBar;
27411
+ vScrollBar;
27412
+ _gantt;
27413
+ _clearHorizontalScrollBar;
27414
+ _clearVerticalScrollBar;
27415
+ constructor(gantt) {
27416
+ this._gantt = gantt;
27417
+ this.createScrollBar(gantt.tableNoFrameWidth, gantt.tableNoFrameHeight - gantt.getAllHeaderRowsHeight());
27418
+ }
27419
+ createScrollBar(tableWidth, tableHeight) {
27420
+ const scrollRailColor = this._gantt.parsedOptions.scrollStyle.scrollRailColor;
27421
+ const scrollSliderColor = this._gantt.parsedOptions.scrollStyle.scrollSliderColor;
27422
+ const scrollSliderCornerRadius = this._gantt.parsedOptions.scrollStyle.scrollSliderCornerRadius;
27423
+ const width = this._gantt.parsedOptions.scrollStyle.width;
27424
+ let sliderStyle;
27425
+ if (isValid$3(scrollSliderCornerRadius)) {
27426
+ sliderStyle = {
27427
+ cornerRadius: scrollSliderCornerRadius,
27428
+ fill: scrollSliderColor
27429
+ };
27430
+ }
27431
+ else {
27432
+ sliderStyle = {
27433
+ fill: scrollSliderColor
27434
+ };
27435
+ }
27436
+ this._gantt.parsedOptions.scrollStyle?.visible;
27437
+ this._gantt.parsedOptions.scrollStyle?.hoverOn;
27438
+ this.hScrollBar = new ScrollBar({
27439
+ direction: 'horizontal',
27440
+ x: -tableWidth * 2,
27441
+ y: -tableHeight * 2,
27442
+ width: tableWidth,
27443
+ height: width,
27444
+ padding: 0,
27445
+ railStyle: {
27446
+ fill: scrollRailColor
27447
+ },
27448
+ sliderStyle,
27449
+ range: [0, 0.1],
27450
+ visible: false
27451
+ });
27452
+ this.hScrollBar.render();
27453
+ this.hScrollBar.hideAll();
27454
+ this.vScrollBar = new ScrollBar({
27455
+ direction: 'vertical',
27456
+ x: -tableWidth * 2,
27457
+ y: -tableHeight * 2,
27458
+ width,
27459
+ height: tableHeight,
27460
+ padding: 0,
27461
+ railStyle: {
27462
+ fill: scrollRailColor
27463
+ },
27464
+ sliderStyle,
27465
+ range: [0, 0.1],
27466
+ visible: false
27467
+ });
27468
+ this.vScrollBar.render();
27469
+ this.vScrollBar.hideAll();
27470
+ }
27471
+ refresh() {
27472
+ }
27473
+ hideVerticalScrollBar() {
27474
+ const visable = this._gantt.parsedOptions.scrollStyle.visible;
27475
+ if (visable !== 'focus' && visable !== 'scrolling') {
27476
+ return;
27477
+ }
27478
+ this.vScrollBar.setAttribute('visible', false);
27479
+ this.vScrollBar.hideAll();
27480
+ this._gantt.scenegraph.updateNextFrame();
27481
+ }
27482
+ showVerticalScrollBar(autoHide) {
27483
+ const visable = this._gantt.parsedOptions.scrollStyle.visible;
27484
+ if (visable !== 'focus' && visable !== 'scrolling') {
27485
+ return;
27486
+ }
27487
+ this.vScrollBar.setAttribute('visible', true);
27488
+ this.vScrollBar.showAll();
27489
+ this._gantt.scenegraph.updateNextFrame();
27490
+ if (autoHide) {
27491
+ clearTimeout(this._clearVerticalScrollBar);
27492
+ this._clearVerticalScrollBar = setTimeout(() => {
27493
+ this.hideVerticalScrollBar();
27494
+ }, 1000);
27495
+ }
27496
+ }
27497
+ hideHorizontalScrollBar() {
27498
+ const visable = this._gantt.parsedOptions.scrollStyle.visible;
27499
+ if (visable !== 'focus' && visable !== 'scrolling') {
27500
+ return;
27501
+ }
27502
+ this.hScrollBar.setAttribute('visible', false);
27503
+ this.hScrollBar.hideAll();
27504
+ this._gantt.scenegraph.updateNextFrame();
27505
+ }
27506
+ showHorizontalScrollBar(autoHide) {
27507
+ const visable = this._gantt.parsedOptions.scrollStyle.visible;
27508
+ if (visable !== 'focus' && visable !== 'scrolling') {
27509
+ return;
27510
+ }
27511
+ this.hScrollBar.setAttribute('visible', true);
27512
+ this.hScrollBar.showAll();
27513
+ this._gantt.scenegraph.updateNextFrame();
27514
+ if (autoHide) {
27515
+ clearTimeout(this._clearHorizontalScrollBar);
27516
+ this._clearHorizontalScrollBar = setTimeout(() => {
27517
+ this.hideHorizontalScrollBar();
27518
+ }, 1000);
27519
+ }
27520
+ }
27521
+ updateVerticalScrollBarPos(topRatio) {
27522
+ const range = this.vScrollBar.attribute.range;
27523
+ const size = range[1] - range[0];
27524
+ const range0 = topRatio * (1 - size);
27525
+ this.vScrollBar.setAttribute('range', [range0, range0 + size]);
27526
+ const bounds = this.vScrollBar.AABBBounds && this.vScrollBar.globalAABBBounds;
27527
+ this.vScrollBar._viewPosition = {
27528
+ x: bounds.x1,
27529
+ y: bounds.y1
27530
+ };
27531
+ }
27532
+ updateHorizontalScrollBarPos(leftRatio) {
27533
+ const range = this.hScrollBar.attribute.range;
27534
+ const size = range[1] - range[0];
27535
+ const range0 = leftRatio * (1 - size);
27536
+ this.hScrollBar.setAttribute('range', [range0, range0 + size]);
27537
+ const bounds = this.hScrollBar.AABBBounds && this.hScrollBar.globalAABBBounds;
27538
+ this.hScrollBar._viewPosition = {
27539
+ x: bounds.x1,
27540
+ y: bounds.y1
27541
+ };
27542
+ }
27543
+ updateScrollBar() {
27544
+ const oldHorizontalBarPos = this._gantt.stateManager.scroll.horizontalBarPos;
27545
+ const oldVerticalBarPos = this._gantt.stateManager.scroll.verticalBarPos;
27546
+ const scrollStyle = this._gantt.parsedOptions.scrollStyle;
27547
+ const width = scrollStyle?.width;
27548
+ const visible = scrollStyle?.visible;
27549
+ const tableWidth = Math.ceil(this._gantt.scenegraph.ganttGroup.attribute.width);
27550
+ const tableHeight = Math.ceil(this._gantt.scenegraph.ganttGroup.attribute.height);
27551
+ const totalHeight = this._gantt.getAllRowsHeight();
27552
+ const totalWidth = this._gantt.getAllDateColsWidth();
27553
+ const frozenRowsHeight = this._gantt.getAllHeaderRowsHeight();
27554
+ if (totalWidth > tableWidth) {
27555
+ const y = Math.min(tableHeight, totalHeight);
27556
+ const rangeEnd = Math.max(0.05, tableWidth / totalWidth);
27557
+ const hoverOn = scrollStyle.hoverOn;
27558
+ let attrY = 0;
27559
+ if (scrollStyle.barToSide) {
27560
+ attrY =
27561
+ this._gantt.tableNoFrameHeight -
27562
+ (hoverOn ? width : -this._gantt.scenegraph.ganttGroup.attribute.y) +
27563
+ this._gantt.tableY;
27564
+ }
27565
+ else {
27566
+ attrY = y - (hoverOn ? width : -this._gantt.scenegraph.ganttGroup.attribute.y) + this._gantt.tableY;
27567
+ }
27568
+ this.hScrollBar.setAttributes({
27569
+ x: this._gantt.scenegraph.ganttGroup.attribute.x,
27570
+ y: attrY,
27571
+ width: tableWidth,
27572
+ range: [0, rangeEnd],
27573
+ visible: visible === 'always'
27574
+ });
27575
+ const bounds = this.hScrollBar.AABBBounds && this.hScrollBar.globalAABBBounds;
27576
+ this.hScrollBar._viewPosition = {
27577
+ x: bounds.x1,
27578
+ y: bounds.y1
27579
+ };
27580
+ if (visible === 'always') {
27581
+ this.hScrollBar.showAll();
27582
+ }
27583
+ }
27584
+ else {
27585
+ this.hScrollBar.setAttributes({
27586
+ x: -this._gantt.tableNoFrameWidth * 2,
27587
+ y: -this._gantt.tableNoFrameHeight * 2,
27588
+ width: 0,
27589
+ visible: false
27590
+ });
27591
+ }
27592
+ if (totalHeight > tableHeight) {
27593
+ const x = Math.min(tableWidth, totalWidth) + this._gantt.scenegraph.ganttGroup.attribute.x;
27594
+ const rangeEnd = Math.max(0.05, (tableHeight - frozenRowsHeight) / (totalHeight - frozenRowsHeight));
27595
+ let attrX = 0;
27596
+ const hoverOn = this._gantt.parsedOptions.scrollStyle.hoverOn;
27597
+ if (this._gantt.parsedOptions.scrollStyle.barToSide) {
27598
+ attrX = this._gantt.tableNoFrameWidth - (hoverOn ? width : -this._gantt.scenegraph.ganttGroup.attribute.x);
27599
+ }
27600
+ else {
27601
+ attrX = x - (hoverOn ? width : -this._gantt.scenegraph.ganttGroup.attribute.x);
28020
27602
  }
28021
- }
28022
- }
28023
- createVerticalBackgroundRects() {
28024
- const verticalBackgroundColor = this._scene._gantt.parsedOptions.grid.verticalBackgroundColor;
28025
- const weekendBackgroundColor = this._scene._gantt.parsedOptions.grid.weekendBackgroundColor;
28026
- if (verticalBackgroundColor || weekendBackgroundColor) {
28027
- this.verticalBackgroundRectsGroup = new Group$2({
28028
- x: 0,
28029
- y: 0,
28030
- width: this.allGridWidth,
28031
- height: this.allGridHeight
27603
+ this.vScrollBar.setAttributes({
27604
+ x: attrX,
27605
+ y: frozenRowsHeight + (!hoverOn ? this._gantt.scenegraph.ganttGroup.attribute.y : 0) + this._gantt.tableY,
27606
+ height: tableHeight - frozenRowsHeight,
27607
+ range: [0, rangeEnd],
27608
+ visible: visible === 'always'
28032
27609
  });
28033
- this.verticalBackgroundRectsGroup.name = 'grid-vertical-background';
28034
- this.group.appendChild(this.verticalBackgroundRectsGroup);
28035
- const { timelineDates, unit, step } = this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];
28036
- const timelineColWidth = this._scene._gantt.parsedOptions.timelineColWidth;
28037
- if (verticalBackgroundColor || weekendBackgroundColor) {
28038
- for (let i = 0; i <= timelineDates?.length - 1; i++) {
28039
- let backgroundColor;
28040
- if (weekendBackgroundColor &&
28041
- unit === 'day' &&
28042
- step === 1 &&
28043
- (timelineDates[i].startDate.getDay() === 0 || timelineDates[i].startDate.getDay() === 6)) {
28044
- backgroundColor = weekendBackgroundColor;
28045
- }
28046
- else if (typeof verticalBackgroundColor === 'function') {
28047
- backgroundColor = verticalBackgroundColor({
28048
- index: i,
28049
- dateIndex: timelineDates[i].dateIndex,
28050
- date: timelineDates[i].endDate,
28051
- ganttInstance: this._scene._gantt
28052
- });
28053
- }
28054
- else if (verticalBackgroundColor) {
28055
- backgroundColor = verticalBackgroundColor[i % verticalBackgroundColor.length];
28056
- }
28057
- if (backgroundColor) {
28058
- const x = Math.ceil(timelineColWidth * i);
28059
- const rect = createRect({
28060
- pickable: false,
28061
- fill: backgroundColor,
28062
- x,
28063
- y: 0,
28064
- width: timelineColWidth,
28065
- height: this.allGridHeight
28066
- });
28067
- this.verticalBackgroundRectsGroup.appendChild(rect);
28068
- }
28069
- }
27610
+ const bounds = this.vScrollBar.AABBBounds && this.vScrollBar.globalAABBBounds;
27611
+ this.vScrollBar._viewPosition = {
27612
+ x: bounds.x1,
27613
+ y: bounds.y1
27614
+ };
27615
+ if (visible === 'always') {
27616
+ this.vScrollBar.showAll();
28070
27617
  }
28071
27618
  }
28072
- }
28073
- createHorizontalBackgroundRects() {
28074
- const horizontalBackgroundColor = this._scene._gantt.parsedOptions.grid.horizontalBackgroundColor;
28075
- if (horizontalBackgroundColor) {
28076
- this.horizontalBackgroundRectsGroup = new Group$2({
28077
- x: 0,
28078
- y: 0,
28079
- width: this.allGridWidth,
28080
- height: this.allGridHeight
27619
+ else {
27620
+ this.vScrollBar.setAttributes({
27621
+ x: -this._gantt.tableNoFrameWidth * 2,
27622
+ y: -this._gantt.tableNoFrameHeight * 2,
27623
+ height: 0,
27624
+ visible: false
28081
27625
  });
28082
- this.horizontalBackgroundRectsGroup.name = 'grid-horizontal-background';
28083
- this.group.appendChild(this.horizontalBackgroundRectsGroup);
28084
- let y = 0;
28085
- for (let i = 0; i <= this.rowCount - 1; i++) {
28086
- let backgroundColor;
28087
- if (typeof horizontalBackgroundColor === 'function') {
28088
- backgroundColor = horizontalBackgroundColor({
28089
- index: i,
28090
- ganttInstance: this._scene._gantt
28091
- });
28092
- }
28093
- else {
28094
- backgroundColor = horizontalBackgroundColor[i % horizontalBackgroundColor.length];
28095
- }
28096
- const rect = createRect({
28097
- pickable: false,
28098
- fill: backgroundColor,
28099
- x: 0,
28100
- y,
28101
- width: this.allGridWidth,
28102
- height: this._scene._gantt.getRowHeightByIndex(i)
28103
- });
28104
- this.horizontalBackgroundRectsGroup.appendChild(rect);
28105
- y += this._scene._gantt.getRowHeightByIndex(i);
28106
- }
28107
27626
  }
27627
+ this._gantt.stateManager.setScrollLeft(oldHorizontalBarPos);
27628
+ this._gantt.stateManager.setScrollTop(oldVerticalBarPos);
28108
27629
  }
28109
- refresh() {
28110
- this.width = this._scene.ganttGroup.attribute.width;
28111
- this.height = this._scene.ganttGroup.attribute.height - this._scene.timelineHeader.group.attribute.height;
28112
- this.group.setAttributes({
28113
- width: this.width,
28114
- height: this.height,
28115
- y: this._scene._gantt.getAllHeaderRowsHeight()
28116
- });
28117
- this.rowCount = this._scene._gantt.itemCount;
28118
- this.allGridWidth = this._scene._gantt.getAllDateColsWidth();
28119
- this.allGridHeight = this._scene._gantt.getAllTaskBarsHeight();
28120
- this.group.removeAllChild();
28121
- this.createVerticalBackgroundRects();
28122
- this.createHorizontalBackgroundRects();
28123
- this.createVerticalLines();
28124
- this.createHorizontalLines();
28125
- this.createTimeLineHeaderBottomLine();
27630
+ }
27631
+
27632
+ function handleWhell$1(event, state, gantt, isWheelEvent = true) {
27633
+ let { deltaX, deltaY } = event;
27634
+ if (event.shiftKey && event.deltaY) {
27635
+ deltaX = deltaY;
27636
+ deltaY = 0;
28126
27637
  }
28127
- setX(x) {
28128
- this.verticalLineGroup?.setAttribute('x', x);
28129
- this.horizontalLineGroup?.setAttribute('x', x);
28130
- this.verticalBackgroundRectsGroup?.setAttribute('x', x);
28131
- this.horizontalBackgroundRectsGroup?.setAttribute('x', x);
27638
+ const [optimizedDeltaX, optimizedDeltaY] = optimizeScrollXY$1(deltaX, deltaY, { horizontal: 1, vertical: 1 });
27639
+ if (optimizedDeltaX) {
27640
+ state.setScrollLeft(state.scroll.horizontalBarPos + optimizedDeltaX);
27641
+ gantt.scenegraph.scrollbarComponent.showHorizontalScrollBar(true);
28132
27642
  }
28133
- setY(y) {
28134
- this.verticalLineGroup?.setAttribute('y', y);
28135
- this.horizontalLineGroup?.setAttribute('y', y);
28136
- this.verticalBackgroundRectsGroup?.setAttribute('y', y);
28137
- this.horizontalBackgroundRectsGroup?.setAttribute('y', y);
27643
+ if (optimizedDeltaY) {
27644
+ state.setScrollTop(state.scroll.verticalBarPos + optimizedDeltaY);
27645
+ gantt.scenegraph.scrollbarComponent.showVerticalScrollBar(true);
28138
27646
  }
28139
- resize() {
28140
- this.width = this._scene.ganttGroup.attribute.width;
28141
- this.height = this._scene.ganttGroup.attribute.height - this._scene.timelineHeader.group.attribute.height;
28142
- this.group.setAttribute('width', this.width);
28143
- this.group.setAttribute('height', this.height);
27647
+ isWheelEvent && state.resetInteractionState();
27648
+ if (event.cancelable &&
27649
+ (state._gantt.parsedOptions.overscrollBehavior === 'none' ||
27650
+ (Math.abs(deltaY) >= Math.abs(deltaX) && deltaY !== 0 && isVerticalScrollable$1(deltaY, state)) ||
27651
+ (Math.abs(deltaY) <= Math.abs(deltaX) && deltaX !== 0 && isHorizontalScrollable$1(deltaX, state)))) {
27652
+ event.preventDefault();
28144
27653
  }
28145
27654
  }
28146
-
28147
- let Env$1 = class Env {
28148
- static _mode;
28149
- static get mode() {
28150
- if (!Env._mode) {
28151
- Env._mode = defaultMode$1();
28152
- }
28153
- return Env._mode;
28154
- }
28155
- static set mode(mode) {
28156
- Env._mode = mode;
28157
- }
28158
- static dpr = 0;
28159
- static CreateCanvas;
28160
- static LoadImage;
28161
- static RequestAnimationFrame;
28162
- static CancelAnimationFrame;
28163
- static RegisterCreateCanvas(func) {
28164
- Env.CreateCanvas = func;
27655
+ function optimizeScrollXY$1(x, y, ratio) {
27656
+ const ANGLE = 2;
27657
+ const angle = Math.abs(x / y);
27658
+ const deltaX = angle <= 1 / ANGLE ? 0 : x;
27659
+ const deltaY = angle > ANGLE ? 0 : y;
27660
+ return [Math.ceil(deltaX * (ratio.horizontal ?? 0)), Math.ceil(deltaY * (ratio.vertical ?? 0))];
27661
+ }
27662
+ function isVerticalScrollable$1(deltaY, state) {
27663
+ const totalHeight = state._gantt.getAllRowsHeight() - state._gantt.scenegraph.height;
27664
+ if (totalHeight === 0) {
27665
+ return false;
28165
27666
  }
28166
- static RegisterLoadImage(func) {
28167
- Env.LoadImage = func;
27667
+ return !isScrollToTop$1(deltaY, state) && !isScrollToBottom$1(deltaY, state);
27668
+ }
27669
+ function isHorizontalScrollable$1(deltaX, state) {
27670
+ const totalWidth = state._gantt.getAllDateColsWidth() - state._gantt.scenegraph.width;
27671
+ if (totalWidth === 0) {
27672
+ return false;
28168
27673
  }
28169
- static GetCreateCanvasFunc() {
28170
- if (Env.CreateCanvas) {
28171
- return Env.CreateCanvas;
27674
+ return !isScrollToLeft$1(deltaX, state) && !isScrollToRight$1(deltaX, state);
27675
+ }
27676
+ function isScrollToTop$1(deltaY, state) {
27677
+ const totalHeight = state._gantt.getAllRowsHeight() - state._gantt.scenegraph.height;
27678
+ return totalHeight !== 0 && deltaY <= 0 && state.scroll.verticalBarPos < 1;
27679
+ }
27680
+ function isScrollToBottom$1(deltaY, state) {
27681
+ const totalHeight = state._gantt.getAllRowsHeight() - state._gantt.scenegraph.height;
27682
+ return totalHeight !== 0 && deltaY >= 0 && Math.abs(state.scroll.verticalBarPos - totalHeight) < 1;
27683
+ }
27684
+ function isScrollToLeft$1(deltaX, state) {
27685
+ const totalWidth = state._gantt.getAllDateColsWidth() - state._gantt.scenegraph.width;
27686
+ return totalWidth !== 0 && deltaX <= 0 && state.scroll.horizontalBarPos < 1;
27687
+ }
27688
+ function isScrollToRight$1(deltaX, state) {
27689
+ const totalWidth = state._gantt.getAllDateColsWidth() - state._gantt.scenegraph.width;
27690
+ return totalWidth !== 0 && deltaX >= 0 && Math.abs(state.scroll.horizontalBarPos - totalWidth) < 1;
27691
+ }
27692
+ function bindScrollBarListener$1(eventManager) {
27693
+ const table = eventManager._gantt;
27694
+ const stateManager = table.stateManager;
27695
+ const scenegraph = table.scenegraph;
27696
+ scenegraph.scrollbarComponent.vScrollBar.addEventListener('pointerover', (e) => {
27697
+ scenegraph.scrollbarComponent.showVerticalScrollBar();
27698
+ });
27699
+ scenegraph.scrollbarComponent.hScrollBar.addEventListener('pointerover', (e) => {
27700
+ scenegraph.scrollbarComponent.showHorizontalScrollBar();
27701
+ });
27702
+ scenegraph.scrollbarComponent.vScrollBar.addEventListener('pointerout', (e) => {
27703
+ if (stateManager.interactionState === InteractionState$1.scrolling) {
27704
+ return;
28172
27705
  }
28173
- if (Env.mode === 'worker') {
28174
- return (width = 200, height = 200) => new OffscreenCanvas(width, height);
27706
+ scenegraph.scrollbarComponent.hideVerticalScrollBar();
27707
+ });
27708
+ scenegraph.scrollbarComponent.hScrollBar.addEventListener('pointerout', (e) => {
27709
+ if (stateManager.interactionState === InteractionState$1.scrolling) {
27710
+ return;
28175
27711
  }
28176
- return undefined;
27712
+ scenegraph.scrollbarComponent.hideHorizontalScrollBar();
27713
+ });
27714
+ scenegraph.scrollbarComponent.vScrollBar.addEventListener('pointermove', (e) => {
27715
+ e.stopPropagation();
27716
+ });
27717
+ scenegraph.scrollbarComponent.vScrollBar.addEventListener('scrollDown', (e) => {
27718
+ scenegraph._gantt.eventManager.isDown = true;
27719
+ });
27720
+ scenegraph.scrollbarComponent.vScrollBar.addEventListener('pointerup', () => {
27721
+ scenegraph._gantt.eventManager.isDraging = false;
27722
+ if (stateManager.interactionState === InteractionState$1.scrolling) {
27723
+ stateManager.updateInteractionState(InteractionState$1.default);
27724
+ }
27725
+ });
27726
+ scenegraph.scrollbarComponent.vScrollBar.addEventListener('pointerupoutside', () => {
27727
+ if (stateManager.interactionState === InteractionState$1.scrolling) {
27728
+ stateManager.updateInteractionState(InteractionState$1.default);
27729
+ }
27730
+ });
27731
+ scenegraph.scrollbarComponent.vScrollBar.addEventListener('scrollUp', (e) => {
27732
+ scenegraph._gantt.eventManager.isDraging = false;
27733
+ });
27734
+ scenegraph.scrollbarComponent.hScrollBar.addEventListener('pointermove', (e) => {
27735
+ e.stopPropagation();
27736
+ });
27737
+ scenegraph.scrollbarComponent.hScrollBar.addEventListener('pointerdown', (e) => {
27738
+ e.stopPropagation();
27739
+ });
27740
+ scenegraph.scrollbarComponent.hScrollBar.addEventListener('scrollDown', (e) => {
27741
+ scenegraph._gantt.eventManager.isDown = true;
27742
+ if (stateManager.interactionState !== InteractionState$1.scrolling) {
27743
+ stateManager.updateInteractionState(InteractionState$1.scrolling);
27744
+ }
27745
+ });
27746
+ scenegraph.scrollbarComponent.hScrollBar.addEventListener('pointerup', () => {
27747
+ if (stateManager.interactionState === InteractionState$1.scrolling) {
27748
+ stateManager.updateInteractionState(InteractionState$1.default);
27749
+ }
27750
+ });
27751
+ scenegraph.scrollbarComponent.hScrollBar.addEventListener('pointerupoutside', () => {
27752
+ if (stateManager.interactionState === InteractionState$1.scrolling) {
27753
+ stateManager.updateInteractionState(InteractionState$1.default);
27754
+ }
27755
+ });
27756
+ scenegraph.scrollbarComponent.hScrollBar.addEventListener('scrollUp', (e) => {
27757
+ scenegraph._gantt.eventManager.isDraging = false;
27758
+ });
27759
+ const throttleVerticalWheel = throttle$1(stateManager.updateVerticalScrollBar, 20);
27760
+ const throttleHorizontalWheel = throttle$1(stateManager.updateHorizontalScrollBar, 20);
27761
+ scenegraph.scrollbarComponent.vScrollBar.addEventListener('scrollDrag', (e) => {
27762
+ if (scenegraph._gantt.eventManager.isDown) {
27763
+ scenegraph._gantt.eventManager.isDraging = true;
27764
+ }
27765
+ if (stateManager.interactionState !== InteractionState$1.scrolling) {
27766
+ stateManager.updateInteractionState(InteractionState$1.scrolling);
27767
+ }
27768
+ const ratio = e.detail.value[0] / (1 - e.detail.value[1] + e.detail.value[0]);
27769
+ throttleVerticalWheel(ratio, e);
27770
+ });
27771
+ scenegraph.scrollbarComponent.hScrollBar.addEventListener('scrollDrag', (e) => {
27772
+ if (scenegraph._gantt.eventManager.isDown) {
27773
+ scenegraph._gantt.eventManager.isDraging = true;
27774
+ }
27775
+ stateManager.fastScrolling = true;
27776
+ if (stateManager.interactionState !== InteractionState$1.scrolling) {
27777
+ stateManager.updateInteractionState(InteractionState$1.scrolling);
27778
+ }
27779
+ const ratio = e.detail.value[0] / (1 - e.detail.value[1] + e.detail.value[0]);
27780
+ throttleHorizontalWheel(ratio);
27781
+ });
27782
+ }
27783
+
27784
+ const defaultTaskBarStyle = {
27785
+ barColor: 'blue',
27786
+ completedBarColor: 'gray',
27787
+ width: 30,
27788
+ cornerRadius: 3,
27789
+ borderWidth: 0,
27790
+ fontFamily: 'Arial',
27791
+ fontSize: 14
27792
+ };
27793
+ function setWidthToDefaultTaskBarStyle(width) {
27794
+ defaultTaskBarStyle.width = width;
27795
+ }
27796
+ const isNode$1 = typeof window === 'undefined' || typeof window.window === 'undefined';
27797
+ const DayTimes = 1000 * 60 * 60 * 24;
27798
+ function getDateIndexByX(x, gantt) {
27799
+ const totalX = x + gantt.stateManager.scroll.horizontalBarPos;
27800
+ const firstDateColWidth = gantt.getDateColWidth(0);
27801
+ const dateIndex = Math.floor((totalX - firstDateColWidth) / gantt.parsedOptions.timelineColWidth) + 1;
27802
+ return dateIndex;
27803
+ }
27804
+ function generateMarkLine(markLine) {
27805
+ if (!markLine) {
27806
+ return [];
28177
27807
  }
28178
- static RegisterRequestAnimationFrame(func) {
28179
- Env.RequestAnimationFrame = func();
27808
+ if (markLine === true) {
27809
+ return [
27810
+ {
27811
+ date: createDateAtMidnight().toLocaleDateString(),
27812
+ scrollToMarkLine: true,
27813
+ position: 'left',
27814
+ style: {
27815
+ lineColor: 'red',
27816
+ lineWidth: 1
27817
+ }
27818
+ }
27819
+ ];
28180
27820
  }
28181
- static GetRequestAnimationFrame() {
28182
- if (Env.RequestAnimationFrame) {
28183
- return Env.RequestAnimationFrame;
27821
+ else if (Array.isArray(markLine)) {
27822
+ return markLine.map((item, index) => {
27823
+ return {
27824
+ ...item,
27825
+ date: item.date,
27826
+ scrollToMarkLine: item.scrollToMarkLine,
27827
+ position: item.position ?? 'left',
27828
+ style: {
27829
+ lineColor: item.style?.lineColor || 'red',
27830
+ lineWidth: item.style?.lineWidth || 1,
27831
+ lineDash: item.style?.lineDash
27832
+ }
27833
+ };
27834
+ });
27835
+ }
27836
+ return [
27837
+ {
27838
+ ...markLine,
27839
+ date: markLine.date,
27840
+ scrollToMarkLine: markLine.scrollToMarkLine ?? true,
27841
+ position: markLine.position ?? 'left',
27842
+ style: {
27843
+ lineColor: markLine.style?.lineColor || 'red',
27844
+ lineWidth: markLine.style?.lineWidth || 1,
27845
+ lineDash: markLine.style?.lineDash
27846
+ }
28184
27847
  }
28185
- return undefined;
27848
+ ];
27849
+ }
27850
+ function getHorizontalScrollBarSize$1(scrollStyle) {
27851
+ if (scrollStyle?.hoverOn ||
27852
+ (scrollStyle?.horizontalVisible && scrollStyle?.horizontalVisible === 'none') ||
27853
+ (!scrollStyle?.horizontalVisible && scrollStyle?.visible === 'none')) {
27854
+ return 0;
28186
27855
  }
28187
- static RegisterCancelAnimationFrame(func) {
28188
- Env.CancelAnimationFrame = func();
27856
+ return scrollStyle?.width ?? 7;
27857
+ }
27858
+ function getVerticalScrollBarSize$1(scrollStyle) {
27859
+ if (scrollStyle?.hoverOn ||
27860
+ (scrollStyle?.verticalVisible && scrollStyle?.verticalVisible === 'none') ||
27861
+ (!scrollStyle?.verticalVisible && scrollStyle?.visible === 'none')) {
27862
+ return 0;
28189
27863
  }
28190
- static GetCancelAnimationFrame() {
28191
- if (Env.CancelAnimationFrame) {
28192
- return Env.CancelAnimationFrame;
28193
- }
28194
- return undefined;
27864
+ return scrollStyle?.width ?? 7;
27865
+ }
27866
+ function initOptions(gantt) {
27867
+ const options = gantt.options;
27868
+ gantt.parsedOptions.tasksShowMode = options?.tasksShowMode ?? TasksShowMode.Tasks_Separate;
27869
+ gantt.parsedOptions.pixelRatio = options?.pixelRatio ?? 1;
27870
+ gantt.parsedOptions.rowHeight = options?.rowHeight ?? 40;
27871
+ gantt.parsedOptions.timelineColWidth = options?.timelineHeader?.colWidth ?? 60;
27872
+ gantt.parsedOptions.startDateField = options.taskBar?.startDateField ?? 'startDate';
27873
+ gantt.parsedOptions.endDateField = options.taskBar?.endDateField ?? 'endDate';
27874
+ gantt.parsedOptions.progressField = options.taskBar?.progressField ?? 'progress';
27875
+ const { unit: minTimeUnit, startOfWeek, step } = gantt.parsedOptions.reverseSortedTimelineScales[0];
27876
+ gantt.parsedOptions.minDate = options?.minDate
27877
+ ? getStartDateByTimeUnit(new Date(options.minDate), minTimeUnit, startOfWeek)
27878
+ : undefined;
27879
+ gantt.parsedOptions.maxDate = options?.maxDate
27880
+ ? getEndDateByTimeUnit(gantt.parsedOptions.minDate, new Date(options.maxDate), minTimeUnit, step)
27881
+ : undefined;
27882
+ gantt.parsedOptions._minDateTime = gantt.parsedOptions.minDate?.getTime();
27883
+ gantt.parsedOptions._maxDateTime = gantt.parsedOptions.maxDate?.getTime();
27884
+ gantt.parsedOptions.overscrollBehavior = options?.overscrollBehavior ?? 'auto';
27885
+ gantt.parsedOptions.underlayBackgroundColor = options?.underlayBackgroundColor ?? '#FFF';
27886
+ gantt.parsedOptions.scrollStyle = Object.assign({}, {
27887
+ scrollRailColor: 'rgba(100, 100, 100, 0.2)',
27888
+ scrollSliderColor: 'rgba(100, 100, 100, 0.5)',
27889
+ scrollSliderCornerRadius: 4,
27890
+ width: 10,
27891
+ visible: 'always',
27892
+ hoverOn: true,
27893
+ barToSide: false
27894
+ }, options?.scrollStyle);
27895
+ gantt.parsedOptions.timelineHeaderHorizontalLineStyle = options?.timelineHeader?.horizontalLine;
27896
+ gantt.parsedOptions.timelineHeaderVerticalLineStyle = options?.timelineHeader?.verticalLine;
27897
+ gantt.parsedOptions.timelineHeaderBackgroundColor = options?.timelineHeader?.backgroundColor;
27898
+ gantt.parsedOptions.timeLineHeaderRowHeights = [];
27899
+ gantt.parsedOptions.timelineHeaderStyles = [];
27900
+ for (let i = 0; i < gantt.parsedOptions.sortedTimelineScales.length ?? 0; i++) {
27901
+ const style = gantt.parsedOptions.sortedTimelineScales[i].style;
27902
+ gantt.parsedOptions.timelineHeaderStyles.push(Object.assign({
27903
+ fontSize: 20,
27904
+ fontWeight: 'bold',
27905
+ textAlign: 'center',
27906
+ textBaseline: 'middle',
27907
+ color: '#000',
27908
+ backgroundColor: '#fff'
27909
+ }, style));
27910
+ gantt.parsedOptions.timeLineHeaderRowHeights.push(gantt.parsedOptions.sortedTimelineScales[i].rowHeight ?? options?.headerRowHeight ?? 40);
28195
27911
  }
28196
- };
28197
- function defaultMode$1() {
28198
- let mode = 'browser';
28199
- try {
28200
- if (window.type === 'node') {
28201
- mode = 'node';
27912
+ gantt.parsedOptions.grid = Object.assign({}, options?.grid);
27913
+ setWidthToDefaultTaskBarStyle((gantt.parsedOptions.rowHeight * 3) / 4);
27914
+ gantt.parsedOptions.taskBarStyle =
27915
+ options?.taskBar?.barStyle && typeof options?.taskBar?.barStyle === 'function'
27916
+ ? options.taskBar.barStyle
27917
+ : Object.assign({}, defaultTaskBarStyle, options?.taskBar?.barStyle);
27918
+ gantt.parsedOptions.taskBarMilestoneStyle = Object.assign(typeof gantt.parsedOptions.taskBarStyle === 'function'
27919
+ ? {}
27920
+ : {
27921
+ width: gantt.parsedOptions.taskBarStyle.width,
27922
+ borderColor: gantt.parsedOptions.taskBarStyle.borderColor,
27923
+ borderLineWidth: gantt.parsedOptions.taskBarStyle.borderLineWidth ?? 1,
27924
+ fillColor: gantt.parsedOptions.taskBarStyle.barColor,
27925
+ cornerRadius: 0
27926
+ }, options?.taskBar?.milestoneStyle);
27927
+ gantt.parsedOptions.taskBarMilestoneHypotenuse = gantt.parsedOptions.taskBarMilestoneStyle.width * Math.sqrt(2);
27928
+ gantt.parsedOptions.dateFormat = options?.dateFormat;
27929
+ gantt.parsedOptions.taskBarHoverStyle = Object.assign({
27930
+ barOverlayColor: 'rgba(99, 144, 0, 0.4)'
27931
+ }, options?.taskBar?.hoverBarStyle);
27932
+ gantt.parsedOptions.taskBarSelectable = options?.taskBar?.selectable ?? true;
27933
+ gantt.parsedOptions.taskBarSelectedStyle = Object.assign(typeof gantt.parsedOptions.taskBarStyle === 'function'
27934
+ ? {
27935
+ shadowBlur: 6,
27936
+ shadowOffsetX: 0,
27937
+ shadowOffsetY: 0,
27938
+ borderLineWidth: 1
28202
27939
  }
28203
- else if (typeof window !== 'undefined' && !window.performance) {
28204
- mode = 'miniApp';
27940
+ : {
27941
+ shadowBlur: 6,
27942
+ shadowOffsetX: 0,
27943
+ shadowOffsetY: 0,
27944
+ shadowColor: gantt.parsedOptions.taskBarStyle.barColor,
27945
+ borderColor: gantt.parsedOptions.taskBarStyle.barColor,
27946
+ borderLineWidth: 1
27947
+ }, options?.taskBar?.selectedBarStyle);
27948
+ gantt.parsedOptions.taskBarLabelText = options?.taskBar?.labelText ?? '';
27949
+ gantt.parsedOptions.taskBarMoveable = options?.taskBar?.moveable ?? true;
27950
+ gantt.parsedOptions.moveTaskBarToExtendDateRange = options?.taskBar?.moveToExtendDateRange ?? true;
27951
+ gantt.parsedOptions.taskBarResizable = options?.taskBar?.resizable ?? true;
27952
+ gantt.parsedOptions.taskBarDragOrder = options?.taskBar?.dragOrder ?? true;
27953
+ gantt.parsedOptions.taskBarLabelStyle = {
27954
+ fontFamily: options?.taskBar?.labelTextStyle?.fontFamily ?? 'Arial',
27955
+ fontSize: options?.taskBar?.labelTextStyle?.fontSize ?? 20,
27956
+ color: options?.taskBar?.labelTextStyle?.color ?? '#F01',
27957
+ textAlign: options?.taskBar?.labelTextStyle?.textAlign ?? 'left',
27958
+ textBaseline: options?.taskBar?.labelTextStyle?.textBaseline ?? 'middle',
27959
+ padding: options?.taskBar?.labelTextStyle?.padding ?? [0, 0, 0, 10],
27960
+ textOverflow: options?.taskBar?.labelTextStyle?.textOverflow
27961
+ };
27962
+ gantt.parsedOptions.taskBarCustomLayout = options?.taskBar?.customLayout;
27963
+ gantt.parsedOptions.taskBarCreatable =
27964
+ options?.taskBar?.scheduleCreatable ??
27965
+ !!(gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Separate ||
27966
+ gantt.parsedOptions.tasksShowMode === TasksShowMode.Tasks_Separate);
27967
+ gantt.parsedOptions.taskBarCreationButtonStyle = Object.assign({
27968
+ lineColor: 'rgb(99, 144, 0)',
27969
+ lineWidth: 1,
27970
+ lineDash: [5, 5],
27971
+ cornerRadius: 4,
27972
+ backgroundColor: '#FFF'
27973
+ }, options?.taskBar?.scheduleCreation?.buttonStyle);
27974
+ gantt.parsedOptions.taskBarCreationCustomLayout = options?.taskBar?.scheduleCreation?.customLayout;
27975
+ gantt.parsedOptions.taskBarCreationMaxWidth = options?.taskBar?.scheduleCreation?.maxWidth;
27976
+ gantt.parsedOptions.taskBarCreationMinWidth = options?.taskBar?.scheduleCreation?.minWidth;
27977
+ gantt.parsedOptions.outerFrameStyle = Object.assign({
27978
+ borderColor: '#e1e4e8',
27979
+ borderLineWidth: 1,
27980
+ cornerRadius: 4
27981
+ }, options.frame?.outerFrameStyle);
27982
+ gantt.parsedOptions.markLine = generateMarkLine(options?.markLine);
27983
+ if (gantt.parsedOptions.markLine?.length ?? 0) {
27984
+ if (gantt.parsedOptions.markLine?.every(item => item.scrollToMarkLine === undefined)) {
27985
+ gantt.parsedOptions.markLine[0].scrollToMarkLine = true;
28205
27986
  }
28206
- else if (typeof window === 'undefined') {
28207
- mode = 'node';
27987
+ if (gantt.parsedOptions.markLine?.find(item => item.scrollToMarkLine)) {
27988
+ gantt.parsedOptions.scrollToMarkLineDate = getStartDateByTimeUnit(new Date(gantt.parsedOptions.markLine?.find(item => item.scrollToMarkLine).date), minTimeUnit, startOfWeek);
28208
27989
  }
28209
27990
  }
28210
- catch (err) {
28211
- mode = 'node';
28212
- }
28213
- return mode;
27991
+ gantt.parsedOptions.verticalSplitLineHighlight = options.frame?.verticalSplitLineHighlight;
27992
+ gantt.parsedOptions.verticalSplitLine = Object.assign({
27993
+ lineColor: gantt.parsedOptions.outerFrameStyle?.borderColor,
27994
+ lineWidth: gantt.parsedOptions.outerFrameStyle?.borderLineWidth
27995
+ }, options.frame?.verticalSplitLine);
27996
+ gantt.parsedOptions.horizontalSplitLine = options.frame?.horizontalSplitLine;
27997
+ gantt.parsedOptions.verticalSplitLineMoveable = options.frame?.verticalSplitLineMoveable;
27998
+ gantt.parsedOptions.taskKeyField = options.taskKeyField ?? 'id';
27999
+ gantt.parsedOptions.dependencyLinks = options.dependency?.links ?? [];
28000
+ gantt.parsedOptions.dependencyLinkCreatable = options.dependency?.linkCreatable ?? false;
28001
+ gantt.parsedOptions.dependencyLinkSelectable = options.dependency?.linkSelectable ?? true;
28002
+ gantt.parsedOptions.dependencyLinkDeletable = options.dependency?.linkDeletable ?? false;
28003
+ gantt.parsedOptions.dependencyLinkLineStyle = Object.assign({
28004
+ lineColor: 'red',
28005
+ lineWidth: 1
28006
+ }, options.dependency?.linkLineStyle);
28007
+ gantt.parsedOptions.dependencyLinkSelectedLineStyle = Object.assign({
28008
+ shadowBlur: 4,
28009
+ shadowOffset: 0,
28010
+ shadowColor: gantt.parsedOptions.dependencyLinkLineStyle.lineColor,
28011
+ lineColor: gantt.parsedOptions.dependencyLinkLineStyle.lineColor,
28012
+ lineWidth: gantt.parsedOptions.dependencyLinkLineStyle.lineWidth
28013
+ }, options?.dependency?.linkSelectedLineStyle);
28014
+ gantt.parsedOptions.dependencyLinkLineCreatePointStyle = Object.assign({
28015
+ strokeColor: 'red',
28016
+ fillColor: 'white',
28017
+ radius: 5,
28018
+ strokeWidth: 1
28019
+ }, options?.dependency?.linkCreatePointStyle);
28020
+ gantt.parsedOptions.dependencyLinkLineCreatingPointStyle = Object.assign({
28021
+ strokeColor: 'red',
28022
+ fillColor: 'red',
28023
+ radius: 5,
28024
+ strokeWidth: 1
28025
+ }, options?.dependency?.linkCreatingPointStyle);
28026
+ gantt.parsedOptions.dependencyLinkLineCreatingStyle = Object.assign({
28027
+ lineColor: 'red',
28028
+ lineWidth: 1,
28029
+ lineDash: [5, 5]
28030
+ }, options?.dependency?.linkCreatingLineStyle);
28031
+ gantt.parsedOptions.eventOptions = options?.eventOptions;
28032
+ gantt.parsedOptions.keyboardOptions = options?.keyboardOptions;
28033
+ gantt.parsedOptions.markLineCreateOptions = options?.markLineCreateOptions;
28214
28034
  }
28215
-
28216
- class ScrollBarComponent {
28217
- hScrollBar;
28218
- vScrollBar;
28219
- _gantt;
28220
- _clearHorizontalScrollBar;
28221
- _clearVerticalScrollBar;
28222
- constructor(gantt) {
28223
- this._gantt = gantt;
28224
- this.createScrollBar(gantt.tableNoFrameWidth, gantt.tableNoFrameHeight - gantt.getAllHeaderRowsHeight());
28035
+ function updateOptionsWhenScaleChanged(gantt) {
28036
+ const options = gantt.options;
28037
+ const { unit: minTimeUnit, startOfWeek, step } = gantt.parsedOptions.reverseSortedTimelineScales[0];
28038
+ gantt.parsedOptions.minDate = getStartDateByTimeUnit(new Date(gantt.parsedOptions.minDate), minTimeUnit, startOfWeek);
28039
+ gantt.parsedOptions.maxDate = getEndDateByTimeUnit(gantt.parsedOptions.minDate, new Date(gantt.parsedOptions.maxDate), minTimeUnit, step);
28040
+ gantt.parsedOptions._minDateTime = gantt.parsedOptions.minDate?.getTime();
28041
+ gantt.parsedOptions._maxDateTime = gantt.parsedOptions.maxDate?.getTime();
28042
+ gantt.parsedOptions.timeLineHeaderRowHeights = [];
28043
+ gantt.parsedOptions.timelineHeaderStyles = [];
28044
+ for (let i = 0; i < gantt.parsedOptions.sortedTimelineScales.length ?? 0; i++) {
28045
+ const style = gantt.parsedOptions.sortedTimelineScales[i].style;
28046
+ gantt.parsedOptions.timelineHeaderStyles.push(Object.assign({
28047
+ fontSize: 20,
28048
+ fontWeight: 'bold',
28049
+ textAlign: 'center',
28050
+ textBaseline: 'middle',
28051
+ color: '#000',
28052
+ backgroundColor: '#fff'
28053
+ }, style));
28054
+ gantt.parsedOptions.timeLineHeaderRowHeights.push(gantt.parsedOptions.sortedTimelineScales[i].rowHeight ?? options?.headerRowHeight ?? 40);
28225
28055
  }
28226
- createScrollBar(tableWidth, tableHeight) {
28227
- const scrollRailColor = this._gantt.parsedOptions.scrollStyle.scrollRailColor;
28228
- const scrollSliderColor = this._gantt.parsedOptions.scrollStyle.scrollSliderColor;
28229
- const scrollSliderCornerRadius = this._gantt.parsedOptions.scrollStyle.scrollSliderCornerRadius;
28230
- const width = this._gantt.parsedOptions.scrollStyle.width;
28231
- let sliderStyle;
28232
- if (isValid$3(scrollSliderCornerRadius)) {
28233
- sliderStyle = {
28234
- cornerRadius: scrollSliderCornerRadius,
28235
- fill: scrollSliderColor
28056
+ }
28057
+ function generateTimeLineDate(currentDate, endDate, scale) {
28058
+ const { unit, step, format } = scale;
28059
+ const timelineDates = [];
28060
+ while (currentDate < endDate) {
28061
+ if (unit === 'day') {
28062
+ const year = currentDate.getFullYear();
28063
+ const month = currentDate.getMonth();
28064
+ const day = currentDate.getDate();
28065
+ const end = createDateAtLastHour(new Date(year, month, day + step - 1), true);
28066
+ if (end.getTime() > endDate.getTime()) {
28067
+ end.setTime(endDate.getTime());
28068
+ }
28069
+ const start = currentDate;
28070
+ const formattedDate = format?.({ dateIndex: day, startDate: start, endDate: end });
28071
+ const columnTitle = formattedDate || day.toString();
28072
+ const dayCellConfig = {
28073
+ days: Math.abs(end.getTime() - currentDate.getTime() + 1) / DayTimes,
28074
+ startDate: start,
28075
+ endDate: end,
28076
+ step,
28077
+ unit: 'day',
28078
+ title: columnTitle,
28079
+ dateIndex: day
28236
28080
  };
28081
+ timelineDates.push(dayCellConfig);
28082
+ currentDate = new Date(year, month, day + step);
28237
28083
  }
28238
- else {
28239
- sliderStyle = {
28240
- fill: scrollSliderColor
28084
+ else if (unit === 'month') {
28085
+ const year = currentDate.getFullYear();
28086
+ const month = currentDate.getMonth();
28087
+ const end = createDateAtLastHour(new Date(year, month + step, 0), true);
28088
+ if (end.getTime() > endDate.getTime()) {
28089
+ end.setTime(endDate.getTime());
28090
+ }
28091
+ const start = currentDate;
28092
+ const formattedDate = format?.({ dateIndex: month + 1, startDate: start, endDate: end });
28093
+ const columnTitle = formattedDate || (month + 1).toString();
28094
+ const dayCellConfig = {
28095
+ days: Math.abs(end.getTime() - currentDate.getTime() + 1) / DayTimes,
28096
+ startDate: start,
28097
+ step,
28098
+ unit: 'month',
28099
+ endDate: end,
28100
+ title: columnTitle,
28101
+ dateIndex: month + 1
28241
28102
  };
28103
+ timelineDates.push(dayCellConfig);
28104
+ currentDate = new Date(year, month + step, 1);
28242
28105
  }
28243
- this._gantt.parsedOptions.scrollStyle?.visible;
28244
- this._gantt.parsedOptions.scrollStyle?.hoverOn;
28245
- this.hScrollBar = new ScrollBar({
28246
- direction: 'horizontal',
28247
- x: -tableWidth * 2,
28248
- y: -tableHeight * 2,
28249
- width: tableWidth,
28250
- height: width,
28251
- padding: 0,
28252
- railStyle: {
28253
- fill: scrollRailColor
28254
- },
28255
- sliderStyle,
28256
- range: [0, 0.1],
28257
- visible: false
28258
- });
28259
- this.hScrollBar.render();
28260
- this.hScrollBar.hideAll();
28261
- this.vScrollBar = new ScrollBar({
28262
- direction: 'vertical',
28263
- x: -tableWidth * 2,
28264
- y: -tableHeight * 2,
28265
- width,
28266
- height: tableHeight,
28267
- padding: 0,
28268
- railStyle: {
28269
- fill: scrollRailColor
28270
- },
28271
- sliderStyle,
28272
- range: [0, 0.1],
28273
- visible: false
28274
- });
28275
- this.vScrollBar.render();
28276
- this.vScrollBar.hideAll();
28277
- }
28278
- refresh() {
28279
- }
28280
- hideVerticalScrollBar() {
28281
- const visable = this._gantt.parsedOptions.scrollStyle.visible;
28282
- if (visable !== 'focus' && visable !== 'scrolling') {
28283
- return;
28284
- }
28285
- this.vScrollBar.setAttribute('visible', false);
28286
- this.vScrollBar.hideAll();
28287
- this._gantt.scenegraph.updateNextFrame();
28288
- }
28289
- showVerticalScrollBar(autoHide) {
28290
- const visable = this._gantt.parsedOptions.scrollStyle.visible;
28291
- if (visable !== 'focus' && visable !== 'scrolling') {
28292
- return;
28293
- }
28294
- this.vScrollBar.setAttribute('visible', true);
28295
- this.vScrollBar.showAll();
28296
- this._gantt.scenegraph.updateNextFrame();
28297
- if (autoHide) {
28298
- clearTimeout(this._clearVerticalScrollBar);
28299
- this._clearVerticalScrollBar = setTimeout(() => {
28300
- this.hideVerticalScrollBar();
28301
- }, 1000);
28302
- }
28303
- }
28304
- hideHorizontalScrollBar() {
28305
- const visable = this._gantt.parsedOptions.scrollStyle.visible;
28306
- if (visable !== 'focus' && visable !== 'scrolling') {
28307
- return;
28308
- }
28309
- this.hScrollBar.setAttribute('visible', false);
28310
- this.hScrollBar.hideAll();
28311
- this._gantt.scenegraph.updateNextFrame();
28312
- }
28313
- showHorizontalScrollBar(autoHide) {
28314
- const visable = this._gantt.parsedOptions.scrollStyle.visible;
28315
- if (visable !== 'focus' && visable !== 'scrolling') {
28316
- return;
28106
+ else if (unit === 'quarter') {
28107
+ const year = currentDate.getFullYear();
28108
+ const quarter = Math.floor(currentDate.getMonth() / 3);
28109
+ const end = createDateAtLastHour(new Date(year, (quarter + step) * 3, 0), true);
28110
+ if (end.getTime() > endDate.getTime()) {
28111
+ end.setTime(endDate.getTime());
28112
+ }
28113
+ const start = currentDate;
28114
+ const formattedDate = format?.({ dateIndex: quarter + 1, startDate: start, endDate: end });
28115
+ const columnTitle = formattedDate || (quarter + 1).toString();
28116
+ const dayCellConfig = {
28117
+ days: Math.abs(end.getTime() - currentDate.getTime() + 1) / (1000 * 60 * 60 * 24),
28118
+ startDate: start,
28119
+ step,
28120
+ unit: 'quarter',
28121
+ endDate: end,
28122
+ title: columnTitle,
28123
+ dateIndex: quarter + 1
28124
+ };
28125
+ timelineDates.push(dayCellConfig);
28126
+ currentDate = new Date(year, (quarter + step) * 3, 1);
28317
28127
  }
28318
- this.hScrollBar.setAttribute('visible', true);
28319
- this.hScrollBar.showAll();
28320
- this._gantt.scenegraph.updateNextFrame();
28321
- if (autoHide) {
28322
- clearTimeout(this._clearHorizontalScrollBar);
28323
- this._clearHorizontalScrollBar = setTimeout(() => {
28324
- this.hideHorizontalScrollBar();
28325
- }, 1000);
28128
+ else if (unit === 'year') {
28129
+ const year = currentDate.getFullYear();
28130
+ const end = createDateAtLastHour(new Date(year + step - 1, 11, 31), true);
28131
+ if (end.getTime() > endDate.getTime()) {
28132
+ end.setTime(endDate.getTime());
28133
+ }
28134
+ const start = currentDate;
28135
+ const formattedDate = format?.({ dateIndex: year, startDate: start, endDate: end });
28136
+ const columnTitle = formattedDate || year.toString();
28137
+ const dayCellConfig = {
28138
+ days: Math.abs(end.getTime() - currentDate.getTime() + 1) / DayTimes,
28139
+ startDate: start,
28140
+ endDate: end,
28141
+ step,
28142
+ unit: 'year',
28143
+ title: columnTitle,
28144
+ dateIndex: year
28145
+ };
28146
+ timelineDates.push(dayCellConfig);
28147
+ currentDate = new Date(year + step, 0, 1);
28326
28148
  }
28327
- }
28328
- updateVerticalScrollBarPos(topRatio) {
28329
- const range = this.vScrollBar.attribute.range;
28330
- const size = range[1] - range[0];
28331
- const range0 = topRatio * (1 - size);
28332
- this.vScrollBar.setAttribute('range', [range0, range0 + size]);
28333
- const bounds = this.vScrollBar.AABBBounds && this.vScrollBar.globalAABBBounds;
28334
- this.vScrollBar._viewPosition = {
28335
- x: bounds.x1,
28336
- y: bounds.y1
28337
- };
28338
- }
28339
- updateHorizontalScrollBarPos(leftRatio) {
28340
- const range = this.hScrollBar.attribute.range;
28341
- const size = range[1] - range[0];
28342
- const range0 = leftRatio * (1 - size);
28343
- this.hScrollBar.setAttribute('range', [range0, range0 + size]);
28344
- const bounds = this.hScrollBar.AABBBounds && this.hScrollBar.globalAABBBounds;
28345
- this.hScrollBar._viewPosition = {
28346
- x: bounds.x1,
28347
- y: bounds.y1
28348
- };
28349
- }
28350
- updateScrollBar() {
28351
- const oldHorizontalBarPos = this._gantt.stateManager.scroll.horizontalBarPos;
28352
- const oldVerticalBarPos = this._gantt.stateManager.scroll.verticalBarPos;
28353
- const scrollStyle = this._gantt.parsedOptions.scrollStyle;
28354
- const width = scrollStyle?.width;
28355
- const visible = scrollStyle?.visible;
28356
- const tableWidth = Math.ceil(this._gantt.scenegraph.ganttGroup.attribute.width);
28357
- const tableHeight = Math.ceil(this._gantt.scenegraph.ganttGroup.attribute.height);
28358
- const totalHeight = this._gantt.getAllRowsHeight();
28359
- const totalWidth = this._gantt.getAllDateColsWidth();
28360
- const frozenRowsHeight = this._gantt.getAllHeaderRowsHeight();
28361
- if (totalWidth > tableWidth) {
28362
- const y = Math.min(tableHeight, totalHeight);
28363
- const rangeEnd = Math.max(0.05, tableWidth / totalWidth);
28364
- const hoverOn = scrollStyle.hoverOn;
28365
- let attrY = 0;
28366
- if (scrollStyle.barToSide) {
28367
- attrY =
28368
- this._gantt.tableNoFrameHeight -
28369
- (hoverOn ? width : -this._gantt.scenegraph.ganttGroup.attribute.y) +
28370
- this._gantt.tableY;
28149
+ else if (unit === 'week') {
28150
+ const startOfWeekSetting = scale.startOfWeek ?? 'monday';
28151
+ let dayOfWeek = currentDate.getDay();
28152
+ if (startOfWeekSetting === 'monday') {
28153
+ dayOfWeek = dayOfWeek === 0 ? 6 : dayOfWeek - 1;
28371
28154
  }
28372
- else {
28373
- attrY = y - (hoverOn ? width : -this._gantt.scenegraph.ganttGroup.attribute.y) + this._gantt.tableY;
28155
+ const startOfWeek = createDateAtMidnight(currentDate);
28156
+ const dateEnd = createDateAtLastHour(currentDate.getTime() + (7 * step - dayOfWeek) * 24 * 60 * 60 * 1000 - 1, true);
28157
+ if (dateEnd > endDate) {
28158
+ dateEnd.setTime(endDate.getTime());
28374
28159
  }
28375
- this.hScrollBar.setAttributes({
28376
- x: this._gantt.scenegraph.ganttGroup.attribute.x,
28377
- y: attrY,
28378
- width: tableWidth,
28379
- range: [0, rangeEnd],
28380
- visible: visible === 'always'
28381
- });
28382
- const bounds = this.hScrollBar.AABBBounds && this.hScrollBar.globalAABBBounds;
28383
- this.hScrollBar._viewPosition = {
28384
- x: bounds.x1,
28385
- y: bounds.y1
28160
+ const weekNumber = getWeekNumber(startOfWeek);
28161
+ const columnTitle = format?.({ dateIndex: weekNumber, startDate: startOfWeek, endDate: dateEnd }) || weekNumber.toString();
28162
+ const dayCellConfig = {
28163
+ days: (dateEnd.getTime() - startOfWeek.getTime() + 1) / DayTimes,
28164
+ startDate: startOfWeek,
28165
+ endDate: dateEnd,
28166
+ step,
28167
+ unit: 'week',
28168
+ title: columnTitle,
28169
+ dateIndex: weekNumber
28386
28170
  };
28387
- if (visible === 'always') {
28388
- this.hScrollBar.showAll();
28389
- }
28390
- }
28391
- else {
28392
- this.hScrollBar.setAttributes({
28393
- x: -this._gantt.tableNoFrameWidth * 2,
28394
- y: -this._gantt.tableNoFrameHeight * 2,
28395
- width: 0,
28396
- visible: false
28397
- });
28171
+ timelineDates.push(dayCellConfig);
28172
+ currentDate.setTime(createDateAtMidnight(currentDate.getTime() + (7 * step - dayOfWeek) * 24 * 60 * 60 * 1000, true).getTime());
28398
28173
  }
28399
- if (totalHeight > tableHeight) {
28400
- const x = Math.min(tableWidth, totalWidth) + this._gantt.scenegraph.ganttGroup.attribute.x;
28401
- const rangeEnd = Math.max(0.05, (tableHeight - frozenRowsHeight) / (totalHeight - frozenRowsHeight));
28402
- let attrX = 0;
28403
- const hoverOn = this._gantt.parsedOptions.scrollStyle.hoverOn;
28404
- if (this._gantt.parsedOptions.scrollStyle.barToSide) {
28405
- attrX = this._gantt.tableNoFrameWidth - (hoverOn ? width : -this._gantt.scenegraph.ganttGroup.attribute.x);
28406
- }
28407
- else {
28408
- attrX = x - (hoverOn ? width : -this._gantt.scenegraph.ganttGroup.attribute.x);
28174
+ else if (unit === 'hour') {
28175
+ const year = currentDate.getFullYear();
28176
+ const month = currentDate.getMonth();
28177
+ const day = currentDate.getDate();
28178
+ const hour = currentDate.getHours();
28179
+ const end = createDateAtLastMinute(new Date(year, month, day, hour + step - 1), true);
28180
+ if (end.getTime() > endDate.getTime()) {
28181
+ end.setTime(endDate.getTime());
28409
28182
  }
28410
- this.vScrollBar.setAttributes({
28411
- x: attrX,
28412
- y: frozenRowsHeight + (!hoverOn ? this._gantt.scenegraph.ganttGroup.attribute.y : 0) + this._gantt.tableY,
28413
- height: tableHeight - frozenRowsHeight,
28414
- range: [0, rangeEnd],
28415
- visible: visible === 'always'
28416
- });
28417
- const bounds = this.vScrollBar.AABBBounds && this.vScrollBar.globalAABBBounds;
28418
- this.vScrollBar._viewPosition = {
28419
- x: bounds.x1,
28420
- y: bounds.y1
28183
+ const start = currentDate;
28184
+ const formattedDate = format?.({ dateIndex: hour, startDate: start, endDate: end });
28185
+ const columnTitle = formattedDate || hour.toString();
28186
+ const dayCellConfig = {
28187
+ days: Math.abs(end.getTime() - currentDate.getTime() + 1) / DayTimes,
28188
+ startDate: start,
28189
+ endDate: end,
28190
+ step,
28191
+ unit: 'hour',
28192
+ title: columnTitle,
28193
+ dateIndex: currentDate.getHours()
28421
28194
  };
28422
- if (visible === 'always') {
28423
- this.vScrollBar.showAll();
28195
+ timelineDates.push(dayCellConfig);
28196
+ currentDate = new Date(year, month, day, hour + step);
28197
+ }
28198
+ else if (unit === 'minute') {
28199
+ const year = currentDate.getFullYear();
28200
+ const month = currentDate.getMonth();
28201
+ const day = currentDate.getDate();
28202
+ const hour = currentDate.getHours();
28203
+ const minute = currentDate.getMinutes();
28204
+ const end = createDateAtLastSecond(new Date(year, month, day, hour, minute + step - 1), true);
28205
+ if (end.getTime() > endDate.getTime()) {
28206
+ end.setTime(endDate.getTime());
28424
28207
  }
28208
+ const start = currentDate;
28209
+ const formattedDate = format?.({ dateIndex: minute, startDate: start, endDate: end });
28210
+ const columnTitle = formattedDate || minute.toString();
28211
+ const dayCellConfig = {
28212
+ days: Math.abs(end.getTime() - currentDate.getTime() + 1) / DayTimes,
28213
+ startDate: start,
28214
+ endDate: end,
28215
+ step,
28216
+ unit: 'minute',
28217
+ title: columnTitle,
28218
+ dateIndex: currentDate.getMinutes()
28219
+ };
28220
+ timelineDates.push(dayCellConfig);
28221
+ currentDate = new Date(year, month, day, hour, minute + step);
28425
28222
  }
28426
- else {
28427
- this.vScrollBar.setAttributes({
28428
- x: -this._gantt.tableNoFrameWidth * 2,
28429
- y: -this._gantt.tableNoFrameHeight * 2,
28430
- height: 0,
28431
- visible: false
28432
- });
28223
+ else if (unit === 'second') {
28224
+ const year = currentDate.getFullYear();
28225
+ const month = currentDate.getMonth();
28226
+ const day = currentDate.getDate();
28227
+ const hour = currentDate.getHours();
28228
+ const minute = currentDate.getMinutes();
28229
+ const second = currentDate.getSeconds();
28230
+ const end = createDateAtLastMillisecond(new Date(year, month, day, hour, minute, second + step - 1), true);
28231
+ if (end.getTime() > endDate.getTime()) {
28232
+ end.setTime(endDate.getTime());
28233
+ }
28234
+ const start = currentDate;
28235
+ const formattedDate = format?.({ dateIndex: second, startDate: start, endDate: end });
28236
+ const columnTitle = formattedDate || second.toString();
28237
+ const dayCellConfig = {
28238
+ days: Math.abs(end.getTime() - currentDate.getTime() + 1) / DayTimes,
28239
+ startDate: start,
28240
+ endDate: end,
28241
+ step,
28242
+ unit: 'second',
28243
+ title: columnTitle,
28244
+ dateIndex: currentDate.getSeconds()
28245
+ };
28246
+ timelineDates.push(dayCellConfig);
28247
+ currentDate = new Date(year, month, day, hour, minute, second + step);
28433
28248
  }
28434
- this._gantt.stateManager.setScrollLeft(oldHorizontalBarPos);
28435
- this._gantt.stateManager.setScrollTop(oldVerticalBarPos);
28436
- }
28437
- }
28438
-
28439
- function handleWhell$1(event, state, gantt, isWheelEvent = true) {
28440
- let { deltaX, deltaY } = event;
28441
- if (event.shiftKey && event.deltaY) {
28442
- deltaX = deltaY;
28443
- deltaY = 0;
28444
28249
  }
28445
- const [optimizedDeltaX, optimizedDeltaY] = optimizeScrollXY$1(deltaX, deltaY, { horizontal: 1, vertical: 1 });
28446
- if (optimizedDeltaX) {
28447
- state.setScrollLeft(state.scroll.horizontalBarPos + optimizedDeltaX);
28448
- gantt.scenegraph.scrollbarComponent.showHorizontalScrollBar(true);
28250
+ return timelineDates;
28251
+ }
28252
+ function getTextPos(padding, textAlign, textBaseline, width, height) {
28253
+ let textX = padding[3] ?? 10;
28254
+ if (textAlign === 'right' || textAlign === 'end') {
28255
+ textX = width - 0 - (padding[1] ?? 10);
28449
28256
  }
28450
- if (optimizedDeltaY) {
28451
- state.setScrollTop(state.scroll.verticalBarPos + optimizedDeltaY);
28452
- gantt.scenegraph.scrollbarComponent.showVerticalScrollBar(true);
28257
+ else if (textAlign === 'center') {
28258
+ textX = 0 + (width - 0 + (padding[3] ?? 10) - (padding[1] ?? 10)) / 2;
28453
28259
  }
28454
- isWheelEvent && state.resetInteractionState();
28455
- if (event.cancelable &&
28456
- (state._gantt.parsedOptions.overscrollBehavior === 'none' ||
28457
- (Math.abs(deltaY) >= Math.abs(deltaX) && deltaY !== 0 && isVerticalScrollable$1(deltaY, state)) ||
28458
- (Math.abs(deltaY) <= Math.abs(deltaX) && deltaX !== 0 && isHorizontalScrollable$1(deltaX, state)))) {
28459
- event.preventDefault();
28260
+ let textY = 0 + (padding[0] ?? 10);
28261
+ if (textBaseline === 'bottom' || textBaseline === 'alphabetic' || textBaseline === 'ideographic') {
28262
+ textY = height - 0 - (padding[2] ?? 10);
28460
28263
  }
28264
+ else if (textBaseline === 'middle') {
28265
+ textY = 0 + (height - 0 - (padding[0] ?? 10) - (padding[2] ?? 10)) / 2 + (padding[0] ?? 10);
28266
+ }
28267
+ return {
28268
+ x: textX,
28269
+ y: textY
28270
+ };
28461
28271
  }
28462
- function optimizeScrollXY$1(x, y, ratio) {
28463
- const ANGLE = 2;
28464
- const angle = Math.abs(x / y);
28465
- const deltaX = angle <= 1 / ANGLE ? 0 : x;
28466
- const deltaY = angle > ANGLE ? 0 : y;
28467
- return [Math.ceil(deltaX * (ratio.horizontal ?? 0)), Math.ceil(deltaY * (ratio.vertical ?? 0))];
28272
+ function convertProgress(progress) {
28273
+ if (typeof progress === 'string') {
28274
+ progress = progress.replace('%', '');
28275
+ progress = parseFloat(progress);
28276
+ }
28277
+ return Math.round(progress);
28468
28278
  }
28469
- function isVerticalScrollable$1(deltaY, state) {
28470
- const totalHeight = state._gantt.getAllRowsHeight() - state._gantt.scenegraph.height;
28471
- if (totalHeight === 0) {
28472
- return false;
28279
+ function createSplitLineAndResizeLine(gantt) {
28280
+ if (gantt.taskListTableInstance) {
28281
+ gantt.verticalSplitResizeLine = document.createElement('div');
28282
+ gantt.verticalSplitResizeLine.style.position = 'absolute';
28283
+ gantt.verticalSplitResizeLine.style.top = gantt.tableY + 'px';
28284
+ gantt.verticalSplitResizeLine.style.left =
28285
+ (gantt.taskTableWidth ? gantt.taskTableWidth - 7 + gantt.parsedOptions.verticalSplitLine.lineWidth / 2 : 0) +
28286
+ 'px';
28287
+ gantt.verticalSplitResizeLine.style.width = '14px';
28288
+ gantt.verticalSplitResizeLine.style.height = gantt.drawHeight + 'px';
28289
+ gantt.verticalSplitResizeLine.style.backgroundColor = 'rgba(0,0,0,0)';
28290
+ gantt.verticalSplitResizeLine.style.zIndex = '100';
28291
+ gantt.parsedOptions.verticalSplitLineMoveable && (gantt.verticalSplitResizeLine.style.cursor = 'col-resize');
28292
+ gantt.verticalSplitResizeLine.style.userSelect = 'none';
28293
+ gantt.verticalSplitResizeLine.style.opacity = '1';
28294
+ const verticalSplitLine = document.createElement('div');
28295
+ verticalSplitLine.style.position = 'absolute';
28296
+ verticalSplitLine.style.top = '0px';
28297
+ verticalSplitLine.style.left = `${(14 - gantt.parsedOptions.verticalSplitLine.lineWidth) / 2}px`;
28298
+ verticalSplitLine.style.width = gantt.parsedOptions.verticalSplitLine.lineWidth + 'px';
28299
+ verticalSplitLine.style.height = '100%';
28300
+ verticalSplitLine.style.backgroundColor = gantt.parsedOptions.verticalSplitLine.lineColor;
28301
+ verticalSplitLine.style.zIndex = '100';
28302
+ verticalSplitLine.style.userSelect = 'none';
28303
+ verticalSplitLine.style.pointerEvents = 'none';
28304
+ verticalSplitLine.style.transition = 'background-color 0.3s';
28305
+ gantt.verticalSplitResizeLine.appendChild(verticalSplitLine);
28306
+ if (gantt.parsedOptions.verticalSplitLineHighlight) {
28307
+ const highlightLine = document.createElement('div');
28308
+ highlightLine.style.position = 'absolute';
28309
+ highlightLine.style.top = '0px';
28310
+ highlightLine.style.left = `${(14 - gantt.parsedOptions.verticalSplitLineHighlight.lineWidth ?? 2) / 2}px`;
28311
+ highlightLine.style.width = (gantt.parsedOptions.verticalSplitLineHighlight.lineWidth ?? 2) + 'px';
28312
+ highlightLine.style.height = '100%';
28313
+ highlightLine.style.backgroundColor = gantt.parsedOptions.verticalSplitLineHighlight.lineColor;
28314
+ highlightLine.style.zIndex = '100';
28315
+ highlightLine.style.cursor = 'col-resize';
28316
+ highlightLine.style.userSelect = 'none';
28317
+ highlightLine.style.pointerEvents = 'none';
28318
+ highlightLine.style.opacity = '0';
28319
+ highlightLine.style.transition = 'background-color 0.3s';
28320
+ gantt.verticalSplitResizeLine.appendChild(highlightLine);
28321
+ }
28322
+ gantt.container.appendChild(gantt.verticalSplitResizeLine);
28473
28323
  }
28474
- return !isScrollToTop$1(deltaY, state) && !isScrollToBottom$1(deltaY, state);
28475
28324
  }
28476
- function isHorizontalScrollable$1(deltaX, state) {
28477
- const totalWidth = state._gantt.getAllDateColsWidth() - state._gantt.scenegraph.width;
28478
- if (totalWidth === 0) {
28479
- return false;
28325
+ function updateSplitLineAndResizeLine(gantt) {
28326
+ if (gantt.verticalSplitResizeLine) {
28327
+ gantt.verticalSplitResizeLine.style.position = 'absolute';
28328
+ gantt.verticalSplitResizeLine.style.top = gantt.tableY + 'px';
28329
+ gantt.verticalSplitResizeLine.style.left = gantt.taskTableWidth
28330
+ ? `${gantt.taskTableWidth - 7 + gantt.parsedOptions.verticalSplitLine.lineWidth / 2}px`
28331
+ : '0px';
28332
+ gantt.verticalSplitResizeLine.style.width = '14px';
28333
+ gantt.verticalSplitResizeLine.style.height = gantt.drawHeight + 'px';
28334
+ gantt.verticalSplitResizeLine.style.backgroundColor = 'rgba(0,0,0,0)';
28335
+ gantt.verticalSplitResizeLine.style.zIndex = '100';
28336
+ gantt.parsedOptions.verticalSplitLineMoveable && (gantt.verticalSplitResizeLine.style.cursor = 'col-resize');
28337
+ gantt.verticalSplitResizeLine.style.userSelect = 'none';
28338
+ gantt.verticalSplitResizeLine.style.opacity = '1';
28339
+ const verticalSplitLine = gantt.verticalSplitResizeLine.childNodes[0];
28340
+ verticalSplitLine.style.position = 'absolute';
28341
+ verticalSplitLine.style.top = '0px';
28342
+ verticalSplitLine.style.left = `${(14 - gantt.parsedOptions.verticalSplitLine.lineWidth) / 2}px`;
28343
+ verticalSplitLine.style.width = gantt.parsedOptions.verticalSplitLine.lineWidth + 'px';
28344
+ verticalSplitLine.style.height = '100%';
28345
+ verticalSplitLine.style.backgroundColor = gantt.parsedOptions.verticalSplitLine.lineColor;
28346
+ verticalSplitLine.style.zIndex = '100';
28347
+ verticalSplitLine.style.userSelect = 'none';
28348
+ verticalSplitLine.style.pointerEvents = 'none';
28349
+ verticalSplitLine.style.transition = 'background-color 0.3s';
28350
+ if (gantt.verticalSplitResizeLine.childNodes[1]) {
28351
+ const highlightLine = gantt.verticalSplitResizeLine.childNodes[1];
28352
+ highlightLine.style.position = 'absolute';
28353
+ highlightLine.style.top = '0px';
28354
+ highlightLine.style.left = `${(14 - gantt.parsedOptions.verticalSplitLineHighlight.lineWidth ?? 2) / 2}px`;
28355
+ highlightLine.style.width = (gantt.parsedOptions.verticalSplitLineHighlight.lineWidth ?? 2) + 'px';
28356
+ highlightLine.style.height = '100%';
28357
+ highlightLine.style.backgroundColor = gantt.parsedOptions.verticalSplitLineHighlight.lineColor;
28358
+ highlightLine.style.zIndex = '100';
28359
+ highlightLine.style.cursor = 'col-resize';
28360
+ highlightLine.style.userSelect = 'none';
28361
+ highlightLine.style.pointerEvents = 'none';
28362
+ highlightLine.style.opacity = '0';
28363
+ highlightLine.style.transition = 'background-color 0.3s';
28364
+ }
28480
28365
  }
28481
- return !isScrollToLeft$1(deltaX, state) && !isScrollToRight$1(deltaX, state);
28482
28366
  }
28483
- function isScrollToTop$1(deltaY, state) {
28484
- const totalHeight = state._gantt.getAllRowsHeight() - state._gantt.scenegraph.height;
28485
- return totalHeight !== 0 && deltaY <= 0 && state.scroll.verticalBarPos < 1;
28367
+ function findRecordByTaskKey(records, taskKeyField, taskKey, childrenField = 'children') {
28368
+ for (let i = 0; i < records.length; i++) {
28369
+ if ((Array.isArray(taskKey) && taskKey.length === 1 && records[i][taskKeyField] === taskKey[0]) ||
28370
+ records[i][taskKeyField] === taskKey) {
28371
+ return { record: records[i], index: [i] };
28372
+ }
28373
+ else if (records[i][childrenField]?.length) {
28374
+ if (Array.isArray(taskKey) && taskKey[0] === records[i][taskKeyField]) {
28375
+ const result = findRecordByTaskKey(records[i][childrenField], taskKeyField, taskKey.slice(1));
28376
+ if (result) {
28377
+ result.index.unshift(i);
28378
+ return result;
28379
+ }
28380
+ }
28381
+ else if (!Array.isArray(taskKey)) {
28382
+ const result = findRecordByTaskKey(records[i][childrenField], taskKeyField, taskKey);
28383
+ if (result) {
28384
+ result.index.unshift(i);
28385
+ return result;
28386
+ }
28387
+ }
28388
+ }
28389
+ }
28486
28390
  }
28487
- function isScrollToBottom$1(deltaY, state) {
28488
- const totalHeight = state._gantt.getAllRowsHeight() - state._gantt.scenegraph.height;
28489
- return totalHeight !== 0 && deltaY >= 0 && Math.abs(state.scroll.verticalBarPos - totalHeight) < 1;
28391
+ function clearRecordLinkInfos(records, childrenField = 'children') {
28392
+ for (let i = 0; i < records.length; i++) {
28393
+ if (records[i][childrenField]?.length) {
28394
+ clearRecordLinkInfos(records[i][childrenField], childrenField);
28395
+ }
28396
+ else {
28397
+ delete records[i].vtable_gantt_linkedTo;
28398
+ delete records[i].vtable_gantt_linkedFrom;
28399
+ }
28400
+ }
28490
28401
  }
28491
- function isScrollToLeft$1(deltaX, state) {
28492
- const totalWidth = state._gantt.getAllDateColsWidth() - state._gantt.scenegraph.width;
28493
- return totalWidth !== 0 && deltaX <= 0 && state.scroll.horizontalBarPos < 1;
28402
+ function clearRecordShowIndex(records, childrenField = 'children') {
28403
+ for (let i = 0; i < records.length; i++) {
28404
+ if (records[i][childrenField]?.length) {
28405
+ clearRecordShowIndex(records[i][childrenField], childrenField);
28406
+ }
28407
+ else {
28408
+ delete records[i].vtable_gantt_showIndex;
28409
+ }
28410
+ }
28494
28411
  }
28495
- function isScrollToRight$1(deltaX, state) {
28496
- const totalWidth = state._gantt.getAllDateColsWidth() - state._gantt.scenegraph.width;
28497
- return totalWidth !== 0 && deltaX >= 0 && Math.abs(state.scroll.horizontalBarPos - totalWidth) < 1;
28412
+ function getTaskIndexsByTaskY(y, gantt) {
28413
+ let task_index;
28414
+ let sub_task_index;
28415
+ if (gantt.taskListTableInstance) {
28416
+ const rowInfo = gantt.taskListTableInstance.getTargetRowAt(y + gantt.headerHeight);
28417
+ if (rowInfo) {
28418
+ const { row } = rowInfo;
28419
+ task_index = row - gantt.taskListTableInstance.columnHeaderLevelCount;
28420
+ const beforeRowsHeight = gantt.getRowsHeightByIndex(0, task_index - 1);
28421
+ if (gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Inline ||
28422
+ gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Arrange ||
28423
+ gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Compact ||
28424
+ gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Separate) {
28425
+ sub_task_index = Math.floor((y - beforeRowsHeight) / gantt.parsedOptions.rowHeight);
28426
+ }
28427
+ }
28428
+ }
28429
+ else {
28430
+ task_index = Math.floor(y / gantt.parsedOptions.rowHeight);
28431
+ }
28432
+ return { task_index, sub_task_index };
28498
28433
  }
28499
- function bindScrollBarListener$1(eventManager) {
28500
- const table = eventManager._gantt;
28501
- const stateManager = table.stateManager;
28502
- const scenegraph = table.scenegraph;
28503
- scenegraph.scrollbarComponent.vScrollBar.addEventListener('pointerover', (e) => {
28504
- scenegraph.scrollbarComponent.showVerticalScrollBar();
28505
- });
28506
- scenegraph.scrollbarComponent.hScrollBar.addEventListener('pointerover', (e) => {
28507
- scenegraph.scrollbarComponent.showHorizontalScrollBar();
28508
- });
28509
- scenegraph.scrollbarComponent.vScrollBar.addEventListener('pointerout', (e) => {
28510
- if (stateManager.interactionState === InteractionState$1.scrolling) {
28511
- return;
28434
+ function computeRowsCountByRecordDateForCompact(gantt, record) {
28435
+ if (!record.children || record.children.length === 1) {
28436
+ if (record.children?.length === 1) {
28437
+ record.children[0].vtable_gantt_showIndex = 0;
28512
28438
  }
28513
- scenegraph.scrollbarComponent.hideVerticalScrollBar();
28514
- });
28515
- scenegraph.scrollbarComponent.hScrollBar.addEventListener('pointerout', (e) => {
28516
- if (stateManager.interactionState === InteractionState$1.scrolling) {
28517
- return;
28439
+ else {
28440
+ record.vtable_gantt_showIndex = 0;
28518
28441
  }
28519
- scenegraph.scrollbarComponent.hideHorizontalScrollBar();
28520
- });
28521
- scenegraph.scrollbarComponent.vScrollBar.addEventListener('pointermove', (e) => {
28522
- e.stopPropagation();
28523
- });
28524
- scenegraph.scrollbarComponent.vScrollBar.addEventListener('scrollDown', (e) => {
28525
- scenegraph._gantt.eventManager.isDown = true;
28442
+ return 1;
28443
+ }
28444
+ const sortedChildren = record.children.slice().sort((a, b) => {
28445
+ const { startDate: aStartDate } = formatRecordDateConsiderHasHour(gantt, a);
28446
+ const { startDate: bStartDate } = formatRecordDateConsiderHasHour(gantt, b);
28447
+ return aStartDate.getTime() - bStartDate.getTime();
28526
28448
  });
28527
- scenegraph.scrollbarComponent.vScrollBar.addEventListener('pointerup', () => {
28528
- scenegraph._gantt.eventManager.isDraging = false;
28529
- if (stateManager.interactionState === InteractionState$1.scrolling) {
28530
- stateManager.updateInteractionState(InteractionState$1.default);
28449
+ const rows = [];
28450
+ for (let i = 0; i <= sortedChildren.length - 1; i++) {
28451
+ const newRecord = sortedChildren[i];
28452
+ const { startDate, endDate } = formatRecordDateConsiderHasHour(gantt, newRecord);
28453
+ let placed = false;
28454
+ for (let j = 0; j < rows.length; j++) {
28455
+ if (startDate.getTime() > rows[j]) {
28456
+ rows[j] = endDate.getTime();
28457
+ placed = true;
28458
+ newRecord.vtable_gantt_showIndex = j;
28459
+ break;
28460
+ }
28531
28461
  }
28532
- });
28533
- scenegraph.scrollbarComponent.vScrollBar.addEventListener('pointerupoutside', () => {
28534
- if (stateManager.interactionState === InteractionState$1.scrolling) {
28535
- stateManager.updateInteractionState(InteractionState$1.default);
28462
+ if (!placed) {
28463
+ rows.push(endDate.getTime());
28464
+ newRecord.vtable_gantt_showIndex = rows.length - 1;
28536
28465
  }
28466
+ }
28467
+ return rows.length;
28468
+ }
28469
+ function isOverlapping(startDate, endDate, rowTasks, gantt) {
28470
+ return rowTasks.some(rowTask => {
28471
+ const { startDate: startDate2, endDate: endDate2 } = formatRecordDateConsiderHasHour(gantt, rowTask);
28472
+ return startDate <= endDate2 && startDate2 <= endDate;
28537
28473
  });
28538
- scenegraph.scrollbarComponent.vScrollBar.addEventListener('scrollUp', (e) => {
28539
- scenegraph._gantt.eventManager.isDraging = false;
28540
- });
28541
- scenegraph.scrollbarComponent.hScrollBar.addEventListener('pointermove', (e) => {
28542
- e.stopPropagation();
28543
- });
28544
- scenegraph.scrollbarComponent.hScrollBar.addEventListener('pointerdown', (e) => {
28545
- e.stopPropagation();
28546
- });
28547
- scenegraph.scrollbarComponent.hScrollBar.addEventListener('scrollDown', (e) => {
28548
- scenegraph._gantt.eventManager.isDown = true;
28549
- if (stateManager.interactionState !== InteractionState$1.scrolling) {
28550
- stateManager.updateInteractionState(InteractionState$1.scrolling);
28474
+ }
28475
+ function computeRowsCountByRecordDate(gantt, record) {
28476
+ if (!record.children || record.children.length === 1) {
28477
+ if (record.children?.length === 1) {
28478
+ record.children[0].vtable_gantt_showIndex = 0;
28551
28479
  }
28552
- });
28553
- scenegraph.scrollbarComponent.hScrollBar.addEventListener('pointerup', () => {
28554
- if (stateManager.interactionState === InteractionState$1.scrolling) {
28555
- stateManager.updateInteractionState(InteractionState$1.default);
28480
+ else {
28481
+ record.vtable_gantt_showIndex = 0;
28556
28482
  }
28557
- });
28558
- scenegraph.scrollbarComponent.hScrollBar.addEventListener('pointerupoutside', () => {
28559
- if (stateManager.interactionState === InteractionState$1.scrolling) {
28560
- stateManager.updateInteractionState(InteractionState$1.default);
28483
+ return 1;
28484
+ }
28485
+ const rows = [];
28486
+ for (let i = 0; i <= record.children.length - 1; i++) {
28487
+ const newRecord = record.children[i];
28488
+ const { startDate, endDate } = formatRecordDateConsiderHasHour(gantt, newRecord);
28489
+ let placed = false;
28490
+ for (let j = 0; j < rows.length; j++) {
28491
+ const rowTasks = record.children.filter((t) => t !== newRecord && t.vtable_gantt_showIndex === j);
28492
+ if (!isOverlapping(startDate, endDate, rowTasks, gantt)) {
28493
+ rows[j] = endDate.getTime();
28494
+ placed = true;
28495
+ newRecord.vtable_gantt_showIndex = j;
28496
+ break;
28497
+ }
28561
28498
  }
28562
- });
28563
- scenegraph.scrollbarComponent.hScrollBar.addEventListener('scrollUp', (e) => {
28564
- scenegraph._gantt.eventManager.isDraging = false;
28565
- });
28566
- const throttleVerticalWheel = throttle$1(stateManager.updateVerticalScrollBar, 20);
28567
- const throttleHorizontalWheel = throttle$1(stateManager.updateHorizontalScrollBar, 20);
28568
- scenegraph.scrollbarComponent.vScrollBar.addEventListener('scrollDrag', (e) => {
28569
- if (scenegraph._gantt.eventManager.isDown) {
28570
- scenegraph._gantt.eventManager.isDraging = true;
28499
+ if (!placed) {
28500
+ rows.push(endDate.getTime());
28501
+ newRecord.vtable_gantt_showIndex = rows.length - 1;
28571
28502
  }
28572
- if (stateManager.interactionState !== InteractionState$1.scrolling) {
28573
- stateManager.updateInteractionState(InteractionState$1.scrolling);
28503
+ }
28504
+ return rows.length;
28505
+ }
28506
+ function formatRecordDateConsiderHasHour(gantt, record) {
28507
+ const { timeScaleIncludeHour, startDateField, endDateField } = gantt.parsedOptions;
28508
+ const startDate = record[startDateField];
28509
+ const endDate = record[endDateField];
28510
+ if (timeScaleIncludeHour) {
28511
+ return { startDate: createDateAtMidnight(startDate), endDate: createDateAtLastHour(endDate) };
28512
+ }
28513
+ return { startDate: createDateAtMidnight(startDate, true), endDate: createDateAtLastHour(endDate, true) };
28514
+ }
28515
+ function updateOptionsWhenRecordChanged(gantt) {
28516
+ const options = gantt.options;
28517
+ const { unit: minTimeUnit, startOfWeek } = gantt.parsedOptions.reverseSortedTimelineScales[0];
28518
+ gantt.parsedOptions.markLine = generateMarkLine(options?.markLine);
28519
+ if (gantt.parsedOptions.markLine?.length ?? 0) {
28520
+ if (gantt.parsedOptions.markLine?.every(item => item.scrollToMarkLine === undefined)) {
28521
+ gantt.parsedOptions.markLine[0].scrollToMarkLine = true;
28574
28522
  }
28575
- const ratio = e.detail.value[0] / (1 - e.detail.value[1] + e.detail.value[0]);
28576
- throttleVerticalWheel(ratio, e);
28577
- });
28578
- scenegraph.scrollbarComponent.hScrollBar.addEventListener('scrollDrag', (e) => {
28579
- if (scenegraph._gantt.eventManager.isDown) {
28580
- scenegraph._gantt.eventManager.isDraging = true;
28523
+ if (gantt.parsedOptions.markLine?.find(item => item.scrollToMarkLine)) {
28524
+ gantt.parsedOptions.scrollToMarkLineDate = getStartDateByTimeUnit(new Date(gantt.parsedOptions.markLine?.find(item => item.scrollToMarkLine).date), minTimeUnit, startOfWeek);
28581
28525
  }
28582
- stateManager.fastScrolling = true;
28583
- if (stateManager.interactionState !== InteractionState$1.scrolling) {
28584
- stateManager.updateInteractionState(InteractionState$1.scrolling);
28526
+ }
28527
+ gantt.parsedOptions.dependencyLinks = options.dependency?.links;
28528
+ }
28529
+ function updateOptionsWhenDateRangeChanged(gantt) {
28530
+ const options = gantt.options;
28531
+ const { unit: minTimeUnit, startOfWeek, step } = gantt.parsedOptions.reverseSortedTimelineScales[0];
28532
+ gantt.parsedOptions.minDate = options?.minDate
28533
+ ? getStartDateByTimeUnit(new Date(options.minDate), minTimeUnit, startOfWeek)
28534
+ : undefined;
28535
+ gantt.parsedOptions.maxDate = options?.maxDate
28536
+ ? getEndDateByTimeUnit(gantt.parsedOptions.minDate, new Date(options.maxDate), minTimeUnit, step)
28537
+ : undefined;
28538
+ gantt.parsedOptions._minDateTime = gantt.parsedOptions.minDate?.getTime();
28539
+ gantt.parsedOptions._maxDateTime = gantt.parsedOptions.maxDate?.getTime();
28540
+ }
28541
+ function updateOptionsWhenMarkLineChanged(gantt) {
28542
+ const options = gantt.options;
28543
+ gantt.parsedOptions.markLine = generateMarkLine(options?.markLine);
28544
+ }
28545
+ function _getTaskInfoByXYForCreateSchedule(eventX, eventY, gantt) {
28546
+ const taskIndex = getTaskIndexsByTaskY(eventY - gantt.headerHeight + gantt.stateManager.scrollTop, gantt);
28547
+ const recordParent = gantt.getRecordByIndex(taskIndex.task_index);
28548
+ const dateIndex = getDateIndexByX(eventX, gantt);
28549
+ const dateRange = gantt.getDateRangeByIndex(dateIndex);
28550
+ if (recordParent?.children) {
28551
+ const taskIndex = getTaskIndexsByTaskY(eventY - gantt.headerHeight + gantt.stateManager.scrollTop, gantt);
28552
+ for (let i = 0; i < recordParent.children.length; i++) {
28553
+ const { startDate, endDate, taskDays, progress, taskRecord } = gantt.getTaskInfoByTaskListIndex(taskIndex.task_index, i);
28554
+ if (((gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Compact ||
28555
+ gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Arrange) &&
28556
+ taskRecord.vtable_gantt_showIndex === taskIndex.sub_task_index) ||
28557
+ gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Inline) {
28558
+ if (dateRange.startDate.getTime() >= startDate.getTime() && dateRange.endDate.getTime() <= endDate.getTime()) {
28559
+ return { startDate, endDate, taskDays, progress, taskRecord };
28560
+ }
28561
+ }
28585
28562
  }
28586
- const ratio = e.detail.value[0] / (1 - e.detail.value[1] + e.detail.value[0]);
28587
- throttleHorizontalWheel(ratio);
28563
+ }
28564
+ }
28565
+ function getNodeClickPos(marklineIconNode, gantt) {
28566
+ const left = marklineIconNode.globalTransMatrix.e +
28567
+ gantt.taskListTableInstance.tableNoFrameWidth +
28568
+ gantt.taskListTableInstance.tableX +
28569
+ gantt.tableX;
28570
+ const top = marklineIconNode.globalTransMatrix.f;
28571
+ const width = marklineIconNode.attribute.width;
28572
+ const height = marklineIconNode.attribute.height;
28573
+ return {
28574
+ left,
28575
+ top,
28576
+ width,
28577
+ height
28578
+ };
28579
+ }
28580
+ function judgeIfHasMarkLine(data, markLine) {
28581
+ const beginTime = data.startDate.getTime();
28582
+ const endTime = data.endDate.getTime();
28583
+ return markLine.some(item => {
28584
+ const marklineTime = new Date(item.date).getTime();
28585
+ return marklineTime >= beginTime && marklineTime <= endTime;
28588
28586
  });
28589
28587
  }
28590
28588
 
@@ -36959,7 +36957,7 @@
36959
36957
  }
36960
36958
  function getCellCornerRadius(col, row, table) {
36961
36959
  const tableCornerRadius = table.theme.frameStyle.cornerRadius;
36962
- if (Array.isArray(tableCornerRadius)) {
36960
+ if (table.theme.cellInnerBorder) if (Array.isArray(tableCornerRadius)) {
36963
36961
  if (0 === col && 0 === row) return [tableCornerRadius[0], 0, 0, 0];
36964
36962
  if (col === table.colCount - 1 && 0 === row) return [0, tableCornerRadius[1], 0, 0];
36965
36963
  if (0 === col && row === table.rowCount - 1) return [0, 0, 0, tableCornerRadius[3]];
@@ -42127,12 +42125,12 @@
42127
42125
  isWidthNumber = !Array.isArray(strokeArrayWidth),
42128
42126
  isStrokeTrue = !Array.isArray(stroke),
42129
42127
  isSplitDraw = Array.isArray(strokeArrayColor) || widthInfo.isSplitDraw;
42130
- context.setStrokeStyle(rect, rect.attribute, x, y, rectAttribute);
42128
+ context.stroke(), context.setStrokeStyle(rect, rect.attribute, x, y, rectAttribute);
42131
42129
  const {
42132
42130
  lineDash = groupAttribute.lineDash
42133
42131
  } = group.attribute;
42134
42132
  let isDash = !1;
42135
- lineDash.length && lineDash.some(dash => Array.isArray(dash)) && (isDash = !0), context.moveTo(x, y);
42133
+ lineDash.length && lineDash.some(dash => Array.isArray(dash)) && (isDash = !0), context.beginPath(), context.moveTo(x, y);
42136
42134
  const strokeTop = (isStrokeTrue || stroke[0]) && (isWidthNumber || strokeArrayWidth[0]),
42137
42135
  strokeRight = (isStrokeTrue || stroke[1]) && (isWidthNumber || strokeArrayWidth[1]),
42138
42136
  strokeBottom = (isStrokeTrue || stroke[2]) && (isWidthNumber || strokeArrayWidth[2]),
@@ -42153,7 +42151,7 @@
42153
42151
  isWidthNumber ? widthInfo.width : strokeArrayWidth[3], isWidthNumber ? widthInfo.width : strokeArrayWidth[3];
42154
42152
  context.moveTo(x1, y1), context.lineTo(x2, y2), (isSplitDraw || isDash) && (strokeArrayColor && strokeArrayColor[3] ? context.strokeStyle = strokeArrayColor[3] : strokeArrayColor && !strokeArrayColor[3] && (context.strokeStyle = "transparent"), isWidthNumber || (context.lineWidth = strokeArrayWidth[3]), context.lineDashOffset = context.currentMatrix.f / context.currentMatrix.d, isDash && context.setLineDash(null !== (_d = lineDash[3]) && void 0 !== _d ? _d : []), context.stroke(), context.beginPath(), context.moveTo(x, y));
42155
42153
  } else 3 === i && context.moveTo(x, y);
42156
- isSplitDraw || isDash || (!isWidthNumber && widthInfo.width && (context.lineWidth = widthInfo.width), context.stroke()), context.lineDashOffset = 0, context.setLineDash([]), context.closePath();
42154
+ context.closePath(), isSplitDraw || isDash || (!isWidthNumber && widthInfo.width && (context.lineWidth = widthInfo.width), context.stroke()), context.lineDashOffset = 0, context.setLineDash([]), context.beginPath();
42157
42155
  }
42158
42156
 
42159
42157
  var __decorate$1 = undefined && undefined.__decorate || function (decorators, target, key, desc) {
@@ -43537,7 +43535,7 @@
43537
43535
  };
43538
43536
  class SceneProxy {
43539
43537
  constructor(table) {
43540
- this.isRelease = !1, this.mode = "column", this.rowLimit = 200, this.currentRow = 0, this.rowStart = 0, this.rowEnd = 0, this.referenceRow = 0, this.screenTopRow = 0, this.deltaY = 0, this.deltaHeight = 0, this.colLimit = 100, this.screenLeftCol = 0, this.deltaX = 0, this.deltaWidth = 0, this.cellCache = new Map(), this.table = table, this.table.isPivotChart() ? (this.rowLimit = Math.max(100, Math.ceil(2 * table.tableNoFrameHeight / table.defaultRowHeight)), this.colLimit = Math.max(100, Math.ceil(2 * table.tableNoFrameWidth / table.defaultColWidth))) : this.table.isAutoRowHeight() ? this.rowLimit = Math.max(100, Math.ceil(2 * table.tableNoFrameHeight / table.defaultRowHeight)) : ("autoWidth" === this.table.widthMode || (this.rowLimit = Math.max(200, Math.ceil(2 * table.tableNoFrameHeight / table.defaultRowHeight))), this.colLimit = Math.max(100, Math.ceil(2 * table.tableNoFrameWidth / table.defaultColWidth))), this.table.internalProps.transpose ? this.mode = "row" : this.table.isPivotTable() && (this.mode = "pivot"), this.table.options.maintainedDataCount && (this.rowLimit = this.table.options.maintainedDataCount);
43538
+ this.isRelease = !1, this.mode = "column", this.rowLimit = 200, this.currentRow = 0, this.rowStart = 0, this.rowEnd = 0, this.referenceRow = 0, this.screenTopRow = 0, this.deltaY = 0, this.deltaHeight = 0, this.colLimit = 100, this.screenLeftCol = 0, this.deltaX = 0, this.deltaWidth = 0, this.cellCache = new Map(), this.table = table, this.table.isPivotChart() ? (this.rowLimit = Math.max(100, Math.ceil(2 * table.tableNoFrameHeight / table.defaultRowHeight)), this.colLimit = Math.max(100, Math.ceil(2 * table.tableNoFrameWidth / table.defaultColWidth))) : this.table.isAutoRowHeight() ? this.rowLimit = Math.max(100, Math.ceil(2 * table.tableNoFrameHeight / table.defaultRowHeight)) : ("autoWidth" === this.table.widthMode || (this.rowLimit = Math.max(200, Math.ceil(2 * table.tableNoFrameHeight / table.defaultRowHeight))), this.colLimit = Math.max(100, Math.ceil(2 * table.tableNoFrameWidth / table.defaultColWidth))), this.table.internalProps.transpose ? this.mode = "row" : this.table.isPivotTable() && (this.mode = "pivot"), this.table.options.maintainedDataCount && (this.rowLimit = this.table.options.maintainedDataCount), this.table.options.maintainedColumnCount && (this.colLimit = this.table.options.maintainedColumnCount);
43541
43539
  }
43542
43540
  get bodyLeftCol() {
43543
43541
  return this.table.frozenColCount;
@@ -44044,7 +44042,7 @@
44044
44042
  }
44045
44043
  isExtend && extendSelectRange();
44046
44044
  };
44047
- ifExtendSelectRange && extendSelectRange(), scene.selectingRangeComponents.forEach((selectComp, key) => {
44045
+ ifExtendSelectRange && (extendSelectRange(), selectRange.start.col > selectRange.end.col ? (selectRange.start.col = Math.max(startCol, endCol), selectRange.end.col = Math.min(startCol, endCol)) : (selectRange.start.col = Math.min(startCol, endCol), selectRange.end.col = Math.max(startCol, endCol)), selectRange.start.row > selectRange.end.row ? (selectRange.start.row = Math.max(startRow, endRow), selectRange.end.row = Math.min(startRow, endRow)) : (selectRange.start.row = Math.min(startRow, endRow), selectRange.end.row = Math.max(startRow, endRow))), scene.selectingRangeComponents.forEach((selectComp, key) => {
44048
44046
  var _a;
44049
44047
  selectComp.rect.delete(), null === (_a = selectComp.fillhandle) || void 0 === _a || _a.delete();
44050
44048
  }), scene.selectingRangeComponents = new Map();
@@ -44134,7 +44132,7 @@
44134
44132
  }
44135
44133
 
44136
44134
  function createCellSelectBorder(scene, start_Col, start_Row, end_Col, end_Row, selectRangeType, selectId, strokes) {
44137
- var _a, _b, _c, _d, _e, _f, _g, _h;
44135
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
44138
44136
  let isHasFillHandleRect = !!(null === (_a = scene.table.options.excelOptions) || void 0 === _a ? void 0 : _a.fillHandle);
44139
44137
  if ((null === (_b = scene.table.stateManager.select.ranges) || void 0 === _b ? void 0 : _b.length) > 1) isHasFillHandleRect = !1, scene.removeFillHandleFromSelectComponents();else if (1 === (null === (_c = scene.table.stateManager.select.ranges) || void 0 === _c ? void 0 : _c.length)) {
44140
44138
  const maxRow = Math.max(scene.table.stateManager.select.ranges[0].start.row, scene.table.stateManager.select.ranges[0].end.row),
@@ -44160,7 +44158,8 @@
44160
44158
  y: firstCellBound.y1 - scene.tableGroup.attribute.y,
44161
44159
  width: 0,
44162
44160
  height: 0,
44163
- visible: !0
44161
+ visible: !0,
44162
+ cornerRadius: getCornerRadius(selectRangeType, null === (_j = scene.table.theme.frameStyle) || void 0 === _j ? void 0 : _j.cornerRadius, start_Col, start_Row, end_Col, end_Row, scene.table)
44164
44163
  });
44165
44164
  let fillhandle;
44166
44165
  isHasFillHandleRect && (fillhandle = createRect({
@@ -44178,6 +44177,15 @@
44178
44177
  role: selectRangeType
44179
44178
  }), scene.tableGroup.insertAfter(rect, "body" === selectRangeType ? scene.bodyGroup : "columnHeader" === selectRangeType ? scene.colHeaderGroup : "rowHeader" === selectRangeType ? scene.rowHeaderGroup : "cornerHeader" === selectRangeType ? scene.cornerHeaderGroup : "rightTopCorner" === selectRangeType ? scene.rightTopCornerGroup : "rightFrozen" === selectRangeType ? scene.rightFrozenGroup : "leftBottomCorner" === selectRangeType ? scene.leftBottomCornerGroup : "bottomFrozen" === selectRangeType ? scene.bottomFrozenGroup : scene.rightBottomCornerGroup), isHasFillHandleRect && scene.tableGroup.insertAfter(fillhandle, "body" === selectRangeType ? scene.bodyGroup : "columnHeader" === selectRangeType ? scene.colHeaderGroup : "rowHeader" === selectRangeType ? scene.rowHeaderGroup : "cornerHeader" === selectRangeType ? scene.cornerHeaderGroup : "rightTopCorner" === selectRangeType ? scene.rightTopCornerGroup : "rightFrozen" === selectRangeType ? scene.rightFrozenGroup : "leftBottomCorner" === selectRangeType ? scene.leftBottomCornerGroup : "bottomFrozen" === selectRangeType ? scene.bottomFrozenGroup : scene.rightBottomCornerGroup);
44180
44179
  }
44180
+ function getCornerRadius(selectRangeType, cornerRadius, start_Col, start_Row, end_Col, end_Row, table) {
44181
+ if (!cornerRadius) return;
44182
+ const cornerRadiusArray = Array.isArray(cornerRadius) ? cornerRadius : [cornerRadius, cornerRadius, cornerRadius, cornerRadius],
44183
+ tableEndCol = table.colCount - 1,
44184
+ tableEndRow = table.rowCount - 1,
44185
+ result = [0, 0, 0, 0];
44186
+ let changed = !1;
44187
+ return 0 === start_Col && 0 === start_Row ? (result[0] = cornerRadiusArray[0], changed = !0) : end_Col === tableEndCol && end_Row === tableEndRow ? (result[2] = cornerRadiusArray[2], changed = !0) : 0 === start_Col && end_Row === tableEndRow ? (result[3] = cornerRadiusArray[3], changed = !0) : end_Col === tableEndCol && 0 === start_Row && (result[1] = cornerRadiusArray[1], changed = !0), changed ? result : void 0;
44188
+ }
44181
44189
 
44182
44190
  function moveSelectingRangeComponentsToSelectedRangeComponents(scene) {
44183
44191
  scene.selectingRangeComponents.forEach((rangeComponent, key) => {
@@ -44273,7 +44281,7 @@
44273
44281
  const minRow = Math.min(...addRows);
44274
44282
  scene.proxy.rowUpdatePos = Math.min(minRow, scene.proxy.rowUpdatePos);
44275
44283
  }
44276
- scene.proxy.rowUpdateDirection = "down", scene.proxy.updateCellGroups(2 * scene.proxy.screenRowCount), updateBottomFrozeCellGroups();
44284
+ scene.proxy.rowUpdateDirection = "up", scene.proxy.updateCellGroups(2 * scene.proxy.screenRowCount), updateBottomFrozeCellGroups();
44277
44285
  } else removeRows.length && (setRowSeriesNumberCellNeedUpdate(removeRows[removeRows.length - 1], scene), scene.proxy.updateCellGroups(2 * scene.proxy.screenRowCount), updateBottomFrozeCellGroups());
44278
44286
  scene.proxy.progress();
44279
44287
  const newTotalHeight = table.getRowsHeight(table.frozenRowCount, table.rowCount - 1 - table.bottomFrozenRowCount);
@@ -44540,7 +44548,7 @@
44540
44548
  }
44541
44549
 
44542
44550
  function dealFrozen(scene) {
44543
- var _a, _b;
44551
+ var _a, _b, _c, _d;
44544
44552
  if (scene.table.frozenColCount > scene.table.rowHeaderLevelCount) {
44545
44553
  scene.rowHeaderGroup.setAttribute("height", scene.bodyGroup.attribute.height), scene.rowHeaderGroup.setAttribute("y", scene.bodyGroup.attribute.y), scene.cornerHeaderGroup.setAttribute("height", scene.colHeaderGroup.attribute.height);
44546
44554
  for (let i = 0; i < scene.table.frozenColCount - scene.table.rowHeaderLevelCount; i++) moveColumnFromBodyToRowHeader(scene), moveColumnFromColHeaderToCornerHeader(scene), moveColumnFromBottomToLeftBottomCorner(scene);
@@ -44548,10 +44556,10 @@
44548
44556
  scene.bodyGroup.setAttribute("height", scene.rowHeaderGroup.attribute.height), scene.bodyGroup.setAttribute("y", scene.rowHeaderGroup.attribute.y), scene.colHeaderGroup.setAttribute("height", scene.cornerHeaderGroup.attribute.height);
44549
44557
  for (let i = 0; i < scene.table.rowHeaderLevelCount - scene.table.frozenColCount; i++) moveColumnFromRowHeaderToBody(scene), moveColumnFromCornerHeaderToColHeader(scene), moveColumnFromLeftBottomCornerToBottom(scene);
44550
44558
  }
44551
- scene.bodyGroup.setAttribute("x", scene.rowHeaderGroup.attribute.width), scene.colHeaderGroup.setAttribute("x", scene.cornerHeaderGroup.attribute.width), scene.updateContainer(), scene.updateBorderSizeAndPosition(), scene.isPivot || scene.table.transpose ? scene.table.options.frozenColCount ? scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1) : scene.table.options.frozenColCount && scene.component.setRightFrozenColumnShadow(scene.table.colCount - scene.table.rightFrozenColCount) : (scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1), scene.component.setRightFrozenColumnShadow(scene.table.colCount - scene.table.rightFrozenColCount)), scene.hasFrozen = !0, scene.frozenColCount = scene.table.frozenColCount, scene.frozenRowCount = null !== (_b = null === (_a = scene.colHeaderGroup.firstChild) || void 0 === _a ? void 0 : _a.childrenCount) && void 0 !== _b ? _b : 0;
44559
+ scene.bodyGroup.setAttribute("x", scene.rowHeaderGroup.attribute.width), scene.colHeaderGroup.setAttribute("x", scene.cornerHeaderGroup.attribute.width), scene.updateContainer(), scene.updateBorderSizeAndPosition(), scene.isPivot || scene.table.transpose ? scene.table.options.frozenColCount ? scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1) : scene.table.options.frozenColCount && scene.component.setRightFrozenColumnShadow(scene.table.colCount - scene.table.rightFrozenColCount) : (scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1), scene.component.setRightFrozenColumnShadow(scene.table.colCount - scene.table.rightFrozenColCount)), scene.hasFrozen = !0, scene.frozenColCount = scene.table.frozenColCount, scene.frozenRowCount = null !== (_d = null !== (_b = null === (_a = scene.colHeaderGroup.firstChild) || void 0 === _a ? void 0 : _a.childrenCount) && void 0 !== _b ? _b : null === (_c = scene.cornerHeaderGroup.firstChild) || void 0 === _c ? void 0 : _c.childrenCount) && void 0 !== _d ? _d : scene.table.frozenRowCount;
44552
44560
  }
44553
44561
  function resetFrozen(scene) {
44554
- var _a, _b, _c, _d;
44562
+ var _a, _b, _c, _d, _e, _f;
44555
44563
  if (scene.frozenColCount > scene.table.frozenColCount) {
44556
44564
  scene.bodyGroup.setAttribute("height", scene.rowHeaderGroup.attribute.height), scene.bodyGroup.setAttribute("y", scene.rowHeaderGroup.attribute.y), scene.colHeaderGroup.setAttribute("height", scene.cornerHeaderGroup.attribute.height);
44557
44565
  for (let i = 0; i < scene.frozenColCount - scene.table.frozenColCount; i++) moveColumnFromRowHeaderToBody(scene), moveColumnFromCornerHeaderToColHeader(scene), moveColumnFromLeftBottomCornerToBottom(scene);
@@ -44559,7 +44567,7 @@
44559
44567
  scene.rowHeaderGroup.setAttribute("height", scene.bodyGroup.attribute.height), scene.rowHeaderGroup.setAttribute("y", scene.bodyGroup.attribute.y), scene.cornerHeaderGroup.setAttribute("height", scene.colHeaderGroup.attribute.height);
44560
44568
  for (let i = 0; i < scene.table.frozenColCount - scene.frozenColCount; i++) moveColumnFromBodyToRowHeader(scene), moveColumnFromColHeaderToCornerHeader(scene), moveColumnFromBottomToLeftBottomCorner(scene);
44561
44569
  }
44562
- updateReactComponentContainer(scene), scene.recreateAllSelectRangeComponents(), scene.frozenColCount = scene.table.frozenColCount, scene.frozenRowCount = null !== (_b = null === (_a = scene.colHeaderGroup.firstChild) || void 0 === _a ? void 0 : _a.childrenCount) && void 0 !== _b ? _b : 0, scene.proxy.colStart = null !== (_d = null === (_c = scene.bodyGroup.firstChild) || void 0 === _c ? void 0 : _c.col) && void 0 !== _d ? _d : scene.table.frozenColCount, scene.bodyGroup.setAttribute("x", scene.rowHeaderGroup.attribute.width), scene.colHeaderGroup.setAttribute("x", scene.cornerHeaderGroup.attribute.width), scene.updateContainer(), scene.updateBorderSizeAndPosition(), scene.isPivot || scene.table.transpose ? scene.table.options.frozenColCount ? scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1) : scene.table.options.rightFrozenColCount && scene.component.setRightFrozenColumnShadow(scene.table.colCount - scene.table.rightFrozenColCount) : (scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1), scene.component.setRightFrozenColumnShadow(scene.table.colCount - scene.table.rightFrozenColCount)), scene.hasFrozen = !0;
44570
+ updateReactComponentContainer(scene), scene.recreateAllSelectRangeComponents(), scene.frozenColCount = scene.table.frozenColCount, scene.frozenRowCount = null !== (_d = null !== (_b = null === (_a = scene.colHeaderGroup.firstChild) || void 0 === _a ? void 0 : _a.childrenCount) && void 0 !== _b ? _b : null === (_c = scene.cornerHeaderGroup.firstChild) || void 0 === _c ? void 0 : _c.childrenCount) && void 0 !== _d ? _d : scene.table.frozenRowCount, scene.proxy.colStart = null !== (_f = null === (_e = scene.bodyGroup.firstChild) || void 0 === _e ? void 0 : _e.col) && void 0 !== _f ? _f : scene.table.frozenColCount, scene.bodyGroup.setAttribute("x", scene.rowHeaderGroup.attribute.width), scene.colHeaderGroup.setAttribute("x", scene.cornerHeaderGroup.attribute.width), scene.updateContainer(), scene.updateBorderSizeAndPosition(), scene.isPivot || scene.table.transpose ? scene.table.options.frozenColCount ? scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1) : scene.table.options.rightFrozenColCount && scene.component.setRightFrozenColumnShadow(scene.table.colCount - scene.table.rightFrozenColCount) : (scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1), scene.component.setRightFrozenColumnShadow(scene.table.colCount - scene.table.rightFrozenColCount)), scene.hasFrozen = !0;
44563
44571
  }
44564
44572
  function moveColumnFromBodyToRowHeader(scene) {
44565
44573
  const column = scene.bodyGroup.firstChild instanceof Group$1 ? scene.bodyGroup.firstChild : null;
@@ -46411,7 +46419,7 @@
46411
46419
  } : table.getCellRange(col, row);
46412
46420
  currentRange.start.col < cellRange.end.col ? currentRange.end.col = cellRange.end.col : currentRange.start.col > cellRange.start.col && (currentRange.end.col = cellRange.start.col), currentRange.start.row < cellRange.end.row ? currentRange.end.row = cellRange.end.row : currentRange.start.row > cellRange.start.row && (currentRange.end.row = cellRange.start.row), "body" === state.select.headerSelectMode && (table.isRowHeader(col, row) ? (currentRange.start.col = table.rowHeaderLevelCount + table.leftRowSeriesNumberCount, currentRange.end.col = table.colCount - 1) : table.isColumnHeader(col, row) ? (currentRange.start.row = table.columnHeaderLevelCount, currentRange.end.row = table.rowCount - 1) : table.internalProps.layoutMap.isSeriesNumberInBody(col, row) ? (currentRange.start.col = table.leftRowSeriesNumberCount, currentRange.end.col = table.colCount - 1) : table.isCornerHeader(col, row) ? (currentRange.start.col = table.rowHeaderLevelCount + table.leftRowSeriesNumberCount, currentRange.start.row = table.columnHeaderLevelCount, currentRange.end.col = table.colCount - 1, currentRange.end.row = table.rowCount - 1) : table.isSeriesNumber(col, row) && (currentRange.start.col = table.leftRowSeriesNumberCount, currentRange.start.row = table.columnHeaderLevelCount, currentRange.end.col = table.colCount - 1, currentRange.end.row = table.rowCount - 1)), skipBodyMerge && (currentRange.skipBodyMerge = !0);
46413
46421
  }
46414
- scenegraph.updateCellSelectBorder(currentRange, extendSelectRange);
46422
+ currentRange && currentRange.start.row <= table.rowCount - 1 && currentRange.end.row <= table.rowCount - 1 && currentRange.start.col <= table.colCount - 1 && currentRange.end.col <= table.colCount - 1 && scenegraph.updateCellSelectBorder(currentRange, extendSelectRange);
46415
46423
  }
46416
46424
  }
46417
46425
  } else {
@@ -46609,7 +46617,7 @@
46609
46617
  }
46610
46618
  cellPos.col = col, cellPos.row = row;
46611
46619
  const currentRange = null === (_b = state.select.ranges) || void 0 === _b ? void 0 : _b[state.select.ranges.length - 1];
46612
- currentRange && scenegraph.updateCellSelectBorder(currentRange, extendSelectRange);
46620
+ currentRange && currentRange.start.row <= table.rowCount - 1 && currentRange.end.row <= table.rowCount - 1 && currentRange.start.col <= table.colCount - 1 && currentRange.end.col <= table.colCount - 1 && scenegraph.updateCellSelectBorder(currentRange, extendSelectRange);
46613
46621
  }
46614
46622
  }
46615
46623
  } else cellPos.col = -1, cellPos.row = -1, state.select.ranges = [], scenegraph.deleteAllSelectBorder();
@@ -47672,76 +47680,108 @@
47672
47680
  var _a, _b;
47673
47681
  const totalHeight = this.table.getAllRowsHeight(),
47674
47682
  oldVerticalBarPos = this.scroll.verticalBarPos;
47675
- this.scroll.verticalBarPos = Math.ceil(yRatio * (totalHeight - this.table.scenegraph.height)), isValid$3(this.scroll.verticalBarPos) && !isNaN(this.scroll.verticalBarPos) || (this.scroll.verticalBarPos = 0), this.table.scenegraph.setY(-this.scroll.verticalBarPos, 1 === yRatio), this.scroll.verticalBarPos -= this.table.scenegraph.proxy.deltaY, this.table.scenegraph.proxy.deltaY = 0, this.updateHoverPos(-1, -1), this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
47683
+ let verticalBarPos = Math.ceil(yRatio * (totalHeight - this.table.scenegraph.height));
47684
+ isValid$3(verticalBarPos) && !isNaN(verticalBarPos) || (verticalBarPos = 0);
47685
+ const dy = verticalBarPos - this.table.scenegraph.proxy.deltaY - oldVerticalBarPos;
47686
+ if (this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
47676
47687
  event: void 0,
47677
- scrollTop: this.scroll.verticalBarPos,
47688
+ scrollTop: verticalBarPos - this.table.scenegraph.proxy.deltaY,
47678
47689
  scrollLeft: this.scroll.horizontalBarPos,
47679
47690
  scrollHeight: null === (_a = this.table.theme.scrollStyle) || void 0 === _a ? void 0 : _a.width,
47680
47691
  scrollWidth: null === (_b = this.table.theme.scrollStyle) || void 0 === _b ? void 0 : _b.width,
47681
47692
  viewHeight: this.table.tableNoFrameHeight,
47682
47693
  viewWidth: this.table.tableNoFrameWidth,
47683
47694
  scrollDirection: "vertical",
47684
- scrollRatioY: yRatio
47685
- }), oldVerticalBarPos !== this.scroll.verticalBarPos && this.checkVerticalScrollBarEnd();
47695
+ scrollRatioY: yRatio,
47696
+ dy: dy
47697
+ }).some(value => !1 === value)) {
47698
+ const yRatio = this.scroll.verticalBarPos / (totalHeight - this.table.scenegraph.height);
47699
+ this.table.scenegraph.component.updateVerticalScrollBarPos(yRatio);
47700
+ } else this.scroll.verticalBarPos = verticalBarPos, this.table.scenegraph.setY(-this.scroll.verticalBarPos, 1 === yRatio), this.scroll.verticalBarPos -= this.table.scenegraph.proxy.deltaY, this.table.scenegraph.proxy.deltaY = 0, this.updateHoverPos(-1, -1), oldVerticalBarPos !== this.scroll.verticalBarPos && this.checkVerticalScrollBarEnd();
47686
47701
  }
47687
47702
  updateHorizontalScrollBar(xRatio) {
47688
47703
  var _a, _b;
47689
47704
  const totalWidth = this.table.getAllColsWidth(),
47690
47705
  oldHorizontalBarPos = this.scroll.horizontalBarPos;
47691
- this.scroll.horizontalBarPos = Math.ceil(xRatio * (totalWidth - this.table.scenegraph.width)), isValid$3(this.scroll.horizontalBarPos) && !isNaN(this.scroll.horizontalBarPos) || (this.scroll.horizontalBarPos = 0), this.table.scenegraph.setX(-this.scroll.horizontalBarPos, 1 === xRatio), this.scroll.horizontalBarPos -= this.table.scenegraph.proxy.deltaX, this.table.scenegraph.proxy.deltaX = 0, this.updateHoverPos(-1, -1), this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
47706
+ let horizontalBarPos = Math.ceil(xRatio * (totalWidth - this.table.scenegraph.width));
47707
+ isValid$3(horizontalBarPos) && !isNaN(horizontalBarPos) || (horizontalBarPos = 0);
47708
+ const dx = horizontalBarPos - this.table.scenegraph.proxy.deltaX - oldHorizontalBarPos;
47709
+ if (this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
47692
47710
  event: void 0,
47693
47711
  scrollTop: this.scroll.verticalBarPos,
47694
- scrollLeft: this.scroll.horizontalBarPos,
47712
+ scrollLeft: horizontalBarPos - this.table.scenegraph.proxy.deltaX,
47695
47713
  scrollHeight: null === (_a = this.table.theme.scrollStyle) || void 0 === _a ? void 0 : _a.width,
47696
47714
  scrollWidth: null === (_b = this.table.theme.scrollStyle) || void 0 === _b ? void 0 : _b.width,
47697
47715
  viewHeight: this.table.tableNoFrameHeight,
47698
47716
  viewWidth: this.table.tableNoFrameWidth,
47699
47717
  scrollDirection: "horizontal",
47700
- scrollRatioX: xRatio
47701
- }), oldHorizontalBarPos !== this.scroll.horizontalBarPos && this.checkHorizontalScrollBarEnd();
47718
+ scrollRatioX: xRatio,
47719
+ dx: dx
47720
+ }).some(value => !1 === value)) {
47721
+ const xRatio = this.scroll.horizontalBarPos / (totalWidth - this.table.scenegraph.width);
47722
+ this.table.scenegraph.component.updateHorizontalScrollBarPos(xRatio);
47723
+ } else this.scroll.horizontalBarPos = horizontalBarPos, this.table.scenegraph.setX(-this.scroll.horizontalBarPos, 1 === xRatio), this.scroll.horizontalBarPos -= this.table.scenegraph.proxy.deltaX, this.table.scenegraph.proxy.deltaX = 0, this.updateHoverPos(-1, -1), oldHorizontalBarPos !== this.scroll.horizontalBarPos && this.checkHorizontalScrollBarEnd();
47702
47724
  }
47703
47725
  setScrollTop(top, event) {
47704
47726
  let triggerEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
47705
- var _a, _b, _c;
47727
+ var _a, _b, _c, _d, _e;
47706
47728
  const totalHeight = this.table.getAllRowsHeight(),
47707
47729
  sizeTolerance = (null === (_a = this.table.options.customConfig) || void 0 === _a ? void 0 : _a._disableColumnAndRowSizeRound) ? 1 : 0;
47708
- top = Math.max(0, Math.min(top, totalHeight - this.table.scenegraph.height - sizeTolerance)), ((top = Math.ceil(top)) !== this.scroll.verticalBarPos || this.table.isPivotChart()) && this.updateHoverPos(-1, -1);
47709
- const oldVerticalBarPos = this.scroll.verticalBarPos;
47710
- this.scroll.verticalBarPos = top, isValid$3(this.scroll.verticalBarPos) && !isNaN(this.scroll.verticalBarPos) || (this.scroll.verticalBarPos = 0), this.table.scenegraph.setY(-top);
47711
- const yRatio = top / (totalHeight - this.table.scenegraph.height);
47712
- this.table.scenegraph.component.updateVerticalScrollBarPos(yRatio), oldVerticalBarPos !== top && triggerEvent && (this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
47713
- event: null == event ? void 0 : event.nativeEvent,
47714
- scrollTop: this.scroll.verticalBarPos,
47715
- scrollLeft: this.scroll.horizontalBarPos,
47716
- scrollHeight: null === (_b = this.table.theme.scrollStyle) || void 0 === _b ? void 0 : _b.width,
47717
- scrollWidth: null === (_c = this.table.theme.scrollStyle) || void 0 === _c ? void 0 : _c.width,
47718
- viewHeight: this.table.tableNoFrameHeight,
47719
- viewWidth: this.table.tableNoFrameWidth,
47720
- scrollDirection: "vertical",
47721
- scrollRatioY: yRatio
47722
- }), this.checkVerticalScrollBarEnd());
47730
+ top = Math.max(0, Math.min(top, totalHeight - this.table.scenegraph.height - sizeTolerance)), top = Math.ceil(top);
47731
+ const oldVerticalBarPos = this.scroll.verticalBarPos,
47732
+ yRatio = top / (totalHeight - this.table.scenegraph.height);
47733
+ if ((oldVerticalBarPos !== top || !0 === (null === (_c = null === (_b = this.table.options) || void 0 === _b ? void 0 : _b.customConfig) || void 0 === _c ? void 0 : _c.scrollEventAlwaysTrigger)) && triggerEvent) {
47734
+ let verticalBarPos = top;
47735
+ isValid$3(verticalBarPos) && !isNaN(verticalBarPos) || (verticalBarPos = 0);
47736
+ const dy = verticalBarPos - oldVerticalBarPos;
47737
+ if (this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
47738
+ event: null == event ? void 0 : event.nativeEvent,
47739
+ scrollTop: verticalBarPos,
47740
+ scrollLeft: this.scroll.horizontalBarPos,
47741
+ scrollHeight: null === (_d = this.table.theme.scrollStyle) || void 0 === _d ? void 0 : _d.width,
47742
+ scrollWidth: null === (_e = this.table.theme.scrollStyle) || void 0 === _e ? void 0 : _e.width,
47743
+ viewHeight: this.table.tableNoFrameHeight,
47744
+ viewWidth: this.table.tableNoFrameWidth,
47745
+ scrollDirection: "vertical",
47746
+ scrollRatioY: yRatio,
47747
+ dy: dy
47748
+ }).some(value => !1 === value)) {
47749
+ const yRatio = this.scroll.verticalBarPos / (totalHeight - this.table.scenegraph.height);
47750
+ return void this.table.scenegraph.component.updateVerticalScrollBarPos(yRatio);
47751
+ }
47752
+ }
47753
+ (top !== this.scroll.verticalBarPos || this.table.isPivotChart()) && this.updateHoverPos(-1, -1), this.scroll.verticalBarPos = top, isValid$3(this.scroll.verticalBarPos) && !isNaN(this.scroll.verticalBarPos) || (this.scroll.verticalBarPos = 0), this.table.scenegraph.setY(-top), this.table.scenegraph.component.updateVerticalScrollBarPos(yRatio), oldVerticalBarPos !== top && triggerEvent && this.checkVerticalScrollBarEnd();
47723
47754
  }
47724
47755
  setScrollLeft(left, event) {
47725
47756
  let triggerEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
47726
- var _a, _b, _c;
47757
+ var _a, _b, _c, _d, _e;
47727
47758
  this.table.scrollLeft;
47728
47759
  const totalWidth = this.table.getAllColsWidth(),
47729
47760
  sizeTolerance = (this.table.getFrozenColsWidth(), (null === (_a = this.table.options.customConfig) || void 0 === _a ? void 0 : _a._disableColumnAndRowSizeRound) ? 1 : 0);
47730
- left = Math.max(0, Math.min(left, totalWidth - this.table.scenegraph.width - sizeTolerance)), (left = Math.ceil(left)) !== this.scroll.horizontalBarPos && this.updateHoverPos(-1, -1);
47731
- const oldHorizontalBarPos = this.scroll.horizontalBarPos;
47732
- this.scroll.horizontalBarPos = left, isValid$3(this.scroll.horizontalBarPos) && !isNaN(this.scroll.horizontalBarPos) || (this.scroll.horizontalBarPos = 0), this.table.scenegraph.setX(-left);
47733
- const xRatio = left / (totalWidth - this.table.scenegraph.width);
47734
- this.table.scenegraph.component.updateHorizontalScrollBarPos(xRatio), oldHorizontalBarPos !== left && triggerEvent && (this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
47735
- event: null == event ? void 0 : event.nativeEvent,
47736
- scrollTop: this.scroll.verticalBarPos,
47737
- scrollLeft: this.scroll.horizontalBarPos,
47738
- scrollHeight: null === (_b = this.table.theme.scrollStyle) || void 0 === _b ? void 0 : _b.width,
47739
- scrollWidth: null === (_c = this.table.theme.scrollStyle) || void 0 === _c ? void 0 : _c.width,
47740
- viewHeight: this.table.tableNoFrameHeight,
47741
- viewWidth: this.table.tableNoFrameWidth,
47742
- scrollDirection: "horizontal",
47743
- scrollRatioX: xRatio
47744
- }), this.checkHorizontalScrollBarEnd());
47761
+ left = Math.max(0, Math.min(left, totalWidth - this.table.scenegraph.width - sizeTolerance)), left = Math.ceil(left);
47762
+ const oldHorizontalBarPos = this.scroll.horizontalBarPos,
47763
+ xRatio = left / (totalWidth - this.table.scenegraph.width);
47764
+ if ((oldHorizontalBarPos !== left || !0 === (null === (_c = null === (_b = this.table.options) || void 0 === _b ? void 0 : _b.customConfig) || void 0 === _c ? void 0 : _c.scrollEventAlwaysTrigger)) && triggerEvent) {
47765
+ let horizontalBarPos = left;
47766
+ isValid$3(horizontalBarPos) && !isNaN(horizontalBarPos) || (horizontalBarPos = 0);
47767
+ const dx = horizontalBarPos - oldHorizontalBarPos;
47768
+ if (this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
47769
+ event: null == event ? void 0 : event.nativeEvent,
47770
+ scrollTop: this.scroll.verticalBarPos,
47771
+ scrollLeft: horizontalBarPos,
47772
+ scrollHeight: null === (_d = this.table.theme.scrollStyle) || void 0 === _d ? void 0 : _d.width,
47773
+ scrollWidth: null === (_e = this.table.theme.scrollStyle) || void 0 === _e ? void 0 : _e.width,
47774
+ viewHeight: this.table.tableNoFrameHeight,
47775
+ viewWidth: this.table.tableNoFrameWidth,
47776
+ scrollDirection: "horizontal",
47777
+ scrollRatioX: xRatio,
47778
+ dx: dx
47779
+ }).some(value => !1 === value)) {
47780
+ const xRatio = this.scroll.horizontalBarPos / (totalWidth - this.table.scenegraph.width);
47781
+ return void this.table.scenegraph.component.updateHorizontalScrollBarPos(xRatio);
47782
+ }
47783
+ }
47784
+ left !== this.scroll.horizontalBarPos && this.updateHoverPos(-1, -1), this.scroll.horizontalBarPos = left, isValid$3(this.scroll.horizontalBarPos) && !isNaN(this.scroll.horizontalBarPos) || (this.scroll.horizontalBarPos = 0), this.table.scenegraph.setX(-left), this.table.scenegraph.component.updateHorizontalScrollBarPos(xRatio), oldHorizontalBarPos !== left && triggerEvent && this.checkHorizontalScrollBarEnd();
47745
47785
  }
47746
47786
  hideVerticalScrollBar() {
47747
47787
  this.table.scenegraph.component.hideVerticalScrollBar();
@@ -48374,7 +48414,7 @@
48374
48414
  callback: globalPointerdownCallback
48375
48415
  }), vglobal.addEventListener("pointerup", globalPointerupCallback), vglobal.addEventListener("pointerdown", globalPointerdownCallback), table.scenegraph.tableGroup.addEventListener("pointerdown", e => {
48376
48416
  var _a, _b, _c, _d, _e;
48377
- table.hasListeners(TABLE_EVENT_TYPE.MOUSEDOWN_TABLE) && table.fireListeners(TABLE_EVENT_TYPE.MOUSEDOWN_TABLE, {
48417
+ if (table.hasListeners(TABLE_EVENT_TYPE.MOUSEDOWN_TABLE) && table.fireListeners(TABLE_EVENT_TYPE.MOUSEDOWN_TABLE, {
48378
48418
  event: e.nativeEvent
48379
48419
  }), table.eventManager.isDown = !0, table.eventManager.LastBodyPointerXY = {
48380
48420
  x: e.x,
@@ -48382,7 +48422,7 @@
48382
48422
  }, table.eventManager.LastPointerXY = {
48383
48423
  x: e.x,
48384
48424
  y: e.y
48385
- };
48425
+ }, 0 !== e.button) return;
48386
48426
  const eventArgsSet = getCellEventArgsSet(e);
48387
48427
  if (eventManager.downIcon = void 0, stateManager.interactionState !== InteractionState.default) return;
48388
48428
  if (table.isPivotChart() && "chart" !== (null === (_a = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _a ? void 0 : _a.target.type) && table.scenegraph.updateChartState(null), (null === (_b = eventArgsSet.eventArgs) || void 0 === _b ? void 0 : _b.target) !== (null === (_c = stateManager.residentHoverIcon) || void 0 === _c ? void 0 : _c.icon) && stateManager.hideMenu(), "chart" === (null === (_d = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _d ? void 0 : _d.target.type)) return;
@@ -48958,7 +48998,7 @@
48958
48998
  }
48959
48999
  }), handler.on(table.getElement(), "contextmenu", e => {
48960
49000
  var _a;
48961
- !1 !== (null === (_a = table.eventOptions) || void 0 === _a ? void 0 : _a.preventDefaultContextMenu) && e.preventDefault();
49001
+ !1 !== (null === (_a = table.eventOptions) || void 0 === _a ? void 0 : _a.preventDefaultContextMenu) ? e.preventDefault() : globalPointerupCallback(e);
48962
49002
  }), table.options.canvas || handler.on(table.getContainer(), "resize", e => {
48963
49003
  var _a;
48964
49004
  table.isReleased || 0 === e.width && 0 === e.height || ((table.autoFillWidth || table.autoFillHeight) && (null === (_a = table.editorManager) || void 0 === _a || _a.completeEdit()), isValid$3(table.options.pixelRatio) || table.setPixelRatio(getPixelRatio$1()), e.windowSizeNotChange || table.resize());
@@ -49389,6 +49429,75 @@
49389
49429
  });
49390
49430
  }
49391
49431
 
49432
+ function bindIconClickEvent(table) {
49433
+ table.on(TABLE_EVENT_TYPE.ICON_CLICK, iconInfo => {
49434
+ var _a;
49435
+ const {
49436
+ col: col,
49437
+ row: row,
49438
+ x: x,
49439
+ y: y,
49440
+ funcType: funcType,
49441
+ icon: icon,
49442
+ event: event
49443
+ } = iconInfo,
49444
+ {
49445
+ stateManager: stateManager
49446
+ } = table;
49447
+ if (funcType === IconFuncTypeEnum.dropDown) stateManager.triggerDropDownMenu(col, row, x, y, event);else if (funcType === IconFuncTypeEnum.sort) stateManager.triggerSort(col, row, icon, event);else if (funcType === IconFuncTypeEnum.frozen) stateManager.triggerFreeze(col, row, icon);else if (funcType === IconFuncTypeEnum.drillDown) drillClick(table);else if (funcType === IconFuncTypeEnum.collapse || funcType === IconFuncTypeEnum.expand) {
49448
+ const isHasSelected = !!(null === (_a = stateManager.select.ranges) || void 0 === _a ? void 0 : _a.length);
49449
+ stateManager.updateSelectPos(-1, -1), stateManager.endSelectCells(!0, isHasSelected), table.toggleHierarchyState(col, row);
49450
+ }
49451
+ });
49452
+ }
49453
+
49454
+ function bindDropdownMenuClickEvent(table) {
49455
+ table.on(TABLE_EVENT_TYPE.DROPDOWN_MENU_CLICK, () => {
49456
+ table.stateManager.hideMenu();
49457
+ });
49458
+ }
49459
+
49460
+ function bindDBClickAutoColumnWidthEvent(table) {
49461
+ table.on(TABLE_EVENT_TYPE.DBLCLICK_CELL, e => {
49462
+ var _a, _b, _c;
49463
+ if (e.federatedEvent) {
49464
+ const eventArgsSet = getCellEventArgsSet(e.federatedEvent),
49465
+ resizeCol = table.scenegraph.getResizeColAt(eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y, null === (_a = eventArgsSet.eventArgs) || void 0 === _a ? void 0 : _a.targetCell),
49466
+ disableDblclickAutoResizeColWidth = null !== (_b = table.options.disableDblclickAutoResizeColWidth) && void 0 !== _b ? _b : null === (_c = table.options.resize) || void 0 === _c ? void 0 : _c.disableDblclickAutoResizeColWidth;
49467
+ if (table.eventManager.checkCellFillhandle(eventArgsSet)) table.fireListeners(TABLE_EVENT_TYPE.DBLCLICK_FILL_HANDLE, {});else if (table._canResizeColumn(resizeCol.col, resizeCol.row) && resizeCol.col >= 0 && !disableDblclickAutoResizeColWidth) {
49468
+ table.scenegraph.updateAutoColWidth(resizeCol.col), table.internalProps._widthResizedColMap.add(resizeCol.col), table.scenegraph.updateChartSizeForResizeColWidth(resizeCol.col);
49469
+ const state = table.stateManager;
49470
+ state.columnResize.col < state.table.frozenColCount && !state.table.isPivotTable() && !state.table.transpose && state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1, state.columnResize.isRightFrozen);
49471
+ const colWidths = [];
49472
+ for (let col = 0; col < table.colCount; col++) colWidths.push(table.getColWidth(col));
49473
+ table.fireListeners(TABLE_EVENT_TYPE.RESIZE_COLUMN_END, {
49474
+ col: resizeCol.col,
49475
+ colWidths: colWidths
49476
+ });
49477
+ }
49478
+ }
49479
+ });
49480
+ }
49481
+
49482
+ function rightButtonClickEvent(table) {
49483
+ table.on(TABLE_EVENT_TYPE.CONTEXTMENU_CELL, e => {
49484
+ const {
49485
+ col: col,
49486
+ row: row
49487
+ } = e,
49488
+ ranges = table.getSelectedCellRanges();
49489
+ let cellInRange = !1;
49490
+ if (ranges.length > 0) for (let i = 0; i < ranges.length; i++) {
49491
+ const range = ranges[i];
49492
+ if (col >= range.start.col && col <= range.end.col && row >= range.start.row && row <= range.end.row) {
49493
+ cellInRange = !0;
49494
+ break;
49495
+ }
49496
+ }
49497
+ cellInRange || table.selectCell(col, row);
49498
+ });
49499
+ }
49500
+
49392
49501
  let EventManager$1 = class EventManager {
49393
49502
  constructor(table) {
49394
49503
  this.isDown = !1, this.isDraging = !1, this.globalEventListeners = [], this._enableTableScroll = !0, this.table = table, this.handleTextStickBindId = [], this.inertiaScroll = new InertiaScroll(table.stateManager), "node" === Env.mode || table.options.disableInteraction || (this.bindOuterEvent(), setTimeout(() => {
@@ -49413,44 +49522,7 @@
49413
49522
  }, 0);
49414
49523
  }
49415
49524
  bindSelfEvent() {
49416
- if (this.table.isReleased) return;
49417
- const stateManager = this.table.stateManager;
49418
- this.table.on(TABLE_EVENT_TYPE.ICON_CLICK, iconInfo => {
49419
- var _a;
49420
- const {
49421
- col: col,
49422
- row: row,
49423
- x: x,
49424
- y: y,
49425
- funcType: funcType,
49426
- icon: icon,
49427
- event: event
49428
- } = iconInfo;
49429
- if (funcType === IconFuncTypeEnum.dropDown) stateManager.triggerDropDownMenu(col, row, x, y, event);else if (funcType === IconFuncTypeEnum.sort) stateManager.triggerSort(col, row, icon, event);else if (funcType === IconFuncTypeEnum.frozen) stateManager.triggerFreeze(col, row, icon);else if (funcType === IconFuncTypeEnum.drillDown) drillClick(this.table);else if (funcType === IconFuncTypeEnum.collapse || funcType === IconFuncTypeEnum.expand) {
49430
- const isHasSelected = !!(null === (_a = stateManager.select.ranges) || void 0 === _a ? void 0 : _a.length);
49431
- stateManager.updateSelectPos(-1, -1), stateManager.endSelectCells(!0, isHasSelected), this.table.toggleHierarchyState(col, row);
49432
- }
49433
- }), this.table.on(TABLE_EVENT_TYPE.DROPDOWN_MENU_CLICK, () => {
49434
- stateManager.hideMenu();
49435
- }), this.updateEventBinder(), bindMediaClick(this.table), this.table.on(TABLE_EVENT_TYPE.DBLCLICK_CELL, e => {
49436
- var _a, _b, _c;
49437
- if (e.federatedEvent) {
49438
- const eventArgsSet = getCellEventArgsSet(e.federatedEvent),
49439
- resizeCol = this.table.scenegraph.getResizeColAt(eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y, null === (_a = eventArgsSet.eventArgs) || void 0 === _a ? void 0 : _a.targetCell),
49440
- disableDblclickAutoResizeColWidth = null !== (_b = this.table.options.disableDblclickAutoResizeColWidth) && void 0 !== _b ? _b : null === (_c = this.table.options.resize) || void 0 === _c ? void 0 : _c.disableDblclickAutoResizeColWidth;
49441
- if (this.table.eventManager.checkCellFillhandle(eventArgsSet)) this.table.fireListeners(TABLE_EVENT_TYPE.DBLCLICK_FILL_HANDLE, {});else if (this.table._canResizeColumn(resizeCol.col, resizeCol.row) && resizeCol.col >= 0 && !disableDblclickAutoResizeColWidth) {
49442
- this.table.scenegraph.updateAutoColWidth(resizeCol.col), this.table.internalProps._widthResizedColMap.add(resizeCol.col), this.table.scenegraph.updateChartSizeForResizeColWidth(resizeCol.col);
49443
- const state = this.table.stateManager;
49444
- state.columnResize.col < state.table.frozenColCount && !state.table.isPivotTable() && !state.table.transpose && state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1, state.columnResize.isRightFrozen);
49445
- const colWidths = [];
49446
- for (let col = 0; col < this.table.colCount; col++) colWidths.push(this.table.getColWidth(col));
49447
- this.table.fireListeners(TABLE_EVENT_TYPE.RESIZE_COLUMN_END, {
49448
- col: resizeCol.col,
49449
- colWidths: colWidths
49450
- });
49451
- }
49452
- }
49453
- }), this.table.isPivotTable() && checkHaveDrill(this.table) && bindDrillEvent(this.table), bindSparklineHoverEvent(this.table), bindAxisClickEvent(this.table), bindAxisHoverEvent(this.table), bindGroupTitleCheckboxChange(this.table), bindButtonClickEvent(this.table);
49525
+ this.table.isReleased || (bindIconClickEvent(this.table), bindDropdownMenuClickEvent(this.table), this.updateEventBinder(), bindMediaClick(this.table), bindDBClickAutoColumnWidthEvent(this.table), this.table.isPivotTable() && checkHaveDrill(this.table) && bindDrillEvent(this.table), bindSparklineHoverEvent(this.table), bindAxisClickEvent(this.table), bindAxisHoverEvent(this.table), bindGroupTitleCheckboxChange(this.table), bindButtonClickEvent(this.table), rightButtonClickEvent(this.table));
49454
49526
  }
49455
49527
  dealTableHover(eventArgsSet) {
49456
49528
  if (!eventArgsSet) return void this.table.stateManager.updateHoverPos(-1, -1);
@@ -51902,15 +51974,14 @@
51902
51974
  } = getAxisOption(col, row, position, layout),
51903
51975
  range = getAxisRange(layout.dataset.collectedValues, indicatorKeys, isZeroAlign, path, null != seriesIndice ? seriesIndice : index);
51904
51976
  if (!range) return;
51905
- let ticks;
51906
- if (isPercent && (range.min = range.min < 0 ? -1 : 0, range.max = range.max > 0 ? 1 : 0), ((null == axisOption ? void 0 : axisOption.zero) || range.min === range.max) && (range.min = Math.min(range.min, 0), range.max = Math.max(range.max, 0)), (null == axisOption ? void 0 : axisOption.nice) || isTickAlign) {
51907
- const getAxisDomainRangeAndLabels = Factory.getFunction("getAxisDomainRangeAndLabels"),
51908
- {
51909
- range: axisRange,
51910
- ticks: selfTicks
51911
- } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign, "bottom" === position || "top" === position ? layout._table.getColWidth(col) || layout._table.tableNoFrameWidth : layout._table.getRowHeight(row) || layout._table.tableNoFrameHeight);
51912
- (null == axisOption ? void 0 : axisOption.nice) && (range.min = axisRange[0], range.max = axisRange[1]), ticks = selfTicks;
51913
- }
51977
+ isPercent && (range.min = range.min < 0 ? -1 : 0, range.max = range.max > 0 ? 1 : 0), ((null == axisOption ? void 0 : axisOption.zero) || range.min === range.max) && (range.min = Math.min(range.min, 0), range.max = Math.max(range.max, 0));
51978
+ const getAxisDomainRangeAndLabels = Factory.getFunction("getAxisDomainRangeAndLabels"),
51979
+ {
51980
+ range: axisRange,
51981
+ ticks: selfTicks
51982
+ } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign, "bottom" === position || "top" === position ? layout._table.getColWidth(col) || layout._table.tableNoFrameWidth : layout._table.getRowHeight(row) || layout._table.tableNoFrameHeight);
51983
+ (null == axisOption ? void 0 : axisOption.nice) && (range.min = axisRange[0], range.max = axisRange[1]);
51984
+ const ticks = selfTicks;
51914
51985
  return isNumber$4(null == axisOption ? void 0 : axisOption.min) && (range.min = axisOption.min), isNumber$4(null == axisOption ? void 0 : axisOption.max) && (range.max = axisOption.max), {
51915
51986
  index: null != seriesIndice ? seriesIndice : index,
51916
51987
  range: range,
@@ -52202,7 +52273,7 @@
52202
52273
  constructor(container) {
52203
52274
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
52204
52275
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
52205
- if (super(), this.showFrozenIcon = !0, this.version = "1.17.3-alpha.11", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
52276
+ if (super(), this.showFrozenIcon = !0, this.version = "1.17.3-alpha.12", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
52206
52277
  !1 === (null === (_a = options.customConfig) || void 0 === _a ? void 0 : _a.imageAnonymous) && (vglobal.isImageAnonymous = !1);
52207
52278
  const {
52208
52279
  frozenColCount = 0,
@@ -52250,7 +52321,7 @@
52250
52321
  right: 0,
52251
52322
  left: 0,
52252
52323
  bottom: 0
52253
- }, padding && ("number" == typeof padding ? (this.padding.top = padding, this.padding.left = padding, this.padding.bottom = padding, this.padding.right = padding) : (padding.top && (this.padding.top = padding.top), padding.bottom && (this.padding.bottom = padding.bottom), padding.left && (this.padding.left = padding.left), padding.right && (this.padding.right = padding.right))), isValid$3(canvasHeight) && isValid$3(canvasWidth) && (this.canvasSizeSeted = !0), this.tableNoFrameWidth = 0, this.tableNoFrameHeight = 0, this.canvasWidth = isNumber$4(canvasWidth) ? canvasWidth : void 0, this.canvasHeight = isNumber$4(canvasHeight) ? canvasHeight : void 0, this.columnWidthComputeMode = null !== (_b = options.columnWidthComputeMode) && void 0 !== _b ? _b : "normal";
52324
+ }, padding && ("number" == typeof padding ? (this.padding.top = padding, this.padding.left = padding, this.padding.bottom = padding, this.padding.right = padding) : (padding.top && (this.padding.top = padding.top), padding.bottom && (this.padding.bottom = padding.bottom), padding.left && (this.padding.left = padding.left), padding.right && (this.padding.right = padding.right))), (isValid$3(canvasHeight) || isValid$3(canvasWidth)) && (this.canvasSizeSeted = !0), this.tableNoFrameWidth = 0, this.tableNoFrameHeight = 0, this.canvasWidth = isNumber$4(canvasWidth) ? canvasWidth : void 0, this.canvasHeight = isNumber$4(canvasHeight) ? canvasHeight : void 0, this.columnWidthComputeMode = null !== (_b = options.columnWidthComputeMode) && void 0 !== _b ? _b : "normal";
52254
52325
  const internalProps = this.internalProps = {};
52255
52326
  void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1), this.options.canvas ? ("node" !== Env.mode && (internalProps.element = this.options.canvas.parentElement, internalProps.element.style.position = "relative"), internalProps.focusControl = new FocusInput(this, internalProps.element), internalProps.canvas = this.options.canvas, internalProps.context = internalProps.canvas.getContext("2d")) : "node" !== Env.mode && (internalProps.element = createRootElement$1(this.padding), internalProps.focusControl = new FocusInput(this, internalProps.element), internalProps.canvas = document.createElement("canvas"), internalProps.element.appendChild(internalProps.canvas), internalProps.context = internalProps.canvas.getContext("2d"), (null === (_c = options.customConfig) || void 0 === _c ? void 0 : _c.createReactContainer) && createReactContainer(this)), internalProps.handler = new EventHandler$1(), isNumber$4(this.options.resizeTime) && (internalProps.handler.resizeTime = this.options.resizeTime), internalProps.pixelRatio = pixelRatio, internalProps.frozenColCount = frozenColCount, internalProps.frozenRowCount = frozenRowCount, internalProps.unfreezeAllOnExceedsMaxWidth = null == unfreezeAllOnExceedsMaxWidth || unfreezeAllOnExceedsMaxWidth, internalProps.defaultRowHeight = defaultRowHeight, internalProps.defaultHeaderRowHeight = null != defaultHeaderRowHeight ? defaultHeaderRowHeight : defaultRowHeight, internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth, internalProps.keyboardOptions = keyboardOptions, internalProps.eventOptions = eventOptions, internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.columnResizeMode = null !== (_d = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _d ? _d : columnResizeMode, internalProps.rowResizeMode = null !== (_e = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _e ? _e : rowResizeMode, internalProps.dragHeaderMode = null !== (_g = null !== (_f = null == dragOrder ? void 0 : dragOrder.dragHeaderMode) && void 0 !== _f ? _f : dragHeaderMode) && void 0 !== _g ? _g : "none", internalProps.renderChartAsync = renderChartAsync, setBatchRenderChartCount(renderChartAsyncBatchCount), internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto", internalProps._rowHeightsMap = new NumberRangeMap(this), internalProps._rowRangeHeightsMap = new Map(), internalProps._colRangeWidthsMap = new Map(), internalProps._widthResizedColMap = new Set(), internalProps._heightResizedRowMap = new Set(), this.colWidthsMap = new NumberMap(), this.colContentWidthsMap = new NumberMap(), this.colWidthsLimit = {};
52256
52327
  const that = this;
@@ -52557,7 +52628,7 @@
52557
52628
  }
52558
52629
  }
52559
52630
  _updateSize() {
52560
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
52631
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
52561
52632
  const {
52562
52633
  padding: padding
52563
52634
  } = this;
@@ -52567,28 +52638,31 @@
52567
52638
  const element = this.getElement();
52568
52639
  let widthWithoutPadding = 0,
52569
52640
  heightWithoutPadding = 0;
52570
- if (this.canvasSizeSeted) widthWithoutPadding = this.canvasWidth, heightWithoutPadding = this.canvasHeight;else if (element.parentElement) {
52641
+ const isDefWidth = isValid$3(this.canvasWidth),
52642
+ isDefHeight = isValid$3(this.canvasHeight);
52643
+ this.canvasSizeSeted && (isDefWidth && (widthWithoutPadding = this.canvasWidth), isDefHeight && (heightWithoutPadding = this.canvasHeight));
52644
+ if ((!isDefWidth || !isDefHeight) && element.parentElement) {
52571
52645
  const computedStyle = element.parentElement.style || window.getComputedStyle(element.parentElement);
52572
- widthWithoutPadding = element.parentElement.offsetWidth - parseInt(computedStyle.paddingLeft || "0px", 10) - parseInt(computedStyle.paddingRight || "0px", 10), heightWithoutPadding = element.parentElement.offsetHeight - parseInt(computedStyle.paddingTop || "0px", 10) - parseInt(computedStyle.paddingBottom || "0px", 20), widthWithoutPadding = (null != widthWithoutPadding ? widthWithoutPadding : 1) - (this.options.tableSizeAntiJitter ? 1 : 0), heightWithoutPadding = (null != heightWithoutPadding ? heightWithoutPadding : 1) - (this.options.tableSizeAntiJitter ? 1 : 0);
52646
+ isDefWidth || (widthWithoutPadding = element.parentElement.offsetWidth - (parseInt(computedStyle.paddingLeft, 10) || 0) - (parseInt(computedStyle.paddingRight, 10) || 0)), isDefHeight || (heightWithoutPadding = element.parentElement.offsetHeight - parseInt(computedStyle.paddingTop || "0px", 10) - parseInt(computedStyle.paddingBottom || "0px", 20)), widthWithoutPadding = (null != widthWithoutPadding ? widthWithoutPadding : 1) - (this.options.tableSizeAntiJitter ? 1 : 0), heightWithoutPadding = (null != heightWithoutPadding ? heightWithoutPadding : 1) - (this.options.tableSizeAntiJitter ? 1 : 0);
52573
52647
  }
52574
52648
  element.style.width = widthWithoutPadding && widthWithoutPadding - padding.left - padding.right + "px" || "0px", element.style.height = heightWithoutPadding && heightWithoutPadding - padding.top - padding.bottom + "px" || "0px";
52575
52649
  const {
52576
52650
  canvas: canvas
52577
52651
  } = this.internalProps;
52578
- widthP = (null !== (_c = null === (_b = canvas.parentElement) || void 0 === _b ? void 0 : _b.offsetWidth) && void 0 !== _c ? _c : 1) - (this.options.tableSizeAntiJitter ? 1 : 0), heightP = (null !== (_e = null === (_d = canvas.parentElement) || void 0 === _d ? void 0 : _d.offsetHeight) && void 0 !== _e ? _e : 1) - (this.options.tableSizeAntiJitter ? 1 : 0), (null === (_f = null == this ? void 0 : this.scenegraph) || void 0 === _f ? void 0 : _f.stage) ? this.scenegraph.stage.resize(widthP, heightP) : (canvas.style.width = "", canvas.style.height = "", canvas.width = widthP, canvas.height = heightP, canvas.style.width = `${widthP}px`, canvas.style.height = `${heightP}px`);
52652
+ widthP = (null !== (_c = null === (_b = canvas.parentElement) || void 0 === _b ? void 0 : _b.offsetWidth) && void 0 !== _c ? _c : 1) - (this.options.tableSizeAntiJitter ? 1 : 0), heightP = (null !== (_e = null === (_d = canvas.parentElement) || void 0 === _d ? void 0 : _d.offsetHeight) && void 0 !== _e ? _e : 1) - (this.options.tableSizeAntiJitter ? 1 : 0), (null === (_f = null == this ? void 0 : this.scenegraph) || void 0 === _f ? void 0 : _f.stage) ? (null === (_g = this.options) || void 0 === _g ? void 0 : _g.viewBox) && !(null === (_h = this.options) || void 0 === _h ? void 0 : _h.canvas) && this.scenegraph.stage.resize(widthP, heightP) : (canvas.style.width = "", canvas.style.height = "", canvas.width = widthP, canvas.height = heightP, canvas.style.width = `${widthP}px`, canvas.style.height = `${heightP}px`), (null === (_j = this.options) || void 0 === _j ? void 0 : _j.viewBox) && (widthP = this.options.viewBox.x2 - this.options.viewBox.x1, heightP = this.options.viewBox.y2 - this.options.viewBox.y1), (null === (_k = null == this ? void 0 : this.scenegraph) || void 0 === _k ? void 0 : _k.stage) && (this.options.viewBox ? this.scenegraph.stage.setViewBox(this.options.viewBox, !1) : this.scenegraph.stage.resize(widthP, heightP));
52579
52653
  } else "node" === Env.mode && (widthP = this.canvasWidth - 1, heightP = this.canvasHeight - 1);
52580
52654
  const width = Math.floor(widthP - getVerticalScrollBarSize(this.getTheme().scrollStyle)),
52581
52655
  height = Math.floor(heightP - getHorizontalScrollBarSize(this.getTheme().scrollStyle));
52582
- if (null === (_g = this.internalProps.theme) || void 0 === _g ? void 0 : _g.frameStyle) {
52583
- const lineWidths = toBoxArray(null !== (_j = null === (_h = this.internalProps.theme.frameStyle) || void 0 === _h ? void 0 : _h.borderLineWidth) && void 0 !== _j ? _j : [null]),
52584
- shadowWidths = toBoxArray(null !== (_l = null === (_k = this.internalProps.theme.frameStyle) || void 0 === _k ? void 0 : _k.shadowBlur) && void 0 !== _l ? _l : [0]);
52585
- (null === (_m = this.theme.frameStyle) || void 0 === _m ? void 0 : _m.innerBorder) ? (this.tableX = 0, this.tableY = 0, this.tableNoFrameWidth = width - (null !== (_o = shadowWidths[1]) && void 0 !== _o ? _o : 0), this.tableNoFrameHeight = height - (null !== (_p = shadowWidths[2]) && void 0 !== _p ? _p : 0)) : (this.tableX = (null !== (_q = lineWidths[3]) && void 0 !== _q ? _q : 0) + (null !== (_r = shadowWidths[3]) && void 0 !== _r ? _r : 0), this.tableY = (null !== (_s = lineWidths[0]) && void 0 !== _s ? _s : 0) + (null !== (_t = shadowWidths[0]) && void 0 !== _t ? _t : 0), this.tableNoFrameWidth = width - ((null !== (_u = lineWidths[1]) && void 0 !== _u ? _u : 0) + (null !== (_v = shadowWidths[1]) && void 0 !== _v ? _v : 0)) - ((null !== (_w = lineWidths[3]) && void 0 !== _w ? _w : 0) + (null !== (_x = shadowWidths[3]) && void 0 !== _x ? _x : 0)), this.tableNoFrameHeight = height - ((null !== (_y = lineWidths[0]) && void 0 !== _y ? _y : 0) + (null !== (_z = shadowWidths[0]) && void 0 !== _z ? _z : 0)) - ((null !== (_0 = lineWidths[2]) && void 0 !== _0 ? _0 : 0) + (null !== (_1 = shadowWidths[2]) && void 0 !== _1 ? _1 : 0)));
52656
+ if (null === (_l = this.internalProps.theme) || void 0 === _l ? void 0 : _l.frameStyle) {
52657
+ const lineWidths = toBoxArray(null !== (_o = null === (_m = this.internalProps.theme.frameStyle) || void 0 === _m ? void 0 : _m.borderLineWidth) && void 0 !== _o ? _o : [null]),
52658
+ shadowWidths = toBoxArray(null !== (_q = null === (_p = this.internalProps.theme.frameStyle) || void 0 === _p ? void 0 : _p.shadowBlur) && void 0 !== _q ? _q : [0]);
52659
+ (null === (_r = this.theme.frameStyle) || void 0 === _r ? void 0 : _r.innerBorder) ? (this.tableX = 0, this.tableY = 0, this.tableNoFrameWidth = width - (null !== (_s = shadowWidths[1]) && void 0 !== _s ? _s : 0), this.tableNoFrameHeight = height - (null !== (_t = shadowWidths[2]) && void 0 !== _t ? _t : 0)) : (this.tableX = (null !== (_u = lineWidths[3]) && void 0 !== _u ? _u : 0) + (null !== (_v = shadowWidths[3]) && void 0 !== _v ? _v : 0), this.tableY = (null !== (_w = lineWidths[0]) && void 0 !== _w ? _w : 0) + (null !== (_x = shadowWidths[0]) && void 0 !== _x ? _x : 0), this.tableNoFrameWidth = width - ((null !== (_y = lineWidths[1]) && void 0 !== _y ? _y : 0) + (null !== (_z = shadowWidths[1]) && void 0 !== _z ? _z : 0)) - ((null !== (_0 = lineWidths[3]) && void 0 !== _0 ? _0 : 0) + (null !== (_1 = shadowWidths[3]) && void 0 !== _1 ? _1 : 0)), this.tableNoFrameHeight = height - ((null !== (_2 = lineWidths[0]) && void 0 !== _2 ? _2 : 0) + (null !== (_3 = shadowWidths[0]) && void 0 !== _3 ? _3 : 0)) - ((null !== (_4 = lineWidths[2]) && void 0 !== _4 ? _4 : 0) + (null !== (_5 = shadowWidths[2]) && void 0 !== _5 ? _5 : 0)));
52586
52660
  }
52587
52661
  }
52588
52662
  updateViewBox(newViewBox) {
52589
- var _a, _b, _c, _d, _e, _f, _g, _h;
52590
- const oldWidth = null !== (_d = null !== (_b = null === (_a = this.options) || void 0 === _a ? void 0 : _a.viewBox.x2) && void 0 !== _b ? _b : 0 - (null === (_c = this.options) || void 0 === _c ? void 0 : _c.viewBox.x1)) && void 0 !== _d ? _d : 0,
52591
- oldHeight = null !== (_h = null !== (_f = null === (_e = this.options) || void 0 === _e ? void 0 : _e.viewBox.y2) && void 0 !== _f ? _f : 0 - (null === (_g = this.options) || void 0 === _g ? void 0 : _g.viewBox.y1)) && void 0 !== _h ? _h : 0,
52663
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
52664
+ const oldWidth = (null !== (_c = null === (_b = null === (_a = this.options) || void 0 === _a ? void 0 : _a.viewBox) || void 0 === _b ? void 0 : _b.x2) && void 0 !== _c ? _c : 0) - (null !== (_f = null === (_e = null === (_d = this.options) || void 0 === _d ? void 0 : _d.viewBox) || void 0 === _e ? void 0 : _e.x1) && void 0 !== _f ? _f : 0),
52665
+ oldHeight = (null !== (_j = null === (_h = null === (_g = this.options) || void 0 === _g ? void 0 : _g.viewBox) || void 0 === _h ? void 0 : _h.y2) && void 0 !== _j ? _j : 0) - (null !== (_m = null === (_l = null === (_k = this.options) || void 0 === _k ? void 0 : _k.viewBox) || void 0 === _l ? void 0 : _l.y1) && void 0 !== _m ? _m : 0),
52592
52666
  newWidth = newViewBox.x2 - newViewBox.x1,
52593
52667
  newHeight = newViewBox.y2 - newViewBox.y1;
52594
52668
  this.options.viewBox = newViewBox, oldWidth !== newWidth || oldHeight !== newHeight ? this.resize() : this.scenegraph.stage.setViewBox(this.options.viewBox, !0);
@@ -55547,9 +55621,9 @@
55547
55621
  }, null), this._headerObjectsIncludeHided = this._addHeaders(0, columns, []), this._headerObjects = this._headerObjectsIncludeHided.filter(col => !0 !== col.define.hide), this._headerObjectMap = this._headerObjects.reduce((o, e) => (o[e.id] = e, o), {}), this.rowHierarchyType = checkHasTreeDefine(this) ? "tree" : "grid", this._hasAggregation = checkHasAggregation(this), this._hasAggregationOnBottomCount = checkHasAggregationOnBottom(this), this._hasAggregationOnTopCount = checkHasAggregationOnTop(this), this.handleRowSeriesNumber(table.internalProps.rowSeriesNumber);
55548
55622
  }
55549
55623
  handleRowSeriesNumber(rowSeriesNumber) {
55550
- var _a, _b;
55624
+ var _a;
55551
55625
  rowSeriesNumber && (Array.isArray(rowSeriesNumber) ? this.rowSeriesNumberColumn = rowSeriesNumber.map((seriesNumber, index) => {
55552
- var _a, _b, _c;
55626
+ var _a, _b;
55553
55627
  return {
55554
55628
  id: this.seqId++,
55555
55629
  title: seriesNumber.title,
@@ -55557,11 +55631,11 @@
55557
55631
  field: "_vtable_rowSeries_number_" + index
55558
55632
  }, seriesNumber),
55559
55633
  cellType: null !== (_a = seriesNumber.cellType) && void 0 !== _a ? _a : "text",
55560
- headerType: null !== (_b = rowSeriesNumber.cellType) && void 0 !== _b ? _b : "text",
55634
+ headerType: "checkbox" === seriesNumber.cellType ? "checkbox" : "text",
55561
55635
  style: seriesNumber.style,
55562
55636
  width: seriesNumber.width,
55563
55637
  format: seriesNumber.format,
55564
- field: null !== (_c = seriesNumber.field) && void 0 !== _c ? _c : "_vtable_rowSeries_number_" + index,
55638
+ field: null !== (_b = seriesNumber.field) && void 0 !== _b ? _b : "_vtable_rowSeries_number_" + index,
55565
55639
  icon: seriesNumber.icon,
55566
55640
  headerIcon: seriesNumber.headerIcon,
55567
55641
  isChildNode: !1
@@ -55573,7 +55647,7 @@
55573
55647
  field: "_vtable_rowSeries_number"
55574
55648
  }, rowSeriesNumber),
55575
55649
  cellType: null !== (_a = rowSeriesNumber.cellType) && void 0 !== _a ? _a : "text",
55576
- headerType: null !== (_b = rowSeriesNumber.cellType) && void 0 !== _b ? _b : "text",
55650
+ headerType: "checkbox" === rowSeriesNumber.cellType ? "checkbox" : "text",
55577
55651
  style: rowSeriesNumber.style,
55578
55652
  width: rowSeriesNumber.width,
55579
55653
  format: rowSeriesNumber.format,
@@ -65213,7 +65287,7 @@
65213
65287
  themes: themes$1
65214
65288
  });
65215
65289
 
65216
- const version = "1.17.3-alpha.11";
65290
+ const version = "1.17.3-alpha.12";
65217
65291
 
65218
65292
  exports.Gantt = Gantt;
65219
65293
  exports.TYPES = index$3;