@processpuzzle/base-entity 1.1.0 → 1.2.0
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 +71 -0
- package/assets/i18n/base_entity/de.json +15 -0
- package/assets/i18n/base_entity/en.json +15 -0
- package/assets/i18n/base_entity/es.json +15 -0
- package/assets/i18n/base_entity/fr.json +15 -0
- package/assets/i18n/base_entity/hu.json +15 -0
- package/fesm2022/processpuzzle-base-entity.mjs +395 -9
- package/fesm2022/processpuzzle-base-entity.mjs.map +1 -1
- package/package.json +1 -1
- package/types/processpuzzle-base-entity.d.ts +132 -2
- package/types/processpuzzle-base-entity.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -21,6 +21,8 @@ the library generates these **Outputs:**
|
|
|
21
21
|
|
|
22
22
|
- A **Reactive Angular Form** built dynamically at run-time.
|
|
23
23
|
- An **Angular Material Table** built dynamically at run-time.
|
|
24
|
+
- A **descriptor-aware RSQL search** with an assisted advanced query editor (see [RSQL search](#rsql-search)).
|
|
25
|
+
- A **client-side PDF export** of the table, driven by the same descriptors (see [PDF export](#pdf-export)).
|
|
24
26
|
|
|
25
27
|
The diagram below shows the main classes the library exposes:
|
|
26
28
|
|
|
@@ -208,3 +210,72 @@ export class TestEntityFacade extends BaseEntityFacade<TestEntity> {
|
|
|
208
210
|
```
|
|
209
211
|
|
|
210
212
|
The facade can then be provided through the `ACTIVE_ENTITY_FACADE` token, and `BaseEntityContainerComponent` will resolve its descriptor automatically — no per-entity container component required.
|
|
213
|
+
|
|
214
|
+
## RSQL search
|
|
215
|
+
|
|
216
|
+
The list toolbar carries two independent search inputs:
|
|
217
|
+
|
|
218
|
+
- **Filter** — a client-side, case-insensitive substring match over the rows already loaded into the Material table. Instant, but limited to the current page of data.
|
|
219
|
+
- **Query** — a server-side [RSQL/FIQL](https://github.com/jirutka/rsql-parser) expression. On <kbd>Enter</kbd> (or the ▶ button) the toolbar calls `store.load({ query })`; the REST service forwards it to the backend as a `where=<rsql>` request parameter (`BaseEntityFirestoreService` applies the equivalent constraints). Clearing the query reloads the unfiltered list.
|
|
220
|
+
|
|
221
|
+
### Query syntax
|
|
222
|
+
|
|
223
|
+
RSQL combines comparisons with logical operators:
|
|
224
|
+
|
|
225
|
+
| Kind | Tokens |
|
|
226
|
+
|------|--------|
|
|
227
|
+
| Comparison | `==` `!=` `=gt=` `=ge=` `=lt=` `=le=` `=in=` `=out=` `=like=` |
|
|
228
|
+
| Logic | `;` (AND) `,` (OR) `( … )` (grouping) |
|
|
229
|
+
| Values | unquoted, `'single'`/`"double"` quoted, or a list `field=in=(a,b,c)` |
|
|
230
|
+
|
|
231
|
+
```text
|
|
232
|
+
status==active;createdAt=gt='2026-01-01'
|
|
233
|
+
name=like='*foo*',priority=ge=3
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Advanced editor
|
|
237
|
+
|
|
238
|
+
The **✎ (`edit_note`)** button in the query field opens the **advanced query editor** dialog — a CodeMirror-based editor (`RsqlEditorDialog` → `RsqlQueryEditorComponent`) that provides:
|
|
239
|
+
|
|
240
|
+
- **Syntax highlighting** and bracket matching for RSQL.
|
|
241
|
+
- **Autocomplete** of field names, the operators valid for each field's type, and enum values.
|
|
242
|
+
- **Live linting** — structural validation (paren balance, clause ordering, unterminated strings) plus semantic checks (unknown field, operator not allowed for the field's type). **Apply** stays disabled while the expression is invalid.
|
|
243
|
+
- A **sample query** inserted on <kbd>Tab</kbd> in an empty editor, plus a matching placeholder.
|
|
244
|
+
|
|
245
|
+
Both the autocomplete and the linter are driven by field metadata derived from the entity's descriptor by `DescriptorBackedFieldMetadataProvider`: each `BaseEntityAttrDescriptor` maps to an RSQL field whose type (and therefore its allowed operators) comes from the `FormControlType` — `CHECKBOX`→boolean, `DATE`→date, `DROPDOWN`/`RADIO`→enum (enum values taken from the attribute's selectables), a numeric/date `TEXT_BOX` input type→number/date, everything else→string. Presentation-only controls (`ARTIFACT`, `COMPONENTS`, `FLEX_BOX`, `LABEL`, `TITLE`) are excluded from the searchable fields.
|
|
246
|
+
|
|
247
|
+
To use the editor outside the entity toolbar, provide your own `RsqlFieldMetadataProvider` and bind `RsqlQueryEditorComponent` through a reactive `FormControl` (see `query-editor/example-usage.ts`).
|
|
248
|
+
|
|
249
|
+
## PDF export
|
|
250
|
+
|
|
251
|
+
The list toolbar can export the current entities to a PDF **entirely on the client** — no backend round-trip. When the list view is active and the store holds at least one entity, `BaseEntityToolbarComponent` shows a **PDF** action (the familiar `picture_as_pdf` icon). It appears both as a toolbar button and, on small screens, as a menu item.
|
|
252
|
+
|
|
253
|
+
Clicking it opens a small options dialog (orientation, page size, page-footer toggle) — deliberately not a full layout editor — and then generates and downloads the file.
|
|
254
|
+
|
|
255
|
+
What ends up in the PDF is derived from the very same descriptors that drive the table:
|
|
256
|
+
|
|
257
|
+
- **Columns** come from the entity's `BaseEntityAttrDescriptor`s, flattened through nested `FlexboxDescriptor`s. Any attribute marked `hideInTable = true` is dropped — so **a field hidden from the list is also absent from the PDF**.
|
|
258
|
+
- **Cell rendering** is chosen from each attribute's `FormControlType`: `CHECKBOX` becomes `✓`/`✗` (centered), `DATE` is formatted as a locale date, `TAGS` are joined, and `ARTIFACT` shows the artifact name.
|
|
259
|
+
- The document **title** uses the descriptor's `entityTitle` (falling back to `entityName`), with a record-count subtitle and page footers.
|
|
260
|
+
|
|
261
|
+
The heavy `jspdf` / `jspdf-autotable` dependencies are **lazy-loaded on first export**, so they never enter the initial bundle.
|
|
262
|
+
|
|
263
|
+
### Programmatic use
|
|
264
|
+
|
|
265
|
+
The export is also usable outside the toolbar. The public API exposes `PdfExportService`, the `entityDescriptorToPdfColumns` mapper, the `PdfExportOptionsDialog`, and the `PdfColumnDefinition` / `PdfExportOptions` / `PdfExportResult` types.
|
|
266
|
+
|
|
267
|
+
```typescript
|
|
268
|
+
private readonly pdfExport = inject(PdfExportService);
|
|
269
|
+
|
|
270
|
+
async export(descriptor: BaseEntityDescriptor, entities: BaseEntity[]) {
|
|
271
|
+
const columns = entityDescriptorToPdfColumns(descriptor.attrDescriptors);
|
|
272
|
+
const result = await this.pdfExport.export(entities as Record<string, unknown>[], columns, {
|
|
273
|
+
title: 'Test Entities',
|
|
274
|
+
filename: 'test-entity-export',
|
|
275
|
+
orientation: 'landscape',
|
|
276
|
+
});
|
|
277
|
+
// result: { success, filename, rowCount, error? }
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
Column headers, cell text, and dialog labels are translated through the `base_entity` Transloco scope (keys under `pdf_export`).
|
|
@@ -9,6 +9,21 @@
|
|
|
9
9
|
"query_label": "Abfrage",
|
|
10
10
|
"filter_label": "Filter"
|
|
11
11
|
},
|
|
12
|
+
"pdf_export": {
|
|
13
|
+
"button": "PDF",
|
|
14
|
+
"tooltip": "Liste als PDF exportieren",
|
|
15
|
+
"dialog_title": "PDF-Exportoptionen",
|
|
16
|
+
"orientation_label": "Ausrichtung",
|
|
17
|
+
"orientation_portrait": "Hochformat",
|
|
18
|
+
"orientation_landscape": "Querformat",
|
|
19
|
+
"page_size_label": "Seitengröße",
|
|
20
|
+
"include_footer_label": "Seitenfußzeile einfügen",
|
|
21
|
+
"cancel_button": "Abbrechen",
|
|
22
|
+
"export_button": "Exportieren",
|
|
23
|
+
"subtitle": "{{ count }} Datensätze",
|
|
24
|
+
"success": "{{ count }} Datensätze als PDF exportiert",
|
|
25
|
+
"failure": "PDF-Export fehlgeschlagen"
|
|
26
|
+
},
|
|
12
27
|
"rsql_editor_dialog": {
|
|
13
28
|
"title": "Erweiterter Abfrage-Editor",
|
|
14
29
|
"cancel_button": "Abbrechen",
|
|
@@ -9,6 +9,21 @@
|
|
|
9
9
|
"query_label": "Query",
|
|
10
10
|
"filter_label": "Filter"
|
|
11
11
|
},
|
|
12
|
+
"pdf_export": {
|
|
13
|
+
"button": "PDF",
|
|
14
|
+
"tooltip": "Export list to PDF",
|
|
15
|
+
"dialog_title": "PDF export options",
|
|
16
|
+
"orientation_label": "Orientation",
|
|
17
|
+
"orientation_portrait": "Portrait",
|
|
18
|
+
"orientation_landscape": "Landscape",
|
|
19
|
+
"page_size_label": "Page size",
|
|
20
|
+
"include_footer_label": "Include page footer",
|
|
21
|
+
"cancel_button": "Cancel",
|
|
22
|
+
"export_button": "Export",
|
|
23
|
+
"subtitle": "{{ count }} records",
|
|
24
|
+
"success": "Exported {{ count }} records to PDF",
|
|
25
|
+
"failure": "PDF export failed"
|
|
26
|
+
},
|
|
12
27
|
"rsql_editor_dialog": {
|
|
13
28
|
"title": "Advanced query editor",
|
|
14
29
|
"cancel_button": "Cancel",
|
|
@@ -9,6 +9,21 @@
|
|
|
9
9
|
"query_label": "Consulta",
|
|
10
10
|
"filter_label": "Filtro"
|
|
11
11
|
},
|
|
12
|
+
"pdf_export": {
|
|
13
|
+
"button": "PDF",
|
|
14
|
+
"tooltip": "Exportar lista a PDF",
|
|
15
|
+
"dialog_title": "Opciones de exportación PDF",
|
|
16
|
+
"orientation_label": "Orientación",
|
|
17
|
+
"orientation_portrait": "Vertical",
|
|
18
|
+
"orientation_landscape": "Horizontal",
|
|
19
|
+
"page_size_label": "Tamaño de página",
|
|
20
|
+
"include_footer_label": "Incluir pie de página",
|
|
21
|
+
"cancel_button": "Cancelar",
|
|
22
|
+
"export_button": "Exportar",
|
|
23
|
+
"subtitle": "{{ count }} registros",
|
|
24
|
+
"success": "{{ count }} registros exportados a PDF",
|
|
25
|
+
"failure": "Error al exportar el PDF"
|
|
26
|
+
},
|
|
12
27
|
"rsql_editor_dialog": {
|
|
13
28
|
"title": "Editor de consultas avanzado",
|
|
14
29
|
"cancel_button": "Cancelar",
|
|
@@ -9,6 +9,21 @@
|
|
|
9
9
|
"query_label": "Requête",
|
|
10
10
|
"filter_label": "Filtre"
|
|
11
11
|
},
|
|
12
|
+
"pdf_export": {
|
|
13
|
+
"button": "PDF",
|
|
14
|
+
"tooltip": "Exporter la liste en PDF",
|
|
15
|
+
"dialog_title": "Options d'export PDF",
|
|
16
|
+
"orientation_label": "Orientation",
|
|
17
|
+
"orientation_portrait": "Portrait",
|
|
18
|
+
"orientation_landscape": "Paysage",
|
|
19
|
+
"page_size_label": "Format de page",
|
|
20
|
+
"include_footer_label": "Inclure le pied de page",
|
|
21
|
+
"cancel_button": "Annuler",
|
|
22
|
+
"export_button": "Exporter",
|
|
23
|
+
"subtitle": "{{ count }} enregistrements",
|
|
24
|
+
"success": "{{ count }} enregistrements exportés en PDF",
|
|
25
|
+
"failure": "Échec de l'export PDF"
|
|
26
|
+
},
|
|
12
27
|
"rsql_editor_dialog": {
|
|
13
28
|
"title": "Éditeur de requêtes avancé",
|
|
14
29
|
"cancel_button": "Annuler",
|
|
@@ -9,6 +9,21 @@
|
|
|
9
9
|
"query_label": "Lekérdezés",
|
|
10
10
|
"filter_label": "Szűrő"
|
|
11
11
|
},
|
|
12
|
+
"pdf_export": {
|
|
13
|
+
"button": "PDF",
|
|
14
|
+
"tooltip": "Lista exportálása PDF-be",
|
|
15
|
+
"dialog_title": "PDF exportálási beállítások",
|
|
16
|
+
"orientation_label": "Tájolás",
|
|
17
|
+
"orientation_portrait": "Álló",
|
|
18
|
+
"orientation_landscape": "Fekvő",
|
|
19
|
+
"page_size_label": "Oldalméret",
|
|
20
|
+
"include_footer_label": "Lábléc megjelenítése",
|
|
21
|
+
"cancel_button": "Mégse",
|
|
22
|
+
"export_button": "Exportálás",
|
|
23
|
+
"subtitle": "{{ count }} rekord",
|
|
24
|
+
"success": "{{ count }} rekord exportálva PDF-be",
|
|
25
|
+
"failure": "A PDF exportálás sikertelen"
|
|
26
|
+
},
|
|
12
27
|
"rsql_editor_dialog": {
|
|
13
28
|
"title": "Speciális lekérdezés-szerkesztő",
|
|
14
29
|
"cancel_button": "Mégse",
|