@devstroupe/devkit-cli 1.2.0-beta.4 → 1.2.0-beta.5
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.
|
@@ -93,6 +93,9 @@ function assertValidTypeScript(source) {
|
|
|
93
93
|
const select = (0, select_template_1.devkitSelectTemplate)();
|
|
94
94
|
strict_1.default.match(select.ts, /searchChange = new EventEmitter<string>/);
|
|
95
95
|
strict_1.default.match(select.ts, /setTimeout\(\(\) => this\.searchChange\.emit/);
|
|
96
|
+
strict_1.default.match(select.ts, /if \(this\.valuesEqual\(this\.value, val\)\)/);
|
|
97
|
+
strict_1.default.match(select.ts, /trackByValue/);
|
|
98
|
+
strict_1.default.match(select.html, /trackBy: trackByValue/);
|
|
96
99
|
strict_1.default.match(select.html, /Carregar mais/);
|
|
97
100
|
strict_1.default.match(select.html, /loadMore\.emit\(\)/);
|
|
98
101
|
assertValidTypeScript(select.ts);
|
|
@@ -67,11 +67,19 @@ export class DevkitSelectComponent implements ControlValueAccessor, OnDestroy {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
onValueChange(val: any): void {
|
|
70
|
+
if (this.valuesEqual(this.value, val)) {
|
|
71
|
+
this.onTouched();
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
70
74
|
this.value = val;
|
|
71
75
|
this.onChange(val);
|
|
72
76
|
this.onTouched();
|
|
73
77
|
}
|
|
74
78
|
|
|
79
|
+
trackByValue(_index: number, option: DevkitSelectOption): any {
|
|
80
|
+
return option.value;
|
|
81
|
+
}
|
|
82
|
+
|
|
75
83
|
onSearchInput(event: Event): void {
|
|
76
84
|
this.searchTerm = (event.target as HTMLInputElement).value;
|
|
77
85
|
if (this.searchTimer) clearTimeout(this.searchTimer);
|
|
@@ -93,6 +101,14 @@ export class DevkitSelectComponent implements ControlValueAccessor, OnDestroy {
|
|
|
93
101
|
const selected = this.options.find(opt => opt.value === value);
|
|
94
102
|
return selected ? selected.label : this.placeholder;
|
|
95
103
|
}
|
|
104
|
+
|
|
105
|
+
private valuesEqual(current: any, next: any): boolean {
|
|
106
|
+
if (Array.isArray(current) && Array.isArray(next)) {
|
|
107
|
+
return current.length === next.length
|
|
108
|
+
&& current.every((value, index) => Object.is(value, next[index]));
|
|
109
|
+
}
|
|
110
|
+
return Object.is(current, next);
|
|
111
|
+
}
|
|
96
112
|
}
|
|
97
113
|
`,
|
|
98
114
|
html: `<div class="flex w-full flex-col space-y-1.5">
|
|
@@ -115,7 +131,7 @@ export class DevkitSelectComponent implements ControlValueAccessor, OnDestroy {
|
|
|
115
131
|
<ng-container *ngTemplateOutlet="lookupSearch"></ng-container>
|
|
116
132
|
<hlm-select-group>
|
|
117
133
|
<hlm-select-item *ngIf="placeholder" [value]="null">{{ placeholder }}</hlm-select-item>
|
|
118
|
-
<hlm-select-item *ngFor="let opt of options" [value]="opt.value">{{ opt.label }}</hlm-select-item>
|
|
134
|
+
<hlm-select-item *ngFor="let opt of options; trackBy: trackByValue" [value]="opt.value">{{ opt.label }}</hlm-select-item>
|
|
119
135
|
</hlm-select-group>
|
|
120
136
|
<ng-container *ngTemplateOutlet="lookupFooter"></ng-container>
|
|
121
137
|
</hlm-select-content>
|
|
@@ -135,7 +151,7 @@ export class DevkitSelectComponent implements ControlValueAccessor, OnDestroy {
|
|
|
135
151
|
<hlm-select-content *hlmSelectPortal>
|
|
136
152
|
<ng-container *ngTemplateOutlet="lookupSearch"></ng-container>
|
|
137
153
|
<hlm-select-group>
|
|
138
|
-
<hlm-select-item *ngFor="let opt of options" [value]="opt.value">{{ opt.label }}</hlm-select-item>
|
|
154
|
+
<hlm-select-item *ngFor="let opt of options; trackBy: trackByValue" [value]="opt.value">{{ opt.label }}</hlm-select-item>
|
|
139
155
|
</hlm-select-group>
|
|
140
156
|
<ng-container *ngTemplateOutlet="lookupFooter"></ng-container>
|
|
141
157
|
</hlm-select-content>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devstroupe/devkit-cli",
|
|
3
|
-
"version": "1.2.0-beta.
|
|
3
|
+
"version": "1.2.0-beta.5",
|
|
4
4
|
"description": "DevsTroupe Development Kit CLI — scaffold NestJS+Angular projects, inject Spartan UI, generate CRUDs and audit architectural governance",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"commander": "^12.0.0",
|
|
38
38
|
"fs-extra": "^11.2.0",
|
|
39
|
-
"@devstroupe/devkit-core": "1.2.0-beta.
|
|
39
|
+
"@devstroupe/devkit-core": "1.2.0-beta.5"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/fs-extra": "^11.0.4",
|