vxe-pc-ui 4.14.29 → 4.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/dist/all.esm.js +24 -20
- package/es/watermark/src/util.js +24 -20
- package/lib/index.umd.js +26 -26
- package/lib/index.umd.min.js +1 -1
- package/lib/watermark/src/util.js +26 -26
- 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.1780632924397.ttf → iconfont.1780656834468.ttf} +0 -0
- /package/es/icon/{iconfont.1780632924397.woff → iconfont.1780656834468.woff} +0 -0
- /package/es/icon/{iconfont.1780632924397.woff2 → iconfont.1780656834468.woff2} +0 -0
- /package/es/{iconfont.1780632924397.ttf → iconfont.1780656834468.ttf} +0 -0
- /package/es/{iconfont.1780632924397.woff → iconfont.1780656834468.woff} +0 -0
- /package/es/{iconfont.1780632924397.woff2 → iconfont.1780656834468.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1780632924397.ttf → iconfont.1780656834468.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1780632924397.woff → iconfont.1780656834468.woff} +0 -0
- /package/lib/icon/style/{iconfont.1780632924397.woff2 → iconfont.1780656834468.woff2} +0 -0
- /package/lib/{iconfont.1780632924397.ttf → iconfont.1780656834468.ttf} +0 -0
- /package/lib/{iconfont.1780632924397.woff → iconfont.1780656834468.woff} +0 -0
- /package/lib/{iconfont.1780632924397.woff2 → iconfont.1780656834468.woff2} +0 -0
|
@@ -59,18 +59,6 @@ function calcContentWH(contList) {
|
|
|
59
59
|
contentHeight
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
function calcCanvasWH(contentWidth, opts) {
|
|
63
|
-
const {
|
|
64
|
-
gap
|
|
65
|
-
} = opts;
|
|
66
|
-
const [gapX = 0, gapY = 0] = gap ? _xeUtils.default.isArray(gap) ? gap : [gap, gap] : [];
|
|
67
|
-
const canvasWidth = contentWidth + _xeUtils.default.toNumber(gapX);
|
|
68
|
-
const canvasHeight = contentWidth + _xeUtils.default.toNumber(gapY);
|
|
69
|
-
return {
|
|
70
|
-
canvasWidth,
|
|
71
|
-
canvasHeight
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
62
|
function getFontConf(item, key, opts) {
|
|
75
63
|
return (item.font ? item.font[key] : '') || (opts.font ? opts.font[key] : '');
|
|
76
64
|
}
|
|
@@ -126,29 +114,41 @@ function getContentUrl(content, defaultFontSize, options) {
|
|
|
126
114
|
const ctx = canvasEl.getContext('2d');
|
|
127
115
|
if (ctx && contList.length) {
|
|
128
116
|
const {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
117
|
+
gap
|
|
118
|
+
} = opts;
|
|
119
|
+
const gapList = gap ? _xeUtils.default.isArray(gap) ? gap : [gap, gap] : [];
|
|
120
|
+
const gapX = _xeUtils.default.toNumber(gapList[0]);
|
|
121
|
+
const gapY = _xeUtils.default.toNumber(gapList[1]);
|
|
132
122
|
const {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
123
|
+
contentWidth
|
|
124
|
+
} = calcContentWH(contList);
|
|
125
|
+
const canvasWidth = contentWidth * 2 + gapX * 2 + gapX / 2;
|
|
126
|
+
const canvasHeight = contentWidth * 2 + gapY;
|
|
136
127
|
canvasEl.width = canvasWidth;
|
|
137
128
|
canvasEl.height = canvasHeight;
|
|
138
|
-
const
|
|
139
|
-
const
|
|
140
|
-
const drayX = x + contentWidth / 2;
|
|
141
|
-
const drayY = y + contentHeight / 2;
|
|
129
|
+
const drayX = gapX / 2;
|
|
130
|
+
const drayY = contentWidth + gapY / 2;
|
|
142
131
|
ctx.save();
|
|
143
132
|
ctx.translate(drayX, drayY);
|
|
144
133
|
ctx.rotate(deg * Math.PI / 180);
|
|
145
134
|
ctx.translate(-drayX, -drayY);
|
|
146
|
-
let
|
|
135
|
+
let txtOffsetY = 0;
|
|
136
|
+
contList.forEach(item => {
|
|
137
|
+
drayFont(ctx, item, opts);
|
|
138
|
+
const txtX = drayX;
|
|
139
|
+
const txtY = drayY + txtOffsetY;
|
|
140
|
+
ctx.fillText(item.text, txtX, txtY, contentWidth);
|
|
141
|
+
txtOffsetY += item.height;
|
|
142
|
+
});
|
|
143
|
+
const offsetX = gapX;
|
|
144
|
+
const offsetY = gapY + contentWidth;
|
|
145
|
+
txtOffsetY = 0;
|
|
147
146
|
contList.forEach(item => {
|
|
148
|
-
const align = getFontConf(item, 'align', opts);
|
|
149
147
|
drayFont(ctx, item, opts);
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
const txtX = drayX + offsetX;
|
|
149
|
+
const txtY = drayY + txtOffsetY + offsetY;
|
|
150
|
+
ctx.fillText(item.text, txtX, txtY, contentWidth);
|
|
151
|
+
txtOffsetY += item.height;
|
|
152
152
|
});
|
|
153
153
|
ctx.restore();
|
|
154
154
|
resolve(canvasEl.toDataURL());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.getContentUrl=getContentUrl;var _xeUtils=_interopRequireDefault(require("xe-utils")),_dom=require("../../ui/src/dom");function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}let canvasEl=null,fontEl=null,fontCacheMaps={};function getMarkCanvas(){return canvasEl||((canvasEl=document.createElement("canvas")).style.position="absolute",canvasEl.style.top="0",canvasEl.style.left="0"),canvasEl}function removeMarkElement(t){var e;t&&(e=t.parentNode)&&e.removeChild(t)}function calcFontWH(t,e){var n=e+"_"+t;return fontCacheMaps[n]||((fontEl=fontEl||document.createElement("span")).parentNode||document.body.append(fontEl),fontEl.textContent=t,fontEl.style.fontSize=(0,_dom.toCssUnit)(e),t=fontEl.offsetWidth,e=fontEl.offsetHeight,fontCacheMaps[n]={width:t,height:e}),fontCacheMaps[n]}function calcContentWH(t){let e=0,n=0;return t.forEach(t=>{e=Math.max(t.width,e),n=Math.max(t.height,n)}),{contentWidth:e,contentHeight:n}}function
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.getContentUrl=getContentUrl;var _xeUtils=_interopRequireDefault(require("xe-utils")),_dom=require("../../ui/src/dom");function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}let canvasEl=null,fontEl=null,fontCacheMaps={};function getMarkCanvas(){return canvasEl||((canvasEl=document.createElement("canvas")).style.position="absolute",canvasEl.style.top="0",canvasEl.style.left="0"),canvasEl}function removeMarkElement(t){var e;t&&(e=t.parentNode)&&e.removeChild(t)}function calcFontWH(t,e){var n=e+"_"+t;return fontCacheMaps[n]||((fontEl=fontEl||document.createElement("span")).parentNode||document.body.append(fontEl),fontEl.textContent=t,fontEl.style.fontSize=(0,_dom.toCssUnit)(e),t=fontEl.offsetWidth,e=fontEl.offsetHeight,fontCacheMaps[n]={width:t,height:e}),fontCacheMaps[n]}function calcContentWH(t){let e=0,n=0;return t.forEach(t=>{e=Math.max(t.width,e),n=Math.max(t.height,n)}),{contentWidth:e,contentHeight:n}}function getFontConf(t,e,n){return(t.font?t.font[e]:"")||(n.font?n.font[e]:"")}function createMarkFont(t,e,n){var o=n.offset,a=_xeUtils.default.toValueString(t.textContent),n=_xeUtils.default.toNumber(getFontConf(t,"fontSize",n)||e)||14,[e=0,o=0]=o?_xeUtils.default.isArray(o)?o:[o,o]:[],{width:r,height:l}=calcFontWH(a,n);return{text:a,fontSize:n,font:t.font,width:r+_xeUtils.default.toNumber(e),height:l+_xeUtils.default.toNumber(o)}}function drayFont(t,e,n){var o=getFontConf(e,"fontWeight",n);t.fillStyle=""+(getFontConf(e,"color",n)||"rgba(0, 0, 0, 0.15)"),t.font=[getFontConf(e,"fontStyle",n)||"normal","bold"===o||"bolder"===o?"bold":"",(0,_dom.toCssUnit)(e.fontSize),getFontConf(e,"fontFamily",n)||"sans-serif"].join(" ")}function getContentUrl(t,e,n){let h=Object.assign({},n);n=h.rotate;let m=_xeUtils.default.toNumber(n),g=(_xeUtils.default.isArray(t)?t:[t]).map(t=>t?t.textContent?createMarkFont(t,e,h):createMarkFont({textContent:""+t},e,h):createMarkFont({textContent:""},e,h));return removeMarkElement(fontEl),new Promise(t=>{var e=getMarkCanvas();e.parentNode||document.body.append(e);let s=e.getContext("2d");if(s&&g.length){var n=h.gap,n=n?_xeUtils.default.isArray(n)?n:[n,n]:[],u=_xeUtils.default.toNumber(n[0]),n=_xeUtils.default.toNumber(n[1]);let o=calcContentWH(g).contentWidth;var c=2*o+2*u+u/2,d=2*o+n;e.width=c,e.height=d;let a=u/2,r=o+n/2,l=(s.save(),s.translate(a,r),s.rotate(m*Math.PI/180),s.translate(-a,-r),0),f=(g.forEach(t=>{drayFont(s,t,h);var e=a,n=r+l;s.fillText(t.text,e,n,o),l+=t.height}),u),i=n+o;l=0,g.forEach(t=>{drayFont(s,t,h);var e=a+f,n=r+l+i;s.fillText(t.text,e,n,o),l+=t.height}),s.restore(),t(e.toDataURL())}else t("");removeMarkElement(e)})}
|
package/package.json
CHANGED
|
@@ -71,17 +71,6 @@ function calcContentWH (contList: VxeWatermarkDefines.ContentObj[]) {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
function calcCanvasWH (contentWidth: number, opts: ContentMarkOptions) {
|
|
75
|
-
const { gap } = opts
|
|
76
|
-
const [gapX = 0, gapY = 0] = gap ? ((XEUtils.isArray(gap) ? gap : [gap, gap])) : []
|
|
77
|
-
const canvasWidth = contentWidth + XEUtils.toNumber(gapX)
|
|
78
|
-
const canvasHeight = contentWidth + XEUtils.toNumber(gapY)
|
|
79
|
-
return {
|
|
80
|
-
canvasWidth,
|
|
81
|
-
canvasHeight
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
74
|
function getFontConf (item: VxeWatermarkDefines.ContentObj | VxeWatermarkDefines.ContentConf, key: keyof VxeWatermarkPropTypes.Font, opts: ContentMarkOptions) {
|
|
86
75
|
return (item.font ? item.font[key] : '') || (opts.font ? opts.font[key] : '')
|
|
87
76
|
}
|
|
@@ -139,31 +128,46 @@ export function getContentUrl (content: VxeWatermarkPropTypes.Content, defaultFo
|
|
|
139
128
|
}
|
|
140
129
|
const ctx = canvasEl.getContext('2d')
|
|
141
130
|
if (ctx && contList.length) {
|
|
142
|
-
const {
|
|
143
|
-
const
|
|
131
|
+
const { gap } = opts
|
|
132
|
+
const gapList = gap ? ((XEUtils.isArray(gap) ? gap : [gap, gap])) : []
|
|
133
|
+
const gapX = XEUtils.toNumber(gapList[0])
|
|
134
|
+
const gapY = XEUtils.toNumber(gapList[1])
|
|
135
|
+
|
|
136
|
+
const { contentWidth } = calcContentWH(contList)
|
|
137
|
+
const canvasWidth = contentWidth * 2 + gapX * 2 + (gapX / 2)
|
|
138
|
+
const canvasHeight = contentWidth * 2 + gapY
|
|
144
139
|
|
|
145
140
|
canvasEl.width = canvasWidth
|
|
146
141
|
canvasEl.height = canvasHeight
|
|
147
142
|
|
|
148
|
-
const
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
const drayX = x + (contentWidth / 2)
|
|
152
|
-
const drayY = y + (contentHeight / 2)
|
|
143
|
+
const drayX = (gapX / 2)
|
|
144
|
+
const drayY = contentWidth + (gapY / 2)
|
|
153
145
|
|
|
154
146
|
ctx.save()
|
|
155
147
|
ctx.translate(drayX, drayY)
|
|
156
148
|
ctx.rotate(deg * Math.PI / 180)
|
|
157
149
|
ctx.translate(-drayX, -drayY)
|
|
158
150
|
|
|
159
|
-
let
|
|
151
|
+
let txtOffsetY = 0
|
|
160
152
|
contList.forEach((item) => {
|
|
161
|
-
const align = getFontConf(item, 'align', opts)
|
|
162
153
|
drayFont(ctx, item, opts)
|
|
163
|
-
|
|
164
|
-
|
|
154
|
+
const txtX = drayX
|
|
155
|
+
const txtY = drayY + txtOffsetY
|
|
156
|
+
ctx.fillText(item.text, txtX, txtY, contentWidth)
|
|
157
|
+
txtOffsetY += item.height
|
|
165
158
|
})
|
|
166
159
|
|
|
160
|
+
const offsetX = gapX
|
|
161
|
+
const offsetY = gapY + contentWidth
|
|
162
|
+
|
|
163
|
+
txtOffsetY = 0
|
|
164
|
+
contList.forEach((item) => {
|
|
165
|
+
drayFont(ctx, item, opts)
|
|
166
|
+
const txtX = drayX + offsetX
|
|
167
|
+
const txtY = drayY + txtOffsetY + offsetY
|
|
168
|
+
ctx.fillText(item.text, txtX, txtY, contentWidth)
|
|
169
|
+
txtOffsetY += item.height
|
|
170
|
+
})
|
|
167
171
|
ctx.restore()
|
|
168
172
|
|
|
169
173
|
resolve(canvasEl.toDataURL())
|
|
@@ -4136,6 +4136,7 @@ export interface TableInternalData<D = any> {
|
|
|
4136
4136
|
sourceDataRowIdData: Record<string, D>
|
|
4137
4137
|
fullColumnIdData: Record<string, VxeTableDefines.ColumnCacheItem<D>>
|
|
4138
4138
|
fullColumnFieldData: Record<string, VxeTableDefines.ColumnCacheItem<D>>
|
|
4139
|
+
fullCellHeightMaps: Record<string, Record<string, number>>
|
|
4139
4140
|
|
|
4140
4141
|
// 当前行
|
|
4141
4142
|
currentRow: D | null
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|