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

WEBUI-1318: nuxeo-data-grid cards navigable when using a keyboard #2039

Closed
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
14 changes: 13 additions & 1 deletion elements/nuxeo-results/nuxeo-default-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@ Polymer({
empty-label="[[emptyLabel]]"
empty-label-when-filtered="[[emptyLabelWhenFiltered]]"
selection-enabled
last-index="[[_lastIndex]]"
>
<template>
<nuxeo-document-grid-thumbnail
class="grid-box"
tabindex$="{{tabIndex}}"
tabindex$="{{_computeTabAndLastIndex(index)}"
selected$="{{selected}}"
selected-items="[[selectedItems]]"
index="[[index]]"
Expand Down Expand Up @@ -263,6 +264,11 @@ Polymer({
notify: true,
},

_lastIndex: {
type: Number,
value: 0,
},

emptyLabel: String,
emptyLabelWhenFiltered: String,
},
Expand Down Expand Up @@ -291,4 +297,10 @@ Polymer({
_contentStoredInColdStorage(doc) {
return this.hasFacet(doc, 'ColdStorage') && doc.properties && doc.properties['coldstorage:coldContent'];
},

_computeTabAndLastIndex(index) {
const tabindex = index + 1;
this._lastIndex = this.nxProvider.resultsCount;
return tabindex.toString();
},
});
13 changes: 12 additions & 1 deletion elements/nuxeo-results/nuxeo-document-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,12 @@ Polymer({
selection-enabled
draggable$="[[_hasWritePermission(document)]]"
drop-target-filter="[[_dropTargetFilter]]"
last-index="[[_lastIndex]]"
>
<template>
<nuxeo-document-grid-thumbnail
class="grid-box"
tabindex$="{{tabIndex}}"
tabindex$="{{_computeTabAndLastIndex(index)}}"
selected$="{{selected}}"
index="[[index]]"
doc="[[item]]"
Expand Down Expand Up @@ -363,9 +364,19 @@ Polymer({
* The label to be dislayed when there are no results with filtering applied.
*/
emptyLabelWhenFiltered: String,
_lastIndex: {
type: Number,
value: 0,
},
},

_contentStoredInColdStorage(doc) {
return this.hasFacet(doc, 'ColdStorage') && doc.properties && doc.properties['coldstorage:coldContent'];
},

_computeTabAndLastIndex(index) {
const tabindex = index + 1;
this._lastIndex = this.nxProvider.resultsCount;
return tabindex.toString();
},
});
13 changes: 12 additions & 1 deletion elements/nuxeo-results/nuxeo-document-trash-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,12 @@ Polymer({
empty-label="[[emptyLabel]]"
empty-label-when-filtered="[[emptyLabelWhenFiltered]]"
selection-enabled
last-index="[[_lastIndex]]"
>
<template>
<nuxeo-document-grid-thumbnail
class="grid-box"
tabindex$="{{tabIndex}}"
tabindex$="{{_computeTabAndLastIndex(index)}}"
selected$="{{selected}}"
index="[[index]]"
doc="[[item]]"
Expand Down Expand Up @@ -339,6 +340,10 @@ Polymer({
* The label to be dislayed when there are no results with filtering applied.
*/
emptyLabelWhenFiltered: String,
_lastIndex: {
type: Number,
value: 0,
},
},

_emptyTrash() {
Expand Down Expand Up @@ -368,4 +373,10 @@ Polymer({
{ field: 'dc:lastContributor', label: this.i18n('searchResults.sort.field.lastContributor'), order: 'asc' },
];
},

_computeTabAndLastIndex(index) {
const tabindex = index + 1;
this._lastIndex = this.nxProvider.resultsCount;
return tabindex.toString();
},
});
14 changes: 11 additions & 3 deletions elements/search/default/nuxeo-default-search-results.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@
icon="nuxeo:view-thumbnails"
empty-label="[[i18n('searchResults.noResults')]]"
selection-enabled
last-index="[[_lastIndex]]"
>
<template>
<nuxeo-document-grid-thumbnail
tabindex$="{{_computeTabIndex(index)}}"
tabindex$="{{_computeTabAndLastIndex(index)}}"
selected$="{{selected}}"
doc="[[item]]"
index="[[index]]"
Expand Down Expand Up @@ -225,6 +226,11 @@
type: Array,
value: [],
},

_lastIndex: {
type: Number,
value: 0,
},
},

attached() {
Expand All @@ -247,8 +253,10 @@
return this.hasFacet(doc, 'ColdStorage') && doc.properties && doc.properties['coldstorage:coldContent'];
},

_computeTabIndex(index) {
return (index + 1).toString();
_computeTabAndLastIndex(index) {
const tabindex = index + 1;
this._lastIndex = this.nxProvider.resultsCount;
return tabindex.toString();
},
});
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
class="results"
empty-label="[[i18n('searchResults.noResults')]]"
selection-enabled
last-index="[[_lastIndex]]"
>
<template>
<nuxeo-document-grid-thumbnail
tabindex$="{{tabIndex}}"
tabindex$="{{_computeTabAndLastIndex(index)}}"
selected$="{{selected}}"
doc="[[item]]"
index="[[index]]"
Expand All @@ -41,6 +42,16 @@
behaviors: [Nuxeo.LayoutBehavior],
properties: {
nxProvider: Object,
_lastIndex: {
type: Number,
value: 0,
},
},

_computeTabAndLastIndex(index) {
const tabindex = index + 1;
this._lastIndex = this.nxProvider.resultsCount;
return tabindex.toString();
},
});
</script>
Expand Down
13 changes: 12 additions & 1 deletion elements/search/expired/nuxeo-expired-search-results.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@
class="results"
empty-label="[[i18n('searchResults.noResults')]]"
selection-enabled
last-index="[[_lastIndex]]"
>
<template>
<nuxeo-document-grid-thumbnail
tabindex$="{{tabIndex}}"
tabindex$="{{_computeTabAndLastIndex(index)}}"
selected$="{{selected}}"
doc="[[item]]"
index="[[index]]"
Expand Down Expand Up @@ -202,6 +203,10 @@
type: Array,
value: [],
},
_lastIndex: {
type: Number,
value: 0,
},
},

