Skip to content

Commit 46d3611

Browse files
author
Patrik Kullman
committed
Expose "headerFocused" for most column types
Will notify when user is engaging with the header filter component Signed-off-by: Patrik Kullman <patrik.kullman@neovici.se>
1 parent 2112b62 commit 46d3611

9 files changed

+35
-16
lines changed

cosmoz-omnitable-column-amount.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
</template>
2121

2222
<template class="header">
23-
<paper-dropdown-menu label="[[ title ]]" placeholder="[[ _filterText ]]" title="[[ _tooltip ]]" horizontal-align="[[ preferredDropdownHorizontalAlign ]]">
23+
<paper-dropdown-menu label="[[ title ]]" placeholder="[[ _filterText ]]" title="[[ _tooltip ]]"
24+
horizontal-align="[[ preferredDropdownHorizontalAlign ]]" opened="{{ headerFocused }}">
2425
<div class="dropdown-content" slot="dropdown-content" style="padding: 15px; min-width: 150px;">
2526
<h3 style="margin: 0;">[[ title ]]</h3>
2627
<paper-input type="number" label="[[ _('Min amount', t) ]]" title="[[ _('Minimum amount', t) ]]" on-change="_setMinValue"

cosmoz-omnitable-column-autocomplete.html

+10-8
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,20 @@
8383
},
8484

8585
_applyMultiFilter(filter, item) {
86-
var filterArray = filter.map(element => {
87-
var val = element;
88-
if (this.valueProperty) {
89-
val = element[this.valueProperty];
90-
}
91-
return val.toString().toLowerCase();
92-
}),
93-
value = this.get(this.valuePath, item);
86+
const filterArray = filter.map(element => {
87+
let val = element;
88+
if (this.valueProperty) {
89+
val = element[this.valueProperty];
90+
}
91+
return val.toString().toLowerCase();
92+
});
93+
94+
let value = this.get(this.valuePath, item);
9495
if (this.valueProperty) {
9596
value = value[this.valueProperty];
9697
}
9798
value = value.toString().toLowerCase();
99+
98100
return filterArray.indexOf(value) !== -1;
99101
},
100102

cosmoz-omnitable-column-behavior.html

+10
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@
4747
notify: true
4848
},
4949

50+
/**
51+
* Indicates whether the user has engaged with the
52+
* header/filter component of the column
53+
*/
54+
headerFocused: {
55+
type: Boolean,
56+
value: false,
57+
notify: true
58+
},
59+
5060
/**
5161
* Indicate that the column is loading/performing work
5262
*/

cosmoz-omnitable-column-boolean.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
</template>
2222

2323
<template class="header">
24-
<paper-dropdown-menu label="[[ title ]]" horizontal-align="[[ preferredDropdownHorizontalAlign ]]">
24+
<paper-dropdown-menu label="[[ title ]]"
25+
horizontal-align="[[ preferredDropdownHorizontalAlign ]]" opened="{{ headerFocused }}">
2526
<paper-listbox class="dropdown-content" slot="dropdown-content" attr-for-selected="value" selected="{{ _textFilter }}">
2627
<paper-item value=""></paper-item>
2728
<paper-item value="true">[[ trueLabel ]]</paper-item>

cosmoz-omnitable-column-date.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
</template>
2222

2323
<template class="header">
24-
<paper-dropdown-menu label="[[ title ]]" placeholder="[[ _filterText ]]" title="[[ _tooltip ]]" horizontal-align="[[ preferredDropdownHorizontalAlign ]]">
24+
<paper-dropdown-menu label="[[ title ]]" placeholder="[[ _filterText ]]" title="[[ _tooltip ]]"
25+
horizontal-align="[[ preferredDropdownHorizontalAlign ]]" opened="{{ headerFocused }}">
2526
<div class="dropdown-content" slot="dropdown-content" style="padding: 15px; min-width: 100px;">
2627
<h3 style="margin: 0;">[[ title ]]</h3>
2728
<paper-input type="date" min="[[ _formatISODate(_fromMin) ]]" max="[[ _formatISODate(_fromMax) ]]"

cosmoz-omnitable-column-datetime.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
</template>
2424

2525
<template class="header">
26-
<paper-dropdown-menu label="[[ title ]]" placeholder="[[ _filterText ]]" title="[[ _tooltip ]]" horizontal-align="[[ preferredDropdownHorizontalAlign ]]">
26+
<paper-dropdown-menu label="[[ title ]]" placeholder="[[ _filterText ]]" title="[[ _tooltip ]]"
27+
horizontal-align="[[ preferredDropdownHorizontalAlign ]]" opened="{{ headerFocused }}">
2728
<div class="dropdown-content" slot="dropdown-content" style="padding: 15px; min-width: 100px;">
2829
<h3 style="margin: 0;">[[ title ]]</h3>
2930
<datetime-local min="[[ _formatISODate(_fromMin) ]]" max="[[ _formatISODate(_fromMax) ]]"

cosmoz-omnitable-column-number.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
</template>
1717

1818
<template class="header">
19-
<paper-dropdown-menu label="[[ title ]]" placeholder="[[ _filterText ]]" title="[[ _tooltip ]]" horizontal-align="[[ preferredDropdownHorizontalAlign ]]">
19+
<paper-dropdown-menu label="[[ title ]]" placeholder="[[ _filterText ]]" title="[[ _tooltip ]]"
20+
horizontal-align="[[ preferredDropdownHorizontalAlign ]]" opened="{{ headerFocused }}">
2021
<div class="dropdown-content" slot="dropdown-content" style="padding: 15px; min-width: 100px;">
2122
<h3 style="margin: 0;">[[ title ]]</h3>
2223
<paper-input type="number" label="[[ _('From', t) ]]" value="{{ _filterInput.min }}"

cosmoz-omnitable-column-time.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
</template>
2020

2121
<template class="header">
22-
<paper-dropdown-menu label="[[ title ]]" placeholder="[[ _filterText ]]" title="[[ _tooltip ]]" horizontal-align="[[ preferredDropdownHorizontalAlign ]]">
22+
<paper-dropdown-menu label="[[ title ]]" placeholder="[[ _filterText ]]" title="[[ _tooltip ]]"
23+
horizontal-align="[[ preferredDropdownHorizontalAlign ]]" opened="{{ headerFocused }}">
2324
<div class="dropdown-content" slot="dropdown-content" style="padding: 15px; min-width: 100px;">
2425
<h3 style="margin: 0;">[[ title ]]</h3>
2526
<paper-input

cosmoz-omnitable-column.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
</template>
99

1010
<template class="edit-cell">
11-
<paper-input no-label-float type="text" on-change="_valueChanged" value="[[ getString(item, valuePath) ]]"></paper-input>
11+
<paper-input no-label-float type="text" on-change="_valueChanged" value="[[ getString(item, valuePath) ]]">
12+
</paper-input>
1213
</template>
1314

1415
<template class="header">
15-
<paper-input label="[[ title ]]" value="{{ filter }}"></paper-input>
16+
<paper-input label="[[ title ]]" value="{{ filter }}" focused="{{ headerFocused }}"></paper-input>
1617
</template>
1718

1819
</template>

0 commit comments

Comments
 (0)