Skip to Content
UI playbookAPI cần biết

API you need to know

Exact for @ant-design/pro-components@2.8.10 (the manh.run runtime). Full reference: procomponents.ant.design .

ProTable

  • request(params, sort, filter) → must return { data, total, success: true }. params from the table: current, pageSize + every search field by dataIndex.
  • params={{ … }} — extra inputs; any change refetches. manualRequest to wait for the first manual search.
  • actionRef.current?.reload() after mutations; reloadAndRest() also goes back to page 1; clearSelected().
  • columnsState={{ persistenceKey: "requests", persistenceType: "localStorage" }} remembers hidden/fixed columns per user.
  • search={false} hides the query form; options={false} hides density/reload/settings icons.
  • dateFormatter="string" sends dates in search as strings (not dayjs).
  • polling (ms, ≥ 2000) for live lists.
  • Column flags: search: false, hideInTable, hideInSearch, hideInForm, hideInDescriptions, copyable, ellipsis, sorter, fixed, search.transform.

Forms

  • Field width: xs 104 · sm 216 · md 328 · lg 440 · xl 552 (px).
  • onFinish returning true closes ModalForm/DrawerForm; false/throw keeps it open.
  • Fields reset on reopen only with modalProps.destroyOnClose / drawerProps.destroyOnClose (v6 destroyOnHidden alone does not reset) — see Forms.
  • submitter={{ searchConfig: { submitText, resetText } }} to translate buttons; submitter={false} hides them; render to move them (e.g. into FooterToolbar).
  • ProFormDependency name={[…]} for conditional fields; transform on a field to reshape the submitted value; convertValue for the inverse.
  • Use renderFormItem (2.x) — formItemRender is a v3 name and does nothing here.

valueType

One valueType drives table cell, search widget, form field and description item. Supported in 2.8.10:

  • Text: text, textarea, password, code, jsonCode
  • Numbers: digit, money, percent, progress, second, rate
  • Dates: date, dateTime, dateWeek, dateMonth, dateQuarter, dateYear, dateRange, dateTimeRange, time, timeRange, fromNow
  • Choice: select, treeSelect, checkbox, radio, radioButton, switch, segmented, cascader, color
  • Media: avatar, image
  • Layout (schema forms): group, formList, formSet, divider, dependency
  • Table only: option (action column), index, indexBorder

valueType can be a function per row:

{ title: "Tiến độ", dataIndex: "pct", valueType: (r) => ({ type: "progress", status: r.late ? "exception" : "active" }) } { title: "Giá", dataIndex: "price", valueType: { type: "money", locale: "vi-VN" } }

valueEnum turns select/status columns into Badges: { pending: { text: "Chờ duyệt", status: "Processing" } } (Success, Error, Processing, Warning, Default).

Last updated on