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
|
@@ -65,21 +65,6 @@ function calcContentWH(contList) {
|
|
|
65
65
|
contentHeight: contentHeight
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
function calcCanvasWH(contentWidth, opts) {
|
|
69
|
-
var gap = opts.gap;
|
|
70
|
-
var _ref = gap ? _xeUtils.default.isArray(gap) ? gap : [gap, gap] : [],
|
|
71
|
-
_ref2 = _slicedToArray(_ref, 2),
|
|
72
|
-
_ref2$ = _ref2[0],
|
|
73
|
-
gapX = _ref2$ === void 0 ? 0 : _ref2$,
|
|
74
|
-
_ref2$2 = _ref2[1],
|
|
75
|
-
gapY = _ref2$2 === void 0 ? 0 : _ref2$2;
|
|
76
|
-
var canvasWidth = contentWidth + _xeUtils.default.toNumber(gapX);
|
|
77
|
-
var canvasHeight = contentWidth + _xeUtils.default.toNumber(gapY);
|
|
78
|
-
return {
|
|
79
|
-
canvasWidth: canvasWidth,
|
|
80
|
-
canvasHeight: canvasHeight
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
68
|
function getFontConf(item, key, opts) {
|
|
84
69
|
return (item.font ? item.font[key] : '') || (opts.font ? opts.font[key] : '');
|
|
85
70
|
}
|
|
@@ -87,12 +72,12 @@ function createMarkFont(contConf, defaultFontSize, opts) {
|
|
|
87
72
|
var offset = opts.offset;
|
|
88
73
|
var text = _xeUtils.default.toValueString(contConf.textContent);
|
|
89
74
|
var fontSize = _xeUtils.default.toNumber(getFontConf(contConf, 'fontSize', opts) || defaultFontSize) || 14;
|
|
90
|
-
var
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
offsetX =
|
|
94
|
-
|
|
95
|
-
offsetY =
|
|
75
|
+
var _ref = offset ? _xeUtils.default.isArray(offset) ? offset : [offset, offset] : [],
|
|
76
|
+
_ref2 = _slicedToArray(_ref, 2),
|
|
77
|
+
_ref2$ = _ref2[0],
|
|
78
|
+
offsetX = _ref2$ === void 0 ? 0 : _ref2$,
|
|
79
|
+
_ref2$2 = _ref2[1],
|
|
80
|
+
offsetY = _ref2$2 === void 0 ? 0 : _ref2$2;
|
|
96
81
|
var _calcFontWH = calcFontWH(text, fontSize),
|
|
97
82
|
width = _calcFontWH.width,
|
|
98
83
|
height = _calcFontWH.height;
|
|
@@ -134,28 +119,39 @@ function getContentUrl(content, defaultFontSize, options) {
|
|
|
134
119
|
}
|
|
135
120
|
var ctx = canvasEl.getContext('2d');
|
|
136
121
|
if (ctx && contList.length) {
|
|
122
|
+
var gap = opts.gap;
|
|
123
|
+
var gapList = gap ? _xeUtils.default.isArray(gap) ? gap : [gap, gap] : [];
|
|
124
|
+
var gapX = _xeUtils.default.toNumber(gapList[0]);
|
|
125
|
+
var gapY = _xeUtils.default.toNumber(gapList[1]);
|
|
137
126
|
var _calcContentWH = calcContentWH(contList),
|
|
138
|
-
contentWidth = _calcContentWH.contentWidth
|
|
139
|
-
|
|
140
|
-
var
|
|
141
|
-
canvasWidth = _calcCanvasWH.canvasWidth,
|
|
142
|
-
canvasHeight = _calcCanvasWH.canvasHeight;
|
|
127
|
+
contentWidth = _calcContentWH.contentWidth;
|
|
128
|
+
var canvasWidth = contentWidth * 2 + gapX * 2 + gapX / 2;
|
|
129
|
+
var canvasHeight = contentWidth * 2 + gapY;
|
|
143
130
|
canvasEl.width = canvasWidth;
|
|
144
131
|
canvasEl.height = canvasHeight;
|
|
145
|
-
var
|
|
146
|
-
var
|
|
147
|
-
var drayX = x + contentWidth / 2;
|
|
148
|
-
var drayY = y + contentHeight / 2;
|
|
132
|
+
var drayX = gapX / 2;
|
|
133
|
+
var drayY = contentWidth + gapY / 2;
|
|
149
134
|
ctx.save();
|
|
150
135
|
ctx.translate(drayX, drayY);
|
|
151
136
|
ctx.rotate(deg * Math.PI / 180);
|
|
152
137
|
ctx.translate(-drayX, -drayY);
|
|
153
|
-
var
|
|
138
|
+
var txtOffsetY = 0;
|
|
139
|
+
contList.forEach(function (item) {
|
|
140
|
+
drayFont(ctx, item, opts);
|
|
141
|
+
var txtX = drayX;
|
|
142
|
+
var txtY = drayY + txtOffsetY;
|
|
143
|
+
ctx.fillText(item.text, txtX, txtY, contentWidth);
|
|
144
|
+
txtOffsetY += item.height;
|
|
145
|
+
});
|
|
146
|
+
var offsetX = gapX;
|
|
147
|
+
var offsetY = gapY + contentWidth;
|
|
148
|
+
txtOffsetY = 0;
|
|
154
149
|
contList.forEach(function (item) {
|
|
155
|
-
var align = getFontConf(item, 'align', opts);
|
|
156
150
|
drayFont(ctx, item, opts);
|
|
157
|
-
|
|
158
|
-
|
|
151
|
+
var txtX = drayX + offsetX;
|
|
152
|
+
var txtY = drayY + txtOffsetY + offsetY;
|
|
153
|
+
ctx.fillText(item.text, txtX, txtY, contentWidth);
|
|
154
|
+
txtOffsetY += item.height;
|
|
159
155
|
});
|
|
160
156
|
ctx.restore();
|
|
161
157
|
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}}function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){var n;if(t)return"string"==typeof t?_arrayLikeToArray(t,e):"Map"===(n="Object"===(n={}.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,e):void 0}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function _iterableToArrayLimit(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,a,l,i=[],
|
|
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}}function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){var n;if(t)return"string"==typeof t?_arrayLikeToArray(t,e):"Map"===(n="Object"===(n={}.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,e):void 0}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function _iterableToArrayLimit(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,a,l,i=[],f=!0,u=!1;try{if(a=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;f=!1}else for(;!(f=(r=a.call(n)).done)&&(i.push(r.value),i.length!==e);f=!0);}catch(t){u=!0,o=t}finally{try{if(!f&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw o}}return i}}function _arrayWithHoles(t){if(Array.isArray(t))return t}var 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="".concat(e,"_").concat(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){var e=0,n=0;return t.forEach(function(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 r=n.offset,o=_xeUtils.default.toValueString(t.textContent),n=_xeUtils.default.toNumber(getFontConf(t,"fontSize",n)||e)||14,e=_slicedToArray(r?_xeUtils.default.isArray(r)?r:[r,r]:[],2),r=e[0],r=void 0===r?0:r,e=e[1],e=void 0===e?0:e,a=calcFontWH(o,n),l=a.width,a=a.height;return{text:o,fontSize:n,font:t.font,width:l+_xeUtils.default.toNumber(r),height:a+_xeUtils.default.toNumber(e)}}function drayFont(t,e,n){var r=getFontConf(e,"fontWeight",n);t.fillStyle="".concat(getFontConf(e,"color",n)||"rgba(0, 0, 0, 0.15)"),t.font=[getFontConf(e,"fontStyle",n)||"normal","bold"===r||"bolder"===r?"bold":"",(0,_dom.toCssUnit)(e.fontSize),getFontConf(e,"fontFamily",n)||"sans-serif"].join(" ")}function getContentUrl(t,e,n){var d=Object.assign({},n),n=d.rotate,h=_xeUtils.default.toNumber(n),y=(_xeUtils.default.isArray(t)?t:[t]).map(function(t){return t?t.textContent?createMarkFont(t,e,d):createMarkFont({textContent:"".concat(t)},e,d):createMarkFont({textContent:""},e,d)});return removeMarkElement(fontEl),new Promise(function(t){var e,n,r,o,a,l,i,f,u,c=getMarkCanvas(),s=(c.parentNode||document.body.append(c),c.getContext("2d"));s&&y.length?(n=(n=d.gap)?_xeUtils.default.isArray(n)?n:[n,n]:[],e=_xeUtils.default.toNumber(n[0]),n=_xeUtils.default.toNumber(n[1]),o=2*(r=calcContentWH(y).contentWidth)+n,c.width=2*r+2*e+e/2,c.height=o,a=e/2,l=r+n/2,s.save(),s.translate(a,l),s.rotate(h*Math.PI/180),s.translate(-a,-l),u=0,y.forEach(function(t){drayFont(s,t,d);var e=l+u;s.fillText(t.text,a,e,r),u+=t.height}),i=e,f=n+r,u=0,y.forEach(function(t){drayFont(s,t,d);var e=l+u+f;s.fillText(t.text,a+i,e,r),u+=t.height}),s.restore(),t(c.toDataURL())):t(""),removeMarkElement(c)})}
|
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())
|
|
@@ -4165,6 +4165,7 @@ export interface TableInternalData<D = any> {
|
|
|
4165
4165
|
sourceDataRowIdData: Record<string, D>
|
|
4166
4166
|
fullColumnIdData: Record<string, VxeTableDefines.ColumnCacheItem<D>>
|
|
4167
4167
|
fullColumnFieldData: Record<string, VxeTableDefines.ColumnCacheItem<D>>
|
|
4168
|
+
fullCellHeightMaps: Record<string, Record<string, number>>
|
|
4168
4169
|
|
|
4169
4170
|
// 当前行
|
|
4170
4171
|
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
|