@yelon/util 12.0.19 → 13.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (307) hide show
  1. package/README.md +1 -1
  2. package/{date-time/yelon-util-date-time.d.ts → array/array.d.ts} +1 -0
  3. package/array/array.service.d.ts +3 -0
  4. package/array/package.json +6 -7
  5. package/browser/browser.d.ts +1 -0
  6. package/browser/cookie.service.d.ts +3 -0
  7. package/browser/copy.d.ts +1 -1
  8. package/browser/package.json +5 -6
  9. package/browser/scroll.service.d.ts +3 -0
  10. package/config/config.d.ts +5 -0
  11. package/config/config.service.d.ts +3 -0
  12. package/config/package.json +6 -7
  13. package/date-time/date-time.d.ts +5 -0
  14. package/date-time/package.json +6 -7
  15. package/decorator/decorator.d.ts +5 -0
  16. package/decorator/package.json +6 -7
  17. package/{esm2015/array/array-type.service.js → esm2020/array/array-type.service.mjs} +0 -0
  18. package/esm2020/array/array.mjs +5 -0
  19. package/esm2020/array/array.service.mjs +278 -0
  20. package/{esm2015/array/index.js → esm2020/array/index.mjs} +0 -0
  21. package/{esm2015/browser/browser.js → esm2020/browser/browser.mjs} +0 -0
  22. package/esm2020/browser/cookie.service.mjs +103 -0
  23. package/esm2020/browser/copy.mjs +9 -0
  24. package/{esm2015/browser/index.js → esm2020/browser/index.mjs} +0 -0
  25. package/{esm2015/browser/is-empty.js → esm2020/browser/is-empty.mjs} +0 -0
  26. package/esm2020/browser/scroll.service.mjs +88 -0
  27. package/{esm2015/browser/style.js → esm2020/browser/style.mjs} +2 -2
  28. package/{esm2015/config/abc/date-picker.type.js → esm2020/config/abc/date-picker.type.mjs} +0 -0
  29. package/{esm2015/config/abc/error-collect.type.js → esm2020/config/abc/error-collect.type.mjs} +0 -0
  30. package/{esm2015/config/abc/image.type.js → esm2020/config/abc/image.type.mjs} +0 -0
  31. package/{esm2015/config/abc/index.js → esm2020/config/abc/index.mjs} +0 -0
  32. package/{esm2015/config/abc/loading.type.js → esm2020/config/abc/loading.type.mjs} +0 -0
  33. package/{esm2015/config/abc/lodop.type.js → esm2020/config/abc/lodop.type.mjs} +0 -0
  34. package/{esm2015/config/abc/media.type.js → esm2020/config/abc/media.type.mjs} +0 -0
  35. package/{esm2015/config/abc/onboarding.type.js → esm2020/config/abc/onboarding.type.mjs} +0 -0
  36. package/{esm2015/config/abc/page-header.type.js → esm2020/config/abc/page-header.type.mjs} +0 -0
  37. package/{esm2015/config/abc/pdf.type.js → esm2020/config/abc/pdf.type.mjs} +0 -0
  38. package/{esm2015/config/abc/qr.type.js → esm2020/config/abc/qr.type.mjs} +0 -0
  39. package/{esm2015/config/abc/se.type.js → esm2020/config/abc/se.type.mjs} +0 -0
  40. package/{esm2015/config/abc/sg.type.js → esm2020/config/abc/sg.type.mjs} +0 -0
  41. package/{esm2015/config/abc/st.type.js → esm2020/config/abc/st.type.mjs} +0 -0
  42. package/{esm2015/config/abc/sv.type.js → esm2020/config/abc/sv.type.mjs} +0 -0
  43. package/{esm2015/config/abc/xlsx.type.js → esm2020/config/abc/xlsx.type.mjs} +0 -0
  44. package/{esm2015/config/abc/zip.type.js → esm2020/config/abc/zip.type.mjs} +0 -0
  45. package/{esm2015/config/acl/acl.type.js → esm2020/config/acl/acl.type.mjs} +0 -0
  46. package/{esm2015/config/auth/auth.type.js → esm2020/config/auth/auth.type.mjs} +0 -0
  47. package/{esm2015/config/bis/bis.type.js → esm2020/config/bis/bis.type.mjs} +0 -0
  48. package/{esm2015/config/cache/cache.type.js → esm2020/config/cache/cache.type.mjs} +0 -0
  49. package/{esm2015/config/chart/chart.type.js → esm2020/config/chart/chart.type.mjs} +0 -0
  50. package/esm2020/config/config.mjs +5 -0
  51. package/esm2020/config/config.service.mjs +37 -0
  52. package/{esm2015/config/config.types.js → esm2020/config/config.types.mjs} +0 -0
  53. package/{esm2015/config/index.js → esm2020/config/index.mjs} +0 -0
  54. package/{esm2015/config/mock/mock.type.js → esm2020/config/mock/mock.type.mjs} +0 -0
  55. package/{esm2015/config/sf/sf.type.js → esm2020/config/sf/sf.type.mjs} +0 -0
  56. package/{esm2015/config/stomp/stomp.type.js → esm2020/config/stomp/stomp.type.mjs} +0 -0
  57. package/{esm2015/config/theme/http.type.js → esm2020/config/theme/http.type.mjs} +0 -0
  58. package/{esm2015/config/theme/i18n.type.js → esm2020/config/theme/i18n.type.mjs} +0 -0
  59. package/{esm2015/config/theme/index.js → esm2020/config/theme/index.mjs} +0 -0
  60. package/{esm2015/config/theme/responsive.type.js → esm2020/config/theme/responsive.type.mjs} +0 -0
  61. package/{esm2015/config/util/array.type.js → esm2020/config/util/array.type.mjs} +0 -0
  62. package/{esm2015/config/util/currency.type.js → esm2020/config/util/currency.type.mjs} +0 -0
  63. package/esm2020/date-time/date-time.mjs +5 -0
  64. package/{esm2015/date-time/index.js → esm2020/date-time/index.mjs} +0 -0
  65. package/esm2020/date-time/picker.mjs +116 -0
  66. package/{esm2015/date-time/time.js → esm2020/date-time/time.mjs} +6 -2
  67. package/esm2020/decorator/convert.mjs +58 -0
  68. package/esm2020/decorator/decorator.mjs +5 -0
  69. package/{esm2015/decorator/index.js → esm2020/decorator/index.mjs} +0 -0
  70. package/esm2020/decorator/zone-outside.mjs +57 -0
  71. package/esm2020/form/form.mjs +5 -0
  72. package/{esm2015/form/index.js → esm2020/form/index.mjs} +0 -0
  73. package/{esm2015/form/match-control.js → esm2020/form/match-control.mjs} +0 -0
  74. package/{esm2015/form/validators.js → esm2020/form/validators.mjs} +0 -0
  75. package/esm2020/format/currency.service.mjs +238 -0
  76. package/{esm2015/format/currency.types.js → esm2020/format/currency.types.mjs} +0 -0
  77. package/esm2020/format/format.mjs +5 -0
  78. package/{esm2015/format/index.js → esm2020/format/index.mjs} +0 -0
  79. package/esm2020/format/string.mjs +85 -0
  80. package/{esm2015/format/validate.js → esm2020/format/validate.mjs} +0 -0
  81. package/{esm2015/index.js → esm2020/index.mjs} +0 -0
  82. package/{esm2015/math/in-range.js → esm2020/math/in-range.mjs} +0 -0
  83. package/{esm2015/math/index.js → esm2020/math/index.mjs} +0 -0
  84. package/esm2020/math/math.mjs +5 -0
  85. package/{esm2015/math/round.js → esm2020/math/round.mjs} +0 -0
  86. package/{esm2015/other/assert.js → esm2020/other/assert.mjs} +0 -0
  87. package/{esm2015/other/deep.js → esm2020/other/deep.mjs} +0 -0
  88. package/{esm2015/other/index.js → esm2020/other/index.mjs} +0 -0
  89. package/esm2020/other/lazy.service.mjs +104 -0
  90. package/{esm2015/other/logger.js → esm2020/other/logger.mjs} +0 -0
  91. package/esm2020/other/other.mjs +5 -0
  92. package/{esm2015/other/resize.js → esm2020/other/resize.mjs} +0 -0
  93. package/{esm2015/other/url.js → esm2020/other/url.mjs} +0 -0
  94. package/esm2020/pipes/currency/cny.pipe.mjs +23 -0
  95. package/{esm2015/pipes/currency/index.js → esm2020/pipes/currency/index.mjs} +2 -1
  96. package/esm2020/pipes/currency/mega.pipe.mjs +29 -0
  97. package/esm2020/pipes/currency/module.mjs +19 -0
  98. package/esm2020/pipes/currency/pipe-currency.mjs +5 -0
  99. package/esm2020/pipes/currency/price.pipe.mjs +27 -0
  100. package/esm2020/pipes/filter/filter.pipe.mjs +19 -0
  101. package/{esm2015/pipes/filter/index.js → esm2020/pipes/filter/index.mjs} +0 -0
  102. package/esm2020/pipes/filter/module.mjs +17 -0
  103. package/{esm2015/other/yelon-util-other.js → esm2020/pipes/filter/pipe-filter.mjs} +1 -1
  104. package/{esm2015/pipes/format/index.js → esm2020/pipes/format/index.mjs} +0 -0
  105. package/esm2020/pipes/format/mask.pipe.mjs +34 -0
  106. package/esm2020/pipes/format/module.mjs +17 -0
  107. package/{esm2015/array/yelon-util-array.js → esm2020/pipes/format/pipe-format.mjs} +1 -1
  108. package/{esm2015/pipes/index.js → esm2020/pipes/index.mjs} +0 -0
  109. package/esm2020/pipes/pipes.mjs +5 -0
  110. package/{esm2015/token/index.js → esm2020/token/index.mjs} +0 -0
  111. package/{esm2015/token/page-visibility.js → esm2020/token/page-visibility.mjs} +0 -0
  112. package/esm2020/token/token.mjs +5 -0
  113. package/{esm2015/token/window.js → esm2020/token/window.mjs} +0 -0
  114. package/{esm2015/yelon-util.js → esm2020/yelon-util.mjs} +0 -0
  115. package/fesm2015/{yelon-util-array.js → array.mjs} +8 -10
  116. package/fesm2015/array.mjs.map +1 -0
  117. package/fesm2015/{browser.js → browser.mjs} +28 -42
  118. package/fesm2015/browser.mjs.map +1 -0
  119. package/fesm2015/{yelon-util-config.js → config.mjs} +14 -8
  120. package/fesm2015/config.mjs.map +1 -0
  121. package/fesm2015/{yelon-util-date-time.js → date-time.mjs} +1 -1
  122. package/fesm2015/date-time.mjs.map +1 -0
  123. package/fesm2015/{yelon-util-decorator.js → decorator.mjs} +8 -4
  124. package/fesm2015/decorator.mjs.map +1 -0
  125. package/fesm2015/{yelon-util-form.js → form.mjs} +1 -1
  126. package/fesm2015/form.mjs.map +1 -0
  127. package/fesm2015/{yelon-util-format.js → format.mjs} +18 -14
  128. package/fesm2015/format.mjs.map +1 -0
  129. package/fesm2015/{yelon-util-math.js → math.mjs} +1 -1
  130. package/fesm2015/math.mjs.map +1 -0
  131. package/fesm2015/{yelon-util-other.js → other.mjs} +17 -29
  132. package/fesm2015/other.mjs.map +1 -0
  133. package/fesm2015/pipe-currency.mjs +96 -0
  134. package/fesm2015/pipe-currency.mjs.map +1 -0
  135. package/fesm2015/pipe-filter.mjs +40 -0
  136. package/fesm2015/pipe-filter.mjs.map +1 -0
  137. package/fesm2015/pipe-format.mjs +55 -0
  138. package/fesm2015/pipe-format.mjs.map +1 -0
  139. package/fesm2015/{yelon-util-pipes.js → pipes.mjs} +1 -1
  140. package/fesm2015/pipes.mjs.map +1 -0
  141. package/fesm2015/{yelon-util-token.js → token.mjs} +1 -1
  142. package/fesm2015/token.mjs.map +1 -0
  143. package/fesm2015/{yelon-util.js → yelon-util.mjs} +1 -1
  144. package/fesm2015/yelon-util.mjs.map +1 -0
  145. package/fesm2020/array.mjs +285 -0
  146. package/fesm2020/array.mjs.map +1 -0
  147. package/fesm2020/browser.mjs +260 -0
  148. package/fesm2020/browser.mjs.map +1 -0
  149. package/fesm2020/config.mjs +54 -0
  150. package/fesm2020/config.mjs.map +1 -0
  151. package/fesm2020/date-time.mjs +210 -0
  152. package/fesm2020/date-time.mjs.map +1 -0
  153. package/fesm2020/decorator.mjs +121 -0
  154. package/fesm2020/decorator.mjs.map +1 -0
  155. package/fesm2020/form.mjs +118 -0
  156. package/fesm2020/form.mjs.map +1 -0
  157. package/fesm2020/format.mjs +431 -0
  158. package/fesm2020/format.mjs.map +1 -0
  159. package/fesm2020/math.mjs +85 -0
  160. package/fesm2020/math.mjs.map +1 -0
  161. package/fesm2020/other.mjs +303 -0
  162. package/fesm2020/other.mjs.map +1 -0
  163. package/fesm2020/pipe-currency.mjs +94 -0
  164. package/fesm2020/pipe-currency.mjs.map +1 -0
  165. package/fesm2020/pipe-filter.mjs +40 -0
  166. package/fesm2020/pipe-filter.mjs.map +1 -0
  167. package/fesm2020/pipe-format.mjs +55 -0
  168. package/fesm2020/pipe-format.mjs.map +1 -0
  169. package/fesm2020/pipes.mjs +8 -0
  170. package/fesm2020/pipes.mjs.map +1 -0
  171. package/fesm2020/token.mjs +38 -0
  172. package/fesm2020/token.mjs.map +1 -0
  173. package/fesm2020/yelon-util.mjs +16 -0
  174. package/fesm2020/yelon-util.mjs.map +1 -0
  175. package/{array/yelon-util-array.d.ts → form/form.d.ts} +1 -0
  176. package/form/package.json +6 -7
  177. package/format/currency.service.d.ts +3 -0
  178. package/format/format.d.ts +5 -0
  179. package/format/package.json +6 -7
  180. package/{config/yelon-util-config.d.ts → math/math.d.ts} +1 -0
  181. package/math/package.json +6 -7
  182. package/other/lazy.service.d.ts +3 -0
  183. package/{decorator/yelon-util-decorator.d.ts → other/other.d.ts} +1 -0
  184. package/other/package.json +6 -7
  185. package/package.json +132 -8
  186. package/pipes/currency/cny.pipe.d.ts +3 -0
  187. package/pipes/currency/index.d.ts +1 -0
  188. package/pipes/currency/mega.pipe.d.ts +3 -0
  189. package/pipes/currency/module.d.ts +7 -0
  190. package/pipes/currency/package.json +6 -7
  191. package/pipes/currency/pipe-currency.d.ts +5 -0
  192. package/pipes/currency/price.pipe.d.ts +3 -0
  193. package/pipes/filter/filter.pipe.d.ts +3 -0
  194. package/pipes/filter/module.d.ts +5 -0
  195. package/pipes/filter/package.json +6 -7
  196. package/pipes/filter/pipe-filter.d.ts +5 -0
  197. package/pipes/format/mask.pipe.d.ts +3 -0
  198. package/pipes/format/module.d.ts +5 -0
  199. package/pipes/format/package.json +6 -7
  200. package/pipes/format/pipe-format.d.ts +5 -0
  201. package/pipes/package.json +6 -7
  202. package/pipes/pipes.d.ts +5 -0
  203. package/token/package.json +6 -7
  204. package/token/token.d.ts +5 -0
  205. package/yelon-util.d.ts +1 -0
  206. package/array/yelon-util-array.metadata.json +0 -1
  207. package/browser/browser.metadata.json +0 -1
  208. package/bundles/browser.umd.js +0 -325
  209. package/bundles/browser.umd.js.map +0 -1
  210. package/bundles/yelon-util-array.umd.js +0 -641
  211. package/bundles/yelon-util-array.umd.js.map +0 -1
  212. package/bundles/yelon-util-config.umd.js +0 -411
  213. package/bundles/yelon-util-config.umd.js.map +0 -1
  214. package/bundles/yelon-util-date-time.umd.js +0 -238
  215. package/bundles/yelon-util-date-time.umd.js.map +0 -1
  216. package/bundles/yelon-util-decorator.umd.js +0 -462
  217. package/bundles/yelon-util-decorator.umd.js.map +0 -1
  218. package/bundles/yelon-util-form.umd.js +0 -135
  219. package/bundles/yelon-util-form.umd.js.map +0 -1
  220. package/bundles/yelon-util-format.umd.js +0 -785
  221. package/bundles/yelon-util-format.umd.js.map +0 -1
  222. package/bundles/yelon-util-math.umd.js +0 -104
  223. package/bundles/yelon-util-math.umd.js.map +0 -1
  224. package/bundles/yelon-util-other.umd.js +0 -733
  225. package/bundles/yelon-util-other.umd.js.map +0 -1
  226. package/bundles/yelon-util-pipes-currency.umd.js +0 -108
  227. package/bundles/yelon-util-pipes-currency.umd.js.map +0 -1
  228. package/bundles/yelon-util-pipes-filter.umd.js +0 -374
  229. package/bundles/yelon-util-pipes-filter.umd.js.map +0 -1
  230. package/bundles/yelon-util-pipes-format.umd.js +0 -66
  231. package/bundles/yelon-util-pipes-format.umd.js.map +0 -1
  232. package/bundles/yelon-util-pipes.umd.js +0 -38
  233. package/bundles/yelon-util-pipes.umd.js.map +0 -1
  234. package/bundles/yelon-util-token.umd.js +0 -49
  235. package/bundles/yelon-util-token.umd.js.map +0 -1
  236. package/bundles/yelon-util.umd.js +0 -86
  237. package/bundles/yelon-util.umd.js.map +0 -1
  238. package/config/yelon-util-config.metadata.json +0 -1
  239. package/date-time/yelon-util-date-time.metadata.json +0 -1
  240. package/decorator/yelon-util-decorator.metadata.json +0 -1
  241. package/esm2015/array/array.service.js +0 -250
  242. package/esm2015/browser/cookie.service.js +0 -104
  243. package/esm2015/browser/copy.js +0 -27
  244. package/esm2015/browser/scroll.service.js +0 -89
  245. package/esm2015/config/config.service.js +0 -34
  246. package/esm2015/config/yelon-util-config.js +0 -5
  247. package/esm2015/date-time/picker.js +0 -116
  248. package/esm2015/date-time/yelon-util-date-time.js +0 -5
  249. package/esm2015/decorator/convert.js +0 -56
  250. package/esm2015/decorator/yelon-util-decorator.js +0 -5
  251. package/esm2015/decorator/zone-outside.js +0 -55
  252. package/esm2015/form/yelon-util-form.js +0 -5
  253. package/esm2015/format/currency.service.js +0 -225
  254. package/esm2015/format/string.js +0 -76
  255. package/esm2015/format/yelon-util-format.js +0 -5
  256. package/esm2015/math/yelon-util-math.js +0 -5
  257. package/esm2015/other/lazy.service.js +0 -118
  258. package/esm2015/pipes/currency/cny.pipe.js +0 -22
  259. package/esm2015/pipes/currency/mega.pipe.js +0 -26
  260. package/esm2015/pipes/currency/module.js +0 -14
  261. package/esm2015/pipes/currency/price.pipe.js +0 -26
  262. package/esm2015/pipes/currency/yelon-util-pipes-currency.js +0 -6
  263. package/esm2015/pipes/filter/filter.pipe.js +0 -15
  264. package/esm2015/pipes/filter/module.js +0 -12
  265. package/esm2015/pipes/filter/yelon-util-pipes-filter.js +0 -5
  266. package/esm2015/pipes/format/mask.pipe.js +0 -30
  267. package/esm2015/pipes/format/module.js +0 -12
  268. package/esm2015/pipes/format/yelon-util-pipes-format.js +0 -5
  269. package/esm2015/pipes/yelon-util-pipes.js +0 -5
  270. package/esm2015/token/yelon-util-token.js +0 -5
  271. package/fesm2015/browser.js.map +0 -1
  272. package/fesm2015/yelon-util-array.js.map +0 -1
  273. package/fesm2015/yelon-util-config.js.map +0 -1
  274. package/fesm2015/yelon-util-date-time.js.map +0 -1
  275. package/fesm2015/yelon-util-decorator.js.map +0 -1
  276. package/fesm2015/yelon-util-form.js.map +0 -1
  277. package/fesm2015/yelon-util-format.js.map +0 -1
  278. package/fesm2015/yelon-util-math.js.map +0 -1
  279. package/fesm2015/yelon-util-other.js.map +0 -1
  280. package/fesm2015/yelon-util-pipes-currency.js +0 -87
  281. package/fesm2015/yelon-util-pipes-currency.js.map +0 -1
  282. package/fesm2015/yelon-util-pipes-filter.js +0 -32
  283. package/fesm2015/yelon-util-pipes-filter.js.map +0 -1
  284. package/fesm2015/yelon-util-pipes-format.js +0 -47
  285. package/fesm2015/yelon-util-pipes-format.js.map +0 -1
  286. package/fesm2015/yelon-util-pipes.js.map +0 -1
  287. package/fesm2015/yelon-util-token.js.map +0 -1
  288. package/fesm2015/yelon-util.js.map +0 -1
  289. package/form/yelon-util-form.d.ts +0 -4
  290. package/form/yelon-util-form.metadata.json +0 -1
  291. package/format/yelon-util-format.d.ts +0 -4
  292. package/format/yelon-util-format.metadata.json +0 -1
  293. package/math/yelon-util-math.d.ts +0 -4
  294. package/math/yelon-util-math.metadata.json +0 -1
  295. package/other/yelon-util-other.d.ts +0 -4
  296. package/other/yelon-util-other.metadata.json +0 -1
  297. package/pipes/currency/yelon-util-pipes-currency.d.ts +0 -5
  298. package/pipes/currency/yelon-util-pipes-currency.metadata.json +0 -1
  299. package/pipes/filter/yelon-util-pipes-filter.d.ts +0 -4
  300. package/pipes/filter/yelon-util-pipes-filter.metadata.json +0 -1
  301. package/pipes/format/yelon-util-pipes-format.d.ts +0 -4
  302. package/pipes/format/yelon-util-pipes-format.metadata.json +0 -1
  303. package/pipes/yelon-util-pipes.d.ts +0 -4
  304. package/pipes/yelon-util-pipes.metadata.json +0 -1
  305. package/token/yelon-util-token.d.ts +0 -4
  306. package/token/yelon-util-token.metadata.json +0 -1
  307. package/yelon-util.metadata.json +0 -1
