ebta-workflow-prod 4.0.14 → 4.0.15
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/build/main.js +1 -1
- package/package.json +1 -1
- package/src/elements/AttributeFilter.tsx +43 -27
package/package.json
CHANGED
|
@@ -166,18 +166,34 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
|
|
|
166
166
|
// Iterate through each attribute in the 'attributes' object of the feature
|
|
167
167
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
168
168
|
for (const [key, value] of Object.entries(feature.attributes)) {
|
|
169
|
-
// Check if the attribute is in the short list
|
|
170
169
|
if (shortListOfAttributes.includes(key)) {
|
|
171
|
-
|
|
170
|
+
if (value === null || value === undefined) continue;
|
|
171
|
+
|
|
172
172
|
if (!attributeSummary[key]) {
|
|
173
173
|
attributeSummary[key] = {};
|
|
174
174
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
175
|
+
|
|
176
|
+
let valueKey: string;
|
|
177
|
+
const fieldType = props.fields.find(obj => obj.name == key)?.type;
|
|
178
|
+
|
|
179
|
+
if (fieldType === "date") {
|
|
180
|
+
const epoch = Number(value);
|
|
181
|
+
if (!epoch || epoch <= 0) continue;
|
|
182
|
+
valueKey = dayjs.unix(epoch / 1000).format("DD/MM/YYYY");
|
|
183
|
+
|
|
184
|
+
} else if (fieldType && ['integer', 'number', 'float', 'short', 'long', 'big integer'].includes(fieldType)) {
|
|
185
|
+
// Numeric: value passed null check above, but still guard NaN
|
|
186
|
+
const num = Number(value);
|
|
187
|
+
if (isNaN(num)) continue;
|
|
188
|
+
valueKey = String(value);
|
|
189
|
+
|
|
190
|
+
} else {
|
|
191
|
+
// String: reject known meaningless values
|
|
192
|
+
valueKey = String(value).trim();
|
|
193
|
+
const meaningless = ['', 'null', 'undefined', '{}', 'N/A', 'n/a', '<Null>', '<null>'];
|
|
194
|
+
if (meaningless.includes(valueKey)) continue;
|
|
178
195
|
}
|
|
179
|
-
|
|
180
|
-
else { valueKey = String(value); }
|
|
196
|
+
|
|
181
197
|
if (!attributeSummary[key][valueKey]) {
|
|
182
198
|
attributeSummary[key][valueKey] = 0;
|
|
183
199
|
}
|
|
@@ -213,10 +229,10 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
|
|
|
213
229
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
214
230
|
let result = props.fields.filter(obj => !attributeList || attributeList.length === 0 || attributeList.includes(obj.name)) // Filter only if nameList is valid
|
|
215
231
|
.filter(obj => {
|
|
216
|
-
if (RawOriginalData.length==0){return true}
|
|
232
|
+
if (RawOriginalData.length == 0) { return true }
|
|
217
233
|
let matchingRawDataValues = RawOriginalData.find(item => item.name === obj.name)?.uniqValue;
|
|
218
234
|
let meanless = ['{}', ' ', 'null']
|
|
219
|
-
return
|
|
235
|
+
return matchingRawDataValues !== undefined && matchingRawDataValues.length > 0 && !matchingRawDataValues.every((val) => meanless.includes(val.value))
|
|
220
236
|
})
|
|
221
237
|
.map(obj => {
|
|
222
238
|
let newObj: Attribute = { name: obj.name };
|
|
@@ -1211,7 +1227,7 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
|
|
|
1211
1227
|
limitInUse = (attribute.type == 'date' && (dayjs.unix(minDate.current).format('DD/MM/YYYY') != startDate.format('DD/MM/YYYY') || (dayjs.unix(maxDate.current).format('DD/MM/YYYY') != endDate.format('DD/MM/YYYY')))) || searchValue.length > 0 || (minValue !== -Infinity || maxValue !== Infinity)
|
|
1212
1228
|
}
|
|
1213
1229
|
if (attribute.uniqValue && attribute.uniqValue.length > 0) {
|
|
1214
|
-
|
|
1230
|
+
displayedValues = (attribute.uniqValue.length < defaultNumber + 2) || showAll ? attribute.uniqValue : attribute.uniqValue.slice(0, defaultNumber);
|
|
1215
1231
|
}
|
|
1216
1232
|
|
|
1217
1233
|
if (limitInUse && filteredValues.length > 0) {
|
|
@@ -1529,14 +1545,14 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
|
|
|
1529
1545
|
const matchedItems = attri.uniqValue?.filter(item =>
|
|
1530
1546
|
keywords.every(keyword => item.value.toLowerCase().includes(keyword))
|
|
1531
1547
|
);
|
|
1532
|
-
return sortItemsBySelection(matchedItems,attri.selection) || [];
|
|
1548
|
+
return sortItemsBySelection(matchedItems, attri.selection) || [];
|
|
1533
1549
|
}
|
|
1534
1550
|
|
|
1535
1551
|
function filterRange(attri: Attribute, min: number, max: number) {
|
|
1536
1552
|
const matchedItems = attri.uniqValue?.filter(item =>
|
|
1537
1553
|
Number(item.value) <= max && Number(item.value) >= min
|
|
1538
1554
|
);
|
|
1539
|
-
return sortItemsBySelection(matchedItems,attri.selection) || []
|
|
1555
|
+
return sortItemsBySelection(matchedItems, attri.selection) || []
|
|
1540
1556
|
}
|
|
1541
1557
|
|
|
1542
1558
|
const groupByMelbourneDate = (data: fieldValue[]) => {
|
|
@@ -1563,7 +1579,7 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
|
|
|
1563
1579
|
itemDate.isSame(start, 'day') || itemDate.isSame(end, 'day'); // Inclusive comparison
|
|
1564
1580
|
});
|
|
1565
1581
|
|
|
1566
|
-
return sortItemsBySelection(matchedItems,attri.selection);
|
|
1582
|
+
return sortItemsBySelection(matchedItems, attri.selection);
|
|
1567
1583
|
}
|
|
1568
1584
|
|
|
1569
1585
|
|
|
@@ -1574,7 +1590,7 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
|
|
|
1574
1590
|
const matchedItems = attri.uniqValue?.filter(item =>
|
|
1575
1591
|
keywords.every(keyword => item.value.toLowerCase().includes(keyword))
|
|
1576
1592
|
);
|
|
1577
|
-
return sortItemsBySelection(matchedItems,attri.selection) || [];
|
|
1593
|
+
return sortItemsBySelection(matchedItems, attri.selection) || [];
|
|
1578
1594
|
}
|
|
1579
1595
|
if (props.openedAttribute !== undefined && (openAttriTime.current) !== (props.openedAttribute.timestamp)) {
|
|
1580
1596
|
let newAttriData: fieldValue[] | undefined
|
|
@@ -1683,7 +1699,7 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
|
|
|
1683
1699
|
if (startDate == undefined) { setProperty("startDate" as any, defaultStart) }
|
|
1684
1700
|
if (endDate == undefined) { setProperty("endDate" as any, defaultEnd) }
|
|
1685
1701
|
if (filteredValues == undefined) { setProperty("filteredValues" as any, []) }
|
|
1686
|
-
if (sqlRule== undefined) {props.setProperty("sqlRule" as any, "AND") }
|
|
1702
|
+
if (sqlRule == undefined) { props.setProperty("sqlRule" as any, "AND") }
|
|
1687
1703
|
}, [defaultEnd, defaultStart, endDate, filteredValues, layerName, maxValue, minValue, props, rule, searchQuery, searchValue, setProperty, sqlRule, startDate, summary]);
|
|
1688
1704
|
|
|
1689
1705
|
React.useEffect(() => {
|
|
@@ -1754,18 +1770,18 @@ function AttributeFilter(props: AttributeFilterProps): React.ReactElement {
|
|
|
1754
1770
|
)}
|
|
1755
1771
|
</Search> : <></>}
|
|
1756
1772
|
{sqlRule && (
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1773
|
+
<RadioGroup
|
|
1774
|
+
//Radio Group
|
|
1775
|
+
row
|
|
1776
|
+
aria-labelledby="demo-row-radio-buttons-group-label"
|
|
1777
|
+
name="row-radio-buttons-group"
|
|
1778
|
+
value={sqlRule}
|
|
1779
|
+
onChange={handleSqlRule}
|
|
1780
|
+
>
|
|
1781
|
+
<FormControlLabel sx={{ fontSize: 15 }} value="AND" control={<Radio sx={{ color: 'var(--accentIconBorder) !important' }}
|
|
1782
|
+
/>} label={<span style={{ fontSize: '1.2rem' }}>Meet ALL Conditions</span>} />
|
|
1783
|
+
<FormControlLabel sx={{ fontSize: 15 }} value="OR" control={<Radio sx={{ color: 'var(--accentIconBorder) !important' }} />} label={<span style={{ fontSize: '1.2rem' }}>Meet ANY Conditon</span>} />
|
|
1784
|
+
</RadioGroup>
|
|
1769
1785
|
)}
|
|
1770
1786
|
{
|
|
1771
1787
|
props.footerButton ?
|