attached() {
Expand All @@ -224,6 +229,12 @@
_contentStoredInColdStorage(doc) {
return this.hasFacet(doc, 'ColdStorage') && doc.properties && doc.properties['coldstorage:coldContent'];
},

_computeTabAndLastIndex(index) {
const tabindex = index + 1;
this._lastIndex = this.nxProvider.resultsCount;
return tabindex.toString();
},
});
</script>
</dom-module>
14 changes: 13 additions & 1 deletion elements/search/nxql/nuxeo-nxql-search-results.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@
icon="nuxeo:view-thumbnails"
empty-label="[[i18n('searchResults.noResults')]]"
selection-enabled
last-index="[[_lastIndex]]"
>
<template>
<nuxeo-document-grid-thumbnail
tabindex$="{{tabIndex}}"
tabindex$="{{_computeTabAndLastIndex(index)}}"
selected$="{{selected}}"
doc="[[item]]"
index="[[index]]"
Expand Down Expand Up @@ -195,11 +196,22 @@
behaviors: [Nuxeo.LayoutBehavior],
properties: {
nxProvider: Object,

_lastIndex: {
type: Number,
value: 0,
},
},

_navigate(e) {
this.fire('navigate', { doc: (e.model || e.detail).item, index: (e.detail || e.model).index });
},

_computeTabAndLastIndex(index) {
const tabindex = index + 1;
this._lastIndex = this.nxProvider.resultsCount;
return tabindex.toString();
},
});
</script>
</dom-module>
14 changes: 13 additions & 1 deletion elements/search/trash/nuxeo-trash-search-results.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@
icon="nuxeo:view-thumbnails"
empty-label="[[i18n('searchResults.noResults')]]"
selection-enabled
last-index="[[_lastIndex]]"
>
<template>
<nuxeo-document-grid-thumbnail
tabindex$="{{tabIndex}}"
tabindex$="{{_computeTabAndLastIndex(index)}}"
selected$="{{selected}}"
doc="[[item]]"
index="[[index]]"
Expand Down Expand Up @@ -233,6 +234,11 @@
type: Array,
value: [],
},

_lastIndex: {
type: Number,
value: 0,
},
},

attached() {
Expand All @@ -254,6 +260,12 @@
_contentStoredInColdStorage(doc) {
return this.hasFacet(doc, 'ColdStorage') && doc.properties && doc.properties['coldstorage:coldContent'];
},

_computeTabAndLastIndex(index) {
const tabindex = index + 1;
this._lastIndex = this.nxProvider.resultsCount;
return tabindex.toString();
},
});
</script>
</dom-module>
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
sort-label="[[i18n('searchResults.sort.label')]]"
sort-options="[[sortOptions]]"
display-navigation
last-index="[[_lastIndex]]"
>
<template>
<nuxeo-document-grid-thumbnail
tabindex$="{{tabIndex}}"
tabindex$="{{_computeTabAndLastIndex(index)}}"
selected$="{{selected}}"
doc="[[item]]"
index="[[index]]"
Expand Down Expand Up @@ -125,11 +126,22 @@
type: Array,
value: [],
},

_lastIndex: {
type: Number,
value: 0,
},
},

_navigate(e) {
this.fire('navigate', { doc: (e.model || e.detail).item, index: (e.model || e.detail).index });
},

_computeTabAndLastIndex(index) {
const tabindex = index + 1;
this._lastIndex = this.nxProvider.resultsCount;
return tabindex.toString();
},
});
</script>
</dom-module>
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@
sort-label="[[i18n('searchResults.sort.label')]]"
selection-enabled
display-quick-filters
last-index="[[_lastIndex]]"
>
<template>
<nuxeo-document-grid-thumbnail
tabindex$="{{tabIndex}}"
tabindex$="{{_computeTabAndLastIndex(index)}}"
selected$="{{selected}}"
doc="[[item]]"
index="[[index]]"
Expand Down Expand Up @@ -108,11 +109,21 @@
behaviors: [Nuxeo.LayoutBehavior],
properties: {
nxProvider: Object,
_lastIndex: {
type: Number,
value: 0,
},
},

_navigate(e) {
this.fire('navigate', { doc: (e.model || e.detail).item });
},

_computeTabAndLastIndex(index) {
const tabindex = index + 1;
this._lastIndex = this.nxProvider.resultsCount;
return tabindex.toString();
},
});
</script>
</dom-module>
Loading