UNPKG

@aplus-frontend/ui

Version:

2 lines (1 loc) 1.29 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),i=require("./interface.js"),o=r=>r==null||typeof r=="string"&&r.trim()==="",u=(r,e={})=>typeof r=="string"||typeof r=="number"?String(r)+JSON.stringify(e):"complex-value",f=(r,e={rawValue:!0,precision:2,thousand:!0,thousandSeparator:",",currency:"CNY",percent:!1})=>{if(Object.prototype.toString.call(r)==="[object Null]"||Object.prototype.toString.call(r)==="[object Undefined]"||Object.prototype.toString.call(r)==="[object Object]"||Object.prototype.toString.call(r)==="[object Function]"||r==="")return"--";if(e.rawValue)return r;if(typeof r=="number"){if(e.percent)return`${r.toFixed(e.precision)}%`;if(e.currency)return r.toLocaleString(i.locales[e.currency?e.currency:"CNY"],{style:"currency",currency:e.currency?e.currency:"CNY"});if(e.thousand){const[n,c]=r.toFixed(e.precision?e.precision:2).split(".");return`${n.replace(/(\d)(?=(\d{3})+(?!\d))/g,`$1${e.thousandSeparator?e.thousandSeparator:","}`)}.${c}`}return r.toFixed(e.precision?e.precision:2)}return r},y=r=>t.isVNode(r)||typeof r=="function",d=r=>t.isVNode(r)?t.h(r):typeof r=="function"?t.h(r()):null;exports.convertValue=f;exports.createMemoizeKey=u;exports.isNull=o;exports.isVNodeOrFunction=y;exports.renderValue=d;