@praxisui/metadata-editor 8.0.0-beta.0 → 8.0.0-beta.2
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/fesm2022/praxisui-metadata-editor.mjs +41 -1
- package/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -3710,6 +3710,41 @@ const avatarProperties = [
|
|
|
3710
3710
|
{ name: 'extra.ariaLabel', label: 'ARIA label', editorType: 'text', group: 'Acessibilidade', hint: 'Use quando não houver label visível.' },
|
|
3711
3711
|
];
|
|
3712
3712
|
|
|
3713
|
+
const fieldSubmitProperties = [
|
|
3714
|
+
{
|
|
3715
|
+
name: 'source',
|
|
3716
|
+
label: 'Field source',
|
|
3717
|
+
editorType: 'select',
|
|
3718
|
+
group: 'Submit',
|
|
3719
|
+
defaultValue: 'schema',
|
|
3720
|
+
options: [
|
|
3721
|
+
{ value: 'schema', text: 'Schema field' },
|
|
3722
|
+
{ value: 'local', text: 'Local field' },
|
|
3723
|
+
],
|
|
3724
|
+
hint: 'Local fields are authored by the host and do not belong to the backend schema.',
|
|
3725
|
+
},
|
|
3726
|
+
{
|
|
3727
|
+
name: 'transient',
|
|
3728
|
+
label: 'Transient field',
|
|
3729
|
+
editorType: 'checkbox',
|
|
3730
|
+
group: 'Submit',
|
|
3731
|
+
hint: 'Transient fields stay available to the form but are omitted from submit payloads by default.',
|
|
3732
|
+
},
|
|
3733
|
+
{
|
|
3734
|
+
name: 'submitPolicy',
|
|
3735
|
+
label: 'Submit policy',
|
|
3736
|
+
editorType: 'select',
|
|
3737
|
+
group: 'Submit',
|
|
3738
|
+
options: [
|
|
3739
|
+
{ value: undefined, text: 'Default' },
|
|
3740
|
+
{ value: 'include', text: 'Include' },
|
|
3741
|
+
{ value: 'omit', text: 'Omit' },
|
|
3742
|
+
{ value: 'includeWhenDirty', text: 'Include when dirty' },
|
|
3743
|
+
],
|
|
3744
|
+
hint: 'When set, this policy has priority over source and transient.',
|
|
3745
|
+
},
|
|
3746
|
+
];
|
|
3747
|
+
|
|
3713
3748
|
/** Garante que minLength <= maxLength quando ambos definidos. */
|
|
3714
3749
|
function minLenLeMaxLen(group) {
|
|
3715
3750
|
const v = group.value || {};
|
|
@@ -5734,7 +5769,7 @@ class FieldMetadataEditorComponent {
|
|
|
5734
5769
|
options: this.typeOptions.map((o) => ({ value: o.value, text: o.label })),
|
|
5735
5770
|
defaultValue: this.controlType,
|
|
5736
5771
|
};
|
|
5737
|
-
props = [typeProp, ...props];
|
|
5772
|
+
props = this.withSharedFieldMetadataProperties([typeProp, ...props]);
|
|
5738
5773
|
}
|
|
5739
5774
|
catch { }
|
|
5740
5775
|
this.normalizedProps = this.normalizer.normalize(props, this.seed);
|
|
@@ -6185,6 +6220,11 @@ class FieldMetadataEditorComponent {
|
|
|
6185
6220
|
if (value != null)
|
|
6186
6221
|
this.onControlTypeChange(value);
|
|
6187
6222
|
}
|
|
6223
|
+
withSharedFieldMetadataProperties(props) {
|
|
6224
|
+
const propNames = new Set(props.map((prop) => prop.name));
|
|
6225
|
+
const missingSharedProps = fieldSubmitProperties.filter((prop) => !propNames.has(prop.name));
|
|
6226
|
+
return missingSharedProps.length ? [...props, ...missingSharedProps] : props;
|
|
6227
|
+
}
|
|
6188
6228
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: FieldMetadataEditorComponent, deps: [{ token: ConfigRegistryService }, { token: SchemaNormalizerService }, { token: DynamicFormFactoryService }, { token: ContextValidatorRegistryService }], target: i0.ɵɵFactoryTarget.Component });
|
|
6189
6229
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.17", type: FieldMetadataEditorComponent, isStandalone: true, selector: "praxis-field-metadata-editor", inputs: { controlType: "controlType", seed: "seed" }, outputs: { applied: "applied", cancel: "cancel" }, ngImport: i0, template: `
|
|
6190
6230
|
<div class="p-3" *ngIf="form">
|
package/index.d.ts
CHANGED
|
@@ -169,6 +169,7 @@ declare class FieldMetadataEditorComponent implements OnInit {
|
|
|
169
169
|
reset(): void;
|
|
170
170
|
onControlTypeChange(next: FieldControlType): void;
|
|
171
171
|
onControlTypeChangeEvent(event: Event): void;
|
|
172
|
+
private withSharedFieldMetadataProperties;
|
|
172
173
|
static ɵfac: i0.ɵɵFactoryDeclaration<FieldMetadataEditorComponent, never>;
|
|
173
174
|
static ɵcmp: i0.ɵɵComponentDeclaration<FieldMetadataEditorComponent, "praxis-field-metadata-editor", never, { "controlType": { "alias": "controlType"; "required": false; }; "seed": { "alias": "seed"; "required": false; }; }, { "applied": "applied"; "cancel": "cancel"; }, never, never, true, never>;
|
|
174
175
|
}
|
package/package.json
CHANGED