vant 4.1.1 → 4.2.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/es/field/Field.mjs +11 -5
- package/es/field/index.css +1 -1
- package/es/image-preview/ImagePreviewItem.mjs +1 -1
- package/es/index.d.ts +2 -1
- package/es/index.mjs +5 -2
- package/es/locale/lang/km-KH.d.ts +62 -0
- package/es/locale/lang/km-KH.mjs +64 -0
- package/es/share-sheet/ShareSheet.mjs +11 -10
- package/es/swipe/Swipe.mjs +1 -1
- package/es/text-ellipsis/TextEllipsis.d.ts +13 -0
- package/es/text-ellipsis/TextEllipsis.mjs +4 -3
- package/es/text-ellipsis/index.d.ts +9 -0
- package/es/watermark/Watermark.d.ts +112 -0
- package/es/watermark/Watermark.mjs +131 -0
- package/es/watermark/index.css +1 -0
- package/es/watermark/index.d.ts +83 -0
- package/es/watermark/index.mjs +10 -0
- package/es/watermark/style/index.d.ts +1 -0
- package/es/watermark/style/index.mjs +2 -0
- package/lib/field/Field.js +11 -5
- package/lib/field/index.css +1 -1
- package/lib/image-preview/ImagePreviewItem.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +5 -2
- package/lib/locale/lang/km-KH.d.ts +62 -0
- package/lib/locale/lang/km-KH.js +83 -0
- package/lib/share-sheet/ShareSheet.js +11 -10
- package/lib/swipe/Swipe.js +1 -1
- package/lib/text-ellipsis/TextEllipsis.d.ts +13 -0
- package/lib/text-ellipsis/TextEllipsis.js +4 -3
- package/lib/text-ellipsis/index.d.ts +9 -0
- package/lib/vant.cjs.js +1035 -899
- package/lib/vant.es.js +1036 -900
- package/lib/vant.js +1035 -899
- package/lib/vant.min.js +1 -1
- package/lib/watermark/Watermark.d.ts +112 -0
- package/lib/watermark/Watermark.js +150 -0
- package/lib/watermark/index.css +1 -0
- package/lib/watermark/index.d.ts +83 -0
- package/lib/watermark/index.js +39 -0
- package/lib/watermark/style/index.d.ts +1 -0
- package/lib/watermark/style/index.js +2 -0
- package/lib/web-types.json +1 -1
- package/package.json +7 -1
package/es/field/Field.mjs
CHANGED
@@ -279,12 +279,12 @@ var stdin_default = defineComponent({
|
|
279
279
|
}
|
280
280
|
};
|
281
281
|
const onBlur = (event) => {
|
282
|
-
if (getProp("readonly")) {
|
283
|
-
return;
|
284
|
-
}
|
285
282
|
state.focused = false;
|
286
283
|
updateValue(getModelValue(), "onBlur");
|
287
284
|
emit("blur", event);
|
285
|
+
if (getProp("readonly")) {
|
286
|
+
return;
|
287
|
+
}
|
288
288
|
validateWithTrigger("onBlur");
|
289
289
|
nextTick(adjustTextareaSize);
|
290
290
|
resetScroll();
|
@@ -307,7 +307,8 @@ var stdin_default = defineComponent({
|
|
307
307
|
});
|
308
308
|
const labelStyle = computed(() => {
|
309
309
|
const labelWidth = getProp("labelWidth");
|
310
|
-
|
310
|
+
const labelAlign = getProp("labelAlign");
|
311
|
+
if (labelWidth && labelAlign !== "top") {
|
311
312
|
return {
|
312
313
|
width: addUnit(labelWidth)
|
313
314
|
};
|
@@ -417,6 +418,8 @@ var stdin_default = defineComponent({
|
|
417
418
|
}
|
418
419
|
};
|
419
420
|
const renderLabel = () => {
|
421
|
+
const labelWidth = getProp("labelWidth");
|
422
|
+
const labelAlign = getProp("labelAlign");
|
420
423
|
const colon = getProp("colon") ? ":" : "";
|
421
424
|
if (slots.label) {
|
422
425
|
return [slots.label(), colon];
|
@@ -424,7 +427,10 @@ var stdin_default = defineComponent({
|
|
424
427
|
if (props.label) {
|
425
428
|
return _createVNode("label", {
|
426
429
|
"id": `${id}-label`,
|
427
|
-
"for": getInputId()
|
430
|
+
"for": getInputId(),
|
431
|
+
"style": labelAlign === "top" && labelWidth ? {
|
432
|
+
width: addUnit(labelWidth)
|
433
|
+
} : void 0
|
428
434
|
}, [props.label + colon]);
|
429
435
|
}
|
430
436
|
};
|
package/es/field/index.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
:root{--van-field-label-width: 6.2em;--van-field-label-color: var(--van-text-color);--van-field-label-margin-right: var(--van-padding-sm);--van-field-input-text-color: var(--van-text-color);--van-field-input-error-text-color: var(--van-danger-color);--van-field-input-disabled-text-color: var(--van-text-color-3);--van-field-placeholder-text-color: var(--van-text-color-3);--van-field-icon-size: 16px;--van-field-clear-icon-size: 16px;--van-field-clear-icon-color: var(--van-gray-5);--van-field-right-icon-color: var(--van-gray-6);--van-field-error-message-color: var(--van-danger-color);--van-field-error-message-font-size: 12px;--van-field-text-area-min-height: 60px;--van-field-word-limit-color: var(--van-gray-7);--van-field-word-limit-font-size: var(--van-font-size-sm);--van-field-word-limit-line-height: 16px;--van-field-disabled-text-color: var(--van-text-color-3);--van-field-required-mark-color: var(--van-red)}.van-field{flex-wrap:wrap}.van-
|
1
|
+
:root{--van-field-label-width: 6.2em;--van-field-label-color: var(--van-text-color);--van-field-label-margin-right: var(--van-padding-sm);--van-field-input-text-color: var(--van-text-color);--van-field-input-error-text-color: var(--van-danger-color);--van-field-input-disabled-text-color: var(--van-text-color-3);--van-field-placeholder-text-color: var(--van-text-color-3);--van-field-icon-size: 16px;--van-field-clear-icon-size: 16px;--van-field-clear-icon-color: var(--van-gray-5);--van-field-right-icon-color: var(--van-gray-6);--van-field-error-message-color: var(--van-danger-color);--van-field-error-message-font-size: 12px;--van-field-text-area-min-height: 60px;--van-field-word-limit-color: var(--van-gray-7);--van-field-word-limit-font-size: var(--van-font-size-sm);--van-field-word-limit-line-height: 16px;--van-field-disabled-text-color: var(--van-text-color-3);--van-field-required-mark-color: var(--van-red)}.van-field{flex-wrap:wrap}.van-field__label{flex:none;box-sizing:border-box;width:var(--van-field-label-width);margin-right:var(--van-field-label-margin-right);color:var(--van-field-label-color);text-align:left;word-wrap:break-word}.van-field__label--center{text-align:center}.van-field__label--right{text-align:right}.van-field__label--top{display:flex;width:100%;text-align:left;margin-bottom:var(--van-padding-base);word-break:break-word}.van-field__label--required:before{margin-right:2px;color:var(--van-field-required-mark-color);content:"*"}.van-field--disabled .van-field__label{color:var(--van-field-disabled-text-color)}.van-field__value{overflow:visible}.van-field__body{display:flex;align-items:center}.van-field__control{display:block;box-sizing:border-box;width:100%;min-width:0;margin:0;padding:0;color:var(--van-field-input-text-color);line-height:inherit;text-align:left;background-color:transparent;border:0;resize:none;-webkit-user-select:auto;user-select:auto}.van-field__control::-webkit-input-placeholder{color:var(--van-field-placeholder-text-color)}.van-field__control::placeholder{color:var(--van-field-placeholder-text-color)}.van-field__control:disabled{color:var(--van-field-input-disabled-text-color);cursor:not-allowed;opacity:1;-webkit-text-fill-color:var(--van-field-input-disabled-text-color)}.van-field__control:read-only{cursor:default}.van-field__control--center{justify-content:center;text-align:center}.van-field__control--right{justify-content:flex-end;text-align:right}.van-field__control--custom{display:flex;align-items:center;min-height:var(--van-cell-line-height)}.van-field__control--error::-webkit-input-placeholder{color:var(--van-field-input-error-text-color);-webkit-text-fill-color:currentColor}.van-field__control--error,.van-field__control--error::placeholder{color:var(--van-field-input-error-text-color);-webkit-text-fill-color:currentColor}.van-field__control--min-height{min-height:var(--van-field-text-area-min-height)}.van-field__control[type=date],.van-field__control[type=time],.van-field__control[type=datetime-local]{min-height:var(--van-cell-line-height)}.van-field__control[type=search]{-webkit-appearance:none}.van-field__clear,.van-field__icon,.van-field__button,.van-field__right-icon{flex-shrink:0}.van-field__clear,.van-field__right-icon{margin-right:calc(var(--van-padding-xs) * -1);padding:0 var(--van-padding-xs);line-height:inherit}.van-field__clear{color:var(--van-field-clear-icon-color);font-size:var(--van-field-clear-icon-size);cursor:pointer}.van-field__left-icon .van-icon,.van-field__right-icon .van-icon{display:block;font-size:var(--van-field-icon-size);line-height:inherit}.van-field__left-icon{margin-right:var(--van-padding-base)}.van-field__right-icon{color:var(--van-field-right-icon-color)}.van-field__button{padding-left:var(--van-padding-xs)}.van-field__error-message{color:var(--van-field-error-message-color);font-size:var(--van-field-error-message-font-size);text-align:left}.van-field__error-message--center{text-align:center}.van-field__error-message--right{text-align:right}.van-field__word-limit{margin-top:var(--van-padding-base);color:var(--van-field-word-limit-color);font-size:var(--van-field-word-limit-font-size);line-height:var(--van-field-word-limit-line-height);text-align:right}
|
@@ -148,7 +148,7 @@ var stdin_default = defineComponent({
|
|
148
148
|
} = touch;
|
149
149
|
const moveX = deltaX.value + startMoveX;
|
150
150
|
const moveY = deltaY.value + startMoveY;
|
151
|
-
if ((moveX > maxMoveX.value || moveX < -maxMoveX.value) && !isImageMoved) {
|
151
|
+
if ((moveX > maxMoveX.value || moveX < -maxMoveX.value) && !isImageMoved && touch.isHorizontal()) {
|
152
152
|
state.moving = false;
|
153
153
|
return;
|
154
154
|
}
|
package/es/index.d.ts
CHANGED
@@ -93,10 +93,11 @@ export * from "./time-picker";
|
|
93
93
|
export * from "./toast";
|
94
94
|
export * from "./tree-select";
|
95
95
|
export * from "./uploader";
|
96
|
+
export * from "./watermark";
|
96
97
|
declare namespace _default {
|
97
98
|
export { install };
|
98
99
|
export { version };
|
99
100
|
}
|
100
101
|
export default _default;
|
101
102
|
export function install(app: any): void;
|
102
|
-
export const version: "4.
|
103
|
+
export const version: "4.2.0";
|
package/es/index.mjs
CHANGED
@@ -92,7 +92,8 @@ import { TimePicker } from "./time-picker/index.mjs";
|
|
92
92
|
import { Toast } from "./toast/index.mjs";
|
93
93
|
import { TreeSelect } from "./tree-select/index.mjs";
|
94
94
|
import { Uploader } from "./uploader/index.mjs";
|
95
|
-
|
95
|
+
import { Watermark } from "./watermark/index.mjs";
|
96
|
+
const version = "4.2.0";
|
96
97
|
function install(app) {
|
97
98
|
const components = [
|
98
99
|
ActionBar,
|
@@ -188,7 +189,8 @@ function install(app) {
|
|
188
189
|
TimePicker,
|
189
190
|
Toast,
|
190
191
|
TreeSelect,
|
191
|
-
Uploader
|
192
|
+
Uploader,
|
193
|
+
Watermark
|
192
194
|
];
|
193
195
|
components.forEach((item) => {
|
194
196
|
if (item.install) {
|
@@ -293,6 +295,7 @@ export * from "./time-picker/index.mjs";
|
|
293
295
|
export * from "./toast/index.mjs";
|
294
296
|
export * from "./tree-select/index.mjs";
|
295
297
|
export * from "./uploader/index.mjs";
|
298
|
+
export * from "./watermark/index.mjs";
|
296
299
|
var stdin_default = {
|
297
300
|
install,
|
298
301
|
version
|
@@ -0,0 +1,62 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
name: string;
|
3
|
+
tel: string;
|
4
|
+
save: string;
|
5
|
+
confirm: string;
|
6
|
+
cancel: string;
|
7
|
+
delete: string;
|
8
|
+
loading: string;
|
9
|
+
noCoupon: string;
|
10
|
+
nameEmpty: string;
|
11
|
+
addContact: string;
|
12
|
+
telInvalid: string;
|
13
|
+
vanCalendar: {
|
14
|
+
end: string;
|
15
|
+
start: string;
|
16
|
+
title: string;
|
17
|
+
weekdays: string[];
|
18
|
+
monthTitle: (year: number, month: number) => string;
|
19
|
+
rangePrompt: (maxRange: number) => string;
|
20
|
+
};
|
21
|
+
vanCascader: {
|
22
|
+
select: string;
|
23
|
+
};
|
24
|
+
vanPagination: {
|
25
|
+
prev: string;
|
26
|
+
next: string;
|
27
|
+
};
|
28
|
+
vanPullRefresh: {
|
29
|
+
pulling: string;
|
30
|
+
loosing: string;
|
31
|
+
};
|
32
|
+
vanSubmitBar: {
|
33
|
+
label: string;
|
34
|
+
};
|
35
|
+
vanCoupon: {
|
36
|
+
unlimited: string;
|
37
|
+
discount: (discount: number) => string;
|
38
|
+
condition: (condition: number) => string;
|
39
|
+
};
|
40
|
+
vanCouponCell: {
|
41
|
+
title: string;
|
42
|
+
count: (count: number) => string;
|
43
|
+
};
|
44
|
+
vanCouponList: {
|
45
|
+
exchange: string;
|
46
|
+
close: string;
|
47
|
+
enable: string;
|
48
|
+
disabled: string;
|
49
|
+
placeholder: string;
|
50
|
+
};
|
51
|
+
vanAddressEdit: {
|
52
|
+
area: string;
|
53
|
+
areaEmpty: string;
|
54
|
+
addressEmpty: string;
|
55
|
+
addressDetail: string;
|
56
|
+
defaultAddress: string;
|
57
|
+
};
|
58
|
+
vanAddressList: {
|
59
|
+
add: string;
|
60
|
+
};
|
61
|
+
};
|
62
|
+
export default _default;
|
@@ -0,0 +1,64 @@
|
|
1
|
+
var stdin_default = {
|
2
|
+
name: "\u1788\u17D2\u1798\u17C4\u17C7",
|
3
|
+
tel: "\u1791\u17BC\u179A\u179F\u17D0\u1796\u17D2\u1791",
|
4
|
+
save: "\u179A\u1780\u17D2\u179F\u17B6\u1791\u17BB\u1780",
|
5
|
+
confirm: "\u1799\u179B\u17CB\u1796\u17D2\u179A\u1798",
|
6
|
+
cancel: "\u1794\u17C4\u17C7\u1794\u1784\u17CB",
|
7
|
+
delete: "\u179B\u17BB\u1794",
|
8
|
+
loading: "\u1780\u17C6\u1796\u17BB\u1784\u200B\u1795\u17D2\u1791\u17BB\u1780...",
|
9
|
+
noCoupon: "\u1782\u17D2\u1798\u17B6\u1793\u1782\u17BC\u1794\u17C9\u17BB\u1784",
|
10
|
+
nameEmpty: "\u179F\u17BC\u1798\u1794\u17C6\u1796\u17C1\u1789\u1788\u17D2\u1798\u17C4\u17C7",
|
11
|
+
addContact: "\u1794\u1793\u17D2\u1790\u17C2\u1798\u1791\u17C6\u1793\u17B6\u1780\u17CB\u1791\u17C6\u1793\u1784",
|
12
|
+
telInvalid: "\u179B\u17C1\u1781\u1791\u17BC\u179A\u179F\u17D0\u1796\u17D2\u1791\u1798\u17B7\u1793\u178F\u17D2\u179A\u17BC\u179C\u1791\u1798\u17D2\u179A\u1784\u17CB",
|
13
|
+
vanCalendar: {
|
14
|
+
end: "\u1794\u1789\u17D2\u1785\u1794\u17CB",
|
15
|
+
start: "\u1785\u17B6\u1794\u17CB\u1796\u17B8",
|
16
|
+
title: "\u1794\u17D2\u179A\u178F\u17B7\u1791\u17B7\u1793",
|
17
|
+
weekdays: ["\u17A2\u17B6", "\u1785", "\u17A2", "\u1796", "\u1796\u17D2\u179A", "\u179F\u17BB", "\u179F\u17C5"],
|
18
|
+
monthTitle: (year, month) => `${year}/${month}`,
|
19
|
+
rangePrompt: (maxRange) => `\u1787\u17D2\u179A\u17BE\u179F\u179A\u17BE\u179F\u1798\u17B7\u1793\u179B\u17BE\u179F\u1796\u17B8 ${maxRange} \u1790\u17D2\u1784\u17C3`
|
20
|
+
},
|
21
|
+
vanCascader: {
|
22
|
+
select: "\u1787\u17D2\u179A\u17BE\u179F\u179A\u17BE\u179F"
|
23
|
+
},
|
24
|
+
vanPagination: {
|
25
|
+
prev: "\u1798\u17BB\u1793",
|
26
|
+
next: "\u1794\u1793\u17D2\u1791\u17B6\u1794\u17CB"
|
27
|
+
},
|
28
|
+
vanPullRefresh: {
|
29
|
+
pulling: "\u1791\u17B6\u1789\u178A\u17BE\u1798\u17D2\u1794\u17B8\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u17A1\u17BE\u1784\u179C\u17B7\u1789...",
|
30
|
+
loosing: "\u1796\u17D2\u179A\u179B\u17C2\u1784\u178A\u17BE\u1798\u17D2\u1794\u17B8\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u17A1\u17BE\u1784\u179C\u17B7\u1789..."
|
31
|
+
},
|
32
|
+
vanSubmitBar: {
|
33
|
+
label: "\u179F\u179A\u17BB\u1794:"
|
34
|
+
},
|
35
|
+
vanCoupon: {
|
36
|
+
unlimited: "\u1782\u17D2\u1798\u17B6\u1793\u178A\u17C2\u1793\u1780\u17C6\u178E\u178F\u17CB",
|
37
|
+
discount: (discount) => `\u1794\u1789\u17D2\u1785\u17BB\u17C7\u178F\u1798\u17D2\u179B\u17C3 ${discount * 10}%`,
|
38
|
+
condition: (condition) => `\u1799\u17C9\u17B6\u1784\u178F\u17B7\u1785 ${condition}`
|
39
|
+
},
|
40
|
+
vanCouponCell: {
|
41
|
+
title: "\u1782\u17BC\u1794\u17C9\u17BB\u1784",
|
42
|
+
count: (count) => `\u17A2\u17D2\u1793\u1780\u1798\u17B6\u1793 ${count}\u1782\u17BC\u1794\u17C9\u17BB\u1784`
|
43
|
+
},
|
44
|
+
vanCouponList: {
|
45
|
+
exchange: "\u1794\u17D2\u178A\u17BC\u179A",
|
46
|
+
close: "\u1794\u17B7\u1791",
|
47
|
+
enable: "\u1794\u17D2\u179A\u17BE\u1794\u17B6\u1793",
|
48
|
+
disabled: "\u1798\u17B7\u1793\u17A2\u17B6\u1785\u1794\u17D2\u179A\u17BE\u1794\u17B6\u1793",
|
49
|
+
placeholder: "\u179B\u17C1\u1781\u1780\u17BC\u178A\u1782\u17BC\u1794\u17C9\u17BB\u1784"
|
50
|
+
},
|
51
|
+
vanAddressEdit: {
|
52
|
+
area: "\u1791\u17B8\u178F\u17B6\u17C6\u1784",
|
53
|
+
areaEmpty: "\u179F\u17BC\u1798\u1787\u17D2\u179A\u17BE\u179F\u179A\u17BE\u179F\u1791\u17B8\u178F\u17B6\u17C6\u1784\u1791\u1791\u17BD\u179B",
|
54
|
+
addressEmpty: "\u178F\u1798\u17D2\u179A\u17BC\u179C\u17A2\u17C4\u1799\u1798\u17B6\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793",
|
55
|
+
addressDetail: "\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793",
|
56
|
+
defaultAddress: "\u178A\u17B6\u1780\u17CB\u1787\u17B6\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u178A\u17BE\u1798"
|
57
|
+
},
|
58
|
+
vanAddressList: {
|
59
|
+
add: "\u1794\u1793\u17D2\u1790\u17C2\u1798\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u1790\u17D2\u1798\u17B8"
|
60
|
+
}
|
61
|
+
};
|
62
|
+
export {
|
63
|
+
stdin_default as default
|
64
|
+
};
|
@@ -4,6 +4,7 @@ import { pick, extend, truthProp, makeArrayProp, createNamespace, HAPTICS_FEEDBA
|
|
4
4
|
import { popupSharedProps, popupSharedPropKeys } from "../popup/shared.mjs";
|
5
5
|
import { Icon } from "../icon/index.mjs";
|
6
6
|
import { Popup } from "../popup/index.mjs";
|
7
|
+
const isImage = (name2) => name2 == null ? void 0 : name2.includes("/");
|
7
8
|
const popupInheritKeys = [...popupSharedPropKeys, "round", "closeOnPopstate", "safeAreaInsetBottom"];
|
8
9
|
const iconMap = {
|
9
10
|
qq: "qq",
|
@@ -53,17 +54,17 @@ var stdin_default = defineComponent({
|
|
53
54
|
}
|
54
55
|
};
|
55
56
|
const renderIcon = (icon) => {
|
56
|
-
if (
|
57
|
-
return _createVNode("
|
58
|
-
"
|
59
|
-
|
60
|
-
|
61
|
-
}, null)]);
|
57
|
+
if (isImage(icon)) {
|
58
|
+
return _createVNode("img", {
|
59
|
+
"src": icon,
|
60
|
+
"class": bem("image-icon")
|
61
|
+
}, null);
|
62
62
|
}
|
63
|
-
return _createVNode("
|
64
|
-
"
|
65
|
-
|
66
|
-
|
63
|
+
return _createVNode("div", {
|
64
|
+
"class": bem("icon", [icon])
|
65
|
+
}, [_createVNode(Icon, {
|
66
|
+
"name": iconMap[icon] || icon
|
67
|
+
}, null)]);
|
67
68
|
};
|
68
69
|
const renderOption = (option, index) => {
|
69
70
|
const {
|
package/es/swipe/Swipe.mjs
CHANGED
@@ -336,7 +336,7 @@ var stdin_default = defineComponent({
|
|
336
336
|
watch(() => props.initialSwipe, (value) => initialize(+value));
|
337
337
|
watch(count, () => initialize(state.active));
|
338
338
|
watch(() => props.autoplay, autoplay);
|
339
|
-
watch([windowWidth, windowHeight], resize);
|
339
|
+
watch([windowWidth, windowHeight, () => props.width, () => props.height], resize);
|
340
340
|
watch(usePageVisibility(), (visible) => {
|
341
341
|
if (visible === "visible") {
|
342
342
|
autoplay();
|
@@ -4,6 +4,10 @@ export declare const textEllipsisProps: {
|
|
4
4
|
type: (NumberConstructor | StringConstructor)[];
|
5
5
|
default: number;
|
6
6
|
};
|
7
|
+
dots: {
|
8
|
+
type: import("vue").PropType<string>;
|
9
|
+
default: string;
|
10
|
+
};
|
7
11
|
content: {
|
8
12
|
type: import("vue").PropType<string>;
|
9
13
|
default: string;
|
@@ -23,6 +27,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
23
27
|
type: (NumberConstructor | StringConstructor)[];
|
24
28
|
default: number;
|
25
29
|
};
|
30
|
+
dots: {
|
31
|
+
type: import("vue").PropType<string>;
|
32
|
+
default: string;
|
33
|
+
};
|
26
34
|
content: {
|
27
35
|
type: import("vue").PropType<string>;
|
28
36
|
default: string;
|
@@ -40,6 +48,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
40
48
|
type: (NumberConstructor | StringConstructor)[];
|
41
49
|
default: number;
|
42
50
|
};
|
51
|
+
dots: {
|
52
|
+
type: import("vue").PropType<string>;
|
53
|
+
default: string;
|
54
|
+
};
|
43
55
|
content: {
|
44
56
|
type: import("vue").PropType<string>;
|
45
57
|
default: string;
|
@@ -57,6 +69,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
57
69
|
}, {
|
58
70
|
content: string;
|
59
71
|
rows: string | number;
|
72
|
+
dots: string;
|
60
73
|
expandText: string;
|
61
74
|
collapseText: string;
|
62
75
|
}>;
|
@@ -5,6 +5,7 @@ import { makeNumericProp, makeStringProp, createNamespace } from "../utils/index
|
|
5
5
|
const [name, bem] = createNamespace("text-ellipsis");
|
6
6
|
const textEllipsisProps = {
|
7
7
|
rows: makeNumericProp(1),
|
8
|
+
dots: makeStringProp("..."),
|
8
9
|
content: makeStringProp(""),
|
9
10
|
expandText: makeStringProp(""),
|
10
11
|
collapseText: makeStringProp("")
|
@@ -48,16 +49,16 @@ var stdin_default = defineComponent({
|
|
48
49
|
};
|
49
50
|
const calcEllipsisText = (container2, maxHeight2) => {
|
50
51
|
const {
|
52
|
+
dots,
|
51
53
|
content,
|
52
54
|
expandText
|
53
55
|
} = props;
|
54
|
-
const dot = "...";
|
55
56
|
let left = 0;
|
56
57
|
let right = content.length;
|
57
58
|
let res = -1;
|
58
59
|
while (left <= right) {
|
59
60
|
const mid = Math.floor((left + right) / 2);
|
60
|
-
container2.innerText = content.slice(0, mid) +
|
61
|
+
container2.innerText = content.slice(0, mid) + dots + expandText;
|
61
62
|
if (container2.offsetHeight <= maxHeight2) {
|
62
63
|
left = mid + 1;
|
63
64
|
res = mid;
|
@@ -65,7 +66,7 @@ var stdin_default = defineComponent({
|
|
65
66
|
right = mid - 1;
|
66
67
|
}
|
67
68
|
}
|
68
|
-
return content.slice(0, res) +
|
69
|
+
return content.slice(0, res) + dots;
|
69
70
|
};
|
70
71
|
const container = cloneContainer();
|
71
72
|
if (!container)
|
@@ -3,6 +3,10 @@ export declare const TextEllipsis: import("../utils").WithInstall<import("vue").
|
|
3
3
|
type: (NumberConstructor | StringConstructor)[];
|
4
4
|
default: number;
|
5
5
|
};
|
6
|
+
dots: {
|
7
|
+
type: import("vue").PropType<string>;
|
8
|
+
default: string;
|
9
|
+
};
|
6
10
|
content: {
|
7
11
|
type: import("vue").PropType<string>;
|
8
12
|
default: string;
|
@@ -20,6 +24,10 @@ export declare const TextEllipsis: import("../utils").WithInstall<import("vue").
|
|
20
24
|
type: (NumberConstructor | StringConstructor)[];
|
21
25
|
default: number;
|
22
26
|
};
|
27
|
+
dots: {
|
28
|
+
type: import("vue").PropType<string>;
|
29
|
+
default: string;
|
30
|
+
};
|
23
31
|
content: {
|
24
32
|
type: import("vue").PropType<string>;
|
25
33
|
default: string;
|
@@ -37,6 +45,7 @@ export declare const TextEllipsis: import("../utils").WithInstall<import("vue").
|
|
37
45
|
}, {
|
38
46
|
content: string;
|
39
47
|
rows: string | number;
|
48
|
+
dots: string;
|
40
49
|
expandText: string;
|
41
50
|
collapseText: string;
|
42
51
|
}>>;
|
@@ -0,0 +1,112 @@
|
|
1
|
+
import { type ExtractPropTypes } from 'vue';
|
2
|
+
export declare const watermarkProps: {
|
3
|
+
gapX: {
|
4
|
+
type: NumberConstructor;
|
5
|
+
default: number;
|
6
|
+
};
|
7
|
+
gapY: {
|
8
|
+
type: NumberConstructor;
|
9
|
+
default: number;
|
10
|
+
};
|
11
|
+
image: StringConstructor;
|
12
|
+
width: {
|
13
|
+
type: NumberConstructor;
|
14
|
+
default: number;
|
15
|
+
};
|
16
|
+
height: {
|
17
|
+
type: NumberConstructor;
|
18
|
+
default: number;
|
19
|
+
};
|
20
|
+
rotate: {
|
21
|
+
type: (NumberConstructor | StringConstructor)[];
|
22
|
+
default: number;
|
23
|
+
};
|
24
|
+
zIndex: (NumberConstructor | StringConstructor)[];
|
25
|
+
content: StringConstructor;
|
26
|
+
opacity: (NumberConstructor | StringConstructor)[];
|
27
|
+
fullPage: {
|
28
|
+
type: BooleanConstructor;
|
29
|
+
default: true;
|
30
|
+
};
|
31
|
+
textColor: {
|
32
|
+
type: import("vue").PropType<string>;
|
33
|
+
default: string;
|
34
|
+
};
|
35
|
+
};
|
36
|
+
export type WatermarkProps = ExtractPropTypes<typeof watermarkProps>;
|
37
|
+
declare const _default: import("vue").DefineComponent<{
|
38
|
+
gapX: {
|
39
|
+
type: NumberConstructor;
|
40
|
+
default: number;
|
41
|
+
};
|
42
|
+
gapY: {
|
43
|
+
type: NumberConstructor;
|
44
|
+
default: number;
|
45
|
+
};
|
46
|
+
image: StringConstructor;
|
47
|
+
width: {
|
48
|
+
type: NumberConstructor;
|
49
|
+
default: number;
|
50
|
+
};
|
51
|
+
height: {
|
52
|
+
type: NumberConstructor;
|
53
|
+
default: number;
|
54
|
+
};
|
55
|
+
rotate: {
|
56
|
+
type: (NumberConstructor | StringConstructor)[];
|
57
|
+
default: number;
|
58
|
+
};
|
59
|
+
zIndex: (NumberConstructor | StringConstructor)[];
|
60
|
+
content: StringConstructor;
|
61
|
+
opacity: (NumberConstructor | StringConstructor)[];
|
62
|
+
fullPage: {
|
63
|
+
type: BooleanConstructor;
|
64
|
+
default: true;
|
65
|
+
};
|
66
|
+
textColor: {
|
67
|
+
type: import("vue").PropType<string>;
|
68
|
+
default: string;
|
69
|
+
};
|
70
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
71
|
+
gapX: {
|
72
|
+
type: NumberConstructor;
|
73
|
+
default: number;
|
74
|
+
};
|
75
|
+
gapY: {
|
76
|
+
type: NumberConstructor;
|
77
|
+
default: number;
|
78
|
+
};
|
79
|
+
image: StringConstructor;
|
80
|
+
width: {
|
81
|
+
type: NumberConstructor;
|
82
|
+
default: number;
|
83
|
+
};
|
84
|
+
height: {
|
85
|
+
type: NumberConstructor;
|
86
|
+
default: number;
|
87
|
+
};
|
88
|
+
rotate: {
|
89
|
+
type: (NumberConstructor | StringConstructor)[];
|
90
|
+
default: number;
|
91
|
+
};
|
92
|
+
zIndex: (NumberConstructor | StringConstructor)[];
|
93
|
+
content: StringConstructor;
|
94
|
+
opacity: (NumberConstructor | StringConstructor)[];
|
95
|
+
fullPage: {
|
96
|
+
type: BooleanConstructor;
|
97
|
+
default: true;
|
98
|
+
};
|
99
|
+
textColor: {
|
100
|
+
type: import("vue").PropType<string>;
|
101
|
+
default: string;
|
102
|
+
};
|
103
|
+
}>>, {
|
104
|
+
width: number;
|
105
|
+
height: number;
|
106
|
+
textColor: string;
|
107
|
+
rotate: string | number;
|
108
|
+
gapX: number;
|
109
|
+
gapY: number;
|
110
|
+
fullPage: boolean;
|
111
|
+
}>;
|
112
|
+
export default _default;
|
@@ -0,0 +1,131 @@
|
|
1
|
+
import { createVNode as _createVNode } from "vue";
|
2
|
+
import { defineComponent, nextTick, onUnmounted, ref, watch, watchEffect } from "vue";
|
3
|
+
import { extend, truthProp, numericProp, createNamespace, getZIndexStyle, makeNumberProp, makeNumericProp, makeStringProp } from "../utils/index.mjs";
|
4
|
+
const [name, bem] = createNamespace("watermark");
|
5
|
+
const watermarkProps = {
|
6
|
+
gapX: makeNumberProp(0),
|
7
|
+
gapY: makeNumberProp(0),
|
8
|
+
image: String,
|
9
|
+
width: makeNumberProp(100),
|
10
|
+
height: makeNumberProp(100),
|
11
|
+
rotate: makeNumericProp(-22),
|
12
|
+
zIndex: numericProp,
|
13
|
+
content: String,
|
14
|
+
opacity: numericProp,
|
15
|
+
fullPage: truthProp,
|
16
|
+
textColor: makeStringProp("#dcdee0")
|
17
|
+
};
|
18
|
+
var stdin_default = defineComponent({
|
19
|
+
name,
|
20
|
+
props: watermarkProps,
|
21
|
+
setup(props, {
|
22
|
+
slots
|
23
|
+
}) {
|
24
|
+
const svgElRef = ref();
|
25
|
+
const watermarkUrl = ref("");
|
26
|
+
const imageBase64 = ref("");
|
27
|
+
const renderWatermark = () => {
|
28
|
+
const rotateStyle = {
|
29
|
+
transformOrigin: "center",
|
30
|
+
transform: `rotate(${props.rotate}deg)`
|
31
|
+
};
|
32
|
+
const svgInner = () => {
|
33
|
+
if (props.image && !slots.content) {
|
34
|
+
return _createVNode("image", {
|
35
|
+
"href": imageBase64.value,
|
36
|
+
"x": "0",
|
37
|
+
"y": "0",
|
38
|
+
"width": props.width,
|
39
|
+
"height": props.height,
|
40
|
+
"style": rotateStyle
|
41
|
+
}, null);
|
42
|
+
}
|
43
|
+
return _createVNode("foreignObject", {
|
44
|
+
"x": "0",
|
45
|
+
"y": "0",
|
46
|
+
"width": props.width,
|
47
|
+
"height": props.height
|
48
|
+
}, [_createVNode("div", {
|
49
|
+
"xmlns": "http://www.w3.org/1999/xhtml",
|
50
|
+
"style": rotateStyle
|
51
|
+
}, [slots.content ? slots.content() : _createVNode("span", {
|
52
|
+
"style": {
|
53
|
+
color: props.textColor
|
54
|
+
}
|
55
|
+
}, [props.content])])]);
|
56
|
+
};
|
57
|
+
const svgWidth = props.width + props.gapX;
|
58
|
+
const svgHeight = props.height + props.gapY;
|
59
|
+
return _createVNode("svg", {
|
60
|
+
"viewBox": `0 0 ${svgWidth} ${svgHeight}`,
|
61
|
+
"width": svgWidth,
|
62
|
+
"height": svgHeight,
|
63
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
64
|
+
"style": {
|
65
|
+
padding: `0 ${props.gapX}px ${props.gapY}px 0`,
|
66
|
+
opacity: props.opacity
|
67
|
+
}
|
68
|
+
}, [svgInner()]);
|
69
|
+
};
|
70
|
+
const makeImageToBase64 = (url) => {
|
71
|
+
const canvas = document.createElement("canvas");
|
72
|
+
const image = new Image();
|
73
|
+
image.crossOrigin = "anonymous";
|
74
|
+
image.referrerPolicy = "no-referrer";
|
75
|
+
image.onload = () => {
|
76
|
+
canvas.width = image.naturalWidth;
|
77
|
+
canvas.height = image.naturalHeight;
|
78
|
+
const ctx = canvas.getContext("2d");
|
79
|
+
ctx == null ? void 0 : ctx.drawImage(image, 0, 0);
|
80
|
+
imageBase64.value = canvas.toDataURL();
|
81
|
+
};
|
82
|
+
image.src = url;
|
83
|
+
};
|
84
|
+
const makeSvgToBlobUrl = (svgStr) => {
|
85
|
+
const svgBlob = new Blob([svgStr], {
|
86
|
+
type: "image/svg+xml;charset=utf-8"
|
87
|
+
});
|
88
|
+
return URL.createObjectURL(svgBlob);
|
89
|
+
};
|
90
|
+
watchEffect(() => {
|
91
|
+
if (props.image) {
|
92
|
+
makeImageToBase64(props.image);
|
93
|
+
}
|
94
|
+
});
|
95
|
+
watch(() => [imageBase64.value, props.content, props.textColor, props.height, props.width, props.rotate, props.gapX, props.gapY], () => {
|
96
|
+
nextTick(() => {
|
97
|
+
if (svgElRef.value) {
|
98
|
+
if (watermarkUrl.value) {
|
99
|
+
URL.revokeObjectURL(watermarkUrl.value);
|
100
|
+
}
|
101
|
+
watermarkUrl.value = makeSvgToBlobUrl(svgElRef.value.innerHTML);
|
102
|
+
}
|
103
|
+
});
|
104
|
+
}, {
|
105
|
+
immediate: true
|
106
|
+
});
|
107
|
+
onUnmounted(() => {
|
108
|
+
if (watermarkUrl.value) {
|
109
|
+
URL.revokeObjectURL(watermarkUrl.value);
|
110
|
+
}
|
111
|
+
});
|
112
|
+
return () => {
|
113
|
+
const style = extend({
|
114
|
+
backgroundImage: `url(${watermarkUrl.value})`
|
115
|
+
}, getZIndexStyle(props.zIndex));
|
116
|
+
return _createVNode("div", {
|
117
|
+
"class": bem({
|
118
|
+
full: props.fullPage
|
119
|
+
}),
|
120
|
+
"style": style
|
121
|
+
}, [_createVNode("div", {
|
122
|
+
"class": bem("wrapper"),
|
123
|
+
"ref": svgElRef
|
124
|
+
}, [renderWatermark()])]);
|
125
|
+
};
|
126
|
+
}
|
127
|
+
});
|
128
|
+
export {
|
129
|
+
stdin_default as default,
|
130
|
+
watermarkProps
|
131
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
:root{--van-watermark-z-index: 100}.van-watermark{position:absolute;height:100%;width:100%;left:0;top:0;z-index:var(--van-watermark-z-index);background-repeat:repeat;pointer-events:none}.van-watermark__wrapper{display:none}.van-watermark--full{position:fixed}
|