@appscode/design-system 2.1.7 → 2.2.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.
Files changed (74) hide show
  1. package/package.json +1 -1
  2. package/vue-components/v3/form-fields/Switch.vue +1 -1
  3. package/vue-components/v3/navbar/NavbarItem.vue +11 -2
  4. package/vue-components/v3/navbar/User.vue +5 -12
  5. package/vue-components/v2/banner/Banner.vue +0 -12
  6. package/vue-components/v2/breadcrumbs/Breadcrumb.vue +0 -84
  7. package/vue-components/v2/button/Button.vue +0 -70
  8. package/vue-components/v2/button/Buttons.vue +0 -5
  9. package/vue-components/v2/button/DownloadBtn.vue +0 -45
  10. package/vue-components/v2/card/Card.vue +0 -37
  11. package/vue-components/v2/card/CardContent.vue +0 -5
  12. package/vue-components/v2/card/CardHeader.vue +0 -10
  13. package/vue-components/v2/card/Cards.vue +0 -5
  14. package/vue-components/v2/card/OverviewCard.vue +0 -10
  15. package/vue-components/v2/card/OverviewCards.vue +0 -20
  16. package/vue-components/v2/card/PaymentCard.vue +0 -69
  17. package/vue-components/v2/card/PaymentCardOptionButtons.vue +0 -35
  18. package/vue-components/v2/card/PaymentCards.vue +0 -48
  19. package/vue-components/v2/content/ContentHeader.vue +0 -50
  20. package/vue-components/v2/content/ContentLayout.vue +0 -9
  21. package/vue-components/v2/content/ContentTable.vue +0 -62
  22. package/vue-components/v2/editor/Editor.vue +0 -144
  23. package/vue-components/v2/editor/FilteredFileEditor.vue +0 -177
  24. package/vue-components/v2/editor/MonacoEditor.vue +0 -118
  25. package/vue-components/v2/editor/ResourceKeyValueEditor.vue +0 -199
  26. package/vue-components/v2/form/Form.vue +0 -54
  27. package/vue-components/v2/form/FormFooterControl.vue +0 -5
  28. package/vue-components/v2/form/FormFooterControls.vue +0 -5
  29. package/vue-components/v2/form-fields/AcSingleInput.vue +0 -20
  30. package/vue-components/v2/form-fields/Input.vue +0 -17
  31. package/vue-components/v2/header/Header.vue +0 -34
  32. package/vue-components/v2/header/HeaderItem.vue +0 -5
  33. package/vue-components/v2/header/HeaderItems.vue +0 -5
  34. package/vue-components/v2/icons/Ellipsis.vue +0 -4
  35. package/vue-components/v2/loaders/ResourceLoader.vue +0 -101
  36. package/vue-components/v2/loaders/SidebarLoader.vue +0 -43
  37. package/vue-components/v2/modal/Modal.vue +0 -137
  38. package/vue-components/v2/modals/DeleteConfirmationModal.vue +0 -74
  39. package/vue-components/v2/modals/JsonShowModal.vue +0 -69
  40. package/vue-components/v2/navbar/Appdrawer.vue +0 -74
  41. package/vue-components/v2/navbar/Navbar.vue +0 -29
  42. package/vue-components/v2/navbar/NavbarItem.vue +0 -7
  43. package/vue-components/v2/navbar/NavbarItemContent.vue +0 -5
  44. package/vue-components/v2/navbar/ThemeMode.vue +0 -114
  45. package/vue-components/v2/navbar/User.vue +0 -190
  46. package/vue-components/v2/notification/Notification.vue +0 -92
  47. package/vue-components/v2/notification/NotificationItem.vue +0 -42
  48. package/vue-components/v2/pagination/Pagination.vue +0 -214
  49. package/vue-components/v2/preloader/Preloader.vue +0 -26
  50. package/vue-components/v2/searchbars/SearchBar.vue +0 -31
  51. package/vue-components/v2/sidebar/ClusterSwitcher.vue +0 -126
  52. package/vue-components/v2/sidebar/Sidebar.vue +0 -5
  53. package/vue-components/v2/sidebar/SidebarItem.vue +0 -59
  54. package/vue-components/v2/sidebar/SidebarItemWithDropDown.vue +0 -114
  55. package/vue-components/v2/tab/TabItem.vue +0 -16
  56. package/vue-components/v2/tab/Tabs.vue +0 -7
  57. package/vue-components/v2/tab/TabsBody.vue +0 -5
  58. package/vue-components/v2/table/EmptyTableImage.vue +0 -3
  59. package/vue-components/v2/table/EmptyTableInfo.vue +0 -6
  60. package/vue-components/v2/table/FakeTableCell.vue +0 -35
  61. package/vue-components/v2/table/InfoTable.vue +0 -91
  62. package/vue-components/v2/table/NarrowTable.vue +0 -17
  63. package/vue-components/v2/table/Table.vue +0 -212
  64. package/vue-components/v2/table/TableCell.vue +0 -26
  65. package/vue-components/v2/table/TableContainer.vue +0 -5
  66. package/vue-components/v2/table/TableRow.vue +0 -50
  67. package/vue-components/v2/table/table-cell/ArrayCell.vue +0 -94
  68. package/vue-components/v2/table/table-cell/CellValue.vue +0 -125
  69. package/vue-components/v2/table/table-cell/GenericCell.vue +0 -56
  70. package/vue-components/v2/table/table-cell/ObjectCell.vue +0 -93
  71. package/vue-components/v2/table/table-cell/ValueWithModal.vue +0 -34
  72. package/vue-components/v2/tabs/EditorTabs.vue +0 -28
  73. package/vue-components/v2/tag/Tag.vue +0 -16
  74. package/vue-components/v2/tag/Tags.vue +0 -5
