@cloudron/pankow 3.4.1 → 3.5.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/Checkbox.vue +1 -1
- package/components/Dialog.vue +8 -1
- package/components/FormGroup.vue +4 -0
- package/components/MaskedInput.vue +79 -0
- package/components/MenuItem.vue +18 -2
- package/components/SingleSelect.vue +2 -0
- package/components/TableView.vue +92 -88
- package/index.js +2 -0
- package/package.json +5 -5
- package/style.css +1 -2
- package/types/index.d.ts +1 -1
package/components/Checkbox.vue
CHANGED
package/components/Dialog.vue
CHANGED
|
@@ -112,7 +112,6 @@ defineExpose({ open, close });
|
|
|
112
112
|
<div ref="dialog" class="pankow-dialog" v-bind="$attrs" :class="{ 'pankow-dialog-center': center }" v-show="visible" @keydown.esc="onDismiss" tabindex="0" :style="mergedStyle">
|
|
113
113
|
<div class="pankow-dialog-header" v-show="title">
|
|
114
114
|
{{ title }}
|
|
115
|
-
<Icon v-show="showX" icon="fa-solid fa-xmark" style="cursor: pointer;" @click="onReject"/>
|
|
116
115
|
</div>
|
|
117
116
|
<div class="pankow-dialog-body" ref="dialogBody" :class="{ 'pankow-dialog-body-no-header': !title, 'pankow-dialog-body-no-buttons': !(rejectLabel || confirmLabel) }">
|
|
118
117
|
<slot></slot>
|
|
@@ -123,6 +122,7 @@ defineExpose({ open, close });
|
|
|
123
122
|
<Button :[rejectStyle]="!!rejectStyle" @click="onReject" v-show="rejectLabel" :disabled="!rejectActive">{{ rejectLabel }}</Button>
|
|
124
123
|
<Button :[confirmStyle]="!!confirmStyle" @click="onConfirm" v-show="confirmLabel" :loading="confirmBusy" :disabled="confirmBusy || !confirmActive">{{ confirmLabel }}</Button>
|
|
125
124
|
</div>
|
|
125
|
+
<Icon v-if="showX" class="pankow-dialog-x-close" icon="fa-solid fa-xmark" style="cursor: pointer;" @click="onReject"/>
|
|
126
126
|
</div>
|
|
127
127
|
</Transition>
|
|
128
128
|
</div>
|
|
@@ -159,6 +159,13 @@ defineExpose({ open, close });
|
|
|
159
159
|
outline: none;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
.pankow-dialog-x-close {
|
|
163
|
+
position: absolute;
|
|
164
|
+
font-size: 20px;
|
|
165
|
+
top: 15px;
|
|
166
|
+
right: 15px;
|
|
167
|
+
}
|
|
168
|
+
|
|
162
169
|
.pankow-dialog-center {
|
|
163
170
|
top: 50%;
|
|
164
171
|
transform: translateX(-50%) translateY(-50%);
|
package/components/FormGroup.vue
CHANGED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
|
|
3
|
+
import { computed } from 'vue';
|
|
4
|
+
|
|
5
|
+
const model = defineModel({ type: [String, null], default: null });
|
|
6
|
+
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
required: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
default: false,
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const maskText = String.fromCharCode(0x25CF).repeat(8);
|
|
15
|
+
|
|
16
|
+
const displayValue = computed({
|
|
17
|
+
get() {
|
|
18
|
+
return model.value === null ? maskText : model.value;
|
|
19
|
+
},
|
|
20
|
+
set(v) {
|
|
21
|
+
if (model.value === null && v === maskText) return;
|
|
22
|
+
model.value = v;
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const isValid = computed(() => {
|
|
27
|
+
if (!props.required) return true;
|
|
28
|
+
if (model.value === null) return true; // treat masked as satisfying "required"
|
|
29
|
+
return !!model.value;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<input class="pankow-masked-input" :value="displayValue" :required="isValid" @input="displayValue = $event.target.value" @focus="$event.target.select()" />
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<style>
|
|
39
|
+
|
|
40
|
+
.pankow-masked-input {
|
|
41
|
+
display: inline-block;
|
|
42
|
+
font-size: 14px;
|
|
43
|
+
color: var(--pankow-text-color);
|
|
44
|
+
background-color: var(--pankow-input-background-color);
|
|
45
|
+
padding: var(--pankow-input-vertial-padding) var(--pankow-input-horizontal-padding);
|
|
46
|
+
border-radius: var(--pankow-border-radius);
|
|
47
|
+
border-style: solid;
|
|
48
|
+
border-width: 1px;
|
|
49
|
+
border-color: var(--pankow-input-border-color);
|
|
50
|
+
transition: border-color 250ms;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.pankow-form-group.has-error .pankow-masked-input,
|
|
54
|
+
.pankow-masked-input.has-error {
|
|
55
|
+
color: var(--pankow-text-color);
|
|
56
|
+
border-color: var(--pankow-color-danger) !important;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.pankow-masked-input:hover {
|
|
60
|
+
border-color: var(--pankow-input-border-color-hover);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.pankow-masked-input:focus {
|
|
64
|
+
border-color: var(--pankow-input-border-color-focus);
|
|
65
|
+
outline: none;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.pankow-masked-input[readonly] {
|
|
69
|
+
cursor: not-allowed;
|
|
70
|
+
border-color: var(--pankow-input-border-color) !important;
|
|
71
|
+
background-color: #f5f5f5;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.pankow-masked-input:disabled {
|
|
75
|
+
cursor: not-allowed;
|
|
76
|
+
opacity: 0.5;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
</style>
|
package/components/MenuItem.vue
CHANGED
|
@@ -44,7 +44,8 @@ function onActivated() {
|
|
|
44
44
|
<template>
|
|
45
45
|
<div class="pankow-menu-item" :class="{'pankow-menu-item-disabled': isDisabled }" @click.stop="onActivated" :separator="item.separator" v-if="isVisible" tabindex="0" @keydown.enter.stop="onActivated" @keydown.space.stop="onActivated">
|
|
46
46
|
<Checkbox v-model="item.checked" v-if="item.checkbox" style="margin-right: 4px; display: inline-flex;"/>
|
|
47
|
-
<span :style="{ width: (hasIcons && !item.checkbox) ? '29px' : 0 }"><Icon v-show="hasIcons" :icon="item.icon"/></span>{{ item.label }}
|
|
47
|
+
<span v-if="!item.separator" :style="{ width: (hasIcons && !item.checkbox) ? '29px' : 0 }"><Icon v-show="hasIcons" :icon="item.icon"/></span>{{ item.label }}
|
|
48
|
+
<div class="pankow-menu-item-separator-line" v-if="item.separator"></div>
|
|
48
49
|
</div>
|
|
49
50
|
</template>
|
|
50
51
|
|
|
@@ -89,10 +90,25 @@ function onActivated() {
|
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
.pankow-menu-item[separator] {
|
|
92
|
-
|
|
93
|
+
color: #666;
|
|
93
94
|
padding: 0;
|
|
94
95
|
margin: 5px 13px;
|
|
96
|
+
font-size: 12px;
|
|
97
|
+
font-weight: bold;
|
|
98
|
+
gap: 5px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.pankow-menu-item[separator]:focus,
|
|
102
|
+
.pankow-menu-item[separator]:hover {
|
|
103
|
+
color: #666;
|
|
104
|
+
cursor: unset;
|
|
105
|
+
background-color: unset;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.pankow-menu-item-separator-line {
|
|
95
109
|
height: 1px;
|
|
110
|
+
background-color: #c3c3c3;
|
|
111
|
+
flex-grow: 1;
|
|
96
112
|
}
|
|
97
113
|
|
|
98
114
|
.pankow-menu-item-with-icons {
|
package/components/TableView.vue
CHANGED
|
@@ -1,3 +1,94 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
|
|
3
|
+
import { onMounted, ref, watchEffect } from 'vue';
|
|
4
|
+
import ProgressBar from './ProgressBar.vue';
|
|
5
|
+
import Icon from './Icon.vue';
|
|
6
|
+
|
|
7
|
+
const emits = defineEmits(['row-click']);
|
|
8
|
+
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
model: Array,
|
|
11
|
+
busy: false,
|
|
12
|
+
placeholder: 'empty',
|
|
13
|
+
columns: Object,
|
|
14
|
+
hover: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: true
|
|
17
|
+
},
|
|
18
|
+
defaultSortBy: String,
|
|
19
|
+
defaultSortOrder: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: 'asc',
|
|
22
|
+
validator(value, props) {
|
|
23
|
+
return [ 'asc', 'desc' ].includes(value);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const SORT_ORDER = {
|
|
29
|
+
ASC: 'asc',
|
|
30
|
+
DESC: 'desc',
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const sortOrder = ref(SORT_ORDER.ASC);
|
|
34
|
+
const sortBy = ref(null);
|
|
35
|
+
const sortedItems = ref([]);
|
|
36
|
+
|
|
37
|
+
watchEffect(() => {
|
|
38
|
+
sort(props.model);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const finalBusy = ref(false);
|
|
42
|
+
let busyTimeout;
|
|
43
|
+
|
|
44
|
+
watchEffect(() => {
|
|
45
|
+
if (props.busy) {
|
|
46
|
+
busyTimeout = setTimeout(() => { finalBusy.value = true; }, 1000);
|
|
47
|
+
} else {
|
|
48
|
+
clearTimeout(busyTimeout);
|
|
49
|
+
finalBusy.value = false;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
function sort() {
|
|
54
|
+
sortedItems.value = props.model.sort((a, b) => {
|
|
55
|
+
let sort = 0;
|
|
56
|
+
|
|
57
|
+
if (!props.columns[sortBy.value]) return 0;
|
|
58
|
+
if (!props.columns[sortBy.value].sort) return 0;
|
|
59
|
+
|
|
60
|
+
if (typeof props.columns[sortBy.value].sort === 'function') {
|
|
61
|
+
sort = props.columns[sortBy.value].sort(a[sortBy.value], b[sortBy.value], a, b);
|
|
62
|
+
} else {
|
|
63
|
+
if (a[sortBy.value] < b[sortBy.value]) sort = -1;
|
|
64
|
+
else sort = 1;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return sort *= (sortOrder.value === SORT_ORDER.DESC ? -1 : 1);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function toggleSort(key) {
|
|
72
|
+
if (!props.columns[key].sort) return;
|
|
73
|
+
|
|
74
|
+
if (sortBy.value === key) sortOrder.value = sortOrder.value === SORT_ORDER.ASC ? SORT_ORDER.DESC : SORT_ORDER.ASC;
|
|
75
|
+
else sortBy.value = key;
|
|
76
|
+
|
|
77
|
+
sort();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function onRowClick(item) {
|
|
81
|
+
emits('row-click', item);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
onMounted(() => {
|
|
85
|
+
sortBy.value = props.defaultSortBy;
|
|
86
|
+
sortOrder.value = props.defaultSortOrder;
|
|
87
|
+
sort(props.model);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
</script>
|
|
91
|
+
|
|
1
92
|
<template>
|
|
2
93
|
<div class="pankow-table-scroll-wrapper">
|
|
3
94
|
<div class="pankow-table-wrapper">
|
|
@@ -12,7 +103,7 @@
|
|
|
12
103
|
</tr>
|
|
13
104
|
</thead>
|
|
14
105
|
<tbody>
|
|
15
|
-
<tr v-if="busy"><td :colspan="Object.keys(columns).length" style="text-align: center; padding: 20px;"><ProgressBar mode="indeterminate" :show-label="false" :slim="true"/></td></tr>
|
|
106
|
+
<tr v-if="busy"><td :colspan="Object.keys(columns).length" style="text-align: center; padding: 20px;"><ProgressBar mode="indeterminate" :show-label="false" :slim="true" v-show="finalBusy"/></td></tr>
|
|
16
107
|
<tr v-else-if="!busy && sortedItems.length === 0"><td :colspan="Object.keys(columns).length" class="pankow-table-placeholder">{{ placeholder }}</td></tr>
|
|
17
108
|
<tr v-else class="pankow-table-row" :class="{ 'pankow-table-row-with-hover': hover }" v-for="item in sortedItems" @click="onRowClick(item)">
|
|
18
109
|
<td class="pankow-table-cell" v-for="column in Object.keys(columns)" :style="{ width: typeof columns[column].width === 'string' ? columns[column].width : 'auto' }" :class="{ 'pankow-table-cell-hide-mobile': columns[column].hideMobile, 'pankow-table-cell-nowrap': columns[column].nowrap }">
|
|
@@ -26,93 +117,6 @@
|
|
|
26
117
|
</div>
|
|
27
118
|
</template>
|
|
28
119
|
|
|
29
|
-
<script>
|
|
30
|
-
|
|
31
|
-
import ProgressBar from './ProgressBar.vue';
|
|
32
|
-
import Icon from './Icon.vue';
|
|
33
|
-
|
|
34
|
-
const SORT_ORDER = {
|
|
35
|
-
ASC: 'asc',
|
|
36
|
-
DESC: 'desc',
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export default {
|
|
40
|
-
name: 'TableView',
|
|
41
|
-
emits: ['row-click'],
|
|
42
|
-
components: {
|
|
43
|
-
Icon,
|
|
44
|
-
ProgressBar,
|
|
45
|
-
},
|
|
46
|
-
data() {
|
|
47
|
-
return {
|
|
48
|
-
SORT_ORDER,
|
|
49
|
-
sortOrder: SORT_ORDER.ASC,
|
|
50
|
-
sortBy: null,
|
|
51
|
-
sortedItems: Array
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
props: {
|
|
55
|
-
model: Array,
|
|
56
|
-
busy: false,
|
|
57
|
-
placeholder: 'empty',
|
|
58
|
-
columns: Object,
|
|
59
|
-
hover: {
|
|
60
|
-
type: Boolean,
|
|
61
|
-
default: true
|
|
62
|
-
},
|
|
63
|
-
defaultSortBy: String,
|
|
64
|
-
defaultSortOrder: {
|
|
65
|
-
type: String,
|
|
66
|
-
default: SORT_ORDER.ASC,
|
|
67
|
-
validator(value, props) {
|
|
68
|
-
return [ SORT_ORDER.ASC, SORT_ORDER.DESC ].includes(value);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
watch: {
|
|
73
|
-
model(newModel, oldModel) {
|
|
74
|
-
this.sort(newModel);
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
mounted() {
|
|
78
|
-
this.sortBy = this.defaultSortBy;
|
|
79
|
-
this.sortOrder = this.defaultSortOrder;
|
|
80
|
-
this.sort(this.model);
|
|
81
|
-
},
|
|
82
|
-
methods: {
|
|
83
|
-
sort() {
|
|
84
|
-
this.sortedItems = this.model.sort((a, b) => {
|
|
85
|
-
let sort = 0;
|
|
86
|
-
|
|
87
|
-
if (!this.columns[this.sortBy]) return 0;
|
|
88
|
-
if (!this.columns[this.sortBy].sort) return 0;
|
|
89
|
-
|
|
90
|
-
if (typeof this.columns[this.sortBy].sort === 'function') {
|
|
91
|
-
sort = this.columns[this.sortBy].sort(a[this.sortBy], b[this.sortBy], a, b);
|
|
92
|
-
} else {
|
|
93
|
-
if (a[this.sortBy] < b[this.sortBy]) sort = -1;
|
|
94
|
-
else sort = 1;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return sort *= (this.sortOrder === SORT_ORDER.DESC ? -1 : 1);
|
|
98
|
-
});
|
|
99
|
-
},
|
|
100
|
-
toggleSort(key) {
|
|
101
|
-
if (!this.columns[key].sort) return;
|
|
102
|
-
|
|
103
|
-
if (this.sortBy === key) this.sortOrder = this.sortOrder === SORT_ORDER.ASC ? SORT_ORDER.DESC : SORT_ORDER.ASC;
|
|
104
|
-
else this.sortBy = key;
|
|
105
|
-
|
|
106
|
-
this.sort();
|
|
107
|
-
},
|
|
108
|
-
onRowClick(item) {
|
|
109
|
-
this.$emit('row-click', item);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
</script>
|
|
115
|
-
|
|
116
120
|
<style>
|
|
117
121
|
|
|
118
122
|
.pankow-table-scroll-wrapper {
|
package/index.js
CHANGED
|
@@ -18,6 +18,7 @@ import FormGroup from './components/FormGroup.vue';
|
|
|
18
18
|
import Icon from './components/Icon.vue';
|
|
19
19
|
import InputDialog from './components/InputDialog.vue';
|
|
20
20
|
import MainLayout from './components/MainLayout.vue';
|
|
21
|
+
import MaskedInput from './components/MaskedInput.vue';
|
|
21
22
|
import Menu from './components/Menu.vue';
|
|
22
23
|
import MenuItem from './components/MenuItem.vue';
|
|
23
24
|
import SingleSelect from './components/SingleSelect.vue';
|
|
@@ -63,6 +64,7 @@ export {
|
|
|
63
64
|
Icon,
|
|
64
65
|
InputDialog,
|
|
65
66
|
MainLayout,
|
|
67
|
+
MaskedInput,
|
|
66
68
|
Menu,
|
|
67
69
|
MenuItem,
|
|
68
70
|
SingleSelect,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudron/pankow",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.5.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"types": "types/index.d.ts",
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@fontsource/inter": "^5.2.8",
|
|
20
|
-
"@fortawesome/fontawesome-free": "^7.0
|
|
20
|
+
"@fortawesome/fontawesome-free": "^7.1.0",
|
|
21
21
|
"filesize": "^11.0.13",
|
|
22
|
-
"monaco-editor": "^0.
|
|
22
|
+
"monaco-editor": "^0.54.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
26
|
-
"typescript": "^5.9.
|
|
27
|
-
"vite": "^7.1.
|
|
26
|
+
"typescript": "^5.9.3",
|
|
27
|
+
"vite": "^7.1.9",
|
|
28
28
|
"vue": "^3.5.22"
|
|
29
29
|
}
|
|
30
30
|
}
|
package/style.css
CHANGED
|
@@ -94,7 +94,7 @@ input {
|
|
|
94
94
|
--pankow-input-border-color-hover: #ced4da;
|
|
95
95
|
|
|
96
96
|
--pankow-color-background: #1b1e21;
|
|
97
|
-
--pankow-color-background-hover:
|
|
97
|
+
--pankow-color-background-hover: #1f2326;
|
|
98
98
|
|
|
99
99
|
--pankow-dialog-background-color: #32383e;
|
|
100
100
|
--pankow-dialog-backdrop-color: rgba(0,0,0,.7);
|
|
@@ -164,7 +164,6 @@ select:focus {
|
|
|
164
164
|
textarea {
|
|
165
165
|
font-size: 14px;
|
|
166
166
|
color: var(--pankow-text-color);
|
|
167
|
-
margin: 6px 0;
|
|
168
167
|
background-color: var(--pankow-input-background-color);
|
|
169
168
|
padding: 6px;
|
|
170
169
|
border-radius: var(--pankow-border-radius);
|
package/types/index.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ import gestures from './gestures.js';
|
|
|
3
3
|
import tooltip from './tooltip.js';
|
|
4
4
|
import fallbackImage from './fallbackImage.js';
|
|
5
5
|
import utils from './utils.js';
|
|
6
|
-
export { BottomBar, Breadcrumb, Button, ButtonGroup, ClipboardAction, ClipboardButton, Checkbox, Dialog, DirectoryView, EmailInput, FileUploader, FormGroup, InputGroup, Icon, InputDialog, MainLayout, Menu, MenuItem, SingleSelect, MultiSelect, Notification, NumberInput, OfflineBanner, PasswordInput, Popover, ProgressBar, Radiobutton, SideBar, Spinner, Switch, TableView, TabView, TagInput, TextInput, TextInputRaw, TopBar, fetcher, gestures, tooltip, fallbackImage, utils };
|
|
6
|
+
export { BottomBar, Breadcrumb, Button, ButtonGroup, ClipboardAction, ClipboardButton, Checkbox, Dialog, DirectoryView, EmailInput, FileUploader, FormGroup, InputGroup, Icon, InputDialog, MainLayout, MaskedInput, Menu, MenuItem, SingleSelect, MultiSelect, Notification, NumberInput, OfflineBanner, PasswordInput, Popover, ProgressBar, Radiobutton, SideBar, Spinner, Switch, TableView, TabView, TagInput, TextInput, TextInputRaw, TopBar, fetcher, gestures, tooltip, fallbackImage, utils };
|