@origen-ui/shared
v1.1.0
Published
Shared type contracts and pure utilities for @origen-ui packages (no business coupling)
Readme
@origen-ui/shared
formatThousands and formatPercent default to zh-CN and accept an optional final Intl locale argument.
跨包共享的类型契约与纯工具函数,零运行时依赖,是所有 @origen-ui/* 包的公共底座。
- 类型:
ApiResponse<T>/PageResult<T>/PageParams/UnknownRecord/SelectOption/SearchField<T>/SearchConfig<T>/FormActionExpose等 - 工具:
formatThousands(千分位)、formatPercent(百分比)格式化纯函数
import type { PageParams, PageResult, SelectOption } from '@origen-ui/shared'
import { formatThousands, formatPercent } from '@origen-ui/shared'红线:本包永远不 import 组件、框架或业务模块。
Numeric and language boundaries
formatThousands and formatPercent return '-' only for nullish, empty,
or NaN input. Finite-number validation is intentionally not imposed here:
Infinity is passed to Intl.NumberFormat and rendered according to the
selected locale. Applications own business bounds and invalid-value policy.
defineOrigenUiLanguage, mergeLocale, and validateLocaleShape are
framework-neutral language contracts. Locale merging recursively clones plain
objects, replaces arrays and opaque values, and ignores __proto__,
prototype, and constructor keys. They do not load translations, mutate a
global locale, or bridge Vue/Element Plus; those responsibilities belong to a
consumer runtime.