bricks/dist/docs/ja/factory.md
yumoqing 1291f7fee3 fix: UiCode build_options uses valueField/textField fallback to 'value'/'text'
When valueField/textField are not explicitly set in opts, the auto-select
logic (line 1140) and nullable empty-option creation (lines 1144-1145) used
data[0][undefined] which returned undefined, causing:
- Single-option selects to show blank (auto-select failed)
- nullable empty options to have undefined keys

Now extracts vf/tf local variables with ||'value'/||'text' fallback at the
top of build_options(), used consistently throughout.
2026-05-29 23:03:52 +08:00

22 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Factory_
## コントロール機能
`Factory_` は、コントロール(またはコンポーネント)の登録と取得を行うためのファクトリクラスであり、グローバルに一意なコントロールの登録および管理機構を提供します。このクラスを使用することで、カスタムコントロールを動的に登録し、必要に応じて名前によって対応するコントロールのコンストラクタまたはクラスを取得できます。
- **タイプ**:通常のコントロール(ユーティリティクラス/マネージャー)
- **親クラスコントロール**なしネイティブJavaScriptクラス
## 初期化パラメータ
- 明示的な外部引数を受け取らないコンストラクタ。
- 内部初期化時に `widgets_kv` オブジェクトを作成し、登録されたコントロールのマッピングテーブルを格納する:
- 初期状態では予約済みキー `_t_`(値は `1`)を含み、これはバージョン識別や存在チェックに使用される可能性がある。
## 主なイベント
- 当該コントロールはUIイベントを発生させない。
- 以下のメソッドを主要な動作インターフェースとして提供:
- `register(name: string, widget: function/class)`
指定された名前 `name` をコントロールクラス/関数 `widget` に関連付けて登録する。
- `get(name: string): function/class | null`
名前をもとに登録済みのコントロールを検索し、存在しない場合は `null` を返す。
> 注:このコントロールは通常、基盤インフラとして使用され、`bricks` フレームワークがすべてのビジュアルコントロールやビジネスコンポーネントのライフサイクルおよびアクセスエントリポイントを統一して管理するために利用されます。