@appscode/design-system 1.0.43-alpha.115 → 1.0.43-alpha.118
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
|
@@ -23,10 +23,28 @@
|
|
|
23
23
|
:key="idx"
|
|
24
24
|
:class="{
|
|
25
25
|
sorting: headerSortables[idx] && headerSortables[idx].enabled,
|
|
26
|
-
'sorting-desc':
|
|
27
|
-
|
|
26
|
+
'sorting-desc':
|
|
27
|
+
headerSortables[idx] && headerSortables[idx].mode === 'desc',
|
|
28
|
+
'sorting-asc':
|
|
29
|
+
headerSortables[idx] && headerSortables[idx].mode === 'asc',
|
|
30
|
+
'has-text-centered':
|
|
31
|
+
typeof tableHeader === 'string'
|
|
32
|
+
? false
|
|
33
|
+
: tableHeader.textAlign === 'center',
|
|
34
|
+
'has-text-left':
|
|
35
|
+
typeof tableHeader === 'string'
|
|
36
|
+
? false
|
|
37
|
+
: tableHeader.textAlign === 'left',
|
|
38
|
+
'has-text-right':
|
|
39
|
+
typeof tableHeader === 'string'
|
|
40
|
+
? false
|
|
41
|
+
: tableHeader.textAlign === 'right',
|
|
28
42
|
}"
|
|
29
|
-
@click.prevent="
|
|
43
|
+
@click.prevent="
|
|
44
|
+
headerSortables[idx] &&
|
|
45
|
+
headerSortables[idx].enabled &&
|
|
46
|
+
emitSortEvent(idx)
|
|
47
|
+
"
|
|
30
48
|
>
|
|
31
49
|
{{ headerLabels[idx] }}
|
|
32
50
|
</th>
|
|
@@ -146,7 +164,7 @@ export default {
|
|
|
146
164
|
},
|
|
147
165
|
headerLabels() {
|
|
148
166
|
return this.tableHeaders.map((th) =>
|
|
149
|
-
typeof th === "string" ? th : th.
|
|
167
|
+
typeof th === "string" ? th : th.name || "Label"
|
|
150
168
|
);
|
|
151
169
|
},
|
|
152
170
|
},
|
|
@@ -157,8 +175,15 @@ export default {
|
|
|
157
175
|
handler(n) {
|
|
158
176
|
if (this.headerSortables.length === n.length) {
|
|
159
177
|
n.forEach((th, idx) => {
|
|
160
|
-
if (
|
|
161
|
-
this.headerSortables[idx].enabled
|
|
178
|
+
if (
|
|
179
|
+
this.headerSortables[idx].enabled !==
|
|
180
|
+
!!(th && th.sort && th.sort.enable)
|
|
181
|
+
) {
|
|
182
|
+
this.headerSortables[idx].enabled = !!(
|
|
183
|
+
th &&
|
|
184
|
+
th.sort &&
|
|
185
|
+
th.sort.enable
|
|
186
|
+
);
|
|
162
187
|
this.headerSortables[idx].mode = "";
|
|
163
188
|
}
|
|
164
189
|
});
|
|
@@ -171,7 +196,7 @@ export default {
|
|
|
171
196
|
};
|
|
172
197
|
} else {
|
|
173
198
|
return {
|
|
174
|
-
enabled: !!th.
|
|
199
|
+
enabled: !!(th && th.sort && th.sort.enable),
|
|
175
200
|
mode: "",
|
|
176
201
|
};
|
|
177
202
|
}
|
|
@@ -198,7 +223,7 @@ export default {
|
|
|
198
223
|
emitSortEvent(index) {
|
|
199
224
|
const emitValue = {
|
|
200
225
|
index,
|
|
201
|
-
label: this.tableHeaders[index].
|
|
226
|
+
label: this.tableHeaders[index].name,
|
|
202
227
|
mode: "",
|
|
203
228
|
};
|
|
204
229
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span
|
|
3
|
+
:class="{
|
|
4
|
+
'is-flex': cellDescriptor.type !== 'object',
|
|
5
|
+
'is-align-items-center': cellValue.icon,
|
|
6
|
+
'is-justify-content-center': cellDescriptor.textAlign === 'center',
|
|
7
|
+
'is-justify-content-left': cellDescriptor.textAlign === 'left',
|
|
8
|
+
'is-justify-content-right': cellDescriptor.textAlign === 'right'
|
|
9
|
+
}"
|
|
10
|
+
>
|
|
11
|
+
<span v-if="cellValue.icon" class="icon p-0 mr-10">
|
|
12
|
+
<img width="15" :src="cellValue.icon" />
|
|
13
|
+
</span>
|
|
14
|
+
<router-link v-if="cellValue.link" :to="getCellLink(cellValue)">
|
|
15
|
+
{{ cellValue.data }}
|
|
16
|
+
</router-link>
|
|
17
|
+
<tag v-else-if="cellValue.color" :class="`is-${cellValue.color}`">
|
|
18
|
+
{{ cellValue.data }}
|
|
19
|
+
</tag>
|
|
20
|
+
<cell-value
|
|
21
|
+
v-else
|
|
22
|
+
:cell-title="cellDescriptor.name"
|
|
23
|
+
:value="cellValue.data || '-'"
|
|
24
|
+
:tooltip="cellValue.tooltip || JSON.stringify(cellValue.data)"
|
|
25
|
+
/>
|
|
26
|
+
</span>
|
|
27
|
+
</template>
|
|
28
|
+
<script>
|
|
29
|
+
export default {
|
|
30
|
+
components: {
|
|
31
|
+
Tag: () => import("../../tag/Tag.vue"),
|
|
32
|
+
CellValue: () => import("../table-cell/CellValue.vue")
|
|
33
|
+
},
|
|
34
|
+
props: {
|
|
35
|
+
cellDescriptor: {
|
|
36
|
+
type: Object,
|
|
37
|
+
default: () => ({})
|
|
38
|
+
},
|
|
39
|
+
cellValue: {
|
|
40
|
+
type: Object,
|
|
41
|
+
default: () => ({})
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
methods: {
|
|
45
|
+
getCellLink(cell) {
|
|
46
|
+
const inject = (str, obj) => str.replace(/\${(.*?)}/g, (x, g) => obj[g]);
|
|
47
|
+
const { user, cluster } = this.$route.params;
|
|
48
|
+
const link = inject(cell.link || "", {
|
|
49
|
+
username: user,
|
|
50
|
+
clustername: cluster
|
|
51
|
+
});
|
|
52
|
+
return link;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
</script>
|
|
@@ -25,6 +25,18 @@
|
|
|
25
25
|
sorting: headerSortables[idx].enabled,
|
|
26
26
|
'sorting-desc': headerSortables[idx].mode === 'desc',
|
|
27
27
|
'sorting-asc': headerSortables[idx].mode === 'asc',
|
|
28
|
+
'has-text-centered':
|
|
29
|
+
typeof tableHeader === 'string'
|
|
30
|
+
? false
|
|
31
|
+
: tableHeader.textAlign === 'center',
|
|
32
|
+
'has-text-left':
|
|
33
|
+
typeof tableHeader === 'string'
|
|
34
|
+
? false
|
|
35
|
+
: tableHeader.textAlign === 'left',
|
|
36
|
+
'has-text-right':
|
|
37
|
+
typeof tableHeader === 'string'
|
|
38
|
+
? false
|
|
39
|
+
: tableHeader.textAlign === 'right',
|
|
28
40
|
}"
|
|
29
41
|
@click.prevent="headerSortables[idx].enabled && emitSortEvent(idx)"
|
|
30
42
|
>
|
|
@@ -165,7 +177,7 @@ export default defineComponent({
|
|
|
165
177
|
},
|
|
166
178
|
headerLabels() {
|
|
167
179
|
return this.tableHeaders.map((th) =>
|
|
168
|
-
typeof th === "string" ? th : th?.
|
|
180
|
+
typeof th === "string" ? th : th?.name || "Label"
|
|
169
181
|
);
|
|
170
182
|
},
|
|
171
183
|
},
|
|
@@ -176,8 +188,8 @@ export default defineComponent({
|
|
|
176
188
|
handler(n) {
|
|
177
189
|
if (this.headerSortables.length === n.length) {
|
|
178
190
|
n.forEach((th, idx) => {
|
|
179
|
-
if (this.headerSortables[idx].enabled !== !!th?.
|
|
180
|
-
this.headerSortables[idx].enabled = !!th?.
|
|
191
|
+
if (this.headerSortables[idx].enabled !== !!th?.sort?.enable) {
|
|
192
|
+
this.headerSortables[idx].enabled = !!th?.sort?.enable;
|
|
181
193
|
this.headerSortables[idx].mode = "";
|
|
182
194
|
}
|
|
183
195
|
});
|
|
@@ -190,7 +202,7 @@ export default defineComponent({
|
|
|
190
202
|
};
|
|
191
203
|
} else {
|
|
192
204
|
return {
|
|
193
|
-
enabled: !!th?.
|
|
205
|
+
enabled: !!th?.sort?.enable,
|
|
194
206
|
mode: "",
|
|
195
207
|
};
|
|
196
208
|
}
|
|
@@ -217,7 +229,7 @@ export default defineComponent({
|
|
|
217
229
|
emitSortEvent(index) {
|
|
218
230
|
const emitValue = {
|
|
219
231
|
index,
|
|
220
|
-
label: this.tableHeaders[index].
|
|
232
|
+
label: this.tableHeaders[index].name,
|
|
221
233
|
mode: "",
|
|
222
234
|
};
|
|
223
235
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span
|
|
3
|
+
:class="{
|
|
4
|
+
'is-flex': cellDescriptor.type !== 'object',
|
|
5
|
+
'is-align-items-center': cellValue.icon,
|
|
6
|
+
'is-justify-content-center': cellDescriptor.textAlign === 'center',
|
|
7
|
+
'is-justify-content-left': cellDescriptor.textAlign === 'left',
|
|
8
|
+
'is-justify-content-right': cellDescriptor.textAlign === 'right'
|
|
9
|
+
}"
|
|
10
|
+
>
|
|
11
|
+
<span v-if="cellValue.icon" class="icon p-0 mr-10">
|
|
12
|
+
<img width="15" :src="cellValue.icon" />
|
|
13
|
+
</span>
|
|
14
|
+
<router-link v-if="cellValue.link" :to="getCellLink(cellValue)">
|
|
15
|
+
{{ cellValue.data }}
|
|
16
|
+
</router-link>
|
|
17
|
+
<tag v-else-if="cellValue.color" :class="`is-${cellValue.color}`">
|
|
18
|
+
{{ cellValue.data }}
|
|
19
|
+
</tag>
|
|
20
|
+
<cell-value
|
|
21
|
+
v-else
|
|
22
|
+
:cell-title="cellDescriptor.name"
|
|
23
|
+
:value="cellValue.data || '-'"
|
|
24
|
+
:tooltip="cellValue.tooltip || JSON.stringify(cellValue.data)"
|
|
25
|
+
/>
|
|
26
|
+
</span>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script>
|
|
30
|
+
import { defineAsyncComponent, defineComponent } from "vue";
|
|
31
|
+
import { useRoute } from "vue-router";
|
|
32
|
+
|
|
33
|
+
export default defineComponent({
|
|
34
|
+
components: {
|
|
35
|
+
Tag: defineAsyncComponent(() => import("../../tag/Tag.vue")),
|
|
36
|
+
CellValue: defineAsyncComponent(() => import("../table-cell/CellValue.vue"))
|
|
37
|
+
},
|
|
38
|
+
props: {
|
|
39
|
+
cellDescriptor: {
|
|
40
|
+
type: Object,
|
|
41
|
+
default: () => ({})
|
|
42
|
+
},
|
|
43
|
+
cellValue: {
|
|
44
|
+
type: Object,
|
|
45
|
+
default: () => ({})
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
setup() {
|
|
49
|
+
function getCellLink(cell) {
|
|
50
|
+
const route = useRoute();
|
|
51
|
+
const inject = (str, obj) => str.replace(/\${(.*?)}/g, (x, g) => obj[g]);
|
|
52
|
+
const { user, cluster } = route.params;
|
|
53
|
+
const link = inject(cell.link || "", {
|
|
54
|
+
username: user,
|
|
55
|
+
clustername: cluster
|
|
56
|
+
});
|
|
57
|
+
return link;
|
|
58
|
+
}
|
|
59
|
+
return { getCellLink };
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
</script>
|