bways-grid 0.0.18 → 0.0.19
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/fesm2022/bways-grid.mjs
CHANGED
|
@@ -1697,6 +1697,7 @@ class FilterToolPanelComponent {
|
|
|
1697
1697
|
_loadedFields = new Set();
|
|
1698
1698
|
showSaveModal = false;
|
|
1699
1699
|
reportNameInput = '';
|
|
1700
|
+
reportDescriptionInput = '';
|
|
1700
1701
|
constructor(cdr) {
|
|
1701
1702
|
this.cdr = cdr;
|
|
1702
1703
|
}
|
|
@@ -1963,13 +1964,74 @@ class FilterToolPanelComponent {
|
|
|
1963
1964
|
}
|
|
1964
1965
|
onSaveReportPrompt() {
|
|
1965
1966
|
this.reportNameInput = '';
|
|
1967
|
+
this.reportDescriptionInput = this.generateFilterDescription();
|
|
1966
1968
|
this.showSaveModal = true;
|
|
1967
1969
|
}
|
|
1970
|
+
generateFilterDescription() {
|
|
1971
|
+
const descriptions = [];
|
|
1972
|
+
for (const section of this.sections) {
|
|
1973
|
+
const colName = section.column.headerName || section.column.field;
|
|
1974
|
+
let colDesc = [];
|
|
1975
|
+
if (section.hasActiveFilter) {
|
|
1976
|
+
const selected = section.selectedValues;
|
|
1977
|
+
if (selected.size > 0 && selected.size < section.uniqueValues.length) {
|
|
1978
|
+
if (selected.size <= 3) {
|
|
1979
|
+
const vals = Array.from(selected).map(v => v === null || v === undefined || v === '' ? '(Blanks)' : String(v));
|
|
1980
|
+
colDesc.push(`Included values: ${vals.join(', ')}`);
|
|
1981
|
+
}
|
|
1982
|
+
else {
|
|
1983
|
+
colDesc.push(`${selected.size} values selected`);
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
if (section.hasConditionFilter) {
|
|
1988
|
+
const filter = this.conditionFilters.get(section.column.field);
|
|
1989
|
+
if (filter) {
|
|
1990
|
+
let condStr = this.formatCondition(filter.condition1.type, filter.condition1.value, filter.condition1.valueTo);
|
|
1991
|
+
if (filter.condition2 && filter.condition2.type) {
|
|
1992
|
+
const cond2Str = this.formatCondition(filter.condition2.type, filter.condition2.value, filter.condition2.valueTo);
|
|
1993
|
+
if (cond2Str) {
|
|
1994
|
+
condStr += ` ${filter.operator} ${cond2Str}`;
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
colDesc.push(`Condition: ${condStr}`);
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
if (colDesc.length > 0) {
|
|
2001
|
+
descriptions.push(`${colName} -> ${colDesc.join(' | ')}`);
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
if (descriptions.length === 0) {
|
|
2005
|
+
return '';
|
|
2006
|
+
}
|
|
2007
|
+
return `Filters applied:\n- ${descriptions.join('\n- ')}`;
|
|
2008
|
+
}
|
|
2009
|
+
formatCondition(type, val1, val2) {
|
|
2010
|
+
const v1 = val1 || '';
|
|
2011
|
+
const v2 = val2 || '';
|
|
2012
|
+
switch (type) {
|
|
2013
|
+
case 'contains': return `Contains "${v1}"`;
|
|
2014
|
+
case 'notContains': return `Does not contain "${v1}"`;
|
|
2015
|
+
case 'equals': return `Equals "${v1}"`;
|
|
2016
|
+
case 'notEqual': return `Not equal to "${v1}"`;
|
|
2017
|
+
case 'startsWith': return `Starts with "${v1}"`;
|
|
2018
|
+
case 'endsWith': return `Ends with "${v1}"`;
|
|
2019
|
+
case 'greaterThan': return `> ${v1}`;
|
|
2020
|
+
case 'greaterThanOrEqual': return `>= ${v1}`;
|
|
2021
|
+
case 'lessThan': return `< ${v1}`;
|
|
2022
|
+
case 'lessThanOrEqual': return `<= ${v1}`;
|
|
2023
|
+
case 'inRange': return `Between ${v1} and ${v2}`;
|
|
2024
|
+
case 'blank': return `Is Blank`;
|
|
2025
|
+
case 'notBlank': return `Is Not Blank`;
|
|
2026
|
+
default: return `"${v1}"`;
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
1968
2029
|
confirmSaveReport() {
|
|
1969
2030
|
if (!this.reportNameInput.trim())
|
|
1970
2031
|
return;
|
|
1971
2032
|
const reportObj = {
|
|
1972
2033
|
reportName: this.reportNameInput.trim(),
|
|
2034
|
+
description: this.reportDescriptionInput.trim(),
|
|
1973
2035
|
activeFilters: {},
|
|
1974
2036
|
conditionFilters: {}
|
|
1975
2037
|
};
|
|
@@ -2054,6 +2116,10 @@ class FilterToolPanelComponent {
|
|
|
2054
2116
|
<label class="ug-modal-label">Report Name</label>
|
|
2055
2117
|
<input type="text" class="ug-modal-input" placeholder="Enter report name..."
|
|
2056
2118
|
[(ngModel)]="reportNameInput" (keydown.enter)="confirmSaveReport()" autofocus />
|
|
2119
|
+
|
|
2120
|
+
<label class="ug-modal-label" style="margin-top: 15px;">Description</label>
|
|
2121
|
+
<textarea class="ug-modal-input" placeholder="Describe what this filter report is for..."
|
|
2122
|
+
[(ngModel)]="reportDescriptionInput" rows="3" style="resize: vertical;"></textarea>
|
|
2057
2123
|
</div>
|
|
2058
2124
|
<div class="ug-modal-footer">
|
|
2059
2125
|
<button class="ug-modal-btn ug-modal-btn-secondary" (click)="cancelSaveReport()">Cancel</button>
|
|
@@ -2201,6 +2267,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
|
|
|
2201
2267
|
<label class="ug-modal-label">Report Name</label>
|
|
2202
2268
|
<input type="text" class="ug-modal-input" placeholder="Enter report name..."
|
|
2203
2269
|
[(ngModel)]="reportNameInput" (keydown.enter)="confirmSaveReport()" autofocus />
|
|
2270
|
+
|
|
2271
|
+
<label class="ug-modal-label" style="margin-top: 15px;">Description</label>
|
|
2272
|
+
<textarea class="ug-modal-input" placeholder="Describe what this filter report is for..."
|
|
2273
|
+
[(ngModel)]="reportDescriptionInput" rows="3" style="resize: vertical;"></textarea>
|
|
2204
2274
|
</div>
|
|
2205
2275
|
<div class="ug-modal-footer">
|
|
2206
2276
|
<button class="ug-modal-btn ug-modal-btn-secondary" (click)="cancelSaveReport()">Cancel</button>
|