Use Set with .has() instead of Array with .includes() (S7776)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -209,7 +209,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- type: value -->
|
<!-- type: value -->
|
||||||
<div
|
<div
|
||||||
v-else-if="valueTypes.includes(selectedAttName.type)"
|
v-else-if="valueTypes.has(selectedAttName.type)"
|
||||||
class="space-y-2 text-sm w-full"
|
class="space-y-2 text-sm w-full"
|
||||||
>
|
>
|
||||||
<!-- Chart.js -->
|
<!-- Chart.js -->
|
||||||
@@ -335,8 +335,8 @@ const { filterAttrs } = storeToRefs(allMapDataStore);
|
|||||||
|
|
||||||
const selectedAttName = ref({});
|
const selectedAttName = ref({});
|
||||||
const selectedAttRange = ref(null);
|
const selectedAttRange = ref(null);
|
||||||
const valueTypes = ["int", "float", "date"];
|
const valueTypes = new Set(["int", "float", "date"]);
|
||||||
const classTypes = ["boolean", "string"];
|
const classTypes = new Set(["boolean", "string"]);
|
||||||
const chartData = ref({});
|
const chartData = ref({});
|
||||||
const chartOptions = ref({});
|
const chartOptions = ref({});
|
||||||
const chartComplete = ref(null); // Rendered chart.js instance data
|
const chartComplete = ref(null); // Rendered chart.js instance data
|
||||||
@@ -384,7 +384,7 @@ const attRangeTotal = computed(() => {
|
|||||||
|
|
||||||
let result = null; // Initialize the result variable with null
|
let result = null; // Initialize the result variable with null
|
||||||
|
|
||||||
if (classTypes.includes(type) && attRangeData.value) {
|
if (classTypes.has(type) && attRangeData.value) {
|
||||||
result = `(${attRangeData.value.length})`; // Assign the length of attRangeData if it exists
|
result = `(${attRangeData.value.length})`; // Assign the length of attRangeData if it exists
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -422,7 +422,7 @@ const attRangeData = computed(() => {
|
|||||||
// Get the selected Attribute radio's numeric-type data
|
// Get the selected Attribute radio's numeric-type data
|
||||||
const valueData = computed(() => {
|
const valueData = computed(() => {
|
||||||
// filter returns an array, find returns the first matched element, so use find here.
|
// filter returns an array, find returns the first matched element, so use find here.
|
||||||
if (valueTypes.includes(selectedAttName.value.type)) {
|
if (valueTypes.has(selectedAttName.value.type)) {
|
||||||
const data = filterAttrs.value.find(
|
const data = filterAttrs.value.find(
|
||||||
(item) =>
|
(item) =>
|
||||||
item.type === selectedAttName.value.type &&
|
item.type === selectedAttName.value.type &&
|
||||||
@@ -945,7 +945,7 @@ function sliderValueRange(e, direction) {
|
|||||||
emitter.on("map-filter-reset", (value) => {
|
emitter.on("map-filter-reset", (value) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
selectedAttRange.value = null;
|
selectedAttRange.value = null;
|
||||||
if (valueData.value && valueTypes.includes(selectedAttName.value.type)) {
|
if (valueData.value && valueTypes.has(selectedAttName.value.type)) {
|
||||||
const min = valueData.value.min;
|
const min = valueData.value.min;
|
||||||
const max = valueData.value.max;
|
const max = valueData.value.max;
|
||||||
startTime.value = new Date(min);
|
startTime.value = new Date(min);
|
||||||
|
|||||||
Reference in New Issue
Block a user