@94ai/nf-text-overflow 3.1.34 → 3.1.35
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/lib/index.d.ts
CHANGED
|
@@ -16,6 +16,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
16
16
|
type: import("vue-demi").PropType<string | number>;
|
|
17
17
|
default: number;
|
|
18
18
|
};
|
|
19
|
+
rowHeight: {
|
|
20
|
+
type: import("vue-demi").PropType<string | number>;
|
|
21
|
+
default: number;
|
|
22
|
+
};
|
|
19
23
|
}>>, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
20
24
|
content: {
|
|
21
25
|
type: import("vue-demi").PropType<string>;
|
|
@@ -33,6 +37,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
33
37
|
type: import("vue-demi").PropType<string | number>;
|
|
34
38
|
default: number;
|
|
35
39
|
};
|
|
40
|
+
rowHeight: {
|
|
41
|
+
type: import("vue-demi").PropType<string | number>;
|
|
42
|
+
default: number;
|
|
43
|
+
};
|
|
36
44
|
}>>, {
|
|
37
45
|
clickAction: (event: Event) => void;
|
|
38
46
|
}, {
|
|
@@ -40,6 +48,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
40
48
|
expandText: string;
|
|
41
49
|
collapseText: string;
|
|
42
50
|
rows: string | number;
|
|
51
|
+
rowHeight: string | number;
|
|
43
52
|
}, true, import("vue/types/v3-component-options").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any>> & Readonly<Readonly<import("vue-demi").ExtractPropTypes<{
|
|
44
53
|
content: {
|
|
45
54
|
type: import("vue-demi").PropType<string>;
|
|
@@ -57,6 +66,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
57
66
|
type: import("vue-demi").PropType<string | number>;
|
|
58
67
|
default: number;
|
|
59
68
|
};
|
|
69
|
+
rowHeight: {
|
|
70
|
+
type: import("vue-demi").PropType<string | number>;
|
|
71
|
+
default: number;
|
|
72
|
+
};
|
|
60
73
|
}>>> & import("vue-demi").ShallowUnwrapRef<{}> & import("vue/types/v3-component-options").ExtractComputedReturns<{}> & import("vue-demi").ComponentCustomProperties & Readonly<import("vue-demi").ExtractPropTypes<{
|
|
61
74
|
content: {
|
|
62
75
|
type: import("vue-demi").PropType<string>;
|
|
@@ -74,6 +87,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
74
87
|
type: import("vue-demi").PropType<string | number>;
|
|
75
88
|
default: number;
|
|
76
89
|
};
|
|
90
|
+
rowHeight: {
|
|
91
|
+
type: import("vue-demi").PropType<string | number>;
|
|
92
|
+
default: number;
|
|
93
|
+
};
|
|
77
94
|
}>>, any, any, any, import("vue-demi").ComponentComputedOptions, import("vue-demi").ComponentMethodOptions> & import("vue/types/v3-component-options").ComponentOptionsBase<Readonly<import("vue-demi").ExtractPropTypes<{
|
|
78
95
|
content: {
|
|
79
96
|
type: import("vue-demi").PropType<string>;
|
|
@@ -91,6 +108,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
91
108
|
type: import("vue-demi").PropType<string | number>;
|
|
92
109
|
default: number;
|
|
93
110
|
};
|
|
111
|
+
rowHeight: {
|
|
112
|
+
type: import("vue-demi").PropType<string | number>;
|
|
113
|
+
default: number;
|
|
114
|
+
};
|
|
94
115
|
}>>, {}, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {
|
|
95
116
|
clickAction: (event: Event) => void;
|
|
96
117
|
}, string, {
|
|
@@ -98,6 +119,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
98
119
|
expandText: string;
|
|
99
120
|
collapseText: string;
|
|
100
121
|
rows: string | number;
|
|
122
|
+
rowHeight: string | number;
|
|
101
123
|
}> & {
|
|
102
124
|
props: {
|
|
103
125
|
content: {
|
|
@@ -116,6 +138,14 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
116
138
|
type: import("vue-demi").PropType<string | number>;
|
|
117
139
|
default: number;
|
|
118
140
|
};
|
|
141
|
+
rowHeight: {
|
|
142
|
+
type: import("vue-demi").PropType<string | number>;
|
|
143
|
+
default: number;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
} & (new () => {
|
|
147
|
+
$slots: {
|
|
148
|
+
default?(_: {}): any;
|
|
119
149
|
};
|
|
120
|
-
} & PluginObject<undefined>;
|
|
150
|
+
}) & PluginObject<undefined>;
|
|
121
151
|
export default _default;
|
|
@@ -1437,6 +1437,12 @@ __sfc_main.props = {
|
|
|
1437
1437
|
required: false,
|
|
1438
1438
|
type: [String, Number],
|
|
1439
1439
|
"default": 1
|
|
1440
|
+
},
|
|
1441
|
+
rowHeight: {
|
|
1442
|
+
key: "rowHeight",
|
|
1443
|
+
required: false,
|
|
1444
|
+
type: [String, Number],
|
|
1445
|
+
"default": 20
|
|
1440
1446
|
}
|
|
1441
1447
|
};
|
|
1442
1448
|
__sfc_main.setup = function(__props, __ctx) {
|
|
@@ -1446,6 +1452,13 @@ __sfc_main.setup = function(__props, __ctx) {
|
|
|
1446
1452
|
var expanded = vueDemi.ref(false);
|
|
1447
1453
|
var hasAction = vueDemi.ref(false);
|
|
1448
1454
|
var textbox = vueDemi.ref();
|
|
1455
|
+
var contentHeight = vueDemi.ref();
|
|
1456
|
+
var hasDefaultSlot = vueDemi.computed(function() {
|
|
1457
|
+
return !!vueDemi.useSlots()["default"];
|
|
1458
|
+
});
|
|
1459
|
+
var maxContentHeight = vueDemi.computed(function() {
|
|
1460
|
+
return Number(props.rows) * Number(props.rowHeight);
|
|
1461
|
+
});
|
|
1449
1462
|
var pxToNum = function pxToNum2(value) {
|
|
1450
1463
|
if (!value)
|
|
1451
1464
|
return 0;
|
|
@@ -1503,25 +1516,39 @@ __sfc_main.setup = function(__props, __ctx) {
|
|
|
1503
1516
|
}
|
|
1504
1517
|
document.body.removeChild(container);
|
|
1505
1518
|
};
|
|
1519
|
+
var calcContentHeight = function calcContentHeight2() {
|
|
1520
|
+
if (!textbox.value)
|
|
1521
|
+
return;
|
|
1522
|
+
var height = textbox.value.offsetHeight;
|
|
1523
|
+
if (height > maxContentHeight.value) {
|
|
1524
|
+
hasAction.value = true;
|
|
1525
|
+
contentHeight.value = "".concat(maxContentHeight.value, "px");
|
|
1526
|
+
}
|
|
1527
|
+
};
|
|
1528
|
+
var init = hasDefaultSlot.value ? calcContentHeight : calcEllipsised;
|
|
1506
1529
|
var onClickAction = function onClickAction2(event) {
|
|
1507
1530
|
expanded.value = !expanded.value;
|
|
1531
|
+
if (hasDefaultSlot.value) {
|
|
1532
|
+
contentHeight.value = expanded.value ? "auto" : "".concat(maxContentHeight.value, "px");
|
|
1533
|
+
}
|
|
1508
1534
|
emit("clickAction", event);
|
|
1509
1535
|
};
|
|
1510
1536
|
vueDemi.onMounted(function() {
|
|
1511
|
-
|
|
1512
|
-
window.addEventListener("resize",
|
|
1537
|
+
init();
|
|
1538
|
+
window.addEventListener("resize", init);
|
|
1513
1539
|
});
|
|
1514
1540
|
vueDemi.onUnmounted(function() {
|
|
1515
|
-
window.removeEventListener("resize",
|
|
1541
|
+
window.removeEventListener("resize", init);
|
|
1516
1542
|
});
|
|
1517
1543
|
vueDemi.watch(function() {
|
|
1518
1544
|
return [props.content, props.rows];
|
|
1519
|
-
},
|
|
1545
|
+
}, init);
|
|
1520
1546
|
return {
|
|
1521
1547
|
text,
|
|
1522
1548
|
expanded,
|
|
1523
1549
|
hasAction,
|
|
1524
1550
|
textbox,
|
|
1551
|
+
contentHeight,
|
|
1525
1552
|
onClickAction
|
|
1526
1553
|
};
|
|
1527
1554
|
};
|
|
@@ -1588,8 +1615,14 @@ var _sfc_render = function render() {
|
|
|
1588
1615
|
staticClass: "nf-text-overflow"
|
|
1589
1616
|
}, [_c("div", {
|
|
1590
1617
|
ref: "textbox",
|
|
1591
|
-
staticClass: "nf-text-overflow__content"
|
|
1592
|
-
|
|
1618
|
+
staticClass: "nf-text-overflow__content",
|
|
1619
|
+
style: {
|
|
1620
|
+
height: _vm.contentHeight,
|
|
1621
|
+
lineHeight: "".concat(_vm.rowHeight, "px")
|
|
1622
|
+
}
|
|
1623
|
+
}, [_vm._t("default", function() {
|
|
1624
|
+
return [_vm._v(_vm._s(_vm.expanded ? _vm.content : _vm.text))];
|
|
1625
|
+
})], 2), _vm.hasAction ? _c("div", {
|
|
1593
1626
|
staticClass: "nf-text-overflow__action",
|
|
1594
1627
|
on: {
|
|
1595
1628
|
"click": _vm.onClickAction
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, onMounted, onUnmounted, watch } from "vue-demi";
|
|
1
|
+
import { defineComponent, ref, computed, useSlots, onMounted, onUnmounted, watch } from "vue-demi";
|
|
2
2
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
3
3
|
function getDefaultExportFromCjs(x) {
|
|
4
4
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
@@ -1435,6 +1435,12 @@ __sfc_main.props = {
|
|
|
1435
1435
|
required: false,
|
|
1436
1436
|
type: [String, Number],
|
|
1437
1437
|
"default": 1
|
|
1438
|
+
},
|
|
1439
|
+
rowHeight: {
|
|
1440
|
+
key: "rowHeight",
|
|
1441
|
+
required: false,
|
|
1442
|
+
type: [String, Number],
|
|
1443
|
+
"default": 20
|
|
1438
1444
|
}
|
|
1439
1445
|
};
|
|
1440
1446
|
__sfc_main.setup = function(__props, __ctx) {
|
|
@@ -1444,6 +1450,13 @@ __sfc_main.setup = function(__props, __ctx) {
|
|
|
1444
1450
|
var expanded = ref(false);
|
|
1445
1451
|
var hasAction = ref(false);
|
|
1446
1452
|
var textbox = ref();
|
|
1453
|
+
var contentHeight = ref();
|
|
1454
|
+
var hasDefaultSlot = computed(function() {
|
|
1455
|
+
return !!useSlots()["default"];
|
|
1456
|
+
});
|
|
1457
|
+
var maxContentHeight = computed(function() {
|
|
1458
|
+
return Number(props.rows) * Number(props.rowHeight);
|
|
1459
|
+
});
|
|
1447
1460
|
var pxToNum = function pxToNum2(value) {
|
|
1448
1461
|
if (!value)
|
|
1449
1462
|
return 0;
|
|
@@ -1501,25 +1514,39 @@ __sfc_main.setup = function(__props, __ctx) {
|
|
|
1501
1514
|
}
|
|
1502
1515
|
document.body.removeChild(container);
|
|
1503
1516
|
};
|
|
1517
|
+
var calcContentHeight = function calcContentHeight2() {
|
|
1518
|
+
if (!textbox.value)
|
|
1519
|
+
return;
|
|
1520
|
+
var height = textbox.value.offsetHeight;
|
|
1521
|
+
if (height > maxContentHeight.value) {
|
|
1522
|
+
hasAction.value = true;
|
|
1523
|
+
contentHeight.value = "".concat(maxContentHeight.value, "px");
|
|
1524
|
+
}
|
|
1525
|
+
};
|
|
1526
|
+
var init = hasDefaultSlot.value ? calcContentHeight : calcEllipsised;
|
|
1504
1527
|
var onClickAction = function onClickAction2(event) {
|
|
1505
1528
|
expanded.value = !expanded.value;
|
|
1529
|
+
if (hasDefaultSlot.value) {
|
|
1530
|
+
contentHeight.value = expanded.value ? "auto" : "".concat(maxContentHeight.value, "px");
|
|
1531
|
+
}
|
|
1506
1532
|
emit("clickAction", event);
|
|
1507
1533
|
};
|
|
1508
1534
|
onMounted(function() {
|
|
1509
|
-
|
|
1510
|
-
window.addEventListener("resize",
|
|
1535
|
+
init();
|
|
1536
|
+
window.addEventListener("resize", init);
|
|
1511
1537
|
});
|
|
1512
1538
|
onUnmounted(function() {
|
|
1513
|
-
window.removeEventListener("resize",
|
|
1539
|
+
window.removeEventListener("resize", init);
|
|
1514
1540
|
});
|
|
1515
1541
|
watch(function() {
|
|
1516
1542
|
return [props.content, props.rows];
|
|
1517
|
-
},
|
|
1543
|
+
}, init);
|
|
1518
1544
|
return {
|
|
1519
1545
|
text,
|
|
1520
1546
|
expanded,
|
|
1521
1547
|
hasAction,
|
|
1522
1548
|
textbox,
|
|
1549
|
+
contentHeight,
|
|
1523
1550
|
onClickAction
|
|
1524
1551
|
};
|
|
1525
1552
|
};
|
|
@@ -1586,8 +1613,14 @@ var _sfc_render = function render() {
|
|
|
1586
1613
|
staticClass: "nf-text-overflow"
|
|
1587
1614
|
}, [_c("div", {
|
|
1588
1615
|
ref: "textbox",
|
|
1589
|
-
staticClass: "nf-text-overflow__content"
|
|
1590
|
-
|
|
1616
|
+
staticClass: "nf-text-overflow__content",
|
|
1617
|
+
style: {
|
|
1618
|
+
height: _vm.contentHeight,
|
|
1619
|
+
lineHeight: "".concat(_vm.rowHeight, "px")
|
|
1620
|
+
}
|
|
1621
|
+
}, [_vm._t("default", function() {
|
|
1622
|
+
return [_vm._v(_vm._s(_vm.expanded ? _vm.content : _vm.text))];
|
|
1623
|
+
})], 2), _vm.hasAction ? _c("div", {
|
|
1591
1624
|
staticClass: "nf-text-overflow__action",
|
|
1592
1625
|
on: {
|
|
1593
1626
|
"click": _vm.onClickAction
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const _default: import("vue-demi").DefineComponent<{
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineComponent<{
|
|
2
2
|
content: {
|
|
3
3
|
type: import("vue-demi").PropType<string>;
|
|
4
4
|
default: string;
|
|
@@ -15,6 +15,10 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
15
15
|
type: import("vue-demi").PropType<string | number>;
|
|
16
16
|
default: number;
|
|
17
17
|
};
|
|
18
|
+
rowHeight: {
|
|
19
|
+
type: import("vue-demi").PropType<string | number>;
|
|
20
|
+
default: number;
|
|
21
|
+
};
|
|
18
22
|
}, {}, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {
|
|
19
23
|
clickAction: (event: Event) => void;
|
|
20
24
|
}, string, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
@@ -34,10 +38,22 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
34
38
|
type: import("vue-demi").PropType<string | number>;
|
|
35
39
|
default: number;
|
|
36
40
|
};
|
|
41
|
+
rowHeight: {
|
|
42
|
+
type: import("vue-demi").PropType<string | number>;
|
|
43
|
+
default: number;
|
|
44
|
+
};
|
|
37
45
|
}>>, {
|
|
38
46
|
content: string;
|
|
39
47
|
expandText: string;
|
|
40
48
|
collapseText: string;
|
|
41
49
|
rows: string | number;
|
|
50
|
+
rowHeight: string | number;
|
|
51
|
+
}>, {
|
|
52
|
+
default?(_: {}): any;
|
|
42
53
|
}>;
|
|
43
54
|
export default _default;
|
|
55
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
56
|
+
new (): {
|
|
57
|
+
$slots: S;
|
|
58
|
+
};
|
|
59
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@94ai/nf-text-overflow",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.35",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "zhongzhenjie <1476686104@qq.com>",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@94ai/nf-theme-chalk": "^3.1.
|
|
17
|
+
"@94ai/nf-theme-chalk": "^3.1.35",
|
|
18
18
|
"vue-demi": "^0.14.5"
|
|
19
19
|
},
|
|
20
20
|
"peerDependenciesMeta": {
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"types": "lib/index.d.ts",
|
|
31
31
|
"main": "lib/nf-text-overflow.cjs.js",
|
|
32
32
|
"module": "lib/nf-text-overflow.esm-bundler.js",
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "5e4e042c5260d792a167207a3c88c76aa264821d"
|
|
34
34
|
}
|