Skip to content

Commit

Permalink
WEBUI-1318: nuxeo-data-grid cards navigable when using a keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
rakeshkumar1019 committed Dec 13, 2023
1 parent cdbf5c2 commit 639dd9b
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 10 deletions.
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>

0 comments on commit 639dd9b

Please sign in to comment.