@tak-ps/vue-tabler 2.5.0 → 2.7.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/CHANGELOG.md +9 -0
- package/components/Bytes.vue +21 -0
- package/components/Epoch.vue +31 -0
- package/components/EpochRange.vue +33 -0
- package/lib.js +6 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span v-text='display'/>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export default {
|
|
7
|
+
name: 'Bytes',
|
|
8
|
+
props: {
|
|
9
|
+
bytes: {
|
|
10
|
+
type: Number,
|
|
11
|
+
required: true
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
computed: {
|
|
15
|
+
display: function() {
|
|
16
|
+
const i = this.bytes == 0 ? 0 : Math.floor(Math.log(this.bytes) / Math.log(1024));
|
|
17
|
+
return (this.bytes / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span v-text='display'/>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export default {
|
|
7
|
+
name: 'Epoch',
|
|
8
|
+
props: {
|
|
9
|
+
date: {
|
|
10
|
+
type: Number,
|
|
11
|
+
required: true
|
|
12
|
+
},
|
|
13
|
+
format: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: 'ISO'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
computed: {
|
|
19
|
+
display: function() {
|
|
20
|
+
const date = new Date(this.date)
|
|
21
|
+
if (this.format === 'ISO') {
|
|
22
|
+
return date.toISOString()
|
|
23
|
+
.replace('T', ' ')
|
|
24
|
+
.replace(/:[0-9]+\.[0-9]+[A-Z]/, '');
|
|
25
|
+
} else {
|
|
26
|
+
return date.toString();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span v-text='display'/>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export default {
|
|
7
|
+
name: 'EpochRange',
|
|
8
|
+
props: {
|
|
9
|
+
start: {
|
|
10
|
+
type: Number,
|
|
11
|
+
required: true
|
|
12
|
+
},
|
|
13
|
+
end: {
|
|
14
|
+
type: Number,
|
|
15
|
+
required: true
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
computed: {
|
|
19
|
+
display: function() {
|
|
20
|
+
const start = new Date(this.start)
|
|
21
|
+
const end = new Date(this.end)
|
|
22
|
+
|
|
23
|
+
const start_dt = start.toISOString().replace(/[A-Z].*/, '');
|
|
24
|
+
const end_dt = end.toISOString().replace(/[A-Z].*/, '');
|
|
25
|
+
if (start_dt === end_dt) {
|
|
26
|
+
return `${start.toISOString().replace(/[A-Z]/, ' ').replace(/:[0-9]+\.[0-9]+[A-Z]/, '')} - ${end.toISOString().replace(/^.*?[A-Z]/, '').replace(/:[0-9]+\.[0-9]+[A-Z]/, '')}`;
|
|
27
|
+
} else {
|
|
28
|
+
return `${start.toISOString().replace(/[A-Z]/, ' ').replace(/:[0-9]+\.[0-9]+[A-Z]/, '')} - ${end.toISOString().replace(/[A-Z]/, ' ').replace(/:[0-9]+\.[0-9]+[A-Z]/, '')}`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
</script>
|
package/lib.js
CHANGED
|
@@ -7,8 +7,14 @@ import TablerLoading from './components/Loading.vue'
|
|
|
7
7
|
import TablerToggle from './components/Toggle.vue'
|
|
8
8
|
import TablerInput from './components/Input.vue'
|
|
9
9
|
import TablerBreadCrumb from './components/BreadCrumb.vue';
|
|
10
|
+
import TablerBytes from './components/Bytes.vue';
|
|
11
|
+
import TablerEpoch from './components/Epoch.vue';
|
|
12
|
+
import TablerEpochRange from './components/EpochRange.vue';
|
|
10
13
|
|
|
11
14
|
export {
|
|
15
|
+
TablerBytes,
|
|
16
|
+
TablerEpoch,
|
|
17
|
+
TablerEpochRange,
|
|
12
18
|
TablerBreadCrumb,
|
|
13
19
|
TablerError,
|
|
14
20
|
TablerSelect,
|