@processpuzzle/base-entity 1.0.1 → 1.0.3
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/assets/i18n/base_entity/de.json +17 -0
- package/assets/i18n/base_entity/en.json +17 -0
- package/assets/i18n/base_entity/es.json +17 -0
- package/assets/i18n/base_entity/fr.json +17 -0
- package/assets/i18n/base_entity/hu.json +17 -0
- package/fesm2022/processpuzzle-base-entity.mjs +67 -32
- package/fesm2022/processpuzzle-base-entity.mjs.map +1 -1
- package/package.json +1 -1
- package/types/processpuzzle-base-entity.d.ts +14 -9
- package/types/processpuzzle-base-entity.d.ts.map +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"delete_artifact_confirmation_dialog": {
|
|
3
|
+
"title": "Artefakt löschen?",
|
|
4
|
+
"content": "Dadurch wird „{{ artifactName }}\" dauerhaft aus dem Objektspeicher gelöscht.",
|
|
5
|
+
"cancel_button": "Abbrechen",
|
|
6
|
+
"delete_button": "Löschen"
|
|
7
|
+
},
|
|
8
|
+
"toolbar": {
|
|
9
|
+
"query_label": "Abfrage",
|
|
10
|
+
"filter_label": "Filter"
|
|
11
|
+
},
|
|
12
|
+
"rsql_editor_dialog": {
|
|
13
|
+
"title": "Erweiterter Abfrage-Editor",
|
|
14
|
+
"cancel_button": "Abbrechen",
|
|
15
|
+
"apply_button": "Übernehmen"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"delete_artifact_confirmation_dialog": {
|
|
3
|
+
"title": "Delete artifact?",
|
|
4
|
+
"content": "This will permanently delete \"{{ artifactName }}\" from the object store.",
|
|
5
|
+
"cancel_button": "Cancel",
|
|
6
|
+
"delete_button": "Delete"
|
|
7
|
+
},
|
|
8
|
+
"toolbar": {
|
|
9
|
+
"query_label": "Query",
|
|
10
|
+
"filter_label": "Filter"
|
|
11
|
+
},
|
|
12
|
+
"rsql_editor_dialog": {
|
|
13
|
+
"title": "Advanced query editor",
|
|
14
|
+
"cancel_button": "Cancel",
|
|
15
|
+
"apply_button": "Apply"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"delete_artifact_confirmation_dialog": {
|
|
3
|
+
"title": "¿Eliminar artefacto?",
|
|
4
|
+
"content": "Esto eliminará permanentemente \"{{ artifactName }}\" del almacén de objetos.",
|
|
5
|
+
"cancel_button": "Cancelar",
|
|
6
|
+
"delete_button": "Eliminar"
|
|
7
|
+
},
|
|
8
|
+
"toolbar": {
|
|
9
|
+
"query_label": "Consulta",
|
|
10
|
+
"filter_label": "Filtro"
|
|
11
|
+
},
|
|
12
|
+
"rsql_editor_dialog": {
|
|
13
|
+
"title": "Editor de consultas avanzado",
|
|
14
|
+
"cancel_button": "Cancelar",
|
|
15
|
+
"apply_button": "Aplicar"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"delete_artifact_confirmation_dialog": {
|
|
3
|
+
"title": "Supprimer l'artefact ?",
|
|
4
|
+
"content": "Cela supprimera définitivement « {{ artifactName }} » du magasin d'objets.",
|
|
5
|
+
"cancel_button": "Annuler",
|
|
6
|
+
"delete_button": "Supprimer"
|
|
7
|
+
},
|
|
8
|
+
"toolbar": {
|
|
9
|
+
"query_label": "Requête",
|
|
10
|
+
"filter_label": "Filtre"
|
|
11
|
+
},
|
|
12
|
+
"rsql_editor_dialog": {
|
|
13
|
+
"title": "Éditeur de requêtes avancé",
|
|
14
|
+
"cancel_button": "Annuler",
|
|
15
|
+
"apply_button": "Appliquer"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"delete_artifact_confirmation_dialog": {
|
|
3
|
+
"title": "Elem törlése?",
|
|
4
|
+
"content": "Ez véglegesen törli a(z) „{{ artifactName }}\" elemet az objektumtárból.",
|
|
5
|
+
"cancel_button": "Mégse",
|
|
6
|
+
"delete_button": "Törlés"
|
|
7
|
+
},
|
|
8
|
+
"toolbar": {
|
|
9
|
+
"query_label": "Lekérdezés",
|
|
10
|
+
"filter_label": "Szűrő"
|
|
11
|
+
},
|
|
12
|
+
"rsql_editor_dialog": {
|
|
13
|
+
"title": "Speciális lekérdezés-szerkesztő",
|
|
14
|
+
"cancel_button": "Mégse",
|
|
15
|
+
"apply_button": "Alkalmaz"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Injectable, output, signal, forwardRef, ViewChild, Inject, Component, input,
|
|
2
|
+
import { inject, Injectable, output, signal, forwardRef, ViewChild, Inject, Component, input, computed, Injector, effect, InjectionToken, Directive, HostBinding, EventEmitter, Output, DestroyRef, untracked, runInInjectionContext, provideAppInitializer } from '@angular/core';
|
|
3
3
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
4
4
|
import * as i1$1 from '@angular/common';
|
|
5
5
|
import { CommonModule, NgClass, NgStyle, NgTemplateOutlet, SlicePipe } from '@angular/common';
|
|
@@ -1230,6 +1230,10 @@ class BaseEntityQueryComponent {
|
|
|
1230
1230
|
...(ngDevMode ? [{ debugName: "entityDescriptor" }] : /* istanbul ignore next */ []));
|
|
1231
1231
|
queryValue = signal('', /* @ts-ignore */
|
|
1232
1232
|
...(ngDevMode ? [{ debugName: "queryValue" }] : /* istanbul ignore next */ []));
|
|
1233
|
+
appliedQuery = signal(undefined, /* @ts-ignore */
|
|
1234
|
+
...(ngDevMode ? [{ debugName: "appliedQuery" }] : /* istanbul ignore next */ []));
|
|
1235
|
+
queryActive = computed(() => this.appliedQuery() !== undefined && this.queryValue() === this.appliedQuery(), /* @ts-ignore */
|
|
1236
|
+
...(ngDevMode ? [{ debugName: "queryActive" }] : /* istanbul ignore next */ []));
|
|
1233
1237
|
store;
|
|
1234
1238
|
dialog = inject(MatDialog);
|
|
1235
1239
|
parentInjector = inject(Injector);
|
|
@@ -1240,7 +1244,14 @@ class BaseEntityQueryComponent {
|
|
|
1240
1244
|
const value = this.queryValue().trim();
|
|
1241
1245
|
if (!value)
|
|
1242
1246
|
return;
|
|
1247
|
+
this.queryValue.set(value);
|
|
1243
1248
|
this.store.load({ query: value });
|
|
1249
|
+
this.appliedQuery.set(value);
|
|
1250
|
+
}
|
|
1251
|
+
onClearQuery() {
|
|
1252
|
+
this.queryValue.set('');
|
|
1253
|
+
this.appliedQuery.set(undefined);
|
|
1254
|
+
this.store.load({});
|
|
1244
1255
|
}
|
|
1245
1256
|
onOpenEditor() {
|
|
1246
1257
|
const data = { initialQuery: this.queryValue() };
|
|
@@ -1258,7 +1269,7 @@ class BaseEntityQueryComponent {
|
|
|
1258
1269
|
});
|
|
1259
1270
|
}
|
|
1260
1271
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: BaseEntityQueryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1261
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
1272
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: BaseEntityQueryComponent, isStandalone: true, selector: "base-entity-query", inputs: { entityDescriptor: { classPropertyName: "entityDescriptor", publicName: "entityDescriptor", isSignal: true, isRequired: true, transformFunction: null } }, providers: [provideTranslocoScope({ scope: 'base_entity', alias: 'base_entity' })], ngImport: i0, template: `
|
|
1262
1273
|
<ng-container *transloco="let t">
|
|
1263
1274
|
<div class="query-wrapper">
|
|
1264
1275
|
<label class="field-label" [attr.for]="entityDescriptor().createTestId('query-input')">{{ t('base_entity.toolbar.query_label') }}</label>
|
|
@@ -1274,9 +1285,15 @@ class BaseEntityQueryComponent {
|
|
|
1274
1285
|
<button [attr.data-testid]="entityDescriptor().createTestId('query-editor-open')" type="button" mat-icon-button matSuffix aria-label="Open advanced query editor" (click)="onOpenEditor()">
|
|
1275
1286
|
<mat-icon>edit_note</mat-icon>
|
|
1276
1287
|
</button>
|
|
1277
|
-
|
|
1278
|
-
<mat-icon
|
|
1279
|
-
|
|
1288
|
+
@if (queryActive()) {
|
|
1289
|
+
<button [attr.data-testid]="entityDescriptor().createTestId('query-clear')" type="button" mat-icon-button matSuffix aria-label="Clear query" (click)="onClearQuery()">
|
|
1290
|
+
<mat-icon>cancel</mat-icon>
|
|
1291
|
+
</button>
|
|
1292
|
+
} @else {
|
|
1293
|
+
<button [attr.data-testid]="entityDescriptor().createTestId('query-send')" type="button" mat-icon-button matSuffix aria-label="Send query" [disabled]="!queryValue()" (click)="onSendQuery()">
|
|
1294
|
+
<mat-icon>play_arrow</mat-icon>
|
|
1295
|
+
</button>
|
|
1296
|
+
}
|
|
1280
1297
|
</mat-form-field>
|
|
1281
1298
|
</div>
|
|
1282
1299
|
</ng-container>
|
|
@@ -1300,9 +1317,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
1300
1317
|
<button [attr.data-testid]="entityDescriptor().createTestId('query-editor-open')" type="button" mat-icon-button matSuffix aria-label="Open advanced query editor" (click)="onOpenEditor()">
|
|
1301
1318
|
<mat-icon>edit_note</mat-icon>
|
|
1302
1319
|
</button>
|
|
1303
|
-
|
|
1304
|
-
<mat-icon
|
|
1305
|
-
|
|
1320
|
+
@if (queryActive()) {
|
|
1321
|
+
<button [attr.data-testid]="entityDescriptor().createTestId('query-clear')" type="button" mat-icon-button matSuffix aria-label="Clear query" (click)="onClearQuery()">
|
|
1322
|
+
<mat-icon>cancel</mat-icon>
|
|
1323
|
+
</button>
|
|
1324
|
+
} @else {
|
|
1325
|
+
<button [attr.data-testid]="entityDescriptor().createTestId('query-send')" type="button" mat-icon-button matSuffix aria-label="Send query" [disabled]="!queryValue()" (click)="onSendQuery()">
|
|
1326
|
+
<mat-icon>play_arrow</mat-icon>
|
|
1327
|
+
</button>
|
|
1328
|
+
}
|
|
1306
1329
|
</mat-form-field>
|
|
1307
1330
|
</div>
|
|
1308
1331
|
</ng-container>
|
|
@@ -1763,12 +1786,15 @@ let BaseEntityRestService = class BaseEntityRestService {
|
|
|
1763
1786
|
if (httpResponse.status === 204 || this.isEmptyBody(httpResponse.body)) {
|
|
1764
1787
|
throw new Error('The query returned no content.');
|
|
1765
1788
|
}
|
|
1766
|
-
return
|
|
1789
|
+
return this.isPagedResponse(httpResponse.body) ? this.mapPagedResponse(httpResponse.body) : this.mapSimpleResponse(httpResponse.body);
|
|
1767
1790
|
}));
|
|
1768
1791
|
}
|
|
1769
1792
|
else
|
|
1770
1793
|
throw new Error('Could not determine the full url');
|
|
1771
1794
|
}
|
|
1795
|
+
isPagedResponse(body) {
|
|
1796
|
+
return body !== null && typeof body === 'object' && !Array.isArray(body) && Array.isArray(body.content);
|
|
1797
|
+
}
|
|
1772
1798
|
isEmptyBody(body) {
|
|
1773
1799
|
if (body == null)
|
|
1774
1800
|
return true;
|
|
@@ -1818,11 +1844,15 @@ let BaseEntityRestService = class BaseEntityRestService {
|
|
|
1818
1844
|
// region protected, private helper methods
|
|
1819
1845
|
buildFullUrl(resourceUri, queryCondition) {
|
|
1820
1846
|
const queryParams = new Map();
|
|
1821
|
-
if (queryCondition.page)
|
|
1847
|
+
if (queryCondition.page !== undefined)
|
|
1822
1848
|
queryParams.set('page', queryCondition.page.toString());
|
|
1849
|
+
if (queryCondition.pageSize !== undefined)
|
|
1850
|
+
queryParams.set('size', queryCondition.pageSize.toString());
|
|
1851
|
+
if (queryCondition.orderBys?.length)
|
|
1852
|
+
queryParams.set('order', this.buildOrder(queryCondition.orderBys));
|
|
1823
1853
|
const rsql = this.buildRsql(queryCondition);
|
|
1824
1854
|
if (rsql)
|
|
1825
|
-
queryParams.set('
|
|
1855
|
+
queryParams.set('where', rsql);
|
|
1826
1856
|
let params = {};
|
|
1827
1857
|
if (queryParams.size > 0) {
|
|
1828
1858
|
for (const [key, value] of queryParams) {
|
|
@@ -1853,16 +1883,17 @@ let BaseEntityRestService = class BaseEntityRestService {
|
|
|
1853
1883
|
return toRsql(queryCondition.filters);
|
|
1854
1884
|
return undefined;
|
|
1855
1885
|
}
|
|
1886
|
+
buildOrder(orderBys) {
|
|
1887
|
+
return orderBys.map((o) => `${o.property},${o.direction}`).join(',');
|
|
1888
|
+
}
|
|
1856
1889
|
mapPagedResponse(response) {
|
|
1857
|
-
const
|
|
1858
|
-
const
|
|
1859
|
-
const content = subjectPage.content.map((dto, index) => {
|
|
1860
|
-
return this.mapEntityResponse(dto, index);
|
|
1861
|
-
});
|
|
1890
|
+
const page = response;
|
|
1891
|
+
const content = page.content.map((dto, index) => this.mapEntityResponse(dto, index));
|
|
1862
1892
|
return {
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1893
|
+
number: page.number,
|
|
1894
|
+
size: page.size,
|
|
1895
|
+
totalElements: page.totalElements,
|
|
1896
|
+
totalPages: page.totalPages,
|
|
1866
1897
|
content,
|
|
1867
1898
|
};
|
|
1868
1899
|
}
|
|
@@ -3688,9 +3719,10 @@ let BaseEntityFirestoreService = class BaseEntityFirestoreService {
|
|
|
3688
3719
|
const results = await getDocs(builtQuery);
|
|
3689
3720
|
const content = results.docs.map((docSnapshot) => this.mapDocument({ id: docSnapshot.id, ...docSnapshot.data() }));
|
|
3690
3721
|
return {
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3722
|
+
number: queryCondition.page,
|
|
3723
|
+
size: queryCondition.pageSize,
|
|
3724
|
+
totalElements: content.length,
|
|
3725
|
+
totalPages: 1,
|
|
3694
3726
|
content,
|
|
3695
3727
|
};
|
|
3696
3728
|
}
|
|
@@ -3788,7 +3820,7 @@ const updateEntity = (store, repository) => {
|
|
|
3788
3820
|
};
|
|
3789
3821
|
|
|
3790
3822
|
const findByQuery = (store, repository) => {
|
|
3791
|
-
return rxMethod(pipe(tap((query) => patchState(store, {
|
|
3823
|
+
return rxMethod(pipe(tap((query) => patchState(store, { number: query.page, isLoading: true, error: undefined })),
|
|
3792
3824
|
// debounceTime(1000),
|
|
3793
3825
|
// distinctUntilChanged(),
|
|
3794
3826
|
switchMap((parameters) => repository.findByQuery(parameters).pipe(tapResponse({
|
|
@@ -3797,9 +3829,10 @@ const findByQuery = (store, repository) => {
|
|
|
3797
3829
|
const baseEntityResponse = response;
|
|
3798
3830
|
patchState(store, {
|
|
3799
3831
|
entities: baseEntityResponse.content,
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3832
|
+
number: baseEntityResponse.number,
|
|
3833
|
+
size: baseEntityResponse.size,
|
|
3834
|
+
totalElements: baseEntityResponse.totalElements,
|
|
3835
|
+
totalPages: baseEntityResponse.totalPages,
|
|
3803
3836
|
isLoading: false,
|
|
3804
3837
|
});
|
|
3805
3838
|
}
|
|
@@ -3807,9 +3840,10 @@ const findByQuery = (store, repository) => {
|
|
|
3807
3840
|
const entities = response.slice();
|
|
3808
3841
|
patchState(store, {
|
|
3809
3842
|
entities,
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3843
|
+
number: undefined,
|
|
3844
|
+
size: entities.length,
|
|
3845
|
+
totalElements: entities.length,
|
|
3846
|
+
totalPages: undefined,
|
|
3813
3847
|
isLoading: false,
|
|
3814
3848
|
});
|
|
3815
3849
|
}
|
|
@@ -3823,9 +3857,10 @@ const BASE_ENTITY_STORE = new InjectionToken('BASE_ENTITY_STORE');
|
|
|
3823
3857
|
function BaseEntityStore(entityType, getRepository) {
|
|
3824
3858
|
return signalStoreFeature(withState({
|
|
3825
3859
|
entities: [],
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3860
|
+
number: 0,
|
|
3861
|
+
size: 5,
|
|
3862
|
+
totalElements: 0,
|
|
3863
|
+
totalPages: 0,
|
|
3829
3864
|
currentEntity: undefined,
|
|
3830
3865
|
currentId: undefined,
|
|
3831
3866
|
isLoading: false,
|