Skip to content

Commit e13869c

Browse files
committed
Move custom changes to schematic generation. Part 2
1 parent f26aa8b commit e13869c

File tree

5 files changed

+13
-30
lines changed

5 files changed

+13
-30
lines changed

libs/schematic/generators/ng-generate/components/shared/generators/components/command-bar/files/__name@dasherize__-command-bar.component.html.template

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<mat-toolbar data-test="toolbar" class="toolbar" #componentsContainer>
22
<div *ngIf="isMultipleSelectionEnabled" data-test="toolbar-number-of-items" class="command-bar-number-of-items">{{ selection.selected.length > 0 ? (selection.selected.length + ' / ') : '' }}{{ totalItems }}</div>
33
<% if (options.hasSearchBar) { %>
4-
<mat-form-field data-test="search-form-field-<%= options.componentType %>" *ngIf="!isInCollapsedMenu('search-form-field-<%= options.componentType %>')" appearance="fill" #toolbarComp>
5-
<mat-label data-test="search-label">{{ 'search' | transloco }}</mat-label>
4+
<mat-form-field class="search-input" data-test="search-form-field-<%= options.componentType %>" *ngIf="!isInCollapsedMenu('search-form-field-<%= options.componentType %>')" appearance="fill" #toolbarComp>
65
<input
76
#searchInput
87
data-test="search-input"
98
matInput
109
[formControl]="filterService.searchString"
1110
type="text"
11+
placeholder="{{ 'search' | transloco }}"
1212
(keyup.enter)="triggerReloadFilter()"
1313
(focus)="searchFocused = true"
1414
(blur)="searchFocused = false"/>
@@ -36,8 +36,7 @@
3636
<% if (options.componentType === 'table' && options.hasSearchBar) { %>
3737
<ng-container *ngIf="hasAdvancedSearch">
3838
<mat-form-field data-test="form-field-select" *ngIf="!isInCollapsedMenu('form-field-select')" appearance="fill" #toolbarComp>
39-
<mat-label data-test="select-label">{{ 'advancedSearch' | transloco }}</mat-label>
40-
<mat-select data-test="select" [formControl]="filterService.selectedStringColumn">
39+
<mat-select data-test="select" [formControl]="filterService.selectedStringColumn" placeholder="{{ 'advancedSearch' | transloco }}">
4140
<mat-option [value]="filterService.advancedSearchAllValue">{{ 'allTextFields' | transloco }}</mat-option>
4241
<mat-option *ngFor="let searchField of filterService.stringColumns" [value]="searchField">
4342
<span>{{ '<%= options.translationPath %>' + searchField + '.preferredName' | transloco }}</span>
@@ -243,8 +242,7 @@
243242
<% if (options.componentType === 'table' && options.hasSearchBar) { %>
244243
<ng-container *ngIf="hasAdvancedSearch">
245244
<mat-form-field data-test="form-field-select" id="form-field-select" *ngIf="!isInCollapsedMenu('form-field-select')" appearance="fill" #toolbarComp>
246-
<mat-label data-test="select-label">{{ 'advancedSearch' | transloco }}</mat-label>
247-
<mat-select data-test="select" [formControl]="filterService.selectedStringColumn">
245+
<mat-select data-test="select" [formControl]="filterService.selectedStringColumn" placeholder="{{ 'advancedSearch' | transloco }}">
248246
<mat-option [value]="filterService.advancedSearchAllValue">{{ 'allTextFields' | transloco }}</mat-option>
249247
<mat-option *ngFor="let searchField of filterService.stringColumns" [value]="searchField">
250248
<span>{{ '<%= options.translationPath %>' + searchField + '.preferredName' | transloco }}</span>
@@ -261,8 +259,7 @@
261259
<ng-container *ngIf="hasAdvancedSearch">
262260
<div mat-menu-item *ngIf="isInCollapsedMenu('form-field-select')">
263261
<mat-form-field data-test="form-field-select" id="form-field-select" appearance="fill">
264-
<mat-label data-test="select-label">{{ 'advancedSearch' | transloco }}</mat-label>
265-
<mat-select data-test="select" [formControl]="filterService.selectedStringColumn">
262+
<mat-select data-test="select" [formControl]="filterService.selectedStringColumn" placeholder="{{ 'advancedSearch' | transloco }}">
266263
<mat-option [value]="filterService.advancedSearchAllValue">{{ 'allTextFields' | transloco }}</mat-option>
267264
<mat-option *ngFor="let searchField of filterService.stringColumns" [value]="searchField">
268265
<span>{{ '<%= options.translationPath %>' + searchField + '.preferredName' | transloco }}</span>

libs/schematic/generators/ng-generate/components/shared/methods/remote-handling/requestData.ts.template

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ private requestData() {
4545

4646
if (this.customOptionsExtension) this.customOptionsExtension.apply(queryOption);
4747

48+
/*
4849
const additionalCondition = new Eq('local', <% if (options.chooseLanguageForSearch) { %>'<%= options.chooseLanguageForSearch.toUpperCase() %>'<% } else { %>'EN'<% } %>);
4950
queryFilter?.queryNode.subNodes.push(additionalCondition);
50-
51+
*/
5152
const filterRQLQuery = queryFilter ? QueryStringifier.stringify(queryFilter) : '';
5253
const optionsRQLQuery = QueryStringifier.stringify(queryOption).replace(/&/g, ',');
5354

@@ -60,24 +61,6 @@ private requestData() {
6061
rqlStringTemp = `${rqlStringTemp}${rqlStringTemp !== '' ? '&' : ''}option=${optionsRQLQuery}`;
6162
}
6263

63-
if (!(QueryStringifier as any)['superParseQueryNode']) {
64-
(QueryStringifier as any)['superParseQueryNode'] = QueryStringifier['parseQueryNode'];
65-
}
66-
67-
QueryStringifier['parseQueryNode'] = (node?: AbstractNode): string => {
68-
let result = (QueryStringifier as any)['superParseQueryNode'](node);
69-
if (node instanceof AbstractArrayNode) {
70-
const arrayNode = <AbstractArrayNode>node;
71-
const encodedValues = arrayNode.values.map(value => QueryStringifier['withType'](QueryStringifier['withEncoding'](value)));
72-
73-
// ensure outer brackets are not used. valid query ..in(<name>, "value1", "value2", ...)..
74-
result = `${QueryStringifier['withEncoding'](arrayNode.name, {isField: true})}(${QueryStringifier['withEncoding'](arrayNode.field, {
75-
isField: true,
76-
})}, ${encodedValues.join(',')})`;
77-
}
78-
return result;
79-
};
80-
8164
this.rqlString = rqlStringTemp;
8265

8366
if (this.requestSubscription && !this.requestSubscription.closed) {

libs/schematic/generators/ng-generate/components/table/generators/components/table/files/__name@dasherize__.component.ts.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ export class <%= classify(name) %>Component implements OnInit, AfterViewInit, Af
704704
this.highlightString = this.filterService.activeFilters
705705
.filter(({type, filterValue}) => type === FilterEnums.Search && !!filterValue)
706706
.map(filter => {
707-
return filter.filterValue;
707+
return filter.filterValue as string;
708708
});
709709
}
710710
}

libs/schematic/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
"peerDependencies": {
1313
"@angular/common": "^20.3.0",
1414
"@angular/core": "^20.3.0",
15+
"@angular/cdk": "^20.3.0",
1516
"@angular/forms": "^20.3.0",
1617
"@angular/material": "^20.2.0",
1718
"@jsverse/transloco": "^8.2.0",
18-
"@jsverse/transloco-locale": "^8.2.0"
19+
"@jsverse/transloco-locale": "^8.2.0",
20+
"rollun-ts-rql": "^0.10.0"
1921
},
2022
"sideEffects": false,
2123
"nx-migrations": {

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
"inquirer-search-list": "^1.2.6",
3434
"path": "^0.12.7",
3535
"rxjs": "~7.8.0",
36-
"zone.js": "~0.15.0"
36+
"zone.js": "~0.15.0",
37+
"rollun-ts-rql": "^0.10.0"
3738
},
3839
"devDependencies": {
3940
"@angular-devkit/build-angular": "~20.3.0",

0 commit comments

Comments
 (0)