@visactor/vtable-gantt 1.26.0 → 1.26.1-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/components/Menu.js +2 -0
- package/cjs/event/touch.js +1 -0
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/plugins/interface.js +1 -2
- package/cjs/state/gantt-table-sync.js +1 -0
- package/dist/vtable-gantt.js +80 -28
- package/dist/vtable-gantt.min.js +1 -1
- package/es/components/Menu.js +2 -0
- package/es/event/touch.js +2 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/plugins/interface.js +1 -2
- package/es/state/gantt-table-sync.js +2 -1
- package/package.json +8 -7
package/cjs/components/Menu.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.26.0";
|
|
9
|
+
export declare const version = "1.26.1-alpha.0";
|
|
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,
|
|
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,gBAAgB,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.26.1-alpha.0\";\n/**\n * @namespace VTableGantt\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/cjs/plugins/interface.js
CHANGED
|
@@ -89,6 +89,7 @@ function _syncTableSize(gantt) {
|
|
|
89
89
|
gantt._updateSize(), (0, gantt_helper_1.updateSplitLineAndResizeLine)(gantt), gantt.zoomScaleManager && gantt.zoomScaleManager.handleTableWidthChange());
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
//# sourceMappingURL=gantt-table-sync.js.map
|
|
92
93
|
exports.syncScrollStateToTable = syncScrollStateToTable, exports.syncScrollStateFromTable = syncScrollStateFromTable,
|
|
93
94
|
exports.syncEditCellFromTable = syncEditCellFromTable, exports.syncTreeChangeFromTable = syncTreeChangeFromTable,
|
|
94
95
|
exports.syncSortFromTable = syncSortFromTable, exports.syncDragOrderFromTable = syncDragOrderFromTable,
|
package/dist/vtable-gantt.js
CHANGED
|
@@ -1847,6 +1847,20 @@
|
|
|
1847
1847
|
function crossProduct(dir1, dir2) {
|
|
1848
1848
|
return dir1[0] * dir2[1] - dir1[1] * dir2[0];
|
|
1849
1849
|
}
|
|
1850
|
+
function fixPrecision$1(num, precision = 10) {
|
|
1851
|
+
return Math.round(num * precision) / precision;
|
|
1852
|
+
}
|
|
1853
|
+
function getDecimalPlaces(n) {
|
|
1854
|
+
const dStr = n.toString().split(/[eE]/),
|
|
1855
|
+
s = (dStr[0].split(".")[1] || "").length - (+dStr[1] || 0);
|
|
1856
|
+
return s > 0 ? s : 0;
|
|
1857
|
+
}
|
|
1858
|
+
function precisionAdd(a, b) {
|
|
1859
|
+
return fixPrecision$1(a + b, 10 ** Math.max(getDecimalPlaces(a), getDecimalPlaces(b)));
|
|
1860
|
+
}
|
|
1861
|
+
function precisionSub(a, b) {
|
|
1862
|
+
return fixPrecision$1(a - b, 10 ** Math.max(getDecimalPlaces(a), getDecimalPlaces(b)));
|
|
1863
|
+
}
|
|
1850
1864
|
|
|
1851
1865
|
class Point {
|
|
1852
1866
|
constructor(x = 0, y = 0, x1, y1) {
|
|
@@ -37505,42 +37519,54 @@
|
|
|
37505
37519
|
if (record) if (this.isRecord && this.records && (record.isAggregator ? this.records.push(...record.records) : this.records.push(record)), record.isAggregator && this.children) {
|
|
37506
37520
|
this.children.push(record);
|
|
37507
37521
|
const value = record.value();
|
|
37508
|
-
this.sum
|
|
37522
|
+
this.sum = precisionAdd(this.sum, null != value ? value : 0), this.needSplitPositiveAndNegativeForSum && (value > 0 ? this.positiveSum = precisionAdd(this.positiveSum, value) : value < 0 && (this.nagetiveSum = precisionAdd(this.nagetiveSum, value)));
|
|
37509
37523
|
} else if (this.field && !isNaN(parseFloat(record[this.field]))) {
|
|
37510
37524
|
const value = parseFloat(record[this.field]);
|
|
37511
|
-
this.sum
|
|
37525
|
+
this.sum = precisionAdd(this.sum, value), this.needSplitPositiveAndNegativeForSum && (value > 0 ? this.positiveSum = precisionAdd(this.positiveSum, value) : value < 0 && (this.nagetiveSum = precisionAdd(this.nagetiveSum, value)));
|
|
37512
37526
|
}
|
|
37513
37527
|
this.clearCacheValue();
|
|
37514
37528
|
}
|
|
37515
37529
|
deleteRecord(record) {
|
|
37516
|
-
if (record)
|
|
37517
|
-
this.
|
|
37518
|
-
|
|
37519
|
-
|
|
37520
|
-
|
|
37521
|
-
|
|
37522
|
-
|
|
37530
|
+
if (record) {
|
|
37531
|
+
if (this.isRecord && this.records) {
|
|
37532
|
+
const index = this.records.indexOf(record);
|
|
37533
|
+
-1 !== index && this.records.splice(index, 1);
|
|
37534
|
+
}
|
|
37535
|
+
if (record.isAggregator && this.children) {
|
|
37536
|
+
const index = this.children.indexOf(record);
|
|
37537
|
+
-1 !== index && this.children.splice(index, 1);
|
|
37538
|
+
const value = record.value();
|
|
37539
|
+
this.sum = precisionSub(this.sum, null != value ? value : 0), this.needSplitPositiveAndNegativeForSum && (value > 0 ? this.positiveSum = precisionSub(this.positiveSum, value) : value < 0 && (this.nagetiveSum = precisionSub(this.nagetiveSum, value)));
|
|
37540
|
+
} else if (this.field && !isNaN(parseFloat(record[this.field]))) {
|
|
37541
|
+
const value = parseFloat(record[this.field]);
|
|
37542
|
+
this.sum = precisionSub(this.sum, value), this.needSplitPositiveAndNegativeForSum && (value > 0 ? this.positiveSum = precisionSub(this.positiveSum, value) : value < 0 && (this.nagetiveSum = precisionSub(this.nagetiveSum, value)));
|
|
37543
|
+
}
|
|
37523
37544
|
}
|
|
37524
37545
|
this.clearCacheValue();
|
|
37525
37546
|
}
|
|
37526
37547
|
updateRecord(oldRecord, newRecord) {
|
|
37527
37548
|
if (oldRecord && newRecord) {
|
|
37528
|
-
if (this.isRecord && this.records
|
|
37529
|
-
const
|
|
37530
|
-
|
|
37549
|
+
if (this.isRecord && this.records) {
|
|
37550
|
+
const index = this.records.indexOf(oldRecord);
|
|
37551
|
+
-1 !== index && (this.records[index] = newRecord);
|
|
37552
|
+
}
|
|
37553
|
+
if (oldRecord.isAggregator && this.children) {
|
|
37554
|
+
const oldValue = oldRecord.value(),
|
|
37555
|
+
index = this.children.indexOf(oldRecord);
|
|
37556
|
+
-1 !== index && (this.children[index] = newRecord);
|
|
37531
37557
|
const newValue = newRecord.value();
|
|
37532
|
-
this.
|
|
37558
|
+
this.sum = precisionAdd(this.sum, precisionSub(newValue, oldValue)), this.needSplitPositiveAndNegativeForSum && (oldValue > 0 ? this.positiveSum = precisionSub(this.positiveSum, oldValue) : oldValue < 0 && (this.nagetiveSum = precisionSub(this.nagetiveSum, oldValue)), newValue > 0 ? this.positiveSum = precisionAdd(this.positiveSum, newValue) : newValue < 0 && (this.nagetiveSum = precisionAdd(this.nagetiveSum, newValue)));
|
|
37533
37559
|
} else if (this.field && !isNaN(parseFloat(oldRecord[this.field]))) {
|
|
37534
37560
|
const oldValue = parseFloat(oldRecord[this.field]),
|
|
37535
37561
|
newValue = parseFloat(newRecord[this.field]);
|
|
37536
|
-
this.sum
|
|
37562
|
+
this.sum = precisionAdd(this.sum, precisionSub(newValue, oldValue)), this.needSplitPositiveAndNegativeForSum && (oldValue > 0 ? this.positiveSum = precisionSub(this.positiveSum, oldValue) : oldValue < 0 && (this.nagetiveSum = precisionSub(this.nagetiveSum, oldValue)), newValue > 0 ? this.positiveSum = precisionAdd(this.positiveSum, newValue) : newValue < 0 && (this.nagetiveSum = precisionAdd(this.nagetiveSum, newValue)));
|
|
37537
37563
|
}
|
|
37538
37564
|
this.clearCacheValue();
|
|
37539
37565
|
}
|
|
37540
37566
|
}
|
|
37541
37567
|
value() {
|
|
37542
|
-
var _a
|
|
37543
|
-
return null !== (_a = this.changedValue) && void 0 !== _a ? _a :
|
|
37568
|
+
var _a;
|
|
37569
|
+
return null !== (_a = this.changedValue) && void 0 !== _a ? _a : this.records && this.records.length >= 1 || !1 === this.isRecord ? this.sum : void 0;
|
|
37544
37570
|
}
|
|
37545
37571
|
positiveValue() {
|
|
37546
37572
|
return this.positiveSum;
|
|
@@ -37556,16 +37582,16 @@
|
|
|
37556
37582
|
const child = this.children[i];
|
|
37557
37583
|
if (child.isAggregator) {
|
|
37558
37584
|
const value = child.value();
|
|
37559
|
-
this.sum
|
|
37585
|
+
this.sum = precisionAdd(this.sum, null != value ? value : 0), this.needSplitPositiveAndNegativeForSum && (value > 0 ? this.positiveSum = precisionAdd(this.positiveSum, value) : value < 0 && (this.nagetiveSum = precisionAdd(this.nagetiveSum, value)));
|
|
37560
37586
|
}
|
|
37561
37587
|
} else if (this.records) for (let i = 0; i < this.records.length; i++) {
|
|
37562
37588
|
const record = this.records[i];
|
|
37563
37589
|
if (record.isAggregator) {
|
|
37564
37590
|
const value = record.value();
|
|
37565
|
-
this.sum
|
|
37591
|
+
this.sum = precisionAdd(this.sum, null != value ? value : 0), this.needSplitPositiveAndNegativeForSum && (value > 0 ? this.positiveSum = precisionAdd(this.positiveSum, value) : value < 0 && (this.nagetiveSum = precisionAdd(this.nagetiveSum, value)));
|
|
37566
37592
|
} else if (this.field && !isNaN(parseFloat(record[this.field]))) {
|
|
37567
37593
|
const value = parseFloat(record[this.field]);
|
|
37568
|
-
this.sum
|
|
37594
|
+
this.sum = precisionAdd(this.sum, value), this.needSplitPositiveAndNegativeForSum && (value > 0 ? this.positiveSum = precisionAdd(this.positiveSum, value) : value < 0 && (this.nagetiveSum = precisionAdd(this.nagetiveSum, value)));
|
|
37569
37595
|
}
|
|
37570
37596
|
}
|
|
37571
37597
|
}
|
|
@@ -37608,17 +37634,43 @@
|
|
|
37608
37634
|
super(...arguments), this.type = AggregationType.AVG, this.sum = 0, this.count = 0;
|
|
37609
37635
|
}
|
|
37610
37636
|
push(record) {
|
|
37611
|
-
record && (this.isRecord && this.records && (record.isAggregator ? this.records.push(...record.records) : this.records.push(record)), record.isAggregator && record.type === AggregationType.AVG ? (this.children && this.children.push(record), this.sum
|
|
37637
|
+
record && (this.isRecord && this.records && (record.isAggregator ? this.records.push(...record.records) : this.records.push(record)), record.isAggregator && record.type === AggregationType.AVG ? (this.children && this.children.push(record), this.sum = precisionAdd(this.sum, record.sum), this.count += record.count) : this.field && !isNaN(parseFloat(record[this.field])) && (this.sum = precisionAdd(this.sum, parseFloat(record[this.field])), this.count++)), this.clearCacheValue();
|
|
37612
37638
|
}
|
|
37613
37639
|
deleteRecord(record) {
|
|
37614
|
-
|
|
37640
|
+
if (record) {
|
|
37641
|
+
if (this.isRecord && this.records) {
|
|
37642
|
+
const index = this.records.indexOf(record);
|
|
37643
|
+
-1 !== index && this.records.splice(index, 1);
|
|
37644
|
+
}
|
|
37645
|
+
if (record.isAggregator && record.type === AggregationType.AVG) {
|
|
37646
|
+
if (this.children) {
|
|
37647
|
+
const index = this.children.indexOf(record);
|
|
37648
|
+
-1 !== index && this.children.splice(index, 1);
|
|
37649
|
+
}
|
|
37650
|
+
this.sum = precisionSub(this.sum, record.sum), this.count -= record.count;
|
|
37651
|
+
} else this.field && !isNaN(parseFloat(record[this.field])) && (this.sum = precisionSub(this.sum, parseFloat(record[this.field])), this.count--);
|
|
37652
|
+
}
|
|
37653
|
+
this.clearCacheValue();
|
|
37615
37654
|
}
|
|
37616
37655
|
updateRecord(oldRecord, newRecord) {
|
|
37617
|
-
|
|
37656
|
+
if (oldRecord && newRecord) {
|
|
37657
|
+
if (this.isRecord && this.records) {
|
|
37658
|
+
const index = this.records.indexOf(oldRecord);
|
|
37659
|
+
-1 !== index && (this.records[index] = newRecord);
|
|
37660
|
+
}
|
|
37661
|
+
if (oldRecord.isAggregator && oldRecord.type === AggregationType.AVG) {
|
|
37662
|
+
if (this.children && newRecord.isAggregator) {
|
|
37663
|
+
const index = this.children.indexOf(oldRecord);
|
|
37664
|
+
-1 !== index && (this.children[index] = newRecord);
|
|
37665
|
+
}
|
|
37666
|
+
this.sum = precisionAdd(this.sum, precisionSub(newRecord.sum, oldRecord.sum)), this.count += newRecord.count - oldRecord.count;
|
|
37667
|
+
} else this.field && !isNaN(parseFloat(oldRecord[this.field])) && (this.sum = precisionAdd(this.sum, precisionSub(parseFloat(newRecord[this.field]), parseFloat(oldRecord[this.field]))));
|
|
37668
|
+
this.clearCacheValue();
|
|
37669
|
+
}
|
|
37618
37670
|
}
|
|
37619
37671
|
value() {
|
|
37620
|
-
var _a
|
|
37621
|
-
return null !== (_a = this.changedValue) && void 0 !== _a ? _a :
|
|
37672
|
+
var _a;
|
|
37673
|
+
return null !== (_a = this.changedValue) && void 0 !== _a ? _a : this.records && this.records.length >= 1 || !1 === this.isRecord && this.count > 0 ? this.sum / this.count : void 0;
|
|
37622
37674
|
}
|
|
37623
37675
|
reset() {
|
|
37624
37676
|
this.changedValue = void 0, this.children = [], this.records = [], this.sum = 0, this.count = 0;
|
|
@@ -37628,11 +37680,11 @@
|
|
|
37628
37680
|
const child = this.children[i];
|
|
37629
37681
|
if (child.isAggregator && child.type === AggregationType.AVG) {
|
|
37630
37682
|
const childValue = child.value();
|
|
37631
|
-
this.sum
|
|
37683
|
+
this.sum = precisionAdd(this.sum, childValue * child.count), this.count += child.count;
|
|
37632
37684
|
}
|
|
37633
37685
|
} else if (this.records) for (let i = 0; i < this.records.length; i++) {
|
|
37634
37686
|
const record = this.records[i];
|
|
37635
|
-
record.isAggregator && record.type === AggregationType.AVG ? (this.sum
|
|
37687
|
+
record.isAggregator && record.type === AggregationType.AVG ? (this.sum = precisionAdd(this.sum, record.sum), this.count += record.count) : this.field && !isNaN(parseFloat(record[this.field])) && (this.sum = precisionAdd(this.sum, parseFloat(record[this.field])), this.count++);
|
|
37636
37688
|
}
|
|
37637
37689
|
}
|
|
37638
37690
|
}
|
|
@@ -60986,7 +61038,7 @@
|
|
|
60986
61038
|
}
|
|
60987
61039
|
constructor(container, options = {}) {
|
|
60988
61040
|
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;
|
|
60989
|
-
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.26.0", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "undefined" != typeof window) {
|
|
61041
|
+
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.26.1-alpha.0", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "undefined" != typeof window) {
|
|
60990
61042
|
const g = window;
|
|
60991
61043
|
g[this.id] = this;
|
|
60992
61044
|
const registry = g.__vtable__ || (g.__vtable__ = {
|
|
@@ -78481,7 +78533,7 @@
|
|
|
78481
78533
|
PluginManager: PluginManager
|
|
78482
78534
|
});
|
|
78483
78535
|
|
|
78484
|
-
const version = "1.26.0";
|
|
78536
|
+
const version = "1.26.1-alpha.0";
|
|
78485
78537
|
|
|
78486
78538
|
exports.Gantt = Gantt;
|
|
78487
78539
|
exports.TYPES = index$4;
|