@yelon/util 16.2.5-68d194e → 16.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,4 +5,4 @@ export const CurrencyMega_Powers = [
5
5
  { unit: 'M', value: Math.pow(10, 6) },
6
6
  { unit: 'K', value: 1000 }
7
7
  ];
8
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VycmVuY3kudHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2Zvcm1hdC9jdXJyZW5jeS50eXBlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFnRUEsTUFBTSxDQUFDLE1BQU0sbUJBQW1CLEdBQUc7SUFDakMsRUFBRSxJQUFJLEVBQUUsR0FBRyxFQUFFLEtBQUssRUFBRSxJQUFJLENBQUMsR0FBRyxDQUFDLEVBQUUsRUFBRSxFQUFFLENBQUMsRUFBRTtJQUN0QyxFQUFFLElBQUksRUFBRSxHQUFHLEVBQUUsS0FBSyxFQUFFLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxFQUFFLEVBQUUsQ0FBQyxFQUFFO0lBQ3RDLEVBQUUsSUFBSSxFQUFFLEdBQUcsRUFBRSxLQUFLLEVBQUUsSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQUFDLEVBQUU7SUFDckMsRUFBRSxJQUFJLEVBQUUsR0FBRyxFQUFFLEtBQUssRUFBRSxJQUFJLENBQUMsR0FBRyxDQUFDLEVBQUUsRUFBRSxDQUFDLENBQUMsRUFBRTtJQUNyQyxFQUFFLElBQUksRUFBRSxHQUFHLEVBQUUsS0FBSyxFQUFFLElBQUksRUFBRTtDQUMzQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHR5cGUgQ3VycmVuY3lTdGFydGluZ1VuaXQgPSAneXVhbicgfCAnY2VudCc7XG5cbmV4cG9ydCBpbn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IE1hdGgucG93KDEwLCAxNSkgfSxcbiAgeyB1bml0OiAnVCcsIHZhbHVlOiBNYXRoLnBvdygxMCwgMTIpIH0sXG4gIHsgdW5pdDogJ0InLCB2YWx1ZTogTWF0aC5wb3coMTAsIDkpIH0sXG4gIHsgdW5pdDogJ00nLCB2YWx1ZTogTWF0aC5wb3coMTAsIDYpIH0sXG4gIHsgdW5pdDogJ0snLCB2YWx1ZTogMTAwMCB9XG5dO1xuXG5leHBvcnQgaW50ZXJmYWNlIEN1cnJlbmN5TWVnYVVuaXRJMThuIHtcbiAgUTogc3RyaW5nO1xuICBUOiBzdHJpbmc7XG4gIEI6IHN0cmluZztcbiAgTTogc3RyaW5nO1xuICBLOiBzdHJpbmc7XG59XG5cbmV4cG9ydCBpbnRlcmZhY2UgQ3VycmVuY3lDTllPcHRpb25zIGV4dGVuZHMgQ3VycmVuY3lTdGFydGluZ1VuaXRPcHRpb25zIHtcbiAgLyoqXG4gICAqIFdoZXRoZXIgdG8gcmV0dXJuIHRvIHVwcGVyY2FzZSBub3RhdGlvbiwgZGVmYXVsdDogYHRydWVgXG4gICAqXG4gICAqIOaYr+WQpui/lOWbnuWkp+WGmeihqOekuuazle+8jOm7mOiupO+8mmB0cnVlYFxuICAgKi9cbiAgaW5Xb3Jkcz86IGJvb2xlYW47XG4gIC8qKlxuICAgKiBTcGVjaWZ5IG5lZ2F0aXZlIHNpZ24sIGRlZmF1bHQ6IGBuZWdhdGl2ZWBcbiAgICpcbiAgICog5oyH5a6a6LSf5pWw56ym5Y+377yM6buY6K6k77yaYOi0n2BcbiAgICovXG4gIG1pbnVzU3ltYm9sPzogc3RyaW5nO1xufVxuIl19
@@ -1 +1 @@
1
- {"version":3,"file":"format.mjs","sources":["../../../../packages/util/format/string.ts","../../../../packages/util/format/validate.ts","../../../../packages/util/format/currency.types.ts","../../../../packages/util/format/currency.service.ts","../../../../packages/util/format/format.ts"],"sourcesContent":["import { deepGet } from '@yelon/util/other';\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\n/**\n * String formatting\n *\n * 字符串格式化\n * ```\n * format('this is ${name}', { name: 'asdf' })\n * // output: this is asdf\n * format('this is ${user.name}', { user: { name: 'asdf' } }, true)\n * // output: this is asdf\n * ```\n */\nexport function format(\n str: string | null | undefined,\n obj: NzSafeAny | null | undefined,\n needDeepGet: boolean = false\n): string {\n return (str || '').replace(/\\${([^}]+)}/g, (_work: string, key: string) =>\n needDeepGet ? deepGet(obj, key.split('.'), '') : (obj || {})[key] || ''\n );\n}\n\nexport interface FormatMaskOption {\n mask: string;\n tokens?: { [key: string]: FormatMaskToken };\n}\n\nexport interface FormatMaskToken {\n pattern: RegExp;\n default?: NzSafeAny;\n transform?: (char: string) => string;\n}\n\n/**\n * Format mask\n *\n * 格式化掩码\n *\n * | 字符 | 描述 |\n * | --- | --- |\n * | `0` | 任意数字,若该位置字符不符合,则默认为 `0` 填充 |\n * | `9` | 任意数字 |\n * | `#` | 任意字符 |\n * | `U` | 转换大写 |\n * | `L` | 转换小写 |\n * | `*` | 转换为 `*` 字符 |\n *\n * ```ts\n * formatMask('123', '(###)') => (123)\n * formatMask('15900000000', '999****9999') => 159****0000\n * ```\n */\nexport function formatMask(value: string, option: string | FormatMaskOption): string {\n if (!value) {\n return '';\n }\n const opt: FormatMaskOption = {\n ...(typeof option === 'string' ? { mask: option } : option)\n };\n const tokens: { [key: string]: FormatMaskToken } = {\n '0': { pattern: /\\d/, default: '0' },\n '9': { pattern: /\\d/ },\n '#': { pattern: /[a-zA-Z0-9]/ },\n U: {\n pattern: /[a-zA-Z]/,\n transform: char => char.toLocaleUpperCase()\n },\n L: {\n pattern: /[a-zA-Z]/,\n transform: char => char.toLocaleLowerCase()\n },\n '*': {\n pattern: /.*/,\n transform: _ => `*`\n },\n ...opt.tokens\n };\n\n const splitValue = value.split('');\n return opt.mask\n .split('')\n .reduce((res, cur) => {\n const token = tokens[cur];\n if (!token) {\n res.push(cur);\n return res;\n }\n\n const value = splitValue.shift() ?? '';\n if (!token.pattern.test(value)) {\n if (token.default) res.push(token.default);\n return res;\n }\n\n if (typeof token.transform === 'function') {\n res.push(token.transform(value));\n } else {\n res.push(value);\n }\n return res;\n }, [] as string[])\n .join('');\n}\n","export const REGEX_STR = {\n num: `(([-+]?\\\\d+\\\\.\\\\d+)|([-+]?\\\\d+)|([-+]?\\\\.\\\\d+))(?:[eE]([-+]?\\\\d+))?`,\n idCard: `(^\\\\d{15}$)|(^\\\\d{17}(?:[0-9]|X)$)`,\n mobile: `^(0|\\\\+?86|17951)?1[0-9]{10}$`,\n url: `(((^https?:(?:\\/\\/)?)(?:[-;:&=\\\\+\\\\$,\\\\w]+@)?[A-Za-z0-9.-]+(?::\\\\d+)?|(?:www.|[-;:&=\\\\+\\\\$,\\\\w]+@)[A-Za-z0-9.-]+)((?:\\/[\\\\+~%\\\\/.\\\\w-_]*)?\\\\??(?:[-\\\\+=&;%@.\\\\w_]*)#?(?:[\\\\w]*))?)`,\n ip: `(?:^(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)(?:\\\\.(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)){3}$)|(?:^(?:(?:[a-fA-F\\\\d]{1,4}:){7}(?:[a-fA-F\\\\d]{1,4}|:)|(?:[a-fA-F\\\\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)(?:\\\\.(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)){3}|:[a-fA-F\\\\d]{1,4}|:)|(?:[a-fA-F\\\\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)(?:\\\\.(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)){3}|(?::[a-fA-F\\\\d]{1,4}){1,2}|:)|(?:[a-fA-F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{6})\\\\b|(?:rgb|hsl)a?\\\\([^\\\\)]*\\\\)`,\n chinese: `[\\u4e00-\\u9fa5]+`\n};\n\nfunction genRegex(str: string, flags?: string): RegExp {\n return new RegExp(`^${str}$`, flags);\n}\n\nexport const REGEX = {\n num: genRegex(REGEX_STR.num),\n idCard: genRegex(REGEX_STR.idCard, 'i'),\n mobile: genRegex(REGEX_STR.mobile),\n url: genRegex(REGEX_STR.url),\n ip: genRegex(REGEX_STR.ip),\n color: genRegex(REGEX_STR.color),\n chinese: genRegex(REGEX_STR.chinese)\n};\n\n/**\n * Wheter is number\n *\n * 是否为数字\n */\nexport function isNum(value: string | number): boolean {\n return REGEX.num.test(value.toString());\n}\n\n/**\n * Wheter is integer\n *\n * 是否为整数\n */\nexport function isInt(value: string | number): boolean {\n return isNum(value) && parseInt(value.toString(), 10).toString() === value.toString();\n}\n\n/**\n * Wheter is decimal\n *\n * 是否为小数点数值\n */\nexport function isDecimal(value: string | number): boolean {\n return isNum(value) && !isInt(value);\n}\n\n/**\n * Wheter is People's Republic of China identity card\n *\n * 是否为中华人民共和国居民身份证\n */\nexport function isIdCard(value: string): boolean {\n return REGEX.idCard.test(value);\n}\n\n/**\n * Wheter is china mobile (China)\n *\n * 是否为手机号(中国)\n */\nexport function isMobile(value: string): boolean {\n return REGEX.mobile.test(value);\n}\n\n/**\n * Wheter is url address\n *\n * 是否URL地址\n */\nexport function isUrl(url: string): boolean {\n return REGEX.url.test(url);\n}\n\n/**\n * Wheter is IPv4 address (Support v4, v6)\n *\n * 是否IP4地址(支持v4、v6)\n */\nexport function isIp(ip: string): boolean {\n return REGEX.ip.test(ip);\n}\n\n/**\n * Wheter is color\n *\n * 是否颜色代码值\n */\nexport function isColor(color: string): boolean {\n return REGEX.color.test(color);\n}\n\n/**\n * Wheter is chinese\n *\n * 是否中文\n */\nexport function isChinese(value: string): boolean {\n return REGEX.chinese.test(value);\n}\n","export type CurrencyStartingUnit = 'yuan' | 'cent';\n\nexport interface CurrencyStartingUnitOptions {\n /**\n * The starting unit of the value, `yuan` means 元, `cent` means 分, default: `yuan`\n *\n * 值的起始单位,`yuan` 元,`cent` 分,默认:`yuan`\n */\n startingUnit?: CurrencyStartingUnit;\n}\n\nexport interface CurrencyFormatOptions extends CurrencyStartingUnitOptions {\n /**\n * Using `DEFAULT_CURRENCY_CODE` when value is `true\n *\n * 是否使用 `CurrencyPipe` 来替代\n */\n useAngular?: boolean;\n /**\n * 精度,默认:`2`\n */\n precision?: number;\n /**\n * 是否忽略精度 `.0` 或 `.00` 结尾的字符,默认:`true`\n */\n ignoreZeroPrecision?: boolean;\n\n /**\n * Use anguar `currency` pipe parse when is set, pls refer to [document](https://angular.io/api/common/CurrencyPipe)\n *\n * 若指定则表示使用 Angular 自带的 `currency` 管道来解析,见[文档](https://angular.cn/api/common/CurrencyPipe)\n */\n ngCurrency?: {\n display: 'code' | 'symbol' | 'symbol-narrow';\n currencyCode?: string;\n digitsInfo?: string;\n locale?: string;\n };\n}\n\n/**\n * Large number format filter, [Document](https://ng-alain.com/util/format/en#mega)\n *\n * 大数据格式化,[文档](https://ng-alain.com/util/format/en#mega)\n */\nexport interface CurrencyMegaOptions extends CurrencyStartingUnitOptions {\n /**\n * 精度,默认:`2`\n */\n precision?: number;\n\n /**\n * 单位国际化,默认:`{Q: '京', T: '兆', B: '亿', M: '万', K: '千',}`\n */\n unitI18n?: CurrencyMegaUnitI18n;\n}\n\nexport interface CurrencyMegaResult {\n raw: number | string;\n value: string;\n unit: string;\n unitI18n: string;\n}\n\nexport const CurrencyMega_Powers = [\n { unit: 'Q', value: Math.pow(10, 15) },\n { unit: 'T', value: Math.pow(10, 12) },\n { unit: 'B', value: Math.pow(10, 9) },\n { unit: 'M', value: Math.pow(10, 6) },\n { unit: 'K', value: 1000 }\n];\n\nexport interface CurrencyMegaUnitI18n {\n Q: string;\n T: string;\n B: string;\n M: string;\n K: string;\n}\n\nexport interface CurrencyCNYOptions extends CurrencyStartingUnitOptions {\n /**\n * Whether to return to uppercase notation, default: `true`\n *\n * 是否返回大写表示法,默认:`true`\n */\n inWords?: boolean;\n /**\n * Specify negative sign, default: `negative`\n *\n * 指定负数符号,默认:`负`\n */\n minusSymbol?: string;\n}\n","import { CurrencyPipe, formatNumber } from '@angular/common';\nimport { DEFAULT_CURRENCY_CODE, Inject, Injectable, LOCALE_ID } from '@angular/core';\n\nimport { YunzaiConfigService, YunzaiUtilCurrencyConfig } from '@yelon/util/config';\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\nimport {\n CurrencyCNYOptions,\n CurrencyFormatOptions,\n CurrencyMegaOptions,\n CurrencyMegaResult,\n CurrencyMega_Powers\n} from './currency.types';\n\n@Injectable({ providedIn: 'root' })\nexport class CurrencyService {\n private c: YunzaiUtilCurrencyConfig;\n private readonly currencyPipe: CurrencyPipe;\n\n constructor(\n cog: YunzaiConfigService,\n @Inject(LOCALE_ID) private locale: string,\n @Inject(DEFAULT_CURRENCY_CODE) _defaultCurrencyCode: string = 'USD'\n ) {\n this.currencyPipe = new CurrencyPipe(locale, _defaultCurrencyCode);\n this.c = cog.merge('utilCurrency', {\n startingUnit: 'yuan',\n megaUnit: { Q: '京', T: '兆', B: '亿', M: '万', K: '千' },\n precision: 2,\n ignoreZeroPrecision: true\n })!;\n }\n\n /**\n * Format a number with commas as thousands separators\n *\n * 格式化货币,用逗号将数字格式化为千位分隔符\n * ```ts\n * 10000 => `10,000`\n * 10000.567 => `10,000.57`\n * ```\n */\n format(value: number | string, options?: CurrencyFormatOptions): string {\n options = {\n startingUnit: this.c.startingUnit,\n precision: this.c.precision,\n ignoreZeroPrecision: this.c.ignoreZeroPrecision,\n ngCurrency: this.c.ngCurrency,\n ...options\n };\n let truthValue = Number(value);\n if (value == null || isNaN(truthValue)) {\n return '';\n }\n if (options.startingUnit === 'cent') {\n truthValue = truthValue / 100;\n }\n if (options.ngCurrency != null) {\n const cur = options.ngCurrency!;\n return this.currencyPipe.transform(\n truthValue,\n cur.currencyCode,\n cur.display,\n cur.digitsInfo,\n cur.locale || this.locale\n )!;\n }\n const res = formatNumber(\n truthValue,\n this.locale,\n `.${options.ignoreZeroPrecision ? 1 : options.precision}-${options.precision}`\n );\n return options.ignoreZeroPrecision ? res.replace(/(?:\\.[0]+)$/g, '') : res;\n }\n\n /**\n * Large number format filter\n *\n * 大数据格式化\n * ```ts\n * 1000 => { value: '1', unit: 'K', unitI18n: '千' }\n * 12456 => { value: '12.46', unit: 'K', unitI18n: '千' }\n * ```\n */\n mega(value: number | string, options?: CurrencyMegaOptions): CurrencyMegaResult {\n options = { precision: this.c.precision, unitI18n: this.c.megaUnit, startingUnit: this.c.startingUnit, ...options };\n let num = Number(value);\n const res: CurrencyMegaResult = { raw: value, value: '', unit: '', unitI18n: '' };\n if (isNaN(num) || num === 0) {\n res.value = value.toString();\n return res;\n }\n if (options.startingUnit === 'cent') {\n num = num / 100;\n }\n let abs = Math.abs(+num);\n const rounder = Math.pow(10, options.precision!);\n const isNegative = num < 0;\n for (const p of CurrencyMega_Powers) {\n let reduced = abs / p.value;\n\n reduced = Math.round(reduced * rounder) / rounder;\n\n if (reduced >= 1) {\n abs = reduced;\n res.unit = p.unit;\n break;\n }\n }\n\n res.value = (isNegative ? '-' : '') + abs;\n res.unitI18n = (options.unitI18n as { [key: string]: NzSafeAny })[res.unit];\n return res;\n }\n\n /**\n * Converted into RMB notation.\n *\n * 转化成人民币表示法\n */\n cny(value: number | string, options?: CurrencyCNYOptions): string {\n options = {\n inWords: true,\n minusSymbol: '负',\n startingUnit: this.c.startingUnit,\n ...options\n };\n\n value = Number(value);\n if (isNaN(value)) {\n return '';\n }\n if (options.startingUnit === 'cent') {\n value = value / 100;\n }\n value = value.toString();\n let integer: number | string;\n let decimal: number | string | null;\n [integer, decimal] = value.split('.');\n let symbol = '';\n if (integer.startsWith('-')) {\n symbol = options.minusSymbol!;\n integer = integer.substring(1);\n }\n if (/^-?\\d+$/.test(value)) {\n decimal = null;\n }\n integer = (+integer).toString();\n const inWords = options.inWords;\n const unit: { [key: string]: string[] } = {\n num: inWords\n ? ['', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖', '点']\n : ['', '一', '二', '三', '四', '五', '六', '七', '八', '九', '点'],\n radice: inWords\n ? [\n '',\n '拾',\n '佰',\n '仟',\n '万',\n '拾',\n '佰',\n '仟',\n '亿',\n '拾',\n '佰',\n '仟',\n '万亿',\n '拾',\n '佰',\n '仟',\n '兆',\n '拾',\n '佰',\n '仟'\n ]\n : [\n '',\n '十',\n '百',\n '千',\n '万',\n '十',\n '百',\n '千',\n '亿',\n '十',\n '百',\n '千',\n '万亿',\n '十',\n '百',\n '千',\n '兆',\n '十',\n '百',\n '千'\n ],\n dec: ['角', '分', '厘', '毫']\n };\n if (inWords) {\n value = (+value).toFixed(5).toString();\n }\n let integerRes = '';\n const integerCount = integer.length;\n if (integer === '0' || integerCount === 0) {\n integerRes = '零';\n } else {\n let cnDesc = '';\n for (let i = 0; i < integerCount; i++) {\n const n = +integer[i];\n const j = integerCount - i - 1;\n const isZero = i > 1 && n !== 0 && integer[i - 1] === '0';\n const cnZero = isZero ? '零' : '';\n const isEmpptyUnit = (n === 0 && j % 4 !== 0) || integer.substring(i - 3, i - 3 + 4) === '0000';\n const descMark = cnDesc;\n let cnNum = unit.num[n];\n\n cnDesc = isEmpptyUnit ? '' : unit.radice[j];\n // 第一位是一十\n if (i === 0 && cnNum === '一' && cnDesc === '十') cnNum = '';\n const isChangeEr =\n n > 1 &&\n cnNum === '二' && // 去除首位\n ['', '十', '百'].indexOf(cnDesc) === -1 && // 不读两\\两十\\两百\n descMark !== '十'; // 不读十两\n if (isChangeEr) cnNum = '两';\n integerRes += cnZero + cnNum + cnDesc;\n }\n }\n\n // 小数部分拼接\n let decimalRes = '';\n const decimalCount = decimal ? decimal.toString().length : 0;\n if (decimal === null) {\n decimalRes = inWords ? '整' : '';\n } else if (decimal === '0') {\n decimalRes = '零';\n } else {\n for (let i = 0; i < decimalCount; i++) {\n if (inWords && i > unit.dec.length - 1) break;\n const n = decimal[i];\n const cnZero = n === '0' ? '零' : '';\n const cnNum = unit.num[+n];\n const cnDesc = inWords ? unit.dec[i] : '';\n decimalRes += cnZero + cnNum + cnDesc;\n }\n }\n const ret =\n symbol +\n (inWords\n ? integerRes + (decimalRes === '零' ? '元整' : `元${decimalRes}`)\n : integerRes + (decimalRes === '' ? '' : `点${decimalRes}`));\n return ret;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAGA;;;;;;;;;;AAUG;AACG,SAAU,MAAM,CACpB,GAA8B,EAC9B,GAAiC,EACjC,cAAuB,KAAK,EAAA;IAE5B,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC,KAAa,EAAE,GAAW,KACpE,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE,GAAG,CAAC,IAAI,EAAE,CACxE,CAAC;AACJ,CAAC;AAaD;;;;;;;;;;;;;;;;;;AAkBG;AACa,SAAA,UAAU,CAAC,KAAa,EAAE,MAAiC,EAAA;IACzE,IAAI,CAAC,KAAK,EAAE;AACV,QAAA,OAAO,EAAE,CAAC;AACX,KAAA;AACD,IAAA,MAAM,GAAG,GAAqB;AAC5B,QAAA,IAAI,OAAO,MAAM,KAAK,QAAQ,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;KAC5D,CAAC;AACF,IAAA,MAAM,MAAM,GAAuC;QACjD,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE;AACpC,QAAA,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;AACtB,QAAA,GAAG,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;AAC/B,QAAA,CAAC,EAAE;AACD,YAAA,OAAO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AAC7D,kBAAE,UAAU,IAAI,UAAU,KAAK,EAAE,GAAG,EAAE,GAAG,CAAA,CAAA,EAAI,UAAU,CAAE,CAAA,CAAC,CAAC,CAAC;AAChE,QAAA,OAAO,GAAG,CAAC;KACZ;8GA/OU,eAAe,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,mBAAA,EAAA,EAAA,EAAA,KAAA,EAMhB,SAAS,EAAA,EAAA,EAAA,KAAA,EACT,qBAAqB,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;AAPpB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,cADF,MAAM,EAAA,CAAA,CAAA,EAAA;;2FACnB,eAAe,EAAA,UAAA,EAAA,CAAA;kBAD3B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;;0BAO7B,MAAM;2BAAC,SAAS,CAAA;;0BAChB,MAAM;2BAAC,qBAAqB,CAAA;;;ACtBjC;;AAEG;;;;"}
1
+ {"version":3,"file":"format.mjs","sources":["../../../../packages/util/format/string.ts","../../../../packages/util/format/validate.ts","../../../../packages/util/format/currency.types.ts","../../../../packages/util/format/currency.service.ts","../../../../packages/util/format/format.ts"],"sourcesContent":["import { deepGet } from '@yelon/util/other';\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\n/**\n * String formatting\n *\n * 字符串格式化\n * ```\n * format('this is ${name}', { name: 'asdf' })\n * // output: this is asdf\n * format('this is ${user.name}', { user: { name: 'asdf' } }, true)\n * // output: this is asdf\n * ```\n */\nexport function format(\n str: string | null | undefined,\n obj: NzSafeAny | null | undefined,\n needDeepGet: boolean = false\n): string {\n return (str || '').replace(/\\${([^}]+)}/g, (_work: string, key: string) =>\n needDeepGet ? deepGet(obj, key.split('.'), '') : (obj || {})[key] || ''\n );\n}\n\nexport interface FormatMaskOption {\n mask: string;\n tokens?: { [key: string]: FormatMaskToken };\n}\n\nexport interface FormatMaskToken {\n pattern: RegExp;\n default?: NzSafeAny;\n transform?: (char: string) => string;\n}\n\n/**\n * Format mask\n *\n * 格式化掩码\n *\n * | 字符 | 描述 |\n * | --- | --- |\n * | `0` | 任意数字,若该位置字符不符合,则默认为 `0` 填充 |\n * | `9` | 任意数字 |\n * | `#` | 任意字符 |\n * | `U` | 转换大写 |\n * | `L` | 转换小写 |\n * | `*` | 转换为 `*` 字符 |\n *\n * ```ts\n * formatMask('123', '(###)') => (123)\n * formatMask('15900000000', '999****9999') => 159****0000\n * ```\n */\nexport function formatMask(value: string, option: string | FormatMaskOption): string {\n if (!value) {\n return '';\n }\n const opt: FormatMaskOption = {\n ...(typeof option === 'string' ? { mask: option } : option)\n };\n const tokens: { [key: string]: FormatMaskToken } = {\n '0': { pattern: /\\d/, default: '0' },\n '9': { pattern: /\\d/ },\n '#': { pattern: /[a-zA-Z0-9]/ },\n U: {\n pattern: /[a-zA-Z]/,\n transform: char => char.toLocaleUpperCase()\n },\n L: {\n pattern: /[a-zA-Z]/,\n transform: char => char.toLocaleLowerCase()\n },\n '*': {\n pattern: /.*/,\n transform: _ => `*`\n },\n ...opt.tokens\n };\n\n const splitValue = value.split('');\n return opt.mask\n .split('')\n .reduce((res, cur) => {\n const token = tokens[cur];\n if (!token) {\n res.push(cur);\n return res;\n }\n\n const value = splitValue.shift() ?? '';\n if (!token.pattern.test(value)) {\n if (token.default) res.push(token.default);\n return res;\n }\n\n if (typeof token.transform === 'function') {\n res.push(token.transform(value));\n } else {\n res.push(value);\n }\n return res;\n }, [] as string[])\n .join('');\n}\n","export const REGEX_STR = {\n num: `(([-+]?\\\\d+\\\\.\\\\d+)|([-+]?\\\\d+)|([-+]?\\\\.\\\\d+))(?:[eE]([-+]?\\\\d+))?`,\n idCard: `(^\\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[a-fA-F\\\\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)(?:\\\\.(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)){3}|(?::[a-fA-F\\\\d]{1,4}){1,4}|:)|(?:[a-fA-F\\\\d]{1,4}:){2}(?:(?::[a-fA-F\\\\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)(?:\\\\.(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)){3}|(?::[a-fA-F\\\\d]{1,4}){1,5}|:)|(?:[a-fA-F\\\\d]{1,4}:){1}(?:(?::[a-fA-F\\\\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)(?:\\\\.(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)){3}|(?::[a-fA-F\\\\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\\\\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)(?:\\\\.(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)){3}|(?::[a-fA-F\\\\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)`,\n color: `(?:#|0x)(?:[a-f0-9]{3}|[a-f0-9]{6})\\\\b|(?:rgb|hsl)a?\\\\([^\\\\)]*\\\\)`,\n chinese: `[\\u4e00-\\u9fa5]+`\n};\n\nfunction genRegex(str: string, flags?: string): RegExp {\n return new RegExp(`^${str}$`, flags);\n}\n\nexport const REGEX = {\n num: genRegex(REGEX_STR.num),\n idCard: genRegex(REGEX_STR.idCard, 'i'),\n mobile: genRegex(REGEX_STR.mobile),\n url: genRegex(REGEX_STR.url),\n ip: genRegex(REGEX_STR.ip),\n color: genRegex(REGEX_STR.color),\n chinese: genRegex(REGEX_STR.chinese)\n};\n\n/**\n * Wheter is number\n *\n * 是否为数字\n */\nexport function isNum(value: string | number): boolean {\n return REGEX.num.test(value.toString());\n}\n\n/**\n * Wheter is integer\n *\n * 是否为整数\n */\nexport function isInt(value: string | number): boolean {\n return isNum(value) && parseInt(value.toString(), 10).toString() === value.toString();\n}\n\n/**\n * Wheter is decimal\n *\n * 是否为小数点数值\n */\nexport function isDecimal(value: string | number): boolean {\n return isNum(value) && !isInt(value);\n}\n\n/**\n * Wheter is People's Republic of China identity card\n *\n * 是否为中华人民共和国居民身份证\n */\nexport function isIdCard(value: string): boolean {\n return REGEX.idCard.test(value);\n}\n\n/**\n * Wheter is china mobile (China)\n *\n * 是否为手机号(中国)\n */\nexport function isMobile(value: string): boolean {\n return REGEX.mobile.test(value);\n}\n\n/**\n * Wheter is url address\n *\n * 是否URL地址\n */\nexport function isUrl(url: string): boolean {\n return REGEX.url.test(url);\n}\n\n/**\n * Wheter is IPv4 address (Support v4, v6)\n *\n * 是否IP4地址(支持v4、v6)\n */\nexport function isIp(ip: string): boolean {\n return REGEX.ip.test(ip);\n}\n\n/**\n * Wheter is color\n *\n * 是否颜色代码值\n */\nexport function isColor(color: string): boolean {\n return REGEX.color.test(color);\n}\n\n/**\n * Wheter is chinese\n *\n * 是否中文\n */\nexport function isChinese(value: string): boolean {\n return REGEX.chinese.test(value);\n}\n","export type CurrencyStartingUnit = 'yuan' | 'cent';\n\nexport interface CurrencyStartingUnitOptions {\n /**\n * The starting unit of the value, `yuan` means 元, `cent` means 分, default: `yuan`\n *\n * 值的起始单位,`yuan` 元,`cent` 分,默认:`yuan`\n */\n startingUnit?: CurrencyStartingUnit;\n}\n\nexport interface CurrencyFormatOptions extends CurrencyStartingUnitOptions {\n /**\n * Using `DEFAULT_CURRENCY_CODE` when value is `true\n *\n * 是否使用 `CurrencyPipe` 来替代\n */\n useAngular?: boolean;\n /**\n * 精度,默认:`2`\n */\n precision?: number;\n /**\n * 是否忽略精度 `.0` 或 `.00` 结尾的字符,默认:`true`\n */\n ignoreZeroPrecision?: boolean;\n\n /**\n * Use anguar `currency` pipe parse when is set, pls refer to [document](https://angular.io/api/common/CurrencyPipe)\n *\n * 若指定则表示使用 Angular 自带的 `currency` 管道来解析,见[文档](https://angular.cn/api/common/CurrencyPipe)\n */\n ngCurrency?: {\n display: 'code' | 'symbol' | 'symbol-narrow';\n currencyCode?: string;\n digitsInfo?: string;\n locale?: string;\n };\n}\n\n/**\n * Large number format filter, [Document](https://ng.yunzainfo.com/util/format/en#mega)\n *\n * 大数据格式化,[文档](https://ng.yunzainfo.com/util/format/en#mega)\n */\nexport interface CurrencyMegaOptions extends CurrencyStartingUnitOptions {\n /**\n * 精度,默认:`2`\n */\n precision?: number;\n\n /**\n * 单位国际化,默认:`{Q: '京', T: '兆', B: '亿', M: '万', K: '千',}`\n */\n unitI18n?: CurrencyMegaUnitI18n;\n}\n\nexport interface CurrencyMegaResult {\n raw: number | string;\n value: string;\n unit: string;\n unitI18n: string;\n}\n\nexport const CurrencyMega_Powers = [\n { unit: 'Q', value: Math.pow(10, 15) },\n { unit: 'T', value: Math.pow(10, 12) },\n { unit: 'B', value: Math.pow(10, 9) },\n { unit: 'M', value: Math.pow(10, 6) },\n { unit: 'K', value: 1000 }\n];\n\nexport interface CurrencyMegaUnitI18n {\n Q: string;\n T: string;\n B: string;\n M: string;\n K: string;\n}\n\nexport interface CurrencyCNYOptions extends CurrencyStartingUnitOptions {\n /**\n * Whether to return to uppercase notation, default: `true`\n *\n * 是否返回大写表示法,默认:`true`\n */\n inWords?: boolean;\n /**\n * Specify negative sign, default: `negative`\n *\n * 指定负数符号,默认:`负`\n */\n minusSymbol?: string;\n}\n","import { CurrencyPipe, formatNumber } from '@angular/common';\nimport { DEFAULT_CURRENCY_CODE, Inject, Injectable, LOCALE_ID } from '@angular/core';\n\nimport { YunzaiConfigService, YunzaiUtilCurrencyConfig } from '@yelon/util/config';\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\nimport {\n CurrencyCNYOptions,\n CurrencyFormatOptions,\n CurrencyMegaOptions,\n CurrencyMegaResult,\n CurrencyMega_Powers\n} from './currency.types';\n\n@Injectable({ providedIn: 'root' })\nexport class CurrencyService {\n private c: YunzaiUtilCurrencyConfig;\n private readonly currencyPipe: CurrencyPipe;\n\n constructor(\n cog: YunzaiConfigService,\n @Inject(LOCALE_ID) private locale: string,\n @Inject(DEFAULT_CURRENCY_CODE) _defaultCurrencyCode: string = 'USD'\n ) {\n this.currencyPipe = new CurrencyPipe(locale, _defaultCurrencyCode);\n this.c = cog.merge('utilCurrency', {\n startingUnit: 'yuan',\n megaUnit: { Q: '京', T: '兆', B: '亿', M: '万', K: '千' },\n precision: 2,\n ignoreZeroPrecision: true\n })!;\n }\n\n /**\n * Format a number with commas as thousands separators\n *\n * 格式化货币,用逗号将数字格式化为千位分隔符\n * ```ts\n * 10000 => `10,000`\n * 10000.567 => `10,000.57`\n * ```\n */\n format(value: number | string, options?: CurrencyFormatOptions): string {\n options = {\n startingUnit: this.c.startingUnit,\n precision: this.c.precision,\n ignoreZeroPrecision: this.c.ignoreZeroPrecision,\n ngCurrency: this.c.ngCurrency,\n ...options\n };\n let truthValue = Number(value);\n if (value == null || isNaN(truthValue)) {\n return '';\n }\n if (options.startingUnit === 'cent') {\n truthValue = truthValue / 100;\n }\n if (options.ngCurrency != null) {\n const cur = options.ngCurrency!;\n return this.currencyPipe.transform(\n truthValue,\n cur.currencyCode,\n cur.display,\n cur.digitsInfo,\n cur.locale || this.locale\n )!;\n }\n const res = formatNumber(\n truthValue,\n this.locale,\n `.${options.ignoreZeroPrecision ? 1 : options.precision}-${options.precision}`\n );\n return options.ignoreZeroPrecision ? res.replace(/(?:\\.[0]+)$/g, '') : res;\n }\n\n /**\n * Large number format filter\n *\n * 大数据格式化\n * ```ts\n * 1000 => { value: '1', unit: 'K', unitI18n: '千' }\n * 12456 => { value: '12.46', unit: 'K', unitI18n: '千' }\n * ```\n */\n mega(value: number | string, options?: CurrencyMegaOptions): CurrencyMegaResult {\n options = { precision: this.c.precision, unitI18n: this.c.megaUnit, startingUnit: this.c.startingUnit, ...options };\n let num = Number(value);\n const res: CurrencyMegaResult = { raw: value, value: '', unit: '', unitI18n: '' };\n if (isNaN(num) || num === 0) {\n res.value = value.toString();\n return res;\n }\n if (options.startingUnit === 'cent') {\n num = num / 100;\n }\n let abs = Math.abs(+num);\n const rounder = Math.pow(10, options.precision!);\n const isNegative = num < 0;\n for (const p of CurrencyMega_Powers) {\n let reduced = abs / p.value;\n\n reduced = Math.round(reduced * rounder) / rounder;\n\n if (reduced >= 1) {\n abs = reduced;\n res.unit = p.unit;\n break;\n }\n }\n\n res.value = (isNegative ? '-' : '') + abs;\n res.unitI18n = (options.unitI18n as { [key: string]: NzSafeAny })[res.unit];\n return res;\n }\n\n /**\n * Converted into RMB notation.\n *\n * 转化成人民币表示法\n */\n cny(value: number | string, options?: CurrencyCNYOptions): string {\n options = {\n inWords: true,\n minusSymbol: '负',\n startingUnit: this.c.startingUnit,\n ...options\n };\n\n value = Number(value);\n if (isNaN(value)) {\n return '';\n }\n if (options.startingUnit === 'cent') {\n value = value / 100;\n }\n value = value.toString();\n let integer: number | string;\n let decimal: number | string | null;\n [integer, decimal] = value.split('.');\n let symbol = '';\n if (integer.startsWith('-')) {\n symbol = options.minusSymbol!;\n integer = integer.substring(1);\n }\n if (/^-?\\d+$/.test(value)) {\n decimal = null;\n }\n integer = (+integer).toString();\n const inWords = options.inWords;\n const unit: { [key: string]: string[] } = {\n num: inWords\n ? ['', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖', '点']\n : ['', '一', '二', '三', '四', '五', '六', '七', '八', '九', '点'],\n radice: inWords\n ? [\n '',\n '拾',\n '佰',\n '仟',\n '万',\n '拾',\n '佰',\n '仟',\n '亿',\n '拾',\n '佰',\n '仟',\n '万亿',\n '拾',\n '佰',\n '仟',\n '兆',\n '拾',\n '佰',\n '仟'\n ]\n : [\n '',\n '十',\n '百',\n '千',\n '万',\n '十',\n '百',\n '千',\n '亿',\n '十',\n '百',\n '千',\n '万亿',\n '十',\n '百',\n '千',\n '兆',\n '十',\n '百',\n '千'\n ],\n dec: ['角', '分', '厘', '毫']\n };\n if (inWords) {\n value = (+value).toFixed(5).toString();\n }\n let integerRes = '';\n const integerCount = integer.length;\n if (integer === '0' || integerCount === 0) {\n integerRes = '零';\n } else {\n let cnDesc = '';\n for (let i = 0; i < integerCount; i++) {\n const n = +integer[i];\n const j = integerCount - i - 1;\n const isZero = i > 1 && n !== 0 && integer[i - 1] === '0';\n const cnZero = isZero ? '零' : '';\n const isEmpptyUnit = (n === 0 && j % 4 !== 0) || integer.substring(i - 3, i - 3 + 4) === '0000';\n const descMark = cnDesc;\n let cnNum = unit.num[n];\n\n cnDesc = isEmpptyUnit ? '' : unit.radice[j];\n // 第一位是一十\n if (i === 0 && cnNum === '一' && cnDesc === '十') cnNum = '';\n const isChangeEr =\n n > 1 &&\n cnNum === '二' && // 去除首位\n ['', '十', '百'].indexOf(cnDesc) === -1 && // 不读两\\两十\\两百\n descMark !== '十'; // 不读十两\n if (isChangeEr) cnNum = '两';\n integerRes += cnZero + cnNum + cnDesc;\n }\n }\n\n // 小数部分拼接\n let decimalRes = '';\n const decimalCount = decimal ? decimal.toString().length : 0;\n if (decimal === null) {\n decimalRes = inWords ? '整' : '';\n } else if (decimal === '0') {\n decimalRes = '零';\n } else {\n for (let i = 0; i < decimalCount; i++) {\n if (inWords && i > unit.dec.length - 1) break;\n const n = decimal[i];\n const cnZero = n === '0' ? '零' : '';\n const cnNum = unit.num[+n];\n const cnDesc = inWords ? unit.dec[i] : '';\n decimalRes += cnZero + cnNum + cnDesc;\n }\n }\n const ret =\n symbol +\n (inWords\n ? integerRes + (decimalRes === '零' ? '元整' : `元${decimalRes}`)\n : integerRes + (decimalRes === '' ? '' : `点${decimalRes}`));\n return ret;\n }\n}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MhB,SAAS,EAAA,EAAA,EAAA,KAAA,EACT,qBAAqB,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;AAPpB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,cADF,MAAM,EAAA,CAAA,CAAA,EAAA;;2FACnB,eAAe,EAAA,UAAA,EAAA,CAAA;kBAD3B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;;0BAO7B,MAAM;2BAAC,SAAS,CAAA;;0BAChB,MAAM;2BAAC,qBAAqB,CAAA;;;ACtBjC;;AAEG;;;;"}
@@ -35,9 +35,9 @@ export interface CurrencyFormatOptions extends CurrencyStartingUnitOptions {
35
35
  };
36
36
  }
37
37
  /**
38
- * Large number format filter, [Document](https://ng-alain.com/util/format/en#mega)
38
+ * Large number format filter, [Document](https://ng.yunzainfo.com/util/format/en#mega)
39
39
  *
40
- * 大数据格式化,[文档](https://ng-alain.com/util/format/en#mega)
40
+ * 大数据格式化,[文档](https://ng.yunzainfo.com/util/format/en#mega)
41
41
  */
42
42
  export interface CurrencyMegaOptions extends CurrencyStartingUnitOptions {
43
43
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yelon/util",
3
- "version": "16.2.5-68d194e",
3
+ "version": "16.3.0",
4
4
  "author": "devcui<devcui@outlook.com>",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -53,11 +53,11 @@
53
53
  "esm": "./esm2022/browser/browser.mjs",
54
54
  "default": "./fesm2022/browser.mjs"
55
55
  },
56
- "./config": {
57
- "types": "./config/index.d.ts",
58
- "esm2022": "./esm2022/config/config.mjs",
59
- "esm": "./esm2022/config/config.mjs",
60
- "default": "./fesm2022/config.mjs"
56
+ "./decorator": {
57
+ "types": "./decorator/index.d.ts",
58
+ "esm2022": "./esm2022/decorator/decorator.mjs",
59
+ "esm": "./esm2022/decorator/decorator.mjs",
60
+ "default": "./fesm2022/decorator.mjs"
61
61
  },
62
62
  "./date-time": {
63
63
  "types": "./date-time/index.d.ts",
@@ -65,11 +65,11 @@
65
65
  "esm": "./esm2022/date-time/date-time.mjs",
66
66
  "default": "./fesm2022/date-time.mjs"
67
67
  },
68
- "./decorator": {
69
- "types": "./decorator/index.d.ts",
70
- "esm2022": "./esm2022/decorator/decorator.mjs",
71
- "esm": "./esm2022/decorator/decorator.mjs",
72
- "default": "./fesm2022/decorator.mjs"
68
+ "./config": {
69
+ "types": "./config/index.d.ts",
70
+ "esm2022": "./esm2022/config/config.mjs",
71
+ "esm": "./esm2022/config/config.mjs",
72
+ "default": "./fesm2022/config.mjs"
73
73
  },
74
74
  "./form": {
75
75
  "types": "./form/index.d.ts",