buildField method presentation ✓ 100.0%

Last updated: 2026-03-04T23:21:38.386Z

Metrics

LOC: 27 Complexity: 3 Params: 1 Coverage: 100.0% (6/6 lines, 0x executed)

Signature

buildField(wrapper: HTMLElement): : FormField

Source Code

  buildField(wrapper: HTMLElement): FormField {
    // Old antd v5 uses .ant-select-selection-placeholder; new CSS-var structure uses .ant-select-placeholder
    const placeholder = (
      wrapper.querySelector<HTMLElement>(".ant-select-selection-placeholder") ??
      wrapper.querySelector<HTMLElement>(".ant-select-placeholder")
    )?.textContent?.trim();

    const isMultiple = wrapper.classList.contains("ant-select-multiple");
    const options = extractDropdownOptions(wrapper);

    const field: FormField = {
      element: wrapper,
      selector: getAntdSelector(wrapper),
      category: "unknown",
      fieldType: isMultiple ? "multiselect" : "select",
      adapterName: "antd-select",
      label: findAntLabel(wrapper),
      name: findAntName(wrapper),
      id: findAntId(wrapper),
      placeholder,
      required: isAntRequired(wrapper),
      options,
    };

    field.contextSignals = buildSignals(field);
    return field;
  },

Dependencies (Outgoing)

graph LR buildField["buildField"] extractDropdownOptions["extractDropdownOptions"] getAntdSelector["getAntdSelector"] findAntLabel["findAntLabel"] findAntName["findAntName"] findAntId["findAntId"] isAntRequired["isAntRequired"] buildField -->|calls| extractDropdownOptions buildField -->|calls| getAntdSelector buildField -->|calls| findAntLabel buildField -->|calls| findAntName buildField -->|calls| findAntId buildField -->|calls| isAntRequired style buildField fill:#dbeafe,stroke:#2563eb,stroke-width:2px click buildField "455296e8c1fe68f0.html" click extractDropdownOptions "591c745dfe181710.html" click getAntdSelector "707eae1ed4437c8e.html" click findAntLabel "4446526a4a01afd7.html" click findAntName "5e51cc1f95724859.html" click findAntId "5d7c366d4d585434.html" click isAntRequired "909385c51f5eb930.html"

No incoming dependencies.