@itfin/components 1.0.95 → 1.0.98
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/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
class="itf-button btn"
|
|
6
6
|
tabindex="0"
|
|
7
7
|
type="button"
|
|
8
|
-
:to="toLink"
|
|
8
|
+
:to="toLink || {}"
|
|
9
9
|
:disabled="disabled"
|
|
10
10
|
:target="target"
|
|
11
11
|
:tag="isLink ? 'a' : 'button'"
|
|
@@ -167,11 +167,11 @@ class itfButton extends Vue {
|
|
|
167
167
|
|
|
168
168
|
get toLink() {
|
|
169
169
|
if (this.to) {
|
|
170
|
-
return this.to;
|
|
170
|
+
return this.to || {};
|
|
171
171
|
} else if (this.href) {
|
|
172
172
|
return { path: this.href };
|
|
173
173
|
}
|
|
174
|
-
return
|
|
174
|
+
return {};
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
get isLink() {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span>
|
|
3
|
+
<span v-html="formattedString" />
|
|
4
|
+
<span v-show="(text || '').length > maxChars">
|
|
5
|
+
<a v-show="!isReadMore" id="readmore" :href="link" @click="triggerReadMore($event, true)">{{ moreStr }}</a>
|
|
6
|
+
<a v-show="isReadMore" id="readless" :href="link" @click="triggerReadMore($event, false)">{{ lessStr }}</a>
|
|
7
|
+
</span>
|
|
8
|
+
</span>
|
|
9
|
+
</template>
|
|
10
|
+
<script>
|
|
11
|
+
import { Vue, Component, Prop } from 'vue-property-decorator';
|
|
12
|
+
|
|
13
|
+
export default @Component()
|
|
14
|
+
class ReadMore extends Vue {
|
|
15
|
+
@Prop({ type: String, default: 'more' }) moreStr;
|
|
16
|
+
|
|
17
|
+
@Prop({ type: String, default: 'less' }) lessStr;
|
|
18
|
+
|
|
19
|
+
@Prop({ type: String, default: '#' }) link;
|
|
20
|
+
|
|
21
|
+
@Prop({ type: Number, default: 200 }) maxChars;
|
|
22
|
+
|
|
23
|
+
@Prop({ type: String }) text;
|
|
24
|
+
|
|
25
|
+
isReadMore = false;
|
|
26
|
+
|
|
27
|
+
get formattedString() {
|
|
28
|
+
let text = this.text || '';
|
|
29
|
+
if (!this.isReadMore && text.length > this.maxChars) {
|
|
30
|
+
text = `${text.substring(0, this.maxChars)}...`;
|
|
31
|
+
}
|
|
32
|
+
return text;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
triggerReadMore(e, b) {
|
|
36
|
+
if (this.link === '#') {
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
}
|
|
39
|
+
if (this.lessStr !== null || this.lessStr !== '') { this.isReadMore = b; }
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
</script>
|