ngx-column-filter-popup 1.0.0 → 1.0.1
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/README.md
CHANGED
|
@@ -2,8 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
A powerful, reusable Angular column filter component with support for multiple field types, advanced filtering rules, and customizable match modes.
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/ngx-column-filter-popup)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://github.com/kakarotx10/ngx-column-filter)
|
|
8
|
+
[](https://github.com/kakarotx10/ngx-column-filter)
|
|
9
|
+
|
|
10
|
+
## 🚀 Quick Links
|
|
11
|
+
|
|
12
|
+
- 📦 [NPM Package](https://www.npmjs.com/package/ngx-column-filter-popup)
|
|
13
|
+
- 🏠 [GitHub Repository](https://github.com/kakarotx10/ngx-column-filter)
|
|
14
|
+
- 📖 [Documentation](./DOCUMENTATION.md)
|
|
15
|
+
- 💡 [Usage Examples](./USAGE_EXAMPLES.md)
|
|
16
|
+
- 🐛 [Report Bug](https://github.com/kakarotx10/ngx-column-filter/issues)
|
|
17
|
+
- 💬 [Request Feature](https://github.com/kakarotx10/ngx-column-filter/issues)
|
|
7
18
|
|
|
8
19
|
## Features
|
|
9
20
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-column-filter-popup",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "A powerful, reusable Angular column filter component with support for multiple field types, advanced filtering rules, and customizable match modes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
24
|
-
"url": "git+https://github.com/
|
|
24
|
+
"url": "git+https://github.com/kakarotx10/ngx-column-filter.git"
|
|
25
25
|
},
|
|
26
26
|
"bugs": {
|
|
27
|
-
"url": "https://github.com/
|
|
27
|
+
"url": "https://github.com/kakarotx10/ngx-column-filter/issues"
|
|
28
28
|
},
|
|
29
|
-
"homepage": "https://github.com/
|
|
29
|
+
"homepage": "https://github.com/kakarotx10/ngx-column-filter#readme",
|
|
30
30
|
"main": "./src/app/lib/public-api.ts",
|
|
31
31
|
"types": "./src/app/lib/public-api.ts",
|
|
32
32
|
"files": [
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"start": "ng serve",
|
|
43
43
|
"build": "ng build",
|
|
44
44
|
"build:lib": "ng build --configuration production",
|
|
45
|
+
"build:gh-pages": "ng build --configuration production --base-href=/ngx-column-filter/",
|
|
45
46
|
"watch": "ng build --watch --configuration development",
|
|
46
47
|
"test": "ng test",
|
|
47
48
|
"publish:npm": "npm publish",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
class="dropdown-select"
|
|
43
43
|
[(ngModel)]="rule.matchType"
|
|
44
44
|
[attr.aria-label]="'Match type for rule ' + (i + 1)">
|
|
45
|
-
<option *ngFor="let type of matchTypes" [value]="type.value">
|
|
45
|
+
<option *ngFor="let type of matchTypes" [value]="type.value" [selected]="rule.matchType === type.value">
|
|
46
46
|
{{ type.label }}
|
|
47
47
|
</option>
|
|
48
48
|
</select>
|
|
@@ -187,6 +187,31 @@ export class ColumnFilterComponent implements OnInit, OnDestroy {
|
|
|
187
187
|
ngOnInit() {
|
|
188
188
|
if (this.initialFilter && this.initialFilter.rules && this.initialFilter.rules.length > 0) {
|
|
189
189
|
this.filterRules = [...this.initialFilter.rules];
|
|
190
|
+
// Validate match types for each rule
|
|
191
|
+
this.filterRules.forEach(rule => {
|
|
192
|
+
const availableTypes = this.matchTypes;
|
|
193
|
+
if (availableTypes.length > 0) {
|
|
194
|
+
const typeExists = availableTypes.some(type => type.value === rule.matchType);
|
|
195
|
+
if (!typeExists) {
|
|
196
|
+
rule.matchType = availableTypes[0].value as MatchType;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
} else {
|
|
201
|
+
// Ensure we have at least one rule with valid default match type
|
|
202
|
+
if (this.filterRules.length === 0) {
|
|
203
|
+
this.addRule();
|
|
204
|
+
} else {
|
|
205
|
+
// Validate existing rule's match type
|
|
206
|
+
const rule = this.filterRules[0];
|
|
207
|
+
const availableTypes = this.matchTypes;
|
|
208
|
+
if (availableTypes.length > 0) {
|
|
209
|
+
const typeExists = availableTypes.some(type => type.value === rule.matchType);
|
|
210
|
+
if (!typeExists) {
|
|
211
|
+
rule.matchType = availableTypes[0].value as MatchType;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
190
215
|
}
|
|
191
216
|
if (this.initialFilter?.globalMatchMode) {
|
|
192
217
|
this.globalMatchMode = this.initialFilter.globalMatchMode;
|
|
@@ -264,6 +289,16 @@ export class ColumnFilterComponent implements OnInit, OnDestroy {
|
|
|
264
289
|
defaultMatchType = 'is';
|
|
265
290
|
}
|
|
266
291
|
|
|
292
|
+
// Ensure default match type is valid from available match types
|
|
293
|
+
const availableTypes = this.matchTypes;
|
|
294
|
+
if (availableTypes.length > 0) {
|
|
295
|
+
// Check if default type exists in available types, otherwise use first one
|
|
296
|
+
const typeExists = availableTypes.some(type => type.value === defaultMatchType);
|
|
297
|
+
if (!typeExists) {
|
|
298
|
+
defaultMatchType = availableTypes[0].value as MatchType;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
267
302
|
this.filterRules.push({
|
|
268
303
|
id: this.generateId(),
|
|
269
304
|
matchType: defaultMatchType,
|