satis 2.1.62 → 2.1.64
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff21f5583a4c95286eabbc1c46ce61ccd07c2f0a502cb91f2c2974f724f778c7
|
4
|
+
data.tar.gz: ec24f62f291123c431ab91b5bb0d22cfe99aa50f168bdfac5dc6ad9948fd30bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34a0a9515ee8979f88e5e91ee447b2b598d7aac2e1b5f143403c43288ec215e8c00065864fdc1166d51ddf3da129a2ba87994d0f3be3edf1d2b4fa5885c9a895
|
7
|
+
data.tar.gz: 2ac93fca741cad0c6f06a8cb5570fafd17f28ef0e5ee7ca7862372631d53653bdb5cb934b5a6f1cf0057b41f15dc1de25cd595c747c03476a37859de04105d1d
|
@@ -1,7 +1,7 @@
|
|
1
1
|
div.satis-date-time-picker data-controller="satis-date-time-picker" data-satis-date-time-picker-time-picker-value=time_picker.to_s data-satis-date-time-picker-clearable-value=clearable.to_s data-satis-date-time-picker-locale-value="" data-satis-date-time-picker-range-value=range.to_s data-satis-date-time-picker-multiple-value=multiple.to_s data-satis-date-time-picker-week-start-value=week_start data-satis-date-time-picker-inline-value=inline.to_s data-satis-date-time-picker-format-value=JSON.dump(format)
|
2
2
|
.relative.flex.items-center
|
3
3
|
= form.text_field attribute, options[:input_html].merge(class: 'hidden')
|
4
|
-
input.form-control data-action="focus->satis-date-time-picker#showCalendar input->satis-date-time-picker#dateTimeEntered" data-satis-date-time-picker-target="input" type="text"
|
4
|
+
input.form-control class=input_class data-action="focus->satis-date-time-picker#showCalendar input->satis-date-time-picker#dateTimeEntered" data-satis-date-time-picker-target="input" type="text"
|
5
5
|
.absolute.inset-y-0.right-0.flex.py-1.5.pr-1.5
|
6
6
|
button.cursor-pointer.w-6.h-full.flex.items-center.text-gray-400.outline-none.focus:outline-none data-satis-date-time-picker-target="clearButton" data-action="click->satis-date-time-picker#clear"
|
7
7
|
i.fas.fa-xmark
|
@@ -26,7 +26,8 @@ export default class DropdownComponentController extends ApplicationController {
|
|
26
26
|
pageSize: Number,
|
27
27
|
url: String,
|
28
28
|
urlParams: Object,
|
29
|
-
isMultiple: Boolean
|
29
|
+
isMultiple: Boolean,
|
30
|
+
minSearchQueryLength: Number
|
30
31
|
}
|
31
32
|
|
32
33
|
connect() {
|
@@ -48,8 +49,6 @@ export default class DropdownComponentController extends ApplicationController {
|
|
48
49
|
// To remember what the last search was we did
|
49
50
|
this.searchQueryValue = null
|
50
51
|
this.lastSearch = null
|
51
|
-
this.minSearchQueryLength = 2
|
52
|
-
|
53
52
|
// To remember what the last options were we got from the server to prevent unnecessary refreshes
|
54
53
|
// and unexpected events
|
55
54
|
this.lastServerRefreshOptions = new Set()
|
@@ -241,8 +240,8 @@ export default class DropdownComponentController extends ApplicationController {
|
|
241
240
|
search(event) {
|
242
241
|
this.searchQueryValue = this.searchInputTarget.value
|
243
242
|
|
244
|
-
if(this.searchInputTarget.value.length === 0 && !this.isMultipleValue){
|
245
|
-
if(this.nrOfItems === 1) this.lowLightSelected()
|
243
|
+
if (this.searchInputTarget.value.length === 0 && !this.isMultipleValue) {
|
244
|
+
if (this.nrOfItems === 1) this.lowLightSelected()
|
246
245
|
this.hiddenSelectTarget.innerHTML = ""
|
247
246
|
this.hiddenSelectTarget.add(this.createOption())
|
248
247
|
}
|
@@ -279,7 +278,7 @@ export default class DropdownComponentController extends ApplicationController {
|
|
279
278
|
this.lastPage = null
|
280
279
|
this.endPage = null
|
281
280
|
|
282
|
-
this.lowLightSelected()
|
281
|
+
this.lowLightSelected()
|
283
282
|
this.selectedIndex = -1
|
284
283
|
|
285
284
|
if (this.hasUrlValue) {
|
@@ -421,9 +420,9 @@ export default class DropdownComponentController extends ApplicationController {
|
|
421
420
|
} else {
|
422
421
|
this.filterResultsChainTo()
|
423
422
|
|
424
|
-
if(this.hasResults && !this.searchQueryChanged){
|
423
|
+
if (this.hasResults && !this.searchQueryChanged) {
|
425
424
|
this.showResultsList(event)
|
426
|
-
}else {
|
425
|
+
} else {
|
427
426
|
if (this.hasUrlValue)
|
428
427
|
this.fetchResults(event)
|
429
428
|
else
|
@@ -492,7 +491,7 @@ export default class DropdownComponentController extends ApplicationController {
|
|
492
491
|
|
493
492
|
localResults(event) {
|
494
493
|
if (!this.searchQueryChanged) {
|
495
|
-
if(!this.resultsShown) {
|
494
|
+
if (!this.resultsShown) {
|
496
495
|
if (this.hasResults)
|
497
496
|
this.showResultsList(event)
|
498
497
|
else this.showSelectedItem()
|
@@ -511,7 +510,7 @@ export default class DropdownComponentController extends ApplicationController {
|
|
511
510
|
} else {
|
512
511
|
previouslyVisibleItemsCount++
|
513
512
|
}
|
514
|
-
})
|
513
|
+
})
|
515
514
|
|
516
515
|
this.filterResultsChainTo()
|
517
516
|
|
@@ -520,7 +519,7 @@ export default class DropdownComponentController extends ApplicationController {
|
|
520
519
|
let matches = []
|
521
520
|
this.itemTargets.forEach((item) => {
|
522
521
|
const text = item.getAttribute("data-satis-dropdown-item-text")
|
523
|
-
const matched = this.needsExactMatchValue ? searchValue.localeCompare(text, undefined, {sensitivity: 'base'}) === 0 : text.toLowerCase().includes(searchValue.toLowerCase())
|
522
|
+
const matched = this.needsExactMatchValue ? searchValue.localeCompare(text, undefined, { sensitivity: 'base' }) === 0 : text.toLowerCase().includes(searchValue.toLowerCase())
|
524
523
|
|
525
524
|
const isHidden = item.classList.contains("hidden")
|
526
525
|
if (!isHidden) {
|
@@ -541,9 +540,9 @@ export default class DropdownComponentController extends ApplicationController {
|
|
541
540
|
}
|
542
541
|
|
543
542
|
// auto select if there is only one match and we are not in freetext mode
|
544
|
-
if(!this.freeTextValue) {
|
543
|
+
if (!this.freeTextValue) {
|
545
544
|
if (matches.length === 1) {
|
546
|
-
if (this.filteredSearchQuery.length >= this.
|
545
|
+
if (this.filteredSearchQuery.length >= this.minSearchQueryLengthValue &&
|
547
546
|
matches[0].getAttribute("data-satis-dropdown-item-text").toLowerCase().indexOf(this.lastSearch.toLowerCase()) >= 0) {
|
548
547
|
const dataDiv = matches[0].closest('[data-satis-dropdown-target="item"]')
|
549
548
|
this.selectItem(dataDiv)
|
@@ -553,7 +552,7 @@ export default class DropdownComponentController extends ApplicationController {
|
|
553
552
|
this.showSelectedItem()
|
554
553
|
}
|
555
554
|
// the selected item if there was only 1 item visible before
|
556
|
-
} else if(previouslyVisibleItemsCount === 1 && matches.length > 1) {
|
555
|
+
} else if (previouslyVisibleItemsCount === 1 && matches.length > 1) {
|
557
556
|
this.setSelectedItem()
|
558
557
|
}
|
559
558
|
}
|
@@ -569,7 +568,7 @@ export default class DropdownComponentController extends ApplicationController {
|
|
569
568
|
(this.currentPage == this.lastPage || this.currentPage == this.endPage)) ||
|
570
569
|
!this.hasUrlValue
|
571
570
|
) {
|
572
|
-
if(!this.resultsShown) {
|
571
|
+
if (!this.resultsShown) {
|
573
572
|
if (this.hasResults)
|
574
573
|
this.showResultsList(event)
|
575
574
|
else this.showSelectedItem()
|
@@ -608,19 +607,23 @@ export default class DropdownComponentController extends ApplicationController {
|
|
608
607
|
}
|
609
608
|
|
610
609
|
// auto select when there is only 1 value
|
611
|
-
if (this.filteredSearchQuery.length >= this.
|
610
|
+
if (this.filteredSearchQuery.length >= this.minSearchQueryLengthValue && this.nrOfItems === 1 && !this.freeTextValue) {
|
612
611
|
const dataDiv = this.itemTargets[0].closest('[data-satis-dropdown-target="item"]')
|
613
612
|
this.selectItem(dataDiv)
|
614
613
|
this.setSelectedItem(dataDiv.getAttribute("data-satis-dropdown-item-value"))
|
615
614
|
this.searchQueryValue = ""
|
616
|
-
} else if(this.searchQueryValue?.length > 0) {
|
615
|
+
} else if (this.searchQueryValue?.length > 0) {
|
617
616
|
// hide all items that don't match the search query
|
618
617
|
const searchValue = this.searchQueryValue
|
619
618
|
let matches = []
|
620
619
|
this.itemTargets.forEach((item) => {
|
621
620
|
const text = item.getAttribute("data-satis-dropdown-item-text")
|
622
|
-
|
623
|
-
|
621
|
+
let matched
|
622
|
+
if (this.needsExactMatchValue) {
|
623
|
+
matched = searchValue.localeCompare(text, undefined, { sensitivity: "base" }) === 0
|
624
|
+
} else {
|
625
|
+
matched = searchValue.split(" ").every((term) => { return text?.toLowerCase().includes(term.toLowerCase()) })
|
626
|
+
}
|
624
627
|
|
625
628
|
const isHidden = item.classList.contains("hidden")
|
626
629
|
if (!isHidden) {
|
@@ -688,8 +691,8 @@ export default class DropdownComponentController extends ApplicationController {
|
|
688
691
|
return promise
|
689
692
|
}
|
690
693
|
|
691
|
-
get filteredSearchQuery(){
|
692
|
-
if(this.searchQueryValue < this.
|
694
|
+
get filteredSearchQuery() {
|
695
|
+
if (this.searchQueryValue < this.minSearchQueryLengthValue) return ""
|
693
696
|
return this.searchQueryValue
|
694
697
|
}
|
695
698
|
|
@@ -866,9 +869,9 @@ export default class DropdownComponentController extends ApplicationController {
|
|
866
869
|
this.selectedIndex = -1
|
867
870
|
return
|
868
871
|
}
|
869
|
-
const itemTargets = this.itemTargets
|
870
|
-
const visibleItems = itemTargets.filter(item => !item.classList.contains("hidden"))
|
871
|
-
this.selectedIndex = visibleItems.findIndex(item => item.getAttribute("data-satis-dropdown-item-value") === value)
|
872
|
+
const itemTargets = this.itemTargets
|
873
|
+
const visibleItems = itemTargets.filter(item => !item.classList.contains("hidden"))
|
874
|
+
this.selectedIndex = visibleItems.findIndex(item => item.getAttribute("data-satis-dropdown-item-value") === value)
|
872
875
|
this.highLightSelected()
|
873
876
|
}
|
874
877
|
|
@@ -884,9 +887,9 @@ export default class DropdownComponentController extends ApplicationController {
|
|
884
887
|
this.highLightSelected()
|
885
888
|
}
|
886
889
|
validateSearchQuery() {
|
887
|
-
const trimmedValue = this.searchInputTarget.value.trim()
|
888
|
-
const elements = this.selectedItemsTemplateTarget.content.querySelectorAll(`[data-satis-dropdown-item-text*="${trimmedValue}"]`)
|
889
|
-
const selected = Array.from(elements).find(element => element.getAttribute('data-satis-dropdown-item-text').trim() === trimmedValue)
|
890
|
+
const trimmedValue = this.searchInputTarget.value.trim()
|
891
|
+
const elements = this.selectedItemsTemplateTarget.content.querySelectorAll(`[data-satis-dropdown-item-text*="${trimmedValue}"]`)
|
892
|
+
const selected = Array.from(elements).find(element => element.getAttribute('data-satis-dropdown-item-text').trim() === trimmedValue)
|
890
893
|
if (!selected && this.searchInputTarget.value.length > 0 && !this.freeTextValue) {
|
891
894
|
this.searchInputTarget.closest(".sts-dropdown").classList.toggle("warning", true)
|
892
895
|
} else {
|
@@ -955,13 +958,13 @@ export default class DropdownComponentController extends ApplicationController {
|
|
955
958
|
}
|
956
959
|
|
957
960
|
get hasFocus() {
|
958
|
-
const activeElement = document.activeElement
|
961
|
+
const activeElement = document.activeElement
|
959
962
|
if (activeElement === this.element ||
|
960
963
|
this.element.contains(activeElement) ||
|
961
964
|
this.element.querySelector(':focus') !== null) {
|
962
|
-
return true
|
965
|
+
return true
|
963
966
|
}
|
964
|
-
return false
|
967
|
+
return false
|
965
968
|
}
|
966
969
|
|
967
970
|
// Selected items are being cached in selectItemsTemplate. Sometimes we want to show the selected item in the results list
|
@@ -971,7 +974,7 @@ export default class DropdownComponentController extends ApplicationController {
|
|
971
974
|
|| this.freeTextValue
|
972
975
|
|| this.hiddenSelectTarget.options.length === 0
|
973
976
|
|| !this.hasFocus
|
974
|
-
) return false
|
977
|
+
) return false
|
975
978
|
|
976
979
|
const option = this.hiddenSelectTarget.options[0]
|
977
980
|
let item = this.itemsTarget.querySelector(`[data-satis-dropdown-item-value="${option.value}"]`)
|
@@ -988,12 +991,12 @@ export default class DropdownComponentController extends ApplicationController {
|
|
988
991
|
}
|
989
992
|
}
|
990
993
|
|
991
|
-
if(item) {
|
994
|
+
if (item) {
|
992
995
|
if (!this.resultsShown)
|
993
996
|
this.showResultsList()
|
994
997
|
this.setSelectedItem(option.value)
|
995
998
|
}
|
996
999
|
|
997
|
-
return item != null
|
1000
|
+
return item != null
|
998
1001
|
}
|
999
1002
|
}
|
data/lib/satis/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: satis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.64
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom de Grunt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: browser
|