@praxisui/metadata-editor 10.0.0-rc.60 → 10.0.0-rc.61

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.
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": "1.0.0",
3
- "generatedAt": "2026-11-23T14:32:32.238Z",
3
+ "generatedAt": "2026-11-24T14:00:56.078Z",
4
4
  "packageName": "@praxisui/metadata-editor",
5
- "packageVersion": "10.0.0-rc.60",
5
+ "packageVersion": "10.0.0-rc.61",
6
6
  "sourceRegistry": "praxis-component-registry-ingestion",
7
7
  "sourceRegistryVersion": "1.0.0",
8
8
  "componentCount": 1,
@@ -2923,12 +2923,12 @@ class DynamicEditorRendererComponent {
2923
2923
  if (!Array.isArray(options)) {
2924
2924
  return undefined;
2925
2925
  }
2926
- return options.map((option) => ({
2926
+ return options.map(({ code, badge, description, ...option }) => ({
2927
2927
  ...option,
2928
2928
  text: this.resolveEditorText(option.textKey, option.text) ?? option.text,
2929
- code: option.code ?? undefined,
2930
- badge: option.badge ?? undefined,
2931
- description: option.description ?? undefined,
2929
+ ...(code != null ? { code } : {}),
2930
+ ...(badge != null ? { badge } : {}),
2931
+ ...(description != null ? { description } : {}),
2932
2932
  }));
2933
2933
  }
2934
2934
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: DynamicEditorRendererComponent, deps: [{ token: i1$1.MatDialog }, { token: i2$2.IconPickerService }, { token: i2$2.PraxisI18nService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
@@ -4511,6 +4511,182 @@ const selectProperties = [
4511
4511
  { name: 'dataAttributes', label: 'Data attributes (JSON)', editorType: 'textarea', group: 'Acessibilidade', hint: '{ "testId": "select-a" }' },
4512
4512
  ];
4513
4513
 
4514
+ /**
4515
+ * Metadata editor property definition for `FieldControlType.SELECTION_LIST`
4516
+ * (`pdx-material-selection-list`).
4517
+ */
4518
+ const selectionListProperties = [
4519
+ // 1) Geral
4520
+ { name: 'label', label: 'Label', editorType: 'text', group: 'Geral' },
4521
+ { name: 'defaultValue', label: 'Valor padrão', editorType: 'text', group: 'Geral' },
4522
+ { name: 'hint', label: 'Hint', editorType: 'text', group: 'Geral' },
4523
+ // 2) Dados/Opções
4524
+ {
4525
+ name: 'options',
4526
+ label: 'Opções (estáticas)',
4527
+ editorType: 'textarea',
4528
+ group: 'Dados/Opções',
4529
+ hint: 'JSON: [{ "value": 1, "label": "Um" }] ou linhas: valor|rótulo.',
4530
+ },
4531
+ {
4532
+ name: 'multiple',
4533
+ label: 'Múltipla seleção',
4534
+ editorType: 'checkbox',
4535
+ group: 'Dados/Opções',
4536
+ row: 'dados.inline1',
4537
+ inline: true,
4538
+ hint: 'Permite selecionar múltiplos itens na lista.',
4539
+ },
4540
+ {
4541
+ name: 'optionLabelKey',
4542
+ label: 'Chave do rótulo (remoto)',
4543
+ editorType: 'text',
4544
+ group: 'Dados/Opções',
4545
+ hint: 'Campo exibido quando carregado via API.',
4546
+ },
4547
+ {
4548
+ name: 'optionValueKey',
4549
+ label: 'Chave do valor (remoto)',
4550
+ editorType: 'text',
4551
+ group: 'Dados/Opções',
4552
+ hint: 'Campo salvo como value vindo da API.',
4553
+ },
4554
+ // 3) Fonte Remota
4555
+ { name: 'resourcePath', label: 'Resource Path', editorType: 'text', group: 'Fonte Remota' },
4556
+ {
4557
+ name: 'loadOn',
4558
+ label: 'Carregar em',
4559
+ editorType: 'select',
4560
+ group: 'Fonte Remota',
4561
+ options: [
4562
+ { value: 'init', text: 'Na inicialização (padrão)' },
4563
+ { value: 'none', text: 'Nenhum (manual)' },
4564
+ ],
4565
+ hint: 'Define quando o componente carrega opções remotas.',
4566
+ },
4567
+ {
4568
+ name: 'filterCriteria',
4569
+ label: 'Critérios de filtro (JSON)',
4570
+ editorType: 'textarea',
4571
+ group: 'Fonte Remota',
4572
+ hint: '{ "active": true }',
4573
+ },
4574
+ {
4575
+ name: 'dependencyFields',
4576
+ label: 'Campos dependentes (CSV ou JSON)',
4577
+ editorType: 'text',
4578
+ group: 'Fonte Remota',
4579
+ hint: 'Ex.: organizationId,departmentId',
4580
+ },
4581
+ {
4582
+ name: 'resetOnDependentChange',
4583
+ label: 'Resetar ao mudar dependentes',
4584
+ editorType: 'checkbox',
4585
+ group: 'Fonte Remota',
4586
+ },
4587
+ {
4588
+ name: 'enableDependencyCascade',
4589
+ label: 'Habilitar cascata nativa',
4590
+ editorType: 'checkbox',
4591
+ group: 'Fonte Remota',
4592
+ },
4593
+ {
4594
+ name: 'dependencyFilterMap',
4595
+ label: 'Mapeamento de filtros (JSON)',
4596
+ editorType: 'textarea',
4597
+ group: 'Fonte Remota',
4598
+ },
4599
+ // 4) Formato/Comportamento
4600
+ {
4601
+ name: 'selectAll',
4602
+ label: 'Selecionar todos',
4603
+ editorType: 'checkbox',
4604
+ group: 'Formato/Comportamento',
4605
+ row: 'comp.inline1',
4606
+ inline: true,
4607
+ hint: 'Exibe opção para selecionar tudo (somente multiple=true).',
4608
+ },
4609
+ {
4610
+ name: 'searchable',
4611
+ label: 'Buscável',
4612
+ editorType: 'checkbox',
4613
+ group: 'Formato/Comportamento',
4614
+ row: 'comp.inline1',
4615
+ inline: true,
4616
+ },
4617
+ {
4618
+ name: 'maxSelections',
4619
+ label: 'Máximo de seleções',
4620
+ editorType: 'number',
4621
+ group: 'Formato/Comportamento',
4622
+ hint: 'Limite máximo de itens quando multiple=true.',
4623
+ },
4624
+ {
4625
+ name: 'readonly',
4626
+ label: 'Somente leitura',
4627
+ editorType: 'checkbox',
4628
+ group: 'Formato/Comportamento',
4629
+ row: 'comp.inline2',
4630
+ inline: true,
4631
+ },
4632
+ {
4633
+ name: 'disabled',
4634
+ label: 'Desabilitado',
4635
+ editorType: 'checkbox',
4636
+ group: 'Formato/Comportamento',
4637
+ row: 'comp.inline2',
4638
+ inline: true,
4639
+ },
4640
+ // 5) Validação
4641
+ { name: 'required', label: 'Obrigatório', editorType: 'checkbox', group: 'Validação' },
4642
+ { name: 'validators.requiredMessage', label: 'Mensagem: obrigatório', editorType: 'text', group: 'Validação' },
4643
+ // 6) Ações (Clear)
4644
+ {
4645
+ name: 'clearButton.enabled',
4646
+ label: 'Clear: habilitar',
4647
+ editorType: 'checkbox',
4648
+ group: 'Ações',
4649
+ row: 'clear.inline1',
4650
+ inline: true,
4651
+ },
4652
+ {
4653
+ name: 'clearButton.showOnlyWhenFilled',
4654
+ label: 'Clear: só quando preenchido',
4655
+ editorType: 'checkbox',
4656
+ group: 'Ações',
4657
+ row: 'clear.inline1',
4658
+ inline: true,
4659
+ },
4660
+ {
4661
+ name: 'clearButton.icon',
4662
+ label: 'Clear: ícone',
4663
+ editorType: 'text',
4664
+ group: 'Ações',
4665
+ row: 'clear.inline2',
4666
+ },
4667
+ {
4668
+ name: 'clearButton.iconColor',
4669
+ label: 'Clear: cor do ícone',
4670
+ editorType: 'color',
4671
+ group: 'Ações',
4672
+ row: 'clear.inline2',
4673
+ },
4674
+ {
4675
+ name: 'clearButton.tooltip',
4676
+ label: 'Clear: tooltip',
4677
+ editorType: 'text',
4678
+ group: 'Ações',
4679
+ row: 'clear.inline2',
4680
+ },
4681
+ {
4682
+ name: 'clearButton.ariaLabel',
4683
+ label: 'Clear: aria-label',
4684
+ editorType: 'text',
4685
+ group: 'Ações',
4686
+ row: 'clear.inline2',
4687
+ },
4688
+ ];
4689
+
4514
4690
  function cloneProperty$7(prop) {
4515
4691
  return {
4516
4692
  ...prop,
@@ -12591,9 +12767,10 @@ class FieldMetadataEditorComponent {
12591
12767
  controlType === FieldControlType.MULTI_SELECT ||
12592
12768
  controlType === FieldControlType.SEARCHABLE_SELECT ||
12593
12769
  controlType === FieldControlType.ASYNC_SELECT ||
12594
- controlType === FieldControlType.AUTO_COMPLETE ||
12595
- controlType === FieldControlType.SELECTION_LIST)
12770
+ controlType === FieldControlType.AUTO_COMPLETE)
12596
12771
  return selectProperties;
12772
+ if (controlType === FieldControlType.SELECTION_LIST)
12773
+ return selectionListProperties;
12597
12774
  if (controlType === FieldControlType.ENTITY_LOOKUP)
12598
12775
  return entityLookupProperties;
12599
12776
  if (controlType === FieldControlType.TEXTAREA)
@@ -12756,11 +12933,14 @@ class FieldMetadataEditorComponent {
12756
12933
  this.controlType === FieldControlType.MULTI_SELECT ||
12757
12934
  this.controlType === FieldControlType.SEARCHABLE_SELECT ||
12758
12935
  this.controlType === FieldControlType.ASYNC_SELECT ||
12759
- this.controlType === FieldControlType.AUTO_COMPLETE ||
12760
- this.controlType === FieldControlType.SELECTION_LIST) {
12936
+ this.controlType === FieldControlType.AUTO_COMPLETE) {
12761
12937
  this.registry.register(this.controlType, selectProperties);
12762
12938
  props = selectProperties;
12763
12939
  }
12940
+ else if (this.controlType === FieldControlType.SELECTION_LIST) {
12941
+ this.registry.register(this.controlType, selectionListProperties);
12942
+ props = selectionListProperties;
12943
+ }
12764
12944
  else if (this.controlType === FieldControlType.ENTITY_LOOKUP) {
12765
12945
  this.registry.register(this.controlType, entityLookupProperties);
12766
12946
  props = entityLookupProperties;
@@ -12862,6 +13042,20 @@ class FieldMetadataEditorComponent {
12862
13042
  } })();
12863
13043
  this.normalizedProps = this.normalizedProps.map((p) => p.name === 'providerOptions' && p.defaultValue === undefined ? { ...p, defaultValue: v } : p);
12864
13044
  }
13045
+ // Hydrate canonical options from legacy listOptions when opening a SELECTION_LIST config.
13046
+ const seedListOptions = this.seed?.listOptions;
13047
+ const optionsProp = this.normalizedProps.find((p) => p.name === 'options');
13048
+ if (this.controlType === FieldControlType.SELECTION_LIST &&
13049
+ optionsProp &&
13050
+ seedOptions === undefined &&
13051
+ Array.isArray(seedListOptions)) {
13052
+ const hydrated = this.toEditorControlValue(optionsProp, seedListOptions);
13053
+ if (hydrated !== undefined && hydrated !== null) {
13054
+ this.normalizedProps = this.normalizedProps.map((p) => p.name === 'options' && p.defaultValue === undefined
13055
+ ? { ...p, defaultValue: hydrated }
13056
+ : p);
13057
+ }
13058
+ }
12865
13059
  }
12866
13060
  catch { }
12867
13061
  this.renderedProps = this.buildRenderedProps(this.normalizedProps);
@@ -13072,11 +13266,7 @@ class FieldMetadataEditorComponent {
13072
13266
  const raw = this.factory.extractPatch(this.form);
13073
13267
  const patch = this.buildDeltaPatch(raw, this.initialSnapshot);
13074
13268
  this.normalizeKnownTextareaPatchValues(patch);
13075
- // Map editor-friendly 'providerOptions' back to canonical 'options'
13076
- if (patch && patch.providerOptions !== undefined && patch.options === undefined) {
13077
- patch.options = patch.providerOptions;
13078
- delete patch.providerOptions;
13079
- }
13269
+ this.finalizeExtractedOptionsPatch(patch);
13080
13270
  // Sempre incluir controlType no patch quando presente
13081
13271
  patch.controlType = this.controlType;
13082
13272
  try {
@@ -13096,12 +13286,22 @@ class FieldMetadataEditorComponent {
13096
13286
  const raw = this.factory.extractPatch(this.form);
13097
13287
  const patch = this.buildDeltaPatch(raw, this.initialSnapshot);
13098
13288
  this.normalizeKnownTextareaPatchValues(patch);
13289
+ this.finalizeExtractedOptionsPatch(patch);
13290
+ patch.controlType = this.controlType;
13291
+ return patch;
13292
+ }
13293
+ finalizeExtractedOptionsPatch(patch) {
13294
+ // Map editor-friendly 'providerOptions' back to canonical 'options'
13099
13295
  if (patch && patch.providerOptions !== undefined && patch.options === undefined) {
13100
13296
  patch.options = patch.providerOptions;
13101
13297
  delete patch.providerOptions;
13102
13298
  }
13103
- patch.controlType = this.controlType;
13104
- return patch;
13299
+ if (this.controlType === FieldControlType.SELECTION_LIST &&
13300
+ patch &&
13301
+ patch.options !== undefined &&
13302
+ this.seed?.listOptions !== undefined) {
13303
+ patch.listOptions = null;
13304
+ }
13105
13305
  }
13106
13306
  /**
13107
13307
  * Constrói um patch delta a partir do valor atual do form, removendo
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@praxisui/metadata-editor",
3
- "version": "10.0.0-rc.60",
3
+ "version": "10.0.0-rc.61",
4
4
  "description": "Metadata editor for Praxis UI fields and components with runtime integration.",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^21.0.0",
@@ -8,10 +8,10 @@
8
8
  "@angular/cdk": "^21.0.0",
9
9
  "@angular/forms": "^21.0.0",
10
10
  "@angular/material": "^21.0.0",
11
- "@praxisui/ai": "^10.0.0-rc.60",
12
- "@praxisui/core": "^10.0.0-rc.60",
13
- "@praxisui/dynamic-fields": "^10.0.0-rc.60",
14
- "@praxisui/settings-panel": "^10.0.0-rc.60",
11
+ "@praxisui/ai": "^10.0.0-rc.61",
12
+ "@praxisui/core": "^10.0.0-rc.61",
13
+ "@praxisui/dynamic-fields": "^10.0.0-rc.61",
14
+ "@praxisui/settings-panel": "^10.0.0-rc.61",
15
15
  "rxjs": "~7.8.0"
16
16
  },
17
17
  "dependencies": {
@@ -193,6 +193,7 @@ declare class FieldMetadataEditorComponent implements OnInit {
193
193
  apply(): void;
194
194
  onSave(): Partial<FieldDefinition> | undefined;
195
195
  getSettingsValue(): Partial<FieldDefinition>;
196
+ private finalizeExtractedOptionsPatch;
196
197
  /**
197
198
  * Constrói um patch delta a partir do valor atual do form, removendo
198
199
  * chaves não alteradas.