@thinkpixellab-public/px-vue 3.0.29 → 3.0.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.
|
@@ -5,7 +5,13 @@
|
|
|
5
5
|
:style="{ opacity: elementOpacity, color: debugColor }"
|
|
6
6
|
>
|
|
7
7
|
<!-- html -->
|
|
8
|
-
<component
|
|
8
|
+
<component
|
|
9
|
+
v-if="hasHtml"
|
|
10
|
+
:class="bem('inner', { html: true })"
|
|
11
|
+
:is="innerTag"
|
|
12
|
+
ref="text"
|
|
13
|
+
v-html="html"
|
|
14
|
+
/>
|
|
9
15
|
|
|
10
16
|
<!-- slot -->
|
|
11
17
|
<component v-else :class="bem('inner')" :is="innerTag" ref="text">
|
|
@@ -17,8 +23,10 @@
|
|
|
17
23
|
<script>
|
|
18
24
|
import PxBaseResize from './PxBaseResize.vue';
|
|
19
25
|
import balanceText from '../utils/balanceText.js';
|
|
26
|
+
import isServer from '../utils/isServer.js';
|
|
20
27
|
|
|
21
28
|
export default {
|
|
29
|
+
name: 'px-balanced-text',
|
|
22
30
|
mixins: [PxBaseResize],
|
|
23
31
|
props: {
|
|
24
32
|
// the outer tag element
|
|
@@ -80,17 +88,23 @@ export default {
|
|
|
80
88
|
},
|
|
81
89
|
watch: {
|
|
82
90
|
enabled() {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
this.$nextTick(() => {
|
|
86
|
-
this.resize();
|
|
87
|
-
});
|
|
91
|
+
if (isServer()) {
|
|
92
|
+
return;
|
|
88
93
|
}
|
|
94
|
+
this.balanced = false;
|
|
95
|
+
this.$nextTick(() => {
|
|
96
|
+
this.resize();
|
|
97
|
+
});
|
|
89
98
|
},
|
|
90
99
|
},
|
|
100
|
+
|
|
91
101
|
methods: {
|
|
92
102
|
resize() {
|
|
93
|
-
if (
|
|
103
|
+
if (isServer()) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (this.enabled) {
|
|
94
108
|
try {
|
|
95
109
|
this.balanceFailed = false;
|
|
96
110
|
if (this.$refs.text && this.$refs.text.offsetWidth > 0) {
|
package/package.json
CHANGED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import bem from '../utils/bem';
|
|
2
|
+
import { cssPx, cssEm, cssPcnt, cssUrl, cssVar } from '../utils/cssStr.js';
|
|
3
|
+
import aspect from './filters/aspect.js';
|
|
4
|
+
import kebab from './filters/kebab.js';
|
|
5
|
+
import slug from './filters/slug.js';
|
|
6
|
+
import spacenator from './filters/spacenator.js';
|
|
7
|
+
import date from './filters/date.js';
|
|
8
|
+
// import isServer from '../utils/isServer.js';
|
|
9
|
+
// import eventBus from './mixins/eventBus.js';
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
//install: (app, options) => {
|
|
13
|
+
install: app => {
|
|
14
|
+
// methods
|
|
15
|
+
app.config.globalProperties.bem = bem;
|
|
16
|
+
app.config.globalProperties.cssPx = cssPx;
|
|
17
|
+
app.config.globalProperties.cssEm = cssEm;
|
|
18
|
+
app.config.globalProperties.cssPcnt = cssPcnt;
|
|
19
|
+
app.config.globalProperties.cssUrl = cssUrl;
|
|
20
|
+
app.config.globalProperties.cssVar = cssVar;
|
|
21
|
+
|
|
22
|
+
// filters (just functions now)
|
|
23
|
+
app.config.globalProperties.$filters = {
|
|
24
|
+
aspect,
|
|
25
|
+
kebab,
|
|
26
|
+
slug,
|
|
27
|
+
spacenator,
|
|
28
|
+
date,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// TODO
|
|
32
|
+
|
|
33
|
+
// // mixins
|
|
34
|
+
// Vue.mixin({
|
|
35
|
+
// computed: {
|
|
36
|
+
// isServer() {
|
|
37
|
+
// return isServer();
|
|
38
|
+
// },
|
|
39
|
+
// },
|
|
40
|
+
// });
|
|
41
|
+
|
|
42
|
+
// // event bus
|
|
43
|
+
// eventBus.install(Vue);
|
|
44
|
+
|
|
45
|
+
// // other
|
|
46
|
+
// Vue.prototype.hasSlot = function (slotName) {
|
|
47
|
+
// return this.$slots && slotName in this.$slots;
|
|
48
|
+
// };
|
|
49
|
+
|
|
50
|
+
// /*
|
|
51
|
+
// Get a unique id derived from vue's unique component identifier (this._uid) for use when an
|
|
52
|
+
// id is required for an inputs, labels, etc.
|
|
53
|
+
// uniqueId('label') => 'label-0003'
|
|
54
|
+
// */
|
|
55
|
+
// Vue.prototype.uniqueId = function (prefix = null) {
|
|
56
|
+
// let id = ('000000' + Number(this._uid).toString(16).toLowerCase()).slice(-4);
|
|
57
|
+
// return prefix ? prefix + '-' + id : id;
|
|
58
|
+
// };
|
|
59
|
+
},
|
|
60
|
+
};
|