Skip to content

Commit f09f61a

Browse files
authored
Merge pull request #6141 from ProcessMaker/observation/FOUR-13973
observation/FOUR-13973 In processes some columns are not resizing
2 parents c1c10ba + 108b4f2 commit f09f61a

File tree

3 files changed

+88
-34
lines changed

3 files changed

+88
-34
lines changed

resources/js/components/shared/EllipsisMenu.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class="ellipsis-dropdown-main"
1111
@show="onShow"
1212
@hide="onHide"
13-
boundary="viewport"
13+
1414
>
1515
<template v-if="customButton" #button-content>
1616
<i

resources/js/components/shared/FilterTable.vue

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,22 +168,36 @@ export default {
168168
});
169169
},
170170
methods: {
171+
calculateColumnWidth() {
172+
this.headers.forEach((headerColumn, index) => {
173+
if (this.calculateContent(index) !== 0) {
174+
headerColumn.width = this.calculateContent(index) - 32;
175+
}
176+
});
177+
},
171178
startResize(index) {
172179
this.isResizing = true;
180+
this.calculateColumnWidth();
173181
this.resizingColumnIndex = index;
174182
this.startX = event.pageX;
175183
this.startWidth = this.headers[index].width;
176184
177185
document.addEventListener("mousemove", this.doResize);
178186
document.addEventListener("mouseup", this.stopResize);
179187
},
188+
calculateContent(index) {
189+
const miDiv = document.getElementById(`column-${index}`);
190+
return miDiv.scrollWidth;
191+
},
180192
doResize(event) {
181193
if (this.isResizing) {
182194
const diff = event.pageX - this.startX;
183-
this.headers[this.resizingColumnIndex].width = Math.max(
184-
40,
185-
this.startWidth + diff,
186-
);
195+
let min = 40;
196+
const currentWidth = Math.max(min, this.startWidth + diff);
197+
const contentWidth = this.calculateContent(this.resizingColumnIndex);
198+
if ((contentWidth - currentWidth) <= 60) {
199+
this.headers[this.resizingColumnIndex].width = currentWidth;
200+
}
187201
}
188202
},
189203
stopResize() {
@@ -254,13 +268,13 @@ export default {
254268
255269
.pm-table-column-resizer {
256270
position: absolute;
257-
right: -5px;
271+
right: 0px;
258272
top: 50%;
259273
transform: translateY(-50%);
260274
height: 85%;
261275
width: 10px;
262276
cursor: col-resize;
263-
border-left: 1px solid rgba(0, 0, 0, 0.125);
277+
border-right: 1px solid rgba(0, 0, 0, 0.125);
264278
}
265279
.pm-table-filter {
266280
width: 100%;
@@ -379,7 +393,7 @@ export default {
379393
.pm-table-container::-webkit-scrollbar-thumb {
380394
background-color: #6C757D;
381395
border-radius: 20px;
382-
}
396+
}
383397
.ellipsis-dropdown-main ul.dropdown-menu.dropdown-menu-right.show {
384398
max-height: 250px;
385399
overflow-y: auto;

resources/js/processes/components/ArchivedProcessList.vue

Lines changed: 66 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,25 @@
1717
:data="data"
1818
style="height: calc(100vh - 355px);"
1919
>
20+
<!-- Slot Table Header filter Button -->
21+
<template
22+
v-for="(column, index) in fields"
23+
#[`filter-${column.field}`]
24+
>
25+
<div
26+
v-if="column.sortable"
27+
:key="index"
28+
@click="handleEllipsisClick(column)"
29+
>
30+
<i
31+
:class="['fas', {
32+
'fa-sort': column.direction === 'none',
33+
'fa-sort-up': column.direction === 'asc',
34+
'fa-sort-down': column.direction === 'desc',
35+
}]"
36+
/>
37+
</div>
38+
</template>
2039
<!-- Slot Table Body -->
2140
<template
2241
v-for="(row, rowIndex) in data.data"
@@ -33,39 +52,52 @@
3352
v-html="sanitize(row[header.field])"
3453
/>
3554
<template v-else>
36-
<template v-if="isComponent(row[header.field])">
55+
<template
56+
v-if="isComponent(row[header.field])"
57+
:data-cy="`process-table-component-${rowIndex}-${colIndex}`"
58+
>
3759
<component
3860
:is="row[header.field].component"
39-
:data-cy="`process-table-component-${rowIndex}-${colIndex}`"
4061
v-bind="row[header.field].props"
4162
/>
4263
</template>
43-
<template v-else>
44-
<div
45-
v-if="header.field === 'name'"
46-
:data-cy="`process-table-field-${rowIndex}-${colIndex}`"
47-
>
48-
<i
49-
v-b-tooltip
50-
tabindex="0"
51-
:title="row.warningMessages.join(' ')"
52-
class="text-warning fa fa-exclamation-triangle"
53-
:class="{'invisible': row.warningMessages.length == 0}"
54-
/>
55-
<i
56-
v-if="row.status == 'ACTIVE' || row.status == 'INACTIVE'"
57-
v-b-tooltip
58-
tabindex="0"
59-
:title="row.status"
60-
class="mr-2"
61-
:class="{ 'fas fa-check-circle text-success': row.status == 'ACTIVE', 'far fa-circle': row.status == 'INACTIVE' }"
62-
/>
63-
<span
64-
v-uni-id="row.id.toString()"
64+
<template
65+
v-else
66+
:data-cy="`process-table-field-${rowIndex}-${colIndex}`"
67+
>
68+
<template v-if="header.field === 'name'">
69+
<div
70+
:id="`element-archived-${row.id}`"
71+
:class="{ 'pm-table-truncate': header.truncate }"
72+
:style="{ maxWidth: header.width + 'px' }"
73+
>
74+
<i
75+
v-b-tooltip
76+
tabindex="0"
77+
:title="row.warningMessages.join(' ')"
78+
class="text-warning fa fa-exclamation-triangle"
79+
:class="{'invisible': row.warningMessages.length == 0}"
80+
/>
81+
<i
82+
v-if="row.status == 'ACTIVE' || row.status == 'INACTIVE'"
83+
v-b-tooltip
84+
tabindex="0"
85+
:title="row.status"
86+
class="mr-2"
87+
:class="{ 'fas fa-check-circle text-success': row.status == 'ACTIVE', 'far fa-circle': row.status == 'INACTIVE' }"
88+
/>
89+
<span>
90+
{{ row[header.field] }}
91+
</span>
92+
</div>
93+
<b-tooltip
94+
v-if="header.truncate"
95+
:target="`element-archived-${row.id}`"
96+
custom-class="pm-table-tooltip"
6597
>
6698
{{ row[header.field] }}
67-
</span>
68-
</div>
99+
</b-tooltip>
100+
</template>
69101
<ellipsis-menu
70102
v-if="header.field === 'actions'"
71103
class="process-table"
@@ -177,32 +209,40 @@ export default {
177209
field: "name",
178210
width: 200,
179211
sortable: true,
212+
truncate: true,
213+
direction: "none",
180214
},
181215
{
182216
label: this.$t("Category"),
183217
field: "category_list",
184218
width: 160,
185219
sortable: true,
220+
direction: "none",
221+
sortField: "category.name",
186222
},
187223
{
188224
label: this.$t("Owner"),
189225
field: "owner",
190226
width: 160,
191227
sortable: true,
228+
direction: "none",
229+
sortField: "user.username",
192230
},
193231
{
194232
label: this.$t("Modified"),
195233
field: "updated_at",
196234
format: "datetime",
197235
width: 160,
198236
sortable: true,
237+
direction: "none",
199238
},
200239
{
201240
label: this.$t("Created"),
202241
field: "created_at",
203242
format: "datetime",
204243
width: 160,
205244
sortable: true,
245+
direction: "none",
206246
},
207247
{
208248
name: "__slot:actions",

0 commit comments

Comments
 (0)