vxe-pc-ui 3.14.29 → 3.14.30
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/es/watermark/src/util.js +24 -20
- package/lib/index.umd.js +30 -34
- package/lib/index.umd.min.js +1 -1
- package/lib/watermark/src/util.js +30 -34
- package/lib/watermark/src/util.min.js +1 -1
- package/package.json +1 -1
- package/packages/watermark/src/util.ts +26 -22
- package/types/components/table.d.ts +1 -0
- /package/es/icon/{iconfont.1780632915143.ttf → iconfont.1780656821823.ttf} +0 -0
- /package/es/icon/{iconfont.1780632915143.woff → iconfont.1780656821823.woff} +0 -0
- /package/es/icon/{iconfont.1780632915143.woff2 → iconfont.1780656821823.woff2} +0 -0
- /package/es/{iconfont.1780632915143.ttf → iconfont.1780656821823.ttf} +0 -0
- /package/es/{iconfont.1780632915143.woff → iconfont.1780656821823.woff} +0 -0
- /package/es/{iconfont.1780632915143.woff2 → iconfont.1780656821823.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1780632915143.ttf → iconfont.1780656821823.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1780632915143.woff → iconfont.1780656821823.woff} +0 -0
- /package/lib/icon/style/{iconfont.1780632915143.woff2 → iconfont.1780656821823.woff2} +0 -0
- /package/lib/{iconfont.1780632915143.ttf → iconfont.1780656821823.ttf} +0 -0
- /package/lib/{iconfont.1780632915143.woff → iconfont.1780656821823.woff} +0 -0
- /package/lib/{iconfont.1780632915143.woff2 → iconfont.1780656821823.woff2} +0 -0
package/es/watermark/src/util.js
CHANGED
|
@@ -52,16 +52,6 @@ function calcContentWH(contList) {
|
|
|
52
52
|
contentHeight
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
function calcCanvasWH(contentWidth, opts) {
|
|
56
|
-
const { gap } = opts;
|
|
57
|
-
const [gapX = 0, gapY = 0] = gap ? ((XEUtils.isArray(gap) ? gap : [gap, gap])) : [];
|
|
58
|
-
const canvasWidth = contentWidth + XEUtils.toNumber(gapX);
|
|
59
|
-
const canvasHeight = contentWidth + XEUtils.toNumber(gapY);
|
|
60
|
-
return {
|
|
61
|
-
canvasWidth,
|
|
62
|
-
canvasHeight
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
55
|
function getFontConf(item, key, opts) {
|
|
66
56
|
return (item.font ? item.font[key] : '') || (opts.font ? opts.font[key] : '');
|
|
67
57
|
}
|
|
@@ -114,24 +104,38 @@ export function getContentUrl(content, defaultFontSize, options) {
|
|
|
114
104
|
}
|
|
115
105
|
const ctx = canvasEl.getContext('2d');
|
|
116
106
|
if (ctx && contList.length) {
|
|
117
|
-
const {
|
|
118
|
-
const
|
|
107
|
+
const { gap } = opts;
|
|
108
|
+
const gapList = gap ? ((XEUtils.isArray(gap) ? gap : [gap, gap])) : [];
|
|
109
|
+
const gapX = XEUtils.toNumber(gapList[0]);
|
|
110
|
+
const gapY = XEUtils.toNumber(gapList[1]);
|
|
111
|
+
const { contentWidth } = calcContentWH(contList);
|
|
112
|
+
const canvasWidth = contentWidth * 2 + gapX * 2 + (gapX / 2);
|
|
113
|
+
const canvasHeight = contentWidth * 2 + gapY;
|
|
119
114
|
canvasEl.width = canvasWidth;
|
|
120
115
|
canvasEl.height = canvasHeight;
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
const drayX = x + (contentWidth / 2);
|
|
124
|
-
const drayY = y + (contentHeight / 2);
|
|
116
|
+
const drayX = (gapX / 2);
|
|
117
|
+
const drayY = contentWidth + (gapY / 2);
|
|
125
118
|
ctx.save();
|
|
126
119
|
ctx.translate(drayX, drayY);
|
|
127
120
|
ctx.rotate(deg * Math.PI / 180);
|
|
128
121
|
ctx.translate(-drayX, -drayY);
|
|
129
|
-
let
|
|
122
|
+
let txtOffsetY = 0;
|
|
123
|
+
contList.forEach((item) => {
|
|
124
|
+
drayFont(ctx, item, opts);
|
|
125
|
+
const txtX = drayX;
|
|
126
|
+
const txtY = drayY + txtOffsetY;
|
|
127
|
+
ctx.fillText(item.text, txtX, txtY, contentWidth);
|
|
128
|
+
txtOffsetY += item.height;
|
|
129
|
+
});
|
|
130
|
+
const offsetX = gapX;
|
|
131
|
+
const offsetY = gapY + contentWidth;
|
|
132
|
+
txtOffsetY = 0;
|
|
130
133
|
contList.forEach((item) => {
|
|
131
|
-
const align = getFontConf(item, 'align', opts);
|
|
132
134
|
drayFont(ctx, item, opts);
|
|
133
|
-
|
|
134
|
-
|
|
135
|
+
const txtX = drayX + offsetX;
|
|
136
|
+
const txtY = drayY + txtOffsetY + offsetY;
|
|
137
|
+
ctx.fillText(item.text, txtX, txtY, contentWidth);
|
|
138
|
+
txtOffsetY += item.height;
|
|
135
139
|
});
|
|
136
140
|
ctx.restore();
|
|
137
141
|
resolve(canvasEl.toDataURL());
|
package/lib/index.umd.js
CHANGED
|
@@ -63416,21 +63416,6 @@ function calcContentWH(contList) {
|
|
|
63416
63416
|
contentHeight: contentHeight
|
|
63417
63417
|
};
|
|
63418
63418
|
}
|
|
63419
|
-
function calcCanvasWH(contentWidth, opts) {
|
|
63420
|
-
var gap = opts.gap;
|
|
63421
|
-
var _ref = gap ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(gap) ? gap : [gap, gap] : [],
|
|
63422
|
-
_ref2 = _slicedToArray(_ref, 2),
|
|
63423
|
-
_ref2$ = _ref2[0],
|
|
63424
|
-
gapX = _ref2$ === void 0 ? 0 : _ref2$,
|
|
63425
|
-
_ref2$2 = _ref2[1],
|
|
63426
|
-
gapY = _ref2$2 === void 0 ? 0 : _ref2$2;
|
|
63427
|
-
var canvasWidth = contentWidth + external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(gapX);
|
|
63428
|
-
var canvasHeight = contentWidth + external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(gapY);
|
|
63429
|
-
return {
|
|
63430
|
-
canvasWidth: canvasWidth,
|
|
63431
|
-
canvasHeight: canvasHeight
|
|
63432
|
-
};
|
|
63433
|
-
}
|
|
63434
63419
|
function getFontConf(item, key, opts) {
|
|
63435
63420
|
return (item.font ? item.font[key] : '') || (opts.font ? opts.font[key] : '');
|
|
63436
63421
|
}
|
|
@@ -63438,12 +63423,12 @@ function createMarkFont(contConf, defaultFontSize, opts) {
|
|
|
63438
63423
|
var offset = opts.offset;
|
|
63439
63424
|
var text = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toValueString(contConf.textContent);
|
|
63440
63425
|
var fontSize = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(getFontConf(contConf, 'fontSize', opts) || defaultFontSize) || 14;
|
|
63441
|
-
var
|
|
63442
|
-
|
|
63443
|
-
|
|
63444
|
-
offsetX =
|
|
63445
|
-
|
|
63446
|
-
offsetY =
|
|
63426
|
+
var _ref = offset ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(offset) ? offset : [offset, offset] : [],
|
|
63427
|
+
_ref2 = _slicedToArray(_ref, 2),
|
|
63428
|
+
_ref2$ = _ref2[0],
|
|
63429
|
+
offsetX = _ref2$ === void 0 ? 0 : _ref2$,
|
|
63430
|
+
_ref2$2 = _ref2[1],
|
|
63431
|
+
offsetY = _ref2$2 === void 0 ? 0 : _ref2$2;
|
|
63447
63432
|
var _calcFontWH = calcFontWH(text, fontSize),
|
|
63448
63433
|
width = _calcFontWH.width,
|
|
63449
63434
|
height = _calcFontWH.height;
|
|
@@ -63485,28 +63470,39 @@ function getContentUrl(content, defaultFontSize, options) {
|
|
|
63485
63470
|
}
|
|
63486
63471
|
var ctx = canvasEl.getContext('2d');
|
|
63487
63472
|
if (ctx && contList.length) {
|
|
63473
|
+
var gap = opts.gap;
|
|
63474
|
+
var gapList = gap ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(gap) ? gap : [gap, gap] : [];
|
|
63475
|
+
var gapX = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(gapList[0]);
|
|
63476
|
+
var gapY = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(gapList[1]);
|
|
63488
63477
|
var _calcContentWH = calcContentWH(contList),
|
|
63489
|
-
contentWidth = _calcContentWH.contentWidth
|
|
63490
|
-
|
|
63491
|
-
var
|
|
63492
|
-
canvasWidth = _calcCanvasWH.canvasWidth,
|
|
63493
|
-
canvasHeight = _calcCanvasWH.canvasHeight;
|
|
63478
|
+
contentWidth = _calcContentWH.contentWidth;
|
|
63479
|
+
var canvasWidth = contentWidth * 2 + gapX * 2 + gapX / 2;
|
|
63480
|
+
var canvasHeight = contentWidth * 2 + gapY;
|
|
63494
63481
|
canvasEl.width = canvasWidth;
|
|
63495
63482
|
canvasEl.height = canvasHeight;
|
|
63496
|
-
var
|
|
63497
|
-
var
|
|
63498
|
-
var drayX = x + contentWidth / 2;
|
|
63499
|
-
var drayY = y + contentHeight / 2;
|
|
63483
|
+
var drayX = gapX / 2;
|
|
63484
|
+
var drayY = contentWidth + gapY / 2;
|
|
63500
63485
|
ctx.save();
|
|
63501
63486
|
ctx.translate(drayX, drayY);
|
|
63502
63487
|
ctx.rotate(deg * Math.PI / 180);
|
|
63503
63488
|
ctx.translate(-drayX, -drayY);
|
|
63504
|
-
var
|
|
63489
|
+
var txtOffsetY = 0;
|
|
63490
|
+
contList.forEach(function (item) {
|
|
63491
|
+
drayFont(ctx, item, opts);
|
|
63492
|
+
var txtX = drayX;
|
|
63493
|
+
var txtY = drayY + txtOffsetY;
|
|
63494
|
+
ctx.fillText(item.text, txtX, txtY, contentWidth);
|
|
63495
|
+
txtOffsetY += item.height;
|
|
63496
|
+
});
|
|
63497
|
+
var offsetX = gapX;
|
|
63498
|
+
var offsetY = gapY + contentWidth;
|
|
63499
|
+
txtOffsetY = 0;
|
|
63505
63500
|
contList.forEach(function (item) {
|
|
63506
|
-
var align = getFontConf(item, 'align', opts);
|
|
63507
63501
|
drayFont(ctx, item, opts);
|
|
63508
|
-
|
|
63509
|
-
|
|
63502
|
+
var txtX = drayX + offsetX;
|
|
63503
|
+
var txtY = drayY + txtOffsetY + offsetY;
|
|
63504
|
+
ctx.fillText(item.text, txtX, txtY, contentWidth);
|
|
63505
|
+
txtOffsetY += item.height;
|
|
63510
63506
|
});
|
|
63511
63507
|
ctx.restore();
|
|
63512
63508
|
resolve(canvasEl.toDataURL());
|