Continues implementation of new numeric filter with comparator select and updates on icon font.

This commit is contained in:
Mateus Machado Luna 2019-05-22 15:07:42 -03:00
parent b79503d31d
commit 7bc560594f
13 changed files with 243 additions and 31 deletions

View File

@ -18,6 +18,7 @@ import FormTaxonomy from '../../classes/metadata-types/taxonomy/FormTaxonomy.vue
import FormSelectbox from '../../classes/metadata-types/selectbox/FormSelectbox.vue';
import FilterCustomInterval from '../../classes/filter-types/custom-interval/CustomInterval.vue';
import FilterNumeric from '../../classes/filter-types/numeric/Numeric.vue';
import FilterSelectbox from '../../classes/filter-types/selectbox/Selectbox.vue';
import FilterAutocomplete from '../../classes/filter-types/autocomplete/Autocomplete.vue';
import FilterCheckbox from '../../classes/filter-types/checkbox/Checkbox.vue';
@ -70,6 +71,7 @@ Vue.component('tainacan-filter-item', TaincanFiltersList);
/* Filters */
Vue.component('tainacan-filter-custom-interval', FilterCustomInterval);
Vue.component('tainacan-filter-numeric', FilterNumeric);
Vue.component('tainacan-filter-selectbox', FilterSelectbox);
Vue.component('tainacan-filter-autocomplete', FilterAutocomplete);
Vue.component('tainacan-filter-checkbox', FilterCheckbox);

View File

