@praxisui/list 1.0.0-beta.5 → 1.0.0-beta.52

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
@@ -1,5 +1,52 @@
1
+ ---
2
+ title: "List"
3
+ slug: "list-overview"
4
+ description: "Visao geral do @praxisui/list com variantes de lista e cards, slots declarativos, acoes, agrupamento e selecao."
5
+ doc_type: "reference"
6
+ document_kind: "component-overview"
7
+ component: "list"
8
+ category: "components"
9
+ audience:
10
+ - "frontend"
11
+ - "host"
12
+ - "architect"
13
+ level: "intermediate"
14
+ status: "active"
15
+ owner: "praxis-ui"
16
+ tags:
17
+ - "list"
18
+ - "cards"
19
+ - "slots"
20
+ - "selection"
21
+ - "actions"
22
+ order: 40
23
+ icon: "view_list"
24
+ toc: true
25
+ sidebar: true
26
+ search_boost: 1.0
27
+ reading_time: 10
28
+ estimated_setup_time: 15
29
+ version: "1.0"
30
+ related_docs:
31
+ - "host-integration-guide"
32
+ - "consumer-integration-quickstart"
33
+ keywords:
34
+ - "cards"
35
+ - "grouping"
36
+ - "selection"
37
+ - "templating"
38
+ last_updated: "2026-03-07"
39
+ ---
40
+
1
41
  # @praxisui/list — Configurable List/Cards Component
2
42
 
43
+ ## 🔰 Exemplos / Quickstart
44
+
45
+ Para ver esta biblioteca em funcionamento em uma aplicação completa, utilize o projeto de exemplo (Quickstart):
46
+
47
+ - Repositório: https://github.com/codexrodrigues/praxis-ui-quickstart
48
+ - O Quickstart demonstra a integração das bibliotecas `@praxisui/*` em um app Angular, incluindo instalação, configuração e uso em telas reais.
49
+
3
50
  Angular list/cards component for enterprise apps. Supports local or remote data, multiple layout variants, templating slots, actions, grouping and selection.
4
51
 
5
52
  ## Install
@@ -13,6 +60,7 @@ Peers (install in your app):
13
60
  - `rxjs` (>=7 <9)
14
61
  - `@praxisui/core` (icons, config storage, CRUD service)
15
62
  - Optional: `@praxisui/settings-panel` (to open the in-app list configuration editor)
63
+ - Optional: `@praxisui/dynamic-fields` (color picker used by the in-app editor)
16
64
 
17
65
  ## Quick Start
18
66
 
@@ -26,6 +74,7 @@ import { PraxisList } from '@praxisui/list';
26
74
  imports: [PraxisList],
27
75
  template: `
28
76
  <praxis-list
77
+ listId="products-list"
29
78
  [config]="config"
30
79
  (itemClick)="onItem($event)"
31
80
  (actionClick)="onAction($event)"
@@ -64,12 +113,85 @@ export class ListDemoComponent {
64
113
  }
65
114
  ```
66
115
 
