@cloudron/pankow 3.3.0 → 3.4.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/components/SingleSelect.vue +5 -1
- package/package.json +1 -1
- package/types/utils.d.ts +1 -0
- package/utils.js +35 -2
- package/components/CircleChart.vue +0 -40
|
@@ -55,6 +55,7 @@ const menuModel = computed(() => {
|
|
|
55
55
|
return {
|
|
56
56
|
label: item[props.optionLabel],
|
|
57
57
|
disabled: item.disabled,
|
|
58
|
+
icon: item.icon,
|
|
58
59
|
action: () => {
|
|
59
60
|
if (selected.value === item) return;
|
|
60
61
|
|
|
@@ -160,7 +161,10 @@ onMounted(() => {
|
|
|
160
161
|
<template>
|
|
161
162
|
<div class="pankow-singleselect" :class="{ 'pankow-singleselect-disabled': disabled }" ref="elem" tabindex="0" @click="onClick" @keydown.enter="onOpen" @keydown.down.stop.prevent="onSelectNext" @keydown.up.stop.prevent="onSelectPrev" @keydown.esc.stop="onClose" @keydown.stop="onKeyDown($event)">
|
|
162
163
|
<Menu ref="menu" :model="menuModel" :search-threshold="searchThreshold" :close-on-activation="true" @close="onMenuClosed"/>
|
|
163
|
-
|
|
164
|
+
<span>
|
|
165
|
+
<Icon v-if="selected ? selected.icon : false" :icon="selected.icon" style="margin-right: 6px" />
|
|
166
|
+
{{ selected ? selected[optionLabel] : placeholder }}
|
|
167
|
+
</span>
|
|
164
168
|
<Icon icon="fa-solid fa-chevron-down" class="pankow-button-icon-right-with-text" />
|
|
165
169
|
</div>
|
|
166
170
|
</template>
|
package/package.json
CHANGED
package/types/utils.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export function prettyBinarySize(size: any, fallback: any): any;
|
|
|
35
35
|
export function prettyDecimalSize(size: any, fallback: any): any;
|
|
36
36
|
export function prettyDate(value: any): any;
|
|
37
37
|
export function prettyShortDate(value: any): string;
|
|
38
|
+
export function formatDate(format: any, value: any): any;
|
|
38
39
|
export function prettyLongDate(value: any): string;
|
|
39
40
|
export function prettyFileSize(value: any): string;
|
|
40
41
|
export function prettyEmailAddresses(addresses: any): any;
|
package/utils.js
CHANGED
|
@@ -103,6 +103,35 @@ function prettyDate(value) {
|
|
|
103
103
|
return fromNow(date);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
function formatDate(format, value) {
|
|
107
|
+
const formatters = {
|
|
108
|
+
'hh:mm A': new Intl.DateTimeFormat('en', {
|
|
109
|
+
hour: '2-digit',
|
|
110
|
+
minute: '2-digit',
|
|
111
|
+
hour12: true
|
|
112
|
+
}),
|
|
113
|
+
'hh:mm:ss A': new Intl.DateTimeFormat('en', {
|
|
114
|
+
hour: '2-digit',
|
|
115
|
+
minute: '2-digit',
|
|
116
|
+
second: '2-digit',
|
|
117
|
+
hour12: true
|
|
118
|
+
}),
|
|
119
|
+
'DD MMM': new Intl.DateTimeFormat('en', {
|
|
120
|
+
day: '2-digit',
|
|
121
|
+
month: 'short'
|
|
122
|
+
}),
|
|
123
|
+
'DD MMM hh:mm A': new Intl.DateTimeFormat('en', {
|
|
124
|
+
day: '2-digit',
|
|
125
|
+
month: 'short',
|
|
126
|
+
hour: '2-digit',
|
|
127
|
+
minute: '2-digit',
|
|
128
|
+
hour12: true
|
|
129
|
+
})
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
return formatters[format].format(new Date(value));
|
|
133
|
+
}
|
|
134
|
+
|
|
106
135
|
function prettyShortDate(value) {
|
|
107
136
|
if (!value) return 'unknown';
|
|
108
137
|
|
|
@@ -125,8 +154,11 @@ function prettyLongDate(value) {
|
|
|
125
154
|
if (isNaN(date.getTime())) return 'unknown';
|
|
126
155
|
|
|
127
156
|
const formatter = new Intl.DateTimeFormat(undefined, {
|
|
128
|
-
|
|
129
|
-
|
|
157
|
+
day: 'numeric',
|
|
158
|
+
month: 'short',
|
|
159
|
+
year: 'numeric',
|
|
160
|
+
hour: '2-digit',
|
|
161
|
+
minute: '2-digit',
|
|
130
162
|
});
|
|
131
163
|
|
|
132
164
|
const formattedDate = formatter.format(date);
|
|
@@ -392,6 +424,7 @@ export {
|
|
|
392
424
|
prettyDecimalSize,
|
|
393
425
|
prettyDate,
|
|
394
426
|
prettyShortDate,
|
|
427
|
+
formatDate,
|
|
395
428
|
prettyLongDate,
|
|
396
429
|
prettyFileSize,
|
|
397
430
|
prettyEmailAddresses,
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
|
|
3
|
-
import { computed } from 'vue';
|
|
4
|
-
|
|
5
|
-
const props = defineProps({
|
|
6
|
-
values: Array,
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
// const normalizedValue = computed(() => {
|
|
10
|
-
// if (props.value < 0) return 0;
|
|
11
|
-
// if (props.value > 100) return 100;
|
|
12
|
-
// return props.value;
|
|
13
|
-
// });
|
|
14
|
-
|
|
15
|
-
// we want 100 to be the circumverence so we can neatly use percentage: radius = 100 / ( 3,14159 * 2 ) = 15,9155
|
|
16
|
-
const radius = 15.9155;
|
|
17
|
-
const stroke = 10;
|
|
18
|
-
|
|
19
|
-
function calculateViewbox() {
|
|
20
|
-
return `0 0 ${radius*2+stroke} ${radius*2+stroke}`;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function calculateArcPath() {
|
|
24
|
-
return `M${radius+stroke/2} ${stroke/2} a ${radius} ${radius} 0 0 1 0 ${radius*2} a ${radius} ${radius} 0 0 1 0 -${radius*2}`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
</script>
|
|
28
|
-
|
|
29
|
-
<template>
|
|
30
|
-
<div class="pankow-circle-chart">
|
|
31
|
-
<svg :viewBox="calculateViewbox()" xmlns="http://www.w3.org/2000/svg">
|
|
32
|
-
<path :d="calculateArcPath()" fill="none" stroke="red" :stroke-width="stroke" stroke-dasharray="75, 100" @click.stop="onClick('red')" />
|
|
33
|
-
<path :d="calculateArcPath()" fill="none" stroke="green" :stroke-width="stroke" stroke-dasharray="30, 100" @click.stop="onClick('green') "/>
|
|
34
|
-
</svg>
|
|
35
|
-
</div>
|
|
36
|
-
</template>
|
|
37
|
-
|
|
38
|
-
<style>
|
|
39
|
-
|
|
40
|
-
</style>
|