@praxisui/settings-panel 3.0.0-beta.8 → 4.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 +106 -118
- package/fesm2022/praxisui-settings-panel.mjs +915 -69
- package/index.d.ts +282 -8
- package/package.json +4 -4
- package/fesm2022/praxisui-settings-panel.mjs.map +0 -1
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,123 @@ 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
|
+
|
|
84
|
+
### 2. Drawer runtime
|
|
85
|
+
|
|
86
|
+
- A infraestrutura base neutra fica disponivel por `BaseSidePanelService`.
|
|
87
|
+
- O shell runtime dedicado fica disponivel por `SurfaceDrawerComponent`.
|
|
88
|
+
- O bridge canonico de runtime e `providePraxisSurfaceDrawerBridge()`.
|
|
89
|
+
- Esse drawer runtime nao deve mostrar `Apply`, `Save`, `Reset` ou `Cancel` por heranca.
|
|
90
|
+
- O runtime drawer aceita `width`, `minWidth`, `maxWidth`, `resizable` e `persistSizeKey`; o handle visual so aparece quando `resizable=true`.
|
|
91
|
+
- Quando `persistSizeKey` estiver presente, a largura volta no proximo open do mesmo painel.
|
|
92
|
+
|
|
93
|
+
## Fronteira canonica
|
|
94
|
+
|
|
95
|
+
- `SettingsPanelService` e `SETTINGS_PANEL_BRIDGE` pertencem a authoring/configuracao.
|
|
96
|
+
- `SURFACE_DRAWER_BRIDGE` pertence ao runtime de `surface.open`.
|
|
97
|
+
- Ambos compartilham a mesma infraestrutura base de side panel, mas com shells diferentes.
|
|
98
|
+
|
|
99
|
+
## Customizacao visual
|
|
72
100
|
|
|
73
|
-
|
|
74
|
-
- O componente implementa o contrato `SettingsValueProvider` para o painel habilitar/desabilitar ações do rodapé.
|
|
75
|
-
- O host observa `SettingsPanelRef.applied$` e `saved$` para aplicar/persistir mudanças.
|
|
101
|
+
### Tokens autorais
|
|
76
102
|
|
|
77
|
-
|
|
103
|
+
- `--pfx-settings-panel-width`
|
|
104
|
+
- `--pfx-settings-panel-width-expanded`
|
|
105
|
+
- `--pfx-settings-panel-max-width`
|
|
106
|
+
- `--pfx-settings-panel-header-height`
|
|
107
|
+
- `--pfx-settings-panel-body-padding`
|
|
108
|
+
- `--pfx-settings-panel-footer-padding`
|
|
78
109
|
|
|
79
|
-
|
|
80
|
-
Se quiser ajustar layout/spacing sem alterar código, use as variáveis abaixo (em `:root` ou no container do painel).
|
|
110
|
+
### Tokens neutros de side panel
|
|
81
111
|
|
|
82
|
-
|
|
83
|
-
- `--pfx-
|
|
84
|
-
- `--pfx-
|
|
85
|
-
- `--pfx-
|
|
86
|
-
- `--pfx-
|
|
87
|
-
- `--pfx-
|
|
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`)
|
|
112
|
+
- `--pfx-side-panel-width`
|
|
113
|
+
- `--pfx-side-panel-max-width`
|
|
114
|
+
- `--pfx-side-panel-header-height`
|
|
115
|
+
- `--pfx-side-panel-backdrop`
|
|
116
|
+
- `--pfx-side-panel-motion-duration-enter`
|
|
117
|
+
- `--pfx-side-panel-motion-duration-exit`
|
|
94
118
|
|
|
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`)
|
|
119
|
+
Hosts devem inferir skin, densidade, spacing e motion sobre os tokens `--pfx-side-panel-*` quando o objetivo for drawer runtime compartilhado.
|
|
100
120
|
|
|
101
|
-
## API
|
|
121
|
+
## API principal de authoring
|
|
122
|
+
|
|
123
|
+
### Servico
|
|
102
124
|
|
|
103
|
-
Serviço
|
|
104
125
|
- `open(config: SettingsPanelConfig): SettingsPanelRef`
|
|
105
|
-
- `config.id: string`
|
|
106
|
-
- `config.title?: string`
|
|
107
|
-
- `config.content: { component: Type<any>; inputs?: Record<string, any> }`
|
|
108
|
-
|
|
109
|
-
Ref
|
|
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
|
-
|
|
126
|
+
- `config.id: string`
|
|
127
|
+
- `config.title?: string`
|
|
128
|
+
- `config.content: { component: Type<any>; inputs?: Record<string, any> }`
|
|
129
|
+
|
|
130
|
+
### Ref
|
|
131
|
+
|
|
132
|
+
- `applied$: Observable<any>`
|
|
133
|
+
- `saved$: Observable<any>`
|
|
134
|
+
- `closed$: Observable<SettingsPanelCloseReason>`
|
|
135
|
+
- `apply(value: any)`
|
|
136
|
+
- `save(value: any)`
|
|
137
|
+
- `reset()`
|
|
138
|
+
- `close(reason?: SettingsPanelCloseReason)`
|
|
139
|
+
|
|
140
|
+
### Injection Tokens
|
|
141
|
+
|
|
142
|
+
- `SETTINGS_PANEL_DATA`
|
|
143
|
+
- `SETTINGS_PANEL_REF`
|
|
144
|
+
|
|
145
|
+
## Contrato do editor
|
|
146
|
+
|
|
147
|
+
O componente hospedado deve expor:
|
|
148
|
+
|
|
149
|
+
- `isDirty$: Observable<boolean>`
|
|
150
|
+
- `isValid$: Observable<boolean>`
|
|
151
|
+
- `isBusy$: Observable<boolean>`
|
|
152
|
+
- `getSettingsValue(): any`
|
|
153
|
+
|
|
154
|
+
Opcionais:
|
|
155
|
+
|
|
156
|
+
- `onSave?()`
|
|
157
|
+
- `reset?()`
|
|
158
|
+
- `suggestExpanded$?`
|
|
159
|
+
- `preferredWidth$?`
|
|
160
|
+
- `requiresFullHeight$?`
|
|
161
|
+
- `onPanelResize?`
|
|
162
|
+
- `onBeforeClose?`
|
|
163
|
+
- `onFocusChange?`
|
|
164
|
+
- `customActions$?`
|
|
165
|
+
- `hideDefaultButtons$?`
|
|
166
|
+
|
|
167
|
+
## Exemplo de authoring
|
|
144
168
|
|
|
145
169
|
```ts
|
|
146
|
-
// Em um componente host (ex.: Filtro Praxis)
|
|
147
170
|
const ref = this.settingsPanel.open({
|
|
148
171
|
id: `filter.${this.configKey}`,
|
|
149
|
-
title: '
|
|
172
|
+
title: 'Configuracoes do filtro',
|
|
150
173
|
content: { component: FilterSettingsComponent, inputs: currentConfig },
|
|
151
174
|
});
|
|
152
175
|
|
|
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
176
|
ref.saved$.pipe(take(1)).subscribe((cfg: FilterConfig) => {
|
|
162
177
|
const safe = validateConfig(cfg);
|
|
163
178
|
applyChanges(safe);
|
|
164
|
-
persistConfig(safe, '
|
|
179
|
+
persistConfig(safe, 'Configuracoes salvas');
|
|
165
180
|
});
|
|
166
181
|
```
|
|
167
182
|
|
|
168
|
-
##
|
|
169
|
-
|
|
170
|
-
```ts
|
|
171
|
-
@Component({ standalone: true /* imports… */ })
|
|
172
|
-
export class MySettingsEditor implements SettingsValueProvider {
|
|
173
|
-
private fb = inject(FormBuilder);
|
|
174
|
-
form = this.fb.group({ foo: ['bar', Validators.required] });
|
|
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
|
-
```
|
|
190
|
-
|
|
191
|
-
## Build local e Publicação
|
|
183
|
+
## Build local
|
|
192
184
|
|
|
193
185
|
```bash
|
|
194
|
-
# build do pacote
|
|
195
186
|
ng build praxis-settings-panel
|
|
196
|
-
|
|
197
|
-
# verificar conteúdo do pacote
|
|
198
187
|
cd dist/praxis-settings-panel && npm pack
|
|
199
188
|
```
|
|
200
189
|
|
|
201
|
-
O pacote publicado inclui este `README.md` via configuração de `assets` no `ng-package.json`.
|
|
202
|
-
|
|
203
190
|
## Links
|
|
204
|
-
|
|
191
|
+
|
|
192
|
+
- Repositorio: https://github.com/codexrodrigues/praxis
|
|
205
193
|
- Issues: https://github.com/codexrodrigues/praxis/issues
|