UNPKG

watercolor-ui

Version:

A modern minimalist cross-framework component library

182 lines 5.47 kB
/** * 格式化价格显示 * @param {number|string} price - 价格 * @param {Object} options - 格式化选项 * @returns {string} 格式化后的价格字符串 */ export function formatPrice(price: number | string, options?: Object): string; /** * 格式化价格周期 * @param {string} period - 计费周期 * @param {string} locale - 语言环境 * @returns {string} 格式化后的周期字符串 */ export function formatPeriod(period: string, locale?: string): string; /** * 计算折扣价格 * @param {number} originalPrice - 原价 * @param {number} discount - 折扣(0-1 或 百分比) * @returns {number} 折扣后价格 */ export function calculateDiscountPrice(originalPrice: number, discount: number): number; /** * 验证价格计划数据 * @param {Object} plan - 价格计划对象 * @returns {Object} 验证结果 */ export function validatePlan(plan: Object): Object; /** * 验证价格计划数组 * @param {Array} plans - 价格计划数组 * @returns {Object} 验证结果 */ export function validatePlans(plans: any[]): Object; /** * 生成价格表格容器类名 * @param {Object} options - 选项 * @returns {string} 类名字符串 */ export function getPricingGridClasses(options?: Object): string; /** * 生成计划卡片类名 * @param {Object} options - 选项 * @returns {string} 类名字符串 */ export function getPlanCardClasses(options?: Object): string; /** * 生成按钮类名 * @param {Object} options - 选项 * @returns {string} 类名字符串 */ export function getPlanButtonClasses(options?: Object): string; /** * 比较两个价格计划 * @param {Object} plan1 - 计划1 * @param {Object} plan2 - 计划2 * @returns {Object} 比较结果 */ export function comparePlans(plan1: Object, plan2: Object): Object; /** * 找到最受欢迎的计划 * @param {Array} plans - 价格计划数组 * @returns {Object|null} 最受欢迎的计划 */ export function findPopularPlan(plans: any[]): Object | null; /** * 找到最便宜的计划 * @param {Array} plans - 价格计划数组 * @returns {Object|null} 最便宜的计划 */ export function findCheapestPlan(plans: any[]): Object | null; /** * 找到最贵的计划 * @param {Array} plans - 价格计划数组 * @returns {Object|null} 最贵的计划 */ export function findMostExpensivePlan(plans: any[]): Object | null; /** * 排序价格计划 * @param {Array} plans - 价格计划数组 * @param {string} sortBy - 排序字段 ('price', 'name', 'features') * @param {string} order - 排序顺序 ('asc', 'desc') * @returns {Array} 排序后的计划数组 */ export function sortPlans(plans: any[], sortBy?: string, order?: string): any[]; /** * 过滤价格计划 * @param {Array} plans - 价格计划数组 * @param {Object} filters - 过滤条件 * @returns {Array} 过滤后的计划数组 */ export function filterPlans(plans: any[], filters?: Object): any[]; /** * 生成可访问性属性 * @param {Object} plan - 价格计划 * @param {number} index - 计划索引 * @returns {Object} 可访问性属性 */ export function getAccessibilityProps(plan: Object, index: number): Object; /** * 防抖函数 * @param {Function} func - 要防抖的函数 * @param {number} wait - 等待时间(毫秒) * @returns {Function} 防抖后的函数 */ export function debounce(func: Function, wait: number): Function; /** * 节流函数 * @param {Function} func - 要节流的函数 * @param {number} limit - 限制时间(毫秒) * @returns {Function} 节流后的函数 */ export function throttle(func: Function, limit: number): Function; /** * 调试价格计划数据 * @param {Array} plans - 价格计划数组 * @returns {Object} 调试信息 */ export function debugPlans(plans: any[]): Object; export namespace PRICING_VARIANTS { let STANDARD: string; let OUTLINED: string; let FILLED: string; let MINIMAL: string; let ELEVATED: string; let GRADIENT: string; let ANIMATED: string; } export namespace PRICING_SIZES { let SM: string; let MD: string; let LG: string; let XL: string; } export namespace BUTTON_VARIANTS { export let PRIMARY: string; let OUTLINED_1: string; export { OUTLINED_1 as OUTLINED }; export let GHOST: string; export let SECONDARY: string; } export namespace CURRENCY_SYMBOLS { let USD: string; let EUR: string; let GBP: string; let JPY: string; let CNY: string; let KRW: string; } export namespace BILLING_PERIODS { let MONTHLY: string; let YEARLY: string; let WEEKLY: string; let DAILY: string; let LIFETIME: string; } declare namespace _default { export { PRICING_VARIANTS }; export { PRICING_SIZES }; export { BUTTON_VARIANTS }; export { CURRENCY_SYMBOLS }; export { BILLING_PERIODS }; export { formatPrice }; export { formatPeriod }; export { calculateDiscountPrice }; export { validatePlan }; export { validatePlans }; export { getPricingGridClasses }; export { getPlanCardClasses }; export { getPlanButtonClasses }; export { comparePlans }; export { findPopularPlan }; export { findCheapestPlan }; export { findMostExpensivePlan }; export { sortPlans }; export { filterPlans }; export { getAccessibilityProps }; export { debounce }; export { throttle }; export { debugPlans }; } export default _default; //# sourceMappingURL=utils.d.ts.map