@appscode/design-system 1.1.0-beta.63 → 1.1.0-beta.64

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.63",
3
+ "version": "1.1.0-beta.64",
4
4
  "description": "A design system for Appscode websites and dashboards made using Bulma",
5
5
  "main": "main.scss",
6
6
  "scripts": {
@@ -77,9 +77,6 @@ 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
-
83
80
  const onWindowResize = () => {
84
81
  if (ac_table.value && props.isDynamicWidthTable) {
85
82
  const tableWidth = ac_table.value.clientWidth;
@@ -111,26 +108,6 @@ const emitSortEvent = (index: number) => {
111
108
  watch(
112
109
  () => props.tableHeaders,
113
110
  (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
-
134
111
  if (headerSortables.value.length === n.length) {
135
112
  n.forEach((th, idx) => {
136
113
  if (headerSortables.value[idx].enabled !== !!th?.sort?.enable) {
@@ -179,13 +156,6 @@ onUpdated(() => {
179
156
  // 'is-bordered': columnStriped,
180
157
  }"
181
158
  >
182
- <colgroup>
183
- <col
184
- v-for="(hw, idx) in headerWidths"
185
- :key="`${hw}-${idx}`"
186
- :width="`${(hw / totalWidth) * 100}%`"
187
- />
188
- </colgroup>
189
159
  <thead>
190
160
  <table-row v-if="isFullTableLoaderActive">
191
161
  <th v-for="i in loaderCols" :key="i">
@@ -473,6 +443,8 @@ onUpdated(() => {
473
443
  animation: collapse 0.5s ease-in-out;
474
444
  }
475
445
  }
446
+
447
+ white-space: nowrap;
476
448
  }
477
449
 
478
450
  .options-items {
@@ -8,18 +8,10 @@ interface Props {
8
8
  const props = withDefaults(defineProps<Props>(), {
9
9
  cellWidth: null,
10
10
  });
11
-
12
- const styleOb = computed(() => {
13
- const ob: { width?: string } = {};
14
- if (props.cellWidth) {
15
- ob.width = `${props.cellWidth}px`;
16
- }
17
- return ob || {};
18
- });
19
11
  </script>
20
12
 
21
13
  <template>
22
- <td :style="styleOb">
14
+ <td>
23
15
  <slot />
24
16
  </td>
25
17
  </template>
@@ -51,10 +51,10 @@ const printableStringObjs = computed(() => {
51
51
 
52
52
  const indexOfCharacterLengthExceed = computed(() => {
53
53
  let idx = -1;
54
- let cumulativeLen = 0;
54
+ let cumulativeLen = 2;
55
55
  for (const [index, po] of printableStringObjs.value.entries()) {
56
56
  const newLen = cumulativeLen + po.print.length + 2;
57
- if (newLen + 2 > props.maxCharacterLength) {
57
+ if (newLen + 4 > props.maxCharacterLength) {
58
58
  idx = index;
59
59
  break;
60
60
  }
@@ -73,6 +73,7 @@ const indexOfCharacterLengthExceed = computed(() => {
73
73
  indexOfCharacterLengthExceed
74
74
  )"
75
75
  :key="`${printableStringOb.print}-${idx}`"
76
+ modifierClasses="is-primary is-light"
76
77
  >
77
78
  <value-with-modal
78
79
  v-if="printableStringOb.exceededLength"
@@ -7,6 +7,7 @@ import {
7
7
  ref,
8
8
  watch,
9
9
  } from "vue";
10
+ import { useElementSize } from "@vueuse/core";
10
11
 
11
12
  interface Props {
12
13
  isLoaderActive?: boolean;
@@ -37,7 +38,6 @@ const loaderDarkThemePrimaryColor = "#2e323c";
37
38
  const loaderLightThemeSecondaryColor = "#ecebeb";
38
39
  const loaderDarkThemeSecondaryColor = "#21272e";
39
40
 
40
- const computedCellWidth = ref(50);
41
41
  const cellLoaderDiv = ref<HTMLElement | null>(null);
42
42
  const cellDiv = ref<HTMLElement | null>(null);
43
43
 
@@ -49,8 +49,10 @@ const valueType = computed(() => {
49
49
  } else return typeof props.value;
50
50
  });
51
51
 
52
+ const { width: cellLoaderDivWidth } = useElementSize(cellLoaderDiv);
53
+ const { width: cellDivWidth } = useElementSize(cellDiv);
52
54
  const maxCharacterLength = computed(() => {
53
- return Math.ceil(computedCellWidth.value / 10);
55
+ return Math.ceil(cellDivWidth.value / 6);
54
56
  });
55
57
 
56
58
  const primaryColor = computed(() => {
@@ -64,41 +66,14 @@ const secondaryColor = computed(() => {
64
66
  ? loaderDarkThemeSecondaryColor
65
67
  : loaderLightThemeSecondaryColor;
66
68
  });
67
-
68
- const calcCellWidth = () => {
69
- if (props.isLoaderActive) {
70
- nextTick(() => {
71
- if (cellLoaderDiv.value) {
72
- computedCellWidth.value = cellLoaderDiv.value.offsetWidth;
73
- }
74
- });
75
- } else {
76
- nextTick(() => {
77
- if (cellDiv.value) {
78
- computedCellWidth.value = cellDiv.value.offsetWidth;
79
- }
80
- });
81
- }
82
- };
83
-
84
- onMounted(() => {
85
- calcCellWidth();
86
- });
87
-
88
- watch(
89
- () => props.isLoaderActive,
90
- () => {
91
- calcCellWidth();
92
- }
93
- );
94
69
  </script>
95
70
 
96
71
  <template>
97
72
  <div v-if="isLoaderActive" ref="cellLoaderDiv" :style="{ maxWidth: '300px' }">
98
73
  <content-loader
99
- :view-box="`0 0 ${computedCellWidth || 300} 10`"
74
+ :view-box="`0 0 ${cellLoaderDivWidth || 300} 10`"
100
75
  :speed="2"
101
- :key="computedCellWidth"
76
+ :key="cellLoaderDivWidth"
102
77
  :primaryColor="primaryColor"
103
78
  :secondaryColor="secondaryColor"
104
79
  />
@@ -119,7 +94,7 @@ watch(
119
94
  data-testid="array-cell-value"
120
95
  />
121
96
  <template v-else>
122
- <span class="is-ellipsis-1" :title="tooltip" data-testid="cell-value">{{
97
+ <span :title="tooltip" data-testid="cell-value">{{
123
98
  value || (value === 0 ? 0 : "-")
124
99
  }}</span>
125
100
  </template>
@@ -9,7 +9,7 @@ interface Props {
9
9
 
10
10
  const props = withDefaults(defineProps<Props>(), {
11
11
  cellTitle: "cell title",
12
- maxCharacterLength: 50,
12
+ maxCharacterLength: 64,
13
13
  obj: () => ({}),
14
14
  });
15
15
 
@@ -46,10 +46,10 @@ const printableStringObjs = computed(() => {
46
46
 
47
47
  const indexOfCharacterLengthExceed = computed(() => {
48
48
  let idx = -1;
49
- let cumulativeLen = 0;
49
+ let cumulativeLen = 2;
50
50
  for (const [index, po] of printableStringObjs.value.entries()) {
51
51
  const newLen = cumulativeLen + po.print.length + 2;
52
- if (newLen + 2 > props.maxCharacterLength) {
52
+ if (newLen + 4 > props.maxCharacterLength) {
53
53
  idx = index;
54
54
  break;
55
55
  }