@appscode/design-system 1.1.0-beta.56 → 1.1.0-beta.57
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
|
@@ -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) {
|
|
@@ -145,7 +168,7 @@ onUpdated(() => {
|
|
|
145
168
|
<table-container ref="ac_table_container" @scroller="handleScroller">
|
|
146
169
|
<table
|
|
147
170
|
ref="ac_table"
|
|
148
|
-
class="table ac-table
|
|
171
|
+
class="table ac-table"
|
|
149
172
|
:class="{
|
|
150
173
|
'is-fullwidth':
|
|
151
174
|
!isDynamicWidthTable ||
|
|
@@ -153,9 +176,16 @@ onUpdated(() => {
|
|
|
153
176
|
isTableEmpty ||
|
|
154
177
|
isLoaderActive,
|
|
155
178
|
// 'ac-striped': !columnStriped,
|
|
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"
|