@appscode/design-system 2.0.74 → 2.0.76

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appscode/design-system",
3
- "version": "2.0.74",
3
+ "version": "2.0.76",
4
4
  "description": "A design system for Appscode websites and dashboards made using Bulma",
5
5
  "main": "main.scss",
6
6
  "scripts": {
@@ -3,6 +3,8 @@
3
3
 
4
4
  .table-container {
5
5
  &.ac-table-container {
6
+ margin-bottom: 8px;
7
+
6
8
  &::-webkit-scrollbar {
7
9
  height: 7px;
8
10
  }
@@ -179,8 +179,6 @@
179
179
  }
180
180
 
181
181
  ul {
182
- max-height: 0;
183
- transition: max-height 0.2s ease-out;
184
182
  margin: 0;
185
183
  padding: 0;
186
184
  border-left: none;
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { nextTick, onMounted, ref, watch } from "vue";
2
+ import { ref } from "vue";
3
3
 
4
4
  interface Props {
5
5
  isDropDownOpen?: boolean;
@@ -13,85 +13,12 @@ const props = withDefaults(defineProps<Props>(), {
13
13
  icon: "https://cdn.appscode.com/k8s/icons/apiextensions.k8s.io/customresourcedefinitions.svg",
14
14
  });
15
15
 
16
- const emit = defineEmits(["dropDownItemChange"]);
17
-
18
- const dropDownStatus = ref("close");
19
- const dropDownSectionHeight = ref<string | null>(null);
20
- const isCompMounted = ref(false);
21
- const sectionItems = ref(null as HTMLElement | null);
22
-
23
- const setDropdownMaxHeight = (mode: string) => {
24
- if (mode === "open" && sectionItems.value) {
25
- dropDownSectionHeight.value = `${sectionItems.value.scrollHeight}px`;
26
- } else {
27
- dropDownSectionHeight.value = null;
28
- }
29
- };
16
+ const dropDownStatus = ref<"close" | "open">(`${props.isDropDownOpen ? "open" : "close"}`);
30
17
 
31
18
  const toggleDropDownStatus = () => {
32
- if (dropDownStatus.value === "open") {
33
- dropDownStatus.value = "close";
34
- } else dropDownStatus.value = "open";
19
+ if (dropDownStatus.value === "open") dropDownStatus.value = "close";
20
+ else dropDownStatus.value = "open";
35
21
  };
36
-
37
- onMounted(() => {
38
- isCompMounted.value = true;
39
- setTimeout(() => {
40
- // for expanding dropdown
41
- if (props.isDropDownOpen) {
42
- setDropdownMaxHeight("open");
43
- } else {
44
- setDropdownMaxHeight("close");
45
- }
46
- }, 200);
47
- });
48
-
49
- watch(
50
- () => props.title,
51
- (n, o) => {
52
- if (n && isCompMounted.value) {
53
- nextTick(() => {
54
- // for expanding dropdown
55
- setDropdownMaxHeight("open");
56
- });
57
- }
58
-
59
- if (o && isCompMounted.value) {
60
- nextTick(() => {
61
- // for expanding dropdown
62
- setDropdownMaxHeight("close");
63
- });
64
- }
65
- }
66
- );
67
-
68
- watch(
69
- () => props.isDropDownOpen,
70
- (n) => {
71
- if (n) {
72
- dropDownStatus.value = "open";
73
- } else dropDownStatus.value = "close";
74
- },
75
- {
76
- immediate: true,
77
- }
78
- );
79
-
80
- watch(dropDownStatus, (n) => {
81
- if (n === "open") {
82
- // emit event to close other drop down items
83
- emit("dropDownItemChange");
84
-
85
- nextTick(() => {
86
- const dropDownUl = sectionItems.value;
87
- // debugger;
88
- if (dropDownUl) dropDownSectionHeight.value = `${dropDownUl.scrollHeight}px`;
89
- });
90
- } else {
91
- // emit event to close other drop down items
92
- dropDownSectionHeight.value = null;
93
- }
94
- });
95
22
  </script>
96
23
 
97
24
  <template>
@@ -106,7 +33,7 @@ watch(dropDownStatus, (n) => {
106
33
  </span>
107
34
  </a>
108
35
 
109
- <ul ref="sectionItems" :style="{ maxHeight: dropDownSectionHeight || undefined }">
36
+ <ul v-if="dropDownStatus == 'open'">
110
37
  <slot />
111
38
  </ul>
112
39
  </li>
@@ -11,6 +11,7 @@ interface Props {
11
11
  isDynamicWidthTable?: boolean;
12
12
  fullWidth?: number;
13
13
  columnStriped?: boolean;
14
+ modifierClass?: string;
14
15
  }
15
16
 
16
17
  const props = withDefaults(defineProps<Props>(), {
@@ -22,6 +23,7 @@ const props = withDefaults(defineProps<Props>(), {
22
23
  isDynamicWidthTable: false,
23
24
  fullWidth: 1920,
24
25
  columnStriped: false,
26
+ modifierClass: "",
25
27
  });
26
28
 
27
29
  const emit = defineEmits(["sort", "scroller"]);
@@ -125,90 +127,93 @@ onUpdated(() => {
125
127
  </script>
126
128
 
127
129
  <template>
128
- <table-container ref="ac_table_container" @scroller="handleScroller">
129
- <table
130
- ref="ac_table"
131
- class="table ac-table is-bordered"
132
- :class="{
133
- 'is-fullwidth': !isDynamicWidthTable || isFullTableLoaderActive || isTableEmpty || isLoaderActive,
134
- // 'ac-striped': !columnStriped,
135
- // 'is-bordered': columnStriped,
136
- }"
137
- >
138
- <thead>
139
- <table-row v-if="isFullTableLoaderActive">
140
- <th v-for="i in loaderCols" :key="i">
141
- <cell-value :is-loader-active="true" />
142
- </th>
143
- </table-row>
144
- <table-row v-else>
145
- <th v-if="collapsible" style="width: 20px" />
146
- <th
147
- v-for="(tableHeader, idx) in tableHeaders"
148
- :key="idx"
149
- :class="{
150
- sorting: headerSortables[idx].enabled,
151
- 'sorting-desc': headerSortables[idx].mode === 'desc',
152
- 'sorting-asc': headerSortables[idx].mode === 'asc',
153
- 'has-text-centered': typeof tableHeader === 'string' ? false : tableHeader.textAlign === 'center',
154
- 'has-text-left': typeof tableHeader === 'string' ? false : tableHeader.textAlign === 'left',
155
- 'has-text-right': typeof tableHeader === 'string' ? false : tableHeader.textAlign === 'right',
156
- }"
157
- @click.prevent="headerSortables[idx].enabled && emitSortEvent(idx)"
158
- >
159
- {{ headerLabels[idx] }}
160
- <span
161
- v-if="tableHeader.dashboard && tableHeader.dashboard.status && tableHeader.dashboard.status !== 'Success'"
162
- :title="tableHeader.dashboard && tableHeader.dashboard.message"
163
- class="icon has-text-danger"
164
- >
165
- <i class="fa fa-exclamation-triangle" />
166
- </span>
167
- </th>
168
- <th ref="action-section" v-if="actionable"></th>
169
- <fake-table-cell v-if="fakeCellWidth > 0" :is-header-cell="true" :fake-cell-width="fakeCellWidth" />
170
- </table-row>
171
- </thead>
172
- <!-- table row loaders -->
173
- <tbody v-if="isFullTableLoaderActive || isLoaderActive">
174
- <table-row v-if="isFullTableLoaderActive">
175
- <th v-for="i in loaderCols" :key="i">
176
- <cell-value :is-loader-active="true" />
177
- </th>
178
- </table-row>
179
- <table-row v-else>
180
- <table-cell v-for="(tableHeader, idx) in tableHeaders" :key="headerLabels[idx]">
181
- <cell-value :is-loader-active="true" :cell-title="headerLabels[idx]" />
182
- </table-cell>
183
- </table-row>
184
- </tbody>
185
- <!-- table row loaders -->
186
- <template v-else>
187
- <tbody v-if="!isTableEmpty">
188
- <!-- table rows -->
189
- <slot :fake-cell-width="fakeCellWidth" />
190
- </tbody>
191
- <tbody v-else>
192
- <table-row class="is-hoverless">
193
- <table-cell
194
- :colspan="tableHeaders.length + (actionable ? 1 : 0) + (collapsible ? 1 : 0)"
195
- class="no-data-available has-text-centered"
130
+ <div class="table-wrapper" :class="modifierClass">
131
+ <table-container ref="ac_table_container" @scroller="handleScroller">
132
+ <table
133
+ ref="ac_table"
134
+ class="table ac-table is-bordered"
135
+ :class="{
136
+ 'is-fullwidth': !isDynamicWidthTable || isFullTableLoaderActive || isTableEmpty || isLoaderActive,
137
+ // 'ac-striped': !columnStriped,
138
+ // 'is-bordered': columnStriped,
139
+ }"
140
+ >
141
+ <thead>
142
+ <table-row v-if="isFullTableLoaderActive">
143
+ <th v-for="i in loaderCols" :key="i">
144
+ <cell-value :is-loader-active="true" />
145
+ </th>
146
+ </table-row>
147
+ <table-row v-else>
148
+ <th v-if="collapsible" style="width: 20px" />
149
+ <th
150
+ v-for="(tableHeader, idx) in tableHeaders"
151
+ :key="idx"
152
+ :class="{
153
+ sorting: headerSortables[idx].enabled,
154
+ 'sorting-desc': headerSortables[idx].mode === 'desc',
155
+ 'sorting-asc': headerSortables[idx].mode === 'asc',
156
+ 'has-text-centered': typeof tableHeader === 'string' ? false : tableHeader.textAlign === 'center',
157
+ 'has-text-left': typeof tableHeader === 'string' ? false : tableHeader.textAlign === 'left',
158
+ 'has-text-right': typeof tableHeader === 'string' ? false : tableHeader.textAlign === 'right',
159
+ }"
160
+ @click.prevent="headerSortables[idx].enabled && emitSortEvent(idx)"
196
161
  >
197
- <empty-table-info />
162
+ {{ headerLabels[idx] }}
163
+ <span
164
+ v-if="
165
+ tableHeader.dashboard && tableHeader.dashboard.status && tableHeader.dashboard.status !== 'Success'
166
+ "
167
+ :title="tableHeader.dashboard && tableHeader.dashboard.message"
168
+ class="icon has-text-danger"
169
+ >
170
+ <i class="fa fa-exclamation-triangle" />
171
+ </span>
172
+ </th>
173
+ <th ref="action-section" v-if="actionable"></th>
174
+ <fake-table-cell v-if="fakeCellWidth > 0" :is-header-cell="true" :fake-cell-width="fakeCellWidth" />
175
+ </table-row>
176
+ </thead>
177
+ <!-- table row loaders -->
178
+ <tbody v-if="isFullTableLoaderActive || isLoaderActive">
179
+ <table-row v-if="isFullTableLoaderActive">
180
+ <th v-for="i in loaderCols" :key="i">
181
+ <cell-value :is-loader-active="true" />
182
+ </th>
183
+ </table-row>
184
+ <table-row v-else>
185
+ <table-cell v-for="(tableHeader, idx) in tableHeaders" :key="headerLabels[idx]">
186
+ <cell-value :is-loader-active="true" :cell-title="headerLabels[idx]" />
198
187
  </table-cell>
199
188
  </table-row>
200
189
  </tbody>
201
- </template>
202
- </table>
203
-
204
- <!-- table footer info start -->
205
- <slot name="table-footer-info" />
206
- <!-- table footer info end -->
207
-
190
+ <!-- table row loaders -->
191
+ <template v-else>
192
+ <tbody v-if="!isTableEmpty">
193
+ <!-- table rows -->
194
+ <slot :fake-cell-width="fakeCellWidth" />
195
+ </tbody>
196
+ <tbody v-else>
197
+ <table-row class="is-hoverless">
198
+ <table-cell
199
+ :colspan="tableHeaders.length + (actionable ? 1 : 0) + (collapsible ? 1 : 0)"
200
+ class="no-data-available has-text-centered"
201
+ >
202
+ <empty-table-info />
203
+ </table-cell>
204
+ </table-row>
205
+ </tbody>
206
+ </template>
207
+ </table>
208
+
209
+ <!-- table footer info start -->
210
+ <slot name="table-footer-info" />
211
+ <!-- table footer info end -->
212
+ </table-container>
208
213
  <!-- pagination start -->
209
214
  <slot name="table-pagination" />
210
215
  <!-- pagination end -->
211
- </table-container>
216
+ </div>
212
217
  </template>
213
218
 
214
219
  <style lang="scss">