@eox/itemfilter 1.1.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eox-itemfilter.js +39 -20
- package/dist/eox-itemfilter.umd.cjs +110 -95
- package/package.json +1 -1
- package/test/cases/general/index.js +1 -0
- package/test/cases/general/validation.js +22 -0
- package/test/general.cy.js +10 -0
package/dist/eox-itemfilter.js
CHANGED
|
@@ -614,6 +614,7 @@ details {
|
|
|
614
614
|
);
|
|
615
615
|
--background-color: #fff;
|
|
616
616
|
--padding: 0.5rem;
|
|
617
|
+
--text-transform: capitalize;
|
|
617
618
|
}
|
|
618
619
|
* {
|
|
619
620
|
font-family: Roboto, sans-serif;
|
|
@@ -650,7 +651,7 @@ details > summary::-webkit-details-marker {
|
|
|
650
651
|
.title {
|
|
651
652
|
font-size: 13px;
|
|
652
653
|
align-items: center;
|
|
653
|
-
text-transform:
|
|
654
|
+
text-transform: var(--text-transform);
|
|
654
655
|
}
|
|
655
656
|
.subtitle {
|
|
656
657
|
font-size: 11px;
|
|
@@ -701,7 +702,7 @@ eox-itemfilter-expandcontainer > [data-type=filter] {
|
|
|
701
702
|
}
|
|
702
703
|
[data-type=filter] .title,
|
|
703
704
|
details summary {
|
|
704
|
-
text-transform:
|
|
705
|
+
text-transform: var(--text-transform);
|
|
705
706
|
}
|
|
706
707
|
li,
|
|
707
708
|
label,
|
|
@@ -735,7 +736,7 @@ section:not(section:last-of-type) {
|
|
|
735
736
|
ul:not(#filters) > li {
|
|
736
737
|
padding: 5px 0;
|
|
737
738
|
}
|
|
738
|
-
|
|
739
|
+
ul#results li {
|
|
739
740
|
padding: 5px var(--padding);
|
|
740
741
|
}
|
|
741
742
|
section {
|
|
@@ -881,7 +882,7 @@ button.icon {
|
|
|
881
882
|
}
|
|
882
883
|
.chip-title {
|
|
883
884
|
pointer-events: none;
|
|
884
|
-
text-transform:
|
|
885
|
+
text-transform: var(--text-transform);
|
|
885
886
|
}
|
|
886
887
|
.chip {
|
|
887
888
|
display: flex;
|
|
@@ -929,21 +930,14 @@ button.icon {
|
|
|
929
930
|
align-items: center;
|
|
930
931
|
width: 100%;
|
|
931
932
|
box-sizing: border-box;
|
|
932
|
-
border: 1px solid var(--border-color);
|
|
933
|
-
border-radius: 4px;
|
|
934
933
|
justify-content: space-between;
|
|
935
934
|
cursor: text;
|
|
936
935
|
margin-top: 0.5rem;
|
|
937
936
|
margin-bottom: 0.5rem;
|
|
938
937
|
background: white;
|
|
939
938
|
}
|
|
940
|
-
.autocomplete-container:hover,
|
|
941
|
-
.text-container:hover {
|
|
942
|
-
border: 1px solid var(--primary-color);
|
|
943
|
-
}
|
|
944
939
|
.autocomplete-container-wrapper,
|
|
945
940
|
.text-container-wrapper {
|
|
946
|
-
padding: 6px;
|
|
947
941
|
position: relative;
|
|
948
942
|
display: flex;
|
|
949
943
|
align-items: center;
|
|
@@ -967,15 +961,25 @@ button.icon {
|
|
|
967
961
|
.autocomplete-input,
|
|
968
962
|
.text-input {
|
|
969
963
|
flex: 1;
|
|
970
|
-
border:
|
|
964
|
+
border: 1px solid var(--border-color);
|
|
971
965
|
outline: none;
|
|
972
966
|
box-sizing: border-box;
|
|
973
967
|
margin-top: 0 !important;
|
|
974
968
|
margin-bottom: 0 !important;
|
|
975
|
-
padding: 3px 0px !important;
|
|
976
969
|
min-width: 150px;
|
|
970
|
+
}
|
|
971
|
+
input[type="text"].text-input,
|
|
972
|
+
input[type="text"].autocomplete-input {
|
|
973
|
+
padding: 9px 6px !important;
|
|
977
974
|
border-radius: 4px;
|
|
978
975
|
}
|
|
976
|
+
.text-input:hover,
|
|
977
|
+
.autocomplete-input:hover {
|
|
978
|
+
border: 1px solid var(--primary-color);
|
|
979
|
+
}
|
|
980
|
+
.text-input:invalid {
|
|
981
|
+
border: 1px solid red;
|
|
982
|
+
}
|
|
979
983
|
.selected-items {
|
|
980
984
|
display: flex;
|
|
981
985
|
flex-wrap: nowrap;
|
|
@@ -1035,6 +1039,12 @@ eox-itemfilter-results li.highlighted {
|
|
|
1035
1039
|
.input-container.dirty-filter-input {
|
|
1036
1040
|
margin-left: 25px;
|
|
1037
1041
|
}
|
|
1042
|
+
.error-validation {
|
|
1043
|
+
position: relative;
|
|
1044
|
+
color: red;
|
|
1045
|
+
font-size: x-small;
|
|
1046
|
+
top: -8px;
|
|
1047
|
+
}
|
|
1038
1048
|
`, za = `:root,:host { --spacing: 1rem; --block-spacing-vertical: calc(var(--spacing) * 2); --block-spacing-horizontal: var(--spacing); --background-color: var(--eox-background-color, white); --color: var(--eox-color, #2c3d49); --h-color: var(--eox-h-color, var(--color)); --hover-transparency: var(--eox-hover-transparency, 20%); --bg-hover-transparency: var(--eox-bg-hover-transparency, 40%); --btn-hover-transparency: var(--eox-btn-hover-transparency, 80%); --primary-color: var(--eox-primary-color, #004170); --primary-color-hover: color-mix( in srgb, var(--primary-color) var(--hover-transparency), transparent ); --primary-bg-color-hover: color-mix( in srgb, var(--primary-color) var(--bg-hover-transparency), transparent ); --primary-btn-color-hover: color-mix( in srgb, var(--primary-color) var(--btn-hover-transparency), transparent ); --secondary-color: var(--eox-secondary-color, #c6d4df); --secondary-color-hover: color-mix( in srgb, var(--secondary-color) var(--hover-transparency), transparent ); --secondary-bg-color-hover: color-mix( in srgb, var(--secondary-color) var(--bg-hover-transparency), transparent ); --secondary-btn-color-hover: color-mix( in srgb, var(--secondary-color) var(--btn-hover-transparency), transparent ); --success: var(--eox-success, #26cc0f); --warning: var(--eox-warning, #f18e32); --error: var(--eox-error, #ff5252); --header-font-family: var(--eox-header-font-family, "Roboto", sans-serif); --body-font-family: var(--eox-body-font-family, "Roboto", sans-serif);}* { font-size: normal; font-family: var(--body-font-family); color: var(--eox-color);}h1,h2,h3,h4,h5,h6 { font-family: var(--header-font-family);}span,p,div,main,label { font-family: var(--body-font-family);}@media (min-width: 576px) { .container { max-width: 510px; padding-right: 0; padding-left: 0; --block-spacing-vertical: calc(var(--spacing) * 2.5); }}@media (min-width: 768px) { .container { max-width: 700px; --block-spacing-vertical: calc(var(--spacing) * 3); }}@media (min-width: 992px) { .container { max-width: 920px; --block-spacing-vertical: calc(var(--spacing) * 3.5); }}@media (min-width: 1200px) { .container { max-width: 1130px; --block-spacing-vertical: calc(var(--spacing) * 4); }}.container { width: 100%; margin-right: auto; margin-left: auto; display: block; padding: var(--block-spacing-vertical) var(--block-spacing-horizontal);}h1,h2,h3 { line-height: 120%; margin-top: 0.8rem; margin-bottom: 0.8rem;}p { --font-size: 1rem; font-weight: 400; line-height: 170%; margin-top: 0.8rem; margin-bottom: 1.6rem; font-size: var(--font-size);}body { padding: 0; margin: 0;}.sb-show-main.sb-main-padded { padding: 0;}h1,h2,h3,h4,h5,h6 { --font-weight: 700;}h1 { --font-size: 3rem; --typography-spacing-vertical: 0.5rem;}h2 { --font-size: 2rem; --typography-spacing-vertical: 0.5rem;}h3 { --font-size: 1.75rem; --typography-spacing-vertical: 0.5rem;}h4 { --font-size: 1.5rem; --typography-spacing-vertical: 0.5rem;}h5 { --font-size: 1.25rem; --typography-spacing-vertical: 0.5rem;}h1,h2,h3,h4,h5,h6 { margin-top: 0; margin-bottom: var(--typography-spacing-vertical); color: var(--h-color); font-weight: var(--font-weight); font-size: var(--font-size); font-family: var(--header-font-family);}button,.button { display: inline-flex; position: relative; align-items: center; color: #fff; border-width: 0; outline: none; border-radius: 4px; padding: 16px; height: 36px; cursor: pointer; font-family: inherit; font-size: 0.875rem; text-transform: uppercase; letter-spacing: 1.25px; font-weight: 500; box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12); transition-property: box-shadow, transform, opacity, background; transition-duration: 0.28s; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);}button:hover:not([disabled]):not(.icon):not(.json-editor-btntype-*),.button:hover:not([disabled]):not(.icon) { box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12); background: var(--primary-btn-color-hover);}button,button:active,.button,.button:active { background: var(--primary-color);}button[disabled],.button[disabled] { opacity: 0.5; cursor: not-allowed;}button.block,.button.block { display: block;}button.outline,.button.outline { background: transparent; box-shadow: none; color: var(--primary-color); outline: 1px solid var(--primary-color);}button.outline:hover,.button.outline:hover { background: transparent;}button.icon,.button.icon,button[class*="json-editor-btntype-"] { background: transparent; border: none; box-shadow: none; padding: 0; border-radius: 50%; width: 24px; height: 24px; text-indent: -9999px;}button.icon-text,.button.icon-text { text-indent: 26px;}button.icon-text.block,.button.icon-text.block { text-indent: 20px;}button.icon:before,button.icon-text:before,.button.icon:before,.button.icon-text:before { position: absolute; text-indent: 0; line-height: initial;}button.icon-text.block:before,.button.icon-text.block:before { text-indent: -54px;}button.icon:before,.button.icon:before,button[class*="json-editor-btntype-"]::before { width: 24px; height: 24px; margin-right: 0;}button.icon-text:before,.button.icon-text:before { width: 18px; height: 18px;}button.small,.button.small { height: 28px; padding: 12.4px; font-size: 0.75rem;}button.smallest.icon,button.smallest.icon::before { height: 16px; width: 16px; padding: 0;}input[type="checkbox"] { appearance: none; -webkit-appearance: none; margin: 0; cursor: pointer; display: flex; flex-direction: row; align-items: center; width: 24px; height: 24px;}input[type="checkbox"]:after { display: block; content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23004170' viewBox='0 0 24 24'%3E%3Ctitle%3Echeckbox-blank-outline%3C/title%3E%3Cpath d='M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z' /%3E%3C/svg%3E"); width: 20px; height: 20px; margin-right: 4px;}input[type="checkbox"]:checked:after { content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23004170' viewBox='0 0 24 24'%3E%3Ctitle%3Echeckbox-marked%3C/title%3E%3Cpath d='M10,17L5,12L6.41,10.58L10,14.17L17.59,6.58L19,8M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z' /%3E%3C/svg%3E");}textarea { height: 90px; resize: none; border-radius: 4px; box-sizing: border-box !important; width: 100%; padding: 5px 7px; border: 1px solid var(--secondary-color); font-size: smaller; background: var(--background-color);}input[type="text"],input[type="url"],input[type="email"],input[type="password"],input[type="text"],input[type="number"],input[type="search"],input[type="tel"],select { box-sizing: border-box; width: 100%; margin-top: 0.5rem; margin-bottom: 0.5rem; padding: 5px 7px; border-radius: 4px; border: 1px solid #0004;}ul.list-wrap { padding: 0;}ul.list-wrap li:hover,ul.list-wrap li.selected { background: var(--secondary-bg-color-hover);}ul.list-wrap li { list-style: none; padding: 4px;}ul.list-wrap li { border-bottom: 1.2px solid var(--secondary-color);}ul.list-wrap li:first-child { border-top: 1.2px solid var(--secondary-color);}ul.list-wrap li .list { width: 100%; align-items: center; justify-content: space-between; display: flex; align-items: center; cursor: pointer; font-size: small; gap: 10px;}ul.list-wrap li .list span { display: flex; align-items: center; cursor: pointer; font-size: small; flex-grow: 1;}input[type="radio"] { appearance: none; -webkit-appearance: none; margin: 0; cursor: pointer; display: flex; flex-direction: row; align-items: center; width: 24px; height: 24px;}label span { font-size: small;}input[type="radio"]:after { display: block; content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23004170' viewBox='0 0 24 24'%3E%3Ctitle%3Eradiobox-blank%3C/title%3E%3Cpath d='M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z' /%3E%3C/svg%3E"); width: 20px; height: 20px; margin-right: 4px;}input[type="radio"]:checked:after { content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23004170' viewBox='0 0 24 24'%3E%3Ctitle%3Eradiobox-marked%3C/title%3E%3Cpath d='M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,7A5,5 0 0,0 7,12A5,5 0 0,0 12,17A5,5 0 0,0 17,12A5,5 0 0,0 12,7Z' /%3E%3C/svg%3E");}input[type="range"] { -webkit-appearance: none; width: 90%; margin-left: 5%; height: 6px; border-radius: 5px; background: #d7dcdf; outline: none; padding: 0;}input[type="range"]::-webkit-slider-thumb { appearance: none; width: 15px; height: 15px; border-radius: 50%; background: #2c3e50; cursor: pointer; transition: background 0.15s ease-in-out;}.range-slider { margin: 60px 0 0 0;}.range-slider { width: 100%;}input[type="range"]::-webkit-slider-thumb:hover { background: #00416f;}input[type="range"]:active::-webkit-slider-thumb { background: #00416f;}input[type="range"]::-moz-range-thumb { width: 15px; height: 15px; border: 0; border-radius: 50%; background: #2c3e50; cursor: pointer; transition: background 0.15s ease-in-out;}input[type="range"]::-moz-range-thumb:hover { background: #00416f;}input[type="range"]:active::-moz-range-thumb { background: #00416f;}input[type="range"]:focus::-webkit-slider-thumb { box-shadow: 0 0 0 3px #fff0, 0 0 0 6px #00416f00;}.range-slider__value { display: inline-block; position: relative; width: 60px; color: #fff; line-height: 20px; text-align: center; border-radius: 3px; background: #2c3e50; padding: 5px 10px; margin-left: 8px;}.range-slider__value:after { position: absolute; top: 8px; left: -7px; width: 0; height: 0; border-top: 7px solid transparent; border-right: 7px solid #2c3e50; border-bottom: 7px solid transparent; content: "";}input::-moz-focus-inner,input::-moz-focus-outer { border: 0;}`;
|
|
1039
1049
|
var Vn, bo;
|
|
1040
1050
|
class qa extends Je {
|
|
@@ -1070,7 +1080,7 @@ class qa extends Je {
|
|
|
1070
1080
|
<summary>
|
|
1071
1081
|
<span
|
|
1072
1082
|
class="title"
|
|
1073
|
-
style="${!this.filterObject.title && "text-transform:
|
|
1083
|
+
style="${!this.filterObject.title && "text-transform: var(--text-transform)"}"
|
|
1074
1084
|
>
|
|
1075
1085
|
${this.filterObject.title || this.filterObject.key || "Filter"}
|
|
1076
1086
|
<slot name="reset-button"></slot>
|
|
@@ -4295,7 +4305,7 @@ function bu(t) {
|
|
|
4295
4305
|
}
|
|
4296
4306
|
function mu(t) {
|
|
4297
4307
|
const e = t.renderRoot.querySelector("input[type='text']");
|
|
4298
|
-
t.filterObject.keys.forEach((r) => {
|
|
4308
|
+
t.isValid = e.checkValidity(), t.filterObject.keys.forEach((r) => {
|
|
4299
4309
|
t.filterObject.state[r] = e.value;
|
|
4300
4310
|
}), t.filterObject.dirty = !0, t.filterObject.stringifiedState = e.value, t.dispatchEvent(new CustomEvent("filter")), e.value === "" && t.reset();
|
|
4301
4311
|
}
|
|
@@ -4450,14 +4460,15 @@ class Tu extends Je {
|
|
|
4450
4460
|
Kr(this, "debouncedInputHandler", ri(Fe(this, Kn), 500, {
|
|
4451
4461
|
leading: !0
|
|
4452
4462
|
}));
|
|
4453
|
-
this.filterObject = {}, this.unstyled = !1, this.tabIndex = 0;
|
|
4463
|
+
this.filterObject = {}, this.unstyled = !1, this.tabIndex = 0, this.unstyled = !1;
|
|
4454
4464
|
}
|
|
4455
4465
|
// Define properties with defaults and types
|
|
4456
4466
|
static get properties() {
|
|
4457
4467
|
return {
|
|
4458
4468
|
filterObject: { attribute: !1, type: Object },
|
|
4459
4469
|
tabIndex: { attribute: !1, type: Number },
|
|
4460
|
-
unstyled: { type: Boolean }
|
|
4470
|
+
unstyled: { type: Boolean },
|
|
4471
|
+
isValid: { state: !0, type: Boolean }
|
|
4461
4472
|
};
|
|
4462
4473
|
}
|
|
4463
4474
|
/**
|
|
@@ -4478,7 +4489,9 @@ class Tu extends Je {
|
|
|
4478
4489
|
render() {
|
|
4479
4490
|
return qe(
|
|
4480
4491
|
this.filterObject,
|
|
4481
|
-
() =>
|
|
4492
|
+
() => {
|
|
4493
|
+
var r;
|
|
4494
|
+
return Y`
|
|
4482
4495
|
<style></style>
|
|
4483
4496
|
<div class="text-container">
|
|
4484
4497
|
<div class="text-container-wrapper">
|
|
@@ -4490,12 +4503,17 @@ class Tu extends Je {
|
|
|
4490
4503
|
part="input-search"
|
|
4491
4504
|
value="${Object.values(this.filterObject.state)[0]}"
|
|
4492
4505
|
tabindex=${this.tabIndex}
|
|
4506
|
+
pattern="${((r = this.filterObject.validation) == null ? void 0 : r.pattern) || ".*"}"
|
|
4493
4507
|
@input="${this.debouncedInputHandler}"
|
|
4494
|
-
@click=${(
|
|
4508
|
+
@click=${(n) => n.stopPropagation()}
|
|
4495
4509
|
/>
|
|
4496
4510
|
</div>
|
|
4497
4511
|
</div>
|
|
4498
|
-
|
|
4512
|
+
<small class="error-validation"
|
|
4513
|
+
>${this.filterObject.validation && this.isValid === !1 ? this.filterObject.validation.message : ""}</small
|
|
4514
|
+
>
|
|
4515
|
+
`;
|
|
4516
|
+
}
|
|
4499
4517
|
);
|
|
4500
4518
|
}
|
|
4501
4519
|
}
|
|
@@ -7254,6 +7272,7 @@ function Yh(t, e, r) {
|
|
|
7254
7272
|
case "text":
|
|
7255
7273
|
return Y`<eox-itemfilter-text
|
|
7256
7274
|
data-type="filter"
|
|
7275
|
+
data-cy="text-filter"
|
|
7257
7276
|
slot="filter"
|
|
7258
7277
|
id="${n}"
|
|
7259
7278
|
.tabIndex=${e}
|