@visactor/vtable-gantt 1.23.3 → 1.24.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/Gantt.d.ts +8 -0
- package/cjs/Gantt.js +91 -9
- package/cjs/Gantt.js.map +1 -1
- package/cjs/components/MenuElementStyle.js +1 -2
- package/cjs/event/touch.js +1 -0
- package/cjs/gantt-helper.js +1 -2
- package/cjs/gantt-helper.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/plugins/index.js.map +1 -1
- package/cjs/scenegraph/dependency-link.js +28 -38
- package/cjs/scenegraph/dependency-link.js.map +1 -1
- package/cjs/scenegraph/grid.js +8 -7
- package/cjs/scenegraph/grid.js.map +1 -1
- package/cjs/scenegraph/mark-line.js +10 -12
- package/cjs/scenegraph/mark-line.js.map +1 -1
- package/cjs/scenegraph/task-bar.js +3 -7
- package/cjs/scenegraph/task-bar.js.map +1 -1
- package/cjs/scenegraph/timeline-header.js +2 -6
- package/cjs/scenegraph/timeline-header.js.map +1 -1
- package/cjs/state/gantt-table-sync.js +1 -0
- package/cjs/state/state-manager.js +22 -18
- package/cjs/state/state-manager.js.map +1 -1
- package/cjs/tools/isx.d.ts +1 -1
- package/cjs/ts-types/gantt-engine.d.ts +2 -0
- package/cjs/ts-types/gantt-engine.js.map +1 -1
- package/dist/vtable-gantt.js +1263 -804
- package/dist/vtable-gantt.min.js +2 -2
- package/es/Gantt.d.ts +8 -0
- package/es/Gantt.js +92 -8
- package/es/Gantt.js.map +1 -1
- package/es/components/MenuElementStyle.js +1 -2
- package/es/event/touch.js +2 -1
- package/es/gantt-helper.js +1 -2
- package/es/gantt-helper.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/plugins/index.js.map +1 -1
- package/es/scenegraph/dependency-link.js +29 -27
- package/es/scenegraph/dependency-link.js.map +1 -1
- package/es/scenegraph/grid.js +6 -8
- package/es/scenegraph/grid.js.map +1 -1
- package/es/scenegraph/mark-line.js +10 -11
- package/es/scenegraph/mark-line.js.map +1 -1
- package/es/scenegraph/task-bar.js +4 -5
- package/es/scenegraph/task-bar.js.map +1 -1
- package/es/scenegraph/timeline-header.js +3 -5
- package/es/scenegraph/timeline-header.js.map +1 -1
- package/es/state/gantt-table-sync.js +2 -1
- package/es/state/state-manager.js +22 -18
- package/es/state/state-manager.js.map +1 -1
- package/es/tools/isx.d.ts +1 -1
- package/es/ts-types/gantt-engine.d.ts +2 -0
- package/es/ts-types/gantt-engine.js.map +1 -1
- package/package.json +5 -5
package/dist/vtable-gantt.js
CHANGED
|
@@ -34894,500 +34894,6 @@
|
|
|
34894
34894
|
registed || (registed = !0, preLoadAllModule(), isBrowserEnv() ? loadBrowserEnv(container) : isNodeEnv() && loadNodeEnv(container), registerArc(), registerCircle(), registerGroup(), registerImage(), registerLine(), registerRect(), registerRichtext(), registerShadowRoot(), registerSymbol(), registerText(), registerFlexLayoutPlugin(), loadPoptip(), registerFlexLayoutPlugin());
|
|
34895
34895
|
}
|
|
34896
34896
|
|
|
34897
|
-
function throttle$1(func, delay) {
|
|
34898
|
-
let timer = null;
|
|
34899
|
-
return function (...args) {
|
|
34900
|
-
if (!timer) {
|
|
34901
|
-
func.apply(this, args);
|
|
34902
|
-
timer = setTimeout(() => {
|
|
34903
|
-
timer = null;
|
|
34904
|
-
}, delay);
|
|
34905
|
-
}
|
|
34906
|
-
};
|
|
34907
|
-
}
|
|
34908
|
-
function getTodayNearDay(dayOffset, format) {
|
|
34909
|
-
const today = new Date();
|
|
34910
|
-
const todayTime = today.getTime();
|
|
34911
|
-
const oneDayTime = 24 * 60 * 60 * 1000;
|
|
34912
|
-
const targetTime = todayTime + dayOffset * oneDayTime;
|
|
34913
|
-
const date = new Date(targetTime);
|
|
34914
|
-
if (format) {
|
|
34915
|
-
const year = date.getFullYear().toString();
|
|
34916
|
-
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
34917
|
-
const day = date.getDate().toString().padStart(2, '0');
|
|
34918
|
-
format = format.replace('yyyy', year);
|
|
34919
|
-
format = format.replace('mm', month);
|
|
34920
|
-
format = format.replace('dd', day);
|
|
34921
|
-
return format;
|
|
34922
|
-
}
|
|
34923
|
-
return date;
|
|
34924
|
-
}
|
|
34925
|
-
function formatDate(date, format) {
|
|
34926
|
-
const year = date.getFullYear().toString();
|
|
34927
|
-
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
34928
|
-
const day = date.getDate().toString().padStart(2, '0');
|
|
34929
|
-
format = format.replace('yyyy', year);
|
|
34930
|
-
format = format.replace('mm', month);
|
|
34931
|
-
format = format.replace('dd', day);
|
|
34932
|
-
if (format.length > 10) {
|
|
34933
|
-
const hour = date.getHours().toString().padStart(2, '0');
|
|
34934
|
-
const minute = date.getMinutes().toString().padStart(2, '0');
|
|
34935
|
-
const second = date.getSeconds().toString().padStart(2, '0');
|
|
34936
|
-
format = format.replace('hh', hour);
|
|
34937
|
-
format = format.replace('mm', minute);
|
|
34938
|
-
format = format.replace('ss', second);
|
|
34939
|
-
}
|
|
34940
|
-
return format;
|
|
34941
|
-
}
|
|
34942
|
-
function validateDate(dateParts, format) {
|
|
34943
|
-
const yearIndex = format.indexOf('yyyy');
|
|
34944
|
-
const monthIndex = format.indexOf('mm');
|
|
34945
|
-
const dayIndex = format.indexOf('dd');
|
|
34946
|
-
const dateYearIndex = yearIndex < monthIndex ? (yearIndex < dayIndex ? 0 : 1) : monthIndex < dayIndex ? 1 : 2;
|
|
34947
|
-
const dateMonthIndex = monthIndex < yearIndex ? (monthIndex < dayIndex ? 0 : 1) : monthIndex < dayIndex ? 1 : 2;
|
|
34948
|
-
const dateDayIndex = dayIndex < yearIndex ? (dayIndex < monthIndex ? 0 : 1) : dayIndex < monthIndex ? 1 : 2;
|
|
34949
|
-
const year = parseInt(dateParts[dateYearIndex], 10);
|
|
34950
|
-
const month = parseInt(dateParts[dateMonthIndex], 10) - 1;
|
|
34951
|
-
const day = parseInt(dateParts[dateDayIndex], 10);
|
|
34952
|
-
if (isNaN(year) || year < 1) {
|
|
34953
|
-
return false;
|
|
34954
|
-
}
|
|
34955
|
-
if (isNaN(month) || month < 0 || month > 11) {
|
|
34956
|
-
return false;
|
|
34957
|
-
}
|
|
34958
|
-
const daysInMonth = [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
34959
|
-
if (isNaN(day) || day < 1 || day > daysInMonth[month]) {
|
|
34960
|
-
return false;
|
|
34961
|
-
}
|
|
34962
|
-
return true;
|
|
34963
|
-
}
|
|
34964
|
-
function validateTime(dateParts, format) {
|
|
34965
|
-
if (format.includes('hh') || format.includes('mm') || format.includes('ss')) {
|
|
34966
|
-
const timeIndex = format.indexOf('hh') > -1 ? format.indexOf('hh') : format.indexOf('HH');
|
|
34967
|
-
const hour = parseInt(dateParts[timeIndex], 10);
|
|
34968
|
-
const minute = parseInt(dateParts[timeIndex + 1], 10);
|
|
34969
|
-
const second = dateParts.length > timeIndex + 2 ? parseInt(dateParts[timeIndex + 2], 10) : 0;
|
|
34970
|
-
if (isNaN(hour) || hour < 0 || hour > 23) {
|
|
34971
|
-
return false;
|
|
34972
|
-
}
|
|
34973
|
-
if (isNaN(minute) || minute < 0 || minute > 59) {
|
|
34974
|
-
return false;
|
|
34975
|
-
}
|
|
34976
|
-
if (isNaN(second) || second < 0 || second > 59) {
|
|
34977
|
-
return false;
|
|
34978
|
-
}
|
|
34979
|
-
}
|
|
34980
|
-
return true;
|
|
34981
|
-
}
|
|
34982
|
-
function isLeapYear(year) {
|
|
34983
|
-
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
|
|
34984
|
-
}
|
|
34985
|
-
function parseDateFormat(dateString) {
|
|
34986
|
-
const formats = [
|
|
34987
|
-
'yyyy-mm-dd',
|
|
34988
|
-
'dd-mm-yyyy',
|
|
34989
|
-
'mm/dd/yyyy',
|
|
34990
|
-
'yyyy/mm/dd',
|
|
34991
|
-
'dd/mm/yyyy',
|
|
34992
|
-
'yyyy.mm.dd',
|
|
34993
|
-
'mm.dd.yyyy',
|
|
34994
|
-
'dd.mm.yyyy'
|
|
34995
|
-
];
|
|
34996
|
-
const timeFormat = ['hh:mm:ss', 'hh:mm'];
|
|
34997
|
-
dateString = dateString.trim();
|
|
34998
|
-
const dates = dateString.split(' ');
|
|
34999
|
-
const date = dates[0];
|
|
35000
|
-
const time = dates[1];
|
|
35001
|
-
let dateFormatMatched;
|
|
35002
|
-
let timeFormatMatched;
|
|
35003
|
-
if (date) {
|
|
35004
|
-
for (let i = 0; i < formats.length; i++) {
|
|
35005
|
-
const format = formats[i];
|
|
35006
|
-
const dateParts = date.split(getSeparator(format));
|
|
35007
|
-
const isValid = validateDate(dateParts, format);
|
|
35008
|
-
if (dateParts.length === 3 && isValid) {
|
|
35009
|
-
dateFormatMatched = format;
|
|
35010
|
-
break;
|
|
35011
|
-
}
|
|
35012
|
-
}
|
|
35013
|
-
}
|
|
35014
|
-
if (dateFormatMatched) {
|
|
35015
|
-
if (time) {
|
|
35016
|
-
for (let i = 0; i < timeFormat.length; i++) {
|
|
35017
|
-
const format = timeFormat[i];
|
|
35018
|
-
const timeParts = time.split(getSeparator(format));
|
|
35019
|
-
const formatParts = format.split(getSeparator(format));
|
|
35020
|
-
const isValid = validateTime(timeParts, format);
|
|
35021
|
-
if (isValid && timeParts.length === formatParts.length) {
|
|
35022
|
-
timeFormatMatched = format;
|
|
35023
|
-
break;
|
|
35024
|
-
}
|
|
35025
|
-
}
|
|
35026
|
-
}
|
|
35027
|
-
}
|
|
35028
|
-
if (date && time && dateFormatMatched && timeFormatMatched) {
|
|
35029
|
-
return dateFormatMatched + ' ' + timeFormatMatched;
|
|
35030
|
-
}
|
|
35031
|
-
if (date && !time) {
|
|
35032
|
-
return dateFormatMatched;
|
|
35033
|
-
}
|
|
35034
|
-
return 'yyyy-mm-dd hh:mm:ss';
|
|
35035
|
-
}
|
|
35036
|
-
function getSeparator(format) {
|
|
35037
|
-
const separators = format.match(/[^\w]/g);
|
|
35038
|
-
if (separators) {
|
|
35039
|
-
const escapedSeparators = separators.map(s => '\\' + s).join('|');
|
|
35040
|
-
return new RegExp(escapedSeparators, 'g');
|
|
35041
|
-
}
|
|
35042
|
-
return /[^\w]/;
|
|
35043
|
-
}
|
|
35044
|
-
function parseStringTemplate(template, data) {
|
|
35045
|
-
const result = template.replace(/\{([^}]+)\}/g, (match, key) => {
|
|
35046
|
-
const keys = key.split('.');
|
|
35047
|
-
let value = data;
|
|
35048
|
-
for (const k of keys) {
|
|
35049
|
-
if (value.hasOwnProperty(k)) {
|
|
35050
|
-
value = value[k];
|
|
35051
|
-
}
|
|
35052
|
-
else {
|
|
35053
|
-
value = match;
|
|
35054
|
-
break;
|
|
35055
|
-
}
|
|
35056
|
-
}
|
|
35057
|
-
return value;
|
|
35058
|
-
});
|
|
35059
|
-
return result;
|
|
35060
|
-
}
|
|
35061
|
-
function toBoxArray$2(obj) {
|
|
35062
|
-
if (!Array.isArray(obj)) {
|
|
35063
|
-
return [obj, obj, obj, obj];
|
|
35064
|
-
}
|
|
35065
|
-
if (obj.length === 3) {
|
|
35066
|
-
return [obj[0], obj[1], obj[2], obj[1]];
|
|
35067
|
-
}
|
|
35068
|
-
if (obj.length === 2) {
|
|
35069
|
-
return [obj[0], obj[1], obj[0], obj[1]];
|
|
35070
|
-
}
|
|
35071
|
-
if (obj.length === 1) {
|
|
35072
|
-
return [obj[0], obj[0], obj[0], obj[0]];
|
|
35073
|
-
}
|
|
35074
|
-
return [obj[0], obj[1], obj[2], obj[3]];
|
|
35075
|
-
}
|
|
35076
|
-
function getWeekNumber(currentDate) {
|
|
35077
|
-
const startOfYear = new Date(currentDate.getFullYear(), 0, 1);
|
|
35078
|
-
const weekNumber = Math.ceil(((currentDate.getTime() + 1 - startOfYear.getTime()) / 86400000 + 1) / 7);
|
|
35079
|
-
return weekNumber;
|
|
35080
|
-
}
|
|
35081
|
-
function getWeekday(dateString, format = 'long') {
|
|
35082
|
-
const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
35083
|
-
const date = new Date(dateString);
|
|
35084
|
-
if (format === 'short') {
|
|
35085
|
-
return days[date.getDay()].substr(0, 3);
|
|
35086
|
-
}
|
|
35087
|
-
else if (format === 'long') {
|
|
35088
|
-
return days[date.getDay()];
|
|
35089
|
-
}
|
|
35090
|
-
return 'Invalid format specified. Please use "short" or "long".';
|
|
35091
|
-
}
|
|
35092
|
-
function isPropertyWritable(obj, prop) {
|
|
35093
|
-
const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
35094
|
-
if (!descriptor) {
|
|
35095
|
-
return false;
|
|
35096
|
-
}
|
|
35097
|
-
return !!descriptor.set || descriptor.writable === true;
|
|
35098
|
-
}
|
|
35099
|
-
function createDateAtMidnight(dateStr, forceMidnight = false) {
|
|
35100
|
-
let date;
|
|
35101
|
-
if (dateStr) {
|
|
35102
|
-
date = new Date(dateStr);
|
|
35103
|
-
if (typeof dateStr === 'string') {
|
|
35104
|
-
if (dateStr.length > 10) {
|
|
35105
|
-
if (forceMidnight) {
|
|
35106
|
-
date.setHours(0, 0, 0, 0);
|
|
35107
|
-
}
|
|
35108
|
-
return date;
|
|
35109
|
-
}
|
|
35110
|
-
date.setHours(0, 0, 0, 0);
|
|
35111
|
-
}
|
|
35112
|
-
}
|
|
35113
|
-
else {
|
|
35114
|
-
date = new Date();
|
|
35115
|
-
}
|
|
35116
|
-
if (forceMidnight) {
|
|
35117
|
-
date.setHours(0, 0, 0, 0);
|
|
35118
|
-
}
|
|
35119
|
-
return date;
|
|
35120
|
-
}
|
|
35121
|
-
function createDateAtLastMinute(dateStr, forceSetMinute = false) {
|
|
35122
|
-
let date;
|
|
35123
|
-
if (dateStr) {
|
|
35124
|
-
date = new Date(dateStr);
|
|
35125
|
-
if (typeof dateStr === 'string') {
|
|
35126
|
-
if (dateStr.length > 10) {
|
|
35127
|
-
if (forceSetMinute) {
|
|
35128
|
-
date.setMinutes(59, 59, 999);
|
|
35129
|
-
}
|
|
35130
|
-
return date;
|
|
35131
|
-
}
|
|
35132
|
-
date.setMinutes(59, 59, 999);
|
|
35133
|
-
}
|
|
35134
|
-
}
|
|
35135
|
-
else {
|
|
35136
|
-
date = new Date();
|
|
35137
|
-
}
|
|
35138
|
-
if (forceSetMinute) {
|
|
35139
|
-
date.setMinutes(59, 59, 999);
|
|
35140
|
-
}
|
|
35141
|
-
return date;
|
|
35142
|
-
}
|
|
35143
|
-
function createDateAtLastSecond(dateStr, forceSetSecond = false) {
|
|
35144
|
-
let date;
|
|
35145
|
-
if (dateStr) {
|
|
35146
|
-
date = new Date(dateStr);
|
|
35147
|
-
if (typeof dateStr === 'string') {
|
|
35148
|
-
if (dateStr.length > 10) {
|
|
35149
|
-
if (forceSetSecond) {
|
|
35150
|
-
date.setSeconds(59, 999);
|
|
35151
|
-
}
|
|
35152
|
-
return date;
|
|
35153
|
-
}
|
|
35154
|
-
date.setSeconds(59, 999);
|
|
35155
|
-
}
|
|
35156
|
-
}
|
|
35157
|
-
else {
|
|
35158
|
-
date = new Date();
|
|
35159
|
-
}
|
|
35160
|
-
if (forceSetSecond) {
|
|
35161
|
-
date.setSeconds(59, 999);
|
|
35162
|
-
}
|
|
35163
|
-
return date;
|
|
35164
|
-
}
|
|
35165
|
-
function createDateAtLastMillisecond(dateStr, forceSetMillisecond = false) {
|
|
35166
|
-
let date;
|
|
35167
|
-
if (dateStr) {
|
|
35168
|
-
date = new Date(dateStr);
|
|
35169
|
-
if (typeof dateStr === 'string') {
|
|
35170
|
-
if (dateStr.length > 10) {
|
|
35171
|
-
if (forceSetMillisecond) {
|
|
35172
|
-
date.setMilliseconds(999);
|
|
35173
|
-
}
|
|
35174
|
-
return date;
|
|
35175
|
-
}
|
|
35176
|
-
date.setMilliseconds(999);
|
|
35177
|
-
}
|
|
35178
|
-
}
|
|
35179
|
-
else {
|
|
35180
|
-
date = new Date();
|
|
35181
|
-
}
|
|
35182
|
-
if (forceSetMillisecond) {
|
|
35183
|
-
date.setMilliseconds(999);
|
|
35184
|
-
}
|
|
35185
|
-
return date;
|
|
35186
|
-
}
|
|
35187
|
-
function createDateAtLastHour(dateStr, forceLastHour = false) {
|
|
35188
|
-
let date;
|
|
35189
|
-
if (dateStr) {
|
|
35190
|
-
date = new Date(dateStr);
|
|
35191
|
-
if (typeof dateStr === 'string') {
|
|
35192
|
-
if (dateStr.length > 10) {
|
|
35193
|
-
if (forceLastHour) {
|
|
35194
|
-
date.setHours(23, 59, 59, 999);
|
|
35195
|
-
}
|
|
35196
|
-
return date;
|
|
35197
|
-
}
|
|
35198
|
-
date.setHours(23, 59, 59, 999);
|
|
35199
|
-
}
|
|
35200
|
-
}
|
|
35201
|
-
else {
|
|
35202
|
-
date = new Date();
|
|
35203
|
-
}
|
|
35204
|
-
if (forceLastHour) {
|
|
35205
|
-
date.setHours(23, 59, 59, 999);
|
|
35206
|
-
}
|
|
35207
|
-
return date;
|
|
35208
|
-
}
|
|
35209
|
-
function getEndDateByTimeUnit(startDate, date, timeScale, step) {
|
|
35210
|
-
let endDate = new Date(date);
|
|
35211
|
-
switch (timeScale) {
|
|
35212
|
-
case 'second':
|
|
35213
|
-
endDate.setMilliseconds(999);
|
|
35214
|
-
break;
|
|
35215
|
-
case 'minute':
|
|
35216
|
-
endDate.setSeconds(59, 999);
|
|
35217
|
-
break;
|
|
35218
|
-
case 'hour':
|
|
35219
|
-
endDate.setMinutes(59, 59, 999);
|
|
35220
|
-
break;
|
|
35221
|
-
case 'day':
|
|
35222
|
-
endDate.setHours(23, 59, 59, 999);
|
|
35223
|
-
break;
|
|
35224
|
-
case 'week':
|
|
35225
|
-
const day = endDate.getDay();
|
|
35226
|
-
const diffToEndOfWeek = 6 - day;
|
|
35227
|
-
endDate.setDate(endDate.getDate() + diffToEndOfWeek);
|
|
35228
|
-
endDate.setHours(23, 59, 59, 999);
|
|
35229
|
-
break;
|
|
35230
|
-
case 'month':
|
|
35231
|
-
const lastDayOfMonth = new Date(endDate.getFullYear(), endDate.getMonth() + 1, 0).getDate();
|
|
35232
|
-
endDate.setDate(lastDayOfMonth);
|
|
35233
|
-
endDate.setHours(23, 59, 59, 999);
|
|
35234
|
-
break;
|
|
35235
|
-
case 'quarter':
|
|
35236
|
-
const currentMonth = endDate.getMonth();
|
|
35237
|
-
const endMonthOfQuarter = currentMonth - (currentMonth % 3) + 2;
|
|
35238
|
-
const lastDayOfQuarter = new Date(endDate.getFullYear(), endMonthOfQuarter + 1, 0).getDate();
|
|
35239
|
-
endDate.setMonth(endMonthOfQuarter, lastDayOfQuarter);
|
|
35240
|
-
endDate.setHours(23, 59, 59, 999);
|
|
35241
|
-
break;
|
|
35242
|
-
case 'year':
|
|
35243
|
-
endDate.setMonth(11, 31);
|
|
35244
|
-
endDate.setHours(23, 59, 59, 999);
|
|
35245
|
-
break;
|
|
35246
|
-
default:
|
|
35247
|
-
throw new Error('Invalid time scale');
|
|
35248
|
-
}
|
|
35249
|
-
const count = computeCountToTimeScale(endDate, startDate, timeScale, step, 1);
|
|
35250
|
-
const targetCount = Math.ceil(count);
|
|
35251
|
-
if (targetCount > count) {
|
|
35252
|
-
const dif = (targetCount - count) * step;
|
|
35253
|
-
const msInSecond = 1000;
|
|
35254
|
-
const msInMinute = msInSecond * 60;
|
|
35255
|
-
const msInHour = msInMinute * 60;
|
|
35256
|
-
const msInDay = msInHour * 24;
|
|
35257
|
-
const msInWeek = msInDay * 7;
|
|
35258
|
-
new Date(endDate.getTime() + 1);
|
|
35259
|
-
switch (timeScale) {
|
|
35260
|
-
case 'second':
|
|
35261
|
-
endDate.setTime(endDate.getTime() + dif * msInSecond);
|
|
35262
|
-
break;
|
|
35263
|
-
case 'minute':
|
|
35264
|
-
endDate.setTime(endDate.getTime() + dif * msInMinute);
|
|
35265
|
-
break;
|
|
35266
|
-
case 'hour':
|
|
35267
|
-
endDate.setTime(endDate.getTime() + dif * msInHour);
|
|
35268
|
-
break;
|
|
35269
|
-
case 'day':
|
|
35270
|
-
endDate.setTime(endDate.getTime() + dif * msInDay);
|
|
35271
|
-
break;
|
|
35272
|
-
case 'week':
|
|
35273
|
-
endDate.setTime(endDate.getTime() + dif * msInWeek);
|
|
35274
|
-
break;
|
|
35275
|
-
case 'month':
|
|
35276
|
-
endDate = new Date(endDate.getFullYear(), endDate.getMonth() + 1 + Math.round(dif), 0);
|
|
35277
|
-
endDate.setHours(23, 59, 59, 999);
|
|
35278
|
-
break;
|
|
35279
|
-
case 'quarter':
|
|
35280
|
-
const currentMonth = endDate.getMonth();
|
|
35281
|
-
const endMonthOfQuarter = currentMonth - (currentMonth % 3) + 2;
|
|
35282
|
-
endDate = new Date(endDate.getFullYear(), endMonthOfQuarter + Math.round(dif * 3) + 1, 0);
|
|
35283
|
-
endDate.setHours(23, 59, 59, 999);
|
|
35284
|
-
break;
|
|
35285
|
-
case 'year':
|
|
35286
|
-
endDate.setFullYear(endDate.getFullYear() + Math.floor(dif));
|
|
35287
|
-
endDate.setHours(23, 59, 59, 999);
|
|
35288
|
-
break;
|
|
35289
|
-
default:
|
|
35290
|
-
throw new Error('Invalid time scale');
|
|
35291
|
-
}
|
|
35292
|
-
}
|
|
35293
|
-
return endDate;
|
|
35294
|
-
}
|
|
35295
|
-
function getStartDateByTimeUnit(date, timeScale, startOfWeekSetting = 'monday') {
|
|
35296
|
-
const startDate = new Date(date);
|
|
35297
|
-
switch (timeScale) {
|
|
35298
|
-
case 'second':
|
|
35299
|
-
startDate.setMilliseconds(0);
|
|
35300
|
-
break;
|
|
35301
|
-
case 'minute':
|
|
35302
|
-
startDate.setSeconds(0, 0);
|
|
35303
|
-
break;
|
|
35304
|
-
case 'hour':
|
|
35305
|
-
startDate.setMinutes(0, 0, 0);
|
|
35306
|
-
break;
|
|
35307
|
-
case 'day':
|
|
35308
|
-
startDate.setHours(0, 0, 0, 0);
|
|
35309
|
-
break;
|
|
35310
|
-
case 'week':
|
|
35311
|
-
const day = startDate.getDay();
|
|
35312
|
-
let diffToStartOfWeek = day;
|
|
35313
|
-
if (startOfWeekSetting === 'monday') {
|
|
35314
|
-
diffToStartOfWeek = day === 0 ? -6 : 1 - day;
|
|
35315
|
-
}
|
|
35316
|
-
else {
|
|
35317
|
-
diffToStartOfWeek = -day;
|
|
35318
|
-
}
|
|
35319
|
-
startDate.setDate(startDate.getDate() + diffToStartOfWeek);
|
|
35320
|
-
startDate.setHours(0, 0, 0, 0);
|
|
35321
|
-
break;
|
|
35322
|
-
case 'month':
|
|
35323
|
-
startDate.setDate(1);
|
|
35324
|
-
startDate.setHours(0, 0, 0, 0);
|
|
35325
|
-
break;
|
|
35326
|
-
case 'quarter':
|
|
35327
|
-
const currentMonth = startDate.getMonth();
|
|
35328
|
-
const startMonthOfQuarter = currentMonth - (currentMonth % 3);
|
|
35329
|
-
startDate.setMonth(startMonthOfQuarter, 1);
|
|
35330
|
-
startDate.setHours(0, 0, 0, 0);
|
|
35331
|
-
break;
|
|
35332
|
-
case 'year':
|
|
35333
|
-
startDate.setMonth(0, 1);
|
|
35334
|
-
startDate.setHours(0, 0, 0, 0);
|
|
35335
|
-
break;
|
|
35336
|
-
default:
|
|
35337
|
-
throw new Error('Invalid time scale');
|
|
35338
|
-
}
|
|
35339
|
-
return startDate;
|
|
35340
|
-
}
|
|
35341
|
-
function computeCountToTimeScale(date, startDate, timeScale, step, diffMS = 0) {
|
|
35342
|
-
const msInSecond = 1000;
|
|
35343
|
-
const msInMinute = msInSecond * 60;
|
|
35344
|
-
const msInHour = msInMinute * 60;
|
|
35345
|
-
const msInDay = msInHour * 24;
|
|
35346
|
-
const msInWeek = msInDay * 7;
|
|
35347
|
-
let difference;
|
|
35348
|
-
const adjusted_date = new Date(date.getTime() + diffMS);
|
|
35349
|
-
switch (timeScale) {
|
|
35350
|
-
case 'second':
|
|
35351
|
-
difference = (adjusted_date.getTime() - startDate.getTime()) / msInSecond;
|
|
35352
|
-
break;
|
|
35353
|
-
case 'minute':
|
|
35354
|
-
difference = (adjusted_date.getTime() - startDate.getTime()) / msInMinute;
|
|
35355
|
-
break;
|
|
35356
|
-
case 'hour':
|
|
35357
|
-
difference = (adjusted_date.getTime() - startDate.getTime()) / msInHour;
|
|
35358
|
-
break;
|
|
35359
|
-
case 'day':
|
|
35360
|
-
difference = (adjusted_date.getTime() - startDate.getTime()) / msInDay;
|
|
35361
|
-
break;
|
|
35362
|
-
case 'week':
|
|
35363
|
-
difference = (adjusted_date.getTime() - startDate.getTime()) / msInWeek;
|
|
35364
|
-
break;
|
|
35365
|
-
case 'month':
|
|
35366
|
-
const startDaysInMonth = new Date(startDate.getFullYear(), startDate.getMonth() + 1, 0).getDate();
|
|
35367
|
-
const adjustedDaysInMonth = new Date(adjusted_date.getFullYear(), adjusted_date.getMonth() + 1, 0).getDate();
|
|
35368
|
-
difference =
|
|
35369
|
-
(adjusted_date.getFullYear() - startDate.getFullYear()) * 12 +
|
|
35370
|
-
(adjusted_date.getMonth() - startDate.getMonth());
|
|
35371
|
-
difference += adjusted_date.getDate() / adjustedDaysInMonth - startDate.getDate() / startDaysInMonth;
|
|
35372
|
-
break;
|
|
35373
|
-
case 'quarter':
|
|
35374
|
-
difference =
|
|
35375
|
-
(adjusted_date.getFullYear() - startDate.getFullYear()) * 4 +
|
|
35376
|
-
(adjusted_date.getMonth() - startDate.getMonth()) / 3;
|
|
35377
|
-
difference +=
|
|
35378
|
-
(adjusted_date.getDate() - startDate.getDate()) /
|
|
35379
|
-
(3 * new Date(adjusted_date.getFullYear(), adjusted_date.getMonth() + 1, 0).getDate());
|
|
35380
|
-
break;
|
|
35381
|
-
case 'year':
|
|
35382
|
-
difference = adjusted_date.getFullYear() - startDate.getFullYear();
|
|
35383
|
-
difference += (adjusted_date.getMonth() - startDate.getMonth()) / 12;
|
|
35384
|
-
break;
|
|
35385
|
-
default:
|
|
35386
|
-
throw new Error('Invalid time scale');
|
|
35387
|
-
}
|
|
35388
|
-
return difference / step;
|
|
35389
|
-
}
|
|
35390
|
-
|
|
35391
34897
|
class Grid {
|
|
35392
34898
|
gridStyle;
|
|
35393
34899
|
scrollLeft;
|
|
@@ -35468,9 +34974,7 @@
|
|
|
35468
34974
|
this.verticalLineGroup.name = 'grid-vertical';
|
|
35469
34975
|
this.group.appendChild(this.verticalLineGroup);
|
|
35470
34976
|
const dependenceOnTimeScale = this._scene._gantt.parsedOptions.reverseSortedTimelineScales.find(scale => scale.unit === verticalLineDependenceOnTimeScale) ?? this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];
|
|
35471
|
-
const { unit: minUnit, step } = this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];
|
|
35472
34977
|
const { timelineDates } = dependenceOnTimeScale;
|
|
35473
|
-
const timelineColWidth = this._scene._gantt.parsedOptions.timelineColWidth;
|
|
35474
34978
|
if (typeof gridStyle.verticalLine === 'function') {
|
|
35475
34979
|
for (let i = 0; i < timelineDates?.length - 1; i++) {
|
|
35476
34980
|
const { endDate } = timelineDates[i];
|
|
@@ -35480,8 +34984,8 @@
|
|
|
35480
34984
|
date: timelineDates[i].endDate,
|
|
35481
34985
|
ganttInstance: this._scene._gantt
|
|
35482
34986
|
});
|
|
35483
|
-
const x = Math.ceil(
|
|
35484
|
-
|
|
34987
|
+
const x = Math.ceil(this._scene._gantt.getXByTime(endDate.getTime() + 1)) +
|
|
34988
|
+
(verticalLine_style.lineWidth & 1 ? 0.5 : 0);
|
|
35485
34989
|
const line = createLine({
|
|
35486
34990
|
pickable: false,
|
|
35487
34991
|
stroke: verticalLine_style.lineColor,
|
|
@@ -35499,8 +35003,8 @@
|
|
|
35499
35003
|
const verticalLine_style = gridStyle.verticalLine;
|
|
35500
35004
|
for (let i = 0; i < timelineDates?.length - 1; i++) {
|
|
35501
35005
|
const { endDate } = timelineDates[i];
|
|
35502
|
-
const x = Math.ceil(
|
|
35503
|
-
|
|
35006
|
+
const x = Math.ceil(this._scene._gantt.getXByTime(endDate.getTime() + 1)) +
|
|
35007
|
+
(verticalLine_style.lineWidth & 1 ? 0.5 : 0);
|
|
35504
35008
|
const line = createLine({
|
|
35505
35009
|
pickable: false,
|
|
35506
35010
|
stroke: verticalLine_style.lineColor,
|
|
@@ -35584,7 +35088,6 @@
|
|
|
35584
35088
|
this.verticalBackgroundRectsGroup.name = 'grid-vertical-background';
|
|
35585
35089
|
this.group.appendChild(this.verticalBackgroundRectsGroup);
|
|
35586
35090
|
const { timelineDates, unit, step } = this._scene._gantt.parsedOptions.reverseSortedTimelineScales[0];
|
|
35587
|
-
const timelineColWidth = this._scene._gantt.parsedOptions.timelineColWidth;
|
|
35588
35091
|
if (verticalBackgroundColor || weekendBackgroundColor) {
|
|
35589
35092
|
for (let i = 0; i <= timelineDates?.length - 1; i++) {
|
|
35590
35093
|
let backgroundColor;
|
|
@@ -35606,13 +35109,14 @@
|
|
|
35606
35109
|
backgroundColor = verticalBackgroundColor[i % verticalBackgroundColor.length];
|
|
35607
35110
|
}
|
|
35608
35111
|
if (backgroundColor) {
|
|
35609
|
-
const x = Math.ceil(
|
|
35112
|
+
const x = i >= 1 ? Math.ceil(this._scene._gantt.getDateColsWidth(0, i - 1)) : 0;
|
|
35113
|
+
const width = this._scene._gantt.getDateColWidth(i);
|
|
35610
35114
|
const rect = createRect({
|
|
35611
35115
|
pickable: false,
|
|
35612
35116
|
fill: backgroundColor,
|
|
35613
35117
|
x,
|
|
35614
35118
|
y: 0,
|
|
35615
|
-
width
|
|
35119
|
+
width,
|
|
35616
35120
|
height: this.allGridHeight
|
|
35617
35121
|
});
|
|
35618
35122
|
this.verticalBackgroundRectsGroup.appendChild(rect);
|
|
@@ -35826,165 +35330,659 @@
|
|
|
35826
35330
|
this.vScrollBar.render();
|
|
35827
35331
|
this.vScrollBar.hideAll();
|
|
35828
35332
|
}
|
|
35829
|
-
refresh() {
|
|
35333
|
+
refresh() {
|
|
35334
|
+
}
|
|
35335
|
+
hideVerticalScrollBar() {
|
|
35336
|
+
const visable = this._gantt.parsedOptions.scrollStyle.visible;
|
|
35337
|
+
if (visable !== 'focus' && visable !== 'scrolling') {
|
|
35338
|
+
return;
|
|
35339
|
+
}
|
|
35340
|
+
this.vScrollBar.setAttribute('visible', false);
|
|
35341
|
+
this.vScrollBar.hideAll();
|
|
35342
|
+
this._gantt.scenegraph.updateNextFrame();
|
|
35343
|
+
}
|
|
35344
|
+
showVerticalScrollBar(autoHide) {
|
|
35345
|
+
const visable = this._gantt.parsedOptions.scrollStyle.visible;
|
|
35346
|
+
if (visable !== 'focus' && visable !== 'scrolling') {
|
|
35347
|
+
return;
|
|
35348
|
+
}
|
|
35349
|
+
this.vScrollBar.setAttribute('visible', true);
|
|
35350
|
+
this.vScrollBar.showAll();
|
|
35351
|
+
this._gantt.scenegraph.updateNextFrame();
|
|
35352
|
+
if (autoHide) {
|
|
35353
|
+
clearTimeout(this._clearVerticalScrollBar);
|
|
35354
|
+
this._clearVerticalScrollBar = setTimeout(() => {
|
|
35355
|
+
this.hideVerticalScrollBar();
|
|
35356
|
+
}, 1000);
|
|
35357
|
+
}
|
|
35358
|
+
}
|
|
35359
|
+
hideHorizontalScrollBar() {
|
|
35360
|
+
const visable = this._gantt.parsedOptions.scrollStyle.visible;
|
|
35361
|
+
if (visable !== 'focus' && visable !== 'scrolling') {
|
|
35362
|
+
return;
|
|
35363
|
+
}
|
|
35364
|
+
this.hScrollBar.setAttribute('visible', false);
|
|
35365
|
+
this.hScrollBar.hideAll();
|
|
35366
|
+
this._gantt.scenegraph.updateNextFrame();
|
|
35367
|
+
}
|
|
35368
|
+
showHorizontalScrollBar(autoHide) {
|
|
35369
|
+
const visable = this._gantt.parsedOptions.scrollStyle.visible;
|
|
35370
|
+
if (visable !== 'focus' && visable !== 'scrolling') {
|
|
35371
|
+
return;
|
|
35372
|
+
}
|
|
35373
|
+
this.hScrollBar.setAttribute('visible', true);
|
|
35374
|
+
this.hScrollBar.showAll();
|
|
35375
|
+
this._gantt.scenegraph.updateNextFrame();
|
|
35376
|
+
if (autoHide) {
|
|
35377
|
+
clearTimeout(this._clearHorizontalScrollBar);
|
|
35378
|
+
this._clearHorizontalScrollBar = setTimeout(() => {
|
|
35379
|
+
this.hideHorizontalScrollBar();
|
|
35380
|
+
}, 1000);
|
|
35381
|
+
}
|
|
35382
|
+
}
|
|
35383
|
+
updateVerticalScrollBarPos(topRatio) {
|
|
35384
|
+
const range = this.vScrollBar.attribute.range;
|
|
35385
|
+
const size = range[1] - range[0];
|
|
35386
|
+
const range0 = topRatio * (1 - size);
|
|
35387
|
+
this.vScrollBar.setAttribute('range', [range0, range0 + size]);
|
|
35388
|
+
const bounds = this.vScrollBar.AABBBounds && this.vScrollBar.globalAABBBounds;
|
|
35389
|
+
this.vScrollBar._viewPosition = {
|
|
35390
|
+
x: bounds.x1,
|
|
35391
|
+
y: bounds.y1
|
|
35392
|
+
};
|
|
35393
|
+
}
|
|
35394
|
+
updateHorizontalScrollBarPos(leftRatio) {
|
|
35395
|
+
const range = this.hScrollBar.attribute.range;
|
|
35396
|
+
const size = range[1] - range[0];
|
|
35397
|
+
const range0 = leftRatio * (1 - size);
|
|
35398
|
+
this.hScrollBar.setAttribute('range', [range0, range0 + size]);
|
|
35399
|
+
const bounds = this.hScrollBar.AABBBounds && this.hScrollBar.globalAABBBounds;
|
|
35400
|
+
this.hScrollBar._viewPosition = {
|
|
35401
|
+
x: bounds.x1,
|
|
35402
|
+
y: bounds.y1
|
|
35403
|
+
};
|
|
35404
|
+
}
|
|
35405
|
+
updateScrollBar() {
|
|
35406
|
+
const oldHorizontalBarPos = this._gantt.stateManager.scroll.horizontalBarPos;
|
|
35407
|
+
const oldVerticalBarPos = this._gantt.stateManager.scroll.verticalBarPos;
|
|
35408
|
+
const scrollStyle = this._gantt.parsedOptions.scrollStyle;
|
|
35409
|
+
const width = scrollStyle?.width;
|
|
35410
|
+
const visible = scrollStyle?.visible;
|
|
35411
|
+
const tableWidth = Math.ceil(this._gantt.scenegraph.ganttGroup.attribute.width);
|
|
35412
|
+
const tableHeight = Math.ceil(this._gantt.scenegraph.ganttGroup.attribute.height);
|
|
35413
|
+
const totalHeight = this._gantt.getAllRowsHeight();
|
|
35414
|
+
const totalWidth = this._gantt.getAllDateColsWidth();
|
|
35415
|
+
const frozenRowsHeight = this._gantt.getAllHeaderRowsHeight();
|
|
35416
|
+
if (totalWidth > tableWidth) {
|
|
35417
|
+
const y = Math.min(tableHeight, totalHeight);
|
|
35418
|
+
const rangeEnd = Math.max(0.05, tableWidth / totalWidth);
|
|
35419
|
+
const hoverOn = scrollStyle.hoverOn;
|
|
35420
|
+
let attrY = 0;
|
|
35421
|
+
if (scrollStyle.barToSide) {
|
|
35422
|
+
attrY =
|
|
35423
|
+
this._gantt.tableNoFrameHeight -
|
|
35424
|
+
(hoverOn ? width : -this._gantt.scenegraph.ganttGroup.attribute.y) +
|
|
35425
|
+
this._gantt.tableY;
|
|
35426
|
+
}
|
|
35427
|
+
else {
|
|
35428
|
+
attrY = y - (hoverOn ? width : -this._gantt.scenegraph.ganttGroup.attribute.y) + this._gantt.tableY;
|
|
35429
|
+
}
|
|
35430
|
+
this.hScrollBar.setAttributes({
|
|
35431
|
+
x: this._gantt.scenegraph.ganttGroup.attribute.x,
|
|
35432
|
+
y: attrY,
|
|
35433
|
+
width: tableWidth,
|
|
35434
|
+
range: [0, rangeEnd],
|
|
35435
|
+
visible: visible === 'always'
|
|
35436
|
+
});
|
|
35437
|
+
const bounds = this.hScrollBar.AABBBounds && this.hScrollBar.globalAABBBounds;
|
|
35438
|
+
this.hScrollBar._viewPosition = {
|
|
35439
|
+
x: bounds.x1,
|
|
35440
|
+
y: bounds.y1
|
|
35441
|
+
};
|
|
35442
|
+
if (visible === 'always') {
|
|
35443
|
+
this.hScrollBar.showAll();
|
|
35444
|
+
}
|
|
35445
|
+
}
|
|
35446
|
+
else {
|
|
35447
|
+
this.hScrollBar.setAttributes({
|
|
35448
|
+
x: -this._gantt.tableNoFrameWidth * 2,
|
|
35449
|
+
y: -this._gantt.tableNoFrameHeight * 2,
|
|
35450
|
+
width: 0,
|
|
35451
|
+
visible: false
|
|
35452
|
+
});
|
|
35453
|
+
}
|
|
35454
|
+
if (totalHeight > tableHeight) {
|
|
35455
|
+
const x = Math.min(tableWidth, totalWidth) + this._gantt.scenegraph.ganttGroup.attribute.x;
|
|
35456
|
+
const rangeEnd = Math.max(0.05, (tableHeight - frozenRowsHeight) / (totalHeight - frozenRowsHeight));
|
|
35457
|
+
let attrX = 0;
|
|
35458
|
+
const hoverOn = this._gantt.parsedOptions.scrollStyle.hoverOn;
|
|
35459
|
+
if (this._gantt.parsedOptions.scrollStyle.barToSide) {
|
|
35460
|
+
attrX = this._gantt.tableNoFrameWidth - (hoverOn ? width : -this._gantt.scenegraph.ganttGroup.attribute.x);
|
|
35461
|
+
}
|
|
35462
|
+
else {
|
|
35463
|
+
attrX = x - (hoverOn ? width : -this._gantt.scenegraph.ganttGroup.attribute.x);
|
|
35464
|
+
}
|
|
35465
|
+
this.vScrollBar.setAttributes({
|
|
35466
|
+
x: attrX,
|
|
35467
|
+
y: frozenRowsHeight + (!hoverOn ? this._gantt.scenegraph.ganttGroup.attribute.y : 0) + this._gantt.tableY,
|
|
35468
|
+
height: tableHeight - frozenRowsHeight,
|
|
35469
|
+
range: [0, rangeEnd],
|
|
35470
|
+
visible: visible === 'always'
|
|
35471
|
+
});
|
|
35472
|
+
const bounds = this.vScrollBar.AABBBounds && this.vScrollBar.globalAABBBounds;
|
|
35473
|
+
this.vScrollBar._viewPosition = {
|
|
35474
|
+
x: bounds.x1,
|
|
35475
|
+
y: bounds.y1
|
|
35476
|
+
};
|
|
35477
|
+
if (visible === 'always') {
|
|
35478
|
+
this.vScrollBar.showAll();
|
|
35479
|
+
}
|
|
35480
|
+
}
|
|
35481
|
+
else {
|
|
35482
|
+
this.vScrollBar.setAttributes({
|
|
35483
|
+
x: -this._gantt.tableNoFrameWidth * 2,
|
|
35484
|
+
y: -this._gantt.tableNoFrameHeight * 2,
|
|
35485
|
+
height: 0,
|
|
35486
|
+
visible: false
|
|
35487
|
+
});
|
|
35488
|
+
}
|
|
35489
|
+
this._gantt.stateManager.setScrollLeft(oldHorizontalBarPos);
|
|
35490
|
+
this._gantt.stateManager.setScrollTop(oldVerticalBarPos);
|
|
35491
|
+
}
|
|
35492
|
+
}
|
|
35493
|
+
|
|
35494
|
+
function throttle$1(func, delay) {
|
|
35495
|
+
let timer = null;
|
|
35496
|
+
return function (...args) {
|
|
35497
|
+
if (!timer) {
|
|
35498
|
+
func.apply(this, args);
|
|
35499
|
+
timer = setTimeout(() => {
|
|
35500
|
+
timer = null;
|
|
35501
|
+
}, delay);
|
|
35502
|
+
}
|
|
35503
|
+
};
|
|
35504
|
+
}
|
|
35505
|
+
function getTodayNearDay(dayOffset, format) {
|
|
35506
|
+
const today = new Date();
|
|
35507
|
+
const todayTime = today.getTime();
|
|
35508
|
+
const oneDayTime = 24 * 60 * 60 * 1000;
|
|
35509
|
+
const targetTime = todayTime + dayOffset * oneDayTime;
|
|
35510
|
+
const date = new Date(targetTime);
|
|
35511
|
+
if (format) {
|
|
35512
|
+
const year = date.getFullYear().toString();
|
|
35513
|
+
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
35514
|
+
const day = date.getDate().toString().padStart(2, '0');
|
|
35515
|
+
format = format.replace('yyyy', year);
|
|
35516
|
+
format = format.replace('mm', month);
|
|
35517
|
+
format = format.replace('dd', day);
|
|
35518
|
+
return format;
|
|
35519
|
+
}
|
|
35520
|
+
return date;
|
|
35521
|
+
}
|
|
35522
|
+
function formatDate(date, format) {
|
|
35523
|
+
const year = date.getFullYear().toString();
|
|
35524
|
+
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
35525
|
+
const day = date.getDate().toString().padStart(2, '0');
|
|
35526
|
+
format = format.replace('yyyy', year);
|
|
35527
|
+
format = format.replace('mm', month);
|
|
35528
|
+
format = format.replace('dd', day);
|
|
35529
|
+
if (format.length > 10) {
|
|
35530
|
+
const hour = date.getHours().toString().padStart(2, '0');
|
|
35531
|
+
const minute = date.getMinutes().toString().padStart(2, '0');
|
|
35532
|
+
const second = date.getSeconds().toString().padStart(2, '0');
|
|
35533
|
+
format = format.replace('hh', hour);
|
|
35534
|
+
format = format.replace('mm', minute);
|
|
35535
|
+
format = format.replace('ss', second);
|
|
35536
|
+
}
|
|
35537
|
+
return format;
|
|
35538
|
+
}
|
|
35539
|
+
function validateDate(dateParts, format) {
|
|
35540
|
+
const yearIndex = format.indexOf('yyyy');
|
|
35541
|
+
const monthIndex = format.indexOf('mm');
|
|
35542
|
+
const dayIndex = format.indexOf('dd');
|
|
35543
|
+
const dateYearIndex = yearIndex < monthIndex ? (yearIndex < dayIndex ? 0 : 1) : monthIndex < dayIndex ? 1 : 2;
|
|
35544
|
+
const dateMonthIndex = monthIndex < yearIndex ? (monthIndex < dayIndex ? 0 : 1) : monthIndex < dayIndex ? 1 : 2;
|
|
35545
|
+
const dateDayIndex = dayIndex < yearIndex ? (dayIndex < monthIndex ? 0 : 1) : dayIndex < monthIndex ? 1 : 2;
|
|
35546
|
+
const year = parseInt(dateParts[dateYearIndex], 10);
|
|
35547
|
+
const month = parseInt(dateParts[dateMonthIndex], 10) - 1;
|
|
35548
|
+
const day = parseInt(dateParts[dateDayIndex], 10);
|
|
35549
|
+
if (isNaN(year) || year < 1) {
|
|
35550
|
+
return false;
|
|
35551
|
+
}
|
|
35552
|
+
if (isNaN(month) || month < 0 || month > 11) {
|
|
35553
|
+
return false;
|
|
35554
|
+
}
|
|
35555
|
+
const daysInMonth = [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
35556
|
+
if (isNaN(day) || day < 1 || day > daysInMonth[month]) {
|
|
35557
|
+
return false;
|
|
35558
|
+
}
|
|
35559
|
+
return true;
|
|
35560
|
+
}
|
|
35561
|
+
function validateTime(dateParts, format) {
|
|
35562
|
+
if (format.includes('hh') || format.includes('mm') || format.includes('ss')) {
|
|
35563
|
+
const timeIndex = format.indexOf('hh') > -1 ? format.indexOf('hh') : format.indexOf('HH');
|
|
35564
|
+
const hour = parseInt(dateParts[timeIndex], 10);
|
|
35565
|
+
const minute = parseInt(dateParts[timeIndex + 1], 10);
|
|
35566
|
+
const second = dateParts.length > timeIndex + 2 ? parseInt(dateParts[timeIndex + 2], 10) : 0;
|
|
35567
|
+
if (isNaN(hour) || hour < 0 || hour > 23) {
|
|
35568
|
+
return false;
|
|
35569
|
+
}
|
|
35570
|
+
if (isNaN(minute) || minute < 0 || minute > 59) {
|
|
35571
|
+
return false;
|
|
35572
|
+
}
|
|
35573
|
+
if (isNaN(second) || second < 0 || second > 59) {
|
|
35574
|
+
return false;
|
|
35575
|
+
}
|
|
35576
|
+
}
|
|
35577
|
+
return true;
|
|
35578
|
+
}
|
|
35579
|
+
function isLeapYear(year) {
|
|
35580
|
+
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
|
|
35581
|
+
}
|
|
35582
|
+
function parseDateFormat(dateString) {
|
|
35583
|
+
const formats = [
|
|
35584
|
+
'yyyy-mm-dd',
|
|
35585
|
+
'dd-mm-yyyy',
|
|
35586
|
+
'mm/dd/yyyy',
|
|
35587
|
+
'yyyy/mm/dd',
|
|
35588
|
+
'dd/mm/yyyy',
|
|
35589
|
+
'yyyy.mm.dd',
|
|
35590
|
+
'mm.dd.yyyy',
|
|
35591
|
+
'dd.mm.yyyy'
|
|
35592
|
+
];
|
|
35593
|
+
const timeFormat = ['hh:mm:ss', 'hh:mm'];
|
|
35594
|
+
dateString = dateString.trim();
|
|
35595
|
+
const dates = dateString.split(' ');
|
|
35596
|
+
const date = dates[0];
|
|
35597
|
+
const time = dates[1];
|
|
35598
|
+
let dateFormatMatched;
|
|
35599
|
+
let timeFormatMatched;
|
|
35600
|
+
if (date) {
|
|
35601
|
+
for (let i = 0; i < formats.length; i++) {
|
|
35602
|
+
const format = formats[i];
|
|
35603
|
+
const dateParts = date.split(getSeparator(format));
|
|
35604
|
+
const isValid = validateDate(dateParts, format);
|
|
35605
|
+
if (dateParts.length === 3 && isValid) {
|
|
35606
|
+
dateFormatMatched = format;
|
|
35607
|
+
break;
|
|
35608
|
+
}
|
|
35609
|
+
}
|
|
35610
|
+
}
|
|
35611
|
+
if (dateFormatMatched) {
|
|
35612
|
+
if (time) {
|
|
35613
|
+
for (let i = 0; i < timeFormat.length; i++) {
|
|
35614
|
+
const format = timeFormat[i];
|
|
35615
|
+
const timeParts = time.split(getSeparator(format));
|
|
35616
|
+
const formatParts = format.split(getSeparator(format));
|
|
35617
|
+
const isValid = validateTime(timeParts, format);
|
|
35618
|
+
if (isValid && timeParts.length === formatParts.length) {
|
|
35619
|
+
timeFormatMatched = format;
|
|
35620
|
+
break;
|
|
35621
|
+
}
|
|
35622
|
+
}
|
|
35623
|
+
}
|
|
35624
|
+
}
|
|
35625
|
+
if (date && time && dateFormatMatched && timeFormatMatched) {
|
|
35626
|
+
return dateFormatMatched + ' ' + timeFormatMatched;
|
|
35627
|
+
}
|
|
35628
|
+
if (date && !time) {
|
|
35629
|
+
return dateFormatMatched;
|
|
35630
|
+
}
|
|
35631
|
+
return 'yyyy-mm-dd hh:mm:ss';
|
|
35632
|
+
}
|
|
35633
|
+
function getSeparator(format) {
|
|
35634
|
+
const separators = format.match(/[^\w]/g);
|
|
35635
|
+
if (separators) {
|
|
35636
|
+
const escapedSeparators = separators.map(s => '\\' + s).join('|');
|
|
35637
|
+
return new RegExp(escapedSeparators, 'g');
|
|
35638
|
+
}
|
|
35639
|
+
return /[^\w]/;
|
|
35640
|
+
}
|
|
35641
|
+
function parseStringTemplate(template, data) {
|
|
35642
|
+
const result = template.replace(/\{([^}]+)\}/g, (match, key) => {
|
|
35643
|
+
const keys = key.split('.');
|
|
35644
|
+
let value = data;
|
|
35645
|
+
for (const k of keys) {
|
|
35646
|
+
if (value.hasOwnProperty(k)) {
|
|
35647
|
+
value = value[k];
|
|
35648
|
+
}
|
|
35649
|
+
else {
|
|
35650
|
+
value = match;
|
|
35651
|
+
break;
|
|
35652
|
+
}
|
|
35653
|
+
}
|
|
35654
|
+
return value;
|
|
35655
|
+
});
|
|
35656
|
+
return result;
|
|
35657
|
+
}
|
|
35658
|
+
function toBoxArray$2(obj) {
|
|
35659
|
+
if (!Array.isArray(obj)) {
|
|
35660
|
+
return [obj, obj, obj, obj];
|
|
35661
|
+
}
|
|
35662
|
+
if (obj.length === 3) {
|
|
35663
|
+
return [obj[0], obj[1], obj[2], obj[1]];
|
|
35664
|
+
}
|
|
35665
|
+
if (obj.length === 2) {
|
|
35666
|
+
return [obj[0], obj[1], obj[0], obj[1]];
|
|
35667
|
+
}
|
|
35668
|
+
if (obj.length === 1) {
|
|
35669
|
+
return [obj[0], obj[0], obj[0], obj[0]];
|
|
35670
|
+
}
|
|
35671
|
+
return [obj[0], obj[1], obj[2], obj[3]];
|
|
35672
|
+
}
|
|
35673
|
+
function getWeekNumber(currentDate) {
|
|
35674
|
+
const startOfYear = new Date(currentDate.getFullYear(), 0, 1);
|
|
35675
|
+
const weekNumber = Math.ceil(((currentDate.getTime() + 1 - startOfYear.getTime()) / 86400000 + 1) / 7);
|
|
35676
|
+
return weekNumber;
|
|
35677
|
+
}
|
|
35678
|
+
function getWeekday(dateString, format = 'long') {
|
|
35679
|
+
const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
35680
|
+
const date = new Date(dateString);
|
|
35681
|
+
if (format === 'short') {
|
|
35682
|
+
return days[date.getDay()].substr(0, 3);
|
|
35683
|
+
}
|
|
35684
|
+
else if (format === 'long') {
|
|
35685
|
+
return days[date.getDay()];
|
|
35686
|
+
}
|
|
35687
|
+
return 'Invalid format specified. Please use "short" or "long".';
|
|
35688
|
+
}
|
|
35689
|
+
function isPropertyWritable(obj, prop) {
|
|
35690
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
35691
|
+
if (!descriptor) {
|
|
35692
|
+
return false;
|
|
35693
|
+
}
|
|
35694
|
+
return !!descriptor.set || descriptor.writable === true;
|
|
35695
|
+
}
|
|
35696
|
+
function createDateAtMidnight(dateStr, forceMidnight = false) {
|
|
35697
|
+
let date;
|
|
35698
|
+
if (dateStr) {
|
|
35699
|
+
date = new Date(dateStr);
|
|
35700
|
+
if (typeof dateStr === 'string') {
|
|
35701
|
+
if (dateStr.length > 10) {
|
|
35702
|
+
if (forceMidnight) {
|
|
35703
|
+
date.setHours(0, 0, 0, 0);
|
|
35704
|
+
}
|
|
35705
|
+
return date;
|
|
35706
|
+
}
|
|
35707
|
+
date.setHours(0, 0, 0, 0);
|
|
35708
|
+
}
|
|
35709
|
+
}
|
|
35710
|
+
else {
|
|
35711
|
+
date = new Date();
|
|
35712
|
+
}
|
|
35713
|
+
if (forceMidnight) {
|
|
35714
|
+
date.setHours(0, 0, 0, 0);
|
|
35715
|
+
}
|
|
35716
|
+
return date;
|
|
35717
|
+
}
|
|
35718
|
+
function createDateAtLastMinute(dateStr, forceSetMinute = false) {
|
|
35719
|
+
let date;
|
|
35720
|
+
if (dateStr) {
|
|
35721
|
+
date = new Date(dateStr);
|
|
35722
|
+
if (typeof dateStr === 'string') {
|
|
35723
|
+
if (dateStr.length > 10) {
|
|
35724
|
+
if (forceSetMinute) {
|
|
35725
|
+
date.setMinutes(59, 59, 999);
|
|
35726
|
+
}
|
|
35727
|
+
return date;
|
|
35728
|
+
}
|
|
35729
|
+
date.setMinutes(59, 59, 999);
|
|
35730
|
+
}
|
|
35731
|
+
}
|
|
35732
|
+
else {
|
|
35733
|
+
date = new Date();
|
|
35734
|
+
}
|
|
35735
|
+
if (forceSetMinute) {
|
|
35736
|
+
date.setMinutes(59, 59, 999);
|
|
35830
35737
|
}
|
|
35831
|
-
|
|
35832
|
-
|
|
35833
|
-
|
|
35834
|
-
|
|
35738
|
+
return date;
|
|
35739
|
+
}
|
|
35740
|
+
function createDateAtLastSecond(dateStr, forceSetSecond = false) {
|
|
35741
|
+
let date;
|
|
35742
|
+
if (dateStr) {
|
|
35743
|
+
date = new Date(dateStr);
|
|
35744
|
+
if (typeof dateStr === 'string') {
|
|
35745
|
+
if (dateStr.length > 10) {
|
|
35746
|
+
if (forceSetSecond) {
|
|
35747
|
+
date.setSeconds(59, 999);
|
|
35748
|
+
}
|
|
35749
|
+
return date;
|
|
35750
|
+
}
|
|
35751
|
+
date.setSeconds(59, 999);
|
|
35835
35752
|
}
|
|
35836
|
-
this.vScrollBar.setAttribute('visible', false);
|
|
35837
|
-
this.vScrollBar.hideAll();
|
|
35838
|
-
this._gantt.scenegraph.updateNextFrame();
|
|
35839
35753
|
}
|
|
35840
|
-
|
|
35841
|
-
|
|
35842
|
-
if (visable !== 'focus' && visable !== 'scrolling') {
|
|
35843
|
-
return;
|
|
35844
|
-
}
|
|
35845
|
-
this.vScrollBar.setAttribute('visible', true);
|
|
35846
|
-
this.vScrollBar.showAll();
|
|
35847
|
-
this._gantt.scenegraph.updateNextFrame();
|
|
35848
|
-
if (autoHide) {
|
|
35849
|
-
clearTimeout(this._clearVerticalScrollBar);
|
|
35850
|
-
this._clearVerticalScrollBar = setTimeout(() => {
|
|
35851
|
-
this.hideVerticalScrollBar();
|
|
35852
|
-
}, 1000);
|
|
35853
|
-
}
|
|
35754
|
+
else {
|
|
35755
|
+
date = new Date();
|
|
35854
35756
|
}
|
|
35855
|
-
|
|
35856
|
-
|
|
35857
|
-
if (visable !== 'focus' && visable !== 'scrolling') {
|
|
35858
|
-
return;
|
|
35859
|
-
}
|
|
35860
|
-
this.hScrollBar.setAttribute('visible', false);
|
|
35861
|
-
this.hScrollBar.hideAll();
|
|
35862
|
-
this._gantt.scenegraph.updateNextFrame();
|
|
35757
|
+
if (forceSetSecond) {
|
|
35758
|
+
date.setSeconds(59, 999);
|
|
35863
35759
|
}
|
|
35864
|
-
|
|
35865
|
-
|
|
35866
|
-
|
|
35867
|
-
|
|
35868
|
-
|
|
35869
|
-
|
|
35870
|
-
|
|
35871
|
-
|
|
35872
|
-
|
|
35873
|
-
|
|
35874
|
-
|
|
35875
|
-
|
|
35876
|
-
}
|
|
35760
|
+
return date;
|
|
35761
|
+
}
|
|
35762
|
+
function createDateAtLastMillisecond(dateStr, forceSetMillisecond = false) {
|
|
35763
|
+
let date;
|
|
35764
|
+
if (dateStr) {
|
|
35765
|
+
date = new Date(dateStr);
|
|
35766
|
+
if (typeof dateStr === 'string') {
|
|
35767
|
+
if (dateStr.length > 10) {
|
|
35768
|
+
if (forceSetMillisecond) {
|
|
35769
|
+
date.setMilliseconds(999);
|
|
35770
|
+
}
|
|
35771
|
+
return date;
|
|
35772
|
+
}
|
|
35773
|
+
date.setMilliseconds(999);
|
|
35877
35774
|
}
|
|
35878
35775
|
}
|
|
35879
|
-
|
|
35880
|
-
|
|
35881
|
-
const size = range[1] - range[0];
|
|
35882
|
-
const range0 = topRatio * (1 - size);
|
|
35883
|
-
this.vScrollBar.setAttribute('range', [range0, range0 + size]);
|
|
35884
|
-
const bounds = this.vScrollBar.AABBBounds && this.vScrollBar.globalAABBBounds;
|
|
35885
|
-
this.vScrollBar._viewPosition = {
|
|
35886
|
-
x: bounds.x1,
|
|
35887
|
-
y: bounds.y1
|
|
35888
|
-
};
|
|
35776
|
+
else {
|
|
35777
|
+
date = new Date();
|
|
35889
35778
|
}
|
|
35890
|
-
|
|
35891
|
-
|
|
35892
|
-
const size = range[1] - range[0];
|
|
35893
|
-
const range0 = leftRatio * (1 - size);
|
|
35894
|
-
this.hScrollBar.setAttribute('range', [range0, range0 + size]);
|
|
35895
|
-
const bounds = this.hScrollBar.AABBBounds && this.hScrollBar.globalAABBBounds;
|
|
35896
|
-
this.hScrollBar._viewPosition = {
|
|
35897
|
-
x: bounds.x1,
|
|
35898
|
-
y: bounds.y1
|
|
35899
|
-
};
|
|
35779
|
+
if (forceSetMillisecond) {
|
|
35780
|
+
date.setMilliseconds(999);
|
|
35900
35781
|
}
|
|
35901
|
-
|
|
35902
|
-
|
|
35903
|
-
|
|
35904
|
-
|
|
35905
|
-
|
|
35906
|
-
|
|
35907
|
-
|
|
35908
|
-
|
|
35909
|
-
|
|
35910
|
-
|
|
35911
|
-
|
|
35912
|
-
|
|
35913
|
-
const y = Math.min(tableHeight, totalHeight);
|
|
35914
|
-
const rangeEnd = Math.max(0.05, tableWidth / totalWidth);
|
|
35915
|
-
const hoverOn = scrollStyle.hoverOn;
|
|
35916
|
-
let attrY = 0;
|
|
35917
|
-
if (scrollStyle.barToSide) {
|
|
35918
|
-
attrY =
|
|
35919
|
-
this._gantt.tableNoFrameHeight -
|
|
35920
|
-
(hoverOn ? width : -this._gantt.scenegraph.ganttGroup.attribute.y) +
|
|
35921
|
-
this._gantt.tableY;
|
|
35922
|
-
}
|
|
35923
|
-
else {
|
|
35924
|
-
attrY = y - (hoverOn ? width : -this._gantt.scenegraph.ganttGroup.attribute.y) + this._gantt.tableY;
|
|
35925
|
-
}
|
|
35926
|
-
this.hScrollBar.setAttributes({
|
|
35927
|
-
x: this._gantt.scenegraph.ganttGroup.attribute.x,
|
|
35928
|
-
y: attrY,
|
|
35929
|
-
width: tableWidth,
|
|
35930
|
-
range: [0, rangeEnd],
|
|
35931
|
-
visible: visible === 'always'
|
|
35932
|
-
});
|
|
35933
|
-
const bounds = this.hScrollBar.AABBBounds && this.hScrollBar.globalAABBBounds;
|
|
35934
|
-
this.hScrollBar._viewPosition = {
|
|
35935
|
-
x: bounds.x1,
|
|
35936
|
-
y: bounds.y1
|
|
35937
|
-
};
|
|
35938
|
-
if (visible === 'always') {
|
|
35939
|
-
this.hScrollBar.showAll();
|
|
35782
|
+
return date;
|
|
35783
|
+
}
|
|
35784
|
+
function createDateAtLastHour(dateStr, forceLastHour = false) {
|
|
35785
|
+
let date;
|
|
35786
|
+
if (dateStr) {
|
|
35787
|
+
date = new Date(dateStr);
|
|
35788
|
+
if (typeof dateStr === 'string') {
|
|
35789
|
+
if (dateStr.length > 10) {
|
|
35790
|
+
if (forceLastHour) {
|
|
35791
|
+
date.setHours(23, 59, 59, 999);
|
|
35792
|
+
}
|
|
35793
|
+
return date;
|
|
35940
35794
|
}
|
|
35795
|
+
date.setHours(23, 59, 59, 999);
|
|
35941
35796
|
}
|
|
35942
|
-
|
|
35943
|
-
|
|
35944
|
-
|
|
35945
|
-
|
|
35946
|
-
|
|
35947
|
-
|
|
35948
|
-
|
|
35797
|
+
}
|
|
35798
|
+
else {
|
|
35799
|
+
date = new Date();
|
|
35800
|
+
}
|
|
35801
|
+
if (forceLastHour) {
|
|
35802
|
+
date.setHours(23, 59, 59, 999);
|
|
35803
|
+
}
|
|
35804
|
+
return date;
|
|
35805
|
+
}
|
|
35806
|
+
function getEndDateByTimeUnit(startDate, date, timeScale, step) {
|
|
35807
|
+
let endDate = new Date(date);
|
|
35808
|
+
switch (timeScale) {
|
|
35809
|
+
case 'second':
|
|
35810
|
+
endDate.setMilliseconds(999);
|
|
35811
|
+
break;
|
|
35812
|
+
case 'minute':
|
|
35813
|
+
endDate.setSeconds(59, 999);
|
|
35814
|
+
break;
|
|
35815
|
+
case 'hour':
|
|
35816
|
+
endDate.setMinutes(59, 59, 999);
|
|
35817
|
+
break;
|
|
35818
|
+
case 'day':
|
|
35819
|
+
endDate.setHours(23, 59, 59, 999);
|
|
35820
|
+
break;
|
|
35821
|
+
case 'week':
|
|
35822
|
+
const day = endDate.getDay();
|
|
35823
|
+
const diffToEndOfWeek = 6 - day;
|
|
35824
|
+
endDate.setDate(endDate.getDate() + diffToEndOfWeek);
|
|
35825
|
+
endDate.setHours(23, 59, 59, 999);
|
|
35826
|
+
break;
|
|
35827
|
+
case 'month':
|
|
35828
|
+
const lastDayOfMonth = new Date(endDate.getFullYear(), endDate.getMonth() + 1, 0).getDate();
|
|
35829
|
+
endDate.setDate(lastDayOfMonth);
|
|
35830
|
+
endDate.setHours(23, 59, 59, 999);
|
|
35831
|
+
break;
|
|
35832
|
+
case 'quarter':
|
|
35833
|
+
const currentMonth = endDate.getMonth();
|
|
35834
|
+
const endMonthOfQuarter = currentMonth - (currentMonth % 3) + 2;
|
|
35835
|
+
const lastDayOfQuarter = new Date(endDate.getFullYear(), endMonthOfQuarter + 1, 0).getDate();
|
|
35836
|
+
endDate.setMonth(endMonthOfQuarter, lastDayOfQuarter);
|
|
35837
|
+
endDate.setHours(23, 59, 59, 999);
|
|
35838
|
+
break;
|
|
35839
|
+
case 'year':
|
|
35840
|
+
endDate.setMonth(11, 31);
|
|
35841
|
+
endDate.setHours(23, 59, 59, 999);
|
|
35842
|
+
break;
|
|
35843
|
+
default:
|
|
35844
|
+
throw new Error('Invalid time scale');
|
|
35845
|
+
}
|
|
35846
|
+
const count = computeCountToTimeScale(endDate, startDate, timeScale, step, 1);
|
|
35847
|
+
const targetCount = Math.ceil(count);
|
|
35848
|
+
if (targetCount > count) {
|
|
35849
|
+
const dif = (targetCount - count) * step;
|
|
35850
|
+
const msInSecond = 1000;
|
|
35851
|
+
const msInMinute = msInSecond * 60;
|
|
35852
|
+
const msInHour = msInMinute * 60;
|
|
35853
|
+
const msInDay = msInHour * 24;
|
|
35854
|
+
const msInWeek = msInDay * 7;
|
|
35855
|
+
new Date(endDate.getTime() + 1);
|
|
35856
|
+
switch (timeScale) {
|
|
35857
|
+
case 'second':
|
|
35858
|
+
endDate.setTime(endDate.getTime() + dif * msInSecond);
|
|
35859
|
+
break;
|
|
35860
|
+
case 'minute':
|
|
35861
|
+
endDate.setTime(endDate.getTime() + dif * msInMinute);
|
|
35862
|
+
break;
|
|
35863
|
+
case 'hour':
|
|
35864
|
+
endDate.setTime(endDate.getTime() + dif * msInHour);
|
|
35865
|
+
break;
|
|
35866
|
+
case 'day':
|
|
35867
|
+
endDate.setTime(endDate.getTime() + dif * msInDay);
|
|
35868
|
+
break;
|
|
35869
|
+
case 'week':
|
|
35870
|
+
endDate.setTime(endDate.getTime() + dif * msInWeek);
|
|
35871
|
+
break;
|
|
35872
|
+
case 'month':
|
|
35873
|
+
endDate = new Date(endDate.getFullYear(), endDate.getMonth() + 1 + Math.round(dif), 0);
|
|
35874
|
+
endDate.setHours(23, 59, 59, 999);
|
|
35875
|
+
break;
|
|
35876
|
+
case 'quarter':
|
|
35877
|
+
const currentMonth = endDate.getMonth();
|
|
35878
|
+
const endMonthOfQuarter = currentMonth - (currentMonth % 3) + 2;
|
|
35879
|
+
endDate = new Date(endDate.getFullYear(), endMonthOfQuarter + Math.round(dif * 3) + 1, 0);
|
|
35880
|
+
endDate.setHours(23, 59, 59, 999);
|
|
35881
|
+
break;
|
|
35882
|
+
case 'year':
|
|
35883
|
+
endDate.setFullYear(endDate.getFullYear() + Math.floor(dif));
|
|
35884
|
+
endDate.setHours(23, 59, 59, 999);
|
|
35885
|
+
break;
|
|
35886
|
+
default:
|
|
35887
|
+
throw new Error('Invalid time scale');
|
|
35949
35888
|
}
|
|
35950
|
-
|
|
35951
|
-
|
|
35952
|
-
|
|
35953
|
-
|
|
35954
|
-
|
|
35955
|
-
|
|
35956
|
-
|
|
35889
|
+
}
|
|
35890
|
+
return endDate;
|
|
35891
|
+
}
|
|
35892
|
+
function getStartDateByTimeUnit(date, timeScale, startOfWeekSetting = 'monday') {
|
|
35893
|
+
const startDate = new Date(date);
|
|
35894
|
+
switch (timeScale) {
|
|
35895
|
+
case 'second':
|
|
35896
|
+
startDate.setMilliseconds(0);
|
|
35897
|
+
break;
|
|
35898
|
+
case 'minute':
|
|
35899
|
+
startDate.setSeconds(0, 0);
|
|
35900
|
+
break;
|
|
35901
|
+
case 'hour':
|
|
35902
|
+
startDate.setMinutes(0, 0, 0);
|
|
35903
|
+
break;
|
|
35904
|
+
case 'day':
|
|
35905
|
+
startDate.setHours(0, 0, 0, 0);
|
|
35906
|
+
break;
|
|
35907
|
+
case 'week':
|
|
35908
|
+
const day = startDate.getDay();
|
|
35909
|
+
let diffToStartOfWeek = day;
|
|
35910
|
+
if (startOfWeekSetting === 'monday') {
|
|
35911
|
+
diffToStartOfWeek = day === 0 ? -6 : 1 - day;
|
|
35957
35912
|
}
|
|
35958
35913
|
else {
|
|
35959
|
-
|
|
35960
|
-
}
|
|
35961
|
-
this.vScrollBar.setAttributes({
|
|
35962
|
-
x: attrX,
|
|
35963
|
-
y: frozenRowsHeight + (!hoverOn ? this._gantt.scenegraph.ganttGroup.attribute.y : 0) + this._gantt.tableY,
|
|
35964
|
-
height: tableHeight - frozenRowsHeight,
|
|
35965
|
-
range: [0, rangeEnd],
|
|
35966
|
-
visible: visible === 'always'
|
|
35967
|
-
});
|
|
35968
|
-
const bounds = this.vScrollBar.AABBBounds && this.vScrollBar.globalAABBBounds;
|
|
35969
|
-
this.vScrollBar._viewPosition = {
|
|
35970
|
-
x: bounds.x1,
|
|
35971
|
-
y: bounds.y1
|
|
35972
|
-
};
|
|
35973
|
-
if (visible === 'always') {
|
|
35974
|
-
this.vScrollBar.showAll();
|
|
35914
|
+
diffToStartOfWeek = -day;
|
|
35975
35915
|
}
|
|
35976
|
-
|
|
35977
|
-
|
|
35978
|
-
|
|
35979
|
-
|
|
35980
|
-
|
|
35981
|
-
|
|
35982
|
-
|
|
35983
|
-
|
|
35984
|
-
|
|
35985
|
-
|
|
35986
|
-
|
|
35916
|
+
startDate.setDate(startDate.getDate() + diffToStartOfWeek);
|
|
35917
|
+
startDate.setHours(0, 0, 0, 0);
|
|
35918
|
+
break;
|
|
35919
|
+
case 'month':
|
|
35920
|
+
startDate.setDate(1);
|
|
35921
|
+
startDate.setHours(0, 0, 0, 0);
|
|
35922
|
+
break;
|
|
35923
|
+
case 'quarter':
|
|
35924
|
+
const currentMonth = startDate.getMonth();
|
|
35925
|
+
const startMonthOfQuarter = currentMonth - (currentMonth % 3);
|
|
35926
|
+
startDate.setMonth(startMonthOfQuarter, 1);
|
|
35927
|
+
startDate.setHours(0, 0, 0, 0);
|
|
35928
|
+
break;
|
|
35929
|
+
case 'year':
|
|
35930
|
+
startDate.setMonth(0, 1);
|
|
35931
|
+
startDate.setHours(0, 0, 0, 0);
|
|
35932
|
+
break;
|
|
35933
|
+
default:
|
|
35934
|
+
throw new Error('Invalid time scale');
|
|
35935
|
+
}
|
|
35936
|
+
return startDate;
|
|
35937
|
+
}
|
|
35938
|
+
function computeCountToTimeScale(date, startDate, timeScale, step, diffMS = 0) {
|
|
35939
|
+
const msInSecond = 1000;
|
|
35940
|
+
const msInMinute = msInSecond * 60;
|
|
35941
|
+
const msInHour = msInMinute * 60;
|
|
35942
|
+
const msInDay = msInHour * 24;
|
|
35943
|
+
const msInWeek = msInDay * 7;
|
|
35944
|
+
let difference;
|
|
35945
|
+
const adjusted_date = new Date(date.getTime() + diffMS);
|
|
35946
|
+
switch (timeScale) {
|
|
35947
|
+
case 'second':
|
|
35948
|
+
difference = (adjusted_date.getTime() - startDate.getTime()) / msInSecond;
|
|
35949
|
+
break;
|
|
35950
|
+
case 'minute':
|
|
35951
|
+
difference = (adjusted_date.getTime() - startDate.getTime()) / msInMinute;
|
|
35952
|
+
break;
|
|
35953
|
+
case 'hour':
|
|
35954
|
+
difference = (adjusted_date.getTime() - startDate.getTime()) / msInHour;
|
|
35955
|
+
break;
|
|
35956
|
+
case 'day':
|
|
35957
|
+
difference = (adjusted_date.getTime() - startDate.getTime()) / msInDay;
|
|
35958
|
+
break;
|
|
35959
|
+
case 'week':
|
|
35960
|
+
difference = (adjusted_date.getTime() - startDate.getTime()) / msInWeek;
|
|
35961
|
+
break;
|
|
35962
|
+
case 'month':
|
|
35963
|
+
const startDaysInMonth = new Date(startDate.getFullYear(), startDate.getMonth() + 1, 0).getDate();
|
|
35964
|
+
const adjustedDaysInMonth = new Date(adjusted_date.getFullYear(), adjusted_date.getMonth() + 1, 0).getDate();
|
|
35965
|
+
difference =
|
|
35966
|
+
(adjusted_date.getFullYear() - startDate.getFullYear()) * 12 +
|
|
35967
|
+
(adjusted_date.getMonth() - startDate.getMonth());
|
|
35968
|
+
difference += adjusted_date.getDate() / adjustedDaysInMonth - startDate.getDate() / startDaysInMonth;
|
|
35969
|
+
break;
|
|
35970
|
+
case 'quarter':
|
|
35971
|
+
difference =
|
|
35972
|
+
(adjusted_date.getFullYear() - startDate.getFullYear()) * 4 +
|
|
35973
|
+
(adjusted_date.getMonth() - startDate.getMonth()) / 3;
|
|
35974
|
+
difference +=
|
|
35975
|
+
(adjusted_date.getDate() - startDate.getDate()) /
|
|
35976
|
+
(3 * new Date(adjusted_date.getFullYear(), adjusted_date.getMonth() + 1, 0).getDate());
|
|
35977
|
+
break;
|
|
35978
|
+
case 'year':
|
|
35979
|
+
difference = adjusted_date.getFullYear() - startDate.getFullYear();
|
|
35980
|
+
difference += (adjusted_date.getMonth() - startDate.getMonth()) / 12;
|
|
35981
|
+
break;
|
|
35982
|
+
default:
|
|
35983
|
+
throw new Error('Invalid time scale');
|
|
35987
35984
|
}
|
|
35985
|
+
return difference / step;
|
|
35988
35986
|
}
|
|
35989
35987
|
|
|
35990
35988
|
function handleWhell$1(event, state, gantt, isWheelEvent = true) {
|
|
@@ -36179,10 +36177,7 @@
|
|
|
36179
36177
|
const isNode$1 = typeof window === 'undefined' || typeof window.window === 'undefined';
|
|
36180
36178
|
const DayTimes = 1000 * 60 * 60 * 24;
|
|
36181
36179
|
function getDateIndexByX(x, gantt) {
|
|
36182
|
-
|
|
36183
|
-
const firstDateColWidth = gantt.getDateColWidth(0);
|
|
36184
|
-
const dateIndex = Math.floor((totalX - firstDateColWidth) / gantt.parsedOptions.timelineColWidth) + 1;
|
|
36185
|
-
return dateIndex;
|
|
36180
|
+
return gantt.getDateIndexByX(x);
|
|
36186
36181
|
}
|
|
36187
36182
|
function generateMarkLine(markLine) {
|
|
36188
36183
|
if (!markLine) {
|
|
@@ -37097,7 +37092,6 @@
|
|
|
37097
37092
|
this.group = dateHeader;
|
|
37098
37093
|
dateHeader.name = 'date-header-container';
|
|
37099
37094
|
scene.ganttGroup.addChild(this.group);
|
|
37100
|
-
const { unit: minUnit, step } = scene._gantt.parsedOptions.reverseSortedTimelineScales[0];
|
|
37101
37095
|
let y = 0;
|
|
37102
37096
|
for (let i = 0; i < scene._gantt.timeLineHeaderLevel; i++) {
|
|
37103
37097
|
const { timelineDates, customLayout, visible } = scene._gantt.parsedOptions.sortedTimelineScales[i];
|
|
@@ -37116,10 +37110,8 @@
|
|
|
37116
37110
|
dateHeader.addChild(rowHeader);
|
|
37117
37111
|
for (let j = 0; j < timelineDates?.length; j++) {
|
|
37118
37112
|
const { days, endDate, startDate, title, dateIndex, unit } = timelineDates[j];
|
|
37119
|
-
const x = Math.ceil(
|
|
37120
|
-
|
|
37121
|
-
const right_x = Math.ceil(computeCountToTimeScale(endDate, scene._gantt.parsedOptions.minDate, minUnit, step, 1) *
|
|
37122
|
-
scene._gantt.parsedOptions.timelineColWidth);
|
|
37113
|
+
const x = Math.ceil(scene._gantt.getXByTime(startDate.getTime()));
|
|
37114
|
+
const right_x = Math.ceil(scene._gantt.getXByTime(endDate.getTime() + 1));
|
|
37123
37115
|
const width = right_x - x;
|
|
37124
37116
|
const date = new Group$2({
|
|
37125
37117
|
x,
|
|
@@ -38774,6 +38766,8 @@
|
|
|
38774
38766
|
RESIZE_COLUMN_END: "resize_column_end",
|
|
38775
38767
|
RESIZE_ROW: "resize_row",
|
|
38776
38768
|
RESIZE_ROW_END: "resize_row_end",
|
|
38769
|
+
MERGE_CELLS: "merge_cells",
|
|
38770
|
+
UNMERGE_CELLS: "unmerge_cells",
|
|
38777
38771
|
CHANGE_HEADER_POSITION_START: "change_header_position_start",
|
|
38778
38772
|
CHANGE_HEADER_POSITION: "change_header_position",
|
|
38779
38773
|
CHANGING_HEADER_POSITION: "changing_header_position",
|
|
@@ -41267,7 +41261,7 @@
|
|
|
41267
41261
|
}
|
|
41268
41262
|
clearFilteredChildren(record) {
|
|
41269
41263
|
var _a, _b;
|
|
41270
|
-
record.filteredChildren = void 0;
|
|
41264
|
+
record.filteredChildren = void 0, delete record.filteredChildren;
|
|
41271
41265
|
for (let i = 0; i < (null !== (_b = null === (_a = record.children) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0); i++) this.clearFilteredChildren(record.children[i]);
|
|
41272
41266
|
}
|
|
41273
41267
|
filterRecord(record) {
|
|
@@ -41370,8 +41364,9 @@
|
|
|
41370
41364
|
fieldPromiseCallBack(_index, _field, _value) {}
|
|
41371
41365
|
recordPromiseCallBack(_index, _record) {}
|
|
41372
41366
|
canChangeOrder(sourceIndex, targetIndex) {
|
|
41373
|
-
var _a;
|
|
41367
|
+
var _a, _b;
|
|
41374
41368
|
if (null === (_a = this.dataSourceObj) || void 0 === _a ? void 0 : _a.canChangeOrder) return this.dataSourceObj.canChangeOrder(sourceIndex, targetIndex);
|
|
41369
|
+
if (null === (_b = this.lastSortStates) || void 0 === _b ? void 0 : _b.some(state => "asc" === state.order || "desc" === state.order)) return !1;
|
|
41375
41370
|
if (this.hasHierarchyStateExpand) {
|
|
41376
41371
|
let sourceIndexs = this.currentPagerIndexedData[sourceIndex],
|
|
41377
41372
|
targetIndexs = this.currentPagerIndexedData[targetIndex];
|
|
@@ -45374,7 +45369,7 @@
|
|
|
45374
45369
|
function updateCell$1(col, row, table, addNew, isShadow, forceFastUpdate) {
|
|
45375
45370
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
45376
45371
|
const oldCellGroup = table.scenegraph.highPerformanceGetCell(col, row, !0);
|
|
45377
|
-
if ("cell" !== oldCellGroup.role && !addNew) return;
|
|
45372
|
+
if ("cell" !== oldCellGroup.role && "shadow-cell" !== oldCellGroup.role && !addNew) return;
|
|
45378
45373
|
const cellLocation = table.getCellLocation(col, row);
|
|
45379
45374
|
let isMerge,
|
|
45380
45375
|
range,
|
|
@@ -52824,7 +52819,7 @@
|
|
|
52824
52819
|
}), scene.tableGroup.role = "table";
|
|
52825
52820
|
const colHeaderGroup = createContainerGroup(0, 0, !scene.table.internalProps.enableTreeStickCell);
|
|
52826
52821
|
colHeaderGroup.role = "col-header", scene.colHeaderGroup = colHeaderGroup;
|
|
52827
|
-
const cornerHeaderGroup = createContainerGroup(0, 0, !scene.table.
|
|
52822
|
+
const cornerHeaderGroup = createContainerGroup(0, 0, !scene.table.internalProps.enableTreeStickCell);
|
|
52828
52823
|
cornerHeaderGroup.role = "corner-header", scene.cornerHeaderGroup = cornerHeaderGroup;
|
|
52829
52824
|
const rowHeaderGroup = createContainerGroup(0, 0, !0);
|
|
52830
52825
|
rowHeaderGroup.role = "row-header", scene.rowHeaderGroup = rowHeaderGroup;
|
|
@@ -55622,13 +55617,13 @@
|
|
|
55622
55617
|
setSortState(sortState) {
|
|
55623
55618
|
const state = this;
|
|
55624
55619
|
const sort = (sortState = !sortState || Array.isArray(sortState) ? sortState : [sortState]) && sortState.reduce((prev, item) => {
|
|
55625
|
-
var _a, _b, _c;
|
|
55620
|
+
var _a, _b, _c, _d, _e;
|
|
55626
55621
|
const column = null === (_a = function (columns) {
|
|
55627
55622
|
const result = [];
|
|
55628
55623
|
return function flatten(cols, parentStartIndex = 0) {
|
|
55629
55624
|
cols.forEach(col => {
|
|
55630
55625
|
var _a;
|
|
55631
|
-
const startIndex = col.startInTotal ? null !== (_a =
|
|
55626
|
+
const startIndex = col.startInTotal ? col.startInTotal + (null !== (_a = state.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount) && void 0 !== _a ? _a : 0) : parentStartIndex;
|
|
55632
55627
|
col.columns ? flatten(col.columns, startIndex) : result.push(Object.assign(Object.assign({}, col), {
|
|
55633
55628
|
startIndex: startIndex
|
|
55634
55629
|
}));
|
|
@@ -55638,12 +55633,12 @@
|
|
|
55638
55633
|
return this.table.internalProps.transpose ? prev.push({
|
|
55639
55634
|
field: item.field,
|
|
55640
55635
|
order: item.order,
|
|
55641
|
-
row: null !== (_b =
|
|
55636
|
+
row: (null !== (_b = null == column ? void 0 : column.startInTotal) && void 0 !== _b ? _b : 0) + (null !== (_c = this.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount) && void 0 !== _c ? _c : 0),
|
|
55642
55637
|
col: null == column ? void 0 : column.level
|
|
55643
55638
|
}) : prev.push({
|
|
55644
55639
|
field: item.field,
|
|
55645
55640
|
order: item.order,
|
|
55646
|
-
col: null !== (
|
|
55641
|
+
col: (null !== (_d = null == column ? void 0 : column.startInTotal) && void 0 !== _d ? _d : 0) + (null !== (_e = this.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount) && void 0 !== _e ? _e : 0),
|
|
55647
55642
|
row: null == column ? void 0 : column.level
|
|
55648
55643
|
}), prev;
|
|
55649
55644
|
}, []);
|
|
@@ -56155,13 +56150,16 @@
|
|
|
56155
56150
|
this.select.selectInline = selectInline;
|
|
56156
56151
|
}
|
|
56157
56152
|
updateSortState(sortState) {
|
|
56158
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
56159
|
-
sortState = Array.isArray(sortState) ? sortState : [sortState]
|
|
56153
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
56154
|
+
const isSame = (sortState = Array.isArray(sortState) ? sortState : [sortState]).length === this.sort.length && sortState.every((item, index) => {
|
|
56155
|
+
var _a, _b;
|
|
56156
|
+
return (null == item ? void 0 : item.field) === (null === (_a = this.sort[index]) || void 0 === _a ? void 0 : _a.field) && (null == item ? void 0 : item.order) === (null === (_b = this.sort[index]) || void 0 === _b ? void 0 : _b.order);
|
|
56157
|
+
});
|
|
56158
|
+
if (isSame) return;
|
|
56160
56159
|
for (let index = 0; index < sortState.length; index++) {
|
|
56161
|
-
|
|
56162
|
-
|
|
56163
|
-
|
|
56164
|
-
"asc" === (null === (_e = this.sort[index]) || void 0 === _e ? void 0 : _e.order) || null === (_f = this.sort[index]) || void 0 === _f || _f.order;
|
|
56160
|
+
const oldSortCol = this.table.internalProps.multipleSort ? null : (null === (_a = this.sort[index]) || void 0 === _a ? void 0 : _a.col) || null,
|
|
56161
|
+
oldSortRow = this.table.internalProps.multipleSort ? null : (null === (_b = this.sort[index]) || void 0 === _b ? void 0 : _b.row) || null;
|
|
56162
|
+
"asc" === (null === (_c = this.sort[index]) || void 0 === _c ? void 0 : _c.order) || null === (_d = this.sort[index]) || void 0 === _d || _d.order;
|
|
56165
56163
|
this.setSortState(sortState.slice(0, index + 1));
|
|
56166
56164
|
const cellAddress = this.table.internalProps.layoutMap.getHeaderCellAddressByField(sortState[index].field);
|
|
56167
56165
|
this.sort[index].col = cellAddress.col, this.sort[index].row = cellAddress.row;
|
|
@@ -56174,7 +56172,7 @@
|
|
|
56174
56172
|
order: this.sort[index].order,
|
|
56175
56173
|
oldSortCol: oldSortCol,
|
|
56176
56174
|
oldSortRow: oldSortRow,
|
|
56177
|
-
oldIconMark: null === (
|
|
56175
|
+
oldIconMark: null === (_e = this.sort[index]) || void 0 === _e ? void 0 : _e.icon
|
|
56178
56176
|
});
|
|
56179
56177
|
}
|
|
56180
56178
|
const normalHeaders = [];
|
|
@@ -56188,7 +56186,7 @@
|
|
|
56188
56186
|
row: null,
|
|
56189
56187
|
iconMark: null,
|
|
56190
56188
|
order: null,
|
|
56191
|
-
oldSortCol: null !== (
|
|
56189
|
+
oldSortCol: (null !== (_f = column.startInTotal) && void 0 !== _f ? _f : 0) + (null !== (_g = this.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount) && void 0 !== _g ? _g : 0),
|
|
56192
56190
|
oldSortRow: column.level,
|
|
56193
56191
|
oldIconMark: null
|
|
56194
56192
|
});
|
|
@@ -60318,11 +60316,11 @@
|
|
|
60318
60316
|
onUpdate(end, ratio, out) {
|
|
60319
60317
|
if (this.from.x !== this.to.x) {
|
|
60320
60318
|
const x = end ? this.to.x : this.from.x + Math.floor((this.to.x - this.from.x) * ratio);
|
|
60321
|
-
this.params.table.scrollLeft = x;
|
|
60319
|
+
this.params.table.scrollLeft = x, 1 === ratio && -1 !== this.to.targetCol && this.params.table.scrollToCol(this.to.targetCol, !1);
|
|
60322
60320
|
}
|
|
60323
60321
|
if (this.from.y !== this.to.y) {
|
|
60324
60322
|
const y = end ? this.to.y : this.from.y + Math.floor((this.to.y - this.from.y) * ratio);
|
|
60325
|
-
this.params.table.scrollTop = y;
|
|
60323
|
+
this.params.table.scrollTop = y, 1 === ratio && -1 !== this.to.targetRow && this.params.table.scrollToRow(this.to.targetRow, !1);
|
|
60326
60324
|
}
|
|
60327
60325
|
}
|
|
60328
60326
|
}
|
|
@@ -60354,7 +60352,9 @@
|
|
|
60354
60352
|
colDecimal && (left += colDecimal * cellRect.width), rowDecimal && (top += rowDecimal * cellRect.height);
|
|
60355
60353
|
const to = {
|
|
60356
60354
|
x: isNumber$2(col) ? left - this.table.getFrozenColsWidth() : this.table.scrollLeft,
|
|
60357
|
-
y: isNumber$2(row) ? top - this.table.getFrozenRowsHeight() : this.table.scrollTop
|
|
60355
|
+
y: isNumber$2(row) ? top - this.table.getFrozenRowsHeight() : this.table.scrollTop,
|
|
60356
|
+
targetRow: null != rowInt ? rowInt : -1,
|
|
60357
|
+
targetCol: null != colInt ? colInt : -1
|
|
60358
60358
|
},
|
|
60359
60359
|
duration = isBoolean$2(animationOption) ? animationOption ? 3e3 : 0 : null !== (_a = null == animationOption ? void 0 : animationOption.duration) && void 0 !== _a ? _a : 3e3,
|
|
60360
60360
|
easing = isBoolean$2(animationOption) ? animationOption ? "linear" : "" : null !== (_b = null == animationOption ? void 0 : animationOption.easing) && void 0 !== _b ? _b : "linear";
|
|
@@ -60441,7 +60441,7 @@
|
|
|
60441
60441
|
}
|
|
60442
60442
|
constructor(container, options = {}) {
|
|
60443
60443
|
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;
|
|
60444
|
-
if (super(), this.showFrozenIcon = !0, this._tableBorderWidth_left = 0, this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0, this.version = "1.
|
|
60444
|
+
if (super(), this.showFrozenIcon = !0, this._scrollToRowCorrectTimer = null, this._tableBorderWidth_left = 0, this._tableBorderWidth_right = 0, this._tableBorderWidth_top = 0, this._tableBorderWidth_bottom = 0, this.version = "1.24.0-alpha.0", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
|
|
60445
60445
|
this.pluginManager = new PluginManager$1(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
|
|
60446
60446
|
options: options,
|
|
60447
60447
|
container: container
|
|
@@ -61379,12 +61379,15 @@
|
|
|
61379
61379
|
dispose() {
|
|
61380
61380
|
this.release();
|
|
61381
61381
|
}
|
|
61382
|
+
clearCorrectTimer() {
|
|
61383
|
+
this._scrollToRowCorrectTimer && (clearTimeout(this._scrollToRowCorrectTimer), this._scrollToRowCorrectTimer = null);
|
|
61384
|
+
}
|
|
61382
61385
|
release() {
|
|
61383
61386
|
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;
|
|
61384
61387
|
null === (_c = null === (_b = null === (_a = this.scenegraph) || void 0 === _a ? void 0 : _a.component) || void 0 === _b ? void 0 : _b.vScrollBar) || void 0 === _c || _c.release(), null === (_f = null === (_e = null === (_d = this.scenegraph) || void 0 === _d ? void 0 : _d.component) || void 0 === _e ? void 0 : _e.hScrollBar) || void 0 === _f || _f.release(), this.animationManager.clear(), this.animationManager.ticker.release(), null === (_j = null === (_h = null === (_g = this.scenegraph) || void 0 === _g ? void 0 : _g.stage) || void 0 === _h ? void 0 : _h.ticker) || void 0 === _j || _j.release();
|
|
61385
61388
|
const internalProps = this.internalProps;
|
|
61386
61389
|
if (this.isReleased) return;
|
|
61387
|
-
null === (_l = null === (_k = internalProps.tooltipHandler) || void 0 === _k ? void 0 : _k.release) || void 0 === _l || _l.call(_k), null === (_o = null === (_m = internalProps.menuHandler) || void 0 === _m ? void 0 : _m.release) || void 0 === _o || _o.call(_m), null === (_p = super.release) || void 0 === _p || _p.call(this), this.pluginManager.release(), null === (_r = null === (_q = internalProps.handler) || void 0 === _q ? void 0 : _q.release) || void 0 === _r || _r.call(_q), this.eventManager.release(), null === (_t = null === (_s = internalProps.focusControl) || void 0 === _s ? void 0 : _s.release) || void 0 === _t || _t.call(_s), null === (_u = internalProps.legends) || void 0 === _u || _u.forEach(legend => {
|
|
61390
|
+
this.clearCorrectTimer(), null === (_l = null === (_k = internalProps.tooltipHandler) || void 0 === _k ? void 0 : _k.release) || void 0 === _l || _l.call(_k), null === (_o = null === (_m = internalProps.menuHandler) || void 0 === _m ? void 0 : _m.release) || void 0 === _o || _o.call(_m), null === (_p = super.release) || void 0 === _p || _p.call(this), this.pluginManager.release(), null === (_r = null === (_q = internalProps.handler) || void 0 === _q ? void 0 : _q.release) || void 0 === _r || _r.call(_q), this.eventManager.release(), null === (_t = null === (_s = internalProps.focusControl) || void 0 === _s ? void 0 : _s.release) || void 0 === _t || _t.call(_s), null === (_u = internalProps.legends) || void 0 === _u || _u.forEach(legend => {
|
|
61388
61391
|
null == legend || legend.release();
|
|
61389
61392
|
}), null === (_v = internalProps.title) || void 0 === _v || _v.release(), internalProps.title = null, null === (_w = internalProps.emptyTip) || void 0 === _w || _w.release(), internalProps.emptyTip = null, internalProps.layoutMap.release(), internalProps.releaseList && (internalProps.releaseList.forEach(releaseObj => {
|
|
61390
61393
|
var _a;
|
|
@@ -61689,6 +61692,30 @@
|
|
|
61689
61692
|
lastSelectRange = currentSelectRanges[currentSelectRanges.length - 1];
|
|
61690
61693
|
lastSelectRange && (lastSelectRange.end.row = rowIndex), this.stateManager.updateSelectPos(this.colCount - 1, rowIndex, !1, isCtrl, !1, makeSelectCellVisible, !0), this.stateManager.select.selecting = !1;
|
|
61691
61694
|
}
|
|
61695
|
+
changeHeaderPosition(args) {
|
|
61696
|
+
var _a, _b, _c, _d, _e;
|
|
61697
|
+
if (!("canMoveHeaderPosition" in this.internalProps.layoutMap) || !0 === (null === (_a = this.options.customConfig) || void 0 === _a ? void 0 : _a.notUpdateInColumnRowMove)) return !1;
|
|
61698
|
+
const prevMoving = this.stateManager.columnMove.movingColumnOrRow;
|
|
61699
|
+
this.stateManager.columnMove.movingColumnOrRow = args.movingColumnOrRow;
|
|
61700
|
+
try {
|
|
61701
|
+
if (!1 === (null === (_c = (_b = this.internalProps.layoutMap).canMoveHeaderPosition) || void 0 === _c ? void 0 : _c.call(_b, args.source, args.target))) return !1;
|
|
61702
|
+
const oldSourceMergeInfo = this.getCellRange(args.source.col, args.source.row),
|
|
61703
|
+
oldTargetMergeInfo = this.getCellRange(args.target.col, args.target.row),
|
|
61704
|
+
moveContext = this._moveHeaderPosition(args.source, args.target);
|
|
61705
|
+
if (!moveContext || moveContext.targetIndex === moveContext.sourceIndex) return !1;
|
|
61706
|
+
this.internalProps.useOneRowHeightFillAll = !1, this.internalProps.layoutMap.clearCellRangeMap();
|
|
61707
|
+
const sourceMergeInfo = this.getCellRange(args.source.col, args.source.row),
|
|
61708
|
+
targetMergeInfo = this.getCellRange(args.target.col, args.target.row),
|
|
61709
|
+
colMin = Math.min(sourceMergeInfo.start.col, targetMergeInfo.start.col, oldSourceMergeInfo.start.col, oldTargetMergeInfo.start.col),
|
|
61710
|
+
colMax = Math.max(sourceMergeInfo.end.col, targetMergeInfo.end.col, oldSourceMergeInfo.end.col, oldTargetMergeInfo.end.col),
|
|
61711
|
+
rowMin = Math.min(sourceMergeInfo.start.row, targetMergeInfo.start.row, oldSourceMergeInfo.start.row, oldTargetMergeInfo.start.row);
|
|
61712
|
+
let rowMax = Math.max(sourceMergeInfo.end.row, targetMergeInfo.end.row, oldSourceMergeInfo.end.row, oldTargetMergeInfo.end.row);
|
|
61713
|
+
if ("row" === moveContext.moveType && "tree" === this.internalProps.layoutMap.rowHierarchyType && (rowMax = moveContext.targetIndex > moveContext.sourceIndex ? rowMax + moveContext.targetSize - 1 : rowMax + moveContext.sourceSize - 1), this.transpose || !this.isSeriesNumberInBody(args.source.col, args.source.row) && "row" !== args.movingColumnOrRow || (this.changeRecordOrder(moveContext.sourceIndex, moveContext.targetIndex), this.stateManager.changeCheckboxAndRadioOrder(moveContext.sourceIndex, moveContext.targetIndex)), "column" === moveContext.moveType) for (let col = colMin; col <= colMax; col++) this._clearColRangeWidthsMap(col);else for (let row = rowMin; row <= rowMax; row++) this._clearRowRangeHeightsMap(row);
|
|
61714
|
+
return this.clearCellStyleCache(), this.isSeriesNumberInBody(args.source.col, args.source.row) || "row" === args.movingColumnOrRow ? this.scenegraph.updateHeaderPosition(this.scenegraph.proxy.colStart, this.scenegraph.proxy.colEnd, this.scenegraph.proxy.rowStart, this.scenegraph.proxy.rowEnd, moveContext.moveType) : "column" === moveContext.moveType ? this.scenegraph.updateHeaderPosition(colMin, colMax, 0, -1, moveContext.moveType) : this.scenegraph.updateHeaderPosition(0, -1, rowMin, rowMax, moveContext.moveType), "adjustFrozenCount" === this.internalProps.frozenColDragHeaderMode && this.isListTable() && (this.isLeftFrozenColumn(args.target.col) && !this.isLeftFrozenColumn(args.source.col) ? this.frozenColCount += sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1 : this.isLeftFrozenColumn(args.source.col) && !this.isLeftFrozenColumn(args.target.col) && (this.frozenColCount -= sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1), this.isRightFrozenColumn(args.target.col) && !this.isRightFrozenColumn(args.source.col) ? this.rightFrozenColCount += sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1 : this.isRightFrozenColumn(args.source.col) && !this.isRightFrozenColumn(args.target.col) && (this.rightFrozenColCount -= sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1)), null === (_e = (_d = this.scenegraph).updateNextFrame) || void 0 === _e || _e.call(_d), !0;
|
|
61715
|
+
} finally {
|
|
61716
|
+
this.stateManager.columnMove.movingColumnOrRow = prevMoving;
|
|
61717
|
+
}
|
|
61718
|
+
}
|
|
61692
61719
|
get recordsCount() {
|
|
61693
61720
|
var _a;
|
|
61694
61721
|
return null === (_a = this.records) || void 0 === _a ? void 0 : _a.length;
|
|
@@ -61834,7 +61861,7 @@
|
|
|
61834
61861
|
getCustomMerge(col, row) {
|
|
61835
61862
|
if (this.internalProps.customMergeCell) {
|
|
61836
61863
|
const customMerge = this.internalProps.customMergeCell(col, row, this);
|
|
61837
|
-
if (customMerge && customMerge.range
|
|
61864
|
+
if (customMerge && customMerge.range) {
|
|
61838
61865
|
if (customMerge.style) {
|
|
61839
61866
|
const styleClass = this.internalProps.bodyHelper.getStyleClass("text"),
|
|
61840
61867
|
style = customMerge.style,
|
|
@@ -62545,12 +62572,36 @@
|
|
|
62545
62572
|
this.eventManager.enableScroll();
|
|
62546
62573
|
}
|
|
62547
62574
|
getGroupTitleLevel(col, row) {}
|
|
62575
|
+
getTargetScrollTop(row) {
|
|
62576
|
+
const drawRange = this.getDrawRange(),
|
|
62577
|
+
frozenHeight = this.getFrozenRowsHeight(),
|
|
62578
|
+
rowsHeight = Math.ceil(this.rowHeightsMap.getSumInRange(0, row - 1)),
|
|
62579
|
+
allRowsHeight = this.getAllRowsHeight();
|
|
62580
|
+
return Math.max(0, Math.min(rowsHeight - frozenHeight, allRowsHeight - drawRange.height));
|
|
62581
|
+
}
|
|
62582
|
+
_scheduleScrollToRowCorrect(row, delay = 0) {
|
|
62583
|
+
this._scrollToRowCorrectTimer = setTimeout(() => {
|
|
62584
|
+
this.clearCorrectTimer();
|
|
62585
|
+
const targetScrollTop = this.getTargetScrollTop(row);
|
|
62586
|
+
if (targetScrollTop !== this.scrollTop) {
|
|
62587
|
+
this.scrollTop = targetScrollTop;
|
|
62588
|
+
const correctedTargetScrollTop = this.getTargetScrollTop(row);
|
|
62589
|
+
correctedTargetScrollTop !== this.scrollTop && (this.scrollTop = correctedTargetScrollTop);
|
|
62590
|
+
}
|
|
62591
|
+
}, delay);
|
|
62592
|
+
}
|
|
62548
62593
|
scrollToRow(row, animationOption) {
|
|
62549
|
-
|
|
62550
|
-
|
|
62551
|
-
|
|
62552
|
-
row:
|
|
62553
|
-
});
|
|
62594
|
+
var _a;
|
|
62595
|
+
const targetRow = Math.min(Math.max(Math.floor(row), 0), this.rowCount - 1);
|
|
62596
|
+
if (this.clearCorrectTimer(), !animationOption) return this.scrollToCell({
|
|
62597
|
+
row: targetRow
|
|
62598
|
+
}), void this._scheduleScrollToRowCorrect(targetRow);
|
|
62599
|
+
const duration = isBoolean$2(animationOption) ? 3e3 : null !== (_a = null == animationOption ? void 0 : animationOption.duration) && void 0 !== _a ? _a : 3e3;
|
|
62600
|
+
this.animationManager.scrollTo({
|
|
62601
|
+
row: targetRow
|
|
62602
|
+
}, animationOption), this._scrollToRowCorrectTimer = setTimeout(() => {
|
|
62603
|
+
this.scrollToRow(targetRow, !1);
|
|
62604
|
+
}, duration);
|
|
62554
62605
|
}
|
|
62555
62606
|
scrollToCol(col, animationOption) {
|
|
62556
62607
|
animationOption ? this.animationManager.scrollTo({
|
|
@@ -62569,8 +62620,8 @@
|
|
|
62569
62620
|
}
|
|
62570
62621
|
if (isValid$1(cellAddr.row) && cellAddr.row >= this.frozenRowCount) {
|
|
62571
62622
|
const frozenHeight = this.getFrozenRowsHeight(),
|
|
62572
|
-
top = this.
|
|
62573
|
-
this.scrollTop = Math.min(top - frozenHeight, this.
|
|
62623
|
+
top = this.rowHeightsMap.getSumInRange(0, cellAddr.row - 1);
|
|
62624
|
+
this.scrollTop = Math.min(top - frozenHeight, this.rowHeightsMap.getSumInRange(0, this.rowCount - 1) - drawRange.height);
|
|
62574
62625
|
}
|
|
62575
62626
|
this.render();
|
|
62576
62627
|
}
|
|
@@ -63218,9 +63269,24 @@
|
|
|
63218
63269
|
return layout._cellRangeMap.set(`$${col}$${row}`, cellRange), cellRange;
|
|
63219
63270
|
}
|
|
63220
63271
|
function getTreeTitleMerge(col, row, cellRange, layout) {
|
|
63272
|
+
var _a;
|
|
63221
63273
|
if ("tree" !== layout.rowHierarchyType) return;
|
|
63222
|
-
const
|
|
63223
|
-
|
|
63274
|
+
const table = layout._table,
|
|
63275
|
+
internalProps = table.internalProps || {},
|
|
63276
|
+
isGroupMode = !!internalProps.groupBy,
|
|
63277
|
+
cellRecord = table.getCellRawRecord(col, row);
|
|
63278
|
+
if (!(null == cellRecord ? void 0 : cellRecord.vtableMerge)) return;
|
|
63279
|
+
const treeTitleStartCol = internalProps.groupTitleCheckbox && internalProps.rowSeriesNumber ? layout.rowHeaderLevelCount + layout.leftRowSeriesNumberColumnCount : layout.rowHeaderLevelCount;
|
|
63280
|
+
if (!(col < treeTitleStartCol) && (cellRange.start.col = treeTitleStartCol, cellRange.end.col = layout.colCount - 1, cellRange.start.row = cellRange.end.row = row, isGroupMode && 1 === (null === (_a = layout.columnObjects) || void 0 === _a ? void 0 : _a.length))) {
|
|
63281
|
+
const onlyColumn = layout.columnObjects[0],
|
|
63282
|
+
field = null == onlyColumn ? void 0 : onlyColumn.field;
|
|
63283
|
+
if (null != field) {
|
|
63284
|
+
let text = cellRecord.vtableMergeName;
|
|
63285
|
+
const groupTitleFieldFormat = internalProps.groupTitleFieldFormat;
|
|
63286
|
+
"function" == typeof groupTitleFieldFormat && (text = groupTitleFieldFormat(cellRecord, col, row, table));
|
|
63287
|
+
null == cellRecord[field] && null != text && (cellRecord[field] = text);
|
|
63288
|
+
}
|
|
63289
|
+
}
|
|
63224
63290
|
}
|
|
63225
63291
|
function getCellRangeTranspose(col, row, layout) {
|
|
63226
63292
|
var _a, _b, _c, _d;
|
|
@@ -64137,7 +64203,7 @@
|
|
|
64137
64203
|
this.listenersId.push(doubleClickEventId, clickEventId, selectedChangedEventId);
|
|
64138
64204
|
}
|
|
64139
64205
|
startEditCell(col, row, value, editElement) {
|
|
64140
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
64206
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
64141
64207
|
if (this.editingEditor) return;
|
|
64142
64208
|
const editor = this.table.getEditor(col, row);
|
|
64143
64209
|
if (editor) {
|
|
@@ -64153,7 +64219,8 @@
|
|
|
64153
64219
|
col: col,
|
|
64154
64220
|
row: row
|
|
64155
64221
|
}), this.table._makeVisibleCell(col, row), this.editingEditor = editor;
|
|
64156
|
-
const
|
|
64222
|
+
const customMergeText = null === (_j = this.table.getCustomMerge(col, row)) || void 0 === _j ? void 0 : _j.text,
|
|
64223
|
+
dataValue = isValid$1(value) ? value : isValid$1(customMergeText) ? customMergeText : this.table.getCellOriginValue(col, row),
|
|
64157
64224
|
rect = this.table.getCellRangeRelativeRect(this.table.getCellRange(col, row)),
|
|
64158
64225
|
referencePosition = {
|
|
64159
64226
|
rect: {
|
|
@@ -64163,9 +64230,9 @@
|
|
|
64163
64230
|
height: rect.height
|
|
64164
64231
|
}
|
|
64165
64232
|
};
|
|
64166
|
-
col === this.table.colCount - 1 ? referencePosition.rect.width = rect.width - 1 : referencePosition.rect.width = rect.width + 1, row === this.table.rowCount - 1 ? referencePosition.rect.height = rect.height - 1 : referencePosition.rect.height = rect.height + 1, editor.beginEditing, null === (
|
|
64233
|
+
col === this.table.colCount - 1 ? referencePosition.rect.width = rect.width - 1 : referencePosition.rect.width = rect.width + 1, row === this.table.rowCount - 1 ? referencePosition.rect.height = rect.height - 1 : referencePosition.rect.height = rect.height + 1, editor.beginEditing, null === (_k = editor.beginEditing) || void 0 === _k || _k.call(editor, this.table.getElement(), referencePosition, dataValue), editor.bindSuccessCallback, null === (_l = editor.bindSuccessCallback) || void 0 === _l || _l.call(editor, () => {
|
|
64167
64234
|
this.completeEdit();
|
|
64168
|
-
}), null === (
|
|
64235
|
+
}), null === (_m = editor.onStart) || void 0 === _m || _m.call(editor, {
|
|
64169
64236
|
value: dataValue,
|
|
64170
64237
|
endEdit: () => {
|
|
64171
64238
|
this.completeEdit();
|
|
@@ -64179,7 +64246,7 @@
|
|
|
64179
64246
|
}
|
|
64180
64247
|
}
|
|
64181
64248
|
completeEdit(e) {
|
|
64182
|
-
var _a, _b;
|
|
64249
|
+
var _a, _b, _c;
|
|
64183
64250
|
if (!this.editingEditor) return !0;
|
|
64184
64251
|
if (this.isValidatingValue) return !1;
|
|
64185
64252
|
this.cacheLastSelectedCellEditor = {};
|
|
@@ -64193,9 +64260,10 @@
|
|
|
64193
64260
|
if (this.editingEditor.getValue, this.editingEditor.validateValue) {
|
|
64194
64261
|
this.isValidatingValue = !0;
|
|
64195
64262
|
const newValue = this.editingEditor.getValue(),
|
|
64196
|
-
|
|
64263
|
+
customMergeText = null === (_a = this.table.getCustomMerge(this.editCell.col, this.editCell.row)) || void 0 === _a ? void 0 : _a.text,
|
|
64264
|
+
oldValue = isValid$1(customMergeText) ? customMergeText : this.table.getCellOriginValue(this.editCell.col, this.editCell.row),
|
|
64197
64265
|
target = null == e ? void 0 : e.target,
|
|
64198
|
-
maybePromiseOrValue = null === (
|
|
64266
|
+
maybePromiseOrValue = null === (_c = (_b = this.editingEditor).validateValue) || void 0 === _c ? void 0 : _c.call(_b, newValue, oldValue, this.editCell, this.table, !!this.table.getElement().contains(target));
|
|
64199
64267
|
return isPromise(maybePromiseOrValue) ? (this.isValidatingValue = !0, new Promise((resolve, reject) => {
|
|
64200
64268
|
maybePromiseOrValue.then(result => {
|
|
64201
64269
|
dealWithValidateValue(result, this, oldValue, resolve);
|
|
@@ -64209,14 +64277,17 @@
|
|
|
64209
64277
|
doExit() {
|
|
64210
64278
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
64211
64279
|
const changedValue = null === (_b = (_a = this.editingEditor).getValue) || void 0 === _b ? void 0 : _b.call(_a),
|
|
64212
|
-
range = this.table.getCellRange(this.editCell.col, this.editCell.row)
|
|
64213
|
-
|
|
64214
|
-
|
|
64215
|
-
|
|
64216
|
-
|
|
64217
|
-
|
|
64280
|
+
range = this.table.getCellRange(this.editCell.col, this.editCell.row);
|
|
64281
|
+
if (null === (_d = (_c = this.editingEditor).beforeEnd) || void 0 === _d || _d.call(_c), range.isCustom) this.table.changeCellValue(range.start.col, range.start.row, changedValue);else {
|
|
64282
|
+
const changedValues = [];
|
|
64283
|
+
for (let row = range.start.row; row <= range.end.row; row++) {
|
|
64284
|
+
const rowChangedValues = [];
|
|
64285
|
+
for (let col = range.start.col; col <= range.end.col; col++) rowChangedValues.push(changedValue);
|
|
64286
|
+
changedValues.push(rowChangedValues);
|
|
64287
|
+
}
|
|
64288
|
+
this.table.changeCellValues(range.start.col, range.start.row, changedValues);
|
|
64218
64289
|
}
|
|
64219
|
-
|
|
64290
|
+
this.editingEditor.exit, null === (_f = (_e = this.editingEditor).exit) || void 0 === _f || _f.call(_e), null === (_h = (_g = this.editingEditor).onEnd) || void 0 === _h || _h.call(_g), this.editingEditor = null, this.isValidatingValue = !1, this.beginTriggerEditCellMode = null;
|
|
64220
64291
|
}
|
|
64221
64292
|
cancelEdit() {
|
|
64222
64293
|
var _a, _b, _c, _d;
|
|
@@ -64276,7 +64347,18 @@
|
|
|
64276
64347
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
64277
64348
|
});
|
|
64278
64349
|
};
|
|
64350
|
+
function refreshCustomMergeCellGroups(table) {
|
|
64351
|
+
var _a;
|
|
64352
|
+
if (!Array.isArray(table.options.customMergeCell)) return;
|
|
64353
|
+
table.internalProps.customMergeCell = getCustomMergeCellFunc(table.options.customMergeCell);
|
|
64354
|
+
const merges = table.options.customMergeCell;
|
|
64355
|
+
for (let i = 0; i < merges.length; i++) {
|
|
64356
|
+
const r = null === (_a = merges[i]) || void 0 === _a ? void 0 : _a.range;
|
|
64357
|
+
if (null == r ? void 0 : r.start) for (let col = r.start.col; col <= r.end.col; col++) for (let row = r.start.row; row <= r.end.row; row++) table.scenegraph.updateCellContent(col, row);
|
|
64358
|
+
}
|
|
64359
|
+
}
|
|
64279
64360
|
function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table, noTriggerChangeCellValuesEvent) {
|
|
64361
|
+
var _a, _b;
|
|
64280
64362
|
if (workOnEditableCell && table.isHasEditorDefine(col, row) || !1 === workOnEditableCell) {
|
|
64281
64363
|
const recordShowIndex = table.getRecordShowIndexByCell(col, row),
|
|
64282
64364
|
recordIndex = recordShowIndex >= 0 ? table.dataSource.getIndexKey(recordShowIndex) : void 0,
|
|
@@ -64286,8 +64368,12 @@
|
|
|
64286
64368
|
beforeChangeValue = table.getCellRawValue(col, row),
|
|
64287
64369
|
oldValue = table.getCellOriginValue(col, row);
|
|
64288
64370
|
table.isHeader(col, row) ? table.internalProps.layoutMap.updateColumnTitle(col, row, value) : table.dataSource.changeFieldValue(value, recordShowIndex, field, col, row, table);
|
|
64289
|
-
const range = table.getCellRange(col, row)
|
|
64290
|
-
|
|
64371
|
+
const range = table.getCellRange(col, row);
|
|
64372
|
+
if (range.isCustom && range.start.col === col && range.start.row === row && Array.isArray(table.options.customMergeCell) && "function" == typeof table.getCellValue) {
|
|
64373
|
+
const customMerge = null === (_b = null === (_a = table.internalProps) || void 0 === _a ? void 0 : _a.customMergeCell) || void 0 === _b ? void 0 : _b.call(_a, col, row, table);
|
|
64374
|
+
customMerge && (customMerge.text = value);
|
|
64375
|
+
}
|
|
64376
|
+
const aggregators = table.internalProps.layoutMap.getAggregatorsByCell(col, row);
|
|
64291
64377
|
if (aggregators) {
|
|
64292
64378
|
if (Array.isArray(aggregators)) for (let i = 0; i < (null == aggregators ? void 0 : aggregators.length); i++) aggregators[i].recalculate();else aggregators.recalculate();
|
|
64293
64379
|
const aggregatorCells = table.internalProps.layoutMap.getAggregatorCellAddress(range.start.col, range.start.row, range.end.col, range.end.row);
|
|
@@ -64510,7 +64596,13 @@
|
|
|
64510
64596
|
(void 0 === recordIndex || recordIndex > table.dataSource.sourceLength) && (recordIndex = table.dataSource.sourceLength);
|
|
64511
64597
|
const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount,
|
|
64512
64598
|
syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords);
|
|
64513
|
-
if (table.dataSource.addRecord(record, recordIndex, syncToOriginalRecords), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1), syncToOriginalRecords)
|
|
64599
|
+
if (table.dataSource.addRecord(record, recordIndex, syncToOriginalRecords), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, 1), syncToOriginalRecords) {
|
|
64600
|
+
if (!table.transpose) {
|
|
64601
|
+
const insertRowIndex = recordIndex + headerCount + table.internalProps.layoutMap.hasAggregationOnTopCount;
|
|
64602
|
+
table.rowHeightsMap.insert(insertRowIndex);
|
|
64603
|
+
}
|
|
64604
|
+
return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(!0), !0;
|
|
64605
|
+
}
|
|
64514
64606
|
const oldRowCount = table.rowCount;
|
|
64515
64607
|
if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
|
|
64516
64608
|
const newRowCount = table.transpose ? table.colCount : table.rowCount;
|
|
@@ -64588,7 +64680,13 @@
|
|
|
64588
64680
|
void 0 === recordIndex || recordIndex > table.dataSource.sourceLength ? recordIndex = table.dataSource.sourceLength : recordIndex < 0 && (recordIndex = 0);
|
|
64589
64681
|
const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount,
|
|
64590
64682
|
syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords);
|
|
64591
|
-
if (table.dataSource.addRecords(records, recordIndex, syncToOriginalRecords), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length), syncToOriginalRecords)
|
|
64683
|
+
if (table.dataSource.addRecords(records, recordIndex, syncToOriginalRecords), adjustCheckBoxStateMapWithAddRecordIndex(table, recordIndex, records.length), syncToOriginalRecords) {
|
|
64684
|
+
if (!table.transpose) {
|
|
64685
|
+
const insertRowIndex = recordIndex + headerCount + table.internalProps.layoutMap.hasAggregationOnTopCount;
|
|
64686
|
+
for (let i = 0; i < records.length; i++) table.rowHeightsMap.insert(insertRowIndex);
|
|
64687
|
+
}
|
|
64688
|
+
return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(!0), !0;
|
|
64689
|
+
}
|
|
64592
64690
|
const oldRowCount = table.transpose ? table.colCount : table.rowCount;
|
|
64593
64691
|
if (table.refreshRowColCount(), 0 === table.scenegraph.proxy.totalActualBodyRowCount) return table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), !0;
|
|
64594
64692
|
const newRowCount = table.transpose ? table.colCount : table.rowCount;
|
|
@@ -64657,7 +64755,7 @@
|
|
|
64657
64755
|
}
|
|
64658
64756
|
}
|
|
64659
64757
|
function listTableDeleteRecords(recordIndexs, table) {
|
|
64660
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
64758
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
64661
64759
|
if ((null == recordIndexs ? void 0 : recordIndexs.length) > 0) if (table.internalProps.groupBy) null === (_b = (_a = table.dataSource).deleteRecordsForGroup) || void 0 === _b || _b.call(_a, recordIndexs), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.sortState && sortRecords(table), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph();else if ("tree" === table.dataSource.rowHierarchyType) {
|
|
64662
64760
|
const deletedRecordIndexs = null === (_d = (_c = table.dataSource).deleteRecordsForTree) || void 0 === _d ? void 0 : _d.call(_c, recordIndexs);
|
|
64663
64761
|
if (0 === deletedRecordIndexs.length) return;
|
|
@@ -64669,8 +64767,17 @@
|
|
|
64669
64767
|
const syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords),
|
|
64670
64768
|
deletedRecordIndexs = table.dataSource.deleteRecords(recordIndexs, syncToOriginalRecords);
|
|
64671
64769
|
if (0 === deletedRecordIndexs.length) return;
|
|
64770
|
+
Array.isArray(table.options.customMergeCell) && (table.internalProps.customMergeCell = getCustomMergeCellFunc(table.options.customMergeCell));
|
|
64672
64771
|
for (let index = 0; index < deletedRecordIndexs.length; index++) adjustCheckBoxStateMapWithDeleteRecordIndex(table, deletedRecordIndexs[index], 1);
|
|
64673
|
-
if (syncToOriginalRecords)
|
|
64772
|
+
if (syncToOriginalRecords) {
|
|
64773
|
+
if (!table.transpose) {
|
|
64774
|
+
const headerCount = table.transpose ? table.rowHeaderLevelCount : table.columnHeaderLevelCount,
|
|
64775
|
+
topAggregationCount = table.internalProps.layoutMap.hasAggregationOnTopCount,
|
|
64776
|
+
sorted = [...deletedRecordIndexs].sort((a, b) => b - a);
|
|
64777
|
+
for (let i = 0; i < sorted.length; i++) table.rowHeightsMap.delete(sorted[i] + headerCount + topAggregationCount);
|
|
64778
|
+
}
|
|
64779
|
+
return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph(!0);
|
|
64780
|
+
}
|
|
64674
64781
|
const oldRowCount = table.transpose ? table.colCount : table.rowCount;
|
|
64675
64782
|
table.refreshRowColCount();
|
|
64676
64783
|
const newRowCount = table.transpose ? table.colCount : table.rowCount,
|
|
@@ -64708,7 +64815,7 @@
|
|
|
64708
64815
|
col: 0,
|
|
64709
64816
|
row: row
|
|
64710
64817
|
});
|
|
64711
|
-
null === (_g = table.reactCustomLayout) || void 0 === _g || _g.clearCache(), table.transpose ? table.scenegraph.updateCol(delRows, [], updateRows) : table.scenegraph.updateRow(delRows, [], updateRows), null === (_h = table.reactCustomLayout) || void 0 === _h || _h.updateAllCustomCell();
|
|
64818
|
+
null === (_g = table.reactCustomLayout) || void 0 === _g || _g.clearCache(), table.transpose ? table.scenegraph.updateCol(delRows, [], updateRows) : table.scenegraph.updateRow(delRows, [], updateRows), null === (_h = table.reactCustomLayout) || void 0 === _h || _h.updateAllCustomCell(), refreshCustomMergeCellGroups(table);
|
|
64712
64819
|
}
|
|
64713
64820
|
} else {
|
|
64714
64821
|
const delRows = [],
|
|
@@ -64726,6 +64833,42 @@
|
|
|
64726
64833
|
});
|
|
64727
64834
|
}
|
|
64728
64835
|
const updateRows = [];
|
|
64836
|
+
if (table.internalProps.customMergeCell) {
|
|
64837
|
+
const proxy = table.scenegraph.proxy,
|
|
64838
|
+
deletedIndexNums = (recordIndexsMinToMax[0], recordIndexsMinToMax.map(recordIndex => recordIndex + headerCount + topAggregationCount)),
|
|
64839
|
+
minIndexNum = deletedIndexNums[0];
|
|
64840
|
+
let updateMin = minIndexNum,
|
|
64841
|
+
updateMax = minIndexNum;
|
|
64842
|
+
if (Array.isArray(table.options.customMergeCell)) {
|
|
64843
|
+
const merges = table.options.customMergeCell,
|
|
64844
|
+
axis = table.transpose ? "col" : "row";
|
|
64845
|
+
merges.forEach(m => {
|
|
64846
|
+
const r = null == m ? void 0 : m.range;
|
|
64847
|
+
if ((null == r ? void 0 : r.start) && (null == r ? void 0 : r.end)) for (let i = 0; i < deletedIndexNums.length; i++) {
|
|
64848
|
+
const deleteIndex = deletedIndexNums[i];
|
|
64849
|
+
if (r.end[axis] >= deleteIndex - 1) {
|
|
64850
|
+
updateMin = Math.min(updateMin, r.start[axis]), updateMax = Math.max(updateMax, r.end[axis]);
|
|
64851
|
+
break;
|
|
64852
|
+
}
|
|
64853
|
+
}
|
|
64854
|
+
});
|
|
64855
|
+
}
|
|
64856
|
+
if (table.transpose) {
|
|
64857
|
+
const start = Math.max(updateMin, null !== (_j = null == proxy ? void 0 : proxy.colStart) && void 0 !== _j ? _j : updateMin),
|
|
64858
|
+
end = Math.min(updateMax, null !== (_k = null == proxy ? void 0 : proxy.colEnd) && void 0 !== _k ? _k : updateMax);
|
|
64859
|
+
for (let col = start; col <= end; col++) updateRows.push({
|
|
64860
|
+
col: col,
|
|
64861
|
+
row: 0
|
|
64862
|
+
});
|
|
64863
|
+
} else {
|
|
64864
|
+
const start = Math.max(updateMin, null !== (_l = null == proxy ? void 0 : proxy.rowStart) && void 0 !== _l ? _l : updateMin),
|
|
64865
|
+
end = Math.min(updateMax, null !== (_m = null == proxy ? void 0 : proxy.rowEnd) && void 0 !== _m ? _m : updateMax);
|
|
64866
|
+
for (let row = start; row <= end; row++) updateRows.push({
|
|
64867
|
+
col: 0,
|
|
64868
|
+
row: row
|
|
64869
|
+
});
|
|
64870
|
+
}
|
|
64871
|
+
}
|
|
64729
64872
|
for (let row = headerCount; row < headerCount + topAggregationCount; row++) table.transpose ? updateRows.push({
|
|
64730
64873
|
col: row,
|
|
64731
64874
|
row: 0
|
|
@@ -64740,7 +64883,7 @@
|
|
|
64740
64883
|
col: 0,
|
|
64741
64884
|
row: row
|
|
64742
64885
|
});
|
|
64743
|
-
null === (
|
|
64886
|
+
null === (_o = table.reactCustomLayout) || void 0 === _o || _o.clearCache(), table.transpose ? table.scenegraph.updateCol(delRows, [], updateRows) : table.scenegraph.updateRow(delRows, [], updateRows), null === (_p = table.reactCustomLayout) || void 0 === _p || _p.updateAllCustomCell(), refreshCustomMergeCellGroups(table);
|
|
64744
64887
|
}
|
|
64745
64888
|
}
|
|
64746
64889
|
}
|
|
@@ -64752,7 +64895,7 @@
|
|
|
64752
64895
|
const syncToOriginalRecords = !!(null === (_f = table.options) || void 0 === _f ? void 0 : _f.syncRecordOperationsToSourceRecords),
|
|
64753
64896
|
updateRecordIndexs = table.dataSource.updateRecords(records, recordIndexs, syncToOriginalRecords);
|
|
64754
64897
|
if (0 === updateRecordIndexs.length) return;
|
|
64755
|
-
if (syncToOriginalRecords) return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph();
|
|
64898
|
+
if (syncToOriginalRecords) return table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), void table.scenegraph.createSceneGraph(!0);
|
|
64756
64899
|
const recordIndexsMinToMax = updateRecordIndexs.map(index => table.getBodyRowIndexByRecordIndex(index)).sort((a, b) => a - b);
|
|
64757
64900
|
if (table.pagination) {
|
|
64758
64901
|
const {
|
|
@@ -65075,10 +65218,33 @@
|
|
|
65075
65218
|
this._hasAutoImageColumn = void 0, this.refreshHeader(), this.records && checkHasAggregationOnColumnDefine(this.internalProps.columns) && this.dataSource.processRecords(null !== (_b = null === (_a = this.dataSource.dataSourceObj) || void 0 === _a ? void 0 : _a.records) && void 0 !== _b ? _b : this.dataSource.dataSourceObj), this.internalProps.useOneRowHeightFillAll = !1, this.headerStyleCache = new Map(), this.bodyStyleCache = new Map(), this.bodyBottomStyleCache = new Map(), this._updateSize(), this.scenegraph.createSceneGraph(), this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row), this.renderAsync(), this.eventManager.updateEventBinder();
|
|
65076
65219
|
}
|
|
65077
65220
|
addColumns(toAddColumns, colIndex, isMaintainArrayData = !0) {
|
|
65078
|
-
var _a;
|
|
65221
|
+
var _a, _b;
|
|
65079
65222
|
const columns = this.options.columns;
|
|
65223
|
+
if (Array.isArray(this.options.customMergeCell) && (null == toAddColumns ? void 0 : toAddColumns.length)) {
|
|
65224
|
+
const axis = this.transpose ? "row" : "col";
|
|
65225
|
+
let insertIndex = colIndex;
|
|
65226
|
+
void 0 === insertIndex ? insertIndex = columns.length : insertIndex < 0 ? insertIndex = 0 : insertIndex > columns.length && (insertIndex = columns.length);
|
|
65227
|
+
const toAddCount = toAddColumns.length,
|
|
65228
|
+
merges = this.options.customMergeCell.map(m => Object.assign(Object.assign({}, m), {
|
|
65229
|
+
range: {
|
|
65230
|
+
start: Object.assign({}, m.range.start),
|
|
65231
|
+
end: Object.assign({}, m.range.end)
|
|
65232
|
+
}
|
|
65233
|
+
}));
|
|
65234
|
+
for (let i = 0; i < merges.length; i++) {
|
|
65235
|
+
const r = null === (_a = merges[i]) || void 0 === _a ? void 0 : _a.range;
|
|
65236
|
+
if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
|
|
65237
|
+
const start = r.start[axis],
|
|
65238
|
+
end = r.end[axis];
|
|
65239
|
+
end < insertIndex || (start > insertIndex ? (r.start[axis] = start + toAddCount, r.end[axis] = end + toAddCount) : r.end[axis] = end + toAddCount);
|
|
65240
|
+
}
|
|
65241
|
+
this.options.customMergeCell = merges.filter(m => {
|
|
65242
|
+
const r = null == m ? void 0 : m.range;
|
|
65243
|
+
return !(!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) && !(r.end.row < r.start.row || r.end.col < r.start.col) && !(r.start.row === r.end.row && r.start.col === r.end.col);
|
|
65244
|
+
}), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
|
|
65245
|
+
}
|
|
65080
65246
|
void 0 === colIndex ? (colIndex = columns.length, columns.push(...toAddColumns)) : columns.splice(colIndex, 0, ...toAddColumns);
|
|
65081
|
-
for (let i = 0; i < toAddColumns.length; i++) this.colWidthsMap.addAndReorder(colIndex + i, null !== (
|
|
65247
|
+
for (let i = 0; i < toAddColumns.length; i++) this.colWidthsMap.addAndReorder(colIndex + i, null !== (_b = toAddColumns[i].width) && void 0 !== _b ? _b : this.internalProps.defaultColWidth);
|
|
65082
65248
|
this.internalProps._colRangeWidthsMap.clear();
|
|
65083
65249
|
const resizedColIndexs = Array.from(this.internalProps._widthResizedColMap.keys());
|
|
65084
65250
|
for (let i = 0; i < resizedColIndexs.length; i++) resizedColIndexs[i] >= colIndex && (this.internalProps._widthResizedColMap.delete(resizedColIndexs[i]), this.internalProps._widthResizedColMap.add(resizedColIndexs[i] + toAddColumns.length));
|
|
@@ -65091,15 +65257,46 @@
|
|
|
65091
65257
|
}
|
|
65092
65258
|
this.updateColumns(columns, {
|
|
65093
65259
|
clearRowHeightCache: !1
|
|
65094
|
-
}), this.
|
|
65260
|
+
}), Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell), this.options.customMergeCell.forEach(m => {
|
|
65261
|
+
const r = null == m ? void 0 : m.range;
|
|
65262
|
+
if (null == r ? void 0 : r.start) for (let col = r.start.col; col <= r.end.col; col++) for (let row = r.start.row; row <= r.end.row; row++) this.scenegraph.updateCellContent(col, row);
|
|
65263
|
+
}), this.scenegraph.updateNextFrame()), this.fireListeners(TABLE_EVENT_TYPE.ADD_COLUMN, {
|
|
65095
65264
|
columnIndex: colIndex,
|
|
65096
65265
|
columnCount: toAddColumns.length,
|
|
65097
65266
|
columns: columns
|
|
65098
65267
|
});
|
|
65099
65268
|
}
|
|
65100
65269
|
deleteColumns(deleteColIndexs, isMaintainArrayData = !0) {
|
|
65270
|
+
var _a;
|
|
65101
65271
|
const columns = this.options.columns;
|
|
65102
65272
|
deleteColIndexs.sort((a, b) => b - a);
|
|
65273
|
+
const deletedColumns = deleteColIndexs.map(idx => cloneDeepSpec(columns[idx], ["children"]));
|
|
65274
|
+
let deletedRecordValues;
|
|
65275
|
+
if (Array.isArray(this.options.customMergeCell) && (null == deleteColIndexs ? void 0 : deleteColIndexs.length)) {
|
|
65276
|
+
const axis = this.transpose ? "row" : "col",
|
|
65277
|
+
deleteIndexNums = deleteColIndexs.slice().sort((a, b) => a - b).map((idx, i) => idx - i),
|
|
65278
|
+
merges = this.options.customMergeCell.map(m => Object.assign(Object.assign({}, m), {
|
|
65279
|
+
range: {
|
|
65280
|
+
start: Object.assign({}, m.range.start),
|
|
65281
|
+
end: Object.assign({}, m.range.end)
|
|
65282
|
+
}
|
|
65283
|
+
}));
|
|
65284
|
+
for (let i = 0; i < deleteIndexNums.length; i++) {
|
|
65285
|
+
const deleteIndex = deleteIndexNums[i];
|
|
65286
|
+
for (let j = 0; j < merges.length; j++) {
|
|
65287
|
+
const r = null === (_a = merges[j]) || void 0 === _a ? void 0 : _a.range;
|
|
65288
|
+
if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
|
|
65289
|
+
const start = r.start[axis],
|
|
65290
|
+
end = r.end[axis];
|
|
65291
|
+
end < deleteIndex || (start > deleteIndex ? (r.start[axis] = start - 1, r.end[axis] = end - 1) : r.end[axis] = end - 1);
|
|
65292
|
+
}
|
|
65293
|
+
}
|
|
65294
|
+
this.options.customMergeCell = merges.filter(m => {
|
|
65295
|
+
const r = null == m ? void 0 : m.range;
|
|
65296
|
+
return !(!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) && !(r.end.row < r.start.row || r.end.col < r.start.col) && !(r.start.row === r.end.row && r.start.col === r.end.col);
|
|
65297
|
+
}), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
|
|
65298
|
+
}
|
|
65299
|
+
isMaintainArrayData && Array.isArray(this.records) && this.records.length && (deletedRecordValues = this.records.map(record => Array.isArray(record) ? deleteColIndexs.map(idx => record[idx]) : []), deletedRecordValues.every(v => 0 === v.length) && (deletedRecordValues = void 0));
|
|
65103
65300
|
for (let i = 0; i < deleteColIndexs.length; i++) if (columns.splice(deleteColIndexs[i], 1), this.colWidthsMap.delAndReorder(deleteColIndexs[i]), this.internalProps._widthResizedColMap.delete(deleteColIndexs[i]), isMaintainArrayData) for (let j = 0; j < this.records.length; j++) {
|
|
65104
65301
|
const record = this.records[j];
|
|
65105
65302
|
Array.isArray(record) && record.splice(deleteColIndexs[i], 1);
|
|
@@ -65115,7 +65312,9 @@
|
|
|
65115
65312
|
clearRowHeightCache: !1
|
|
65116
65313
|
}), this.fireListeners(TABLE_EVENT_TYPE.DELETE_COLUMN, {
|
|
65117
65314
|
deleteColIndexs: deleteColIndexs,
|
|
65118
|
-
columns: columns
|
|
65315
|
+
columns: columns,
|
|
65316
|
+
deletedColumns: deletedColumns,
|
|
65317
|
+
deletedRecordValues: deletedRecordValues
|
|
65119
65318
|
});
|
|
65120
65319
|
}
|
|
65121
65320
|
get columns() {
|
|
@@ -65503,9 +65702,9 @@
|
|
|
65503
65702
|
}
|
|
65504
65703
|
}
|
|
65505
65704
|
updateSortState(sortState, executeSort = !0) {
|
|
65506
|
-
var _a;
|
|
65507
|
-
|
|
65508
|
-
(
|
|
65705
|
+
var _a, _b, _c, _d, _e;
|
|
65706
|
+
const normalizedSortState = (Array.isArray(sortState) ? sortState : sortState ? [sortState] : []).filter(Boolean);
|
|
65707
|
+
if (normalizedSortState.length ? this.internalProps.sortState = sortState : this.internalProps.sortState = null, executeSort) if (normalizedSortState.length) this.internalProps.layoutMap.headerObjects.some(item => !1 !== item.define.sort) && (this.dataSource.sort(normalizedSortState.map(item => {
|
|
65509
65708
|
const sortFunc = this._getSortFuncFromHeaderOption(this.internalProps.columns, item.field);
|
|
65510
65709
|
this.internalProps.layoutMap.headerObjects.find(col => col && col.field === item.field);
|
|
65511
65710
|
return {
|
|
@@ -65513,13 +65712,20 @@
|
|
|
65513
65712
|
order: item.order,
|
|
65514
65713
|
orderFn: null != sortFunc ? sortFunc : defaultOrderFn
|
|
65515
65714
|
};
|
|
65516
|
-
})), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1, this.scenegraph.sortCell())
|
|
65715
|
+
})), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1, this.scenegraph.sortCell());else {
|
|
65716
|
+
const ds = this.dataSource,
|
|
65717
|
+
sourceLength = null !== (_c = null !== (_b = null !== (_a = null == ds ? void 0 : ds.sourceLength) && void 0 !== _a ? _a : null == ds ? void 0 : ds._sourceLength) && void 0 !== _b ? _b : null == ds ? void 0 : ds.length) && void 0 !== _c ? _c : 0;
|
|
65718
|
+
(null === (_d = null == ds ? void 0 : ds.sortedIndexMap) || void 0 === _d ? void 0 : _d.clear) && ds.sortedIndexMap.clear(), void 0 !== ds.currentIndexedData && (ds.currentIndexedData = Array.from({
|
|
65719
|
+
length: sourceLength
|
|
65720
|
+
}, (_, i) => i)), ds.lastSortStates = [], null === (_e = ds.updatePagination) || void 0 === _e || _e.call(ds, ds.pagination), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1, this.scenegraph.sortCell();
|
|
65721
|
+
}
|
|
65722
|
+
this.stateManager.updateSortState(normalizedSortState);
|
|
65517
65723
|
}
|
|
65518
65724
|
updateFilterRules(filterRules, options = {
|
|
65519
65725
|
clearRowHeightCache: !0
|
|
65520
65726
|
}) {
|
|
65521
65727
|
var _a, _b, _c;
|
|
65522
|
-
this.scenegraph.clearCells(), null === (_b = (_a = this.dataSource).clearForceVisibleRecords) || void 0 === _b || _b.call(_a), this.sortState ? (this.dataSource.updateFilterRulesForSorted(filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(filterRules, null == options ? void 0 : options.onFilterRecordsEnd), this.refreshRowColCount(), this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(!(null == options ? void 0 : options.clearRowHeightCache)), null === (_c = this.internalProps.emptyTip) || void 0 === _c || _c.resetVisible(), this.resize();
|
|
65728
|
+
this.scenegraph.clearCells(), !1 !== (null == options ? void 0 : options.clearForceVisibleRecords) && (null === (_b = (_a = this.dataSource).clearForceVisibleRecords) || void 0 === _b || _b.call(_a)), this.sortState ? (this.dataSource.updateFilterRulesForSorted(filterRules), sortRecords(this)) : this.dataSource.updateFilterRules(filterRules, null == options ? void 0 : options.onFilterRecordsEnd), this.refreshRowColCount(), this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(!(null == options ? void 0 : options.clearRowHeightCache)), null === (_c = this.internalProps.emptyTip) || void 0 === _c || _c.resetVisible(), this.resize();
|
|
65523
65729
|
}
|
|
65524
65730
|
getFilteredRecords() {
|
|
65525
65731
|
return this.dataSource.records;
|
|
@@ -65794,30 +66000,112 @@
|
|
|
65794
66000
|
traverseColumns(this.internalProps.columns), this.refreshRowColCount(), this.internalProps.layoutMap.clearCellRangeMap(), this.internalProps.useOneRowHeightFillAll = !1, this.stateManager.initCheckedState(this.records), this.scenegraph.createSceneGraph(!clearRowHeightCache), null === (_k = this.internalProps.emptyTip) || void 0 === _k || _k.resetVisible(), this.resize();
|
|
65795
66001
|
}
|
|
65796
66002
|
addRecord(record, recordIndex, triggerEvent = !0) {
|
|
65797
|
-
var _a;
|
|
66003
|
+
var _a, _b;
|
|
66004
|
+
if (Array.isArray(this.options.customMergeCell) && "number" == typeof recordIndex) {
|
|
66005
|
+
const axis = this.transpose ? "col" : "row",
|
|
66006
|
+
headerCount = this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount,
|
|
66007
|
+
topAggregationCount = this.internalProps.layoutMap.hasAggregationOnTopCount;
|
|
66008
|
+
let insertIndex = recordIndex;
|
|
66009
|
+
void 0 === insertIndex || insertIndex > this.dataSource.sourceLength ? insertIndex = this.dataSource.sourceLength : insertIndex < 0 && (insertIndex = 0);
|
|
66010
|
+
const insertIndexNum = insertIndex + headerCount + topAggregationCount,
|
|
66011
|
+
merges = this.options.customMergeCell.map(m => Object.assign(Object.assign({}, m), {
|
|
66012
|
+
range: {
|
|
66013
|
+
start: Object.assign({}, m.range.start),
|
|
66014
|
+
end: Object.assign({}, m.range.end)
|
|
66015
|
+
}
|
|
66016
|
+
}));
|
|
66017
|
+
for (let i = 0; i < merges.length; i++) {
|
|
66018
|
+
const r = null === (_a = merges[i]) || void 0 === _a ? void 0 : _a.range;
|
|
66019
|
+
if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
|
|
66020
|
+
const start = r.start[axis],
|
|
66021
|
+
end = r.end[axis];
|
|
66022
|
+
end < insertIndexNum || (start > insertIndexNum ? (r.start[axis] = start + 1, r.end[axis] = end + 1) : r.end[axis] = end + 1);
|
|
66023
|
+
}
|
|
66024
|
+
this.options.customMergeCell = merges.filter(m => {
|
|
66025
|
+
const r = null == m ? void 0 : m.range;
|
|
66026
|
+
return !(!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) && !(r.end.row < r.start.row || r.end.col < r.start.col) && !(r.start.row === r.end.row && r.start.col === r.end.col);
|
|
66027
|
+
}), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
|
|
66028
|
+
}
|
|
65798
66029
|
const success = listTableAddRecord(record, recordIndex, this);
|
|
65799
|
-
adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]), null === (
|
|
66030
|
+
adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, [record]), null === (_b = this.internalProps.emptyTip) || void 0 === _b || _b.resetVisible(), success && Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell), this.options.customMergeCell.forEach(m => {
|
|
66031
|
+
const r = null == m ? void 0 : m.range;
|
|
66032
|
+
if (null == r ? void 0 : r.start) for (let col = r.start.col; col <= r.end.col; col++) for (let row = r.start.row; row <= r.end.row; row++) this.scenegraph.updateCellContent(col, row);
|
|
66033
|
+
}), this.scenegraph.updateNextFrame()), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
|
|
65800
66034
|
records: [record],
|
|
65801
66035
|
recordIndex: recordIndex,
|
|
65802
66036
|
recordCount: 1
|
|
65803
66037
|
});
|
|
65804
66038
|
}
|
|
65805
66039
|
addRecords(records, recordIndex, triggerEvent = !0) {
|
|
65806
|
-
var _a;
|
|
66040
|
+
var _a, _b;
|
|
66041
|
+
if (Array.isArray(this.options.customMergeCell) && "number" == typeof recordIndex && (null == records ? void 0 : records.length)) {
|
|
66042
|
+
const axis = this.transpose ? "col" : "row",
|
|
66043
|
+
headerCount = this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount,
|
|
66044
|
+
topAggregationCount = this.internalProps.layoutMap.hasAggregationOnTopCount;
|
|
66045
|
+
let insertIndex = recordIndex;
|
|
66046
|
+
void 0 === insertIndex || insertIndex > this.dataSource.sourceLength ? insertIndex = this.dataSource.sourceLength : insertIndex < 0 && (insertIndex = 0);
|
|
66047
|
+
const insertIndexNum = insertIndex + headerCount + topAggregationCount,
|
|
66048
|
+
toAddCount = records.length,
|
|
66049
|
+
merges = this.options.customMergeCell.map(m => Object.assign(Object.assign({}, m), {
|
|
66050
|
+
range: {
|
|
66051
|
+
start: Object.assign({}, m.range.start),
|
|
66052
|
+
end: Object.assign({}, m.range.end)
|
|
66053
|
+
}
|
|
66054
|
+
}));
|
|
66055
|
+
for (let i = 0; i < merges.length; i++) {
|
|
66056
|
+
const r = null === (_a = merges[i]) || void 0 === _a ? void 0 : _a.range;
|
|
66057
|
+
if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
|
|
66058
|
+
const start = r.start[axis],
|
|
66059
|
+
end = r.end[axis];
|
|
66060
|
+
end < insertIndexNum || (start > insertIndexNum ? (r.start[axis] = start + toAddCount, r.end[axis] = end + toAddCount) : r.end[axis] = end + toAddCount);
|
|
66061
|
+
}
|
|
66062
|
+
this.options.customMergeCell = merges.filter(m => {
|
|
66063
|
+
const r = null == m ? void 0 : m.range;
|
|
66064
|
+
return !(!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) && !(r.end.row < r.start.row || r.end.col < r.start.col) && !(r.start.row === r.end.row && r.start.col === r.end.col);
|
|
66065
|
+
}), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
|
|
66066
|
+
}
|
|
65807
66067
|
const success = listTableAddRecords(records, recordIndex, this);
|
|
65808
|
-
"number" == typeof recordIndex && adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records), null === (
|
|
66068
|
+
"number" == typeof recordIndex && adjustHeightResizedRowMapWithAddRecordIndex(this, recordIndex, records), null === (_b = this.internalProps.emptyTip) || void 0 === _b || _b.resetVisible(), success && Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell), this.options.customMergeCell.forEach(m => {
|
|
66069
|
+
const r = null == m ? void 0 : m.range;
|
|
66070
|
+
if (null == r ? void 0 : r.start) for (let col = r.start.col; col <= r.end.col; col++) for (let row = r.start.row; row <= r.end.row; row++) this.scenegraph.updateCellContent(col, row);
|
|
66071
|
+
}), this.scenegraph.updateNextFrame()), triggerEvent && success && this.fireListeners(TABLE_EVENT_TYPE.ADD_RECORD, {
|
|
65809
66072
|
records: records,
|
|
65810
66073
|
recordIndex: recordIndex,
|
|
65811
66074
|
recordCount: records.length
|
|
65812
66075
|
});
|
|
65813
66076
|
}
|
|
65814
66077
|
deleteRecords(recordIndexs, triggerEvent = !0) {
|
|
65815
|
-
var _a;
|
|
65816
|
-
const
|
|
65817
|
-
|
|
66078
|
+
var _a, _b;
|
|
66079
|
+
const prevMergeRanges = Array.isArray(this.options.customMergeCell) ? this.options.customMergeCell.map(m => null == m ? void 0 : m.range).filter(Boolean).map(r => ({
|
|
66080
|
+
start: Object.assign({}, r.start),
|
|
66081
|
+
end: Object.assign({}, r.end)
|
|
66082
|
+
})) : [],
|
|
66083
|
+
deletedRecords = [];
|
|
66084
|
+
if ((null == recordIndexs ? void 0 : recordIndexs.length) > 0 && recordIndexs.forEach(index => {
|
|
65818
66085
|
let record = null;
|
|
65819
66086
|
record = "number" == typeof index ? this.dataSource.get(index) : [], deletedRecords.push(record);
|
|
65820
|
-
}),
|
|
66087
|
+
}), Array.isArray(this.options.customMergeCell) && (null == recordIndexs ? void 0 : recordIndexs.length) && "number" == typeof recordIndexs[0]) {
|
|
66088
|
+
const axis = this.transpose ? "col" : "row",
|
|
66089
|
+
headerCount = this.transpose ? this.rowHeaderLevelCount : this.columnHeaderLevelCount,
|
|
66090
|
+
topAggregationCount = this.internalProps.layoutMap.hasAggregationOnTopCount,
|
|
66091
|
+
deleteIndexNums = recordIndexs.slice().sort((a, b) => a - b).map((index, i) => index + headerCount + topAggregationCount - i),
|
|
66092
|
+
merges = this.options.customMergeCell;
|
|
66093
|
+
for (let i = 0; i < deleteIndexNums.length; i++) {
|
|
66094
|
+
const deleteIndex = deleteIndexNums[i];
|
|
66095
|
+
for (let j = 0; j < merges.length; j++) {
|
|
66096
|
+
const r = null === (_a = merges[j]) || void 0 === _a ? void 0 : _a.range;
|
|
66097
|
+
if (!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) continue;
|
|
66098
|
+
const start = r.start[axis],
|
|
66099
|
+
end = r.end[axis];
|
|
66100
|
+
end < deleteIndex || (start > deleteIndex ? (r.start[axis] = start - 1, r.end[axis] = end - 1) : r.end[axis] = end - 1);
|
|
66101
|
+
}
|
|
66102
|
+
}
|
|
66103
|
+
this.options.customMergeCell = merges.filter(m => {
|
|
66104
|
+
const r = null == m ? void 0 : m.range;
|
|
66105
|
+
return !(!(null == r ? void 0 : r.start) || !(null == r ? void 0 : r.end)) && !(r.end.row < r.start.row || r.end.col < r.start.col) && !(r.start.row === r.end.row && r.start.col === r.end.col);
|
|
66106
|
+
});
|
|
66107
|
+
}
|
|
66108
|
+
listTableDeleteRecords(recordIndexs, this), adjustHeightResizedRowMapWithDeleteRecordIndex(this, recordIndexs), null === (_b = this.internalProps.emptyTip) || void 0 === _b || _b.resetVisible();
|
|
65821
66109
|
const rowIndexs = [];
|
|
65822
66110
|
for (let i = 0; i < recordIndexs.length; i++) rowIndexs.push(this.getBodyRowIndexByRecordIndex(recordIndexs[i]) + this.columnHeaderLevelCount);
|
|
65823
66111
|
triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.DELETE_RECORD, {
|
|
@@ -65825,7 +66113,16 @@
|
|
|
65825
66113
|
records: deletedRecords,
|
|
65826
66114
|
rowIndexs: rowIndexs,
|
|
65827
66115
|
deletedCount: (Array.isArray(recordIndexs[0]), recordIndexs.length)
|
|
65828
|
-
})
|
|
66116
|
+
}), Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell), this.options.customMergeCell.forEach(m => {
|
|
66117
|
+
const r = null == m ? void 0 : m.range;
|
|
66118
|
+
if (null == r ? void 0 : r.start) for (let col = r.start.col; col <= r.end.col; col++) for (let row = r.start.row; row <= r.end.row; row++) this.scenegraph.updateCellContent(col, row);
|
|
66119
|
+
}), this.scenegraph.updateNextFrame(), setTimeout(() => {
|
|
66120
|
+
if (!this.internalProps || !this.options || !this.scenegraph) return;
|
|
66121
|
+
Array.isArray(this.options.customMergeCell) && (this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell));
|
|
66122
|
+
[...prevMergeRanges, ...(Array.isArray(this.options.customMergeCell) ? this.options.customMergeCell.map(m => null == m ? void 0 : m.range) : [])].filter(Boolean).forEach(r => {
|
|
66123
|
+
if (null == r ? void 0 : r.start) for (let col = r.start.col; col <= r.end.col; col++) for (let row = r.start.row; row <= r.end.row; row++) this.scenegraph.updateCellContent(col, row);
|
|
66124
|
+
}), this.scenegraph.updateNextFrame();
|
|
66125
|
+
}, 0));
|
|
65829
66126
|
}
|
|
65830
66127
|
updateRecords(records, recordIndexs, triggerEvent = !0) {
|
|
65831
66128
|
listTableUpdateRecords(records, recordIndexs, this), triggerEvent && this.fireListeners(TABLE_EVENT_TYPE.UPDATE_RECORD, {
|
|
@@ -65929,7 +66226,12 @@
|
|
|
65929
66226
|
}
|
|
65930
66227
|
}), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
|
|
65931
66228
|
for (let i = startCol; i <= endCol; i++) for (let j = startRow; j <= endRow; j++) this.scenegraph.updateCellContent(i, j);
|
|
65932
|
-
this.scenegraph.updateNextFrame()
|
|
66229
|
+
this.scenegraph.updateNextFrame(), this.fireListeners(TABLE_EVENT_TYPE.MERGE_CELLS, {
|
|
66230
|
+
startCol: startCol,
|
|
66231
|
+
startRow: startRow,
|
|
66232
|
+
endCol: endCol,
|
|
66233
|
+
endRow: endRow
|
|
66234
|
+
});
|
|
65933
66235
|
}
|
|
65934
66236
|
unmergeCells(startCol, startRow, endCol, endRow) {
|
|
65935
66237
|
this.options.customMergeCell ? "function" == typeof this.options.customMergeCell && (this.options.customMergeCell = []) : this.options.customMergeCell = [], this.options.customMergeCell = this.options.customMergeCell.filter(item => {
|
|
@@ -65940,7 +66242,12 @@
|
|
|
65940
66242
|
return !(start.col === startCol && start.row === startRow && end.col === endCol && end.row === endRow);
|
|
65941
66243
|
}), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
|
|
65942
66244
|
for (let i = startCol; i <= endCol; i++) for (let j = startRow; j <= endRow; j++) this.scenegraph.updateCellContent(i, j);
|
|
65943
|
-
this.scenegraph.updateNextFrame()
|
|
66245
|
+
this.scenegraph.updateNextFrame(), this.fireListeners(TABLE_EVENT_TYPE.UNMERGE_CELLS, {
|
|
66246
|
+
startCol: startCol,
|
|
66247
|
+
startRow: startRow,
|
|
66248
|
+
endCol: endCol,
|
|
66249
|
+
endRow: endRow
|
|
66250
|
+
});
|
|
65944
66251
|
}
|
|
65945
66252
|
}
|
|
65946
66253
|
|
|
@@ -70209,8 +70516,7 @@
|
|
|
70209
70516
|
(!isMilestone && (taskDays <= 0 || !startDate || !endDate || startDate.getTime() > endDate.getTime()))) {
|
|
70210
70517
|
return { barGroupBox: null, baselineBar: null };
|
|
70211
70518
|
}
|
|
70212
|
-
|
|
70213
|
-
let taskBarSize = computeCountToTimeScale(endDate, startDate, unit, step, 1) * this._scene._gantt.parsedOptions.timelineColWidth;
|
|
70519
|
+
let taskBarSize = this._scene._gantt.getXByTime(endDate.getTime() + 1) - this._scene._gantt.getXByTime(startDate.getTime());
|
|
70214
70520
|
const taskBarStyle = this._scene._gantt.getTaskBarStyle(index, childIndex);
|
|
70215
70521
|
const taskbarHeight = taskBarStyle.width;
|
|
70216
70522
|
if (isValid$1(taskBarStyle.minSize)) {
|
|
@@ -70218,9 +70524,7 @@
|
|
|
70218
70524
|
}
|
|
70219
70525
|
const oneTaskHeigth = this._scene._gantt.parsedOptions.rowHeight;
|
|
70220
70526
|
const milestoneTaskBarHeight = this._scene._gantt.parsedOptions.taskBarMilestoneStyle.width;
|
|
70221
|
-
const x =
|
|
70222
|
-
this._scene._gantt.parsedOptions.timelineColWidth -
|
|
70223
|
-
(isMilestone ? milestoneTaskBarHeight / 2 : 0);
|
|
70527
|
+
const x = this._scene._gantt.getXByTime(startDate.getTime()) - (isMilestone ? milestoneTaskBarHeight / 2 : 0);
|
|
70224
70528
|
let y = this._scene._gantt.getRowsHeightByIndex(0, index - 1) +
|
|
70225
70529
|
(this._scene._gantt.parsedOptions.tasksShowMode === TasksShowMode.Sub_Tasks_Separate
|
|
70226
70530
|
? (childIndex ?? 0) * oneTaskHeigth
|
|
@@ -70235,10 +70539,9 @@
|
|
|
70235
70539
|
let taskBarYOffset = 0;
|
|
70236
70540
|
if (hasBaseline && !isMilestone) {
|
|
70237
70541
|
const baselineStyle = this._scene._gantt.getBaselineStyle(index, childIndex);
|
|
70238
|
-
const baselineX =
|
|
70239
|
-
|
|
70240
|
-
|
|
70241
|
-
this._scene._gantt.parsedOptions.timelineColWidth;
|
|
70542
|
+
const baselineX = this._scene._gantt.getXByTime(baselineInfo.baselineStartDate.getTime());
|
|
70543
|
+
const baselineWidth = this._scene._gantt.getXByTime(baselineInfo.baselineEndDate.getTime() + 1) -
|
|
70544
|
+
this._scene._gantt.getXByTime(baselineInfo.baselineStartDate.getTime());
|
|
70242
70545
|
let baselineY;
|
|
70243
70546
|
const taskBarPaddingTop = taskBarStyle.paddingTop ?? undefined;
|
|
70244
70547
|
const baselinePaddingTop = baselineStyle.paddingTop ?? undefined;
|
|
@@ -70849,22 +71152,24 @@
|
|
|
70849
71152
|
const date = this._scene._gantt.parsedOptions.timeScaleIncludeHour
|
|
70850
71153
|
? createDateAtMidnight(line.date)
|
|
70851
71154
|
: createDateAtMidnight(line.date, true);
|
|
70852
|
-
const
|
|
70853
|
-
|
|
70854
|
-
|
|
70855
|
-
|
|
70856
|
-
positionOffset = 1;
|
|
71155
|
+
const dateTime = date.getTime();
|
|
71156
|
+
if (dateTime < this._scene._gantt.parsedOptions._minDateTime ||
|
|
71157
|
+
dateTime > this._scene._gantt.parsedOptions._maxDateTime) {
|
|
71158
|
+
return;
|
|
70857
71159
|
}
|
|
70858
|
-
|
|
70859
|
-
|
|
71160
|
+
const cellIndex = this._scene._gantt.getDateIndexByTime(dateTime);
|
|
71161
|
+
const cellStartX = cellIndex >= 1 ? this._scene._gantt.getDateColsWidth(0, cellIndex - 1) : 0;
|
|
71162
|
+
const cellWidth = this._scene._gantt.getDateColWidth(cellIndex);
|
|
71163
|
+
let dateX = cellStartX;
|
|
71164
|
+
if (line.position === 'date') {
|
|
71165
|
+
dateX = this._scene._gantt.getXByTime(dateTime);
|
|
71166
|
+
}
|
|
71167
|
+
else if (line.position === 'right') {
|
|
71168
|
+
dateX = cellStartX + cellWidth;
|
|
70860
71169
|
}
|
|
70861
|
-
else if (line.position === '
|
|
70862
|
-
|
|
70863
|
-
const unitCount = computeCountToTimeScale(date, minDate, unit, step);
|
|
70864
|
-
const cellIndex = Math.floor(unitCount);
|
|
70865
|
-
positionOffset = unitCount - cellIndex;
|
|
71170
|
+
else if (line.position === 'middle') {
|
|
71171
|
+
dateX = cellStartX + cellWidth / 2;
|
|
70866
71172
|
}
|
|
70867
|
-
const dateX = this._scene._gantt.parsedOptions.timelineColWidth * (Math.floor(unitCount) + positionOffset);
|
|
70868
71173
|
const markLineGroup = new Group$2({
|
|
70869
71174
|
pickable: false,
|
|
70870
71175
|
x: dateX - this.markLineContainerWidth / 2,
|
|
@@ -70886,7 +71191,7 @@
|
|
|
70886
71191
|
});
|
|
70887
71192
|
markLineGroup.appendChild(lineObj);
|
|
70888
71193
|
if (line.content) {
|
|
70889
|
-
const textMaxLineWidth = this._scene._gantt.
|
|
71194
|
+
const textMaxLineWidth = Math.max(this._scene._gantt.getDateColWidth(cellIndex), 1);
|
|
70890
71195
|
const textContainerHeight = contentStyle.lineHeight || 18;
|
|
70891
71196
|
const textGroup = new Group$2({
|
|
70892
71197
|
x: this.markLineContainerWidth / 2,
|
|
@@ -71475,22 +71780,21 @@
|
|
|
71475
71780
|
}
|
|
71476
71781
|
}
|
|
71477
71782
|
function generateLinkLinePoints(type, linkedFromTaskStartDate, linkedFromTaskEndDate, linkedFromTaskRecordRowIndex, linkedFromTaskTaskDays, linkedFromTaskIsMilestone, linkedToTaskStartDate, linkedToTaskEndDate, linkedToTaskRecordRowIndex, linkedToTaskTaskDays, linkedToTaskIsMilestone, gantt) {
|
|
71478
|
-
const {
|
|
71479
|
-
const { minDate, rowHeight, timelineColWidth } = gantt.parsedOptions;
|
|
71783
|
+
const { rowHeight } = gantt.parsedOptions;
|
|
71480
71784
|
const taskBarMilestoneHypotenuse = gantt.parsedOptions.taskBarMilestoneHypotenuse;
|
|
71481
71785
|
const distanceToTaskBar = gantt.parsedOptions.dependencyLinkDistanceToTaskBar ?? 20;
|
|
71482
71786
|
const arrowWidth = 10;
|
|
71483
71787
|
const arrowHeight = 5;
|
|
71484
71788
|
let linePoints = [];
|
|
71485
71789
|
let arrowPoints = [];
|
|
71790
|
+
const getStartX = (d) => gantt.getXByTime(d.getTime());
|
|
71791
|
+
const getEndX = (d) => gantt.getXByTime(d.getTime() + 1);
|
|
71486
71792
|
if (type === DependencyType.FinishToStart) {
|
|
71487
|
-
let linkFromPointX =
|
|
71793
|
+
let linkFromPointX = getEndX(linkedFromTaskEndDate);
|
|
71488
71794
|
if (linkedFromTaskIsMilestone) {
|
|
71489
|
-
linkFromPointX =
|
|
71490
|
-
computeCountToTimeScale(linkedFromTaskStartDate, minDate, unit, step, 1) * timelineColWidth +
|
|
71491
|
-
taskBarMilestoneHypotenuse / 2;
|
|
71795
|
+
linkFromPointX = getStartX(linkedFromTaskStartDate) + taskBarMilestoneHypotenuse / 2;
|
|
71492
71796
|
}
|
|
71493
|
-
let linkToPointX =
|
|
71797
|
+
let linkToPointX = getStartX(linkedToTaskStartDate);
|
|
71494
71798
|
if (linkedToTaskIsMilestone) {
|
|
71495
71799
|
linkToPointX -= taskBarMilestoneHypotenuse / 2;
|
|
71496
71800
|
}
|
|
@@ -71549,15 +71853,13 @@
|
|
|
71549
71853
|
];
|
|
71550
71854
|
}
|
|
71551
71855
|
else if (type === DependencyType.StartToFinish) {
|
|
71552
|
-
let linkFromPointX =
|
|
71856
|
+
let linkFromPointX = getStartX(linkedFromTaskStartDate);
|
|
71553
71857
|
if (linkedFromTaskIsMilestone) {
|
|
71554
71858
|
linkFromPointX -= taskBarMilestoneHypotenuse / 2;
|
|
71555
71859
|
}
|
|
71556
|
-
let linkToPointX =
|
|
71860
|
+
let linkToPointX = getEndX(linkedToTaskEndDate);
|
|
71557
71861
|
if (linkedToTaskIsMilestone) {
|
|
71558
|
-
linkToPointX =
|
|
71559
|
-
computeCountToTimeScale(linkedToTaskStartDate, minDate, unit, step, 1) * timelineColWidth +
|
|
71560
|
-
taskBarMilestoneHypotenuse / 2;
|
|
71862
|
+
linkToPointX = getStartX(linkedToTaskStartDate) + taskBarMilestoneHypotenuse / 2;
|
|
71561
71863
|
}
|
|
71562
71864
|
linePoints = [
|
|
71563
71865
|
{
|
|
@@ -71614,11 +71916,11 @@
|
|
|
71614
71916
|
];
|
|
71615
71917
|
}
|
|
71616
71918
|
else if (type === DependencyType.StartToStart) {
|
|
71617
|
-
let linkFromPointX =
|
|
71919
|
+
let linkFromPointX = getStartX(linkedFromTaskStartDate);
|
|
71618
71920
|
if (linkedFromTaskIsMilestone) {
|
|
71619
71921
|
linkFromPointX -= taskBarMilestoneHypotenuse / 2;
|
|
71620
71922
|
}
|
|
71621
|
-
let linkToPointX =
|
|
71923
|
+
let linkToPointX = getStartX(linkedToTaskStartDate);
|
|
71622
71924
|
if (linkedToTaskIsMilestone) {
|
|
71623
71925
|
linkToPointX -= taskBarMilestoneHypotenuse / 2;
|
|
71624
71926
|
}
|
|
@@ -71677,17 +71979,13 @@
|
|
|
71677
71979
|
];
|
|
71678
71980
|
}
|
|
71679
71981
|
else if (type === DependencyType.FinishToFinish) {
|
|
71680
|
-
let linkFromPointX =
|
|
71982
|
+
let linkFromPointX = getEndX(linkedFromTaskEndDate);
|
|
71681
71983
|
if (linkedFromTaskIsMilestone) {
|
|
71682
|
-
linkFromPointX =
|
|
71683
|
-
computeCountToTimeScale(linkedFromTaskStartDate, minDate, unit, step, 1) * timelineColWidth +
|
|
71684
|
-
taskBarMilestoneHypotenuse / 2;
|
|
71984
|
+
linkFromPointX = getStartX(linkedFromTaskStartDate) + taskBarMilestoneHypotenuse / 2;
|
|
71685
71985
|
}
|
|
71686
|
-
let linkToPointX =
|
|
71986
|
+
let linkToPointX = getEndX(linkedToTaskEndDate);
|
|
71687
71987
|
if (linkedToTaskIsMilestone) {
|
|
71688
|
-
linkToPointX =
|
|
71689
|
-
computeCountToTimeScale(linkedToTaskStartDate, minDate, unit, step, 1) * timelineColWidth +
|
|
71690
|
-
taskBarMilestoneHypotenuse / 2;
|
|
71988
|
+
linkToPointX = getStartX(linkedToTaskStartDate) + taskBarMilestoneHypotenuse / 2;
|
|
71691
71989
|
}
|
|
71692
71990
|
linePoints = [
|
|
71693
71991
|
{
|
|
@@ -71744,8 +72042,7 @@
|
|
|
71744
72042
|
return { linePoints, arrowPoints };
|
|
71745
72043
|
}
|
|
71746
72044
|
function updateLinkLinePoints(type, linkedFromTaskStartDate, linkedFromTaskEndDate, linkedFromTaskRecordRowIndex, linkedFromTaskTaskDays, linkedFromTaskIsMilestone, linkedFromMovedTaskBarNode, fromNodeDiffY, linkedToTaskStartDate, linkedToTaskEndDate, linkedToTaskRecordRowIndex, linkedToTaskTaskDays, linkedToTaskIsMilestone, linkedToMovedTaskBarNode, toNodeDiffY, gantt) {
|
|
71747
|
-
const {
|
|
71748
|
-
const { minDate, rowHeight, timelineColWidth } = gantt.parsedOptions;
|
|
72045
|
+
const { rowHeight } = gantt.parsedOptions;
|
|
71749
72046
|
const taskBarMilestoneHypotenuse = gantt.parsedOptions.taskBarMilestoneHypotenuse;
|
|
71750
72047
|
const milestoneTaskbarHeight = gantt.parsedOptions.taskBarMilestoneStyle.width;
|
|
71751
72048
|
const distanceToTaskBar = gantt.parsedOptions.dependencyLinkDistanceToTaskBar ?? 20;
|
|
@@ -71753,21 +72050,22 @@
|
|
|
71753
72050
|
const arrowHeight = 5;
|
|
71754
72051
|
let linePoints = [];
|
|
71755
72052
|
let arrowPoints = [];
|
|
72053
|
+
const getStartX = (d) => gantt.getXByTime(d.getTime());
|
|
72054
|
+
const getEndX = (d) => gantt.getXByTime(d.getTime() + 1);
|
|
71756
72055
|
if (type === DependencyType.FinishToStart) {
|
|
71757
72056
|
let linkFromPointX = linkedFromMovedTaskBarNode
|
|
71758
72057
|
? linkedFromMovedTaskBarNode.attribute.x + linkedFromMovedTaskBarNode.attribute.width
|
|
71759
|
-
:
|
|
72058
|
+
: getEndX(linkedFromTaskEndDate);
|
|
71760
72059
|
if (linkedFromTaskIsMilestone) {
|
|
71761
72060
|
linkFromPointX = linkedFromMovedTaskBarNode
|
|
71762
72061
|
? linkedFromMovedTaskBarNode.attribute.x +
|
|
71763
72062
|
linkedFromMovedTaskBarNode.attribute.width +
|
|
71764
72063
|
(taskBarMilestoneHypotenuse - milestoneTaskbarHeight) / 2
|
|
71765
|
-
:
|
|
71766
|
-
taskBarMilestoneHypotenuse / 2;
|
|
72064
|
+
: getStartX(linkedFromTaskStartDate) + taskBarMilestoneHypotenuse / 2;
|
|
71767
72065
|
}
|
|
71768
72066
|
let linkToPointX = linkedToMovedTaskBarNode
|
|
71769
72067
|
? linkedToMovedTaskBarNode.attribute.x
|
|
71770
|
-
:
|
|
72068
|
+
: getStartX(linkedToTaskStartDate);
|
|
71771
72069
|
if (linkedToTaskIsMilestone) {
|
|
71772
72070
|
linkToPointX -= (taskBarMilestoneHypotenuse - milestoneTaskbarHeight) / 2;
|
|
71773
72071
|
}
|
|
@@ -71830,20 +72128,19 @@
|
|
|
71830
72128
|
else if (type === DependencyType.StartToFinish) {
|
|
71831
72129
|
let linkFromPointX = linkedFromMovedTaskBarNode
|
|
71832
72130
|
? linkedFromMovedTaskBarNode.attribute.x
|
|
71833
|
-
:
|
|
72131
|
+
: getStartX(linkedFromTaskStartDate);
|
|
71834
72132
|
if (linkedFromTaskIsMilestone) {
|
|
71835
72133
|
linkFromPointX -= (taskBarMilestoneHypotenuse - milestoneTaskbarHeight) / 2;
|
|
71836
72134
|
}
|
|
71837
72135
|
let linkToPointX = linkedToMovedTaskBarNode
|
|
71838
72136
|
? linkedToMovedTaskBarNode.attribute.x + linkedToMovedTaskBarNode.attribute.width
|
|
71839
|
-
:
|
|
72137
|
+
: getEndX(linkedToTaskEndDate);
|
|
71840
72138
|
if (linkedToTaskIsMilestone) {
|
|
71841
72139
|
linkToPointX = linkedToMovedTaskBarNode
|
|
71842
72140
|
? linkedToMovedTaskBarNode.attribute.x +
|
|
71843
72141
|
linkedToMovedTaskBarNode.attribute.width +
|
|
71844
72142
|
(taskBarMilestoneHypotenuse - milestoneTaskbarHeight) / 2
|
|
71845
|
-
:
|
|
71846
|
-
taskBarMilestoneHypotenuse / 2;
|
|
72143
|
+
: getStartX(linkedToTaskStartDate) + taskBarMilestoneHypotenuse / 2;
|
|
71847
72144
|
}
|
|
71848
72145
|
linePoints = [
|
|
71849
72146
|
{
|
|
@@ -71904,13 +72201,13 @@
|
|
|
71904
72201
|
else if (type === DependencyType.StartToStart) {
|
|
71905
72202
|
let linkFromPointX = linkedFromMovedTaskBarNode
|
|
71906
72203
|
? linkedFromMovedTaskBarNode.attribute.x
|
|
71907
|
-
:
|
|
72204
|
+
: getStartX(linkedFromTaskStartDate);
|
|
71908
72205
|
if (linkedFromTaskIsMilestone) {
|
|
71909
72206
|
linkFromPointX -= (taskBarMilestoneHypotenuse - milestoneTaskbarHeight) / 2;
|
|
71910
72207
|
}
|
|
71911
72208
|
let linkToPointX = linkedToMovedTaskBarNode
|
|
71912
72209
|
? linkedToMovedTaskBarNode.attribute.x
|
|
71913
|
-
:
|
|
72210
|
+
: getStartX(linkedToTaskStartDate);
|
|
71914
72211
|
if (linkedToTaskIsMilestone) {
|
|
71915
72212
|
linkToPointX -= (taskBarMilestoneHypotenuse - milestoneTaskbarHeight) / 2;
|
|
71916
72213
|
}
|
|
@@ -71973,25 +72270,23 @@
|
|
|
71973
72270
|
else if (type === DependencyType.FinishToFinish) {
|
|
71974
72271
|
let linkFromPointX = linkedFromMovedTaskBarNode
|
|
71975
72272
|
? linkedFromMovedTaskBarNode.attribute.x + linkedFromMovedTaskBarNode.attribute.width
|
|
71976
|
-
:
|
|
72273
|
+
: getEndX(linkedFromTaskEndDate);
|
|
71977
72274
|
if (linkedFromTaskIsMilestone) {
|
|
71978
72275
|
linkFromPointX = linkedFromMovedTaskBarNode
|
|
71979
72276
|
? linkedFromMovedTaskBarNode.attribute.x +
|
|
71980
72277
|
linkedFromMovedTaskBarNode.attribute.width +
|
|
71981
72278
|
(taskBarMilestoneHypotenuse - milestoneTaskbarHeight) / 2
|
|
71982
|
-
:
|
|
71983
|
-
taskBarMilestoneHypotenuse / 2;
|
|
72279
|
+
: getStartX(linkedFromTaskStartDate) + taskBarMilestoneHypotenuse / 2;
|
|
71984
72280
|
}
|
|
71985
72281
|
let linkToPointX = linkedToMovedTaskBarNode
|
|
71986
72282
|
? linkedToMovedTaskBarNode.attribute.x + linkedToMovedTaskBarNode.attribute.width
|
|
71987
|
-
:
|
|
72283
|
+
: getEndX(linkedToTaskEndDate);
|
|
71988
72284
|
if (linkedToTaskIsMilestone) {
|
|
71989
72285
|
linkToPointX = linkedToMovedTaskBarNode
|
|
71990
72286
|
? linkedToMovedTaskBarNode.attribute.x +
|
|
71991
72287
|
linkedToMovedTaskBarNode.attribute.width +
|
|
71992
72288
|
(taskBarMilestoneHypotenuse - milestoneTaskbarHeight) / 2
|
|
71993
|
-
:
|
|
71994
|
-
taskBarMilestoneHypotenuse / 2;
|
|
72289
|
+
: getStartX(linkedToTaskStartDate) + taskBarMilestoneHypotenuse / 2;
|
|
71995
72290
|
}
|
|
71996
72291
|
linePoints = [
|
|
71997
72292
|
{
|
|
@@ -74311,7 +74606,7 @@
|
|
|
74311
74606
|
gantt._updateSize();
|
|
74312
74607
|
gantt.scenegraph.refreshAll();
|
|
74313
74608
|
target = this.moveTaskBar.target = gantt.scenegraph.taskBar.getTaskBarNodeByIndex(this.moveTaskBar.target.task_index, this.moveTaskBar.target.sub_task_index);
|
|
74314
|
-
gantt.scrollLeft = gantt.
|
|
74609
|
+
gantt.scrollLeft = Math.max(0, gantt.getDateColWidth(0) - 1);
|
|
74315
74610
|
gantt.eventManager.lastDragPointerXYOnWindow.x = e.x;
|
|
74316
74611
|
if (target.record?.type === 'milestone') {
|
|
74317
74612
|
moveTaskBar(target, gantt.scrollLeft - target.attribute.x, 0, this);
|
|
@@ -74321,7 +74616,9 @@
|
|
|
74321
74616
|
}
|
|
74322
74617
|
}
|
|
74323
74618
|
else {
|
|
74324
|
-
|
|
74619
|
+
const colCount = gantt.parsedOptions.reverseSortedTimelineScales[0].timelineDates?.length ?? 0;
|
|
74620
|
+
const avgColWidth = gantt.getAllDateColsWidth() / Math.max(1, colCount);
|
|
74621
|
+
this.moveTaskBar.moveTaskBarXSpeed = -avgColWidth / 100;
|
|
74325
74622
|
this.moveTaskBar.moveTaskBarXInertia.startInertia(this.moveTaskBar.moveTaskBarXSpeed, 0, 1);
|
|
74326
74623
|
this.moveTaskBar.moveTaskBarXInertia.setScrollHandle((dx, dy) => {
|
|
74327
74624
|
this.moveTaskBar.deltaX += dx;
|
|
@@ -74359,7 +74656,9 @@
|
|
|
74359
74656
|
}
|
|
74360
74657
|
}
|
|
74361
74658
|
else {
|
|
74362
|
-
|
|
74659
|
+
const colCount = gantt.parsedOptions.reverseSortedTimelineScales[0].timelineDates?.length ?? 0;
|
|
74660
|
+
const avgColWidth = gantt.getAllDateColsWidth() / Math.max(1, colCount);
|
|
74661
|
+
this.moveTaskBar.moveTaskBarXSpeed = avgColWidth / 100;
|
|
74363
74662
|
this.moveTaskBar.moveTaskBarXInertia.startInertia(this.moveTaskBar.moveTaskBarXSpeed, 0, 1);
|
|
74364
74663
|
this.moveTaskBar.moveTaskBarXInertia.setScrollHandle((dx, dy) => {
|
|
74365
74664
|
this.moveTaskBar.deltaX += dx;
|
|
@@ -76158,6 +76457,10 @@
|
|
|
76158
76457
|
parsedOptions = {};
|
|
76159
76458
|
millisecondsPerPixel;
|
|
76160
76459
|
zoomScaleManager;
|
|
76460
|
+
_timelineColWidths = [];
|
|
76461
|
+
_timelineColX = [];
|
|
76462
|
+
_timelineColStartTimes = [];
|
|
76463
|
+
_timelineColEndTimes = [];
|
|
76161
76464
|
recalculateTimeScale() {
|
|
76162
76465
|
if (this.zoomScaleManager) {
|
|
76163
76466
|
this.zoomScaleManager.recalculateTimeScale();
|
|
@@ -76572,6 +76875,151 @@
|
|
|
76572
76875
|
scale.timelineDates = generateTimeLineDate(new Date(this.parsedOptions.minDate), this.parsedOptions.maxDate, scale);
|
|
76573
76876
|
}
|
|
76574
76877
|
}
|
|
76878
|
+
this._rebuildTimelineColXMap();
|
|
76879
|
+
}
|
|
76880
|
+
_rebuildTimelineColXMap() {
|
|
76881
|
+
const minScale = this.parsedOptions.reverseSortedTimelineScales?.[0];
|
|
76882
|
+
const timelineDates = minScale?.timelineDates ?? [];
|
|
76883
|
+
const baseWidth = this.parsedOptions.timelineColWidth ?? 0;
|
|
76884
|
+
const hideWeekend = this.options?.timelineHeader?.hideWeekend === true;
|
|
76885
|
+
const weekendColWidth = this.options?.timelineHeader?.weekendColWidth;
|
|
76886
|
+
const enableWeekendWidth = minScale?.unit === 'day' && minScale?.step === 1 && (hideWeekend || weekendColWidth !== undefined);
|
|
76887
|
+
this._timelineColWidths = new Array(timelineDates.length);
|
|
76888
|
+
this._timelineColX = new Array(timelineDates.length + 1);
|
|
76889
|
+
this._timelineColStartTimes = new Array(timelineDates.length);
|
|
76890
|
+
this._timelineColEndTimes = new Array(timelineDates.length);
|
|
76891
|
+
this._timelineColX[0] = 0;
|
|
76892
|
+
let sumX = 0;
|
|
76893
|
+
for (let i = 0; i < timelineDates.length; i++) {
|
|
76894
|
+
const d = timelineDates[i];
|
|
76895
|
+
const startTime = d.startDate?.getTime?.() ?? 0;
|
|
76896
|
+
const endTime = d.endDate?.getTime?.() ?? startTime;
|
|
76897
|
+
this._timelineColStartTimes[i] = startTime;
|
|
76898
|
+
this._timelineColEndTimes[i] = endTime;
|
|
76899
|
+
let w = baseWidth;
|
|
76900
|
+
if (enableWeekendWidth) {
|
|
76901
|
+
const day = d.startDate.getDay();
|
|
76902
|
+
const isWeekend = day === 0 || day === 6;
|
|
76903
|
+
if (isWeekend) {
|
|
76904
|
+
if (hideWeekend) {
|
|
76905
|
+
w = 0;
|
|
76906
|
+
}
|
|
76907
|
+
else if (typeof weekendColWidth === 'number') {
|
|
76908
|
+
w = weekendColWidth;
|
|
76909
|
+
}
|
|
76910
|
+
else if (typeof weekendColWidth === 'function') {
|
|
76911
|
+
w = weekendColWidth(baseWidth);
|
|
76912
|
+
}
|
|
76913
|
+
}
|
|
76914
|
+
}
|
|
76915
|
+
w = Math.max(0, Number.isFinite(w) ? w : baseWidth);
|
|
76916
|
+
this._timelineColWidths[i] = w;
|
|
76917
|
+
sumX += w;
|
|
76918
|
+
this._timelineColX[i + 1] = sumX;
|
|
76919
|
+
}
|
|
76920
|
+
}
|
|
76921
|
+
getXByTime(time) {
|
|
76922
|
+
const startTimes = this._timelineColStartTimes;
|
|
76923
|
+
const endTimes = this._timelineColEndTimes;
|
|
76924
|
+
const widths = this._timelineColWidths;
|
|
76925
|
+
const xPrefix = this._timelineColX;
|
|
76926
|
+
if (!startTimes?.length || !endTimes?.length || !widths?.length || !xPrefix?.length) {
|
|
76927
|
+
return 0;
|
|
76928
|
+
}
|
|
76929
|
+
if (time <= startTimes[0]) {
|
|
76930
|
+
return 0;
|
|
76931
|
+
}
|
|
76932
|
+
const lastIndex = endTimes.length - 1;
|
|
76933
|
+
if (time > endTimes[lastIndex]) {
|
|
76934
|
+
return xPrefix[lastIndex + 1] ?? 0;
|
|
76935
|
+
}
|
|
76936
|
+
let low = 0;
|
|
76937
|
+
let high = lastIndex;
|
|
76938
|
+
while (low <= high) {
|
|
76939
|
+
const mid = (low + high) >> 1;
|
|
76940
|
+
const st = startTimes[mid];
|
|
76941
|
+
const et = endTimes[mid];
|
|
76942
|
+
if (time < st) {
|
|
76943
|
+
high = mid - 1;
|
|
76944
|
+
}
|
|
76945
|
+
else if (time > et) {
|
|
76946
|
+
low = mid + 1;
|
|
76947
|
+
}
|
|
76948
|
+
else {
|
|
76949
|
+
const duration = Math.max(1, et - st + 1);
|
|
76950
|
+
const offset = (time - st) / duration;
|
|
76951
|
+
return (xPrefix[mid] ?? 0) + (widths[mid] ?? 0) * offset;
|
|
76952
|
+
}
|
|
76953
|
+
}
|
|
76954
|
+
const idx = Math.max(0, Math.min(lastIndex, high));
|
|
76955
|
+
const st = startTimes[idx];
|
|
76956
|
+
const et = endTimes[idx];
|
|
76957
|
+
const duration = Math.max(1, et - st + 1);
|
|
76958
|
+
const offset = Math.max(0, Math.min(1, (time - st) / duration));
|
|
76959
|
+
return (xPrefix[idx] ?? 0) + (widths[idx] ?? 0) * offset;
|
|
76960
|
+
}
|
|
76961
|
+
getDateIndexByTime(time) {
|
|
76962
|
+
const startTimes = this._timelineColStartTimes;
|
|
76963
|
+
const endTimes = this._timelineColEndTimes;
|
|
76964
|
+
if (!startTimes?.length || !endTimes?.length) {
|
|
76965
|
+
return 0;
|
|
76966
|
+
}
|
|
76967
|
+
if (time <= startTimes[0]) {
|
|
76968
|
+
return 0;
|
|
76969
|
+
}
|
|
76970
|
+
const lastIndex = endTimes.length - 1;
|
|
76971
|
+
if (time > endTimes[lastIndex]) {
|
|
76972
|
+
return lastIndex;
|
|
76973
|
+
}
|
|
76974
|
+
let low = 0;
|
|
76975
|
+
let high = lastIndex;
|
|
76976
|
+
while (low <= high) {
|
|
76977
|
+
const mid = (low + high) >> 1;
|
|
76978
|
+
const st = startTimes[mid];
|
|
76979
|
+
const et = endTimes[mid];
|
|
76980
|
+
if (time < st) {
|
|
76981
|
+
high = mid - 1;
|
|
76982
|
+
}
|
|
76983
|
+
else if (time > et) {
|
|
76984
|
+
low = mid + 1;
|
|
76985
|
+
}
|
|
76986
|
+
else {
|
|
76987
|
+
return mid;
|
|
76988
|
+
}
|
|
76989
|
+
}
|
|
76990
|
+
return Math.max(0, Math.min(lastIndex, high));
|
|
76991
|
+
}
|
|
76992
|
+
getDateIndexByX(x) {
|
|
76993
|
+
const totalX = x + this.stateManager.scroll.horizontalBarPos;
|
|
76994
|
+
const xPrefix = this._timelineColX;
|
|
76995
|
+
if (!xPrefix?.length) {
|
|
76996
|
+
return 0;
|
|
76997
|
+
}
|
|
76998
|
+
if (totalX <= 0) {
|
|
76999
|
+
return 0;
|
|
77000
|
+
}
|
|
77001
|
+
const lastIndex = xPrefix.length - 2;
|
|
77002
|
+
const totalWidth = xPrefix[lastIndex + 1] ?? 0;
|
|
77003
|
+
if (totalX >= totalWidth) {
|
|
77004
|
+
return Math.max(0, lastIndex);
|
|
77005
|
+
}
|
|
77006
|
+
let low = 0;
|
|
77007
|
+
let high = lastIndex;
|
|
77008
|
+
while (low <= high) {
|
|
77009
|
+
const mid = (low + high) >> 1;
|
|
77010
|
+
const left = xPrefix[mid] ?? 0;
|
|
77011
|
+
const right = xPrefix[mid + 1] ?? left;
|
|
77012
|
+
if (totalX < left) {
|
|
77013
|
+
high = mid - 1;
|
|
77014
|
+
}
|
|
77015
|
+
else if (totalX >= right) {
|
|
77016
|
+
low = mid + 1;
|
|
77017
|
+
}
|
|
77018
|
+
else {
|
|
77019
|
+
return mid;
|
|
77020
|
+
}
|
|
77021
|
+
}
|
|
77022
|
+
return Math.max(0, Math.min(lastIndex, low));
|
|
76575
77023
|
}
|
|
76576
77024
|
getRowHeightByIndex(index) {
|
|
76577
77025
|
if (this.taskListTableInstance) {
|
|
@@ -76600,6 +77048,10 @@
|
|
|
76600
77048
|
}, 0);
|
|
76601
77049
|
}
|
|
76602
77050
|
getAllDateColsWidth() {
|
|
77051
|
+
const xPrefix = this._timelineColX;
|
|
77052
|
+
if (xPrefix?.length) {
|
|
77053
|
+
return xPrefix[xPrefix.length - 1] ?? 0;
|
|
77054
|
+
}
|
|
76603
77055
|
return (this.parsedOptions.timelineColWidth *
|
|
76604
77056
|
(this.parsedOptions.reverseSortedTimelineScales[0].timelineDates?.length ?? 0));
|
|
76605
77057
|
}
|
|
@@ -77001,10 +77453,7 @@
|
|
|
77001
77453
|
}
|
|
77002
77454
|
_scrollToMarkLine() {
|
|
77003
77455
|
if (this.parsedOptions.scrollToMarkLineDate && this.parsedOptions.minDate) {
|
|
77004
|
-
const
|
|
77005
|
-
const { unit, step } = this.parsedOptions.reverseSortedTimelineScales[0];
|
|
77006
|
-
const count = computeCountToTimeScale(this.parsedOptions.scrollToMarkLineDate, minDate, unit, step);
|
|
77007
|
-
const targetDayDistance = count * this.parsedOptions.timelineColWidth;
|
|
77456
|
+
const targetDayDistance = this.getXByTime(this.parsedOptions.scrollToMarkLineDate.getTime());
|
|
77008
77457
|
const left = targetDayDistance - this.tableNoFrameWidth / 2;
|
|
77009
77458
|
this.stateManager.setScrollLeft(left);
|
|
77010
77459
|
}
|
|
@@ -77013,10 +77462,7 @@
|
|
|
77013
77462
|
if (!date || !this.parsedOptions.minDate) {
|
|
77014
77463
|
return;
|
|
77015
77464
|
}
|
|
77016
|
-
const
|
|
77017
|
-
const { unit, step } = this.parsedOptions.reverseSortedTimelineScales[0];
|
|
77018
|
-
const count = computeCountToTimeScale(date, minDate, unit, step);
|
|
77019
|
-
const targetDayDistance = count * this.parsedOptions.timelineColWidth;
|
|
77465
|
+
const targetDayDistance = this.getXByTime(date.getTime());
|
|
77020
77466
|
const left = targetDayDistance - this.tableNoFrameWidth / 2;
|
|
77021
77467
|
this.stateManager.setScrollLeft(left);
|
|
77022
77468
|
}
|
|
@@ -77068,9 +77514,22 @@
|
|
|
77068
77514
|
};
|
|
77069
77515
|
}
|
|
77070
77516
|
getDateColWidth(dateIndex) {
|
|
77517
|
+
const widths = this._timelineColWidths;
|
|
77518
|
+
if (widths?.length && dateIndex >= 0 && dateIndex < widths.length) {
|
|
77519
|
+
return widths[dateIndex] ?? 0;
|
|
77520
|
+
}
|
|
77071
77521
|
return this.parsedOptions.timelineColWidth;
|
|
77072
77522
|
}
|
|
77073
77523
|
getDateColsWidth(startDateIndex, endDateIndex) {
|
|
77524
|
+
const xPrefix = this._timelineColX;
|
|
77525
|
+
if (xPrefix?.length) {
|
|
77526
|
+
const start = Math.max(0, Math.min(startDateIndex, xPrefix.length - 1));
|
|
77527
|
+
const end = Math.max(0, Math.min(endDateIndex + 1, xPrefix.length - 1));
|
|
77528
|
+
if (end <= start) {
|
|
77529
|
+
return 0;
|
|
77530
|
+
}
|
|
77531
|
+
return (xPrefix[end] ?? 0) - (xPrefix[start] ?? 0);
|
|
77532
|
+
}
|
|
77074
77533
|
return (endDateIndex - startDateIndex + 1) * this.parsedOptions.timelineColWidth;
|
|
77075
77534
|
}
|
|
77076
77535
|
getDateRangeByIndex(index) {
|
|
@@ -77192,7 +77651,7 @@
|
|
|
77192
77651
|
PluginManager: PluginManager
|
|
77193
77652
|
});
|
|
77194
77653
|
|
|
77195
|
-
const version = "1.
|
|
77654
|
+
const version = "1.24.0-alpha.0";
|
|
77196
77655
|
|
|
77197
77656
|
exports.Gantt = Gantt;
|
|
77198
77657
|
exports.TYPES = index$4;
|