@@ -1,785 +0,0 @@
1
- /**
2
- * @license ng-yunzai(devcui@outlook.com) v12.0.19
3
- * (c) 2020 devcui https://github.com/hbyunzai/yelon/
4
- * License: MIT
5
- */
6
- (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@yelon/util/other'), require('@angular/common'), require('@angular/core'), require('@yelon/util/config')) :
8
- typeof define === 'function' && define.amd ? define('@yelon/util/format', ['exports', '@yelon/util/other', '@angular/common', '@angular/core', '@yelon/util/config'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.yelon = global.yelon || {}, global.yelon.util = global.yelon.util || {}, global.yelon.util.format = {}), global.yelon.util.other, global.ng.common, global.ng.core, global.yelon.util.config));
10
- })(this, (function (exports, other, common, i0, i1) { 'use strict';
11
-
12
- function _interopNamespace(e) {
13
- if (e && e.__esModule) return e;
14
- var n = Object.create(null);
15
- if (e) {
16
- Object.keys(e).forEach(function (k) {
17
- if (k !== 'default') {
18
- var d = Object.getOwnPropertyDescriptor(e, k);
19
- Object.defineProperty(n, k, d.get ? d : {
20
- enumerable: true,
21
- get: function () { return e[k]; }
22
- });
23
- }
24
- });
25
- }
26
- n["default"] = e;
27
- return Object.freeze(n);
28
- }
29
-
30
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
31
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
32
-
33
- /**
34
- * String formatting
35
- *
36
- * 字符串格式化
37
- * ```
38
- * format('this is ${name}', { name: 'asdf' })
39
- * // output: this is asdf
40
- * format('this is ${user.name}', { user: { name: 'asdf' } }, true)
41
- * // output: this is asdf
42
- * ```
43
- */
44
- function format(str, obj, needDeepGet) {
45
- if (needDeepGet === void 0) { needDeepGet = false; }
46
- return (str || '').replace(/\${([^}]+)}/g, function (_work, key) { return needDeepGet ? other.deepGet(obj, key.split('.'), '') : (obj || {})[key] || ''; });
47
- }
48
- /**
49
- * Format mask
50
- *
51
- * 格式化掩码
52
- *
53
- * | 字符 | 描述 |
54
- * | --- | --- |
55
- * | `0` | 任意数字,若该位置字符不符合,则默认为 `0` 填充 |
56
- * | `9` | 任意数字 |
57
- * | `#` | 任意字符 |
58
- * | `U` | 转换大写 |
59
- * | `L` | 转换小写 |
60
- * | `*` | 转换为 `*` 字符 |
61
- *
62
- * ```ts
63
- * formatMask('123', '(###)') => (123)
64
- * formatMask('15900000000', '999****9999') => 159****0000
65
- * ```
66
- */
67
- function formatMask(value, option) {
68
- if (!value) {
69
- return '';
70
- }
71
- var opt = Object.assign({}, (typeof option === 'string' ? { mask: option } : option));
72
- var tokens = Object.assign({ '0': { pattern: /\d/, default: '0' }, '9': { pattern: /\d/ }, '#': { pattern: /[a-zA-Z0-9]/ }, U: {
73
- pattern: /[a-zA-Z]/,
74
- transform: function (char) { return char.toLocaleUpperCase(); }
75
- }, L: {
76
- pattern: /[a-zA-Z]/,
77
- transform: function (char) { return char.toLocaleLowerCase(); }
78
- }, '*': {
79
- pattern: /.*/,
80
- transform: function (_) { return "*"; }
81
- } }, opt.tokens);
82
- var splitValue = value.split('');
83
- return opt.mask
84
- .split('')
85
- .reduce(function (res, cur) {
86
- var _a;
87
- var token = tokens[cur];
88
- if (!token) {
89
- res.push(cur);
90
- return res;
91
- }
92
- var value = (_a = splitValue.shift()) !== null && _a !== void 0 ? _a : '';
93
- if (!token.pattern.test(value)) {
94
- if (token.default)
95
- res.push(token.default);
96
- return res;
97
- }
98
- if (typeof token.transform === 'function') {
99
- res.push(token.transform(value));
100
- }
101
- else {
102
- res.push(value);
103
- }
104
- return res;
105
- }, [])
106
- .join('');
107
- }
108
-
109
- var REGEX_STR = {
110
- num: "((-?\\d+\\.\\d+)|(-?\\d+)|(-?\\.\\d+))",
111
- idCard: "(^\\d{15}$)|(^\\d{17}(?:[0-9]|X)$)",
112
- mobile: "^(0|\\+?86|17951)?1[0-9]{10}$",
113
- url: "(((^https?:(?://)?)(?:[-;:&=\\+\\$,\\w]+@)?[A-Za-z0-9.-]+(?::\\d+)?|(?:www.|[-;:&=\\+\\$,\\w]+@)[A-Za-z0-9.-]+)((?:/[\\+~%\\/.\\w-_]*)?\\??(?:[-\\+=&;%@.\\w_]*)#?(?:[\\w]*))?)",
114
- 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\\d]{1,4}:){4}(?:(?::[a-fA-F\\d]{1,4}){0,1}:(?: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,3}|:)|(?:[a-fA-F\\d]{1,4}:){3}(?:(?::[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,})?$)",
115
- color: "(?:#|0x)(?:[a-f0-9]{3}|[a-f0-9]{6})\\b|(?:rgb|hsl)a?\\([^\\)]*\\)",
116
- chinese: "[\u4E00-\u9FA5]+"
117
- };
118
- function genRegex(str, flags) {
119
- return new RegExp("^" + str + "$", flags);
120
- }
121
- var REGEX = {
122
- num: genRegex(REGEX_STR.num),
123
- idCard: genRegex(REGEX_STR.idCard, 'i'),
124
- mobile: genRegex(REGEX_STR.mobile),
125
- url: genRegex(REGEX_STR.url),
126
- ip: genRegex(REGEX_STR.ip),
127
- color: genRegex(REGEX_STR.color),
128
- chinese: genRegex(REGEX_STR.chinese)
129
- };
130
- /**
131
- * Wheter is number
132
- *
133
- * 是否为数字
134
- */
135
- function isNum(value) {
136
- return REGEX.num.test(value.toString());
137
- }
138
- /**
139
- * Wheter is integer
140
- *
141
- * 是否为整数
142
- */
143
- function isInt(value) {
144
- return isNum(value) && parseInt(value.toString(), 10).toString() === value.toString();
145
- }
146
- /**
147
- * Wheter is decimal
148
- *
149
- * 是否为小数点数值
150
- */
151
- function isDecimal(value) {
152
- return isNum(value) && !isInt(value);
153
- }
154
- /**
155
- * Wheter is People's Republic of China identity card
156
- *
157
- * 是否为中华人民共和国居民身份证
158
- */
159
- function isIdCard(value) {
160
- return REGEX.idCard.test(value);
161
- }
162
- /**
163
- * Wheter is china mobile (China)
164
- *
165
- * 是否为手机号(中国)
166
- */
167
- function isMobile(value) {
168
- return REGEX.mobile.test(value);
169
- }
170
- /**
171
- * Wheter is url address
172
- *
173
- * 是否URL地址
174
- */
175
- function isUrl(url) {
176
- return REGEX.url.test(url);
177
- }
178
- /**
179
- * Wheter is IPv4 address (Support v4, v6)
180
- *
181
- * 是否IP4地址(支持v4、v6)
182
- */
183
- function isIp(ip) {
184
- return REGEX.ip.test(ip);
185
- }
186
- /**
187
- * Wheter is color
188
- *
189
- * 是否颜色代码值
190
- */
191
- function isColor(color) {
192
- return REGEX.color.test(color);
193
- }
194
- /**
195
- * Wheter is chinese
196
- *
197
- * 是否中文
198
- */
199
- function isChinese(value) {
200
- return REGEX.chinese.test(value);
201
- }
202
-
203
- /*! *****************************************************************************
204
- Copyright (c) Microsoft Corporation.
205
-
206
- Permission to use, copy, modify, and/or distribute this software for any
207
- purpose with or without fee is hereby granted.
208
-
209
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
210
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
211
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
212
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
213
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
214
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
215
- PERFORMANCE OF THIS SOFTWARE.
216
- ***************************************************************************** */
217
- /* global Reflect, Promise */
218
- var extendStatics = function (d, b) {
219
- extendStatics = Object.setPrototypeOf ||
220
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
221
- function (d, b) { for (var p in b)
222
- if (Object.prototype.hasOwnProperty.call(b, p))
223
- d[p] = b[p]; };
224
- return extendStatics(d, b);
225
- };
226
- function __extends(d, b) {
227
- if (typeof b !== "function" && b !== null)
228
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
229
- extendStatics(d, b);
230
- function __() { this.constructor = d; }
231
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
232
- }
233
- var __assign = function () {
234
- __assign = Object.assign || function __assign(t) {
235
- for (var s, i = 1, n = arguments.length; i < n; i++) {
236
- s = arguments[i];
237
- for (var p in s)
238
- if (Object.prototype.hasOwnProperty.call(s, p))
239
- t[p] = s[p];
240
- }
241
- return t;
242
- };
243
- return __assign.apply(this, arguments);
244
- };
245
- function __rest(s, e) {
246
- var t = {};
247
- for (var p in s)
248
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
249
- t[p] = s[p];
250
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
251
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
252
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
253
- t[p[i]] = s[p[i]];
254
- }
255
- return t;
256
- }
257
- function __decorate(decorators, target, key, desc) {
258
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
259
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
260
- r = Reflect.decorate(decorators, target, key, desc);
261
- else
262
- for (var i = decorators.length - 1; i >= 0; i--)
263
- if (d = decorators[i])
264
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
265
- return c > 3 && r && Object.defineProperty(target, key, r), r;
266
- }
267
- function __param(paramIndex, decorator) {
268
- return function (target, key) { decorator(target, key, paramIndex); };
269
- }
270
- function __metadata(metadataKey, metadataValue) {
271
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
272
- return Reflect.metadata(metadataKey, metadataValue);
273
- }
274
- function __awaiter(thisArg, _arguments, P, generator) {
275
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
276
- return new (P || (P = Promise))(function (resolve, reject) {
277
- function fulfilled(value) { try {
278
- step(generator.next(value));
279
- }
280
- catch (e) {
281
- reject(e);
282
- } }
283
- function rejected(value) { try {
284
- step(generator["throw"](value));
285
- }
286
- catch (e) {
287
- reject(e);
288
- } }
289
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
290
- step((generator = generator.apply(thisArg, _arguments || [])).next());
291
- });
292
- }
293
- function __generator(thisArg, body) {
294
- var _ = { label: 0, sent: function () { if (t[0] & 1)
295
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
296
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
297
- function verb(n) { return function (v) { return step([n, v]); }; }
298
- function step(op) {
299
- if (f)
300
- throw new TypeError("Generator is already executing.");
301
- while (_)
302
- try {
303
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
304
- return t;
305
- if (y = 0, t)
306
- op = [op[0] & 2, t.value];
307
- switch (op[0]) {
308
- case 0:
309
- case 1:
310
- t = op;
311
- break;
312
- case 4:
313
- _.label++;
314
- return { value: op[1], done: false };
315
- case 5:
316
- _.label++;
317
- y = op[1];
318
- op = [0];
319
- continue;
320
- case 7:
321
- op = _.ops.pop();
322
- _.trys.pop();
323
- continue;
324
- default:
325
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
326
- _ = 0;
327
- continue;
328
- }
329
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
330
- _.label = op[1];
331
- break;
332
- }
333
- if (op[0] === 6 && _.label < t[1]) {
334
- _.label = t[1];
335
- t = op;
336
- break;
337
- }
338
- if (t && _.label < t[2]) {
339
- _.label = t[2];
340
- _.ops.push(op);
341
- break;
342
- }
343
- if (t[2])
344
- _.ops.pop();
345
- _.trys.pop();
346
- continue;
347
- }
348
- op = body.call(thisArg, _);
349
- }
350
- catch (e) {
351
- op = [6, e];
352
- y = 0;
353
- }
354
- finally {
355
- f = t = 0;
356
- }
357
- if (op[0] & 5)
358
- throw op[1];
359
- return { value: op[0] ? op[1] : void 0, done: true };
360
- }
361
- }
362
- var __createBinding = Object.create ? (function (o, m, k, k2) {
363
- if (k2 === undefined)
364
- k2 = k;
365
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
366
- }) : (function (o, m, k, k2) {
367
- if (k2 === undefined)
368
- k2 = k;
369
- o[k2] = m[k];
370
- });
371
- function __exportStar(m, o) {
372
- for (var p in m)
373
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
374
- __createBinding(o, m, p);
375
- }
376
- function __values(o) {
377
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
378
- if (m)
379
- return m.call(o);
380
- if (o && typeof o.length === "number")
381
- return {
382
- next: function () {
383
- if (o && i >= o.length)
384
- o = void 0;
385
- return { value: o && o[i++], done: !o };
386
- }
387
- };
388
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
389
- }
390
- function __read(o, n) {
391
- var m = typeof Symbol === "function" && o[Symbol.iterator];
392
- if (!m)
393
- return o;
394
- var i = m.call(o), r, ar = [], e;
395
- try {
396
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
397
- ar.push(r.value);
398
- }
399
- catch (error) {
400
- e = { error: error };
401
- }
402
- finally {
403
- try {
404
- if (r && !r.done && (m = i["return"]))
405
- m.call(i);
406
- }
407
- finally {
408
- if (e)
409
- throw e.error;
410
- }
411
- }
412
- return ar;
413
- }
414
- /** @deprecated */
415
- function __spread() {
416
- for (var ar = [], i = 0; i < arguments.length; i++)
417
- ar = ar.concat(__read(arguments[i]));
418
- return ar;
419
- }
420
- /** @deprecated */
421
- function __spreadArrays() {
422
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
423
- s += arguments[i].length;
424
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
425
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
426
- r[k] = a[j];
427
- return r;
428
- }
429
- function __spreadArray(to, from, pack) {
430
- if (pack || arguments.length === 2)
431
- for (var i = 0, l = from.length, ar; i < l; i++) {
432
- if (ar || !(i in from)) {
433
- if (!ar)
434
- ar = Array.prototype.slice.call(from, 0, i);
435
- ar[i] = from[i];
436
- }
437
- }
438
- return to.concat(ar || Array.prototype.slice.call(from));
439
- }
440
- function __await(v) {
441
- return this instanceof __await ? (this.v = v, this) : new __await(v);
442
- }
443
- function __asyncGenerator(thisArg, _arguments, generator) {
444
- if (!Symbol.asyncIterator)
445
- throw new TypeError("Symbol.asyncIterator is not defined.");
446
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
447
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
448
- function verb(n) { if (g[n])
449
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
450
- function resume(n, v) { try {
451
- step(g[n](v));
452
- }
453
- catch (e) {
454
- settle(q[0][3], e);
455
- } }
456
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
457
- function fulfill(value) { resume("next", value); }
458
- function reject(value) { resume("throw", value); }
459
- function settle(f, v) { if (f(v), q.shift(), q.length)
460
- resume(q[0][0], q[0][1]); }
461
- }
462
- function __asyncDelegator(o) {
463
- var i, p;
464
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
465
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
466
- }
467
- function __asyncValues(o) {
468
- if (!Symbol.asyncIterator)
469
- throw new TypeError("Symbol.asyncIterator is not defined.");
470
- var m = o[Symbol.asyncIterator], i;
471
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
472
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
473
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
474
- }
475
- function __makeTemplateObject(cooked, raw) {
476
- if (Object.defineProperty) {
477
- Object.defineProperty(cooked, "raw", { value: raw });
478
- }
479
- else {
480
- cooked.raw = raw;
481
- }
482
- return cooked;
483
- }
484
- ;
485
- var __setModuleDefault = Object.create ? (function (o, v) {
486
- Object.defineProperty(o, "default", { enumerable: true, value: v });
487
- }) : function (o, v) {
488
- o["default"] = v;
489
- };
490
- function __importStar(mod) {
491
- if (mod && mod.__esModule)
492
- return mod;
493
- var result = {};
494
- if (mod != null)
495
- for (var k in mod)
496
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
497
- __createBinding(result, mod, k);
498
- __setModuleDefault(result, mod);
499
- return result;
500
- }
501
- function __importDefault(mod) {
502
- return (mod && mod.__esModule) ? mod : { default: mod };
503
- }
504
- function __classPrivateFieldGet(receiver, state, kind, f) {
505
- if (kind === "a" && !f)
506
- throw new TypeError("Private accessor was defined without a getter");
507
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
508
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
509
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
510
- }
511
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
512
- if (kind === "m")
513
- throw new TypeError("Private method is not writable");
514
- if (kind === "a" && !f)
515
- throw new TypeError("Private accessor was defined without a setter");
516
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
517
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
518
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
519
- }
520
-
521
- var CurrencyMega_Powers = [
522
- { unit: 'Q', value: Math.pow(10, 15) },
523
- { unit: 'T', value: Math.pow(10, 12) },
524
- { unit: 'B', value: Math.pow(10, 9) },
525
- { unit: 'M', value: Math.pow(10, 6) },
526
- { unit: 'K', value: 1000 }
527
- ];
528
-
529
- var CurrencyService = /** @class */ (function () {
530
- function CurrencyService(cog, locale, _defaultCurrencyCode) {
531
- if (_defaultCurrencyCode === void 0) { _defaultCurrencyCode = 'USD'; }
532
- this.locale = locale;
533
- this.currencyPipe = new common.CurrencyPipe(locale, _defaultCurrencyCode);
534
- this.c = cog.merge('utilCurrency', {
535
- startingUnit: 'yuan',
536
- megaUnit: { Q: '京', T: '兆', B: '亿', M: '万', K: '千' },
537
- precision: 2,
538
- ignoreZeroPrecision: true
539
- });
540
- }
541
- /**
542
- * Format a number with commas as thousands separators
543
- *
544
- * 格式化货币,用逗号将数字格式化为千位分隔符
545
- * ```ts
546
- * 10000 => `10,000`
547
- * 10000.567 => `10,000.57`
548
- * ```
549
- */
550
- CurrencyService.prototype.format = function (value, options) {
551
- options = Object.assign({ startingUnit: this.c.startingUnit, precision: this.c.precision, ignoreZeroPrecision: this.c.ignoreZeroPrecision, ngCurrency: this.c.ngCurrency }, options);
552
- var truthValue = Number(value);
553
- if (value == null || isNaN(truthValue)) {
554
- return '';
555
- }
556
- if (options.startingUnit === 'cent') {
557
- truthValue = truthValue / 100;
558
- }
559
- if (options.ngCurrency != null) {
560
- var cur = options.ngCurrency;
561
- return this.currencyPipe.transform(truthValue, cur.currencyCode, cur.display, cur.digitsInfo, cur.locale || this.locale);
562
- }
563
- var res = common.formatNumber(truthValue, this.locale, "." + (options.ignoreZeroPrecision ? 1 : options.precision) + "-" + options.precision);
564
- return options.ignoreZeroPrecision ? res.replace(/(?:\.[0]+)$/g, '') : res;
565
- };
566
- /**
567
- * Large number format filter
568
- *
569
- * 大数据格式化
570
- * ```ts
571
- * 1000 => { value: '1', unit: 'K', unitI18n: '千' }
572
- * 12456 => { value: '12.46', unit: 'K', unitI18n: '千' }
573
- * ```
574
- */
575
- CurrencyService.prototype.mega = function (value, options) {
576
- var e_1, _a;
577
- options = Object.assign({ precision: this.c.precision, unitI18n: this.c.megaUnit, startingUnit: this.c.startingUnit }, options);
578
- var num = Number(value);
579
- var res = { raw: value, value: '', unit: '', unitI18n: '' };
580
- if (isNaN(num) || num === 0) {
581
- res.value = value.toString();
582
- return res;
583
- }
584
- if (options.startingUnit === 'cent') {
585
- num = num / 100;
586
- }
587
- var abs = Math.abs(+num);
588
- var rounder = Math.pow(10, options.precision);
589
- var isNegative = num < 0;
590
- try {
591
- for (var CurrencyMega_Powers_1 = __values(CurrencyMega_Powers), CurrencyMega_Powers_1_1 = CurrencyMega_Powers_1.next(); !CurrencyMega_Powers_1_1.done; CurrencyMega_Powers_1_1 = CurrencyMega_Powers_1.next()) {
592
- var p = CurrencyMega_Powers_1_1.value;
593
- var reduced = abs / p.value;
594
- reduced = Math.round(reduced * rounder) / rounder;
595
- if (reduced >= 1) {
596
- abs = reduced;
597
- res.unit = p.unit;
598
- break;
599
- }
600
- }
601
- }
602
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
603
- finally {
604
- try {
605
- if (CurrencyMega_Powers_1_1 && !CurrencyMega_Powers_1_1.done && (_a = CurrencyMega_Powers_1.return)) _a.call(CurrencyMega_Powers_1);
606
- }
607
- finally { if (e_1) throw e_1.error; }
608
- }
609
- res.value = (isNegative ? '-' : '') + abs;
610
- res.unitI18n = options.unitI18n[res.unit];
611
- return res;
612
- };
613
- /**
614
- * Converted into RMB notation.
615
- *
616
- * 转化成人民币表示法
617
- */
618
- CurrencyService.prototype.cny = function (value, options) {
619
- var _a;
620
- options = Object.assign({ inWords: true, minusSymbol: '负', startingUnit: this.c.startingUnit }, options);
621
- value = Number(value);
622
- if (isNaN(value)) {
623
- return '';
624
- }
625
- if (options.startingUnit === 'cent') {
626
- value = value / 100;
627
- }
628
- value = value.toString();
629
- var integer;
630
- var decimal;
631
- _a = __read(value.split('.'), 2), integer = _a[0], decimal = _a[1];
632
- var symbol = '';
633
- if (integer.startsWith('-')) {
634
- symbol = options.minusSymbol;
635
- integer = integer.substr(1);
636
- }
637
- if (/^-?\d+$/.test(value)) {
638
- decimal = null;
639
- }
640
- integer = (+integer).toString();
641
- var inWords = options.inWords;
642
- var unit = {
643
- num: inWords
644
- ? ['', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖', '点']
645
- : ['', '一', '二', '三', '四', '五', '六', '七', '八', '九', '点'],
646
- radice: inWords
647
- ? [
648
- '',
649
- '拾',
650
- '佰',
651
- '仟',
652
- '万',
653
- '拾',
654
- '佰',
655
- '仟',
656
- '亿',
657
- '拾',
658
- '佰',
659
- '仟',
660
- '万亿',
661
- '拾',
662
- '佰',
663
- '仟',
664
- '兆',
665
- '拾',
666
- '佰',
667
- '仟'
668
- ]
669
- : [
670
- '',
671
- '十',
672
- '百',
673
- '千',
674
- '万',
675
- '十',
676
- '百',
677
- '千',
678
- '亿',
679
- '十',
680
- '百',
681
- '千',
682
- '万亿',
683
- '十',
684
- '百',
685
- '千',
686
- '兆',
687
- '十',
688
- '百',
689
- '千'
690
- ],
691
- dec: ['角', '分', '厘', '毫']
692
- };
693
- if (inWords) {
694
- value = (+value).toFixed(5).toString();
695
- }
696
- var integerRes = '';
697
- var integerCount = integer.length;
698
- if (integer === '0' || integerCount === 0) {
699
- integerRes = '零';
700
- }
701
- else {
702
- var cnDesc = '';
703
- for (var i = 0; i < integerCount; i++) {
704
- var n = +integer[i];
705
- var j = integerCount - i - 1;
706
- var isZero = i > 1 && n !== 0 && integer[i - 1] === '0';
707
- var cnZero = isZero ? '零' : '';
708
- var isEmpptyUnit = (n === 0 && j % 4 !== 0) || integer.substr(i - 3, 4) === '0000';
709
- var descMark = cnDesc;
710
- var cnNum = unit.num[n];
711
- cnDesc = isEmpptyUnit ? '' : unit.radice[j];
712
- // 第一位是一十
713
- if (i === 0 && cnNum === '一' && cnDesc === '十')
714
- cnNum = '';
715
- var isChangeEr = n > 1 &&
716
- cnNum === '二' && // 去除首位
717
- ['', '十', '百'].indexOf(cnDesc) === -1 && // 不读两\两十\两百
718
- descMark !== '十'; // 不读十两
719
- if (isChangeEr)
720
- cnNum = '两';
721
- integerRes += cnZero + cnNum + cnDesc;
722
- }
723
- }
724
- // 小数部分拼接
725
- var decimalRes = '';
726
- var decimalCount = decimal ? decimal.toString().length : 0;
727
- if (decimal === null) {
728
- decimalRes = inWords ? '整' : '';
729
- }
730
- else if (decimal === '0') {
731
- decimalRes = '零';
732
- }
733
- else {
734
- for (var i = 0; i < decimalCount; i++) {
735
- if (inWords && i > unit.dec.length - 1)
736
- break;
737
- var n = decimal[i];
738
- var cnZero = n === '0' ? '零' : '';
739
- var cnNum = unit.num[+n];
740
- var cnDesc = inWords ? unit.dec[i] : '';
741
- decimalRes += cnZero + cnNum + cnDesc;
742
- }
743
- }
744
- var ret = symbol +
745
- (inWords
746
- ? integerRes + (decimalRes === '零' ? '元整' : "\u5143" + decimalRes)
747
- : integerRes + (decimalRes === '' ? '' : "\u70B9" + decimalRes));
748
- return ret;
749
- };
750
- return CurrencyService;
751
- }());
752
- CurrencyService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function CurrencyService_Factory() { return new CurrencyService(i0__namespace.ɵɵinject(i1__namespace.YunzaiConfigService), i0__namespace.ɵɵinject(i0__namespace.LOCALE_ID), i0__namespace.ɵɵinject(i0__namespace.DEFAULT_CURRENCY_CODE)); }, token: CurrencyService, providedIn: "root" });
753
- CurrencyService.decorators = [
754
- { type: i0.Injectable, args: [{ providedIn: 'root' },] }
755
- ];
756
- CurrencyService.ctorParameters = function () { return [
757
- { type: i1.YunzaiConfigService },
758
- { type: String, decorators: [{ type: i0.Inject, args: [i0.LOCALE_ID,] }] },
759
- { type: String, decorators: [{ type: i0.Inject, args: [i0.DEFAULT_CURRENCY_CODE,] }] }
760
- ]; };
761
-
762
- /**
763
- * Generated bundle index. Do not edit.
764
- */
765
-
766
- exports.CurrencyMega_Powers = CurrencyMega_Powers;
767
- exports.CurrencyService = CurrencyService;
768
- exports.REGEX = REGEX;
769
- exports.REGEX_STR = REGEX_STR;
770
- exports.format = format;
771
- exports.formatMask = formatMask;
772
- exports.isChinese = isChinese;
773
- exports.isColor = isColor;
774
- exports.isDecimal = isDecimal;
775
- exports.isIdCard = isIdCard;
776
- exports.isInt = isInt;
777
- exports.isIp = isIp;
778
- exports.isMobile = isMobile;
779
- exports.isNum = isNum;
780
- exports.isUrl = isUrl;
781
-
782
- Object.defineProperty(exports, '__esModule', { value: true });
783
-
784
- }));
785
- //# sourceMappingURL=yelon-util-format.umd.js.map