@visactor/react-vtable 1.19.9-alpha.2 → 1.20.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/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/dist/react-vtable.js +55 -33
- package/dist/react-vtable.min.js +2 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/package.json +4 -4
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -18,5 +18,5 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", {
|
|
19
19
|
value: !0
|
|
20
20
|
}), exports.version = void 0, __exportStar(require("./tables"), exports), __exportStar(require("./table-components"), exports),
|
|
21
|
-
__exportStar(require("./components"), exports), exports.version = "1.
|
|
21
|
+
__exportStar(require("./components"), exports), exports.version = "1.20.0-alpha.0";
|
|
22
22
|
//# sourceMappingURL=index.js.map
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,qDAAmC;AACnC,+CAA6B;AAEhB,QAAA,OAAO,GAAG,gBAAgB,CAAC","file":"index.js","sourcesContent":["export * from './tables';\nexport * from './table-components';\nexport * from './components';\n\nexport const version = \"1.
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,qDAAmC;AACnC,+CAA6B;AAEhB,QAAA,OAAO,GAAG,gBAAgB,CAAC","file":"index.js","sourcesContent":["export * from './tables';\nexport * from './table-components';\nexport * from './components';\n\nexport const version = \"1.20.0-alpha.0\";\n"]}
|
package/dist/react-vtable.js
CHANGED
|
@@ -3749,7 +3749,8 @@
|
|
|
3749
3749
|
y1: 0,
|
|
3750
3750
|
strokeBoundsBuffer: 0,
|
|
3751
3751
|
cornerRadius: 0,
|
|
3752
|
-
cornerType: "round"
|
|
3752
|
+
cornerType: "round",
|
|
3753
|
+
drawStrokeWhenZeroWH: !1
|
|
3753
3754
|
});
|
|
3754
3755
|
Object.assign(Object.assign({}, DefaultAttribute), {
|
|
3755
3756
|
width: 0,
|
|
@@ -3758,7 +3759,8 @@
|
|
|
3758
3759
|
y1: 0,
|
|
3759
3760
|
cornerRadius: 0,
|
|
3760
3761
|
length: 0,
|
|
3761
|
-
cornerType: "round"
|
|
3762
|
+
cornerType: "round",
|
|
3763
|
+
drawStrokeWhenZeroWH: !1
|
|
3762
3764
|
});
|
|
3763
3765
|
const DefaultSymbolAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
|
|
3764
3766
|
symbolType: "circle",
|
|
@@ -3985,6 +3987,34 @@
|
|
|
3985
3987
|
}
|
|
3986
3988
|
return c;
|
|
3987
3989
|
}
|
|
3990
|
+
static processColorStops(colorStops) {
|
|
3991
|
+
if (!colorStops || 0 === colorStops.length) return [];
|
|
3992
|
+
if (colorStops.some(item => item.length)) {
|
|
3993
|
+
const stops = colorStops.map(item => ({
|
|
3994
|
+
color: item.value,
|
|
3995
|
+
offset: item.length ? parseFloat(item.length.value) / 100 : -1
|
|
3996
|
+
}));
|
|
3997
|
+
stops[0].offset < 0 && (stops[0].offset = 0), stops[stops.length - 1].offset < 0 && (stops[stops.length - 1].offset = 1);
|
|
3998
|
+
for (let i = 1; i < stops.length - 1; i++) if (stops[i].offset < 0) {
|
|
3999
|
+
const prevWithOffsetIdx = i - 1;
|
|
4000
|
+
let nextWithOffsetIdx = i + 1;
|
|
4001
|
+
for (; nextWithOffsetIdx < stops.length && stops[nextWithOffsetIdx].offset < 0;) nextWithOffsetIdx++;
|
|
4002
|
+
const startOffset = stops[prevWithOffsetIdx].offset,
|
|
4003
|
+
endOffset = stops[nextWithOffsetIdx].offset,
|
|
4004
|
+
unspecCount = nextWithOffsetIdx - prevWithOffsetIdx;
|
|
4005
|
+
for (let j = 1; j < unspecCount; j++) stops[prevWithOffsetIdx + j].offset = startOffset + (endOffset - startOffset) * j / unspecCount;
|
|
4006
|
+
i = nextWithOffsetIdx - 1;
|
|
4007
|
+
}
|
|
4008
|
+
return stops;
|
|
4009
|
+
}
|
|
4010
|
+
return colorStops.map((item, index) => {
|
|
4011
|
+
const offset = colorStops.length > 1 ? index / (colorStops.length - 1) : 0;
|
|
4012
|
+
return {
|
|
4013
|
+
color: item.value,
|
|
4014
|
+
offset: offset
|
|
4015
|
+
};
|
|
4016
|
+
});
|
|
4017
|
+
}
|
|
3988
4018
|
static ParseConic(datum) {
|
|
3989
4019
|
const {
|
|
3990
4020
|
orientation: orientation,
|
|
@@ -3998,10 +4028,7 @@
|
|
|
3998
4028
|
y: .5,
|
|
3999
4029
|
startAngle: sa,
|
|
4000
4030
|
endAngle: sa + pi2,
|
|
4001
|
-
stops:
|
|
4002
|
-
color: item.value,
|
|
4003
|
-
offset: parseFloat(item.length.value) / 100
|
|
4004
|
-
}))
|
|
4031
|
+
stops: GradientParser.processColorStops(colorStops)
|
|
4005
4032
|
};
|
|
4006
4033
|
}
|
|
4007
4034
|
static ParseRadial(datum) {
|
|
@@ -4016,10 +4043,7 @@
|
|
|
4016
4043
|
y1: .5,
|
|
4017
4044
|
r0: 0,
|
|
4018
4045
|
r1: 1,
|
|
4019
|
-
stops:
|
|
4020
|
-
color: item.value,
|
|
4021
|
-
offset: parseFloat(item.length.value) / 100
|
|
4022
|
-
}))
|
|
4046
|
+
stops: GradientParser.processColorStops(colorStops)
|
|
4023
4047
|
};
|
|
4024
4048
|
}
|
|
4025
4049
|
static ParseLinear(datum) {
|
|
@@ -4041,10 +4065,7 @@
|
|
|
4041
4065
|
y0: y0,
|
|
4042
4066
|
x1: x1,
|
|
4043
4067
|
y1: y1,
|
|
4044
|
-
stops:
|
|
4045
|
-
color: item.value,
|
|
4046
|
-
offset: parseFloat(item.length.value) / 100
|
|
4047
|
-
}))
|
|
4068
|
+
stops: GradientParser.processColorStops(colorStops)
|
|
4048
4069
|
};
|
|
4049
4070
|
}
|
|
4050
4071
|
}
|
|
@@ -6727,7 +6748,7 @@
|
|
|
6727
6748
|
});
|
|
6728
6749
|
}
|
|
6729
6750
|
setAttributes(params, forceUpdateTag = !1, context) {
|
|
6730
|
-
(params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context);
|
|
6751
|
+
params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
|
|
6731
6752
|
}
|
|
6732
6753
|
_setAttributes(params, forceUpdateTag = !1, context) {
|
|
6733
6754
|
const keys = Object.keys(params);
|
|
@@ -7362,8 +7383,8 @@
|
|
|
7362
7383
|
function strokeVisible(opacity, strokeOpacity) {
|
|
7363
7384
|
return opacity * strokeOpacity > 0;
|
|
7364
7385
|
}
|
|
7365
|
-
function rectStrokeVisible(opacity, strokeOpacity, width, height) {
|
|
7366
|
-
return opacity * strokeOpacity > 0 && 0 !== width && 0 !== height;
|
|
7386
|
+
function rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH) {
|
|
7387
|
+
return drawStrokeWhenZeroWH ? opacity * strokeOpacity > 0 : opacity * strokeOpacity > 0 && 0 !== width && 0 !== height;
|
|
7367
7388
|
}
|
|
7368
7389
|
|
|
7369
7390
|
const ImageRenderContribution = Symbol.for("ImageRenderContribution");
|
|
@@ -7725,7 +7746,7 @@
|
|
|
7725
7746
|
this.cache.layoutData.lines.forEach(item => {
|
|
7726
7747
|
mergedText += item.str;
|
|
7727
7748
|
});
|
|
7728
|
-
return (Array.isArray(text) ? text.join("") : text) !== mergedText;
|
|
7749
|
+
return (Array.isArray(text) ? text.join("") : text).toString() !== mergedText;
|
|
7729
7750
|
}
|
|
7730
7751
|
return "vertical" === attribute.direction && this.cache.verticalList && this.cache.verticalList[0] ? this.cache.verticalList[0].map(item => item.text).join("") !== attribute.text.toString() : null != this.clipedText && this.clipedText !== attribute.text.toString();
|
|
7731
7752
|
}
|
|
@@ -7824,7 +7845,7 @@
|
|
|
7824
7845
|
return fontSize ? .1 * fontSize : 0;
|
|
7825
7846
|
}
|
|
7826
7847
|
updateHorizontalMultilineAABBBounds(text) {
|
|
7827
|
-
var _a;
|
|
7848
|
+
var _a, _b;
|
|
7828
7849
|
const textTheme = this.getGraphicTheme(),
|
|
7829
7850
|
attribute = this.attribute,
|
|
7830
7851
|
{
|
|
@@ -7851,7 +7872,7 @@
|
|
|
7851
7872
|
const bbox = this.cache.layoutData.bbox;
|
|
7852
7873
|
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
7853
7874
|
}
|
|
7854
|
-
const textMeasure = application.graphicUtil.
|
|
7875
|
+
const textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_b = this.stage) || void 0 === _b ? void 0 : _b.textMeasureId)),
|
|
7855
7876
|
layoutData = new CanvasTextLayout(fontFamily, {
|
|
7856
7877
|
fontSize: fontSize,
|
|
7857
7878
|
fontWeight: fontWeight,
|
|
@@ -7869,7 +7890,7 @@
|
|
|
7869
7890
|
return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
7870
7891
|
}
|
|
7871
7892
|
updateWrapAABBBounds(text) {
|
|
7872
|
-
var _a, _b, _c;
|
|
7893
|
+
var _a, _b, _c, _d;
|
|
7873
7894
|
const textTheme = this.getGraphicTheme(),
|
|
7874
7895
|
{
|
|
7875
7896
|
fontFamily = textTheme.fontFamily,
|
|
@@ -7895,7 +7916,7 @@
|
|
|
7895
7916
|
const bbox = this.cache.layoutData.bbox;
|
|
7896
7917
|
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
7897
7918
|
}
|
|
7898
|
-
const textMeasure = application.graphicUtil.
|
|
7919
|
+
const textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_b = this.stage) || void 0 === _b ? void 0 : _b.textMeasureId)),
|
|
7899
7920
|
textOptions = {
|
|
7900
7921
|
fontSize: fontSize,
|
|
7901
7922
|
fontWeight: fontWeight,
|
|
@@ -7927,7 +7948,7 @@
|
|
|
7927
7948
|
if ("" !== str && "" === clip.str || clip.wordBreaked) {
|
|
7928
7949
|
if (ellipsis) {
|
|
7929
7950
|
const clipEllipsis = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
7930
|
-
clip.str = null !== (
|
|
7951
|
+
clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
|
|
7931
7952
|
} else clip.str = "", clip.width = 0;
|
|
7932
7953
|
needCut = !1;
|
|
7933
7954
|
}
|
|
@@ -7990,9 +8011,9 @@
|
|
|
7990
8011
|
return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
7991
8012
|
}
|
|
7992
8013
|
updateVerticalMultilineAABBBounds(text) {
|
|
7993
|
-
var _a, _b;
|
|
8014
|
+
var _a, _b, _c;
|
|
7994
8015
|
const textTheme = this.getGraphicTheme(),
|
|
7995
|
-
textMeasure = application.graphicUtil.
|
|
8016
|
+
textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_a = this.stage) || void 0 === _a ? void 0 : _a.textMeasureId));
|
|
7996
8017
|
let width;
|
|
7997
8018
|
const attribute = this.attribute,
|
|
7998
8019
|
{
|
|
@@ -8013,7 +8034,7 @@
|
|
|
8013
8034
|
} = attribute;
|
|
8014
8035
|
if (!verticalMode) {
|
|
8015
8036
|
const t = textAlign;
|
|
8016
|
-
textAlign = null !== (
|
|
8037
|
+
textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
|
|
8017
8038
|
}
|
|
8018
8039
|
if (width = 0, !this.shouldUpdateShape() && this.cache) {
|
|
8019
8040
|
this.cache.verticalList.forEach(item => {
|
|
@@ -8127,7 +8148,7 @@
|
|
|
8127
8148
|
return isArray$1(text) ? !text.every(t => null == t || "" === t) : null != text && "" !== text;
|
|
8128
8149
|
}
|
|
8129
8150
|
updateMultilineAABBBounds(text) {
|
|
8130
|
-
var _a, _b, _c, _d;
|
|
8151
|
+
var _a, _b, _c, _d, _e;
|
|
8131
8152
|
const textTheme = this.getGraphicTheme(),
|
|
8132
8153
|
{
|
|
8133
8154
|
fontFamily = textTheme.fontFamily,
|
|
@@ -8151,7 +8172,7 @@
|
|
|
8151
8172
|
const bbox = this.cache.layoutData.bbox;
|
|
8152
8173
|
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
8153
8174
|
}
|
|
8154
|
-
const textMeasure = application.graphicUtil.
|
|
8175
|
+
const textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_c = this.stage) || void 0 === _c ? void 0 : _c.textMeasureId)),
|
|
8155
8176
|
layoutObj = new CanvasTextLayout(fontFamily, {
|
|
8156
8177
|
fontSize: fontSize,
|
|
8157
8178
|
fontWeight: fontWeight,
|
|
@@ -8180,7 +8201,7 @@
|
|
|
8180
8201
|
if ("" !== str && "" === clip.str) {
|
|
8181
8202
|
if (ellipsis) {
|
|
8182
8203
|
const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
8183
|
-
clip.str = null !== (
|
|
8204
|
+
clip.str = null !== (_d = clipEllipsis.str) && void 0 !== _d ? _d : "", clip.width = null !== (_e = clipEllipsis.width) && void 0 !== _e ? _e : 0;
|
|
8184
8205
|
} else clip.str = "", clip.width = 0;
|
|
8185
8206
|
needCut = !1;
|
|
8186
8207
|
}
|
|
@@ -9194,7 +9215,7 @@
|
|
|
9194
9215
|
case "right":
|
|
9195
9216
|
deltaX = -aabbBounds.width();
|
|
9196
9217
|
}
|
|
9197
|
-
return aabbBounds.translate(deltaX, deltaY), application.graphicService.updateTempAABBBounds(aabbBounds), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, application.graphicService.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, this), 0 === aabbBounds.width() && 0 === aabbBounds.height() && aabbBounds.clear(), aabbBounds;
|
|
9218
|
+
return height || ("middle" === this.verticalDirection ? deltaY -= aabbBounds.height() / 2 : "bottom" === this.verticalDirection && (deltaY -= aabbBounds.height())), aabbBounds.translate(deltaX, deltaY), application.graphicService.updateTempAABBBounds(aabbBounds), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, application.graphicService.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, this), 0 === aabbBounds.width() && 0 === aabbBounds.height() && aabbBounds.clear(), aabbBounds;
|
|
9198
9219
|
}
|
|
9199
9220
|
needUpdateTags(keys) {
|
|
9200
9221
|
return super.needUpdateTags(keys, RICHTEXT_UPDATE_TAG_KEY);
|
|
@@ -10408,7 +10429,8 @@
|
|
|
10408
10429
|
y1: y1,
|
|
10409
10430
|
x: originX = rectAttribute.x,
|
|
10410
10431
|
y: originY = rectAttribute.y,
|
|
10411
|
-
fillStrokeOrder = rectAttribute.fillStrokeOrder
|
|
10432
|
+
fillStrokeOrder = rectAttribute.fillStrokeOrder,
|
|
10433
|
+
drawStrokeWhenZeroWH = rectAttribute.drawStrokeWhenZeroWH
|
|
10412
10434
|
} = rect.attribute;
|
|
10413
10435
|
let {
|
|
10414
10436
|
width: width,
|
|
@@ -10416,7 +10438,7 @@
|
|
|
10416
10438
|
} = rect.attribute;
|
|
10417
10439
|
width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
|
|
10418
10440
|
const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
|
|
10419
|
-
sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height),
|
|
10441
|
+
sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH),
|
|
10420
10442
|
doFill = runFill(fill, background),
|
|
10421
10443
|
doStroke = runStroke(stroke, lineWidth);
|
|
10422
10444
|
if (!rect.valid || !visible) return;
|
|
@@ -19788,7 +19810,7 @@
|
|
|
19788
19810
|
const Checkbox = React.forwardRef(CheckboxComponent);
|
|
19789
19811
|
Checkbox.displayName = 'Checkbox';
|
|
19790
19812
|
|
|
19791
|
-
const version = "1.
|
|
19813
|
+
const version = "1.20.0-alpha.0";
|
|
19792
19814
|
|
|
19793
19815
|
Object.defineProperty(exports, 'register', {
|
|
19794
19816
|
enumerable: true,
|