@visactor/vtable-gantt 1.26.3 → 1.26.4
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/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/dist/vtable-gantt.js +116 -11
- package/dist/vtable-gantt.min.js +1 -1
- 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/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.
|
|
9
|
+
export declare const version = "1.26.4";
|
|
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.26.
|
|
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.26.4\";\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/dist/vtable-gantt.js
CHANGED
|
@@ -45277,7 +45277,7 @@
|
|
|
45277
45277
|
rowEnd = null !== (_k = cellGroup.mergeEndCol) && void 0 !== _k ? _k : cellGroup.row,
|
|
45278
45278
|
leftIconWidth = null !== (_l = cellGroup._cellLeftIconWidth) && void 0 !== _l ? _l : 0,
|
|
45279
45279
|
rightIconWidth = null !== (_m = cellGroup._cellRightIconWidth) && void 0 !== _m ? _m : 0;
|
|
45280
|
-
if (image.keepAspectRatio) {
|
|
45280
|
+
if (image.keepAspectRatio || isDamagePic(image)) {
|
|
45281
45281
|
const {
|
|
45282
45282
|
width: imageWidth,
|
|
45283
45283
|
height: imageHeight
|
|
@@ -61086,7 +61086,7 @@
|
|
|
61086
61086
|
}
|
|
61087
61087
|
constructor(container, options = {}) {
|
|
61088
61088
|
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;
|
|
61089
|
-
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.
|
|
61089
|
+
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.4", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "undefined" != typeof window) {
|
|
61090
61090
|
const g = window;
|
|
61091
61091
|
g[this.id] = this;
|
|
61092
61092
|
const registry = g.__vtable__ || (g.__vtable__ = {
|
|
@@ -69951,8 +69951,66 @@
|
|
|
69951
69951
|
}
|
|
69952
69952
|
|
|
69953
69953
|
const regedIcons = get$2();
|
|
69954
|
+
function releaseVideoResource(video) {
|
|
69955
|
+
try {
|
|
69956
|
+
video.pause();
|
|
69957
|
+
} catch (err) {}
|
|
69958
|
+
video.removeAttribute("src");
|
|
69959
|
+
try {
|
|
69960
|
+
video.load();
|
|
69961
|
+
} catch (err) {}
|
|
69962
|
+
}
|
|
69963
|
+
function getVideoFirstFrameTimeout(table) {
|
|
69964
|
+
var _a;
|
|
69965
|
+
const timeout = null === (_a = table.options.customConfig) || void 0 === _a ? void 0 : _a.videoFirstFrameTimeout;
|
|
69966
|
+
return "number" == typeof timeout && timeout >= 0 ? timeout : 8e3;
|
|
69967
|
+
}
|
|
69968
|
+
function getVideoFirstFrameMaxCanvasSize(table) {
|
|
69969
|
+
var _a;
|
|
69970
|
+
const maxCanvasSize = null === (_a = table.options.customConfig) || void 0 === _a ? void 0 : _a.videoFirstFrameMaxCanvasSize;
|
|
69971
|
+
return "number" == typeof maxCanvasSize && maxCanvasSize > 0 ? maxCanvasSize : 512;
|
|
69972
|
+
}
|
|
69973
|
+
function snapshotVideoFirstFrame(video, image, table) {
|
|
69974
|
+
const displayWidth = image.attribute.width,
|
|
69975
|
+
displayHeight = image.attribute.height;
|
|
69976
|
+
if ("number" != typeof displayWidth || "number" != typeof displayHeight || displayWidth <= 0 || displayHeight <= 0) return !1;
|
|
69977
|
+
const canvas = document.createElement("canvas"),
|
|
69978
|
+
context = canvas.getContext("2d");
|
|
69979
|
+
if (!context) return !1;
|
|
69980
|
+
const dpr = Math.min(("undefined" == typeof window ? 1 : window.devicePixelRatio) || 1, 2),
|
|
69981
|
+
maxSize = getVideoFirstFrameMaxCanvasSize(table),
|
|
69982
|
+
scale = Math.min(dpr, maxSize / Math.max(displayWidth, displayHeight));
|
|
69983
|
+
canvas.width = Math.max(1, Math.ceil(displayWidth * scale)), canvas.height = Math.max(1, Math.ceil(displayHeight * scale)), canvas.style.width = `${displayWidth}px`, canvas.style.height = `${displayHeight}px`;
|
|
69984
|
+
try {
|
|
69985
|
+
return context.drawImage(video, 0, 0, canvas.width, canvas.height), image.setAttributes({
|
|
69986
|
+
image: canvas
|
|
69987
|
+
}), !0;
|
|
69988
|
+
} catch (err) {
|
|
69989
|
+
return !1;
|
|
69990
|
+
}
|
|
69991
|
+
}
|
|
69992
|
+
function getSvgSize(svg) {
|
|
69993
|
+
var _a;
|
|
69994
|
+
const svgTag = null === (_a = svg.match(/<svg\b[^>]*>/i)) || void 0 === _a ? void 0 : _a[0];
|
|
69995
|
+
if (!svgTag) return;
|
|
69996
|
+
const widthMatch = svgTag.match(/\bwidth=["']?([\d.]+)/i),
|
|
69997
|
+
heightMatch = svgTag.match(/\bheight=["']?([\d.]+)/i),
|
|
69998
|
+
width = widthMatch ? Number(widthMatch[1]) : void 0,
|
|
69999
|
+
height = heightMatch ? Number(heightMatch[1]) : void 0;
|
|
70000
|
+
if (width > 0 && height > 0) return {
|
|
70001
|
+
width: width,
|
|
70002
|
+
height: height
|
|
70003
|
+
};
|
|
70004
|
+
const viewBoxMatch = svgTag.match(/\bviewBox=["']\s*[-\d.]+\s+[-\d.]+\s+([\d.]+)\s+([\d.]+)\s*["']/i),
|
|
70005
|
+
viewBoxWidth = viewBoxMatch ? Number(viewBoxMatch[1]) : void 0,
|
|
70006
|
+
viewBoxHeight = viewBoxMatch ? Number(viewBoxMatch[2]) : void 0;
|
|
70007
|
+
return viewBoxWidth > 0 && viewBoxHeight > 0 ? {
|
|
70008
|
+
width: viewBoxWidth,
|
|
70009
|
+
height: viewBoxHeight
|
|
70010
|
+
} : void 0;
|
|
70011
|
+
}
|
|
69954
70012
|
function createVideoCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, height, keepAspectRatio, imageAutoSizing, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, range, isAsync) {
|
|
69955
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
|
|
70013
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
|
|
69956
70014
|
const headerStyle = table._getCellStyle(col, row),
|
|
69957
70015
|
functionalPadding = getFunctionalProp("padding", headerStyle, col, row, table);
|
|
69958
70016
|
(null === (_a = table.options.customConfig) || void 0 === _a ? void 0 : _a.imageMargin) ? padding = getQuadProps(null === (_b = table.options.customConfig) || void 0 === _b ? void 0 : _b.imageMargin) : isValid$1(functionalPadding) && (padding = functionalPadding), (null === (_c = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _c ? void 0 : _c.textAlign) && (textAlign = null === (_d = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _d ? void 0 : _d.textAlign), (null === (_e = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _e ? void 0 : _e.textBaseline) && (textBaseline = null === (_f = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _f ? void 0 : _f.textBaseline);
|
|
@@ -70010,7 +70068,55 @@
|
|
|
70010
70068
|
}
|
|
70011
70069
|
const value = table.getCellValue(col, row),
|
|
70012
70070
|
video = document.createElement("video");
|
|
70071
|
+
video.muted = !0, video.playsInline = !0;
|
|
70072
|
+
const shouldSnapshot = !0 === (null === (_6 = table.options.customConfig) || void 0 === _6 ? void 0 : _6.videoFirstFrameSnapshot);
|
|
70073
|
+
let loadTimer,
|
|
70074
|
+
videoReleased = !1;
|
|
70075
|
+
const clearVideoLoadTimer = () => {
|
|
70076
|
+
void 0 !== loadTimer && (clearTimeout(loadTimer), loadTimer = void 0);
|
|
70077
|
+
},
|
|
70078
|
+
releaseCurrentVideo = () => {
|
|
70079
|
+
videoReleased || (videoReleased = !0, clearVideoLoadTimer(), releaseVideoResource(video));
|
|
70080
|
+
},
|
|
70081
|
+
isCurrentImage = () => cellGroup.getChildByName("image", !0) === image,
|
|
70082
|
+
handleVideoLoadFail = () => {
|
|
70083
|
+
videoReleased || (isCurrentImage() && ((() => {
|
|
70084
|
+
var _a, _b;
|
|
70085
|
+
const regedIcons = get$2(),
|
|
70086
|
+
damageIcon = regedIcons.video_damage_pic || regedIcons.damage_pic,
|
|
70087
|
+
damageImage = damageIcon.svg;
|
|
70088
|
+
image.setAttributes({
|
|
70089
|
+
image: damageImage
|
|
70090
|
+
});
|
|
70091
|
+
const originImage = null === (_b = null === (_a = image.resources) || void 0 === _a ? void 0 : _a.get(damageImage)) || void 0 === _b ? void 0 : _b.data,
|
|
70092
|
+
svgSize = "string" == typeof damageImage ? getSvgSize(damageImage) : void 0,
|
|
70093
|
+
originWidth = (null == originImage ? void 0 : originImage.width) || damageIcon.width || (null == svgSize ? void 0 : svgSize.width) || 24,
|
|
70094
|
+
originHeight = (null == originImage ? void 0 : originImage.height) || damageIcon.height || (null == svgSize ? void 0 : svgSize.height) || 24,
|
|
70095
|
+
{
|
|
70096
|
+
width: cellWidth,
|
|
70097
|
+
height: cellHeight,
|
|
70098
|
+
isMerge: isMerge
|
|
70099
|
+
} = getCellRange$1(cellGroup, table),
|
|
70100
|
+
availableWidth = cellWidth - padding[1] - padding[3],
|
|
70101
|
+
availableHeight = cellHeight - padding[0] - padding[2];
|
|
70102
|
+
if (originWidth > 0 && originHeight > 0 && availableWidth > 0 && availableHeight > 0) {
|
|
70103
|
+
const {
|
|
70104
|
+
width: imageWidth,
|
|
70105
|
+
height: imageHeight
|
|
70106
|
+
} = calcKeepAspectRatioSize(originWidth, originHeight, availableWidth, availableHeight),
|
|
70107
|
+
pos = calcStartPosition(0, 0, cellWidth, cellHeight, imageWidth, imageHeight, textAlign, textBaseline, padding);
|
|
70108
|
+
image.setAttributes({
|
|
70109
|
+
x: pos.x,
|
|
70110
|
+
y: pos.y,
|
|
70111
|
+
width: imageWidth,
|
|
70112
|
+
height: imageHeight
|
|
70113
|
+
}), isMerge && updateImageDxDy(cellGroup.mergeStartCol, cellGroup.mergeEndCol, cellGroup.mergeStartRow, cellGroup.mergeEndRow, table);
|
|
70114
|
+
}
|
|
70115
|
+
})(), table.scenegraph.updateNextFrame()), shouldSnapshot && releaseCurrentVideo());
|
|
70116
|
+
};
|
|
70013
70117
|
video.addEventListener("loadeddata", () => {
|
|
70118
|
+
if (clearVideoLoadTimer(), videoReleased) return;
|
|
70119
|
+
if (!isCurrentImage()) return void releaseCurrentVideo();
|
|
70014
70120
|
imageAutoSizing && _adjustWidthHeight(col, row, video.videoWidth, video.videoHeight, table.scenegraph, padding, cellGroup);
|
|
70015
70121
|
const {
|
|
70016
70122
|
width: cellWidth,
|
|
@@ -70060,11 +70166,8 @@
|
|
|
70060
70166
|
dx: dx,
|
|
70061
70167
|
dy: dy
|
|
70062
70168
|
});
|
|
70063
|
-
playIcon.name = "play-icon", cellGroup.appendChild(playIcon), table.scenegraph.updateNextFrame();
|
|
70064
|
-
}), video.
|
|
70065
|
-
const regedIcons = get$2();
|
|
70066
|
-
image.image = regedIcons.video_damage_pic ? regedIcons.video_damage_pic.svg : regedIcons.damage_pic.svg;
|
|
70067
|
-
}, video.src = value, video.setAttribute("preload", "auto");
|
|
70169
|
+
playIcon.name = "play-icon", cellGroup.appendChild(playIcon), shouldSnapshot && snapshotVideoFirstFrame(video, image, table) && releaseCurrentVideo(), table.scenegraph.updateNextFrame();
|
|
70170
|
+
}), video.addEventListener("error", handleVideoLoadFail), video.addEventListener("abort", handleVideoLoadFail);
|
|
70068
70171
|
const image = createImage({
|
|
70069
70172
|
x: padding[3],
|
|
70070
70173
|
y: padding[0],
|
|
@@ -70073,9 +70176,11 @@
|
|
|
70073
70176
|
image: video,
|
|
70074
70177
|
cursor: "pointer"
|
|
70075
70178
|
});
|
|
70076
|
-
|
|
70179
|
+
image.name = "image", image.keepAspectRatio = keepAspectRatio, image.textAlign = textAlign, image.textBaseline = textBaseline, cellGroup.appendChild(image), image.successCallback = () => {
|
|
70077
70180
|
isDamagePic(image) && (updateAutoSizingAndKeepAspectRatio(imageAutoSizing, keepAspectRatio, padding, textAlign, textBaseline, image, cellGroup, table), table.scenegraph.updateNextFrame());
|
|
70078
|
-
},
|
|
70181
|
+
}, video.setAttribute("preload", "auto"), video.src = value;
|
|
70182
|
+
const timeout = getVideoFirstFrameTimeout(table);
|
|
70183
|
+
return shouldSnapshot && timeout > 0 && (loadTimer = setTimeout(handleVideoLoadFail, timeout)), cellGroup;
|
|
70079
70184
|
}
|
|
70080
70185
|
|
|
70081
70186
|
function createMark(marked, cellGroup, table) {
|
|
@@ -78708,7 +78813,7 @@
|
|
|
78708
78813
|
PluginManager: PluginManager
|
|
78709
78814
|
});
|
|
78710
78815
|
|
|
78711
|
-
const version = "1.26.
|
|
78816
|
+
const version = "1.26.4";
|
|
78712
78817
|
|
|
78713
78818
|
exports.Gantt = Gantt;
|
|
78714
78819
|
exports.TYPES = index$4;
|