Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XWIKI-21009: LiveData alternative to drag controls #2809

Merged
merged 4 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export const mousedownmove = {
const removeMousemoveHandler = () => {
window.removeEventListener("mousemove", mousemoveHandler);
window.removeEventListener("mouseup", removeMousemoveHandler);
window.removeEventListener("focusout", removeMousemoveHandler);
};

// If the "immediate" modifiers is set, dispatch the event immediately
Expand All @@ -61,7 +60,6 @@ export const mousedownmove = {
// Bind event listeners
window.addEventListener("mousemove", mousemoveHandler);
window.addEventListener("mouseup", removeMousemoveHandler);
window.addEventListener("focusout", removeMousemoveHandler);
});
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@
<div class="column-name">
<!-- Property Name -->
<button
class="property-name handle"
class="handle"
@click="sort(property)"
@keydown.left="keyboardDragNDrop($event, -1)"
@keydown.right="keyboardDragNDrop($event, 1)"
:title="logic.isPropertySortable(property.id) ?
$t('livedata.action.columnName.sortable.hint') :
$t('livedata.action.columnName.default.hint')"
>
{{ property.name }}
<span class="property-name">{{ property.name }}</span>
<!--
Sort icon
Only show the icon for the first-level sort property
Expand All @@ -79,20 +79,19 @@
:icon-descriptor="{name: isFirstSortLevel(property) && firstSortLevel.descending? 'caret-down': 'caret-up'}"
:class="['sort-icon', isFirstSortLevel(property)? 'sorted': '']"/>
</button>

<!--
</div>
<!--
Specify the handle to resize properties
-->
<button class="resize-handle btn btn-xs btn-default" :title="$t('livedata.action.resizeColumn.hint')"
v-mousedownmove="mouseResizeColumnInit"
@mousedownmove="mouseResizeColumn"
@keydown.left="keyboardResizeColumn($event, -10)"
@keydown.right="keyboardResizeColumn($event, 10)"
@dblclick="resetColumnSize"
@keydown.esc="resetColumnSize"
>
</button>
</div>
<button class="resize-handle btn btn-xs btn-default" :title="$t('livedata.action.resizeColumn.hint')"
v-mousedownmove="mouseResizeColumnInit"
@mousedownmove="mouseResizeColumn"
@keydown.left="keyboardResizeColumn($event, -10)"
@keydown.right="keyboardResizeColumn($event, 10)"
@dblclick="resetColumnSize"
@keydown.esc="resetColumnSize"
>
</button>
</th>

</XWikiDraggable>
Expand Down Expand Up @@ -273,12 +272,18 @@ export default {
}

.layout-table .column-name {
cursor: pointer;
display: flex;
justify-content: space-between;
}

.layout-table .resize-handle {
.layout-table .draggable-item .resize-handle {
position: absolute;
right: 0;
top: 0.5rem;
bottom: 0.5rem;
/* TODO: Discussion about the exact display of resize handles.
See https://jira.xwiki.org/browse/XWIKI-21816 */
opacity: 0;
padding: 0;
cursor: col-resize;
min-width: 0;
Expand All @@ -288,8 +293,9 @@ export default {
margin-left: 2px;
}

.layout-table .column-name:focus-within .resize-handle,
.layout-table .column-name:hover .resize-handle {
.layout-table .draggable-item:focus-within .resize-handle,
.layout-table .draggable-item:hover .resize-handle {
opacity: 1;
border-color: @text-muted;
border-width: 3px;
margin-left: 0;
Expand All @@ -299,32 +305,29 @@ export default {
margin-right: -2px;
}

.layout-table .draggable-item:not(:last-child) .column-name:focus-within .resize-handle,
.layout-table .draggable-item:not(:last-child) .column-name:hover .resize-handle {
.layout-table .draggable-item:not(:last-child):focus-within .resize-handle,
.layout-table .draggable-item:not(:last-child):hover .resize-handle {
margin-right: -3px;
}

.layout-table .property-name {
.layout-table .draggable-item .handle {
opacity: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
background: transparent;
border: 0;
width: 100%;
text-align: left;
}

.draggable-item .property-name.handle {
opacity: 1;
}

.layout-table .sort-icon {
color: currentColor;
opacity: 0;
padding-left: @table-cell-padding;
cursor: pointer;
}

.layout-table .property-name .sort-icon {
.layout-table .property-name + .sort-icon {
vertical-align: baseline;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ define('xwiki-livedata', [
"pagination.last",
"action.refresh",
"action.addEntry",
"action.reorder.hint",
"action.columnName.sortable.hint",
"action.columnName.default.hint",
"action.resizeColumn.hint",
"panel.filter.title",
"panel.filter.noneFilterable",
Expand Down