@appscode/design-system 1.1.0-beta.56 → 1.1.0-beta.58

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": "1.1.0-beta.56",
3
+ "version": "1.1.0-beta.58",
4
4
  "description": "A design system for Appscode websites and dashboards made using Bulma",
5
5
  "main": "main.scss",
6
6
  "scripts": {
@@ -15,6 +15,7 @@ export interface AcTableCol {
15
15
  name: string;
16
16
  type: "object" | "string" | "number" | "date" | "integer";
17
17
  priority: number;
18
+ width?: number;
18
19
  pathTemplate?: string;
19
20
  format?: string;
20
21
  link?: Record<string, unknown>;
@@ -21,7 +21,8 @@
21
21
  padding: 8px 16px;
22
22
  border-radius: 2px;
23
23
  strong {
24
- width: min(30px);
24
+ min-width: 30px;
25
+ font-size: 14px;
25
26
  }
26
27
  }
27
28
  </style>
@@ -28,7 +28,7 @@ withDefaults(defineProps<Props>(), {
28
28
  .overview-cards-wrapper {
29
29
  border: 1px solid $primary-90;
30
30
  margin-right: 20px;
31
- height: 100%;
31
+ height: calc(100% - 16px);
32
32
  }
33
33
  .overview-cards {
34
34
  display: grid;
@@ -13,7 +13,7 @@ export default {
13
13
  primaryColor="#f5f5f5"
14
14
  secondaryColor="#ecebeb"
15
15
  >
16
- <rect x="0" y="0" rx="0" ry="0" width="NaN" height="NaN" />
16
+ <rect x="0" y="0" rx="0" ry="0" />
17
17
  <rect x="10" y="70" rx="3" ry="3" width="120" height="11" />
18
18
  <rect x="10" y="100" rx="3" ry="3" width="120" height="11" />
19
19
  <rect x="150" y="100" rx="3" ry="3" width="60" height="11" />
@@ -77,6 +77,9 @@ const handleScroller = (value: number) => {
77
77
  emit("scroller", value);
78
78
  };
79
79
 
80
+ const headerWidths = ref<number[]>([]);
81
+ const totalWidth = ref<number>(0);
82
+
80
83
  const onWindowResize = () => {
81
84
  if (ac_table.value && props.isDynamicWidthTable) {
82
85
  const tableWidth = ac_table.value.clientWidth;
@@ -108,6 +111,26 @@ const emitSortEvent = (index: number) => {
108
111
  watch(
109
112
  () => props.tableHeaders,
110
113
  (n) => {
114
+ // calculated column width based on percentages
115
+ headerWidths.value = n.map((th) => th.width || 1);
116
+ totalWidth.value = headerWidths.value.reduce((p, c) => p + c, 0);
117
+ let collapsibleWidth = 0;
118
+ let actionsWidth = 0;
119
+ const collapsibleWidthPercent = 70 / (ac_table.value?.clientWidth || 0);
120
+ const actionsWidthPercent = 140 / (ac_table.value?.clientWidth || 0);
121
+ if (props.collapsible) {
122
+ collapsibleWidth =
123
+ (totalWidth.value * collapsibleWidthPercent) /
124
+ (1 - collapsibleWidthPercent);
125
+ headerWidths.value = [collapsibleWidth, ...headerWidths.value];
126
+ }
127
+ if (props.actionable) {
128
+ actionsWidth =
129
+ (totalWidth.value * actionsWidthPercent) / (1 - actionsWidthPercent);
130
+ headerWidths.value = [...headerWidths.value, actionsWidth];
131
+ }
132
+ totalWidth.value += collapsibleWidth + actionsWidth;
133
+
111
134
  if (headerSortables.value.length === n.length) {
112
135
  n.forEach((th, idx) => {
113
136
  if (headerSortables.value[idx].enabled !== !!th?.sort?.enable) {
@@ -156,6 +179,13 @@ onUpdated(() => {
156
179
  // 'is-bordered': columnStriped,
157
180
  }"
158
181
  >
182
+ <colgroup>
183
+ <col
184
+ v-for="(hw, idx) in headerWidths"
185
+ :key="`${hw}-${idx}`"
186
+ :width="`${(hw / totalWidth) * 100}%`"
187
+ />
188
+ </colgroup>
159
189
  <thead>
160
190
  <table-row v-if="isFullTableLoaderActive">
161
191
  <th v-for="i in loaderCols" :key="i">
@@ -199,11 +229,7 @@ onUpdated(() => {
199
229
  <i class="fa fa-exclamation-triangle" />
200
230
  </span>
201
231
  </th>
202
- <th
203
- ref="action-section"
204
- v-if="actionable"
205
- style="min-width: 100px"
206
- ></th>
232
+ <th ref="action-section" v-if="actionable"></th>
207
233
  <fake-table-cell
208
234
  v-if="fakeCellWidth > 0"
209
235
  :is-header-cell="true"
@@ -53,8 +53,8 @@ const indexOfCharacterLengthExceed = computed(() => {
53
53
  let idx = -1;
54
54
  let cumulativeLen = 0;
55
55
  for (const [index, po] of printableStringObjs.value.entries()) {
56
- const newLen = cumulativeLen + po.print.length;
57
- if (newLen > props.maxCharacterLength) {
56
+ const newLen = cumulativeLen + po.print.length + 2;
57
+ if (newLen + 2 > props.maxCharacterLength) {
58
58
  idx = index;
59
59
  break;
60
60
  }
@@ -50,7 +50,7 @@ const valueType = computed(() => {
50
50
  });
51
51
 
52
52
  const maxCharacterLength = computed(() => {
53
- return Math.ceil(computedCellWidth.value / 8);
53
+ return Math.ceil(computedCellWidth.value / 10);
54
54
  });
55
55
 
56
56
  const primaryColor = computed(() => {
@@ -48,8 +48,8 @@ const indexOfCharacterLengthExceed = computed(() => {
48
48
  let idx = -1;
49
49
  let cumulativeLen = 0;
50
50
  for (const [index, po] of printableStringObjs.value.entries()) {
51
- const newLen = cumulativeLen + po.print.length;
52
- if (newLen > props.maxCharacterLength) {
51
+ const newLen = cumulativeLen + po.print.length + 2;
52
+ if (newLen + 2 > props.maxCharacterLength) {
53
53
  idx = index;
54
54
  break;
55
55
  }
@@ -68,7 +68,7 @@ const indexOfCharacterLengthExceed = computed(() => {
68
68
  indexOfCharacterLengthExceed
69
69
  )"
70
70
  :key="printableStringOb.key"
71
- modifierClasses="is-info is-light"
71
+ modifierClasses="is-primary is-light"
72
72
  >
73
73
  <value-with-modal
74
74
  v-if="printableStringOb.exceededLength"