@ -50,6 +50,14 @@
.button.is-outlined {
color: $blue5 !important;
}
.b-numberinput {
button.is-primary,
button.is-primary:hover,
button.is-primary:focus,
button.is-primary:active {
color: $blue5 !important;
}
}
.tabs {
li.is-active a {
border-bottom-color: $blue5;

View File

@ -49,7 +49,50 @@
background-color: $red1;
}
}
.control{
.b-numberinput {
.control {
margin-right: 0 !important;
}
div.control {
flex-shrink: 1;
order: -1;
}
button,
input {
height: 28px !important;
}
button.is-primary,
button.is-primary:hover,
button.is-primary:focus,
button.is-primary:active {
border: 1px solid $gray2;
background-color: $gray1 !important;
color: $secondary !important;
padding: 0.75rem !important;
border-radius: 0 !important;
.mdi::before {
display: inline-block;
font: normal normal normal 20px/1 "TainacanIcons";
font-size: inherit;
text-rendering: auto;
vertical-align: middle;
line-height: inherit;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
transform: none !important;
font-size: 20px;
margin-top: -2px;
}
.mdi-plus::before {
content: "plus" !important;
}
.mdi-minus::before {
content: "minus" !important;
}
}
}
.control {
&.has-icons-right {
.icon {
height: 2.0em;

View File

@ -45,6 +45,7 @@ export default {
@import "../../node_modules/buefy/src/scss/components/_dropdown.scss";
@import "../../node_modules/buefy/src/scss/components/_modal.scss";
@import "../../node_modules/buefy/src/scss/components/_notices.scss";
@import "../../node_modules/buefy/src/scss/components/_numberinput.scss";
// Tainacan imports
@import "../admin/scss/_tables.scss";

View File

@ -2,7 +2,7 @@
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
<metadata>
Created by FontForge 20170910 at Thu Apr 11 17:41:05 2019
Created by FontForge 20170910 at Wed May 22 19:09:21 2019
By Jimmy Wärting
</metadata>
<defs>
@ -15,7 +15,7 @@ Created by FontForge 20170910 at Thu Apr 11 17:41:05 2019
panose-1="0 0 0 0 0 0 0 0 0 0"
ascent="750"
descent="-250"
bbox="42 -208 958 708"
bbox="42 -209 958 708"
underline-thickness="50"
underline-position="-125"
unicode-range="U+000D-2421"
@ -51,10 +51,10 @@ t-39.5 27t-48.5 10t-48.5 -10t-39.5 -27t-27 -39.5t-10 -48.5t10 -48.5t27 -39.5t39.
<glyph glyph-name="uni21B8" unicode="home"
d="M208 -125v333h-125l417 375l417 -375h-125v-333h-209v250h-166v-250h-209z" />
<glyph glyph-name="tour" unicode="tour"
d="M792 668q35 0 59 -24.5t24 -59.5v-583q0 -35 -24 -59.5t-59 -24.5h-167l-125 -125l-125 125h-167q-35 0 -59 24.5t-24 59.5v583q0 35 24 59.5t59 24.5h584zM542 84h-84v-83h84v83zM628 324q18 18 28.5 42t10.5 52q0 35 -13 65t-36 52.5t-53 35.5t-65 13q-34 0 -64.5 -13
t-53.5 -35.5t-36 -52.5t-13 -65h84q0 34 24 58.5t59 24.5t59 -24.5t24 -58.5q0 -35 -24 -59l-52 -53q-23 -23 -36 -53t-13 -65v-20h84q0 23 3.5 40t9.5 30.5t15 24.5t20 22z" />
d="M125 583q0 35 24 59.5t59 24.5h584q35 0 59 -24.5t24 -59.5v-583q0 -35 -24 -59t-59 -24h-167l-125 -125l-125 125h-167q-35 0 -59 24t-24 59v583zM410 0l90 -90l90 90h202v583h-584v-583h202zM333 375q0 35 13 65t36 53t53.5 36t64.5 13q35 0 65 -13t53 -36t36 -53
t13 -65q0 -39 -19.5 -63.5t-43 -45t-43 -42.5t-19.5 -57h-84q0 34 9.5 56.5t23 39t30 28t30 23.5t23 26t9.5 35q0 35 -24 59t-59 24t-59 -24t-24 -59h-84zM458 125h84v-83h-84v83z" />
<glyph glyph-name="processes" unicode="processes"
d="M542 458h-126v-291h-83v291h-125l167 167zM792 42l-167 -167l-167 167h126v291h83v-291h125z" />
d="M458 42h126v291h83v-291h125l-167 -167zM375 625l167 -167h-126v-291h-83v291h-125z" />
<glyph glyph-name="help" unicode="help"
d="M458 83h84v-83h-84v83zM500 666q86 0 162 -32.5t132.5 -89t89.5 -132.5t33 -162t-33 -162t-89.5 -132.5t-132.5 -89.5t-162 -33t-162 33t-132.5 89.5t-89.5 132.5t-33 162t33 162t89.5 132.5t132.5 89t162 32.5zM500 -84q69 0 129.5 26.5t106 71.5t71.5 106t26 130
t-26 129.5t-71.5 105.5t-106 71.5t-129.5 26.5t-129.5 -26.5t-106 -71.5t-71.5 -105.5t-26 -129.5t26 -130t71.5 -106t106 -71.5t129.5 -26.5zM500 500q35 0 65 -13t53 -36t36 -53t13 -65q0 -39 -19.5 -63.5t-43 -45t-43 -42.5t-19.5 -57h-84q0 34 9.5 56.5t23 39t30 28
@ -95,9 +95,9 @@ t24 -59.5t59 -24.5zM625 500q0 27 -9.5 49.5t-26.5 39.5t-39.5 26.5t-49.5 9.5t-49.5
d="M709 417h-417v-84h417v84zM709 250h-417v-83h417v83zM583 83h-291v-83h291v83zM500 584q-17 0 -29.5 -12.5t-12.5 -29.5t12.5 -29.5t29.5 -12.5t29.5 12.5t12.5 29.5t-12.5 29.5t-29.5 12.5zM792 584q35 0 59 -24.5t24 -59.5v-584q0 -35 -24 -59t-59 -24h-584
q-35 0 -59 24t-24 59v584q0 35 24 59.5t59 24.5h174q14 36 45.5 59.5t72.5 23.5t72.5 -23.5t45.5 -59.5h174z" />
<glyph glyph-name="download" unicode="download"
d="M208 1h584v-84h-584v84zM500 84l-292 292h167v250h250v-250h167z" />
d="M375 376v250h250v-250h167l-292 -292l-292 292h167zM208 1h584v-84h-584v84z" />
<glyph glyph-name="upload" unicode="upload"
d="M792 500h-584v84h584v-84zM500 417l292 -292h-167v-250h-250v250h-167z" />
d="M208 125l292 292l292 -292h-167v-250h-250v250h-167zM792 584v-84h-584v84h584z" />
<glyph glyph-name="playfill" unicode="playfill"
d="M500 667q86 0 162 -33t132.5 -89.5t89.5 -132.5t33 -162t-33 -162t-89.5 -132.5t-132.5 -89.5t-162 -33t-162 33t-132.5 89.5t-89.5 132.5t-33 162t33 162t89.5 132.5t132.5 89.5t162 33zM667 250l-250 188v-376z" />
<glyph glyph-name="play" unicode="play"
@ -130,7 +130,7 @@ d="M542 0h-84v84h84v-84zM542 500v-334h-84v334h84z" />
d="M500 667q87 0 163 -32.5t132.5 -89t89 -132.5t32.5 -163t-32.5 -163t-89 -132.5t-132.5 -89t-163 -32.5t-163 32.5t-132.5 89t-89 132.5t-32.5 163t32.5 163t89 132.5t132.5 89t163 32.5zM559 250l150 150l-59 59l-150 -150l-150 150l-59 -59l150 -150l-150 -150l59 -59
l150 150l150 -150l59 59z" />
<glyph glyph-name="repproved" unicode="repproved"
d="M559 251l233 -233l-59 -59l-233 233l-233 -233l-59 59l233 233l-233 233l59 59l233 -233l233 233l59 -59z" />
d="M208 484l59 59l233 -233l233 233l59 -59l-233 -233l233 -233l-59 -59l-233 233l-233 -233l-59 59l233 233z" />
<glyph glyph-name="arrowleft" unicode="arrowleft"
d="M584 42l-209 209l209 209v-418z" />
<glyph glyph-name="arrowright" unicode="arrowright"
@ -168,7 +168,7 @@ t20 29.5t7.5 36v0q0 19 -7.5 36t-20 29.5t-29.5 20t-36 7.5v0z" />
<glyph glyph-name="notifications" unicode="notifications"
d="M500 -167q-35 0 -59 24.5t-24 58.5h166q0 -34 -24 -58.5t-59 -24.5zM833 0v-42h-666v42l83 83v208q0 48 12.5 91t36.5 78t59 59.5t80 34.5v28q0 26 18 44.5t44 18.5t44 -18.5t18 -44.5v-28q45 -10 80 -34.5t59 -59.5t36.5 -78t12.5 -91v-208zM667 291q0 39 -11.5 73
t-33 59.5t-52.5 40t-70 14.5t-70 -14.5t-52 -40t-32.5 -59.5t-11.5 -73v-250h333v250z" />
<glyph glyph-name="more" unicode="more"
<glyph glyph-name="plus" unicode="plus"
d="M792 209h-250v-250h-84v250h-250v84h250v250h84v-250h250v-84z" />
<glyph glyph-name="menu" unicode="menu"
d="M125 83h750v-83h-750v83zM125 292h750v-84h-750v84zM875 500v-83h-750v83h750z" />
@ -188,13 +188,13 @@ d="M459 666h-375v-499h375v499zM917 -167h-375v500h375v-500zM459 -167h-375v250h375
<glyph glyph-name="viewgallery" unicode="viewgallery"
d="M917 418h-167v-334h167v334zM250 84h-167v334h167v-334zM667 -41h-334v584h334v-584z" />
<glyph glyph-name="sortasc" unicode="sortasc"
d="M667 417h-166v83h166v-83zM792 167h-291v83h291v-83zM917 -83h-416v84h416v-84zM251 625l-166 -167h125v-541h83v541h125z" />
d="M85 457l166 167l167 -167h-125v-541h-83v541h-125zM917 416h-416v83h416v-83zM792 166h-291v83h291v-83zM501 -84v84h166v-84h-166z" />
<glyph glyph-name="sortdesc" unicode="sortdesc"
d="M667 416h-167v84h167v-84zM792 166h-292v84h292v-84zM917 -84h-417v83h417v-83zM292 -1v542h-84v-542h-125l167 -166l167 166h-125z" />
d="M208 0v542h84v-542h125l-167 -166l-167 166h125zM500 417v84h417v-84h-417zM792 251v-84h-292v84h292zM500 -83v83h167v-83h-167z" />
<glyph glyph-name="viewrecords" unicode="viewrecords"
d="M333 543h-208v-584h208v584zM625 -41h-208v584h208v-584zM917 -41h-208v584h208v-584z" />
<glyph glyph-name="close" unicode="close"
d="M559 251l233 -233l-59 -59l-233 233l-233 -233l-59 59l233 233l-233 233l59 59l233 -233l233 233l59 -59z" />
d="M208 484l59 59l233 -233l233 233l59 -59l-233 -233l233 -233l-59 -59l-233 233l-233 -233l-59 59l233 233z" />
<glyph glyph-name="heartoutline" unicode="heartoutline"
d="M504 -23q75 68 135.5 124.5t103.5 107t66.5 96.5t23.5 91q0 31 -11 58t-30.5 46.5t-46 30.5t-57.5 11q-24 0 -47.5 -7.5t-43 -20.5t-35 -31.5t-23.5 -39.5h-78q-8 21 -23.5 39.5t-35 31.5t-42.5 20.5t-47 7.5q-31 0 -58 -11t-46.5 -30.5t-30.5 -46.5t-11 -58
q0 -45 23.5 -91t66.5 -96.5t103.5 -107t134.5 -124.5l5 -4zM688 625q48 0 90 -17.5t72.5 -48.5t48.5 -73t18 -90q0 -59 -25.5 -114t-72.5 -112t-112.5 -119.5t-146.5 -135.5l-60 -55l-60 55q-81 73 -146.5 135.5t-112.5 119.5t-72.5 112t-25.5 114q0 48 18 90t49 73t73 48.5
@ -238,6 +238,38 @@ d="M936 500q-37 -56 -89 -93v-23q0 -89 -33.5 -179.5t-98 -164t-159.5 -119.5t-218 -
q18 -9 38.5 -14.5t42.5 -5.5q-36 23 -57.5 62t-21.5 86q0 24 6.5 46.5t17.5 42.5q66 -81 161 -131t207 -55q-4 17 -4 41q0 37 14 69.5t38 56.5t56.5 38t69.5 14q80 0 131 -56q31 6 59.5 17t54.5 26q-22 -65 -79 -99q27 4 53 11t50 18z" />
<glyph glyph-name="facebook" unicode="facebook"
d="M707 668v-167h-83q-22 0 -32 -20.5t-10 -41.5v-105h125v-166h-125v-334h-166v334h-125v166h125v167q0 35 13 65t35.5 53t53 36t64.5 13h125z" />
<glyph glyph-name="item" unicode="item"
d="M542 625l250 -250v-417q0 -35 -24.5 -59t-59.5 -24h-417q-35 0 -59 24t-24 59l1 584q0 34 24 58.5t59 24.5h250zM500 333h229l-229 229v-229z" />
<glyph glyph-name="dincol" unicode="dincol"
d="M457 85q1 -6 1 -11.5v-11.5q0 -16 -1.5 -31t-6.5 -30h301v84h-294zM167 502v-219q-47 -12 -84 -43v262h84zM834 542q34 0 58.5 -24.5t24.5 -59.5v-249q0 -35 -24.5 -59.5t-58.5 -24.5h-385q-9 34 -28 63t-45 50.5t-58 35.5t-68 17l1 251q0 35 24 59t59 24h208l83 -83h209
zM351 -18q5 8 10 19q14 28 14 61q0 6 -0.5 11.5t-1.5 11.5q-2 11 -5 21t-8 19q-18 39 -53.5 61t-77.5 22q-31 0 -62 -13q-34 -17 -56.5 -48t-26.5 -70q-1 -1 0 -2q-1 -5 -1 -13q0 -30 11.5 -56.5t31.5 -46.5t46.5 -31.5t56.5 -11.5q23 0 43 6.5t37 17.5l24 -23v-1l84 -83
l41 42zM229 0q-26 0 -44.5 18t-18.5 44t18.5 44.5t44.5 18.5t44.5 -18.5t18.5 -44.5t-18.5 -44t-44.5 -18z" />
<glyph glyph-name="dinitems" unicode="dinitems"
d="M610 669v-87h-307v-318q-31 9 -66 9h-11t-11 -1v310q0 36 26 61.5t62 25.5h307zM917 231v-351q0 -36 -25.5 -62t-62.5 -26h-306l43 43l-106 105q18 42 18 92q0 57 -23.5 105t-63.5 81v188q0 36 25.5 62t61.5 26h176zM806 231l-196 197v-197h196zM478 -165l-44 -44
l-113 113q-18 -12 -39.5 -19t-44.5 -7q-32 0 -60 12t-49 33t-33 49t-12 60t12.5 60t33.5 49t49 33t59 12q32 0 60 -12t49 -33t33 -49t12 -60q0 -23 -7 -44.5t-19 -39.5zM303 32q0 27 -19.5 46.5t-46.5 19.5q-6 0 -11.5 -1t-10.5 -3q-19 -7 -31.5 -23.5t-12.5 -38.5
q0 -27 19.5 -46.5t46.5 -19.5t46.5 19.5t19.5 46.5z" />
<glyph glyph-name="dinterms" unicode="dinterms"
d="M893 183l-88 -100q-15 -20 -37 -30.5t-47 -10.5h-264q1 5 1 10v10q0 45 -16 85t-44 70.5t-66 49.5t-82 23v59q0 23 8.5 43t23 34.5t34.5 23t42 8.5h363q25 0 47 -10.5t37 -30.5l88 -99q24 -30 24 -68t-24 -67zM166 627q-34 0 -58.5 -24t-24.5 -59v-305q36 30 83 44v261
h501v83h-501zM458 -125l-41 -42l-84 83v1l-24 23q-17 -11 -37 -17.5t-43 -6.5q-30 0 -57 11.5t-46.5 31.5t-31 46.5t-11.5 56.5t11.5 57t31 46.5t46.5 31t57 11.5h10.5t10.5 -2q27 -4 49.5 -16.5t39.5 -32t26.5 -44t9.5 -51.5q0 -22 -6.5 -42.5t-17.5 -37.5l23 -24h1z
M292 62q0 26 -18.5 44.5t-44.5 18.5t-44.5 -18.5t-18.5 -44.5t18.5 -44t44.5 -18t44.5 18t18.5 44z" />
<glyph glyph-name="slideritems" unicode="slideritems"
d="M769 250l-186 188v-188h186zM875 250v-333q0 -35 -24.5 -59.5t-59.5 -24.5h-334q-16 0 -30 6q14 26 22.5 56.5t8.5 63.5q0 56 -23 104t-61 82l1 272q0 35 24 59t59 24h166zM291 667h292v-83h-292v-389q-40 14 -84 14v375q0 34 24.5 58.5t59.5 24.5zM42 -41l125 124v-250z
M375 -42l-125 -124v249z" />
<glyph glyph-name="sliderterms" unicode="sliderterms"
d="M893 97l-88 -100q-15 -20 -37 -30.5t-47 -10.5h-219q0 51 -20 96.5t-54 79.5t-79.5 53.5t-96.5 19.5h-2v58q0 23 8.5 42.5t23.5 34.5t34.5 23.5t41.5 8.5h363q25 0 47 -10.5t37 -30.5l88 -99q24 -30 24 -68t-24 -67zM167 541q-35 0 -59 -24.5t-24 -58.5v-318q37 34 83 50
v268h500v83h-500zM292 83v-250l125 125zM209 -167l-1 250l-125 -125z" />
<glyph glyph-name="slidercol" unicode="slidercol"
d="M485 45q15 -39 15 -84h250v84h-265zM167 463v-266q-47 -16 -84 -50v316h84zM834 502q34 0 58.5 -24t24.5 -59v-250q0 -35 -24.5 -59.5t-58.5 -24.5h-367q-32 57 -89.5 91.5t-127.5 34.5v291q0 35 24.5 59.5t58.5 24.5h209l83 -84h209zM417 -39l-125 -125v250zM83 -39
l125 125l1 -253z" />
<glyph glyph-name="instagram" unicode="instagram"
d="M325 667h350q50 0 94 -19t77 -52t52 -77t19 -94v-350q0 -50 -19 -94t-52 -77t-77 -52t-94 -19h-350q-50 0 -94 19t-77 52t-52 77t-19 94v350q0 50 19 94t52 77t77 52t94 19zM317 584q-31 0 -58.5 -12t-48 -32.5t-32.5 -48t-12 -58.5v-366q0 -31 12 -58.5t32.5 -48
t48 -32.5t58.5 -12h366q31 0 58.5 12t48 32.5t32.5 48t12 58.5v366q0 31 -12 58.5t-32.5 48t-48 32.5t-58.5 12h-366zM719 521q22 0 37 -15t15 -37t-15 -37t-37 -15t-37 15t-15 37t15 37t37 15zM500 458q43 0 81 -16.5t66.5 -44.5t45 -66t16.5 -81t-16.5 -81t-45 -66.5
t-66.5 -45t-81 -16.5t-81 16.5t-66 45t-44.5 66.5t-16.5 81t16.5 81t44.5 66t66 44.5t81 16.5zM500 375q-26 0 -48.5 -10t-39.5 -27t-27 -39.5t-10 -48.5t10 -48.5t27 -39.5t39.5 -27t48.5 -10t48.5 10t39.5 27t27 39.5t10 48.5t-10 48.5t-27 39.5t-39.5 27t-48.5 10z" />
<glyph glyph-name="youtube" unicode="youtube"
d="M417 125l216 125l-216 125v-250zM910 372q2 -25 3 -46.5t1 -40.5l3 -35q0 -69 -5 -119t-14 -82q-15 -57 -72 -72q-18 -6 -53 -9t-74 -4.5t-75.5 -2t-57.5 -0.5l-66 -3q-132 0 -213 5t-113 14q-57 15 -72 72q-5 15 -8 37t-5 45t-2.5 45.5t-0.5 38.5l-3 35q0 69 5 119
t14 82q15 57 72 72q18 6 53 9t74 4.5t75.5 2t57.5 0.5l66 3q132 0 213 -5t113 -14q27 -7 43 -22.5t24.5 -36.5t12 -44.5t4.5 -47.5z" />
<glyph glyph-name="minus" unicode="minus"
d="M789 208h-584v84h584v-84z" />
<glyph glyph-name=".notdef" horiz-adv-x="500"
/>
<glyph glyph-name="uni0000" horiz-adv-x="0"

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -147,8 +147,11 @@
.tainacan-icon-metadata:before {
content: "metadata";
}
.tainacan-icon-more:before {
content: "more";
.tainacan-icon-plus:before {
content: "plus";
}
.tainacan-icon-minus:before {
content: "minus";
}
.tainacan-icon-showmore:before {
content: "showmore";
@ -279,6 +282,27 @@
.tainacan-icon-twitter:before {
content: "twitter";
}
.tainacan-icon-youtube:before {
content: "facebook";
}
.tainacan-icon-slidercol:before {
content: "slidercol";
}
.tainacan-icon-slideritems:before {
content: "slideritems";
}
.tainacan-icon-sliderterms:before {
content: "sliderterms";
}
.tainacan-icon-dincol:before {
content: "dincol";
}
.tainacan-icon-dinitems:before {
content: "dinitems";
}
.tainacan-icon-dinterms:before {
content: "dinterms";
}
.tainacan-icon-18px.tainacan-icon-set,
.tainacan-icon-18px.tainacan-icon:before {

View File

@ -1,7 +1,6 @@
import qs from 'qs';
import axios from '../../js/axios/axios';
import { mapGetters } from 'vuex';
import { resolve } from 'bluebird';
export const filter_type_mixin = {
data () {

View File

@ -1,11 +1,68 @@
<template>
<div>
<b-input
<div class="numeric-filter-container">
<b-dropdown
:mobile-modal="true"
@input="onChangeComparator($event)"
aria-role="list">
<button
:aria-label="$i18n.get('label_comparator')"
class="button is-white"
slot="trigger">
<span class="icon is-small">
<i v-html="comparatorSymbol" />
</span>
<span class="icon">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown" />
</span>
</button>
<b-dropdown-item
role="button"
:class="{ 'is-active': comparator == '=' }"
:value="'='"
aria-role="listitem">
&#61;&nbsp; {{ $i18n.get('is_equal_to') }}
</b-dropdown-item>
<b-dropdown-item
role="button"
:class="{ 'is-active': comparator == '!=' }"
:value="'!='"
aria-role="listitem">
&#8800;&nbsp; {{ $i18n.get('is_not_equal_to') }}
</b-dropdown-item>
<b-dropdown-item
role="button"
:class="{ 'is-active': comparator == '>' }"
:value="'>'"
aria-role="listitem">
&#62;&nbsp; {{ $i18n.get('greater_than') }}
</b-dropdown-item>
<b-dropdown-item
role="button"
:class="{ 'is-active': comparator == '>=' }"
:value="'>='"
aria-role="listitem">
&#8805;&nbsp; {{ $i18n.get('greater_than_or_equal_to') }}
</b-dropdown-item>
<b-dropdown-item
role="button"
:class="{ 'is-active': comparator == '<' }"
:value="'<'"
aria-role="listitem">
&#60;&nbsp; {{ $i18n.get('less_than') }}
</b-dropdown-item>
<b-dropdown-item
role="button"
:class="{ 'is-active': comparator == '<=' }"
:value="'<='"
aria-role="listitem">
&#8804;&nbsp; {{ $i18n.get('less_than_or_equal_to') }}
</b-dropdown-item>
</b-dropdown>
<b-numberinput
:aria-labelledby="labelId"
size="is-small"
type="number"
step="any"
autocomplete="off"
step="0.01"
@input="emit()"
v-model="value"/>
</div>
@ -23,14 +80,13 @@
let in_route = '/collection/' + this.collection + '/metadata/' + this.metadatum;
if(this.isRepositoryLevel || this.collection == 'filter_in_repository'){
if (this.isRepositoryLevel || this.collection == 'filter_in_repository')
in_route = '/metadata/'+ this.metadatum;
}
axios.get(in_route)
.then( res => {
let result = res.data;
if( result && result.metadata_type ){
if ( result && result.metadata_type ){
this.metadatum_object = result;
this.selectedValues();
}
@ -44,11 +100,11 @@
data(){
return {
value: null,
isValid: false,
clear: false,
collection: '',
metadatum: '',
metadatum_object: {},
comparator: '=' // =, !=, >, >=, <, <=
}
},
props: {
@ -61,18 +117,34 @@
query: Object,
isRepositoryLevel: Boolean,
},
computed: {
comparatorSymbol() {
switch(this.comparator) {
case '=': return '&#61;';
case '!=': return '&#8800;';
case '>': return '&#62;';
case '>=': return '&#8805;';
case '<': return '&#60;';
case '<=': return '&#8804;';
default: return '';
}
}
},
methods: {
selectedValues(){
if ( !this.query || !this.query.metaquery || !Array.isArray( this.query.metaquery ) )
return false;
let index = this.query.metaquery.findIndex(newMetadatum => newMetadatum.key === this.metadatum );
if ( index >= 0){
let metadata = this.query.metaquery[ index ];
if ( metadata.value && metadata.value.length > 0){
this.value = metadata.value[0];
this.isValid = true;
}
if ( metadata.value && metadata.value.length > 0)
this.value = Number(metadata.value[0]);
if ( metadata.compare)
this.comparator = metadata.compare;
if (metadata.value[0] != undefined) {
this.$eventBusSearch.$emit( 'sendValuesToTags', {
@ -84,6 +156,7 @@
} else {
return false;
}
},
cleanSearchFromTags(filterTag) {
if (filterTag.filterId == this.filter.id)
@ -95,6 +168,7 @@
this.$emit('input', {
filter: 'numeric',
compare: this.comparator,
metadatum_id: this.metadatum,
collection_id: ( this.collection_id ) ? this.collection_id : this.filter.collection_id,
value: ''
@ -107,9 +181,10 @@
if ( this.value === null || this.value === '')
return;
this.$emit('input', {
filter: 'numeric',
compare: this.comparator,
metadatum_id: this.metadatum,
collection_id: ( this.collection_id ) ? this.collection_id : this.filter.collection_id,
value: this.value
@ -120,6 +195,10 @@
value: this.value
});
},
onChangeComparator(newComparator) {
this.comparator = newComparator;
this.emit();
}
},
beforeDestroy() {
@ -127,3 +206,27 @@
}
}
</script>
<style lang="scss" scoped>
.numeric-filter-container {
display: flex;
.dropdown {
width: auto;
.dropdown-trigger button {
padding: 0 0.5rem !important;
height: 28px !important;
i:not(.tainacan-icon-arrowdown) {
margin-top: -3px;
font-size: 1.5rem;
font-style: normal;
color: #555758;
}
}
}
}
</style>