@@ -1,29 +0,0 @@
1
- <template>
2
- <div class="ac-navbar-area" id="header">
3
- <div class="ac-navbar-inner">
4
- <!-- navbar start -->
5
- <nav class="ac-navbar">
6
- <!-- navbar logo start -->
7
- <!-- <div class="ac-navbar-brand">
8
- <slot name="navbar-brand-logo" />
9
- </div> -->
10
- <!-- navbar logo end -->
11
-
12
- <!-- navbar search area start -->
13
- <div class="ac-navbar-search">
14
- <slot name="navbar-search" />
15
- </div>
16
- <!-- navbar search area end -->
17
-
18
- <!-- navbar menus start -->
19
- <div class="ac-navbar-menu">
20
- <!-- single navbar menu item start -->
21
- <slot />
22
- <!-- single navbar menu item end -->
23
- </div>
24
- <!-- navbar menus end -->
25
- </nav>
26
- <!-- navbar end -->
27
- </div>
28
- </div>
29
- </template>
@@ -1,7 +0,0 @@
1
- <template>
2
- <div class="ac-menu-item">
3
- <slot />
4
- </div>
5
- </template>
6
-
7
- <style></style>
@@ -1,5 +0,0 @@
1
- <template>
2
- <div class="ac-menu-content">
3
- <slot />
4
- </div>
5
- </template>
@@ -1,114 +0,0 @@
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 = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
81
- this.addColorSchemeEventListener();
82
- theme = isDarkMode ? "dark" : "light";
83
- } else {
84
- this.removeColorSchemeEventListener();
85
- }
86
- this.$emit("set:theme", theme);
87
- this.handleDarkThemeClass(theme);
88
- },
89
-
90
- // add proper css class to update the ui theme
91
- handleDarkThemeClass(currentTheme) {
92
- if (currentTheme === "light") {
93
- document.documentElement.classList.remove("is-dark-theme");
94
- } else {
95
- document.documentElement.classList.add("is-dark-theme");
96
- }
97
- },
98
-
99
- // add system theme listener event
100
- addColorSchemeEventListener() {
101
- window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", this.handleSystemThemeChange);
102
- },
103
-
104
- // remove system theme listener event
105
- removeColorSchemeEventListener() {
106
- window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change", this.handleSystemThemeChange);
107
- },
108
-
109
- handleSystemThemeChange() {
110
- this.onThemeModeChange(this.themeMode);
111
- },
112
- },
113
- };
114
- </script>
@@ -1,190 +0,0 @@
1
- <template>
2
- <navbar-item>
3
- <button class="button ac-nav-button ac-profile-button">
4
- <div class="ac-user-profile">
5
- <img :src="user.avatar_url" alt="User Photo" />
6
- </div>
7
- {{ user.full_name || user.username }}
8
- <i class="fa fa-angle-down" aria-hidden="true"></i>
9
- </button>
10
- <navbar-item-content class="navbar-dropdown-wrapper">
11
- <div v-if="user.username" class="user-profile-wrapper" @mouseleave="onMouseLeave()">
12
- <div class="profile-area">
13
- <div class="profile-photo">
14
- <img :src="user.avatar_url" alt="User Photo" class="width-50 height-50" />
15
- <button class="camera-icon"></button>
16
- </div>
17
- <div class="profile-info" style="width: calc(100% - 60px)">
18
- <a
19
- :href="`${serverDomain}/${user.username}`"
20
- :title="user.username.toUpperCase()"
21
- data-testid="user-profile-link"
22
- class="line-break-anywhere is-ellipsis-1"
23
- >{{ user.username.toUpperCase() }}</a
24
- >
25
- <a :href="`mailto:${user.email}`"> {{ user.email }}</a>
26
- </div>
27
- </div>
28
- <transition-group name="list" tag="ul">
29
- <li key="settings">
30
- <a data-testid="user-settings-link" :href="`${serverDomain}/user/settings/`">Settings</a>
31
- </li>
32
- <li v-if="isLoggedinUserAdmin" key="site-admin">
33
- <a data-testid="site-admin-link" :href="`${accountsDomain}/admin`">Site Administration</a>
34
- </li>
35
- <li v-if="showAccountSwitcher" :class="`is-${dropDownStatus}`" key="switcher">
36
- <a
37
- class="ac-dropdown-button is-fullwidth is-flex is-justify-content-space-between is-align-items-center"
38
- @click="toggleList()"
39
- >
40
- <span>Switch Account</span>
41
- <span><i :class="`fa fa-angle-${dropDownStatus === 'open' ? 'up' : 'down'}`"></i></span>
42
- </a>
43
- <transition-group
44
- name="list"
45
- tag="ul"
46
- class="ac-vscrollbar"
47
- ref="dropdownItems"
48
- :style="{ maxHeight: dropDownSectionHeight }"
49
- >
50
- <li v-for="(org, idx) in formattedOrganizations" :key="org.username">
51
- <a class="is-flex is-align-items-center" @click="onOrganizationClick(org.username)">
52
- <div class="width-30 height-30 image">
53
- <img :src="org.avatar_url" class="ac-user-profile is-rounded" alt="icon" />
54
- </div>
55
- <div class="is-flex is-align-items-center is-justify-content-space-between is-fullwidth ml-10">
56
- <div class="org-info">
57
- <strong :title="org.username" class="line-break-anywhere is-ellipsis-1">{{
58
- org.username
59
- }}</strong>
60
- <p>
61
- {{ org.isPersonalAccount ? "Personal Account" : "Organization" }}
62
- </p>
63
- </div>
64
- <span v-if="idx === 0" class="material-icons-outlined font-size-18 ml-10 is-pulled-right">
65
- check
66
- </span>
67
- </div>
68
- </a>
69
- </li>
70
- </transition-group>
71
- </li>
72
- <li key="dashboard">
73
- <nuxt-link v-if="isPlatformDomain" to="/dashboard" data-testid="user-dashboard-link"> Dashboard </nuxt-link>
74
- <a v-else :href="`${serverDomain}/dashboard`" data-testid="user-dashboard-link"> Dashboard </a>
75
- </li>
76
- <li key="signout">
77
- <a :href="`${accountsDomain}/user/logout`" data-testid="signout-link"> Sign out </a>
78
- </li>
79
- </transition-group>
80
- </div>
81
- </navbar-item-content>
82
- </navbar-item>
83
- </template>
84
-
85
- <script>
86
- export default {
87
- props: {
88
- // active user info
89
- user: {
90
- type: Object,
91
- default: () => ({}),
92
- },
93
- serverDomain: {
94
- type: String,
95
- default: "",
96
- },
97
- accountsDomain: {
98
- type: String,
99
- default: "",
100
- },
101
- showAccountSwitcher: {
102
- type: Boolean,
103
- default: false,
104
- },
105
- // all available organization list including personal account
106
- organizations: {
107
- type: Array,
108
- default: () => [],
109
- },
110
- isLoggedinUserAdmin: {
111
- type: Boolean,
112
- default: false,
113
- },
114
- isPlatformDomain: {
115
- type: Boolean,
116
- default: false,
117
- },
118
- },
119
-
120
- components: {
121
- NavbarItem: () => import("./NavbarItem.vue"),
122
- NavbarItemContent: () => import("./NavbarItemContent.vue"),
123
- },
124
-
125
- computed: {
126
- formattedOrganizations() {
127
- let activeUser;
128
- const filteredList = this.organizations.filter((item) => {
129
- if (item.username === this.user.username) {
130
- activeUser = item;
131
- } else {
132
- return true;
133
- }
134
- return false;
135
- });
136
-
137
- filteredList.unshift(activeUser);
138
-
139
- return filteredList || [];
140
- },
141
- },
142
-
143
- data() {
144
- return {
145
- dropDownStatus: "close",
146
- dropDownSectionHeight: null,
147
- };
148
- },
149
-
150
- methods: {
151
- toggleList() {
152
- this.dropDownStatus = this.dropDownStatus === "open" ? "close" : "open";
153
- this.$nextTick(() => {
154
- this.$refs["dropdownItems"].$el.scrollTo(0, 0);
155
- });
156
- },
157
- onOrganizationClick(orgName) {
158
- this.$refs["dropdownItems"].$el.scrollTo(0, 0);
159
- this.$emit("activeorg$set", orgName);
160
- },
161
- onMouseLeave() {
162
- this.dropDownStatus = "close";
163
- },
164
- },
165
-
166
- watch: {
167
- dropDownStatus: {
168
- immediate: true,
169
- handler(n) {
170
- if (n === "open") {
171
- this.$nextTick(() => {
172
- const dropDownUl = this.$refs["dropdownItems"];
173
- if (dropDownUl) this.dropDownSectionHeight = `${dropDownUl.scrollHeight}px`;
174
- });
175
- } else {
176
- this.dropDownSectionHeight = null;
177
- }
178
- },
179
- },
180
- },
181
- };
182
- </script>
183
- <style lang="scss" scoped>
184
- .ac-vscrollbar {
185
- overflow: auto !important;
186
- }
187
- .line-break-anywhere {
188
- line-break: anywhere;
189
- }
190
- </style>
@@ -1,92 +0,0 @@
1
- <template>
2
- <div @mouseenter="notificationPanelOpen = true" @mouseleave="notificationPanelOpen = false">
3
- <button class="button ac-nav-button">
4
- <span v-if="unreadCount">{{ unreadCount }}</span>
5
- <i class="fa fa-bell" :class="{ 'ac-shake': unreadCount }" aria-hidden="true"></i>
6
- </button>
7
- <div class="ac-menu-content is-notification">
8
- <div class="notification-header">
9
- <div class="left-content">
10
- <p>
11
- Notifications <span>({{ notifications.length }})</span>
12
- </p>
13
- </div>
14
- <div class="right-content"></div>
15
- </div>
16
- <div :key="notificationPanelOpen ? 1 : 0" class="notification-body">
17
- <transition-group v-if="notifications.length" name="slide-right">
18
- <notification-item
19
- v-for="notification in notifications"
20
- :key="`${notification.id}${unreadCount}`"
21
- :notification="notification"
22
- />
23
- </transition-group>
24
- <span v-else class="single-notification-item">No new notifications</span>
25
- </div>
26
- </div>
27
- </div>
28
- </template>
29
-
30
- <script>
31
- import { StringCodec } from "nats.ws/cjs/nats";
32
- export default {
33
- components: {
34
- NotificationItem: () => import("./NotificationItem.vue"),
35
- },
36
- data() {
37
- return {
38
- notifications: [],
39
- notificationsRead: 0,
40
-
41
- notificationPanelOpen: false,
42
- subscription: null,
43
- };
44
- },
45
- computed: {
46
- unreadCount() {
47
- return this.notifications.length - this.notificationsRead;
48
- },
49
- },
50
- watch: {
51
- notificationPanelOpen(n) {
52
- if (n) {
53
- this.notificationsRead = this.notifications.length;
54
- }
55
- },
56
- },
57
- created() {
58
- this.subscribeToNotifcations();
59
- },
60
- methods: {
61
- addNewNotification(notification) {
62
- this.notifications.unshift(notification);
63
- if (this.notificationPanelOpen) {
64
- this.notificationsRead = this.notifications.length;
65
- }
66
- },
67
- async subscribeToNotifcations() {
68
- this.subscription = this.$nc?.subscribe("notifications");
69
- console.log("Started listening to Notifications");
70
-
71
- if (this.subscription) {
72
- // listen to channel events
73
- for await (const msg of this.subscription) {
74
- console.log("notifications ===>");
75
- console.log({ data: StringCodec().decode(msg.data) });
76
- const log = JSON.parse(StringCodec().decode(msg.data));
77
- console.log({ log });
78
- const currentTime = new Date().getTime();
79
- this.addNewNotification({
80
- ...log,
81
- id: currentTime,
82
- time: currentTime,
83
- });
84
- msg.respond();
85
- }
86
- console.log("Stopped listening to Notifications");
87
- console.log("Closed Channel Notifications");
88
- }
89
- },
90
- },
91
- };
92
- </script>
@@ -1,42 +0,0 @@
1
- <template>
2
- <a class="single-notification-item is-complete">
3
- <p>
4
- {{ notification.msg }}
5
- </p>
6
- <div class="notification-status">
7
- <p
8
- :class="{
9
- 'is-success': notification.status === 'Success',
10
- 'has-text-danger': notification.status === 'Failed',
11
- 'is-info': notification.status === 'Started' || notification.status === 'Running',
12
- 'is-warning': notification.status === 'Pending',
13
- }"
14
- >
15
- <i
16
- class="fa mr-5"
17
- :class="{
18
- 'fa-check': notification.status === 'Success',
19
- 'fa-exclamation-triangle': notification.status === 'Failed',
20
- 'fa-info-circle':
21
- notification.status === 'Started' ||
22
- notification.status === 'Pending' ||
23
- notification.status === 'Running',
24
- }"
25
- />
26
- {{ notification.status }}
27
- </p>
28
- <p>{{ notification.time | getDayDifferences }} ago</p>
29
- </div>
30
- </a>
31
- </template>
32
-
33
- <script>
34
- export default {
35
- props: {
36
- notification: {
37
- type: Object,
38
- default: () => ({}),
39
- },
40
- },
41
- };
42
- </script>
@@ -1,214 +0,0 @@
1
- <template>
2
- <div class="level inner-table-pagination" v-show="showPagination">
3
- <div class="pagination-filter level-left">
4
- <div class="level-item" v-show="!hideRowsPerPageSelection && totalNoOfItems > preSelectedItemsCountPerPage">
5
- <label>Rows per page</label>
6
- <select v-model="selectedItemCountPerPage" name="page" data-testid="rows-per-page-selector">
7
- <option :value="5">5</option>
8
- <option :value="10" v-show="totalNoOfItems > 5">10</option>
9
- <option :value="15" v-show="totalNoOfItems > 10">15</option>
10
- <option :value="20" v-show="totalNoOfItems > 15">20</option>
11
- <option :value="25" v-show="totalNoOfItems > 20">25</option>
12
- <option :value="50" v-show="totalNoOfItems > 25">50</option>
13
- </select>
14
- </div>
15
- </div>
16
-
17
- <nav class="pagination-item level-right">
18
- <p class="counting-page">
19
- Showing
20
- <span>{{ itemsRange.start + 1 }}</span
21
- >to <span>{{ itemsRange.end }}</span
22
- >of <span>{{ totalNoOfItems }}</span
23
- >{{ totalNoOfItems > 1 ? "Items" : "Item" }}
24
- </p>
25
-
26
- <ul v-if="totalNoOfItems > selectedItemCountPerPage">
27
- <li>
28
- <a class="previous" @click.prevent="prevPage()" data-testid="pagination-previous-page-button">
29
- <i class="fa fa-angle-left" aria-hidden="true"></i>
30
- </a>
31
- </li>
32
- <li v-for="page in pages" :key="`page-${page}`">
33
- <a
34
- @click.prevent="changePage(page)"
35
- data-testid="pagination-page-switch-button"
36
- :class="{ 'is-current': activePageNo === page }"
37
- >{{ page }}</a
38
- >
39
- </li>
40
- <li>
41
- <a class="next" @click.prevent="nextPage()" data-testid="pagination-next-page-button">
42
- <i class="fa fa-angle-right" aria-hidden="true"></i>
43
- </a>
44
- </li>
45
- </ul>
46
- </nav>
47
- </div>
48
- </template>
49
-
50
- <script>
51
- export default {
52
- props: {
53
- hideRowsPerPageSelection: {
54
- type: Boolean,
55
- default: false,
56
- },
57
- totalNoOfItems: {
58
- type: Number,
59
- default: 0,
60
- },
61
- preSelectedItemsCountPerPage: {
62
- type: Number,
63
- default: 5,
64
- },
65
- },
66
-
67
- data() {
68
- return {
69
- activePageNo: 1,
70
- selectedItemCountPerPage: 5,
71
- };
72
- },
73
-
74
- computed: {
75
- noOfPages() {
76
- return Math.ceil(this.totalNoOfItems / this.selectedItemCountPerPage);
77
- },
78
- noOfPageNos() {
79
- return Math.min(this.noOfPages, 5);
80
- },
81
- pageRange() {
82
- let o = { start: 1, end: 0 };
83
- if (this.noOfPageNos < 5) {
84
- o.start = 1;
85
- o.end = this.noOfPageNos;
86
- } else {
87
- if (this.activePageNo < 3) {
88
- o.start = 1;
89
- o.end = 5;
90
- } else if (this.activePageNo > this.noOfPages - 2) {
91
- o.start = this.noOfPages - 4;
92
- o.end = this.noOfPages;
93
- } else {
94
- o.start = this.activePageNo - 2;
95
- o.end = this.activePageNo + 2;
96
- }
97
- }
98
- return o;
99
- },
100
- pages() {
101
- let ar = [];
102
- let start = this.pageRange.start;
103
- let end = this.pageRange.end;
104
- for (let i = start; i <= end; i++) {
105
- ar.push(i);
106
- }
107
- return ar;
108
- },
109
- itemsRange() {
110
- let start = (this.activePageNo - 1) * this.selectedItemCountPerPage;
111
- let end = Math.min(this.activePageNo * this.selectedItemCountPerPage, this.totalNoOfItems);
112
-
113
- return { start, end };
114
- },
115
- showPagination() {
116
- return this.itemsRange.end > this.itemsRange.start;
117
- },
118
- },
119
-
120
- created() {
121
- this.selectedItemCountPerPage = this.preSelectedItemsCountPerPage;
122
- },
123
-
124
- methods: {
125
- prevPage() {
126
- this.activePageNo = Math.max(this.activePageNo - 1, 1);
127
- },
128
- changePage(page) {
129
- this.activePageNo = page;
130
- },
131
- nextPage() {
132
- this.activePageNo = Math.min(this.activePageNo + 1, this.noOfPages);
133
- },
134
- },
135
-
136
- watch: {
137
- itemsRange: {
138
- deep: true,
139
- handler(n) {
140
- this.$emit("pagination:pagechange", n);
141
- },
142
- },
143
- selectedItemCountPerPage() {
144
- this.activePageNo = 1;
145
- },
146
- },
147
- };
148
- </script>
149
- <style lang="scss" scoped>
150
- .inner-table-pagination {
151
- padding: 4px 20px;
152
- }
153
-
154
- .pagination-item {
155
- ul {
156
- li {
157
- display: inline-block;
158
- a {
159
- display: block;
160
- width: 20px;
161
- text-align: center;
162
- font-size: 13px;
163
- font-weight: 500;
164
- border-radius: 4px;
165
- border: 1px solid $color-border;
166
- color: $ac-primary;
167
- margin-left: 4px;
168
-
169
- &:hover {
170
- background-color: $ac-primary !important;
171
- color: $white-100;
172
- border: 1px solid $color-border;
173
- }
174
- &.previous {
175
- background-color: $primary-97;
176
- }
177
- &.next {
178
- background-color: $primary-97;
179
- }
180
- &.is-current {
181
- background-color: $ac-primary;
182
- color: $white-100;
183
- }
184
- }
185
- }
186
- }
187
- }
188
-
189
- .counting-page,
190
- .pagination-filter {
191
- color: $color-text;
192
- font-size: 12px;
193
- span {
194
- font-weight: 500;
195
- padding: 0 4px;
196
- }
197
- }
198
- .pagination-filter {
199
- select {
200
- background-color: $primary-97;
201
- border: 1px solid $color-border;
202
- border-radius: 2px;
203
- margin-left: 4px;
204
- height: 22px;
205
- padding: 0 4px;
206
- &:focus,
207
- &:active,
208
- &:focus-visible {
209
- border: 1px solid $ac-primary;
210
- outline: none;
211
- }
212
- }
213
- }
214
- </style>