[Custom Components] Unable to update inherited editform values

Abierto
#974 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
angular, typescript
Área
frontend

Línea de trabajo

Comienza desde el punto de entrada heredado Components.components.radio.editForm y reproduce la sobrescritura personalizada de values con las versiones de Formio y Angular indicadas. Rastrea cómo se combinan las propiedades del formulario de edición padre y del hijo, y verifica después que campos como label y reorder se actualicen en el padre, mientras las sobrescrituras existentes del hijo siguen funcionando.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

question scope: community scope: custom components

Environment:

formiojs: ^4.14.1
formio/angular : ^5.3.0-rc.2
angular:13.3.11

I'm making a custom radio component, inheriting the radio editFormfrom formio, as an example below:

import { Components } from 'formiojs';

const COMPONENT_OPTIONS: FormioCustomComponentInfo = {
  type: 'custom-radio',
  selector: 'custom-radio', 
  title: 'Radio', 
  group: 'basic', 
  icon: 'stop-circle-o', 
  editForm: Components.components.radio.editForm,                <----------------------
  schema: {tableView: true},
  fieldOptions: ['key', 'label', 'values','value', 'disabled', 'validate']
};

The base code equivalent of the values ​​field is as follows:

{
              "type": "datagrid",
              "input": true,
              "label": "Values",
              "key": "values",
              "tooltip": "The radio button values that can be picked for this field. Values are text submitted with the form data. Labels are text that appears next to the radio buttons on the form.",
              "weight": 10,
              "reorder": true,
              "defaultValue": [
                {
                  "label": "",
                  "value": ""
                }
              ],
              "components": [
                {
                  "label": "Label",
                  "key": "label",
                  "input": true,
                  "type": "textfield"
                },
                {
                  "label": "Value",
                  "key": "value",
                  "input": true,
                  "type": "textfield",
                  "allowCalculateOverride": true,
                  "calculateValue": "value = _.camelCase(row.label);",
                  "validate": {
                    "required": true
                  }
                },
                {
                  "type": "select",
                  "input": true,
                  "weight": 180,
                  "label": "Shortcut",
                  "key": "shortcut",
                  "tooltip": "The shortcut key for this option.",
                  "dataSrc": "custom",
                  "valueProperty": "value",
                  "template": "{{ item.label }}",
                  "data": {}
                }
              ]
            }

In the editform of my custom component I'm doing this:

      {
        key: "values",
        label: "test", //not working
        reorder: false, //not working
        components: [
          {
            key: "shortcut",
            ignore: true, //working
          },
          {
            key: "value",
            label: "test2", //working
          }
        ],
        calculateValue(context) {
          console.log(context.value); //working
          return context.value;
        }
      }

However, no changes to the parent component (values) are reflected.
What I managed to change was the child components.
How can I modify data, such as label, reorder, among others of the parent component?

image

Lenguaje dominante
TypeScript
Estrellas
706
Forks
493
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de formio/angular

Todos los issues de formio/angular

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.