@visactor/vtable-gantt 1.18.5 → 1.18.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/data/DataSource.js +2 -1
- package/cjs/event/touch.js +0 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/dist/vtable-gantt.js +76 -50
- package/dist/vtable-gantt.min.js +2 -2
- package/es/data/DataSource.js +2 -1
- package/es/event/touch.js +1 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/package.json +5 -5
package/cjs/data/DataSource.js
CHANGED
package/cjs/event/touch.js
CHANGED
package/cjs/index.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ import * as tools from './tools';
|
|
|
6
6
|
import * as VRender from './vrender';
|
|
7
7
|
import * as VTable from './vtable';
|
|
8
8
|
import * as plugins from './plugins';
|
|
9
|
-
export declare const version = "1.18.
|
|
9
|
+
export declare const version = "1.18.6";
|
|
10
10
|
export { TYPES, GanttConstructorOptions, Gantt, ColumnsDefine, ColumnDefine, LinkColumnDefine, ChartColumnDefine, ImageColumnDefine, SparklineColumnDefine, ProgressbarColumnDefine, TextColumnDefine, GroupColumnDefine, TextAlignType, TextBaselineType, tools, VRender, VTable, plugins };
|
package/cjs/index.js
CHANGED
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAAoC;AAwBlC,sBAAK;AAVP,mCAAgC;AAY9B,sFAZO,aAAK,OAYP;AAXP,+CAAiC;AAuB/B,sBAAK;AAtBP,mDAAqC;AAuBnC,0BAAO;AAtBT,iDAAmC;AAuBjC,wBAAM;AAtBR,mDAAqC;AAuBnC,0BAAO;AAtBI,QAAA,OAAO,GAAG,QAAQ,CAAC","file":"index.js","sourcesContent":["import type { GanttConstructorOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType\n} from '@visactor/vtable';\nimport { Gantt } from './Gantt';\nimport * as tools from './tools';\nimport * as VRender from './vrender';\nimport * as VTable from './vtable';\nimport * as plugins from './plugins';\nexport const version = \"1.18.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAAoC;AAwBlC,sBAAK;AAVP,mCAAgC;AAY9B,sFAZO,aAAK,OAYP;AAXP,+CAAiC;AAuB/B,sBAAK;AAtBP,mDAAqC;AAuBnC,0BAAO;AAtBT,iDAAmC;AAuBjC,wBAAM;AAtBR,mDAAqC;AAuBnC,0BAAO;AAtBI,QAAA,OAAO,GAAG,QAAQ,CAAC","file":"index.js","sourcesContent":["import type { GanttConstructorOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType\n} from '@visactor/vtable';\nimport { Gantt } from './Gantt';\nimport * as tools from './tools';\nimport * as VRender from './vrender';\nimport * as VTable from './vtable';\nimport * as plugins from './plugins';\nexport const version = \"1.18.6\";\n/**\n * @namespace VTable\n */\nexport {\n TYPES,\n GanttConstructorOptions,\n Gantt,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n tools,\n VRender,\n VTable,\n plugins\n};\n"]}
|
package/dist/vtable-gantt.js
CHANGED
|
@@ -18409,6 +18409,18 @@
|
|
|
18409
18409
|
const changeEvent = new CustomEvent(eventName, details);
|
|
18410
18410
|
changeEvent.manager = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventSystem.manager, this.dispatchEvent(changeEvent);
|
|
18411
18411
|
}
|
|
18412
|
+
eventPosToStagePos(e) {
|
|
18413
|
+
var _a, _b;
|
|
18414
|
+
const result = {
|
|
18415
|
+
x: 0,
|
|
18416
|
+
y: 0
|
|
18417
|
+
},
|
|
18418
|
+
stagePoints = null !== (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventPointTransform(e)) && void 0 !== _b ? _b : {
|
|
18419
|
+
x: 0,
|
|
18420
|
+
y: 0
|
|
18421
|
+
};
|
|
18422
|
+
return this.globalTransMatrix.transformPoint(stagePoints, result), result;
|
|
18423
|
+
}
|
|
18412
18424
|
}
|
|
18413
18425
|
|
|
18414
18426
|
const MathPickerContribution = Symbol.for("MathPickerContribution");
|
|
@@ -24121,7 +24133,7 @@
|
|
|
24121
24133
|
const MIN_TICK_GAP = 12;
|
|
24122
24134
|
const calculateFlushPos = (basePosition, size, rangePosition, otherEnd) => rangePosition < basePosition ? Math.max(basePosition - size / 2, rangePosition) : rangePosition > basePosition ? Math.min(basePosition - size / 2, rangePosition - size) : rangePosition < otherEnd ? rangePosition : rangePosition - size;
|
|
24123
24135
|
const getCartesianLabelBounds = (scale, domain, op) => {
|
|
24124
|
-
var _a;
|
|
24136
|
+
var _a, _b, _c;
|
|
24125
24137
|
const {
|
|
24126
24138
|
labelStyle: labelStyle,
|
|
24127
24139
|
axisOrientType: axisOrientType,
|
|
@@ -24137,27 +24149,32 @@
|
|
|
24137
24149
|
scaleY = 0;
|
|
24138
24150
|
isHorizontal || (isVertical ? (scaleX = 0, scaleY = 1) : startAngle && (scaleX = Math.cos(startAngle), scaleY = -Math.sin(startAngle)));
|
|
24139
24151
|
const textMeasure = initTextMeasure(labelStyle),
|
|
24140
|
-
range = scale.range()
|
|
24141
|
-
|
|
24142
|
-
|
|
24143
|
-
|
|
24144
|
-
|
|
24145
|
-
|
|
24146
|
-
|
|
24147
|
-
|
|
24148
|
-
|
|
24149
|
-
|
|
24150
|
-
|
|
24151
|
-
|
|
24152
|
-
|
|
24153
|
-
|
|
24154
|
-
|
|
24155
|
-
|
|
24156
|
-
|
|
24157
|
-
|
|
24158
|
-
|
|
24159
|
-
|
|
24160
|
-
|
|
24152
|
+
range = scale.range();
|
|
24153
|
+
let labelBoundsList = [];
|
|
24154
|
+
for (let i = 0; i < domain.length; i++) {
|
|
24155
|
+
const v = domain[i],
|
|
24156
|
+
str = labelFormatter ? labelFormatter(v) : `${v}`;
|
|
24157
|
+
if (isPlainObject$5(str)) {
|
|
24158
|
+
labelBoundsList = void 0;
|
|
24159
|
+
break;
|
|
24160
|
+
}
|
|
24161
|
+
const {
|
|
24162
|
+
width: width,
|
|
24163
|
+
height: height
|
|
24164
|
+
} = textMeasure.quickMeasure(str),
|
|
24165
|
+
textWidth = Math.max(width, 12),
|
|
24166
|
+
textHeight = Math.max(height, 12),
|
|
24167
|
+
pos = scale.scale(v),
|
|
24168
|
+
baseTextX = scaleX * pos,
|
|
24169
|
+
baseTextY = scaleY * pos;
|
|
24170
|
+
let align,
|
|
24171
|
+
baseline,
|
|
24172
|
+
textX = baseTextX,
|
|
24173
|
+
textY = baseTextY;
|
|
24174
|
+
labelFlush && isHorizontal && 0 === i ? textX = calculateFlushPos(baseTextX, textWidth, range[0], range[range.length - 1]) : labelFlush && isHorizontal && i === domain.length - 1 ? textX = calculateFlushPos(baseTextX, textWidth, range[range.length - 1], range[0]) : align = null !== (_b = labelStyle.textAlign) && void 0 !== _b ? _b : "center", "right" === align ? textX -= textWidth : "center" === align && (textX -= textWidth / 2), labelFlush && isVertical && 0 === i ? textY = calculateFlushPos(baseTextY, textHeight, range[0], range[range.length - 1]) : labelFlush && isVertical && i === domain.length - 1 ? textY = calculateFlushPos(baseTextY, textHeight, range[range.length - 1], range[0]) : baseline = null !== (_c = labelStyle.textBaseline) && void 0 !== _c ? _c : "middle", "bottom" === baseline ? textY -= textHeight : "middle" === baseline && (textY -= textHeight / 2);
|
|
24175
|
+
const bounds = new AABBBounds$1().set(textX, textY, textX + textWidth, textY + textHeight);
|
|
24176
|
+
labelAngle && bounds.rotate(labelAngle, baseTextX, baseTextY), labelBoundsList.push(bounds);
|
|
24177
|
+
}
|
|
24161
24178
|
return labelBoundsList;
|
|
24162
24179
|
};
|
|
24163
24180
|
const isAxisHorizontal = axisOrientType => ["bottom", "top", "z"].includes(axisOrientType);
|
|
@@ -24668,7 +24685,7 @@
|
|
|
24668
24685
|
}
|
|
24669
24686
|
}
|
|
24670
24687
|
const continuousTicks = (scale, op) => {
|
|
24671
|
-
var _a, _b;
|
|
24688
|
+
var _a, _b, _c, _d;
|
|
24672
24689
|
if (!isContinuous(scale.type)) return convertDomainToTickData(scale.domain());
|
|
24673
24690
|
const range = scale.range(),
|
|
24674
24691
|
rangeSize = Math.abs(range[range.length - 1] - range[0]);
|
|
@@ -24720,23 +24737,25 @@
|
|
|
24720
24737
|
step = Math.floor(scaleTicks.length * MIN_FONT_SIZE / rangeSize);
|
|
24721
24738
|
scaleTicks.forEach((tick, index) => {
|
|
24722
24739
|
index % step != 0 && index !== scaleTicks.length - 1 || samplingScaleTicks.push(tick);
|
|
24723
|
-
}), items = getCartesianLabelBounds(scale, samplingScaleTicks, op).map((bounds, i) => ({
|
|
24740
|
+
}), items = null === (_c = getCartesianLabelBounds(scale, samplingScaleTicks, op)) || void 0 === _c ? void 0 : _c.map((bounds, i) => ({
|
|
24724
24741
|
AABBBounds: bounds,
|
|
24725
24742
|
value: samplingScaleTicks[i]
|
|
24726
24743
|
}));
|
|
24727
|
-
} else items = getCartesianLabelBounds(scale, scaleTicks, op).map((bounds, i) => ({
|
|
24744
|
+
} else items = null === (_d = getCartesianLabelBounds(scale, scaleTicks, op)) || void 0 === _d ? void 0 : _d.map((bounds, i) => ({
|
|
24728
24745
|
AABBBounds: bounds,
|
|
24729
24746
|
value: scaleTicks[i]
|
|
24730
24747
|
}));
|
|
24731
|
-
|
|
24732
|
-
|
|
24733
|
-
|
|
24734
|
-
|
|
24735
|
-
|
|
24736
|
-
|
|
24737
|
-
|
|
24738
|
-
|
|
24739
|
-
|
|
24748
|
+
if (items) {
|
|
24749
|
+
const firstSourceItem = items[0],
|
|
24750
|
+
lastSourceItem = last$1(items),
|
|
24751
|
+
samplingMethod = breakData && breakData() ? methods.greedy : methods.parity;
|
|
24752
|
+
for (; items.length >= 3 && hasOverlap(items, labelGap);) items = samplingMethod(items, labelGap);
|
|
24753
|
+
const checkFirst = op.labelFirstVisible;
|
|
24754
|
+
let checkLast = op.labelLastVisible;
|
|
24755
|
+
textIntersect(firstSourceItem, lastSourceItem, labelGap) && items.includes(lastSourceItem) && items.length > 1 && checkFirst && checkLast && (items.splice(items.indexOf(lastSourceItem), 1), checkLast = !1), forceItemVisible(firstSourceItem, items, checkFirst, item => textIntersect(item, firstSourceItem, labelGap)), forceItemVisible(lastSourceItem, items, checkLast, item => textIntersect(item, lastSourceItem, labelGap) || !(!checkFirst || item === firstSourceItem) && textIntersect(item, firstSourceItem, labelGap), !0);
|
|
24756
|
+
const ticks = items.map(item => item.value);
|
|
24757
|
+
ticks.length < 3 && labelFlush && (ticks.length > 1 && ticks.pop(), last$1(ticks) !== last$1(scaleTicks) && ticks.push(last$1(scaleTicks))), scaleTicks = ticks;
|
|
24758
|
+
}
|
|
24740
24759
|
}
|
|
24741
24760
|
return convertDomainToTickData(scaleTicks);
|
|
24742
24761
|
};
|
|
@@ -24750,7 +24769,10 @@
|
|
|
24750
24769
|
}
|
|
24751
24770
|
};
|
|
24752
24771
|
|
|
24753
|
-
const getOneDimensionalLabelBounds = (scale, domain, op, isHorizontal) =>
|
|
24772
|
+
const getOneDimensionalLabelBounds = (scale, domain, op, isHorizontal) => {
|
|
24773
|
+
const labelBoundsList = getCartesianLabelBounds(scale, domain, op);
|
|
24774
|
+
return labelBoundsList && labelBoundsList.map(bounds => isHorizontal ? [bounds.x1, bounds.x2, bounds.width()] : [bounds.y1, bounds.y2, bounds.height()]);
|
|
24775
|
+
},
|
|
24754
24776
|
boundsOverlap = function (prevBounds, nextBounds) {
|
|
24755
24777
|
let gap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
24756
24778
|
return Math.max(prevBounds[0], nextBounds[0]) - gap / 2 <= Math.min(prevBounds[1], nextBounds[1]) + gap / 2;
|
|
@@ -24784,23 +24806,27 @@
|
|
|
24784
24806
|
rangeStart = minInArray$1(range),
|
|
24785
24807
|
rangeEnd = maxInArray$1(range);
|
|
24786
24808
|
if (domain.length <= rangeSize / fontSize) {
|
|
24787
|
-
const
|
|
24788
|
-
|
|
24789
|
-
minBoundsLength = Math.min(...labelBoundsList.map(bounds => bounds[2])),
|
|
24790
|
-
|
|
24791
|
-
|
|
24809
|
+
const labelBoundsList = getOneDimensionalLabelBounds(scale, domain, op, isHorizontal);
|
|
24810
|
+
if (labelBoundsList) {
|
|
24811
|
+
const minBoundsLength = Math.min(...labelBoundsList.map(bounds => bounds[2])),
|
|
24812
|
+
incrementUnit = (rangeEnd - rangeStart) / domain.length,
|
|
24813
|
+
stepResult = getStep$1(domain, labelBoundsList, labelGap, op.labelLastVisible, Math.floor(minBoundsLength / incrementUnit), !1);
|
|
24814
|
+
scaleTicks = scale.stepTicks(stepResult.step), op.labelLastVisible && (stepResult.delCount && (scaleTicks = scaleTicks.slice(0, scaleTicks.length - stepResult.delCount)), scaleTicks.push(domain[domain.length - 1]));
|
|
24815
|
+
}
|
|
24792
24816
|
} else {
|
|
24793
24817
|
const tempDomain = [domain[0], domain[Math.floor(domain.length / 2)], domain[domain.length - 1]],
|
|
24794
24818
|
tempList = getOneDimensionalLabelBounds(scale, tempDomain, op, isHorizontal);
|
|
24795
|
-
|
|
24796
|
-
|
|
24797
|
-
|
|
24798
|
-
|
|
24799
|
-
|
|
24800
|
-
|
|
24819
|
+
if (tempList) {
|
|
24820
|
+
let maxBounds = null;
|
|
24821
|
+
tempList.forEach(current => {
|
|
24822
|
+
maxBounds ? maxBounds[2] < current[2] && (maxBounds = current) : maxBounds = current;
|
|
24823
|
+
});
|
|
24824
|
+
const step = rangeEnd - rangeStart - labelGap > 0 ? Math.ceil(domain.length * (labelGap + maxBounds[2]) / (rangeEnd - rangeStart - labelGap)) : domain.length - 1;
|
|
24825
|
+
scaleTicks = scale.stepTicks(step), !op.labelLastVisible || scaleTicks.length && scaleTicks[scaleTicks.length - 1] === domain[domain.length - 1] || (scaleTicks.length && Math.abs(scale.scale(scaleTicks[scaleTicks.length - 1]) - scale.scale(domain[domain.length - 1])) < maxBounds[2] && (scaleTicks = scaleTicks.slice(0, -1)), scaleTicks.push(domain[domain.length - 1]));
|
|
24826
|
+
}
|
|
24801
24827
|
}
|
|
24802
|
-
}
|
|
24803
|
-
return convertDomainToTickData(scaleTicks);
|
|
24828
|
+
}
|
|
24829
|
+
return isNil$5(scaleTicks) && (scaleTicks = scale.domain()), convertDomainToTickData(scaleTicks);
|
|
24804
24830
|
};
|
|
24805
24831
|
const getStep$1 = (domain, labelBoundsList, labelGap, labelLastVisible, defaultStep, areAllBoundsSame) => {
|
|
24806
24832
|
let resultDelCount = 0,
|
|
@@ -52282,7 +52308,7 @@
|
|
|
52282
52308
|
constructor(container) {
|
|
52283
52309
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
52284
52310
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
52285
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.18.
|
|
52311
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.18.6", 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");
|
|
52286
52312
|
this.pluginManager = new PluginManager$1(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
|
|
52287
52313
|
options: options,
|
|
52288
52314
|
container: container
|
|
@@ -68473,7 +68499,7 @@
|
|
|
68473
68499
|
PluginManager: PluginManager
|
|
68474
68500
|
});
|
|
68475
68501
|
|
|
68476
|
-
const version = "1.18.
|
|
68502
|
+
const version = "1.18.6";
|
|
68477
68503
|
|
|
68478
68504
|
exports.Gantt = Gantt;
|
|
68479
68505
|
exports.TYPES = index$4;
|