Skip to content

ProConfigProvider ​

Every Pro component inherits its nearest Antdv Next ConfigProvider: locale, theme algorithms, global tokens, native component tokens, prefix, direction, size, disabled state and popup container. ProConfigProvider adds Pro translations, custom value types and local Pro token overrides.

vue
<script setup lang="ts">
import { ConfigProvider, Switch, theme } from 'antdv-next'
import enUS from 'antdv-next/locale/en_US'
import zhCN from 'antdv-next/locale/zh_CN'
import { computed, ref } from 'vue'
import {
  ProCard,
  ProConfigProvider,
  ProField,
  ProForm,
  ProFormText,
} from '@bubblesjs/antv-next-pro'

const english = ref(false)
const dark = ref(false)
const accent = ref(false)
const nativeTheme = computed(() => ({
  algorithm: [theme.compactAlgorithm, dark.value ? theme.darkAlgorithm : theme.defaultAlgorithm],
  token: { colorPrimary: accent.value ? '#722ed1' : '#1677ff' },
  components: { Card: { headerFontSize: 20 } },
}))
</script>

<template>
  <div style="display: flex; gap: 16px; margin-block-end: 16px; flex-wrap: wrap">
    <label>English <Switch v-model:checked="english" /></label>
    <label>Dark <Switch v-model:checked="dark" /></label>
    <label>Purple <Switch v-model:checked="accent" /></label>
  </div>
  <ConfigProvider :locale="english ? enUS : zhCN" :theme="nativeTheme" prefix-cls="demo">
    <ProConfigProvider :token="{ colorTextSecondary: '#9254de' }">
      <ProCard title="ConfigProvider → ProConfigProvider">
        <p><ProField value-type="switch" :text="true" /></p>
        <ProForm>
          <ProFormText name="title" :label="english ? 'Title' : '标题'" />
        </ProForm>
      </ProCard>
    </ProConfigProvider>
  </ConfigProvider>
</template>

Configuration ​

TargetEntry
Global tokens and algorithmsConfigProvider.theme.token / algorithm
Native component tokensConfigProvider.theme.components.Card/Result/...
Pro custom areasProConfigProvider.token
Pro translationsProConfigProvider.intl
Custom value typesProConfigProvider.valueTypeMap

theme.components.Result customizes native Result. The native components map does not add ProTable or ProCard keys; use the Pro provider for Pro token overrides.

Props ​

PropType / defaultBehavior
tokenProTokenLocal patch over resolved native tokens and ancestor Pro patches
intlIntlTypeExplicit local → explicit ancestor → nearest native locale → Chinese
valueTypeMapProValueTypeMapInherit by name; replace the entire matching definition; preserve other names
prefixClsstringPro namespace; ant-pro by default or demo-pro under native prefix demo
darkoptional booleanAdd dark algorithm while preserving compact; inherit when omitted
hashedoptional booleanInherit or override native hash class configuration
contentHashstringVersion component of request cache keys
autoClearCachefalseClear only this provider's owned cache on unmount
needDepsfalseReuse the parent cache when no explicit overrides are supplied

ProProvider aliases the Vue provider component. useProConfig(), useIntl() and useProPrefix() expose reactive refs for setup consumers.

Internationalization ​

All 34 baseline locale packs are exported through intlMap, intlMapKeys and named entries such as enUSIntl. Native locale matching accepts case variants, underscores, hyphens and language prefixes. Missing messages fall back to Chinese, then the caller's default. An explicit empty string remains empty.

ts
import { createIntl } from '@bubblesjs/antv-next-pro'
const intl = createIntl('en-US', { tableForm: { search: 'Find', reset: 'Clear' } })

Pro search/edit/form actions, boolean fields, captcha and upload text use this context. Native date panels, pagination and validation use Antdv Next locale packs. Newly added upload translations are supplied in Chinese and English; missing entries in other baseline languages use the documented fallback.

Tokens consumed by rendered components ​

The following Pro tokens have rendered consumers. Native components separately resolve their own component tokens. Inheriting the GlobalToken type does not imply that every native token controls a Pro custom area.

TokenRendered consumers
colorTextField root, Table, forms, List, FieldLabel, DropdownFooter
colorTextSecondaryCard subtitle/tooltip, Table secondary text, LabelIconTip
colorPrimaryCard selection outline, selected Table column settings
colorPrimaryBgTable selection/alert area
colorBgContainerFullscreen Table, List background
colorBgElevatedTable column-settings popup, DropdownFooter
colorFillAlterTable column-settings drag hover, SchemaForm list
colorBorderSecondaryCard/List dividers, DropdownFooter, Table alert
colorErrorTable edit errors
boxShadowSecondaryFilterDropdown popup
paddingLGForm Group gap, QueryFilter columns, Steps content, List rows, ListToolBar, FilterDropdown
borderRadiusLGTable popups/alert
marginField option action gap
boxShadowCard with boxShadow enabled
padding / paddingXSCard regular/small header padding fallback; explicit native Card headerPadding settings take precedence

Use classes / styles for local semantic styling.

token.layout.header/sider/pageContainer retains its types and nested merge rules. ProLayout/PageContainer are outside this implementation, so these layout fields do not currently control a rendered layout component.

Released under the MIT License