From c54c992cdce023b3176e8c39757f8431ee0dd70a Mon Sep 17 00:00:00 2001 From: Laila Los <44241786+ElectronicBlueberry@users.noreply.github.com> Date: Thu, 16 Nov 2023 18:03:27 +0100 Subject: [PATCH 01/37] initial layout --- .../Form/Elements/FromSelectMany.vue | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 client/src/components/Form/Elements/FromSelectMany.vue diff --git a/client/src/components/Form/Elements/FromSelectMany.vue b/client/src/components/Form/Elements/FromSelectMany.vue new file mode 100644 index 000000000000..123af9fe735f --- /dev/null +++ b/client/src/components/Form/Elements/FromSelectMany.vue @@ -0,0 +1,114 @@ + + + + + From 6381e7bd3eb520e58c3517fa38f41afae3d7af29 Mon Sep 17 00:00:00 2001 From: Laila Los <44241786+ElectronicBlueberry@users.noreply.github.com> Date: Thu, 16 Nov 2023 19:03:04 +0100 Subject: [PATCH 02/37] add regex filtering --- .../Form/Elements/FromSelectMany.vue | 69 ++++++++++++++++--- client/src/composables/filter/filter.d.ts | 4 +- client/src/composables/filter/filter.js | 22 ++++-- .../src/composables/filter/filter.worker.js | 5 +- .../src/composables/filter/filterFunction.ts | 26 ++++++- 5 files changed, 105 insertions(+), 21 deletions(-) diff --git a/client/src/components/Form/Elements/FromSelectMany.vue b/client/src/components/Form/Elements/FromSelectMany.vue index 123af9fe735f..b09b49c03768 100644 --- a/client/src/components/Form/Elements/FromSelectMany.vue +++ b/client/src/components/Form/Elements/FromSelectMany.vue @@ -3,8 +3,9 @@ import { library } from "@fortawesome/fontawesome-svg-core"; import { faLongArrowAltLeft, faLongArrowAltRight } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { BButton, BFormInput, BInputGroup } from "bootstrap-vue"; -import { type PropType, ref } from "vue"; +import { computed, type PropType, ref } from "vue"; +import { useFilterObjectArray } from "@/composables/filter"; import { useUid } from "@/composables/utils/uid"; library.add(faLongArrowAltLeft, faLongArrowAltRight); @@ -41,17 +42,61 @@ const props = defineProps({ }); const _emit = defineEmits<{ - (e: "input", value: SelectValue | Array): void; + (e: "input", value: Array): void; }>(); const searchValue = ref(""); const useRegex = ref(false); + +const searchRegex = computed(() => { + if (useRegex.value) { + try { + const regex = new RegExp(searchValue.value); + return regex; + } catch (e) { + return null; + } + } else { + return null; + } +}); + +const regexInvalid = computed(() => useRegex.value && searchRegex.value === null); +const asRegex = computed(() => searchRegex.value !== null); +const filteredOptions = useFilterObjectArray(props.options, searchValue, ["label"], asRegex); + +const highlightedUnselected = ref([]); +const highlightedSelected = ref([]); + +const selectText = computed(() => { + if (highlightedUnselected.value.length > 0) { + return "Select highlighted"; + } else if (searchValue.value === "") { + return "Select all"; + } else { + return "Select filtered"; + } +}); + +const deselectText = computed(() => { + if (highlightedSelected.value.length > 0) { + return "Deselect highlighted"; + } else if (searchValue.value === "") { + return "Deselect all"; + } else { + return "Deselect filtered"; + } +}); @@ -451,11 +451,12 @@ const deselectText = computed(() => { padding-left: 0.5rem; color: darken($gray-400, 20%); - button::after { + .show-more-button:hover::after, + .show-more-button:focus::after { content: none; } - button { + .show-more-button { color: $brand-info; text-decoration: underline; } @@ -485,5 +486,9 @@ const deselectText = computed(() => { width: 100%; display: flex; justify-content: space-between; + + .working-indicator { + color: $brand-primary; + } } From f4eb4ce34b947f1e33af3b31272bd3c7ee630d58 Mon Sep 17 00:00:00 2001 From: Laila Los <44241786+ElectronicBlueberry@users.noreply.github.com> Date: Tue, 21 Nov 2023 11:18:44 +0100 Subject: [PATCH 17/37] show amount of options in columns increase default display limits to 1000 --- .../FormSelectMany/FormSelectMany.vue | 38 +++++++++++++++++-- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/client/src/components/Form/Elements/FormSelectMany/FormSelectMany.vue b/client/src/components/Form/Elements/FormSelectMany/FormSelectMany.vue index bf5687af500b..3ae761f5c151 100644 --- a/client/src/components/Form/Elements/FormSelectMany/FormSelectMany.vue +++ b/client/src/components/Form/Elements/FormSelectMany/FormSelectMany.vue @@ -81,8 +81,8 @@ const regexInvalid = computed(() => useRegex.value && searchRegex.value === null const asRegex = computed(() => searchRegex.value !== null); // Limits amount of displayed options -const selectedDisplayCount = ref(500); -const unselectedDisplayCount = ref(500); +const selectedDisplayCount = ref(1000); +const unselectedDisplayCount = ref(1000); // binding to worker thread const { unselectedOptionsFiltered, selectedOptionsFiltered, running, moreUnselected, moreSelected } = useSelectMany({ @@ -256,6 +256,30 @@ const deselectText = computed(() => { return "Deselect filtered"; } }); + +const unselectedCount = computed(() => { + if (searchValue.value === "") { + return `${props.options.length - selected.value.length}`; + } else { + let countString = `${unselectedOptionsFiltered.value.length}`; + if (moreUnselected.value) { + countString += "+"; + } + return countString; + } +}); + +const selectedCount = computed(() => { + if (searchValue.value === "") { + return `${selected.value.length}`; + } else { + let countString = `${selectedOptionsFiltered.value.length}`; + if (moreSelected.value) { + countString += "+"; + } + return countString; + } +});