[Custom Components] Unable to update inherited editform values

オープン
#974 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
angular, typescript
領域
frontend

調査の方向性

継承された Components.components.radio.editForm エントリポイントから始め、記載された Formio および Angular のバージョンでカスタムの values オーバーライドを再現します。親と子の edit-form プロパティがどのようにマージされるかを追跡し、そのうえで label や reorder などのフィールドが親で更新され、既存の子のオーバーライドが引き続き機能することを確認します。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
TypeScript
スター
706
フォーク
493
PR マージ指標
30日以内にマージされた PR はありません

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

formio/angular のほかの issue

formio/angular の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。