@praxisui/settings-panel 3.0.0-beta.9 → 5.0.0-beta.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 +136 -116
- package/fesm2022/praxisui-settings-panel.mjs +1072 -87
- package/index.d.ts +323 -9
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Settings Panel"
|
|
3
3
|
slug: "settings-panel-overview"
|
|
4
|
-
description: "Visao geral do @praxisui/settings-panel
|
|
4
|
+
description: "Visao geral do @praxisui/settings-panel, incluindo shell autoral, drawer runtime e infraestrutura base de side panel."
|
|
5
5
|
doc_type: "reference"
|
|
6
6
|
document_kind: "component-overview"
|
|
7
7
|
component: "settings-panel"
|
|
@@ -17,7 +17,7 @@ tags:
|
|
|
17
17
|
- "settings-panel"
|
|
18
18
|
- "drawer"
|
|
19
19
|
- "config-editor"
|
|
20
|
-
- "
|
|
20
|
+
- "surface-open"
|
|
21
21
|
- "ux"
|
|
22
22
|
order: 39
|
|
23
23
|
icon: "settings"
|
|
@@ -35,27 +35,30 @@ keywords:
|
|
|
35
35
|
- "praxis settings panel"
|
|
36
36
|
- "drawer editor"
|
|
37
37
|
- "settings value provider"
|
|
38
|
-
- "
|
|
39
|
-
last_updated: "2026-03
|
|
38
|
+
- "surface drawer bridge"
|
|
39
|
+
last_updated: "2026-04-03"
|
|
40
40
|
---
|
|
41
41
|
|
|
42
42
|
# @praxisui/settings-panel
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
`@praxisui/settings-panel` publica duas camadas complementares:
|
|
45
|
+
|
|
46
|
+
- um shell autoral para editores de configuracao, com `Apply`, `Save`, `Reset` e `Cancel`
|
|
47
|
+
- uma infraestrutura neutra de side panel para drawers runtime sem semantica autoral
|
|
45
48
|
|
|
46
49
|
## Documentation
|
|
47
50
|
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
- Indicado para: apps host que precisam abrir
|
|
51
|
+
- Documentacao oficial: https://praxisui.dev
|
|
52
|
+
- Aplicacao de referencia: https://github.com/codexrodrigues/praxis-ui-quickstart
|
|
53
|
+
- Indicado para: apps host que precisam abrir drawers consistentes, separando authoring de runtime
|
|
51
54
|
|
|
52
55
|
## When to use
|
|
53
56
|
|
|
54
|
-
- Abrir editores de configuracao
|
|
55
|
-
- Padronizar
|
|
56
|
-
-
|
|
57
|
+
- Abrir editores de configuracao com UX autoral consistente
|
|
58
|
+
- Padronizar `Apply`, `Save`, `Reset` e `Cancel` em flows de authoring
|
|
59
|
+
- Reutilizar uma base neutra de side panel para drawers runtime do `surface.open`
|
|
57
60
|
|
|
58
|
-
##
|
|
61
|
+
## Instalacao
|
|
59
62
|
|
|
60
63
|
```bash
|
|
61
64
|
npm i @praxisui/settings-panel
|
|
@@ -68,138 +71,155 @@ Peer dependencies (Angular v20):
|
|
|
68
71
|
- `@angular/material` `^20.0.0`
|
|
69
72
|
- `@praxisui/dynamic-fields` `^0.0.1`
|
|
70
73
|
|
|
71
|
-
##
|
|
74
|
+
## Visao Geral
|
|
75
|
+
|
|
76
|
+
### 1. Shell autoral
|
|
77
|
+
|
|
78
|
+
- Abra um painel com `SettingsPanelService.open(...)` informando um componente standalone como conteudo.
|
|
79
|
+
- O componente implementa `SettingsValueProvider` para habilitar ou desabilitar as acoes do rodape.
|
|
80
|
+
- O host observa `SettingsPanelRef.applied$` e `saved$` para aplicar e persistir mudancas.
|
|
81
|
+
- O shell autoral agora pode ligar resize horizontal compartilhado pela base comum, com `resizable`, `minWidth`, `maxWidth` e `persistSizeKey`.
|
|
82
|
+
- O `ref` base pode observar `sizeChanged$` quando o host precisar reagir a resize programatico ou interativo.
|
|
83
|
+
- `expanded: true` abre o painel ja expandido de forma efetiva, respeitando `maxWidth`.
|
|
84
|
+
- Expandir temporariamente o painel nao substitui a preferencia persistida do usuario; apenas o resize manual continua sendo persistido.
|
|
85
|
+
- Quando um editor autoral tentar abrir outro painel sobre o atual, o shell passa pela mesma mediacao de fechamento do proprio painel. Se `onBeforeClose` vetar o fechamento, a substituicao nao acontece.
|
|
86
|
+
|
|
87
|
+
### 2. Drawer runtime
|
|
88
|
+
|
|
89
|
+
- A infraestrutura base neutra fica disponivel por `BaseSidePanelService`.
|
|
90
|
+
- O shell runtime dedicado fica disponivel por `SurfaceDrawerComponent`.
|
|
91
|
+
- O bridge canonico de runtime e `providePraxisSurfaceDrawerBridge()`.
|
|
92
|
+
- Esse drawer runtime nao deve mostrar `Apply`, `Save`, `Reset` ou `Cancel` por heranca.
|
|
93
|
+
- O runtime drawer aceita `width`, `minWidth`, `maxWidth`, `resizable` e `persistSizeKey`; o handle visual so aparece quando `resizable=true`.
|
|
94
|
+
- Quando `persistSizeKey` estiver presente, a largura volta no proximo open do mesmo painel.
|
|
95
|
+
|
|
96
|
+
## Fronteira canonica
|
|
97
|
+
|
|
98
|
+
- `SettingsPanelService` e `SETTINGS_PANEL_BRIDGE` pertencem a authoring/configuracao.
|
|
99
|
+
- `SURFACE_DRAWER_BRIDGE` pertence ao runtime de `surface.open`.
|
|
100
|
+
- Ambos compartilham a mesma infraestrutura base de side panel, mas com shells diferentes.
|
|
101
|
+
|
|
102
|
+
## Customizacao visual
|
|
103
|
+
|
|
104
|
+
### Tokens autorais
|
|
72
105
|
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
106
|
+
- `--pfx-settings-panel-width`
|
|
107
|
+
- `--pfx-settings-panel-width-expanded`
|
|
108
|
+
- `--pfx-settings-panel-max-width`
|
|
109
|
+
- `--pfx-settings-panel-header-height`
|
|
110
|
+
- `--pfx-settings-panel-body-padding`
|
|
111
|
+
- `--pfx-settings-panel-footer-padding`
|
|
76
112
|
|
|
77
|
-
|
|
113
|
+
### Tokens neutros de side panel
|
|
78
114
|
|
|
79
|
-
|
|
80
|
-
|
|
115
|
+
- `--pfx-side-panel-width`
|
|
116
|
+
- `--pfx-side-panel-max-width`
|
|
117
|
+
- `--pfx-side-panel-header-height`
|
|
118
|
+
- `--pfx-side-panel-backdrop`
|
|
119
|
+
- `--pfx-side-panel-motion-duration-enter`
|
|
120
|
+
- `--pfx-side-panel-motion-duration-exit`
|
|
81
121
|
|
|
82
|
-
|
|
83
|
-
- `--pfx-settings-panel-width`: largura padrão (default `720px`)
|
|
84
|
-
- `--pfx-settings-panel-width-expanded`: largura quando expandido (default `95vw`)
|
|
85
|
-
- `--pfx-settings-panel-max-width`: largura máxima quando expandido (default `2400px`)
|
|
86
|
-
- `--pfx-settings-panel-header-height`: altura do header (default `64px`)
|
|
87
|
-
- `--pfx-settings-panel-header-padding-x`: padding horizontal do header (default `16px`)
|
|
88
|
-
- `--pfx-settings-panel-header-gap`: gap entre itens do header (default `8px`)
|
|
89
|
-
- `--pfx-settings-panel-title-gap`: gap entre ícone e título (default `8px`)
|
|
90
|
-
- `--pfx-settings-panel-body-padding`: padding do corpo (default `8px 8px 24px 8px`)
|
|
91
|
-
- `--pfx-settings-panel-footer-padding`: padding do rodapé (default `12px 16px`)
|
|
92
|
-
- `--pfx-settings-panel-footer-gap`: gap entre botões do rodapé (default `12px`)
|
|
93
|
-
- `--pfx-settings-panel-button-gap`: gap entre ícone e texto em botões (default `8px`)
|
|
122
|
+
Hosts devem inferir skin, densidade, spacing e motion sobre os tokens `--pfx-side-panel-*` quando o objetivo for drawer runtime compartilhado.
|
|
94
123
|
|
|
95
|
-
|
|
96
|
-
- `--pfx-settings-panel-header-shadow`: sombra do header (default `--md-sys-elevation-level1`)
|
|
97
|
-
- `--pfx-settings-panel-footer-shadow`: sombra do footer (default `--md-sys-elevation-level1`)
|
|
98
|
-
- `--pfx-backdrop`: cor do backdrop (default `--md-sys-color-scrim`)
|
|
99
|
-
- `--pfx-backdrop-blur`: blur do backdrop (default `6px`)
|
|
124
|
+
## API principal de authoring
|
|
100
125
|
|
|
101
|
-
|
|
126
|
+
### Servico
|
|
102
127
|
|
|
103
|
-
Serviço
|
|
104
128
|
- `open(config: SettingsPanelConfig): SettingsPanelRef`
|
|
105
|
-
- `config.id: string`
|
|
106
|
-
- `config.title?: string`
|
|
107
|
-
- `config.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
- `
|
|
111
|
-
- `
|
|
112
|
-
- `
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
- `
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
- `
|
|
120
|
-
- `
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
- `
|
|
129
|
-
- `
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
129
|
+
- `config.id: string`
|
|
130
|
+
- `config.title?: string`
|
|
131
|
+
- `config.expanded?: boolean`
|
|
132
|
+
- `config.resizable?: boolean`
|
|
133
|
+
- `config.persistSizeKey?: string`
|
|
134
|
+
- `config.minWidth?: string`
|
|
135
|
+
- `config.maxWidth?: string`
|
|
136
|
+
- `config.content: { component: Type<any>; inputs?: Record<string, any> }`
|
|
137
|
+
|
|
138
|
+
### Ref
|
|
139
|
+
|
|
140
|
+
- `applied$: Observable<any>`
|
|
141
|
+
- `saved$: Observable<any>`
|
|
142
|
+
- `closed$: Observable<SettingsPanelCloseReason>`
|
|
143
|
+
- `sizeChanged$: Observable<{ width: string }>`
|
|
144
|
+
- `apply(value: any)`
|
|
145
|
+
- `save(value: any)`
|
|
146
|
+
- `reset()`
|
|
147
|
+
- `updateSize(width, options?)`
|
|
148
|
+
- `close(reason?: SettingsPanelCloseReason)`
|
|
149
|
+
|
|
150
|
+
### Injection Tokens
|
|
151
|
+
|
|
152
|
+
- `SETTINGS_PANEL_DATA`
|
|
153
|
+
- `SETTINGS_PANEL_REF`
|
|
154
|
+
|
|
155
|
+
## Contrato do editor
|
|
156
|
+
|
|
157
|
+
O componente hospedado deve expor:
|
|
158
|
+
|
|
159
|
+
- `isDirty$: Observable<boolean>`
|
|
160
|
+
- `isValid$: Observable<boolean>`
|
|
161
|
+
- `isBusy$: Observable<boolean>`
|
|
162
|
+
- `getSettingsValue(): any`
|
|
163
|
+
|
|
164
|
+
Opcionais:
|
|
165
|
+
|
|
166
|
+
- `onSave?()`
|
|
167
|
+
- `reset?()`
|
|
168
|
+
- `suggestExpanded$?`
|
|
169
|
+
- `preferredWidth$?`
|
|
170
|
+
- `requiresFullHeight$?`
|
|
171
|
+
- `onPanelResize?`
|
|
172
|
+
- `onBeforeClose?`
|
|
173
|
+
- `onFocusChange?`
|
|
174
|
+
- `customActions$?`
|
|
175
|
+
- `hideDefaultButtons$?`
|
|
176
|
+
|
|
177
|
+
### `onBeforeClose`
|
|
178
|
+
|
|
179
|
+
`onBeforeClose` pertence ao contrato canonico de authoring. Ele pode:
|
|
180
|
+
|
|
181
|
+
- permitir cleanup antes do fechamento
|
|
182
|
+
- vetar o fechamento retornando `false`
|
|
183
|
+
- ser usado tanto no `Cancel` local quanto na tentativa de substituir um painel autoral ja aberto
|
|
184
|
+
|
|
185
|
+
Na pratica:
|
|
186
|
+
|
|
187
|
+
- `Cancel`, `Esc` e `backdrop` continuam passando pela confirmacao de descarte quando houver `dirty`
|
|
188
|
+
- antes disso, o shell consulta `onBeforeClose`
|
|
189
|
+
- se `onBeforeClose` retornar `false`, o painel continua aberto e o host nao substitui silenciosamente a sessao atual
|
|
190
|
+
|
|
191
|
+
## Exemplo de authoring
|
|
144
192
|
|
|
145
193
|
```ts
|
|
146
|
-
// Em um componente host (ex.: Filtro Praxis)
|
|
147
194
|
const ref = this.settingsPanel.open({
|
|
148
195
|
id: `filter.${this.configKey}`,
|
|
149
|
-
title: '
|
|
196
|
+
title: 'Configuracoes do filtro',
|
|
150
197
|
content: { component: FilterSettingsComponent, inputs: currentConfig },
|
|
151
198
|
});
|
|
152
199
|
|
|
153
|
-
// Tratar Apply (manter painel aberto)
|
|
154
|
-
ref.applied$.pipe(take(1)).subscribe((cfg: FilterConfig) => {
|
|
155
|
-
const safe = validateConfig(cfg);
|
|
156
|
-
applyChanges(safe);
|
|
157
|
-
persistConfig(safe, 'Configurações aplicadas');
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
// Tratar Save & Close
|
|
161
200
|
ref.saved$.pipe(take(1)).subscribe((cfg: FilterConfig) => {
|
|
162
201
|
const safe = validateConfig(cfg);
|
|
163
202
|
applyChanges(safe);
|
|
164
|
-
persistConfig(safe, '
|
|
203
|
+
persistConfig(safe, 'Configuracoes salvas');
|
|
165
204
|
});
|
|
166
205
|
```
|
|
167
206
|
|
|
168
|
-
##
|
|
207
|
+
## Resize e persistencia
|
|
169
208
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
// Streams obrigatórias
|
|
177
|
-
isDirty$ = this.form.valueChanges.pipe(map(() => this.form.dirty), startWith(false));
|
|
178
|
-
isValid$ = this.form.statusChanges.pipe(map(() => this.form.valid), startWith(this.form.valid));
|
|
179
|
-
isBusy$ = of(false);
|
|
180
|
-
|
|
181
|
-
getSettingsValue() {
|
|
182
|
-
return this.form.getRawValue();
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
reset() {
|
|
186
|
-
this.form.reset({ foo: 'bar' });
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
```
|
|
209
|
+
- `resizable` fica ligado por padrao no shell autoral
|
|
210
|
+
- `persistSizeKey` controla a restauracao da largura no proximo open do mesmo painel
|
|
211
|
+
- `sizeChanged$` emite a largura aplicada de fato
|
|
212
|
+
- resize manual persiste a largura
|
|
213
|
+
- `expanded` e `toggleExpand()` nao sobrescrevem a largura persistida; eles sao tratados como estado transitório de layout
|
|
190
214
|
|
|
191
|
-
## Build local
|
|
215
|
+
## Build local
|
|
192
216
|
|
|
193
217
|
```bash
|
|
194
|
-
# build do pacote
|
|
195
218
|
ng build praxis-settings-panel
|
|
196
|
-
|
|
197
|
-
# verificar conteúdo do pacote
|
|
198
219
|
cd dist/praxis-settings-panel && npm pack
|
|
199
220
|
```
|
|
200
221
|
|
|
201
|
-
O pacote publicado inclui este `README.md` via configuração de `assets` no `ng-package.json`.
|
|
202
|
-
|
|
203
222
|
## Links
|
|
204
|
-
|
|
223
|
+
|
|
224
|
+
- Repositorio: https://github.com/codexrodrigues/praxis
|
|
205
225
|
- Issues: https://github.com/codexrodrigues/praxis/issues
|