116
+ ## Runtime Contract (Data Mode and Precedence)
117
+
118
+ Effective data mode resolution follows `ListDataService.stream()`:
119
+
120
+ 1. if `dataSource.data` exists, local mode is used;
121
+ 2. else if `dataSource.resourcePath` exists and `GenericCrudService` is available, remote mode is used;
122
+ 3. otherwise, empty mode is used.
123
+
124
+ Critical rule:
125
+ - local data has precedence over remote when both `dataSource.data` and `dataSource.resourcePath` are present.
126
+
127
+ Decision matrix (runtime today):
128
+
129
+ | `dataSource.data` | `dataSource.resourcePath` | Resolved mode | Data pipeline | Main surface |
130
+ | --- | --- | --- | --- | --- |
131
+ | array | any value | local | local array only | list/cards/tiles |
132
+ | missing/null | filled | remote | `/filter` with fallback `getAll()` on failure | list/cards/tiles + remote controls |
133
+ | missing/null | missing/empty | empty | none | empty state |
134
+
135
+ Important behavior:
136
+ - pagination/search/sort controls from `ui.*` are rendered only when `dataSource.resourcePath` is defined.
137
+ - remote mode uses `GenericCrudService.filter(query, pageable)` and falls back to `getAll()` when `/filter` fails.
138
+
139
+ ## Runtime Status Matrix (High-Impact Paths)
140
+
141
+ | JSON path | Runtime status | Notes |
142
+ | --- | --- | --- |
143
+ | `dataSource.data` | Active | Local mode source. |
144
+ | `dataSource.resourcePath` | Active | Remote mode source. |
145
+ | `layout.virtualScroll` | Declared-only | Accepted in config/editor but no runtime binding yet. |
146
+ | `layout.stickySectionHeader` | Declared-only | Accepted in config/editor but no runtime sticky behavior yet. |
147
+ | `actions[].emitPayload` | Declared-only | Authoring field only; `actionClick` payload shape is fixed. |
148
+ | `events.*` | Declared-only | Declarative mapping only; no dynamic event router in runtime. |
149
+ | `a11y.highContrast` / `a11y.reduceMotion` | Declared-only | No visual/runtime enforcement yet. |
150
+
151
+ ## Pagina de documentacao viva (showcase completo)
152
+
153
+ Para documentar o componente com exemplos live (layout, templating, selecao, acoes, skins e snippets),
154
+ use o componente `praxis-list-doc-page`:
155
+
156
+ ```html
157
+ <praxis-list-doc-page></praxis-list-doc-page>
158
+ ```
159
+
160
+ ```ts
161
+ import { Component } from '@angular/core';
162
+ import { PraxisListDocPageComponent } from '@praxisui/list';
163
+
164
+ @Component({
165
+ selector: 'app-list-doc-host',
166
+ standalone: true,
167
+ imports: [PraxisListDocPageComponent],
168
+ template: `<praxis-list-doc-page />`,
169
+ })
170
+ export class ListDocHostComponent {}
171
+ ```
172
+
173
+ Cobertura da pagina:
174
+ - Variantes `list`, `cards`, `tiles`.
175
+ - `density`, `lines`, `model`, `groupBy`, `dividers`.
176
+ - Slots `leading`, `primary`, `secondary`, `meta`, `trailing`, `sectionHeader`, `emptyState`.
177
+ - Tipos de template `text`, `icon`, `image`, `chip`, `rating`, `currency`, `date`, `html`.
178
+ - Selecao (`none`, `single`, `multiple`) com `FormControl` externo.
179
+ - Acoes com `showIf`, estilos `icon/button` e log de eventos.
180
+ - Skins `elevated`, `pill-soft`, `glass`, `gradient-tile`, `custom`.
181
+ - Snippets para host, config JSON e contrato remoto com `resourcePath`.
182
+
183
+ ## Persistência
184
+
185
+ - `listId` é obrigatório para salvar/carregar configurações.
186
+ - A chave usada no storage é `praxis-list-config-<component_id>` (via `ComponentKeyService`).
187
+ - Use `componentInstanceId` quando houver múltiplas listas com o mesmo `listId` na mesma rota.
188
+
67
189
  ## Remote Data (resourcePath)
68
190
 
69
191
  Provide `dataSource.resourcePath` to fetch data and (optionally) infer templating from backend schema.
70
192
 
71
193
  ```html
72
- <praxis-list [config]="{
194
+ <praxis-list listId="employees" [config]="{
73
195
  id: 'employees',
74
196
  dataSource: { resourcePath: 'employees', sort: ['name,asc'] },
75
197
  layout: { variant: 'list', lines: 2, groupBy: 'department' },
@@ -83,25 +205,51 @@ The component uses `GenericCrudService` from `@praxisui/core` when `resourcePath
83
205
 
84
206
  - `list` (default): Material list with optional selection and dividers.
85
207
  - `cards`: Card grid layout with the same templating slots.
208
+ - `tiles`: Modern grid layout (image + title + meta), ideal for catalogs.
86
209
 
87
210
  Layout options (`config.layout`):
88
211
  - `lines`: 1 | 2 | 3 controls visible text lines.
89
212
  - `dividers`: 'none' | 'between' | 'all'.
90
213
  - `groupBy`: string key to group items; section headers can be templated via `templating.sectionHeader`.
91
- - `pageSize`, `virtualScroll`, `density`, `model` for advanced tuning.
214
+ - `pageSize`, `density`, `model` are runtime-active.
215
+ - `virtualScroll` and `stickySectionHeader` are currently declared-only (no runtime binding yet).
216
+
217
+ ## Config Merging Behavior
218
+ Be aware that `applyConfigFromAdapter` replaces the entire `config` object. It does not perform a deep merge. Any local runtime overrides must be re-applied or managed carefully.
92
219
 
93
220
  ## Templating Slots
94
221
 
95
222
  Every slot accepts a `TemplateDef` with `type`, `expr`, optional `class` and `style`.
96
- - `leading`: 'icon' | 'image' with optional `badge`.
97
- - `primary`: 'text' | 'html' | 'date' | 'currency' | 'rating' | 'chip'.
223
+ - `leading`: 'icon' | 'image' | 'text' | 'chip' | 'rating' | 'html' with optional `badge`.
224
+ - `primary`: 'text' | 'html' | 'date' | 'currency'.
98
225
  - `secondary`: same as primary; shown when `lines > 1`.
