vant 4.6.1 → 4.6.2
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/README.md +1 -1
- package/es/checkbox/Checkbox.d.ts +14 -13
- package/es/checkbox/Checkbox.mjs +2 -1
- package/es/checkbox/Checker.d.ts +9 -13
- package/es/checkbox/Checker.mjs +13 -3
- package/es/checkbox/index.d.ts +8 -8
- package/es/field/Field.d.ts +25 -0
- package/es/field/Field.mjs +9 -0
- package/es/field/index.d.ts +13 -0
- package/es/floating-bubble/FloatingBubble.d.ts +16 -21
- package/es/floating-bubble/FloatingBubble.mjs +6 -8
- package/es/floating-bubble/index.css +1 -1
- package/es/floating-bubble/index.d.ts +18 -18
- package/es/floating-bubble/types.d.ts +12 -0
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/pagination/index.css +1 -1
- package/es/radio/Radio.d.ts +18 -15
- package/es/radio/Radio.mjs +5 -3
- package/es/radio/index.css +1 -1
- package/es/radio/index.d.ts +11 -9
- package/es/radio/types.d.ts +1 -0
- package/es/search/Search.d.ts +19 -0
- package/es/search/index.d.ts +13 -0
- package/es/text-ellipsis/TextEllipsis.d.ts +13 -0
- package/es/text-ellipsis/TextEllipsis.mjs +50 -19
- package/es/text-ellipsis/index.d.ts +9 -0
- package/lib/checkbox/Checkbox.d.ts +14 -13
- package/lib/checkbox/Checkbox.js +1 -0
- package/lib/checkbox/Checker.d.ts +9 -13
- package/lib/checkbox/Checker.js +13 -3
- package/lib/checkbox/index.d.ts +8 -8
- package/lib/field/Field.d.ts +25 -0
- package/lib/field/Field.js +9 -0
- package/lib/field/index.d.ts +13 -0
- package/lib/floating-bubble/FloatingBubble.d.ts +16 -21
- package/lib/floating-bubble/FloatingBubble.js +6 -8
- package/lib/floating-bubble/index.css +1 -1
- package/lib/floating-bubble/index.d.ts +18 -18
- package/lib/floating-bubble/types.d.ts +12 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/pagination/index.css +1 -1
- package/lib/radio/Radio.d.ts +18 -15
- package/lib/radio/Radio.js +4 -2
- package/lib/radio/index.css +1 -1
- package/lib/radio/index.d.ts +11 -9
- package/lib/radio/types.d.ts +1 -0
- package/lib/search/Search.d.ts +19 -0
- package/lib/search/index.d.ts +13 -0
- package/lib/text-ellipsis/TextEllipsis.d.ts +13 -0
- package/lib/text-ellipsis/TextEllipsis.js +49 -18
- package/lib/text-ellipsis/index.d.ts +9 -0
- package/lib/vant.cjs.js +82 -31
- package/lib/vant.es.js +82 -31
- package/lib/vant.js +82 -31
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +1 -1
package/lib/vant.cjs.js
CHANGED
@@ -3977,8 +3977,14 @@ const fieldSharedProps = {
|
|
3977
3977
|
inputAlign: String,
|
3978
3978
|
placeholder: String,
|
3979
3979
|
autocomplete: String,
|
3980
|
+
autocapitalize: String,
|
3981
|
+
autocorrect: String,
|
3980
3982
|
errorMessage: String,
|
3981
3983
|
enterkeyhint: String,
|
3984
|
+
spellcheck: {
|
3985
|
+
type: Boolean,
|
3986
|
+
default: null
|
3987
|
+
},
|
3982
3988
|
clearTrigger: makeStringProp("focus"),
|
3983
3989
|
formatTrigger: makeStringProp("onChange"),
|
3984
3990
|
error: {
|
@@ -4306,7 +4312,10 @@ var stdin_default$1u = vue.defineComponent({
|
|
4306
4312
|
autofocus: props2.autofocus,
|
4307
4313
|
placeholder: props2.placeholder,
|
4308
4314
|
autocomplete: props2.autocomplete,
|
4315
|
+
autocapitalize: props2.autocapitalize,
|
4316
|
+
autocorrect: props2.autocorrect,
|
4309
4317
|
enterkeyhint: props2.enterkeyhint,
|
4318
|
+
spellcheck: props2.spellcheck,
|
4310
4319
|
"aria-labelledby": props2.label ? `${id}-label` : void 0,
|
4311
4320
|
onBlur,
|
4312
4321
|
onFocus,
|
@@ -5288,7 +5297,6 @@ var stdin_default$1o = vue.defineComponent({
|
|
5288
5297
|
const Tag = withInstall(stdin_default$1o);
|
5289
5298
|
const checkerProps = {
|
5290
5299
|
name: unknownProp,
|
5291
|
-
shape: makeStringProp("round"),
|
5292
5300
|
disabled: Boolean,
|
5293
5301
|
iconSize: numericProp,
|
5294
5302
|
modelValue: unknownProp,
|
@@ -5300,6 +5308,7 @@ var stdin_default$1n = vue.defineComponent({
|
|
5300
5308
|
props: extend({}, checkerProps, {
|
5301
5309
|
bem: makeRequiredProp(Function),
|
5302
5310
|
role: String,
|
5311
|
+
shape: makeStringProp("round"),
|
5303
5312
|
parent: Object,
|
5304
5313
|
checked: Boolean,
|
5305
5314
|
bindGroup: truthProp
|
@@ -5350,6 +5359,7 @@ var stdin_default$1n = vue.defineComponent({
|
|
5350
5359
|
emit("click", event);
|
5351
5360
|
};
|
5352
5361
|
const renderIcon = () => {
|
5362
|
+
var _a, _b;
|
5353
5363
|
const {
|
5354
5364
|
bem: bem2,
|
5355
5365
|
shape,
|
@@ -5362,15 +5372,24 @@ var stdin_default$1n = vue.defineComponent({
|
|
5362
5372
|
disabled: disabled.value,
|
5363
5373
|
checked
|
5364
5374
|
}]),
|
5365
|
-
"style": {
|
5375
|
+
"style": shape !== "dot" ? {
|
5366
5376
|
fontSize: addUnit(iconSize)
|
5377
|
+
} : {
|
5378
|
+
width: addUnit(iconSize),
|
5379
|
+
height: addUnit(iconSize),
|
5380
|
+
borderColor: (_a = iconStyle.value) == null ? void 0 : _a.borderColor
|
5367
5381
|
}
|
5368
5382
|
}, [slots.icon ? slots.icon({
|
5369
5383
|
checked,
|
5370
5384
|
disabled: disabled.value
|
5371
|
-
}) : vue.createVNode(Icon, {
|
5385
|
+
}) : shape !== "dot" ? vue.createVNode(Icon, {
|
5372
5386
|
"name": "success",
|
5373
5387
|
"style": iconStyle.value
|
5388
|
+
}, null) : vue.createVNode("div", {
|
5389
|
+
"class": bem2("icon--dot__icon"),
|
5390
|
+
"style": {
|
5391
|
+
backgroundColor: (_b = iconStyle.value) == null ? void 0 : _b.backgroundColor
|
5392
|
+
}
|
5374
5393
|
}, null)]);
|
5375
5394
|
};
|
5376
5395
|
const renderLabel = () => {
|
@@ -5397,11 +5416,13 @@ var stdin_default$1n = vue.defineComponent({
|
|
5397
5416
|
};
|
5398
5417
|
}
|
5399
5418
|
});
|
5400
|
-
const radioProps = checkerProps
|
5419
|
+
const radioProps = extend({}, checkerProps, {
|
5420
|
+
shape: makeStringProp("round")
|
5421
|
+
});
|
5401
5422
|
const [name$1d, bem$19] = createNamespace("radio");
|
5402
5423
|
var stdin_default$1m = vue.defineComponent({
|
5403
5424
|
name: name$1d,
|
5404
|
-
props:
|
5425
|
+
props: radioProps,
|
5405
5426
|
emits: ["update:modelValue"],
|
5406
5427
|
setup(props2, {
|
5407
5428
|
emit,
|
@@ -7455,6 +7476,7 @@ var stdin_default$19 = vue.defineComponent({
|
|
7455
7476
|
});
|
7456
7477
|
const [name$$, bem$_] = createNamespace("checkbox");
|
7457
7478
|
const checkboxProps = extend({}, checkerProps, {
|
7479
|
+
shape: makeStringProp("round"),
|
7458
7480
|
bindGroup: truthProp
|
7459
7481
|
});
|
7460
7482
|
var stdin_default$18 = vue.defineComponent({
|
@@ -9687,10 +9709,10 @@ var stdin_default$S = vue.defineComponent({
|
|
9687
9709
|
const DropdownItem = withInstall(stdin_default$S);
|
9688
9710
|
const DropdownMenu = withInstall(stdin_default$T);
|
9689
9711
|
const floatingBubbleProps = {
|
9712
|
+
gap: makeNumberProp(24),
|
9713
|
+
icon: String,
|
9690
9714
|
axis: makeStringProp("y"),
|
9691
9715
|
magnetic: String,
|
9692
|
-
icon: String,
|
9693
|
-
gap: makeNumberProp(24),
|
9694
9716
|
offset: {
|
9695
9717
|
type: Object,
|
9696
9718
|
default: () => ({
|
@@ -9721,8 +9743,8 @@ var stdin_default$R = vue.defineComponent({
|
|
9721
9743
|
});
|
9722
9744
|
const boundary = vue.computed(() => ({
|
9723
9745
|
top: props2.gap,
|
9724
|
-
right: windowWidth.value - state.value.
|
9725
|
-
bottom: windowHeight.value - state.value.
|
9746
|
+
right: windowWidth.value - state.value.width - props2.gap,
|
9747
|
+
bottom: windowHeight.value - state.value.height - props2.gap,
|
9726
9748
|
left: props2.gap
|
9727
9749
|
}));
|
9728
9750
|
const dragging = vue.ref(false);
|
@@ -9820,9 +9842,7 @@ var stdin_default$R = vue.defineComponent({
|
|
9820
9842
|
initialized = true;
|
9821
9843
|
});
|
9822
9844
|
});
|
9823
|
-
vue.watch([windowWidth, windowHeight, () => props2.gap, () => props2.offset],
|
9824
|
-
deep: true
|
9825
|
-
});
|
9845
|
+
vue.watch([windowWidth, windowHeight, () => props2.gap, () => props2.offset], updateState);
|
9826
9846
|
const show = vue.ref(true);
|
9827
9847
|
vue.onActivated(() => {
|
9828
9848
|
show.value = true;
|
@@ -14582,7 +14602,8 @@ const textEllipsisProps = {
|
|
14582
14602
|
dots: makeStringProp("..."),
|
14583
14603
|
content: makeStringProp(""),
|
14584
14604
|
expandText: makeStringProp(""),
|
14585
|
-
collapseText: makeStringProp("")
|
14605
|
+
collapseText: makeStringProp(""),
|
14606
|
+
position: makeStringProp("end")
|
14586
14607
|
};
|
14587
14608
|
var stdin_default$9 = vue.defineComponent({
|
14588
14609
|
name: name$4,
|
@@ -14595,6 +14616,7 @@ var stdin_default$9 = vue.defineComponent({
|
|
14595
14616
|
const expanded = vue.ref(false);
|
14596
14617
|
const hasAction = vue.ref(false);
|
14597
14618
|
const root = vue.ref();
|
14619
|
+
const actionText = vue.computed(() => expanded.value ? props2.expandText : props2.collapseText);
|
14598
14620
|
const pxToNum = (value) => {
|
14599
14621
|
if (!value)
|
14600
14622
|
return 0;
|
@@ -14623,24 +14645,53 @@ var stdin_default$9 = vue.defineComponent({
|
|
14623
14645
|
};
|
14624
14646
|
const calcEllipsisText = (container2, maxHeight2) => {
|
14625
14647
|
const {
|
14626
|
-
dots,
|
14627
14648
|
content,
|
14628
|
-
|
14649
|
+
position,
|
14650
|
+
dots
|
14629
14651
|
} = props2;
|
14630
|
-
|
14631
|
-
|
14632
|
-
|
14633
|
-
|
14634
|
-
|
14635
|
-
|
14636
|
-
|
14637
|
-
|
14638
|
-
|
14639
|
-
|
14640
|
-
|
14652
|
+
const end = content.length;
|
14653
|
+
const calcEllipse = () => {
|
14654
|
+
const tail = (left, right) => {
|
14655
|
+
if (right - left <= 1) {
|
14656
|
+
if (position === "end") {
|
14657
|
+
return content.slice(0, left) + dots;
|
14658
|
+
}
|
14659
|
+
return dots + content.slice(right, end);
|
14660
|
+
}
|
14661
|
+
const middle2 = Math.round(left + right >> 1);
|
14662
|
+
if (position === "end") {
|
14663
|
+
container2.innerText = content.slice(0, middle2) + dots + actionText.value;
|
14664
|
+
} else {
|
14665
|
+
container2.innerText = dots + content.slice(middle2, end) + actionText.value;
|
14666
|
+
}
|
14667
|
+
if (container2.offsetHeight > maxHeight2) {
|
14668
|
+
if (position === "end") {
|
14669
|
+
return tail(left, middle2);
|
14670
|
+
}
|
14671
|
+
return tail(middle2, right);
|
14672
|
+
}
|
14673
|
+
if (position === "end") {
|
14674
|
+
return tail(middle2, right);
|
14675
|
+
}
|
14676
|
+
return tail(left, middle2);
|
14677
|
+
};
|
14678
|
+
container2.innerText = tail(0, end);
|
14679
|
+
};
|
14680
|
+
const middleTail = (leftPart, rightPart) => {
|
14681
|
+
if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
|
14682
|
+
return content.slice(0, leftPart[1]) + dots + dots + content.slice(rightPart[1], end);
|
14641
14683
|
}
|
14642
|
-
|
14643
|
-
|
14684
|
+
const leftMiddle = Math.floor(leftPart[0] + leftPart[1] >> 1);
|
14685
|
+
const rightMiddle = Math.ceil(rightPart[0] + rightPart[1] >> 1);
|
14686
|
+
container2.innerText = props2.content.slice(0, leftMiddle) + props2.dots + actionText.value + props2.dots + props2.content.slice(rightMiddle, end);
|
14687
|
+
if (container2.offsetHeight >= maxHeight2) {
|
14688
|
+
return middleTail([leftPart[0], leftMiddle], [rightMiddle, rightPart[1]]);
|
14689
|
+
}
|
14690
|
+
return middleTail([leftMiddle, leftPart[1]], [rightPart[0], rightMiddle]);
|
14691
|
+
};
|
14692
|
+
const middle = 0 + end >> 1;
|
14693
|
+
props2.position === "middle" ? container2.innerText = middleTail([0, middle], [middle, end]) : calcEllipse();
|
14694
|
+
return container2.innerText;
|
14644
14695
|
};
|
14645
14696
|
const container = cloneContainer();
|
14646
14697
|
if (!container)
|
@@ -14650,7 +14701,7 @@ var stdin_default$9 = vue.defineComponent({
|
|
14650
14701
|
paddingTop,
|
14651
14702
|
lineHeight
|
14652
14703
|
} = container.style;
|
14653
|
-
const maxHeight = (Number(props2.rows) + 0.5) * pxToNum(lineHeight) + pxToNum(paddingTop) + pxToNum(paddingBottom);
|
14704
|
+
const maxHeight = Math.ceil((Number(props2.rows) + 0.5) * pxToNum(lineHeight) + pxToNum(paddingTop) + pxToNum(paddingBottom));
|
14654
14705
|
if (maxHeight < container.offsetHeight) {
|
14655
14706
|
hasAction.value = true;
|
14656
14707
|
text.value = calcEllipsisText(container, maxHeight);
|
@@ -14669,7 +14720,7 @@ var stdin_default$9 = vue.defineComponent({
|
|
14669
14720
|
"onClick": onClickAction
|
14670
14721
|
}, [expanded.value ? props2.collapseText : props2.expandText]);
|
14671
14722
|
vue.onMounted(calcEllipsised);
|
14672
|
-
vue.watch(() => [props2.content, props2.rows], calcEllipsised);
|
14723
|
+
vue.watch(() => [props2.content, props2.rows, props2.position], calcEllipsised);
|
14673
14724
|
use.useEventListener("resize", calcEllipsised);
|
14674
14725
|
return () => vue.createVNode("div", {
|
14675
14726
|
"ref": root,
|
@@ -16328,7 +16379,7 @@ const Lazyload = {
|
|
16328
16379
|
});
|
16329
16380
|
}
|
16330
16381
|
};
|
16331
|
-
const version = "4.6.
|
16382
|
+
const version = "4.6.2";
|
16332
16383
|
function install(app) {
|
16333
16384
|
const components = [
|
16334
16385
|
ActionBar,
|
package/lib/vant.es.js
CHANGED
@@ -3975,8 +3975,14 @@ const fieldSharedProps = {
|
|
3975
3975
|
inputAlign: String,
|
3976
3976
|
placeholder: String,
|
3977
3977
|
autocomplete: String,
|
3978
|
+
autocapitalize: String,
|
3979
|
+
autocorrect: String,
|
3978
3980
|
errorMessage: String,
|
3979
3981
|
enterkeyhint: String,
|
3982
|
+
spellcheck: {
|
3983
|
+
type: Boolean,
|
3984
|
+
default: null
|
3985
|
+
},
|
3980
3986
|
clearTrigger: makeStringProp("focus"),
|
3981
3987
|
formatTrigger: makeStringProp("onChange"),
|
3982
3988
|
error: {
|
@@ -4304,7 +4310,10 @@ var stdin_default$1u = defineComponent({
|
|
4304
4310
|
autofocus: props2.autofocus,
|
4305
4311
|
placeholder: props2.placeholder,
|
4306
4312
|
autocomplete: props2.autocomplete,
|
4313
|
+
autocapitalize: props2.autocapitalize,
|
4314
|
+
autocorrect: props2.autocorrect,
|
4307
4315
|
enterkeyhint: props2.enterkeyhint,
|
4316
|
+
spellcheck: props2.spellcheck,
|
4308
4317
|
"aria-labelledby": props2.label ? `${id}-label` : void 0,
|
4309
4318
|
onBlur,
|
4310
4319
|
onFocus,
|
@@ -5286,7 +5295,6 @@ var stdin_default$1o = defineComponent({
|
|
5286
5295
|
const Tag = withInstall(stdin_default$1o);
|
5287
5296
|
const checkerProps = {
|
5288
5297
|
name: unknownProp,
|
5289
|
-
shape: makeStringProp("round"),
|
5290
5298
|
disabled: Boolean,
|
5291
5299
|
iconSize: numericProp,
|
5292
5300
|
modelValue: unknownProp,
|
@@ -5298,6 +5306,7 @@ var stdin_default$1n = defineComponent({
|
|
5298
5306
|
props: extend({}, checkerProps, {
|
5299
5307
|
bem: makeRequiredProp(Function),
|
5300
5308
|
role: String,
|
5309
|
+
shape: makeStringProp("round"),
|
5301
5310
|
parent: Object,
|
5302
5311
|
checked: Boolean,
|
5303
5312
|
bindGroup: truthProp
|
@@ -5348,6 +5357,7 @@ var stdin_default$1n = defineComponent({
|
|
5348
5357
|
emit("click", event);
|
5349
5358
|
};
|
5350
5359
|
const renderIcon = () => {
|
5360
|
+
var _a, _b;
|
5351
5361
|
const {
|
5352
5362
|
bem: bem2,
|
5353
5363
|
shape,
|
@@ -5360,15 +5370,24 @@ var stdin_default$1n = defineComponent({
|
|
5360
5370
|
disabled: disabled.value,
|
5361
5371
|
checked
|
5362
5372
|
}]),
|
5363
|
-
"style": {
|
5373
|
+
"style": shape !== "dot" ? {
|
5364
5374
|
fontSize: addUnit(iconSize)
|
5375
|
+
} : {
|
5376
|
+
width: addUnit(iconSize),
|
5377
|
+
height: addUnit(iconSize),
|
5378
|
+
borderColor: (_a = iconStyle.value) == null ? void 0 : _a.borderColor
|
5365
5379
|
}
|
5366
5380
|
}, [slots.icon ? slots.icon({
|
5367
5381
|
checked,
|
5368
5382
|
disabled: disabled.value
|
5369
|
-
}) : createVNode(Icon, {
|
5383
|
+
}) : shape !== "dot" ? createVNode(Icon, {
|
5370
5384
|
"name": "success",
|
5371
5385
|
"style": iconStyle.value
|
5386
|
+
}, null) : createVNode("div", {
|
5387
|
+
"class": bem2("icon--dot__icon"),
|
5388
|
+
"style": {
|
5389
|
+
backgroundColor: (_b = iconStyle.value) == null ? void 0 : _b.backgroundColor
|
5390
|
+
}
|
5372
5391
|
}, null)]);
|
5373
5392
|
};
|
5374
5393
|
const renderLabel = () => {
|
@@ -5395,11 +5414,13 @@ var stdin_default$1n = defineComponent({
|
|
5395
5414
|
};
|
5396
5415
|
}
|
5397
5416
|
});
|
5398
|
-
const radioProps = checkerProps
|
5417
|
+
const radioProps = extend({}, checkerProps, {
|
5418
|
+
shape: makeStringProp("round")
|
5419
|
+
});
|
5399
5420
|
const [name$1d, bem$19] = createNamespace("radio");
|
5400
5421
|
var stdin_default$1m = defineComponent({
|
5401
5422
|
name: name$1d,
|
5402
|
-
props:
|
5423
|
+
props: radioProps,
|
5403
5424
|
emits: ["update:modelValue"],
|
5404
5425
|
setup(props2, {
|
5405
5426
|
emit,
|
@@ -7453,6 +7474,7 @@ var stdin_default$19 = defineComponent({
|
|
7453
7474
|
});
|
7454
7475
|
const [name$$, bem$_] = createNamespace("checkbox");
|
7455
7476
|
const checkboxProps = extend({}, checkerProps, {
|
7477
|
+
shape: makeStringProp("round"),
|
7456
7478
|
bindGroup: truthProp
|
7457
7479
|
});
|
7458
7480
|
var stdin_default$18 = defineComponent({
|
@@ -9685,10 +9707,10 @@ var stdin_default$S = defineComponent({
|
|
9685
9707
|
const DropdownItem = withInstall(stdin_default$S);
|
9686
9708
|
const DropdownMenu = withInstall(stdin_default$T);
|
9687
9709
|
const floatingBubbleProps = {
|
9710
|
+
gap: makeNumberProp(24),
|
9711
|
+
icon: String,
|
9688
9712
|
axis: makeStringProp("y"),
|
9689
9713
|
magnetic: String,
|
9690
|
-
icon: String,
|
9691
|
-
gap: makeNumberProp(24),
|
9692
9714
|
offset: {
|
9693
9715
|
type: Object,
|
9694
9716
|
default: () => ({
|
@@ -9719,8 +9741,8 @@ var stdin_default$R = defineComponent({
|
|
9719
9741
|
});
|
9720
9742
|
const boundary = computed(() => ({
|
9721
9743
|
top: props2.gap,
|
9722
|
-
right: windowWidth.value - state.value.
|
9723
|
-
bottom: windowHeight.value - state.value.
|
9744
|
+
right: windowWidth.value - state.value.width - props2.gap,
|
9745
|
+
bottom: windowHeight.value - state.value.height - props2.gap,
|
9724
9746
|
left: props2.gap
|
9725
9747
|
}));
|
9726
9748
|
const dragging = ref(false);
|
@@ -9818,9 +9840,7 @@ var stdin_default$R = defineComponent({
|
|
9818
9840
|
initialized = true;
|
9819
9841
|
});
|
9820
9842
|
});
|
9821
|
-
watch([windowWidth, windowHeight, () => props2.gap, () => props2.offset],
|
9822
|
-
deep: true
|
9823
|
-
});
|
9843
|
+
watch([windowWidth, windowHeight, () => props2.gap, () => props2.offset], updateState);
|
9824
9844
|
const show = ref(true);
|
9825
9845
|
onActivated(() => {
|
9826
9846
|
show.value = true;
|
@@ -14580,7 +14600,8 @@ const textEllipsisProps = {
|
|
14580
14600
|
dots: makeStringProp("..."),
|
14581
14601
|
content: makeStringProp(""),
|
14582
14602
|
expandText: makeStringProp(""),
|
14583
|
-
collapseText: makeStringProp("")
|
14603
|
+
collapseText: makeStringProp(""),
|
14604
|
+
position: makeStringProp("end")
|
14584
14605
|
};
|
14585
14606
|
var stdin_default$9 = defineComponent({
|
14586
14607
|
name: name$4,
|
@@ -14593,6 +14614,7 @@ var stdin_default$9 = defineComponent({
|
|
14593
14614
|
const expanded = ref(false);
|
14594
14615
|
const hasAction = ref(false);
|
14595
14616
|
const root = ref();
|
14617
|
+
const actionText = computed(() => expanded.value ? props2.expandText : props2.collapseText);
|
14596
14618
|
const pxToNum = (value) => {
|
14597
14619
|
if (!value)
|
14598
14620
|
return 0;
|
@@ -14621,24 +14643,53 @@ var stdin_default$9 = defineComponent({
|
|
14621
14643
|
};
|
14622
14644
|
const calcEllipsisText = (container2, maxHeight2) => {
|
14623
14645
|
const {
|
14624
|
-
dots,
|
14625
14646
|
content,
|
14626
|
-
|
14647
|
+
position,
|
14648
|
+
dots
|
14627
14649
|
} = props2;
|
14628
|
-
|
14629
|
-
|
14630
|
-
|
14631
|
-
|
14632
|
-
|
14633
|
-
|
14634
|
-
|
14635
|
-
|
14636
|
-
|
14637
|
-
|
14638
|
-
|
14650
|
+
const end = content.length;
|
14651
|
+
const calcEllipse = () => {
|
14652
|
+
const tail = (left, right) => {
|
14653
|
+
if (right - left <= 1) {
|
14654
|
+
if (position === "end") {
|
14655
|
+
return content.slice(0, left) + dots;
|
14656
|
+
}
|
14657
|
+
return dots + content.slice(right, end);
|
14658
|
+
}
|
14659
|
+
const middle2 = Math.round(left + right >> 1);
|
14660
|
+
if (position === "end") {
|
14661
|
+
container2.innerText = content.slice(0, middle2) + dots + actionText.value;
|
14662
|
+
} else {
|
14663
|
+
container2.innerText = dots + content.slice(middle2, end) + actionText.value;
|
14664
|
+
}
|
14665
|
+
if (container2.offsetHeight > maxHeight2) {
|
14666
|
+
if (position === "end") {
|
14667
|
+
return tail(left, middle2);
|
14668
|
+
}
|
14669
|
+
return tail(middle2, right);
|
14670
|
+
}
|
14671
|
+
if (position === "end") {
|
14672
|
+
return tail(middle2, right);
|
14673
|
+
}
|
14674
|
+
return tail(left, middle2);
|
14675
|
+
};
|
14676
|
+
container2.innerText = tail(0, end);
|
14677
|
+
};
|
14678
|
+
const middleTail = (leftPart, rightPart) => {
|
14679
|
+
if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
|
14680
|
+
return content.slice(0, leftPart[1]) + dots + dots + content.slice(rightPart[1], end);
|
14639
14681
|
}
|
14640
|
-
|
14641
|
-
|
14682
|
+
const leftMiddle = Math.floor(leftPart[0] + leftPart[1] >> 1);
|
14683
|
+
const rightMiddle = Math.ceil(rightPart[0] + rightPart[1] >> 1);
|
14684
|
+
container2.innerText = props2.content.slice(0, leftMiddle) + props2.dots + actionText.value + props2.dots + props2.content.slice(rightMiddle, end);
|
14685
|
+
if (container2.offsetHeight >= maxHeight2) {
|
14686
|
+
return middleTail([leftPart[0], leftMiddle], [rightMiddle, rightPart[1]]);
|
14687
|
+
}
|
14688
|
+
return middleTail([leftMiddle, leftPart[1]], [rightPart[0], rightMiddle]);
|
14689
|
+
};
|
14690
|
+
const middle = 0 + end >> 1;
|
14691
|
+
props2.position === "middle" ? container2.innerText = middleTail([0, middle], [middle, end]) : calcEllipse();
|
14692
|
+
return container2.innerText;
|
14642
14693
|
};
|
14643
14694
|
const container = cloneContainer();
|
14644
14695
|
if (!container)
|
@@ -14648,7 +14699,7 @@ var stdin_default$9 = defineComponent({
|
|
14648
14699
|
paddingTop,
|
14649
14700
|
lineHeight
|
14650
14701
|
} = container.style;
|
14651
|
-
const maxHeight = (Number(props2.rows) + 0.5) * pxToNum(lineHeight) + pxToNum(paddingTop) + pxToNum(paddingBottom);
|
14702
|
+
const maxHeight = Math.ceil((Number(props2.rows) + 0.5) * pxToNum(lineHeight) + pxToNum(paddingTop) + pxToNum(paddingBottom));
|
14652
14703
|
if (maxHeight < container.offsetHeight) {
|
14653
14704
|
hasAction.value = true;
|
14654
14705
|
text.value = calcEllipsisText(container, maxHeight);
|
@@ -14667,7 +14718,7 @@ var stdin_default$9 = defineComponent({
|
|
14667
14718
|
"onClick": onClickAction
|
14668
14719
|
}, [expanded.value ? props2.collapseText : props2.expandText]);
|
14669
14720
|
onMounted(calcEllipsised);
|
14670
|
-
watch(() => [props2.content, props2.rows], calcEllipsised);
|
14721
|
+
watch(() => [props2.content, props2.rows, props2.position], calcEllipsised);
|
14671
14722
|
useEventListener("resize", calcEllipsised);
|
14672
14723
|
return () => createVNode("div", {
|
14673
14724
|
"ref": root,
|
@@ -16326,7 +16377,7 @@ const Lazyload = {
|
|
16326
16377
|
});
|
16327
16378
|
}
|
16328
16379
|
};
|
16329
|
-
const version = "4.6.
|
16380
|
+
const version = "4.6.2";
|
16330
16381
|
function install(app) {
|
16331
16382
|
const components = [
|
16332
16383
|
ActionBar,
|