@appscode/design-system 1.0.3-alpha.7 → 1.0.43-alpha.100
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/base/utilities/_default.scss +298 -23
- package/base/utilities/_derived-variables.scss +2 -15
- package/base/utilities/_initial-variables.scss +99 -64
- package/base/utilities/_mixin.scss +90 -10
- package/base/utilities/_typography.scss +23 -7
- package/base/utilities/dark-theme.scss +25 -0
- package/components/_ac-accordion.scss +1 -0
- package/components/_ac-alert-box.scss +47 -11
- package/components/_ac-card.scss +55 -20
- package/components/_ac-code-highlight.scss +7 -1
- package/components/_ac-content-layout.scss +4 -4
- package/components/_ac-drag.scss +6 -6
- package/components/_ac-input.scss +140 -38
- package/components/_ac-modal.scss +5 -4
- package/components/_ac-multi-select.scss +220 -18
- package/components/_ac-options.scss +31 -16
- package/components/_ac-select-box.scss +15 -5
- package/components/_ac-table.scss +88 -47
- package/components/_ac-tabs.scss +72 -23
- package/components/_ac-tags.scss +2 -2
- package/components/_ac-terminal.scss +272 -0
- package/components/_app-drawer.scss +6 -6
- package/components/_breadcumb.scss +8 -3
- package/components/_buttons.scss +86 -33
- package/components/_card-body-wrapper.scss +3 -3
- package/components/_dashboard-header.scss +1 -1
- package/components/_direct-deploy.scss +69 -0
- package/components/_go-to-top.scss +1 -1
- package/components/_graph.scss +45 -0
- package/components/_image-upload.scss +6 -4
- package/components/_left-sidebar-menu.scss +206 -46
- package/components/_monaco-editor.scss +1 -1
- package/components/_navbar.scss +104 -27
- package/components/_overview-info.scss +4 -4
- package/components/_overview-page.scss +1 -2
- package/components/_pagination.scss +45 -7
- package/components/_payment-card.scss +28 -12
- package/components/_preloader.scss +1 -1
- package/components/_preview-modal.scss +8 -8
- package/components/_pricing-table.scss +1 -1
- package/components/_progress-bar.scss +5 -5
- package/components/_subscription-card.scss +15 -8
- package/components/_table-of-content.scss +1 -1
- package/components/_tfa.scss +69 -0
- package/components/_widget-menu.scss +9 -9
- package/components/_wizard.scss +32 -20
- package/components/ac-toaster/_ac-toasted.scss +40 -8
- package/components/bbum/_card-team.scss +18 -10
- package/components/bbum/_information-center.scss +19 -5
- package/components/bbum/_mobile-desktop.scss +6 -6
- package/components/bbum/_post.scss +5 -4
- package/components/bbum/_sign-up-notification.scss +6 -6
- package/components/bbum/_single-post-preview.scss +9 -9
- package/components/bbum/_user-profile.scss +97 -90
- package/components/ui-builder/_ui-builder.scss +31 -12
- package/components/ui-builder/_vue-open-api.scss +98 -0
- package/layouts/_404.scss +159 -0
- package/layouts/_code-preview.scss +14 -6
- package/main.scss +4 -0
- package/package.json +2 -7
- package/plugins/theme.js +142 -0
- package/plugins/vue-toaster.js +7 -6
- package/vue-components/v2/card/CardContent.vue +5 -0
- package/vue-components/v2/card/CardHeader.vue +12 -0
- package/vue-components/v2/card/OverviewCard.vue +10 -0
- package/vue-components/v2/card/OverviewCards.vue +5 -0
- package/vue-components/v2/card/PaymentCards.vue +16 -10
- package/vue-components/v2/content/ContentHeader.vue +1 -1
- package/vue-components/v2/editor/Editor.vue +37 -17
- package/vue-components/v2/header/Header.vue +0 -1
- package/vue-components/v2/modal/Modal.vue +32 -14
- package/vue-components/v2/modals/JsonShowModal.vue +0 -1
- package/vue-components/v2/navbar/Appdrawer.vue +9 -6
- package/vue-components/v2/navbar/ThemeMode.vue +120 -0
- package/vue-components/v2/pagination/Pagination.vue +8 -1
- package/vue-components/v2/preloader/Preloader.vue +5 -5
- package/vue-components/v2/sidebar/ClusterSwitcher.vue +126 -0
- package/vue-components/v2/sidebar/SidebarItem.vue +24 -2
- package/vue-components/v2/table/InfoTable.vue +13 -3
- package/vue-components/v2/table/Table.vue +75 -5
- package/vue-components/v2/table/TableRow.vue +17 -8
- package/vue-components/v2/table/table-cell/CellValue.vue +10 -1
- package/vue-components/v2/tabs/EditorTabs.vue +1 -1
- package/vue-components/v3/button/Button.vue +73 -0
- package/vue-components/v3/content/ContentHeader.vue +54 -0
- package/vue-components/v3/content/ContentTable.vue +65 -0
- package/vue-components/v3/dropdown/DropdownDivider.vue +3 -0
- package/vue-components/v3/dropdown/DropdownItem.vue +5 -0
- package/vue-components/v3/dropdown/DropdownMenu.vue +111 -0
- package/vue-components/v3/editor/Editor.vue +157 -0
- package/vue-components/v3/form-fields/Input.vue +21 -0
- package/vue-components/v3/header/Header.vue +45 -0
- package/vue-components/v3/modal/Modal.vue +135 -0
- package/vue-components/v3/modals/JsonShowModal.vue +87 -0
- package/vue-components/v3/navbar/Appdrawer.vue +63 -0
- package/vue-components/v3/navbar/ThemeMode.vue +128 -0
- package/vue-components/v3/navbar/User.vue +64 -0
- package/vue-components/v3/pagination/Pagination.vue +159 -0
- package/vue-components/v3/searchbars/SearchBar.vue +47 -0
- package/vue-components/v3/sidebar/ClusterSwitcher.vue +133 -0
- package/vue-components/v3/tab/TabItem.vue +17 -0
- package/vue-components/v3/table/FakeTableCell.vue +39 -0
- package/vue-components/v3/table/InfoTable.vue +105 -0
- package/vue-components/v3/table/Table.vue +238 -0
- package/vue-components/v3/table/TableCell.vue +28 -0
- package/vue-components/v3/table/TableRow.vue +60 -0
- package/vue-components/v3/table/table-cell/ArrayCell.vue +111 -0
- package/vue-components/v3/table/table-cell/CellValue.vue +117 -0
- package/vue-components/v3/table/table-cell/ObjectCell.vue +105 -0
- package/vue-components/v3/table/table-cell/ValueWithModal.vue +43 -0
- package/vue-components/v3/tabs/EditorTabs.vue +36 -0
- package/vue-components/v3/tag/Tag.vue +17 -0
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="app-drawer-wrapper">
|
|
3
|
-
<div
|
|
2
|
+
<div class="app-drawer-wrapper is-flex">
|
|
3
|
+
<div
|
|
4
|
+
class="drawer-icon is-flex is-justify-content-center is-align-items-center"
|
|
5
|
+
>
|
|
4
6
|
<svg
|
|
5
7
|
class="gb_We"
|
|
6
8
|
focusable="false"
|
|
7
9
|
viewBox="0 0 24 24"
|
|
10
|
+
style="width: 22px;margin-top: 2px;"
|
|
8
11
|
:style="{ fill: 'white' }"
|
|
9
12
|
>
|
|
10
13
|
<path
|
|
@@ -44,11 +47,11 @@ export default {
|
|
|
44
47
|
props: {
|
|
45
48
|
apps: {
|
|
46
49
|
type: Array,
|
|
47
|
-
default: () => []
|
|
48
|
-
}
|
|
50
|
+
default: () => []
|
|
51
|
+
}
|
|
49
52
|
},
|
|
50
53
|
components: {
|
|
51
|
-
NavbarItemContent: () => import("./NavbarItemContent.vue")
|
|
52
|
-
}
|
|
54
|
+
NavbarItemContent: () => import("./NavbarItemContent.vue")
|
|
55
|
+
}
|
|
53
56
|
};
|
|
54
57
|
</script>
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<button
|
|
4
|
+
v-if="themeMode"
|
|
5
|
+
class="button ac-nav-button"
|
|
6
|
+
style="color: #ffffff; font-size: 15px;"
|
|
7
|
+
@click="toggleTheme"
|
|
8
|
+
:title="themeModes[themeMode].displayName"
|
|
9
|
+
>
|
|
10
|
+
<i :class="`fa ${themeModes[themeMode].iconClass}`" />
|
|
11
|
+
</button>
|
|
12
|
+
<div class="ac-menu-content theme-choice">
|
|
13
|
+
<ul class="is-flex is-flex-direction-row is-justify-content-space-around">
|
|
14
|
+
<li
|
|
15
|
+
v-for="theme of Object.keys(themeModes)"
|
|
16
|
+
:title="themeModes[theme].displayName"
|
|
17
|
+
@click="themeMode = theme"
|
|
18
|
+
:class="{'is-active': themeMode === theme}"
|
|
19
|
+
:key="theme"
|
|
20
|
+
>
|
|
21
|
+
<i :class="['fa', themeModes[theme].iconClass]" />
|
|
22
|
+
</li>
|
|
23
|
+
</ul>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
<script>
|
|
28
|
+
export default {
|
|
29
|
+
data() {
|
|
30
|
+
return {
|
|
31
|
+
themeMode: "",
|
|
32
|
+
themeModes: {
|
|
33
|
+
system: {
|
|
34
|
+
displayName: "System Theme",
|
|
35
|
+
iconClass: "fa-desktop",
|
|
36
|
+
},
|
|
37
|
+
light: {
|
|
38
|
+
displayName: "Light Theme",
|
|
39
|
+
iconClass: "fa-sun-o",
|
|
40
|
+
},
|
|
41
|
+
dark: {
|
|
42
|
+
displayName: "Dark Theme",
|
|
43
|
+
iconClass: "fa-moon-o",
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
mounted() {
|
|
50
|
+
// get theme mode from localStorage or set default one
|
|
51
|
+
this.themeMode = localStorage.getItem("themeMode") || "light";
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
destroyed() {
|
|
55
|
+
this.removeColorSchemeEventListener();
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
watch: {
|
|
59
|
+
themeMode: {
|
|
60
|
+
handler(n) {
|
|
61
|
+
this.onThemeModeChange(n);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
methods: {
|
|
67
|
+
// handle theme mode button click
|
|
68
|
+
toggleTheme() {
|
|
69
|
+
if (this.themeMode === "light") this.themeMode = "dark";
|
|
70
|
+
else if (this.themeMode === "dark") this.themeMode = "system";
|
|
71
|
+
else if (this.themeMode === "system") this.themeMode = "light";
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
// triggered when theme mode is updated
|
|
75
|
+
onThemeModeChange(n) {
|
|
76
|
+
localStorage.setItem("themeMode", n);
|
|
77
|
+
|
|
78
|
+
let theme = n;
|
|
79
|
+
if (n === "system") {
|
|
80
|
+
const isDarkMode =
|
|
81
|
+
window.matchMedia &&
|
|
82
|
+
window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
83
|
+
this.addColorSchemeEventListener();
|
|
84
|
+
theme = isDarkMode ? "dark" : "light";
|
|
85
|
+
} else {
|
|
86
|
+
this.removeColorSchemeEventListener();
|
|
87
|
+
}
|
|
88
|
+
this.$emit("set:theme", theme);
|
|
89
|
+
this.handleDarkThemeClass(theme);
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
// add proper css class to update the ui theme
|
|
93
|
+
handleDarkThemeClass(currentTheme) {
|
|
94
|
+
if (currentTheme === "light") {
|
|
95
|
+
document.documentElement.classList.remove("is-dark-theme");
|
|
96
|
+
} else {
|
|
97
|
+
document.documentElement.classList.add("is-dark-theme");
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
// add system theme listener event
|
|
102
|
+
addColorSchemeEventListener() {
|
|
103
|
+
window
|
|
104
|
+
.matchMedia("(prefers-color-scheme: dark)")
|
|
105
|
+
.addEventListener("change", this.handleSystemThemeChange);
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
// remove system theme listener event
|
|
109
|
+
removeColorSchemeEventListener() {
|
|
110
|
+
window
|
|
111
|
+
.matchMedia("(prefers-color-scheme: dark)")
|
|
112
|
+
.removeEventListener("change", this.handleSystemThemeChange);
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
handleSystemThemeChange() {
|
|
116
|
+
this.onThemeModeChange(this.themeMode);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
</script>
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
<div class="pagination-filter level-left">
|
|
4
4
|
<div
|
|
5
5
|
class="level-item"
|
|
6
|
-
v-show="
|
|
6
|
+
v-show="
|
|
7
|
+
!hideRowsPerPageSelection &&
|
|
8
|
+
totalNoOfItems > preSelectedItemsCountPerPage
|
|
9
|
+
"
|
|
7
10
|
>
|
|
8
11
|
<label>Rows per page</label>
|
|
9
12
|
<select v-model="selectedItemCountPerPage" name="page">
|
|
@@ -52,6 +55,10 @@
|
|
|
52
55
|
<script>
|
|
53
56
|
export default {
|
|
54
57
|
props: {
|
|
58
|
+
hideRowsPerPageSelection: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: false,
|
|
61
|
+
},
|
|
55
62
|
totalNoOfItems: {
|
|
56
63
|
type: Number,
|
|
57
64
|
default: 0,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
class="is-flex is-justify-content-center is-align-items-center is-flex-direction-column"
|
|
3
|
+
class="is-flex is-justify-content-center is-align-items-center is-flex-direction-column ac-preloader"
|
|
4
4
|
style="height: calc(100vh - 200px);"
|
|
5
5
|
>
|
|
6
6
|
<span v-if="showSpinner" class="spinner"></span>
|
|
@@ -15,12 +15,12 @@ export default {
|
|
|
15
15
|
props: {
|
|
16
16
|
showSpinner: {
|
|
17
17
|
type: Boolean,
|
|
18
|
-
default: true
|
|
18
|
+
default: true
|
|
19
19
|
},
|
|
20
20
|
message: {
|
|
21
21
|
type: String,
|
|
22
|
-
default: "Fetching! Please wait for sometime..."
|
|
23
|
-
}
|
|
24
|
-
}
|
|
22
|
+
default: "Fetching! Please wait for sometime..."
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
25
|
};
|
|
26
26
|
</script>
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="is-cluster-logo" v-if="sidebarCollapsed">
|
|
3
|
+
<img
|
|
4
|
+
width="40"
|
|
5
|
+
:src="getProviderIcon(selectedCluster && selectedCluster.provider)"
|
|
6
|
+
onerror="this.onerror=null;this.src='https://cdn.appscode.com/images/cloud-provider-icons/Generic.png';"
|
|
7
|
+
alt="provider-icon"
|
|
8
|
+
/>
|
|
9
|
+
</div>
|
|
10
|
+
<multiselect
|
|
11
|
+
v-else
|
|
12
|
+
v-model="selectedCluster"
|
|
13
|
+
placeholder="Selected Cluster"
|
|
14
|
+
label="name"
|
|
15
|
+
track-by="name"
|
|
16
|
+
:options="clusterOptions"
|
|
17
|
+
:allow-empty="false"
|
|
18
|
+
deselectLabel=""
|
|
19
|
+
selectLabel=""
|
|
20
|
+
selectedLabel=""
|
|
21
|
+
>
|
|
22
|
+
<template slot="singleLabel" slot-scope="props">
|
|
23
|
+
<div class="is-flex is-align-items-center">
|
|
24
|
+
<img
|
|
25
|
+
:src="getProviderIcon(props.option.provider)"
|
|
26
|
+
onerror="this.onerror=null;this.src='https://cdn.appscode.com/images/cloud-provider-icons/Generic.png';"
|
|
27
|
+
alt="No cluster selected"
|
|
28
|
+
/><span
|
|
29
|
+
><span>{{ props.option.displayName }}</span></span
|
|
30
|
+
>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
<template slot="option" slot-scope="props">
|
|
34
|
+
<div class="is-flex is-align-items-center">
|
|
35
|
+
<img
|
|
36
|
+
class="mr-15"
|
|
37
|
+
:src="getProviderIcon(props.option.provider)"
|
|
38
|
+
onerror="this.onerror=null;this.src='https://cdn.appscode.com/images/cloud-provider-icons/Generic.png';"
|
|
39
|
+
alt="No cluster selected"
|
|
40
|
+
/>
|
|
41
|
+
<div>
|
|
42
|
+
<p>{{ props.option.displayName }}</p>
|
|
43
|
+
<p class="location">{{ props.option.location }}</p>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
</multiselect>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script>
|
|
51
|
+
export default {
|
|
52
|
+
props: {
|
|
53
|
+
sidebarCollapsed: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: false,
|
|
56
|
+
},
|
|
57
|
+
mouseHover: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false,
|
|
60
|
+
},
|
|
61
|
+
clusterOptions: {
|
|
62
|
+
type: Array,
|
|
63
|
+
default: [],
|
|
64
|
+
},
|
|
65
|
+
value: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: "",
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
components: {
|
|
72
|
+
Multiselect: () => import("vue-multiselect"),
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
data() {
|
|
76
|
+
return {
|
|
77
|
+
selectedCluster: null,
|
|
78
|
+
selectedClusterName: "",
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
methods: {
|
|
83
|
+
getProviderIcon(provider) {
|
|
84
|
+
return `https://cdn.appscode.com/images/cloud-provider-icons/${provider}.png`;
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
watch: {
|
|
89
|
+
value: {
|
|
90
|
+
immediate: true,
|
|
91
|
+
handler(n) {
|
|
92
|
+
this.selectedClusterName = n;
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
selectedCluster: {
|
|
96
|
+
deep: true,
|
|
97
|
+
handler(n) {
|
|
98
|
+
this.selectedClusterName = n.name;
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
selectedClusterName(n) {
|
|
102
|
+
if (this.selectedCluster && n !== this.selectedCluster.name) {
|
|
103
|
+
this.clusterOptions.forEach((item) => {
|
|
104
|
+
if (this.selectedClusterName === item.name) {
|
|
105
|
+
this.selectedCluster = item;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
this.$emit("input", n);
|
|
110
|
+
},
|
|
111
|
+
clusterOptions: {
|
|
112
|
+
deep: true,
|
|
113
|
+
immediate: true,
|
|
114
|
+
async handler(list) {
|
|
115
|
+
if (list) {
|
|
116
|
+
list.forEach(async (item) => {
|
|
117
|
+
if(item.name === this.selectedClusterName) {
|
|
118
|
+
this.selectedCluster = item;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<li>
|
|
2
|
+
<li ref="sidebarItem">
|
|
3
3
|
<router-link
|
|
4
4
|
:id="id"
|
|
5
5
|
:title="title"
|
|
@@ -34,9 +34,31 @@ export default {
|
|
|
34
34
|
default: false,
|
|
35
35
|
},
|
|
36
36
|
icon: {
|
|
37
|
-
type:
|
|
37
|
+
type: null,
|
|
38
38
|
default: "@/assets/images/icons/basic.svg",
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
|
+
watch: {
|
|
42
|
+
isActive: {
|
|
43
|
+
immediate: true,
|
|
44
|
+
handler(n) {
|
|
45
|
+
if (n) {
|
|
46
|
+
this.$nextTick(() => {
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
const top = (this.$refs.sidebarItem && this.$refs.sidebarItem.getBoundingClientRect().top) || 0;
|
|
49
|
+
// preventing scroll to options that are already visible
|
|
50
|
+
if (top > window.innerHeight - 200) {
|
|
51
|
+
// scroll to selected option item
|
|
52
|
+
this.$refs.sidebarItem.scrollIntoView({
|
|
53
|
+
behavior: 'smooth',
|
|
54
|
+
block: "center"
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}, 500);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
41
63
|
};
|
|
42
64
|
</script>
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<table-container>
|
|
3
|
-
<table
|
|
3
|
+
<table
|
|
4
|
+
class="table ac-info-table is-fullwidth"
|
|
5
|
+
:class="{ 'pl-0 pr-0': removeContentPadding }"
|
|
6
|
+
>
|
|
4
7
|
<tbody v-if="isFullTableLoaderActive">
|
|
5
8
|
<!-- table loader -->
|
|
6
9
|
<table-row v-for="i in loaderCols" :key="i">
|
|
@@ -15,7 +18,10 @@
|
|
|
15
18
|
</tbody>
|
|
16
19
|
<tbody
|
|
17
20
|
v-else
|
|
18
|
-
:class="
|
|
21
|
+
:class="{
|
|
22
|
+
'no-data-available has-text-centered p-10': isTableEmpty,
|
|
23
|
+
'pl-0 pr-0': removeContentPadding
|
|
24
|
+
}"
|
|
19
25
|
>
|
|
20
26
|
<template v-if="!isTableEmpty">
|
|
21
27
|
<!-- table rows -->
|
|
@@ -60,7 +66,11 @@ export default {
|
|
|
60
66
|
},
|
|
61
67
|
tableHeaders: {
|
|
62
68
|
type: Array,
|
|
63
|
-
default: () => []
|
|
69
|
+
default: () => []
|
|
70
|
+
},
|
|
71
|
+
removeContentPadding: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: false,
|
|
64
74
|
},
|
|
65
75
|
},
|
|
66
76
|
|
|
@@ -18,8 +18,17 @@
|
|
|
18
18
|
</th>
|
|
19
19
|
</table-row>
|
|
20
20
|
<table-row v-else>
|
|
21
|
-
<th
|
|
22
|
-
|
|
21
|
+
<th
|
|
22
|
+
v-for="(tableHeader, idx) in tableHeaders"
|
|
23
|
+
:key="idx"
|
|
24
|
+
:class="{
|
|
25
|
+
sorting: headerSortables[idx] && headerSortables[idx].enabled,
|
|
26
|
+
'sorting-desc': headerSortables[idx] && headerSortables[idx].mode === 'desc',
|
|
27
|
+
'sorting-asc': headerSortables[idx] && headerSortables[idx].mode === 'asc',
|
|
28
|
+
}"
|
|
29
|
+
@click.prevent="headerSortables[idx] && headerSortables[idx].enabled && emitSortEvent(idx)"
|
|
30
|
+
>
|
|
31
|
+
{{ headerLabels[idx] }}
|
|
23
32
|
</th>
|
|
24
33
|
<th
|
|
25
34
|
ref="action-section"
|
|
@@ -41,8 +50,14 @@
|
|
|
41
50
|
</th>
|
|
42
51
|
</table-row>
|
|
43
52
|
<table-row v-else>
|
|
44
|
-
<table-cell
|
|
45
|
-
|
|
53
|
+
<table-cell
|
|
54
|
+
v-for="(tableHeader, idx) in tableHeaders"
|
|
55
|
+
:key="headerLabels[idx]"
|
|
56
|
+
>
|
|
57
|
+
<cell-value
|
|
58
|
+
:is-loader-active="true"
|
|
59
|
+
:cell-title="headerLabels[idx]"
|
|
60
|
+
/>
|
|
46
61
|
</table-cell>
|
|
47
62
|
</table-row>
|
|
48
63
|
</tbody>
|
|
@@ -112,12 +127,13 @@ export default {
|
|
|
112
127
|
data() {
|
|
113
128
|
return {
|
|
114
129
|
fakeCellWidth: 0,
|
|
130
|
+
headerSortables: [],
|
|
115
131
|
};
|
|
116
132
|
},
|
|
117
133
|
|
|
118
134
|
computed: {
|
|
119
135
|
loaderCols() {
|
|
120
|
-
if (this.
|
|
136
|
+
if (this.isFullTableLoaderActive) {
|
|
121
137
|
return 5;
|
|
122
138
|
} else if (this.isLoaderActive) {
|
|
123
139
|
return Math.max(this.tableHeaders.length + 1, 5);
|
|
@@ -128,6 +144,41 @@ export default {
|
|
|
128
144
|
isFullTableLoaderActive() {
|
|
129
145
|
return !this.tableHeaders.length;
|
|
130
146
|
},
|
|
147
|
+
headerLabels() {
|
|
148
|
+
return this.tableHeaders.map((th) =>
|
|
149
|
+
typeof th === "string" ? th : th.label || "Label"
|
|
150
|
+
);
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
watch: {
|
|
155
|
+
tableHeaders: {
|
|
156
|
+
immediate: true,
|
|
157
|
+
handler(n) {
|
|
158
|
+
if (this.headerSortables.length === n.length) {
|
|
159
|
+
n.forEach((th, idx) => {
|
|
160
|
+
if (this.headerSortables[idx].enabled !== !!th.sortable) {
|
|
161
|
+
this.headerSortables[idx].enabled = !!th.sortable;
|
|
162
|
+
this.headerSortables[idx].mode = "";
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
} else {
|
|
166
|
+
this.headerSortables = n.map((th) => {
|
|
167
|
+
if (typeof th === "string") {
|
|
168
|
+
return {
|
|
169
|
+
enabled: false,
|
|
170
|
+
mode: "",
|
|
171
|
+
};
|
|
172
|
+
} else {
|
|
173
|
+
return {
|
|
174
|
+
enabled: !!th.sortable,
|
|
175
|
+
mode: "",
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
},
|
|
131
182
|
},
|
|
132
183
|
|
|
133
184
|
updated() {
|
|
@@ -144,6 +195,25 @@ export default {
|
|
|
144
195
|
this.fakeCellWidth = d;
|
|
145
196
|
}
|
|
146
197
|
},
|
|
198
|
+
emitSortEvent(index) {
|
|
199
|
+
const emitValue = {
|
|
200
|
+
index,
|
|
201
|
+
label: this.tableHeaders[index].label,
|
|
202
|
+
mode: "",
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
this.headerSortables.forEach((hs, idx) => {
|
|
206
|
+
if (idx !== index) hs.mode = "";
|
|
207
|
+
else {
|
|
208
|
+
if (hs.mode === "asc") hs.mode = "desc";
|
|
209
|
+
else hs.mode = "asc";
|
|
210
|
+
|
|
211
|
+
emitValue.mode = hs.mode;
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
this.$emit("sort", emitValue);
|
|
216
|
+
},
|
|
147
217
|
},
|
|
148
218
|
};
|
|
149
219
|
</script>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
custom
|
|
7
7
|
v-slot="{ navigate }"
|
|
8
8
|
>
|
|
9
|
-
<tr @click="navigate">
|
|
9
|
+
<tr class="is-link" @click="navigate">
|
|
10
10
|
<slot />
|
|
11
11
|
<fake-table-cell
|
|
12
12
|
v-if="fakeCellWidth > 0"
|
|
@@ -14,9 +14,14 @@
|
|
|
14
14
|
/>
|
|
15
15
|
</tr>
|
|
16
16
|
</router-link>
|
|
17
|
+
|
|
17
18
|
<tr
|
|
18
19
|
v-else
|
|
19
|
-
:class="{
|
|
20
|
+
:class="{
|
|
21
|
+
'is-selected': isSelected,
|
|
22
|
+
'is-hoverless': !isSelected,
|
|
23
|
+
'is-disabled': isDisabled
|
|
24
|
+
}"
|
|
20
25
|
@click.prevent="$emit('rowselect', true)"
|
|
21
26
|
>
|
|
22
27
|
<slot />
|
|
@@ -32,21 +37,25 @@ export default {
|
|
|
32
37
|
props: {
|
|
33
38
|
link: {
|
|
34
39
|
type: String,
|
|
35
|
-
default: ""
|
|
40
|
+
default: ""
|
|
36
41
|
},
|
|
37
42
|
isSelected: {
|
|
38
43
|
type: Boolean,
|
|
39
|
-
default: false
|
|
44
|
+
default: false
|
|
45
|
+
},
|
|
46
|
+
isDisabled: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
40
49
|
},
|
|
41
50
|
fakeCellWidth: {
|
|
42
51
|
type: Number,
|
|
43
|
-
default: 0
|
|
44
|
-
}
|
|
52
|
+
default: 0
|
|
53
|
+
}
|
|
45
54
|
},
|
|
46
55
|
|
|
47
56
|
components: {
|
|
48
57
|
TableCell: () => import("./TableCell.vue"),
|
|
49
|
-
FakeTableCell: () => import("./FakeTableCell.vue")
|
|
50
|
-
}
|
|
58
|
+
FakeTableCell: () => import("./FakeTableCell.vue")
|
|
59
|
+
}
|
|
51
60
|
};
|
|
52
61
|
</script>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div v-if="isLoaderActive" ref="cellLoaderDiv" :style="{ maxWidth: '300px' }">
|
|
3
|
-
<content-loader :height="10" :width="computedCellWidth || 300"
|
|
3
|
+
<content-loader :height="10" :width="computedCellWidth || 300" :primaryColor="primaryColor"
|
|
4
|
+
:secondaryColor="secondaryColor" />
|
|
4
5
|
</div>
|
|
5
6
|
<div v-else class="haha" ref="cellDiv">
|
|
6
7
|
<object-cell
|
|
@@ -24,6 +25,8 @@
|
|
|
24
25
|
</template>
|
|
25
26
|
|
|
26
27
|
<script>
|
|
28
|
+
import {loaderLightThemePrimaryColor, loaderDarkThemePrimaryColor, loaderLightThemeSecondaryColor, loaderDarkThemeSecondaryColor} from "@appscode/design-system/plugins/theme";
|
|
29
|
+
|
|
27
30
|
export default {
|
|
28
31
|
props: {
|
|
29
32
|
isLoaderActive: {
|
|
@@ -56,6 +59,12 @@ export default {
|
|
|
56
59
|
maxCharacterLength() {
|
|
57
60
|
return Math.ceil(this.computedCellWidth / 8);
|
|
58
61
|
},
|
|
62
|
+
primaryColor() {
|
|
63
|
+
return document.documentElement.classList.contains("is-dark-theme") ? loaderDarkThemePrimaryColor : loaderLightThemePrimaryColor;
|
|
64
|
+
},
|
|
65
|
+
secondaryColor() {
|
|
66
|
+
return document.documentElement.classList.contains("is-dark-theme") ? loaderDarkThemeSecondaryColor : loaderLightThemeSecondaryColor;
|
|
67
|
+
}
|
|
59
68
|
},
|
|
60
69
|
|
|
61
70
|
data() {
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button
|
|
3
|
+
class="button ac-button is-extra-small"
|
|
4
|
+
:class="`${modifierClasses}${isLoaderActive ? ' is-loading' : ''}`"
|
|
5
|
+
:disabled="disabled ? true : null"
|
|
6
|
+
@click="handleClick"
|
|
7
|
+
>
|
|
8
|
+
<span v-if="iconClass || iconImage" class="icon is-small">
|
|
9
|
+
<img
|
|
10
|
+
v-if="iconImage"
|
|
11
|
+
:src="iconImage"
|
|
12
|
+
alt="close-icon"
|
|
13
|
+
:width="iconImageWidth"
|
|
14
|
+
/>
|
|
15
|
+
<i v-else :class="`fa fa-${iconClass}`" aria-hidden="true" />
|
|
16
|
+
</span>
|
|
17
|
+
<span v-if="title" :class="titleModifierClass">{{ title }}</span>
|
|
18
|
+
<slot />
|
|
19
|
+
</button>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import { defineComponent } from "vue";
|
|
24
|
+
export default defineComponent({
|
|
25
|
+
props: {
|
|
26
|
+
// button title
|
|
27
|
+
title: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: "",
|
|
30
|
+
},
|
|
31
|
+
// for loader
|
|
32
|
+
isLoaderActive: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false,
|
|
35
|
+
},
|
|
36
|
+
// for disability
|
|
37
|
+
disabled: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false,
|
|
40
|
+
},
|
|
41
|
+
// for icon
|
|
42
|
+
iconClass: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: "",
|
|
45
|
+
},
|
|
46
|
+
iconImage: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: "",
|
|
49
|
+
},
|
|
50
|
+
iconImageWidth: {
|
|
51
|
+
type: Number,
|
|
52
|
+
default: undefined,
|
|
53
|
+
},
|
|
54
|
+
// modifier class
|
|
55
|
+
modifierClasses: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: "is-primary",
|
|
58
|
+
},
|
|
59
|
+
titleModifierClass: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: "",
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
emits: ["click"],
|
|
66
|
+
|
|
67
|
+
methods: {
|
|
68
|
+
handleClick(e) {
|
|
69
|
+
if (!this.disabled) this.$emit("click", e);
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
</script>
|