@annalib/anna-core 31.0.1 → 31.0.2
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/esm2022/lib/anna-core-shared-lib/services/anna-filter.service.mjs +16 -3
- package/esm2022/lib/anna-generic-table-lib/components/anna-non-editable-generic-table/anna-non-editable-generic-table.component.mjs +2 -63
- package/fesm2022/annalib-anna-core.mjs +15 -63
- package/fesm2022/annalib-anna-core.mjs.map +1 -1
- package/lib/anna-core-shared-lib/services/anna-date-time-format.service.d.ts +2 -2
- package/lib/anna-core-shared-lib/services/anna-filter.service.d.ts +2 -0
- package/lib/anna-generic-table-lib/components/anna-non-editable-generic-table/anna-non-editable-generic-table.component.d.ts +0 -2
- package/package.json +1 -1
|
@@ -1769,6 +1769,8 @@ class AnnaFilterService {
|
|
|
1769
1769
|
"userMG",
|
|
1770
1770
|
"udValue",
|
|
1771
1771
|
"odValue",
|
|
1772
|
+
"buyerBookedValue",
|
|
1773
|
+
"trafficBookedValue",
|
|
1772
1774
|
]);
|
|
1773
1775
|
this.isFilterSortActive = {};
|
|
1774
1776
|
this.resetFilterSortActiveStatus = true;
|
|
@@ -2165,7 +2167,7 @@ class AnnaFilterService {
|
|
|
2165
2167
|
// eslint-disable-next-line no-param-reassign
|
|
2166
2168
|
key = key.split(this.SPLITED_CHECKBOX_FILTER_KEY)[0];
|
|
2167
2169
|
}
|
|
2168
|
-
if (key !== keyToSkip && originalData.length > 0 &&
|
|
2170
|
+
if (key !== keyToSkip && originalData.length > 0 && this.nestedKeyExists(originalData[0], key)) {
|
|
2169
2171
|
if (this.sliderSet.has(key)) {
|
|
2170
2172
|
filteredData = filteredData.filter((obj) => obj[key] >= value.min && obj[key] <= value.max);
|
|
2171
2173
|
}
|
|
@@ -2208,12 +2210,23 @@ class AnnaFilterService {
|
|
|
2208
2210
|
filteredData = filteredData.filter((obj) => this.returnDataForStartAndEndTimeRange(obj, value, key));
|
|
2209
2211
|
}
|
|
2210
2212
|
else if (value.length > 0) {
|
|
2211
|
-
filteredData = filteredData.filter((u) => filterSplitedValues ? value.find((val) => u[key].includes(val)) : value.includes(u
|
|
2213
|
+
filteredData = filteredData.filter((u) => filterSplitedValues ? value.find((val) => u[key].includes(val)) : value.includes(this.getValueFromObject(u, key)));
|
|
2212
2214
|
}
|
|
2213
2215
|
}
|
|
2214
2216
|
});
|
|
2215
2217
|
return filteredData;
|
|
2216
2218
|
}
|
|
2219
|
+
getValueFromObject(obj, key) {
|
|
2220
|
+
return key.split(".").reduce((res, currentKey) => res && res[currentKey], obj);
|
|
2221
|
+
}
|
|
2222
|
+
nestedKeyExists(obj, key) {
|
|
2223
|
+
return (key.split(".").reduce((acc, currentKey) => {
|
|
2224
|
+
if (acc && currentKey in acc) {
|
|
2225
|
+
return acc[currentKey];
|
|
2226
|
+
}
|
|
2227
|
+
return undefined;
|
|
2228
|
+
}, obj) !== undefined);
|
|
2229
|
+
}
|
|
2217
2230
|
returnOrdersInTheRange(order, range, key) {
|
|
2218
2231
|
const isDateBetweenTheSelectedRange = dayjs(order[key]).isBetween(range.minSelectedDate, range.maxSelectedDate);
|
|
2219
2232
|
const isDateSameAsTheMinSelectedDate = dayjs(order[key]).isSame(range.minSelectedDate);
|
|
@@ -4911,34 +4924,6 @@ class AnnaNonEditableGenericTableComponent {
|
|
|
4911
4924
|
this.bindValueFuncCalled = false;
|
|
4912
4925
|
}
|
|
4913
4926
|
}
|
|
4914
|
-
checkIfUniqueValuePresentForTheHeader(header, enabledHeaders) {
|
|
4915
|
-
header.filterSortObjectKeys.forEach((item) => {
|
|
4916
|
-
const dataToCheck = this.annaFilterService.getFilterOptionsData(this.tableData, this.clonedTableData, item);
|
|
4917
|
-
if (item === "period") {
|
|
4918
|
-
const uniqStartDate = uniq(dataToCheck.map((u) => u.startDate));
|
|
4919
|
-
const uniqEndDate = uniq(dataToCheck.map((u) => u.endDate));
|
|
4920
|
-
if (uniqStartDate.length > 1 || uniqEndDate.length > 1 || this.isTooltipActive([item])) {
|
|
4921
|
-
enabledHeaders.push(item);
|
|
4922
|
-
}
|
|
4923
|
-
}
|
|
4924
|
-
else {
|
|
4925
|
-
const values = dataToCheck.map((u) => u[item]);
|
|
4926
|
-
// if last applied filter is this header, push it alos as enabledHeader
|
|
4927
|
-
let activeAndLastlyAppliedHeader = false;
|
|
4928
|
-
if (this.annaFilterService.appliedFiltersArray.length > 0 &&
|
|
4929
|
-
this.annaFilterService.appliedFiltersArray[this.annaFilterService.appliedFiltersArray.length - 1] === item) {
|
|
4930
|
-
activeAndLastlyAppliedHeader = true;
|
|
4931
|
-
}
|
|
4932
|
-
if (header.filter === "CHECKBOX" && (uniq(values).length > 1 || activeAndLastlyAppliedHeader)) {
|
|
4933
|
-
enabledHeaders.push(item);
|
|
4934
|
-
}
|
|
4935
|
-
else if (header.filter !== "CHECKBOX" &&
|
|
4936
|
-
(uniq(values).filter((n) => n != null && n !== "-").length > 1 || activeAndLastlyAppliedHeader)) {
|
|
4937
|
-
enabledHeaders.push(item);
|
|
4938
|
-
}
|
|
4939
|
-
}
|
|
4940
|
-
});
|
|
4941
|
-
}
|
|
4942
4927
|
openTooltip(tooltip, header, columnHeader) {
|
|
4943
4928
|
this.closeTooltip();
|
|
4944
4929
|
this.tooltip = tooltip;
|
|
@@ -4951,39 +4936,6 @@ class AnnaNonEditableGenericTableComponent {
|
|
|
4951
4936
|
columnHeader?.splitDelimiter?.[index]);
|
|
4952
4937
|
});
|
|
4953
4938
|
}
|
|
4954
|
-
disableEnableEachColumnTooltipIcon() {
|
|
4955
|
-
this.tableHeaders.forEach((header) => {
|
|
4956
|
-
header.headerInfo.forEach((item) => {
|
|
4957
|
-
if (item.showTooltipIcon) {
|
|
4958
|
-
let values = [];
|
|
4959
|
-
item.disableTooltipIcon = true;
|
|
4960
|
-
item.filterSortObjectKeys.forEach((key) => {
|
|
4961
|
-
const latestFilters = this.annaFilterService.appliedFiltersArray;
|
|
4962
|
-
if (latestFilters.length > 0 &&
|
|
4963
|
-
item.disableTooltipIcon &&
|
|
4964
|
-
latestFilters[latestFilters.length - 1] === key) {
|
|
4965
|
-
item.disableTooltipIcon = false;
|
|
4966
|
-
}
|
|
4967
|
-
if (item.disableTooltipIcon) {
|
|
4968
|
-
if (key === "period") {
|
|
4969
|
-
const uniqStartDate = uniq(this.tableData.map((u) => u.startDate));
|
|
4970
|
-
const uniqEndDate = uniq(this.tableData.map((u) => u.endDate));
|
|
4971
|
-
item.disableTooltipIcon = !(uniqStartDate.length > 1 || uniqEndDate.length > 1);
|
|
4972
|
-
}
|
|
4973
|
-
else {
|
|
4974
|
-
values = this.tableData.map((u) => u[key]);
|
|
4975
|
-
if ((item.filter === "CHECKBOX" && uniq(values).length > 1) ||
|
|
4976
|
-
(item.filter !== "CHECKBOX" &&
|
|
4977
|
-
uniq(values).filter((n) => n != null && n !== "-").length > 1)) {
|
|
4978
|
-
item.disableTooltipIcon = false;
|
|
4979
|
-
}
|
|
4980
|
-
}
|
|
4981
|
-
}
|
|
4982
|
-
});
|
|
4983
|
-
}
|
|
4984
|
-
});
|
|
4985
|
-
});
|
|
4986
|
-
}
|
|
4987
4939
|
dataRowClicked(rowData) {
|
|
4988
4940
|
this.rowClicked.emit(rowData);
|
|
4989
4941
|
}
|