99
- - `meta`: small text or chip/rating rendered inline or on the side (`metaPlacement`).
100
- - `trailing`: optional trailing text/chip.
226
+ - `meta`: small text or chip/rating/icon/image rendered inline or on the side (`metaPlacement`).
227
+ - `trailing`: optional trailing text/chip/icon/image.
101
228
  - `features`: array of `{ icon?, expr }` rendered below primary/secondary; control with `featuresVisible` and `featuresMode` ('icons+labels' | 'icons-only' | 'labels-only').
102
229
 
103
230
  Expressions use `${...}` to read from `item` (e.g., `${item.name}`). For `currency`, you may pass code/locale as `|:USD` or `|:USD:en-US`.
104
231
 
232
+ ### Rating props
233
+
234
+ ```json
235
+ {
236
+ "templating": {
237
+ "meta": {
238
+ "type": "rating",
239
+ "expr": "${item.rating}",
240
+ "props": { "rating": { "max": 5, "size": 16, "color": "primary" } }
241
+ }
242
+ }
243
+ }
244
+ ```
245
+
246
+ ### Colors
247
+
248
+ `color` accepts:
249
+ - theme colors (`primary`, `accent`, `warn`)
250
+ - M3 tokens (`var(--md-sys-color-*)`)
251
+ - custom colors (hex/rgb). The in-app editor offers a color picker.
252
+
105
253
  ## Actions
106
254
 
107
255
  Configure contextual item actions via `config.actions`:
@@ -115,8 +263,44 @@ actions: [
115
263
  ```
116
264
 
117
265
  - `kind`: 'icon' (default) or 'button'.
118
- - `showIf`: simple equality check is supported (left side must be an `${...}` expression).
119
- - `emitPayload`: choose what the action emits ('item' | 'id' | 'value').
266
+ - `showIf`: simple equality check is supported. Syntax: `"${item.field} == 'value'"`. Left side must be an interpolation expression.
267
+ - `emitPayload`: authoring field in the config/editor; current runtime `actionClick` emission does not change shape based on this field.
268
+
269
+ ### Global actions (command)
270
+
271
+ ```ts
272
+ actions: [
273
+ {
274
+ id: 'favorite',
275
+ icon: 'favorite',
276
+ label: 'Favorite',
277
+ command: 'global:api.post',
278
+ globalPayload: { url: '/api/favorite', body: { id: '${item.id}' } }
279
+ }
280
+ ]
281
+ ```
282
+
283
+ When `command` is set, `actionClick` is **not emitted** by default. Use `emitLocal: true` to emit both.
284
+
285
+ ### Confirmation and loading
286
+
287
+ ```ts
288
+ actions: [
289
+ {
290
+ id: 'delete',
291
+ icon: 'delete',
292
+ label: 'Delete',
293
+ command: 'global:api.patch',
294
+ showLoading: true,
295
+ confirmation: {
296
+ title: 'Confirm deletion',
297
+ message: 'Are you sure you want to delete this item?',
298
+ type: 'danger',
299
+ },
300
+ globalPayload: { url: '/api/items/${item.id}', body: { active: false } },
301
+ }
302
+ ]
303
+ ```
120
304
 
121
305
  ## Selection and Events
122
306
 
@@ -131,6 +315,25 @@ Outputs:
131
315
  - `(actionClick)`: `{ actionId, item, index }`
132
316
  - `(selectionChange)`: `{ mode, value, items, ids? }`
133
317
 
318
+ ## Known limitations and mismatches
319
+
320
+ 1. `layout.virtualScroll` and `layout.stickySectionHeader` exist in the contract/editor, but have no runtime implementation.
321
+ 2. `actions[].emitPayload` is accepted in config/editor, but does not change current `actionClick` payload format.
322
+ 3. `events.*` is declarative-only (no runtime dynamic routing).
323
+ 4. `a11y.highContrast` and `a11y.reduceMotion` are declarative-only at this stage.
324
+ 5. In remote mode, `/filter -> getAll()` fallback can increase network cost on large datasets.
325
+
326
+ ## Source of truth
327
+
328
+ - Canonical contract: `projects/praxis-list/src/lib/praxis-list.json-api.md`
329
+ - Runtime implementation:
330
+ - `projects/praxis-list/src/lib/components/praxis-list.component.ts`
331
+ - `projects/praxis-list/src/lib/components/praxis-list.component.html`
332
+ - `projects/praxis-list/src/lib/services/list-data.service.ts`
333
+ - Runtime specs:
334
+ - `projects/praxis-list/src/lib/components/praxis-list.component.spec.ts`
335
+ - `projects/praxis-list/src/lib/services/list-data.service.spec.ts`
336
+
134
337
  ## License
135
338
 
136
339
  Apache-2.0 — see `LICENSE` in this package or the repository root.