-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from charangirijala/filterpanel
Filters logic implemented 🚀
- Loading branch information
Showing
8 changed files
with
173 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
export default function filterData(filters, fileData) { | ||
//condtion check for active filters | ||
const activeFilters = filters.filter((filter) => filter.isActive); | ||
// console.log('filters: ', activeFilters, 'fileData: ', fileData); | ||
return fileData.filter((record) => { | ||
return activeFilters.every( | ||
({ field, operator, value, filterValues }) => { | ||
const fieldValue = record[field]; | ||
switch (operator) { | ||
case 'equals': | ||
if ( | ||
Array.isArray(filterValues) && | ||
filterValues.length > 0 | ||
) { | ||
return value.includes(fieldValue); | ||
} else { | ||
return fieldValue === value; | ||
} | ||
case 'notEqualTo': | ||
if ( | ||
Array.isArray(filterValues) && | ||
filterValues.length > 0 | ||
) { | ||
return !value.includes(fieldValue); | ||
} else { | ||
return fieldValue !== value; | ||
} | ||
case 'contains': | ||
return fieldValue.includes(value); | ||
default: | ||
return true; | ||
} | ||
} | ||
); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
.help-text-container { | ||
position: relative; | ||
display: inline-block; | ||
} | ||
|
||
.help-text-icon { | ||
border-radius: 50%; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
font-size: 14px; | ||
font-weight: bold; | ||
cursor: pointer; | ||
user-select: none; | ||
} | ||
|
||
/* Tooltip container */ | ||
.help-text-content { | ||
position: absolute; | ||
bottom: 100%; | ||
left: 50%; | ||
font-size: 0.75rem; | ||
color: white; | ||
transform: translateX(-50%); | ||
background-color: #032d60; | ||
border: none; | ||
border-radius: 5px; | ||
padding: 0.5rem 0.75rem; | ||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); | ||
white-space: normal; /* Allow wrapping */ | ||
width: 200px; | ||
max-width: 200px; /* Limit the width of the tooltip */ | ||
visibility: hidden; /* Initially hidden */ | ||
opacity: 0; /* Fully transparent */ | ||
transition: opacity 0.2s ease-in-out; | ||
z-index: 1000; | ||
overflow-wrap: anywhere; /* Prevent overflow for very long words */ | ||
text-align: left; | ||
} | ||
|
||
/* Show tooltip on hover */ | ||
.help-text-container:hover .help-text-content { | ||
visibility: visible; | ||
opacity: 1; /* Fully visible */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template> | ||
<div class="help-text-container"> | ||
<span | ||
class="help-text-icon" | ||
tabindex="0" | ||
role="tooltip" | ||
aria-label={content} | ||
> | ||
<svg | ||
focusable="false" | ||
data-key="info" | ||
aria-hidden="true" | ||
class="slds-button__icon" | ||
> | ||
<use | ||
xlink:href="/public/assets/icons/utility-sprite/svg/symbols.svg#info" | ||
></use> | ||
</svg> | ||
</span> | ||
<div class="help-text-content">{content}</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { LightningElement, api } from 'lwc'; | ||
|
||
export default class HelpText extends LightningElement { | ||
@api content; // Text for the help tooltip | ||
} |