@praxisui/dynamic-fields 1.0.0-beta.10 → 1.0.0-beta.12
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,12 @@
|
|
|
1
1
|
# @praxisui/dynamic-fields — Dynamic Form Fields
|
|
2
2
|
|
|
3
|
+
## 🔰 Exemplos / Quickstart
|
|
4
|
+
|
|
5
|
+
Para ver esta biblioteca em funcionamento em uma aplicação completa, utilize o projeto de exemplo (Quickstart):
|
|
6
|
+
|
|
7
|
+
- Repositório: https://github.com/codexrodrigues/praxis-ui-quickstart
|
|
8
|
+
- O Quickstart demonstra a integração das bibliotecas `@praxisui/*` em um app Angular, incluindo instalação, configuração e uso em telas reais.
|
|
9
|
+
|
|
3
10
|
### Concept Usage
|
|
4
11
|
|
|
5
12
|
- [Dynamic Component Rendering](../../../../docs/concepts/dynamic-component-rendering.md)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i4 from '@angular/forms';
|
|
2
2
|
import { NgControl, FormControl, Validators, ReactiveFormsModule, NG_VALUE_ACCESSOR, FormGroup, FormsModule } from '@angular/forms';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { inject, DestroyRef, ElementRef, ChangeDetectorRef, Injector, signal, output, computed, Input, Directive, viewChild, effect, forwardRef, Component, ViewChild, LOCALE_ID, EventEmitter, Injectable, ViewContainerRef, HostListener, HostBinding, Output, ChangeDetectionStrategy, Inject, TemplateRef, ContentChild } from '@angular/core';
|
|
4
|
+
import { inject, DestroyRef, ElementRef, ChangeDetectorRef, Injector, signal, output, computed, Input, Directive, viewChild, effect, forwardRef, Component, ViewChild, LOCALE_ID, EventEmitter, Injectable, ViewContainerRef, HostListener, HostBinding, Output, ViewEncapsulation, ChangeDetectionStrategy, Inject, TemplateRef, ContentChild, APP_INITIALIZER } from '@angular/core';
|
|
5
5
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
6
|
import { isCssTextTransform, getTextTransformer, GenericCrudService, GlobalConfigService, PraxisIconDirective, createCpfCnpjValidator, FieldControlType } from '@praxisui/core';
|
|
7
7
|
import { BehaviorSubject, combineLatest, take as take$1, of, EMPTY, firstValueFrom, fromEvent, Subscription } from 'rxjs';
|
|
@@ -14918,11 +14918,11 @@ class FieldShellComponent {
|
|
|
14918
14918
|
|
|
14919
14919
|
</div>
|
|
14920
14920
|
</div>
|
|
14921
|
-
`, isInline: true, styles: [":host{display:block;cursor:pointer;width:100%}.pfx-field-shell-wrapper,.pfx-field-shell-host{position:relative}.praxis-readonly-overlay{position:absolute;inset:0;pointer-events:all;cursor:not-allowed}.praxis-presentation{white-space:pre-wrap;display:block;padding:6px 0}.praxis-presentation__label{display:block;font-size:var(--pfx-pres-label-size, .78rem);line-height:1.2;letter-spacing:.02em;font-weight:500;opacity:.8;margin-bottom:2px}.praxis-presentation__value{display:block;font-size:var(--pfx-pres-value-size, 1rem);line-height:1.35;font-weight:600;opacity:.95}.presentation-mode.pres-label-left .praxis-presentation{display:flex;align-items:center;gap:8px}.presentation-mode.pres-label-left .praxis-presentation__label{margin:0;min-width:var(--pfx-pres-label-width, 140px);opacity:.85;text-align:var(--pfx-pres-label-align, start)}.presentation-mode .praxis-presentation__value{text-align:var(--pfx-pres-value-align, start)}.presentation-mode.pres-density-cozy .praxis-presentation{padding:6px 0}.presentation-mode.pres-density-compact .praxis-presentation{padding:2px 0;gap:6px}.presentation-mode.pres-compact .praxis-presentation{padding:2px 0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
14921
|
+
`, isInline: true, styles: [".pfx-field-shell .mat-mdc-form-field,.pfx-field-shell mat-form-field{width:100%}:host{display:block;cursor:pointer;width:100%}.pfx-field-shell-wrapper,.pfx-field-shell-host{position:relative}.praxis-readonly-overlay{position:absolute;inset:0;pointer-events:all;cursor:not-allowed}.praxis-presentation{white-space:pre-wrap;display:block;padding:6px 0}.praxis-presentation__label{display:block;font-size:var(--pfx-pres-label-size, .78rem);line-height:1.2;letter-spacing:.02em;font-weight:500;opacity:.8;margin-bottom:2px}.praxis-presentation__value{display:block;font-size:var(--pfx-pres-value-size, 1rem);line-height:1.35;font-weight:600;opacity:.95}.presentation-mode.pres-label-left .praxis-presentation{display:flex;align-items:center;gap:8px}.presentation-mode.pres-label-left .praxis-presentation__label{margin:0;min-width:var(--pfx-pres-label-width, 140px);opacity:.85;text-align:var(--pfx-pres-label-align, start)}.presentation-mode .praxis-presentation__value{text-align:var(--pfx-pres-value-align, start)}.presentation-mode.pres-density-cozy .praxis-presentation{padding:6px 0}.presentation-mode.pres-density-compact .praxis-presentation{padding:2px 0;gap:6px}.presentation-mode.pres-compact .praxis-presentation{padding:2px 0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
14922
14922
|
}
|
|
14923
14923
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: FieldShellComponent, decorators: [{
|
|
14924
14924
|
type: Component,
|
|
14925
|
-
args: [{ selector: 'praxis-field-shell', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
14925
|
+
args: [{ selector: 'praxis-field-shell', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: `
|
|
14926
14926
|
<div
|
|
14927
14927
|
class="pfx-field-shell-wrapper"
|
|
14928
14928
|
[attr.data-field-index]="index"
|
|
@@ -14975,7 +14975,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImpor
|
|
|
14975
14975
|
|
|
14976
14976
|
</div>
|
|
14977
14977
|
</div>
|
|
14978
|
-
`, host: { class: 'pfx-field-shell' }, styles: [":host{display:block;cursor:pointer;width:100%}.pfx-field-shell-wrapper,.pfx-field-shell-host{position:relative}.praxis-readonly-overlay{position:absolute;inset:0;pointer-events:all;cursor:not-allowed}.praxis-presentation{white-space:pre-wrap;display:block;padding:6px 0}.praxis-presentation__label{display:block;font-size:var(--pfx-pres-label-size, .78rem);line-height:1.2;letter-spacing:.02em;font-weight:500;opacity:.8;margin-bottom:2px}.praxis-presentation__value{display:block;font-size:var(--pfx-pres-value-size, 1rem);line-height:1.35;font-weight:600;opacity:.95}.presentation-mode.pres-label-left .praxis-presentation{display:flex;align-items:center;gap:8px}.presentation-mode.pres-label-left .praxis-presentation__label{margin:0;min-width:var(--pfx-pres-label-width, 140px);opacity:.85;text-align:var(--pfx-pres-label-align, start)}.presentation-mode .praxis-presentation__value{text-align:var(--pfx-pres-value-align, start)}.presentation-mode.pres-density-cozy .praxis-presentation{padding:6px 0}.presentation-mode.pres-density-compact .praxis-presentation{padding:2px 0;gap:6px}.presentation-mode.pres-compact .praxis-presentation{padding:2px 0}\n"] }]
|
|
14978
|
+
`, host: { class: 'pfx-field-shell' }, styles: [".pfx-field-shell .mat-mdc-form-field,.pfx-field-shell mat-form-field{width:100%}:host{display:block;cursor:pointer;width:100%}.pfx-field-shell-wrapper,.pfx-field-shell-host{position:relative}.praxis-readonly-overlay{position:absolute;inset:0;pointer-events:all;cursor:not-allowed}.praxis-presentation{white-space:pre-wrap;display:block;padding:6px 0}.praxis-presentation__label{display:block;font-size:var(--pfx-pres-label-size, .78rem);line-height:1.2;letter-spacing:.02em;font-weight:500;opacity:.8;margin-bottom:2px}.praxis-presentation__value{display:block;font-size:var(--pfx-pres-value-size, 1rem);line-height:1.35;font-weight:600;opacity:.95}.presentation-mode.pres-label-left .praxis-presentation{display:flex;align-items:center;gap:8px}.presentation-mode.pres-label-left .praxis-presentation__label{margin:0;min-width:var(--pfx-pres-label-width, 140px);opacity:.85;text-align:var(--pfx-pres-label-align, start)}.presentation-mode .praxis-presentation__value{text-align:var(--pfx-pres-value-align, start)}.presentation-mode.pres-density-cozy .praxis-presentation{padding:6px 0}.presentation-mode.pres-density-compact .praxis-presentation{padding:2px 0;gap:6px}.presentation-mode.pres-compact .praxis-presentation{padding:2px 0}\n"] }]
|
|
14979
14979
|
}], propDecorators: { field: [{
|
|
14980
14980
|
type: Input
|
|
14981
14981
|
}], index: [{
|
|
@@ -19027,6 +19027,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImpor
|
|
|
19027
19027
|
* Providers necessários para o funcionamento correto da biblioteca,
|
|
19028
19028
|
* incluindo HttpClient e outros serviços essenciais.
|
|
19029
19029
|
*/
|
|
19030
|
+
/** Runtime init to inject a narrowly-scoped style that ensures
|
|
19031
|
+
* Material form fields render full width inside praxis components.
|
|
19032
|
+
* The selector is restricted to hosts that expose `data-component-id`,
|
|
19033
|
+
* which all praxis field components set on the host element.
|
|
19034
|
+
*/
|
|
19035
|
+
function initPraxisDynamicFieldsStyles() {
|
|
19036
|
+
return () => {
|
|
19037
|
+
try {
|
|
19038
|
+
const d = globalThis.document;
|
|
19039
|
+
if (!d || !d.head)
|
|
19040
|
+
return;
|
|
19041
|
+
if (d.querySelector('style[data-praxis-df-fullwidth]'))
|
|
19042
|
+
return;
|
|
19043
|
+
const style = d.createElement('style');
|
|
19044
|
+
style.setAttribute('data-praxis-df-fullwidth', 'true');
|
|
19045
|
+
style.textContent = `
|
|
19046
|
+
/* Applied by praxis-dynamic-fields: make form fields take full width */
|
|
19047
|
+
[data-component-id] .mat-mdc-form-field,
|
|
19048
|
+
[data-component-id] mat-form-field { width: 100%; }
|
|
19049
|
+
`;
|
|
19050
|
+
d.head.appendChild(style);
|
|
19051
|
+
}
|
|
19052
|
+
catch {
|
|
19053
|
+
// no-op: style injection is best-effort
|
|
19054
|
+
}
|
|
19055
|
+
};
|
|
19056
|
+
}
|
|
19030
19057
|
/**
|
|
19031
19058
|
* Providers essenciais para praxis-dynamic-fields
|
|
19032
19059
|
*
|
|
@@ -19049,6 +19076,8 @@ function providePraxisDynamicFields() {
|
|
|
19049
19076
|
return [
|
|
19050
19077
|
// HttpClient para data loading
|
|
19051
19078
|
provideHttpClient(withInterceptorsFromDi()),
|
|
19079
|
+
// Default style to ensure 100% width for mat-form-field inside praxis components
|
|
19080
|
+
{ provide: APP_INITIALIZER, useFactory: initPraxisDynamicFieldsStyles, deps: [], multi: true },
|
|
19052
19081
|
// Outros providers podem ser adicionados aqui no futuro
|
|
19053
19082
|
];
|
|
19054
19083
|
}
|