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

changes #1980

Closed
wants to merge 5 commits into from
Closed

changes #1980

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
100 changes: 71 additions & 29 deletions elements/nuxeo-data-grid/nuxeo-document-grid-thumbnail.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ Polymer({
border: 2px solid transparent;
}

.bubbleBox:hover,
.bubbleBox:focus {
.bubbleBox:hover {
z-index: 500;
border: 2px solid var(--nuxeo-link-hover-color);
box-shadow: 0 3px 5px rgba(0, 0, 0, 0.04);
Expand Down Expand Up @@ -108,7 +107,7 @@ Polymer({
}

.bubbleBox .select {
display: none;
// display: none;
position: absolute;
top: 1rem;
left: 1rem;
Expand Down Expand Up @@ -142,7 +141,7 @@ Polymer({
}

.bubbleBox .actions {
display: none;
// display: none;
background-color: var(--nuxeo-box);
position: absolute;
bottom: 0;
Expand All @@ -159,11 +158,11 @@ Polymer({
@apply --nuxeo-action-hover;
}

.bubbleBox:hover .actions,
/* .bubbleBox:hover .actions,
.bubbleBox:hover .select,
.bubbleBox[selection-mode] .select {
display: block;
}
} */

.bubbleBox:hover .select:hover {
border: 2px solid var(--nuxeo-button-primary);
Expand All @@ -189,35 +188,67 @@ Polymer({
:host(.droptarget-hover) .bubbleBox {
border: 2px dashed var(--nuxeo-grid-selected);
}

:host(:focus) .bubbleBox {
z-index: 500;
border: 2px solid var(--nuxeo-link-hover-color);
box-shadow: 0 3px 5px rgba(0, 0, 0, 0.04);
}

:host(:focus) .bubbleBox .actions,
:host(:focus) .bubbleBox .select,
.bubbleBox:hover .actions,
.bubbleBox:hover .select,
.bubbleBox[selection-mode] .select {
opacity: 1;
height: auto;
overflow: visible;
transition: opacity 0.2s ease, height 0.2s ease;
}

.bubbleBox .actions,
.bubbleBox .select {
opacity: 0;
height: 0;
overflow: hidden;
transition: opacity 0.2s ease, height 0.2s ease;
}

/* div.actions *:focus-visible {
outline: none;
} */

/* :host *:focus-visible {
outline: none;
} */
</style>

<div class="bubbleBox grid-box" selection-mode$="[[selectionMode]]">
<div class="thumbnailContainer" on-tap="handleClick">
<div class="thumbnailContainer" on-tap="handleClick" tabindex="0">
<img src="[[_thumbnail(doc)]]" alt$="[[doc.title]]" />
</div>
<template is="dom-if" if="[[_hasDocument(doc)]]">
<a class="title" href$="[[urlFor(doc)]]" on-tap="handleClick">
<div class="dataContainer">
<div class="title" id="title">[[doc.title]]</div>
<nuxeo-tag>[[formatDocType(doc.type)]]</nuxeo-tag>
<nuxeo-tooltip for="title">[[doc.title]]</nuxeo-tooltip>
</div>
</a>
<div class="actions">
<nuxeo-favorites-toggle-button document="[[doc]]"></nuxeo-favorites-toggle-button>
<nuxeo-download-button document="[[doc]]"></nuxeo-download-button>
</div>
<div class="select">
<paper-icon-button
noink
icon="icons:check"
title="[[_computeTitle(doc)]]"
on-tap="_onCheckBoxTap"
role="checkbox"
aria-checked="[[selected]]"
></paper-icon-button>

<a class="title" href$="[[urlFor(doc)]]" on-tap="handleClick" tabindex="0">
<div class="dataContainer">
<div class="title" id="title">[[doc.title]]</div>
<nuxeo-tag>[[formatDocType(doc.type)]]</nuxeo-tag>
<nuxeo-tooltip for="title">[[doc.title]]</nuxeo-tooltip>
</div>
</template>
</a>
<div class="actions">
<nuxeo-favorites-toggle-button document="[[doc]]" tabindex="0"></nuxeo-favorites-toggle-button>
<nuxeo-download-button document="[[doc]]" tabindex="0"></nuxeo-download-button>
</div>
<div class="select" tabindex="0">
<paper-icon-button
noink
icon="icons:check"
title="[[_computeTitle(doc)]]"
on-tap="_onCheckBoxTap"
role="checkbox"
aria-checked="[[selected]]"
></paper-icon-button>
</div>
</div>
`,

Expand Down Expand Up @@ -249,6 +280,10 @@ Polymer({
index: {
type: Number,
},

tabindex: {
type: String,
},
},

observers: ['_selectedItemsChanged(selectedItems.splices)'],
Expand All @@ -263,6 +298,10 @@ Polymer({
: '';
},

computeTabIndex(index) {
return (Number(this.tabindex) + Number(index)).toString();
},

handleClick(e) {
if (this.selectionMode) {
this._toogleSelect(e);
Expand All @@ -289,6 +328,9 @@ Polymer({
},

_computeTitle(doc) {
// const myComponent = document.querySelector('nuxeo-document-grid-thumbnail');
// const shadowRootMode = myComponent.shadowRoot.constructor.mode;
// console.log(shadowRootMode);
return `${doc && doc.title}${this.i18n && this.i18n('command.select')}`;
},
});
24 changes: 19 additions & 5 deletions elements/search/default/nuxeo-default-search-results.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,24 @@
>
<template>
<nuxeo-document-grid-thumbnail
tabindex$="{{tabIndex}}"
tabindex="0"
selected$="{{selected}}"
doc="[[item]]"
index="[[index]]"
on-navigate="_navigate"
selected-items="[[selectedItems]]"
>
</nuxeo-document-grid-thumbnail>
<!-- <div style="width: 100px; height: 100px; border: 1px solid black" tabindex="0">
<div style="width: 80px; height: 80px; border: 1px solid red; display: flex;" tabindex="0">
<div style="width: 50px; height: 50px; border: 1px solid green;" tabindex="0">
Hi
</div>
<div style="width: 50px; height: 50px; border: 1px solid green;" tabindex="0">
Hello
</div>
</div>
</div> -->
</template>
</nuxeo-data-grid>

Expand Down Expand Up @@ -144,16 +154,16 @@
<nuxeo-data-table-column name="[[i18n('label.dublincore.nature')]]" field="dc:nature" hidden>
<template>
<nuxeo-tag hidden$="[[!item.properties.dc:nature]]"
>[[formatDirectory(item.properties.dc:nature)]]</nuxeo-tag
>
>[[formatDirectory(item.properties.dc:nature)]]
</nuxeo-tag>
</template>
</nuxeo-data-table-column>

<nuxeo-data-table-column name="[[i18n('label.dublincore.coverage')]]" field="dc:coverage" hidden>
<template>
<nuxeo-tag hidden$="[[!item.properties.dc:coverage]]"
>[[formatDirectory(item.properties.dc:coverage)]]</nuxeo-tag
>
>[[formatDirectory(item.properties.dc:coverage)]]
</nuxeo-tag>
</template>
</nuxeo-data-table-column>

Expand Down Expand Up @@ -246,6 +256,10 @@
_contentStoredInColdStorage(doc) {
return this.hasFacet(doc, 'ColdStorage') && doc.properties && doc.properties['coldstorage:coldContent'];
},

computeTabIndex(index) {
return (index + 1).toString();
},
});
</script>
</dom-module>
Loading