@yelon/util 12.0.19 → 13.2.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.mjs","sources":["../../../../packages/util/browser/cookie.service.ts","../../../../packages/util/browser/copy.ts","../../../../packages/util/browser/is-empty.ts","../../../../packages/util/browser/scroll.service.ts","../../../../packages/util/browser/style.ts","../../../../packages/util/browser/browser.ts"],"sourcesContent":["import { Platform } from '@angular/cdk/platform';\nimport { DOCUMENT } from '@angular/common';\nimport { Inject, Injectable } from '@angular/core';\n\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\nexport interface CookieOptions {\n path?: string;\n domain?: string;\n /**\n * Expiration time, `number` is seconds\n *\n * 过期时间,`number` 类型表示秒数\n */\n expires?: number | Date | string;\n secure?: boolean;\n HttpOnly?: boolean;\n SameSite?: boolean | 'lax' | 'strict' | 'none';\n}\n\n/**\n * A set of simple Cookie manipulation classes.\n *\n * 一组简单的 Cookie 操作类。\n */\n@Injectable({ providedIn: 'root' })\nexport class CookieService {\n private get doc(): Document {\n return this._doc || document;\n }\n\n /**\n * Original cookie value\n *\n * 原始Cookie值\n */\n get cookie(): string {\n return this.platform.isBrowser ? this.doc.cookie : '';\n }\n\n constructor(@Inject(DOCUMENT) private _doc: NzSafeAny, private platform: Platform) {}\n\n /**\n * Get all cookie key-value pairs\n *\n * 获取所有Cookie键值对\n */\n getAll(): { [key: string]: string } {\n const ret: { [key: string]: string } = {};\n const arr = this.cookie.split('; ');\n for (let i = 0; i < arr.length; i++) {\n const cookie = arr[i];\n const index = cookie.indexOf('=');\n if (index > 0) {\n const name = decodeURIComponent(cookie.substring(0, index));\n if (ret[name] == null) {\n ret[name] = decodeURIComponent(cookie.substring(index + 1));\n }\n }\n }\n return ret;\n }\n\n /**\n * Get the value of given cookie `key`\n *\n * 获取指定 `key` 的值\n */\n get(key: string): string | undefined {\n return this.getAll()[key];\n }\n\n /**\n * Sets a value for given cookie key\n *\n * 设置指定 Cookie 键的值\n */\n put(key: string, value: string | undefined, options?: CookieOptions): void {\n if (!this.platform.isBrowser) {\n return;\n }\n const opt = { path: '/', ...options };\n if (typeof opt.expires === 'number') {\n opt.expires = new Date(+new Date() + opt.expires * 1e3);\n }\n if (typeof opt.expires !== 'string') {\n opt.expires = opt.expires ? opt.expires.toUTCString() : '';\n }\n const optStr: { [key: string]: string | boolean } = opt as NzSafeAny;\n const attributes = Object.keys(optStr)\n .filter(k => optStr[k] && optStr[k] !== true)\n .map(k => `${k}=${(optStr[k] as string).split(';')[0]}`)\n .join(';');\n this.doc.cookie = `${encodeURIComponent(String(key))}=${encodeURIComponent(String(value))}${\n attributes ? `; ${attributes}` : ''\n }`;\n }\n\n /**\n * Remove given cookie\n *\n * 移除指定 Cookie\n */\n remove(key: string, options?: CookieOptions): void {\n this.put(key, undefined, options);\n }\n\n /**\n * Remove all cookies\n *\n * 移除所有 Cookies\n */\n removeAll(): void {\n this.doc.cookie = '';\n }\n}\n","/**\n * Copy text to clipboard\n *\n * 复制字符串文档至剪贴板\n */\n export function copy(value: string): Promise<void> {\n return navigator.clipboard.writeText(value);\n}\n","/**\n * Used to verify `<ng-content></ng-content>` is empty, useful for custom components.\n *\n * 用于校验 `<ng-content></ng-content>` 是否为空,自定义组件时蛮有用。\n */\nexport function isEmpty(element: HTMLElement): boolean {\n const nodes = element.childNodes;\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes.item(i);\n if (node.nodeType === 1 && (node as HTMLElement).outerHTML.toString().trim().length !== 0) {\n return false;\n } else if (node.nodeType === 3 && node.textContent!.toString().trim().length !== 0) {\n return false;\n }\n }\n return true;\n}\n","import { Platform } from '@angular/cdk/platform';\nimport { DOCUMENT } from '@angular/common';\nimport { Inject, Injectable } from '@angular/core';\n\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\n@Injectable({ providedIn: 'root' })\nexport class ScrollService {\n private _getDoc(): Document {\n return this._doc || document;\n }\n\n private _getWin(): Window {\n const doc = this._getDoc();\n return doc.defaultView || window;\n }\n\n constructor(@Inject(DOCUMENT) private _doc: NzSafeAny, private platform: Platform) {}\n\n /**\n * 获取滚动条位置\n *\n * @param element 指定元素,默认 `window`\n */\n getScrollPosition(element?: Element | Window): [number, number] {\n if (!this.platform.isBrowser) {\n return [0, 0];\n }\n\n const win = this._getWin();\n if (element && element !== win) {\n return [(element as Element).scrollLeft, (element as Element).scrollTop];\n } else {\n return [win.scrollX, win.scrollY];\n }\n }\n\n /**\n * 设置滚动条位置\n *\n * @param element 指定元素\n */\n scrollToPosition(element: Element | Window | null | undefined, position: [number, number]): void {\n if (!this.platform.isBrowser) {\n return;\n }\n (element || this._getWin()).scrollTo(position[0], position[1]);\n }\n\n /**\n * 设置滚动条至指定元素\n *\n * @param element 指定元素,默认 `document.body`\n * @param topOffset 偏移值,默认 `0`\n */\n scrollToElement(element?: Element | null, topOffset: number = 0): void {\n if (!this.platform.isBrowser) {\n return;\n }\n if (!element) {\n element = this._getDoc().body;\n }\n\n element.scrollIntoView();\n\n const win = this._getWin();\n if (win && win.scrollBy) {\n win.scrollBy(0, element!.getBoundingClientRect().top - topOffset);\n\n if (win.scrollY < 20) {\n win.scrollBy(0, -win.scrollY);\n }\n }\n }\n\n /**\n * 滚动至顶部\n *\n * @param topOffset 偏移值,默认 `0`\n */\n scrollToTop(topOffset: number = 0): void {\n if (!this.platform.isBrowser) {\n return;\n }\n this.scrollToElement(this._getDoc().body, topOffset);\n }\n}\n","import { Renderer2 } from '@angular/core';\n\nfunction removeClass(el: HTMLElement, classMap: { [klass: string]: unknown }, renderer: Renderer2): void {\n Object.keys(classMap).forEach(key => renderer.removeClass(el, key));\n}\n\nfunction addClass(el: HTMLElement, classMap: { [klass: string]: unknown }, renderer: Renderer2): void {\n for (const i in classMap) {\n if (classMap[i]) {\n renderer.addClass(el, i);\n }\n }\n}\n\n/**\n * Update host component style `class`\n *\n * 更新宿主组件样式 `class`\n *\n * ```ts\n * updateHostClass(\n * this.el.nativeElement,\n * this.renderer,\n * {\n * [ 'classname' ]: true,\n * [ 'classname' ]: this.type === '1',\n * [ this.cls ]: true,\n * [ `a-${this.cls}` ]: true\n * })\n * ```\n */\nexport function updateHostClass(\n el: HTMLElement,\n renderer: Renderer2,\n classMap: { [klass: string]: unknown },\n preClean: boolean = false\n): void {\n if (preClean === true) {\n renderer.removeAttribute(el, 'class');\n } else {\n removeClass(el, classMap, renderer);\n }\n classMap = { ...classMap };\n addClass(el, classMap, renderer);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAoBA;;;;;MAMa,aAAa;IAcxB,YAAsC,IAAe,EAAU,QAAkB;QAA3C,SAAI,GAAJ,IAAI,CAAW;QAAU,aAAQ,GAAR,QAAQ,CAAU;KAAI;IAbrF,IAAY,GAAG;QACb,OAAO,IAAI,CAAC,IAAI,IAAI,QAAQ,CAAC;KAC9B;;;;;;IAOD,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC;KACvD;;;;;;IASD,MAAM;QACJ,MAAM,GAAG,GAA8B,EAAE,CAAC;QAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACnC,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;YACtB,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAClC,IAAI,KAAK,GAA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AAC,EAAE;YACf,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;SAC1B;KACF;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;SAiBgB,eAAe,CAC7B,EAAe,EACf,QAAmB,EACnB,QAAsC,EACtC,WAAoB,KAAK;IAEzB,IAAI,QAAQ,KAAK,IAAI,EAAE;QACrB,QAAQ,CAAC,eAAe,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;KACvC;SAAM;QACL,WAAW,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;KACrC;IACD,QAAQ,qBAAQ,QAAQ,CAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACnC;;AC5CA;;;;;;"}
@@ -34,17 +34,23 @@ class YunzaiConfigService {
34
34
  this.config[componentName] = Object.assign(Object.assign({}, this.config[componentName]), value);
35
35
  }
36
36
  }
37
- YunzaiConfigService.ɵprov = i0.ɵɵdefineInjectable({ factory: function YunzaiConfigService_Factory() { return new YunzaiConfigService(i0.ɵɵinject(YUNZAI_CONFIG, 8)); }, token: YunzaiConfigService, providedIn: "root" });
38
- YunzaiConfigService.decorators = [
39
- { type: Injectable, args: [{ providedIn: 'root' },] }
40
- ];
41
- YunzaiConfigService.ctorParameters = () => [
42
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [YUNZAI_CONFIG,] }] }
43
- ];
37
+ YunzaiConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: YunzaiConfigService, deps: [{ token: YUNZAI_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
38
+ YunzaiConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: YunzaiConfigService, providedIn: 'root' });
39
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: YunzaiConfigService, decorators: [{
40
+ type: Injectable,
41
+ args: [{ providedIn: 'root' }]
42
+ }], ctorParameters: function () {
43
+ return [{ type: undefined, decorators: [{
44
+ type: Optional
45
+ }, {
46
+ type: Inject,
47
+ args: [YUNZAI_CONFIG]
48
+ }] }];
49
+ } });
44
50
 
45
51
  /**
46
52
  * Generated bundle index. Do not edit.
47
53
  */
48
54
 
49
55
  export { YUNZAI_CONFIG, YUNZAI_CONFIG_FACTORY, YunzaiConfigService, YunzaiSVConfig };
50
- //# sourceMappingURL=yelon-util-config.js.map
56
+ //# sourceMappingURL=config.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.mjs","sources":["../../../../packages/util/config/abc/sv.type.ts","../../../../packages/util/config/config.types.ts","../../../../packages/util/config/config.service.ts","../../../../packages/util/config/config.ts"],"sourcesContent":["export class YunzaiSVConfig {\n /** 大小,默认:`large` */\n size?: 'small' | 'large';\n /** 间距,默认:`32` */\n gutter?: number;\n /** 布局,默认:`horizontal` */\n layout?: 'horizontal' | 'vertical';\n /** 列数,默认:`3` */\n col?: number;\n /** 是否显示默认值,当内容为空值时显示 `-`,默认:`true` */\n default?: boolean;\n /** `label` 固定宽度,若 `null` 或 `undefined` 表示非固定,默认:`null` */\n labelWidth?: number;\n}\n","import { InjectionToken } from '@angular/core';\n\nimport {\n YunzaiDateRangePickerConfig,\n YunzaiErrorCollectConfig,\n YunzaiImageConfig,\n YunzaiLoadingConfig,\n YunzaiLodopConfig,\n YunzaiMediaConfig,\n YunzaiOnboardingConfig,\n YunzaiPageHeaderConfig,\n YunzaiPdfConfig,\n YunzaiQRConfig,\n YunzaiSEConfig,\n YunzaiSGConfig,\n YunzaiSTConfig,\n YunzaiSVConfig,\n YunzaiXlsxConfig,\n YunzaiZipConfig\n} from './abc/index';\nimport { YunzaiACLConfig } from './acl/acl.type';\nimport { YunzaiAuthConfig } from './auth/auth.type';\nimport { YunzaiBusinessConfig } from './bis/bis.type';\nimport { YunzaiCacheConfig } from './cache/cache.type';\nimport { YunzaiChartConfig } from './chart/chart.type';\nimport { YunzaiMockConfig } from './mock/mock.type';\nimport { YunzaiSFConfig } from './sf/sf.type';\nimport { YunzaiStompConfig } from './stomp/stomp.type';\nimport { YunzaiThemeHttpClientConfig } from './theme/http.type';\nimport { YunzaiThemeI18nConfig } from './theme/i18n.type';\nimport { YunzaiThemeResponsiveConfig } from './theme/responsive.type';\nimport { YunzaiUtilArrayConfig } from './util/array.type';\nimport { YunzaiUtilCurrencyConfig } from './util/currency.type';\n\nexport interface YunzaiConfig {\n bis?: YunzaiBusinessConfig;\n stomp?: YunzaiStompConfig;\n dataRange?: YunzaiDateRangePickerConfig;\n errorCollect?: YunzaiErrorCollectConfig;\n image?: YunzaiImageConfig;\n loading?: YunzaiLoadingConfig;\n onboarding?: YunzaiOnboardingConfig;\n lodop?: YunzaiLodopConfig;\n pageHeader?: YunzaiPageHeaderConfig;\n qr?: YunzaiQRConfig;\n se?: YunzaiSEConfig;\n sg?: YunzaiSGConfig;\n sv?: YunzaiSVConfig;\n st?: YunzaiSTConfig;\n sf?: YunzaiSFConfig;\n xlsx?: YunzaiXlsxConfig;\n zip?: YunzaiZipConfig;\n pdf?: YunzaiPdfConfig;\n media?: YunzaiMediaConfig;\n acl?: YunzaiACLConfig;\n auth?: YunzaiAuthConfig;\n cache?: YunzaiCacheConfig;\n chart?: YunzaiChartConfig;\n mock?: YunzaiMockConfig;\n utilArray?: YunzaiUtilArrayConfig;\n utilCurrency?: YunzaiUtilCurrencyConfig;\n themeHttp?: YunzaiThemeHttpClientConfig;\n themeResponsive?: YunzaiThemeResponsiveConfig;\n themeI18n?: YunzaiThemeI18nConfig;\n}\n\nexport type YunzaiConfigKey = keyof YunzaiConfig;\n\nexport const YUNZAI_CONFIG = new InjectionToken<YunzaiConfig>('yunzai-config', {\n providedIn: 'root',\n factory: YUNZAI_CONFIG_FACTORY\n});\n\nexport function YUNZAI_CONFIG_FACTORY(): YunzaiConfig {\n return {};\n}\n","import { Inject, Injectable, Optional } from '@angular/core';\n\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\nimport { deepMergeKey } from '@yelon/util/other';\n\nimport { YunzaiConfig, YunzaiConfigKey, YUNZAI_CONFIG } from './config.types';\n\n@Injectable({ providedIn: 'root' })\nexport class YunzaiConfigService {\n private config: YunzaiConfig;\n\n constructor(@Optional() @Inject(YUNZAI_CONFIG) defaultConfig?: YunzaiConfig) {\n this.config = { ...defaultConfig };\n }\n\n get<T extends YunzaiConfigKey>(componentName: T, key?: string): YunzaiConfig[T] {\n const res = ((this.config[componentName] as { [key: string]: unknown }) || {}) as NzSafeAny;\n return key ? { [key]: res[key] } : res;\n }\n\n merge<T extends YunzaiConfigKey>(componentName: T, ...defaultValues: Array<YunzaiConfig[T]>): YunzaiConfig[T] {\n return deepMergeKey({}, true, ...defaultValues, this.get(componentName));\n }\n\n attach<T extends YunzaiConfigKey>(componentThis: unknown, componentName: T, defaultValues: YunzaiConfig[T]): void {\n Object.assign(componentThis, this.merge(componentName, defaultValues));\n }\n\n attachKey<T extends YunzaiConfigKey>(componentThis: unknown, componentName: T, key: string): void {\n Object.assign(componentThis, this.get(componentName, key));\n }\n\n set<T extends YunzaiConfigKey>(componentName: T, value: YunzaiConfig[T]): void {\n this.config[componentName] = { ...this.config[componentName], ...value };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAAa,cAAc;;;MCoEd,aAAa,GAAG,IAAI,cAAc,CAAe,eAAe,EAAE;IAC7E,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,qBAAqB;CAC/B,EAAE;SAEa,qBAAqB;IACnC,OAAO,EAAE,CAAC;AACZ;;MClEa,mBAAmB;IAG9B,YAA+C,aAA4B;QACzE,IAAI,CAAC,MAAM,qBAAQ,aAAa,CAAE,CAAC;KACpC;IAED,GAAG,CAA4B,aAAgB,EAAE,GAAY;QAC3D,MAAM,GAAG,IAAK,IAAI,CAAC,MAAM,CAAC,aAAa,CAAgC,IAAI,EAAE,CAAc,CAAC;QAC5F,OAAO,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC;KACxC;IAED,KAAK,CAA4B,aAAgB,EAAE,GAAG,aAAqC;QACzF,OAAO,YAAY,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,aAAa,EAAE,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;KAC1E;IAED,MAAM,CAA4B,aAAsB,EAAE,aAAgB,EAAE,aAA8B;QACxG,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC;KACxE;IAED,SAAS,CAA4B,aAAsB,EAAE,aAAgB,EAAE,GAAW;QACxF,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC;KAC5D;IAED,GAAG,CAA4B,aAAgB,EAAE,KAAsB;QACrE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,mCAAQ,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAK,KAAK,CAAE,CAAC;KAC1E;;gHA1BU,mBAAmB,kBAGE,aAAa;oHAHlC,mBAAmB,cADN,MAAM;2FACnB,mBAAmB;kBAD/B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;8BAInB,QAAQ;;8BAAI,MAAM;+BAAC,aAAa;;;;ACZ/C;;;;;;"}
@@ -203,4 +203,4 @@ const dateTimePickerUtil = new DateTimePickerUtil();
203
203
  */
204
204
 
205
205
  export { DateTimePickerUtil, dateTimePickerUtil, fixEndTimeOfRange, getTimeDistance, toDate };
206
- //# sourceMappingURL=yelon-util-date-time.js.map
206
+ //# sourceMappingURL=date-time.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-time.mjs","sources":["../../../../packages/util/date-time/time.ts","../../../../packages/util/date-time/picker.ts","../../../../packages/util/date-time/date-time.ts"],"sourcesContent":["import {\n addDays,\n endOfDay,\n endOfMonth,\n endOfWeek,\n endOfYear,\n parse,\n parseISO,\n startOfDay,\n startOfMonth,\n startOfWeek,\n startOfYear,\n subMonths,\n subWeeks,\n subYears\n} from 'date-fns';\n\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\n/**\n * Get the time range, return `[ Date, Date]` for the start and end dates\n *\n * 获取时间范围\n *\n * @param type 类型,带 `-` 表示过去一个时间,若指定 `number` 表示天数\n * @param time 开始时间\n */\nexport function getTimeDistance(\n type: 'today' | '-today' | 'yesterday' | 'week' | '-week' | 'month' | '-month' | 'year' | '-year' | number,\n time?: Date | string | number\n): [Date, Date] {\n time = time\n ? typeof time === 'string'\n ? parse(time, 'yyyy-MM-dd HH:mm:ss', new Date())\n : new Date(time)\n : new Date();\n const options: { weekStartsOn: 1 } = { weekStartsOn: 1 };\n\n let res: [Date, Date];\n switch (type) {\n case 'today':\n res = [time, time];\n break;\n case '-today':\n res = [addDays(time, -1), time];\n break;\n case 'yesterday':\n res = [addDays(time, -1), addDays(time, -1)];\n break;\n case 'week':\n res = [startOfWeek(time, options), endOfWeek(time, options)];\n break;\n case '-week':\n res = [startOfWeek(subWeeks(time, 1), options), endOfWeek(subWeeks(time, 1), options)];\n break;\n case 'month':\n res = [startOfMonth(time), endOfMonth(time)];\n break;\n case '-month':\n res = [startOfMonth(subMonths(time, 1)), endOfMonth(subMonths(time, 1))];\n break;\n case 'year':\n res = [startOfYear(time), endOfYear(time)];\n break;\n case '-year':\n res = [startOfYear(subYears(time, 1)), endOfYear(subYears(time, 1))];\n break;\n default:\n res = type > 0 ? [time, addDays(time, type)] : [addDays(time, type), time];\n break;\n }\n return fixEndTimeOfRange(res);\n}\n\n/**\n * fix time is the most, big value\n */\nexport function fixEndTimeOfRange(dates: [Date, Date]): [Date, Date] {\n return [startOfDay(dates[0]), endOfDay(dates[1])];\n}\n\nexport type ToDateOptions = string | { formatString?: string; defaultValue?: NzSafeAny };\n\n/**\n * Return the date parsed from string using the given format string\n * - If the argument is a number, it is treated as a timestamp.\n *\n * @param formatString If parsing fails try to parse the date by pressing `formatString`\n * @param defaultValue If parsing fails returned default value, default: `new Date(NaN)`\n */\nexport function toDate(value: Date | string | number, options?: ToDateOptions): Date {\n if (typeof options === 'string') options = { formatString: options };\n const { formatString, defaultValue } = {\n formatString: 'yyyy-MM-dd HH:mm:ss',\n defaultValue: new Date(NaN),\n ...options\n };\n if (value == null) {\n return defaultValue;\n }\n if (value instanceof Date) {\n return value;\n }\n if (typeof value === 'number' || (typeof value === 'string' && /[0-9]{10,13}/.test(value))) {\n return new Date(+value);\n }\n let tryDate = parseISO(value);\n if (isNaN(tryDate as NzSafeAny)) {\n tryDate = parse(value, formatString!, new Date());\n }\n\n return isNaN(tryDate as NzSafeAny) ? defaultValue : tryDate;\n}\n","import { addDays, addSeconds, differenceInCalendarDays, format } from 'date-fns';\n\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\nimport { DisabledDateFn, DisabledTimeConfig, DisabledTimeFn } from 'ng-zorro-antd/date-picker';\n\n// TODO: timezone process\nexport class DateTimePickerUtil {\n /**\n * Current local time\n *\n * 当前本地时间\n */\n get now(): Date {\n return new Date();\n }\n /**\n * Current local date (not including time part)\n *\n * 当前本地日期(不包含时间部分)\n */\n get date(): Date {\n return this.removeTime(this.now);\n }\n /**\n * Remove the time part of the date\n *\n * 移除日期的时间部分\n */\n removeTime(d: Date): Date {\n return new Date(d.toDateString());\n }\n /**\n * Format date-time\n *\n * 格式化日期\n */\n format(d: number | Date, formatString: string = 'yyyy-MM-dd HH:mm:ss'): string {\n return format(d, formatString);\n }\n private genTick(count: number): number[] {\n return new Array(count).fill(0).map((_, idx) => idx);\n }\n /**\n * Calculate the number of days between two dates, `0` means the same day\n *\n * 计算两个日期相差天数,`0` 表示同一天\n */\n getDiffDays(dateLeft: Date | number, dateRight?: Date | number): number {\n return differenceInCalendarDays(\n dateLeft,\n typeof dateRight === 'number' ? addDays(this.date, dateRight) : dateRight || this.date\n );\n }\n /**\n * Disabled Before date (Default: today), Generally serves `nzDisabledDate`\n *\n * 禁用之前日期(默认:今天),一般服务于 `nzDisabledDate`\n */\n disabledBeforeDate(options?: { offsetDays?: Date | number }): DisabledDateFn {\n return (d): boolean => this.getDiffDays(d, options?.offsetDays) < 0;\n }\n /**\n * Disabled After date (Default: today), Generally serves `nzDisabledDate`\n *\n * 禁用之后日期(默认:今天),一般服务于 `nzDisabledDate`\n */\n disabledAfterDate(options?: { offsetDays?: Date | number }): DisabledDateFn {\n return (d): boolean => this.getDiffDays(d, options?.offsetDays) > 0;\n }\n private baseDisabledTime(type: 'before' | 'after', offsetSeconds?: number): DisabledTimeFn {\n const tick24 = this.genTick(24);\n const tick60 = this.genTick(60);\n return (current): DisabledTimeConfig => {\n const cur = current as Date;\n if (cur == null) {\n return {} as NzSafeAny;\n }\n const now = addSeconds(this.now, offsetSeconds || 0);\n const nowHours = now.getHours();\n const nowMinutes = now.getMinutes();\n const curHours = cur.getHours();\n const isToday = this.getDiffDays(this.removeTime(cur)) === 0;\n return {\n nzDisabledHours: () => {\n if (!isToday) return [];\n return type === 'before' ? tick24.slice(0, nowHours) : tick24.slice(nowHours + 1);\n },\n nzDisabledMinutes: () => {\n if (isToday && curHours === nowHours) {\n return type === 'before' ? tick60.slice(0, nowMinutes) : tick60.slice(nowMinutes + 1);\n }\n return [];\n },\n nzDisabledSeconds: () => {\n if (isToday && curHours === nowHours && cur.getMinutes() === nowMinutes) {\n const nowSeconds = now.getSeconds();\n return type === 'before' ? tick60.slice(0, nowSeconds) : tick60.slice(nowSeconds + 1);\n }\n return [];\n }\n };\n };\n }\n /**\n * Disabled Before time (Default: now), Generally serves `nzDisabledTime`\n *\n * 禁用之前时间(默认:现在),一般服务于 `nzDisabledTime`\n */\n disabledBeforeTime(options?: { offsetSeconds?: number }): DisabledTimeFn {\n return this.baseDisabledTime('before', options?.offsetSeconds);\n }\n /**\n * Disabled After time (Default: now), Generally serves `nzDisabledTime`\n *\n * 禁用之后时间(默认:现在),一般服务于 `nzDisabledTime`\n */\n disabledAfterTime(options?: { offsetSeconds?: number }): DisabledTimeFn {\n return this.baseDisabledTime('after', options?.offsetSeconds);\n }\n}\n\nexport const dateTimePickerUtil = new DateTimePickerUtil();\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAmBA;;;;;;;;SAQgB,eAAe,CAC7B,IAA0G,EAC1G,IAA6B;IAE7B,IAAI,GAAG,IAAI;UACP,OAAO,IAAI,KAAK,QAAQ;cACtB,KAAK,CAAC,IAAI,EAAE,qBAAqB,EAAE,IAAI,IAAI,EAAE,CAAC;cAC9C,IAAI,IAAI,CAAC,IAAI,CAAC;UAChB,IAAI,IAAI,EAAE,CAAC;IACf,MAAM,OAAO,GAAwB,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC;IAEzD,IAAI,GAAiB,CAAC;IACtB,QAAQ,IAAI;QACV,KAAK,OAAO;YACV,GAAG,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACnB,MAAM;QACR,KAAK,QAAQ;YACX,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;YAChC,MAAM;QACR,KAAK,WAAW;YACd,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7C,MAAM;QACR,KAAK,MAAM;YACT,GAAG,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;YAC7D,MAAM;QACR,KAAK,OAAO;YACV,GAAG,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,EAAE,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P,OAAO,CAAE,aAAa,CAAC,CAAC;KAC/D;CACF;MAEY,kBAAkB,GAAG,IAAI,kBAAkB;;ACzHxD;;;;;;"}
@@ -3,8 +3,10 @@ import { warn } from '@yelon/util/other';
3
3
  function propDecoratorFactory(name, fallback, defaultValue) {
4
4
  function propDecorator(target, propName, originalDescriptor) {
5
5
  const privatePropName = `$$__${propName}`;
6
- if (Object.prototype.hasOwnProperty.call(target, privatePropName)) {
7
- warn(`The prop "${privatePropName}" is already exist, it will be overrided by ${name} decorator.`);
6
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
7
+ if (Object.prototype.hasOwnProperty.call(target, privatePropName)) {
8
+ warn(`The prop "${privatePropName}" is already exist, it will be overrided by ${name} decorator.`);
9
+ }
8
10
  }
9
11
  Object.defineProperty(target, privatePropName, {
10
12
  configurable: true,
@@ -62,7 +64,9 @@ function makeFn(type, options) {
62
64
  const that = this;
63
65
  const ngZone = that[(options === null || options === void 0 ? void 0 : options.ngZoneName) || 'ngZone'];
64
66
  if (!ngZone) {
65
- warn(`ZoneOutside: Decorator should have 'ngZone' property with 'NgZone' class.`);
67
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
68
+ warn(`ZoneOutside: Decorator should have 'ngZone' property with 'NgZone' class.`);
69
+ }
66
70
  return source.call(this, ...data);
67
71
  }
68
72
  let res;
@@ -114,4 +118,4 @@ function ZoneRun(options) {
114
118
  */
115
119
 
116
120
  export { InputBoolean, InputNumber, ZoneOutside, ZoneRun, toBoolean, toNumber };
117
- //# sourceMappingURL=yelon-util-decorator.js.map
121
+ //# sourceMappingURL=decorator.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorator.mjs","sources":["../../../../packages/util/decorator/convert.ts","../../../../packages/util/decorator/zone-outside.ts","../../../../packages/util/decorator/decorator.ts"],"sourcesContent":["import { warn } from '@yelon/util/other';\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\nexport type BooleanInput = boolean | string | undefined | null;\nexport type NumberInput = number | string | undefined | null;\n\nfunction propDecoratorFactory<T, D>(\n name: string,\n fallback: (v: T, defaultValue: D) => D,\n defaultValue: NzSafeAny\n): (target: NzSafeAny, propName: string) => void {\n function propDecorator(\n target: NzSafeAny,\n propName: string,\n originalDescriptor?: TypedPropertyDescriptor<NzSafeAny>\n ): NzSafeAny {\n const privatePropName = `$$__${propName}`;\n\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (Object.prototype.hasOwnProperty.call(target, privatePropName)) {\n warn(`The prop \"${privatePropName}\" is already exist, it will be overrided by ${name} decorator.`);\n }\n }\n\n Object.defineProperty(target, privatePropName, {\n configurable: true,\n writable: true\n });\n\n return {\n get(): string {\n return originalDescriptor && originalDescriptor.get\n ? originalDescriptor.get.bind(this)()\n : this[privatePropName];\n },\n set(value: T): void {\n if (originalDescriptor && originalDescriptor.set) {\n originalDescriptor.set.bind(this)(fallback(value, defaultValue));\n }\n this[privatePropName] = fallback(value, defaultValue);\n }\n };\n }\n\n return propDecorator;\n}\n\nexport function toBoolean(\n value: unknown,\n defaultValue: boolean | null | undefined = false\n): boolean | null | undefined {\n return value == null ? defaultValue : `${value}` !== 'false';\n}\n\n/**\n * Input decorator that handle a prop to do get/set automatically with toBoolean\n *\n * ```ts\n * {AT}Input() {AT}InputBoolean() visible: boolean = false;\n * {AT}Input() {AT}InputBoolean(null) visible: boolean = false;\n * ```\n */\nexport function InputBoolean(defaultValue: boolean | null = false): NzSafeAny {\n return propDecoratorFactory('InputBoolean', toBoolean, defaultValue);\n}\n\nexport function toNumber(value: unknown): number;\nexport function toNumber<D>(value: unknown, fallback: D): number | D;\nexport function toNumber(value: unknown, fallbackValue: number = 0): number {\n return !isNaN(parseFloat(value as NzSafeAny)) && !isNaN(Number(value)) ? Number(value) : fallbackValue;\n}\n\n/**\n * Input decorator that handle a prop to do get/set automatically with toNumber\n *\n * ```ts\n * {AT}Input() {AT}InputNumber() visible: number = 1;\n * {AT}Input() {AT}InputNumber(null) visible: number = 2;\n * ```\n */\nexport function InputNumber(defaultValue: number | null = 0): NzSafeAny {\n return propDecoratorFactory('InputNumber', toNumber, defaultValue);\n}\n","import { warn } from '@yelon/util/other';\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\nexport interface ZoneOptions {\n ngZoneName?: string;\n}\n\ntype DecoratorType = (target: unknown, fn: string, descriptor: PropertyDescriptor) => PropertyDescriptor;\n\nfunction makeFn(type: 'runOutsideAngular' | 'run', options?: ZoneOptions): DecoratorType {\n return (_, __, descriptor) => {\n const source = descriptor.value;\n descriptor.value = function (...data: NzSafeAny[]): () => void {\n const that = this as NzSafeAny;\n const ngZone = that[options?.ngZoneName || 'ngZone'];\n if (!ngZone) {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n warn(`ZoneOutside: Decorator should have 'ngZone' property with 'NgZone' class.`);\n }\n return source.call(this, ...data);\n }\n let res: NzSafeAny;\n ngZone[type](() => {\n res = source.call(this, ...data);\n });\n return res;\n };\n\n return descriptor;\n };\n}\n\n/**\n * The decoration method runs in `runOutsideAngular`\n *\n * 装饰方法运行在 `runOutsideAngular` 内\n *\n * ```ts\n * class MockClass {\n * constructor(public ngZone: NgZone) {}\n *\n * {AT}ZoneOutside()\n * runOutsideAngular(): void {}\n * }\n * ```\n */\nexport function ZoneOutside(options?: ZoneOptions): DecoratorType {\n return makeFn('runOutsideAngular', options);\n}\n\n/**\n * The decoration method runs in `run`\n *\n * 装饰方法运行在 `run` 内\n *\n * ```ts\n * class MockClass {\n * constructor(public ngZone: NgZone) {}\n *\n * {AT}ZoneRun()\n * run(): void {}\n * }\n * ```\n */\nexport function ZoneRun(options?: ZoneOptions): DecoratorType {\n return makeFn('run', options);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAMA,SAAS,oBAAoB,CAC3B,IAAY,EACZ,QAAsC,EACtC,YAAuB;IAEvB,SAAS,aAAa,CACpB,MAAiB,EACjB,QAAgB,EAChB,kBAAuD;QAEv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;IAC3C,OAAO,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAChC;;AClEA;;;;;;"}
@@ -115,4 +115,4 @@ function MatchControl(controlName, matchingControlName) {
115
115
  */
116
116
 
117
117
  export { MatchControl, _Validators };
118
- //# sourceMappingURL=yelon-util-form.js.map
118
+ //# sourceMappingURL=form.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.mjs","sources":["../../../../packages/util/form/validators.ts","../../../../packages/util/form/match-control.ts","../../../../packages/util/form/form.ts"],"sourcesContent":["import { AbstractControl, ValidationErrors } from '@angular/forms';\n\nimport { isChinese, isColor, isDecimal, isIdCard, isInt, isIp, isMobile, isNum, isUrl } from '@yelon/util/format';\n\n/**\n * A set of validators for reactive forms\n *\n * 一套用于响应式表单的验证器\n */\nexport class _Validators {\n /**\n * Wheter is number\n *\n * 是否为数字\n */\n static num(control: AbstractControl): ValidationErrors | null {\n return isNum(control.value) ? null : { num: true };\n }\n\n /**\n * Wheter is integer\n *\n * 是否为整数\n */\n static int(control: AbstractControl): ValidationErrors | null {\n return isInt(control.value) ? null : { int: true };\n }\n\n /**\n * Wheter is decimal\n *\n * 是否为小数点数值\n */\n static decimal(control: AbstractControl): ValidationErrors | null {\n return isDecimal(control.value) ? null : { decimal: true };\n }\n\n /**\n * Wheter is People's Republic of China identity card\n *\n * 是否为中华人民共和国居民身份证\n */\n static idCard(control: AbstractControl): ValidationErrors | null {\n return isIdCard(control.value) ? null : { idCard: true };\n }\n\n /**\n * Wheter is china mobile (China)\n *\n * 是否为手机号(中国)\n */\n static mobile(control: AbstractControl): ValidationErrors | null {\n return isMobile(control.value) ? null : { mobile: true };\n }\n\n /**\n * Wheter is url address\n *\n * 是否URL地址\n */\n static url(control: AbstractControl): ValidationErrors | null {\n return isUrl(control.value) ? null : { url: true };\n }\n\n /**\n * Wheter is IPv4 address (Support v4, v6)\n *\n * 是否IP4地址(支持v4、v6)\n */\n static ip(control: AbstractControl): ValidationErrors | null {\n return isIp(control.value) ? null : { ip: true };\n }\n\n /**\n * Wheter is color\n *\n * 是否颜色代码值\n */\n static color(control: AbstractControl): ValidationErrors | null {\n return isColor(control.value) ? null : { color: true };\n }\n\n /**\n * Wheter is chinese\n *\n * 是否中文\n */\n static chinese(control: AbstractControl): ValidationErrors | null {\n return isChinese(control.value) ? null : { chinese: true };\n }\n}\n","import { AbstractControl, ValidatorFn } from '@angular/forms';\n\n/**\n * Match two control values\n *\n * 匹配两个控件值\n * ```ts\n * this.form = new FormGroup({\n * pwd: new FormControl(''),\n * repwd: new FormControl(''),\n * }, {\n * validators: MatchControl('pwd', 'repwd'),\n * });\n * ```\n */\nexport function MatchControl(controlName: string, matchingControlName: string): ValidatorFn {\n return (formGroup: AbstractControl) => {\n const control = formGroup.get(controlName)!;\n const matchingControl = formGroup.get(matchingControlName)!;\n if (matchingControl.errors && !matchingControl.errors.matchControl) {\n return null;\n }\n if (control.value !== matchingControl.value) {\n matchingControl.setErrors({ matchControl: true });\n } else {\n matchingControl.setErrors(null);\n }\n return null;\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAIA;;;;;MAKa,WAAW;;;;;;IAMtB,OAAO,GAAG,CAAC,OAAwB;QACjC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;KACpD;;;;;;IAOD,OAAO,GAAG,CAAC,OAAwB;QACjC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;KACpD;;;;;;IAOD,OAAO,OAAO,CAAC,OAAwB;QACrC,OAAO,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;KAC5D;;;;;;IAOD,OAAO,MAAM,CAAC,OAAwB;QACpC,OAAO,QAAQ,CA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,SAAS,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;SACnD;aAAM;YACL,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;SACjC;QACD,OAAO,IAAI,CAAC;KACb,CAAC;AACJ;;AC7BA;;;;;;"}
@@ -1,9 +1,8 @@
1
1
  import { deepGet } from '@yelon/util/other';
2
2
  import { CurrencyPipe, formatNumber } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { Injectable, Inject, LOCALE_ID, DEFAULT_CURRENCY_CODE } from '@angular/core';
4
+ import { LOCALE_ID, DEFAULT_CURRENCY_CODE, Injectable, Inject } from '@angular/core';
5
5
  import * as i1 from '@yelon/util/config';
6
- import { YunzaiConfigService } from '@yelon/util/config';
7
6
 
8
7
  /**
9
8
  * String formatting
@@ -275,7 +274,7 @@ class CurrencyService {
275
274
  let symbol = '';
276
275
  if (integer.startsWith('-')) {
277
276
  symbol = options.minusSymbol;
278
- integer = integer.substr(1);
277
+ integer = integer.substring(1);
279
278
  }
280
279
  if (/^-?\d+$/.test(value)) {
281
280
  decimal = null;
@@ -348,7 +347,7 @@ class CurrencyService {
348
347
  const j = integerCount - i - 1;
349
348
  const isZero = i > 1 && n !== 0 && integer[i - 1] === '0';
350
349
  const cnZero = isZero ? '零' : '';
351
- const isEmpptyUnit = (n === 0 && j % 4 !== 0) || integer.substr(i - 3, 4) === '0000';
350
+ const isEmpptyUnit = (n === 0 && j % 4 !== 0) || integer.substring(i - 3, i - 3 + 4) === '0000';
352
351
  const descMark = cnDesc;
353
352
  let cnNum = unit.num[n];
354
353
  cnDesc = isEmpptyUnit ? '' : unit.radice[j];
@@ -391,19 +390,24 @@ class CurrencyService {
391
390
  return ret;
392
391
  }
393
392
  }
394
- CurrencyService.ɵprov = i0.ɵɵdefineInjectable({ factory: function CurrencyService_Factory() { return new CurrencyService(i0.ɵɵinject(i1.YunzaiConfigService), i0.ɵɵinject(i0.LOCALE_ID), i0.ɵɵinject(i0.DEFAULT_CURRENCY_CODE)); }, token: CurrencyService, providedIn: "root" });
395
- CurrencyService.decorators = [
396
- { type: Injectable, args: [{ providedIn: 'root' },] }
397
- ];
398
- CurrencyService.ctorParameters = () => [
399
- { type: YunzaiConfigService },
400
- { type: String, decorators: [{ type: Inject, args: [LOCALE_ID,] }] },
401
- { type: String, decorators: [{ type: Inject, args: [DEFAULT_CURRENCY_CODE,] }] }
402
- ];
393
+ CurrencyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: CurrencyService, deps: [{ token: i1.YunzaiConfigService }, { token: LOCALE_ID }, { token: DEFAULT_CURRENCY_CODE }], target: i0.ɵɵFactoryTarget.Injectable });
394
+ CurrencyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: CurrencyService, providedIn: 'root' });
395
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: CurrencyService, decorators: [{
396
+ type: Injectable,
397
+ args: [{ providedIn: 'root' }]
398
+ }], ctorParameters: function () {
399
+ return [{ type: i1.YunzaiConfigService }, { type: undefined, decorators: [{
400
+ type: Inject,
401
+ args: [LOCALE_ID]
402
+ }] }, { type: undefined, decorators: [{
403
+ type: Inject,
404
+ args: [DEFAULT_CURRENCY_CODE]
405
+ }] }];
406
+ } });
403
407
 
404
408
  /**
405
409
  * Generated bundle index. Do not edit.
406
410
  */
407
411
 
408
412
  export { CurrencyMega_Powers, CurrencyService, REGEX, REGEX_STR, format, formatMask, isChinese, isColor, isDecimal, isIdCard, isInt, isIp, isMobile, isNum, isUrl };
409
- //# sourceMappingURL=yelon-util-format.js.map
413
+ //# sourceMappingURL=format.mjs.map
@@ -0,0 +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 type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\nimport { deepGet } from '@yelon/util/other';\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+))`,\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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?:[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\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":";;;;;;AAIA;;;;;;;;;;;SAWgB,MAAM,CACpB,GAA8B,EAC9B,GAAiC,EACjC,cAAuB,KAAK;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;;;;;;;;;;;;;;;;;;;SAmBgB,UAAU,CAAC,KAAa,EAAE,MAAiC;IACzE,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,EAAE,CAAC;KACX;IACD,MAAM,GAAG,sBACH,OAAO,MAAM,KAAK,QAAQ,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAC3D,CAAC;IACF,MAAM,MAAM,mBACV,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,EACpC,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EACtB,GAAG,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,EAC/B,CAAC,EAAE;YACD,OAAO,EAAE,UAAU;YACnB,SAAS,EAAE,IAAI,IAAI,IAAI,CAAC,iBAAiB,EAAE;SAC5C,EACD,CAAC,EAAE;YACD,OAAO,EAAE,UAAU;YACnB,SAAS,EAAE,IAAI,IAAI,IAAI,CAAC,iBAAiB,EAAE;SAC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UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;8BAO7B,MAAM;+BAAC,SAAS;;8BAChB,MAAM;+BAAC,qBAAqB;;;;ACtBjC;;;;;;"}
@@ -82,4 +82,4 @@ function createRound(number, precision, methodName) {
82
82
  */
83
83
 
84
84
  export { ceil, floor, inRange, round };
85
- //# sourceMappingURL=yelon-util-math.js.map
85
+ //# sourceMappingURL=math.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math.mjs","sources":["../../../../packages/util/math/in-range.ts","../../../../packages/util/math/round.ts","../../../../packages/util/math/math.ts"],"sourcesContent":["import { assertNumber } from '@yelon/util/other';\n\n/**\n * Checks if `value` is between `start` and `end` to, but not including `end`. If `end` is not specified, it's set to start with `start` then set to `0`. If `start` is greater than `end` the params are swapped to support negative ranges.\n *\n * 检查 `value` 是否在 `start` 与 `end` 之间,但不包括 `end`。 如果 `end` 没有指定,那么 `start` 设置为 `0`。 如果 `start` 大于 `end`,那么参数会交换以便支持负范围。\n * ```ts\n * inRange(3, 2, 4); // true\n * inRange(4, 8); // true\n * inRange(4, 2); // false\n * inRange(2, 2); // false\n * inRange(1.2, 2); // true\n * inRange(-3, -2, -6); // true\n * ```\n */\nexport function inRange(value: number, start: number, end?: number): boolean {\n if (end === undefined) {\n end = start;\n start = 0;\n }\n assertNumber(value);\n assertNumber(start);\n assertNumber(end);\n return value >= Math.min(start, end) && value < Math.max(start, end);\n}\n","/**\n * Computes `number` rounded up to `precision`.\n *\n * 根据 `precision`(精度) 向上舍入 `number`。\n * ```ts\n * ceil(4.006); // 5\n * ceil(6.004, 2); // 6.01\n * ceil(6040, -2); // 6100\n * ```\n */\nexport function ceil(number: number, precision: number = 0): number {\n return createRound(number, precision, 'ceil');\n}\n\n/**\n * Computes `number` rounded down to `precision`.\n *\n * 根据 `precision`(精度) 向下舍入 `number`。\n * ```ts\n * floor(4.006); // 4\n * floor(0.046, 2); // 0.04\n * floor(4060, -2); // 4000\n * ```\n */\nexport function floor(number: number, precision: number = 0): number {\n return createRound(number, precision, 'floor');\n}\n\n/**\n * Computes `number` rounded to `precision`.\n *\n * 根据 `precision`(精度) 四舍五入 `number`。\n * ```ts\n * round(4.006); // 4\n * round(4.006, 2); // 4.01\n * round(4060, -2); // 4100\n * ```\n */\nexport function round(number: number, precision: number = 0): number {\n return createRound(number, precision, 'round');\n}\n\nfunction createRound(number: number, precision: number, methodName: keyof Math): number {\n const func = Math[methodName] as (x: number) => number;\n\n precision = precision == null ? 0 : Math.min(precision, 292);\n if (!precision) {\n return func(number);\n }\n // Shift with exponential notation to avoid floating-point issues.\n // See [MDN](https://mdn.io/round#Examples) for more details.\n let pair = `${number}e`.split('e');\n const value = func(Number(`${pair[0]}e${Number(pair[1]) + precision}`));\n pair = `${value}e`.split('e');\n return Number(`${pair[0]}e${Number(pair[1]) - precision}`);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;SAagB,OAAO,CAAC,KAAa,EAAE,KAAa,EAAE,GAAY;IAChE,IAAI,GAAG,KAAK,SAAS,EAAE;QACrB,GAAG,GAAG,KAAK,CAAC;QACZ,KAAK,GAAG,CAAC,CAAC;KACX;IACD,YAAY,CAAC,KAAK,CAAC,CAAC;IACpB,YAAY,CAAC,KAAK,CAAC,CAAC;IACpB,YAAY,CAAC,GAAG,CAAC,CAAC;IAClB,OAAO,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACvE;;ACxBA;;;;;;;;;;SAUgB,IAAI,CAAC,MAAc,EAAE,YAAoB,CAAC;IACxD,OAAO,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;AAChD,CAAC;AAED;;;;;;;;;;SAUgB,KAAK,CAAC,MAAc,EAAE,YAAoB,CAAC;IACzD,OAAO,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;;;;SAUgB,KAAK,CAAC,MAAc,EAAE,YAAoB,CAAC;IACzD,OAAO,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC;AAED,SAAS,WAAW,CAAC,MAAc,EAAE,SAAiB,EAAE,UAAsB;IAC5E,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAA0B,CAAC;IAEvD,SAAS,GAAG,SAAS,IAAI,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IAC7D,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;KACrB;;;IAGD,IAAI,IAAI,GAAG,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC,CAAC,CAAC;IACxE,IAAI,GAAG,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,OAAO,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC,CAAC;AAC7D;;ACvDA;;;;;;"}
@@ -1,5 +1,4 @@
1
1
  import extend from 'extend';
2
- import * as i1 from '@angular/common';
3
2
  import { DOCUMENT } from '@angular/common';
4
3
  import * as i0 from '@angular/core';
5
4
  import { Injectable, Inject } from '@angular/core';
@@ -164,29 +163,14 @@ class LazyService {
164
163
  const node = this.doc.createElement('script');
165
164
  node.type = 'text/javascript';
166
165
  node.src = path;
167
- node.charset = 'utf-8';
168
166
  if (innerContent) {
169
167
  node.innerHTML = innerContent;
170
168
  }
171
- if (node.readyState) {
172
- // IE
173
- node.onreadystatechange = () => {
174
- if (node.readyState === 'loaded' || node.readyState === 'complete') {
175
- node.onreadystatechange = null;
176
- onSuccess({
177
- path,
178
- status: 'ok'
179
- });
180
- }
181
- };
182
- }
183
- else {
184
- node.onload = () => onSuccess({
185
- path,
186
- status: 'ok'
187
- });
188
- }
189
- node.onerror = (error) => onSuccess({
169
+ node.onload = () => onSuccess({
170
+ path,
171
+ status: 'ok'
172
+ });
173
+ node.onerror = error => onSuccess({
190
174
  path,
191
175
  status: 'error',
192
176
  error
@@ -218,13 +202,17 @@ class LazyService {
218
202
  });
219
203
  }
220
204
  }
221
- LazyService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LazyService_Factory() { return new LazyService(i0.ɵɵinject(i1.DOCUMENT)); }, token: LazyService, providedIn: "root" });
222
- LazyService.decorators = [
223
- { type: Injectable, args: [{ providedIn: 'root' },] }
224
- ];
225
- LazyService.ctorParameters = () => [
226
- { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
227
- ];
205
+ LazyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: LazyService, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
206
+ LazyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: LazyService, providedIn: 'root' });
207
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: LazyService, decorators: [{
208
+ type: Injectable,
209
+ args: [{ providedIn: 'root' }]
210
+ }], ctorParameters: function () {
211
+ return [{ type: undefined, decorators: [{
212
+ type: Inject,
213
+ args: [DOCUMENT]
214
+ }] }];
215
+ } });
228
216
 
229
217
  function throwError(msg, actual, expected, comparison) {
230
218
  if (ngDevMode) {
@@ -314,4 +302,4 @@ const resizeWindow = () => {
314
302
  */
315
303
 
316
304
  export { LazyService, PREFIX, assert, assertArray, assertEmpty, assertNumber, assertObservable, assertString, deepCopy, deepGet, deepMerge, deepMergeKey, getUrlParam, log, resizeWindow, warn, warnDeprecation };
317
- //# sourceMappingURL=yelon-util-other.js.map
305
+ //# sourceMappingURL=other.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"other.mjs","sources":["../../../../packages/util/other/deep.ts","../../../../packages/util/other/logger.ts","../../../../packages/util/other/lazy.service.ts","../../../../packages/util/other/assert.ts","../../../../packages/util/other/url.ts","../../../../packages/util/other/resize.ts","../../../../packages/util/other/other.ts"],"sourcesContent":["import extend from 'extend';\n\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\n/**\n * Gets the value at `path` of `object`, like `_.get` in lodash.\n *\n * 类似 `_.get`,根据 `path` 获取安全值\n */\nexport function deepGet(obj: NzSafeAny, path: string | string[] | null | undefined, defaultValue?: unknown): NzSafeAny {\n if (!obj || path == null || path.length === 0) return defaultValue;\n if (!Array.isArray(path)) {\n path = ~path.indexOf('.') ? path.split('.') : [path];\n }\n if (path.length === 1) {\n const checkObj = obj[path[0]];\n return typeof checkObj === 'undefined' ? defaultValue : checkObj;\n }\n const res = path.reduce((o, k) => (o || {})[k], obj);\n return typeof res === 'undefined' ? defaultValue : res;\n}\n\n/**\n * Base on [extend](https://github.com/justmoon/node-extend) deep copy.\n *\n * 基于 [extend](https://github.com/justmoon/node-extend) 的深度拷贝\n */\nexport function deepCopy<T extends { [key: string]: NzSafeAny } = NzSafeAny>(obj: T | null | undefined): T {\n const result = extend(true, {}, { _: obj });\n return result._ as T;\n}\n\n/**\n * Deep merge object.\n *\n * 深度合并对象\n *\n * @param original 原始对象\n * @param arrayProcessMethod 数组处理方式\n * - `true` 表示替换新值,不管新值为哪种类型\n * - `false` 表示会合并整个数组(将旧数据与新数据合并成新数组)\n * @param objects 要合并的对象\n */\nexport function deepMergeKey(original: unknown, arrayProcessMethod: boolean, ...objects: NzSafeAny[]): NzSafeAny {\n if (Array.isArray(original) || typeof original !== 'object') return original;\n\n const isObject = (v: unknown): boolean => typeof v === 'object';\n\n const merge = (target: NzSafeAny, obj: NzSafeAny): NzSafeAny => {\n Object.keys(obj)\n .filter(key => key !== '__proto__' && Object.prototype.hasOwnProperty.call(obj, key))\n .forEach(key => {\n const fromValue = obj[key];\n const toValue = target[key];\n if (Array.isArray(toValue)) {\n target[key] = arrayProcessMethod ? fromValue : [...toValue, ...fromValue];\n } else if (typeof fromValue === 'function') {\n target[key] = fromValue;\n } else if (fromValue != null && isObject(fromValue) && toValue != null && isObject(toValue)) {\n target[key] = merge(toValue, fromValue);\n } else {\n target[key] = deepCopy(fromValue);\n }\n });\n return target;\n };\n\n objects.filter(v => v != null && isObject(v)).forEach(v => merge(original, v));\n\n return original;\n}\n\n/**\n * Deep merge object.\n *\n * 深度合并对象\n */\nexport function deepMerge(original: unknown, ...objects: unknown[]): NzSafeAny {\n return deepMergeKey(original, false, ...objects);\n}\n","import type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\ndeclare const ngDevMode: boolean;\n\nconst record: Record<string, boolean> = {};\n\nexport const PREFIX = '[@YELON]:';\n\nfunction notRecorded(...args: NzSafeAny[]): boolean {\n const asRecord = args.reduce((acc, c) => acc + c.toString(), '');\n\n if (record[asRecord]) {\n return false;\n } else {\n record[asRecord] = true;\n return true;\n }\n}\n\nfunction consoleCommonBehavior(consoleFunc: (...args: NzSafeAny) => void, ...args: NzSafeAny[]): void {\n if ((typeof ngDevMode === 'undefined' || ngDevMode) && notRecorded(...args)) {\n consoleFunc(...args);\n }\n}\n\n// Warning should only be printed in dev mode and only once.\nexport const warn = (...args: NzSafeAny[]): void =>\n consoleCommonBehavior((...arg: NzSafeAny[]) => console.warn(PREFIX, ...arg), ...args);\n\nexport const warnDeprecation = (...args: NzSafeAny[]): NzSafeAny => {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n return () => {};\n }\n const stack = new Error().stack;\n return consoleCommonBehavior((...arg: NzSafeAny[]) => console.warn(PREFIX, 'deprecated:', ...arg, stack), ...args);\n};\n\n// Log should only be printed in dev mode.\nexport const log = (...args: NzSafeAny[]): void => {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n console.log(PREFIX, ...args);\n }\n};\n","import { DOCUMENT } from '@angular/common';\nimport { Inject, Injectable } from '@angular/core';\nimport { BehaviorSubject, Observable } from 'rxjs';\nimport { filter, share } from 'rxjs/operators';\n\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\nexport interface LazyResult {\n path: string;\n status: 'ok' | 'error' | 'loading';\n error?: NzSafeAny;\n}\n\n/**\n * 延迟加载资源(js 或 css)服务\n */\n@Injectable({ providedIn: 'root' })\nexport class LazyService {\n private list: { [key: string]: boolean } = {};\n private cached: { [key: string]: LazyResult } = {};\n private _notify: BehaviorSubject<LazyResult[]> = new BehaviorSubject<LazyResult[]>([]);\n\n constructor(@Inject(DOCUMENT) private doc: NzSafeAny) {}\n\n get change(): Observable<LazyResult[]> {\n return this._notify.asObservable().pipe(\n share(),\n filter(ls => ls.length !== 0)\n );\n }\n\n clear(): void {\n this.list = {};\n this.cached = {};\n }\n\n load(paths: string | string[]): Promise<LazyResult[]> {\n if (!Array.isArray(paths)) {\n paths = [paths];\n }\n\n const promises: Array<Promise<LazyResult>> = [];\n paths.forEach(path => {\n if (path.endsWith('.js')) {\n promises.push(this.loadScript(path));\n } else {\n promises.push(this.loadStyle(path));\n }\n });\n\n return Promise.all(promises).then(res => {\n this._notify.next(res);\n return Promise.resolve(res);\n });\n }\n\n loadScript(path: string, innerContent?: string): Promise<LazyResult> {\n return new Promise(resolve => {\n if (this.list[path] === true) {\n resolve({ ...this.cached[path], status: 'loading' });\n return;\n }\n\n this.list[path] = true;\n const onSuccess = (item: LazyResult): void => {\n this.cached[path] = item;\n resolve(item);\n this._notify.next([item]);\n };\n\n const node = this.doc.createElement('script') as HTMLScriptElement;\n node.type = 'text/javascript';\n node.src = path;\n if (innerContent) {\n node.innerHTML = innerContent;\n }\n node.onload = () =>\n onSuccess({\n path,\n status: 'ok'\n });\n node.onerror = error =>\n onSuccess({\n path,\n status: 'error',\n error\n });\n this.doc.getElementsByTagName('head')[0].appendChild(node);\n });\n }\n\n loadStyle(path: string, rel: string = 'stylesheet', innerContent?: string): Promise<LazyResult> {\n return new Promise(resolve => {\n if (this.list[path] === true) {\n resolve(this.cached[path]);\n return;\n }\n\n this.list[path] = true;\n\n const node = this.doc.createElement('link') as HTMLLinkElement;\n node.rel = rel;\n node.type = 'text/css';\n node.href = path;\n if (innerContent) {\n node.innerHTML = innerContent;\n }\n this.doc.getElementsByTagName('head')[0].appendChild(node);\n const item: LazyResult = {\n path,\n status: 'ok'\n };\n this.cached[path] = item;\n resolve(item);\n });\n }\n}\n","import { isObservable } from 'rxjs';\n\ndeclare const ngDevMode: boolean;\n\nfunction throwError(msg: string | null | undefined): void;\nfunction throwError(msg: string | null | undefined, actual: unknown, expected: unknown, comparison: string): void;\nfunction throwError(msg: string | null | undefined, actual?: unknown, expected?: unknown, comparison?: string): void {\n if (ngDevMode) {\n throw new Error(\n `ASSERTION ERROR: ${msg}${comparison == null ? '' : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`}`\n );\n }\n}\n\n/**\n * Assert whether the expression and throw an error into console in dev mode\n *\n * 断言表达式是否符合预期,并在开发模式下会在控制台抛出一个错误\n */\nexport function assert(expression: boolean, msg?: string): void {\n if (!expression) {\n throwError(msg);\n }\n}\n\n/**\n * Assert whether empty (`null` or `undefined`)\n *\n * 断言是否空值(`null` 或 `undefined`)\n */\nexport function assertEmpty(actual: unknown, msg?: string): void {\n if (actual == null) {\n throwError(msg, typeof actual, 'NULL', '==');\n }\n}\n\n/**\n * Assert whether `number` type\n *\n * 断言是否 `number` 类型\n */\nexport function assertNumber(actual: unknown, msg?: string): void {\n if (!(typeof actual === 'number')) {\n throwError(msg, typeof actual, 'number', '===');\n }\n}\n\n/**\n * Assert whether `string` type\n *\n * 断言是否 `string` 类型\n */\nexport function assertString(actual: unknown, msg?: string): void {\n if (!(typeof actual === 'string')) {\n throwError(msg, actual === null ? 'null' : typeof actual, 'string', '===');\n }\n}\n\n/**\n * Assert whether `array` type\n *\n * 断言是否 `array` 类型\n */\nexport function assertArray(actual: unknown, msg?: string): void {\n if (!Array.isArray(actual)) {\n throwError(msg, actual === null ? 'null' : typeof actual, 'array', '===');\n }\n}\n\n/**\n * Assert whether `Observable` type\n *\n * 断言是否 `Observable` 类型\n */\nexport function assertObservable(obj: unknown, msg?: string): void {\n if (!isObservable(obj)) {\n throwError(msg, obj === null ? 'null' : typeof obj, 'Observable', '===');\n }\n}\n","import { NzSafeAny } from 'ng-zorro-antd/core/types';\n\nexport function getUrlParam(url: NzSafeAny, name: string): string | null {\n try {\n var reg = new RegExp(`(^|&)${name}=([^&]*)(&|$)`);\n var r = url.split('?')[1].match(reg);\n if (r != null) return unescape(r[2]);\n } catch (e) {\n return null;\n }\n return null;\n}\n","export const resizeWindow = (): void => {\n window.dispatchEvent(new Event('resize'));\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAIA;;;;;SAKgB,OAAO,CAAC,GAAc,EAAE,IAA0C,EAAE,YAAsB;IACxG,IAAI,CAAC,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,YAAY,CAAC;IACnE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACxB,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;KACtD;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACrB,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9B,OAAO,OAAO,QAAQ,K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CAAC,QAAQ,CAAC,CAAC,CAAC;AAC5C;;ACFA;;;;;;"}
@@ -0,0 +1,96 @@
1
+ import * as i0 from '@angular/core';
2
+ import { LOCALE_ID, Pipe, Inject, NgModule } from '@angular/core';
3
+ import * as i1 from '@yelon/util/format';
4
+
5
+ class CurrencyMegaPipe {
6
+ constructor(srv, locale) {
7
+ this.srv = srv;
8
+ this.isCN = false;
9
+ this.isCN = locale.startsWith('zh');
10
+ }
11
+ /**
12
+ * Large number format filter
13
+ *
14
+ * 大数据格式化
15
+ */
16
+ transform(value, options) {
17
+ const res = this.srv.mega(value, options);
18
+ return res.value + (this.isCN ? res.unitI18n : res.unit);
19
+ }
20
+ }
21
+ CurrencyMegaPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: CurrencyMegaPipe, deps: [{ token: i1.CurrencyService }, { token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Pipe });
22
+ CurrencyMegaPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: CurrencyMegaPipe, name: "mega" });
23
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: CurrencyMegaPipe, decorators: [{
24
+ type: Pipe,
25
+ args: [{ name: 'mega' }]
26
+ }], ctorParameters: function () {
27
+ return [{ type: i1.CurrencyService }, { type: undefined, decorators: [{
28
+ type: Inject,
29
+ args: [LOCALE_ID]
30
+ }] }];
31
+ } });
32
+
33
+ class CurrencyPricePipe {
34
+ constructor(srv) {
35
+ this.srv = srv;
36
+ }
37
+ /**
38
+ * Format a number with commas as thousands separators
39
+ *
40
+ * 格式化货币,用逗号将数字格式化为千位分隔符
41
+ * ```ts
42
+ * 10000 => `10,000`
43
+ * 10000.567 => `10,000.57`
44
+ * ```
45
+ */
46
+ transform(value, options) {
47
+ return this.srv.format(value, options);
48
+ }
49
+ }
50
+ CurrencyPricePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: CurrencyPricePipe, deps: [{ token: i1.CurrencyService }], target: i0.ɵɵFactoryTarget.Pipe });
51
+ CurrencyPricePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: CurrencyPricePipe, name: "price" });
52
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: CurrencyPricePipe, decorators: [{
53
+ type: Pipe,
54
+ args: [{ name: 'price' }]
55
+ }], ctorParameters: function () { return [{ type: i1.CurrencyService }]; } });
56
+
57
+ class CurrencyCNYPipe {
58
+ constructor(srv) {
59
+ this.srv = srv;
60
+ }
61
+ /**
62
+ * Converted into RMB notation.
63
+ *
64
+ * 转化成人民币表示法
65
+ */
66
+ transform(value, options) {
67
+ return this.srv.cny(value, options);
68
+ }
69
+ }
70
+ CurrencyCNYPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: CurrencyCNYPipe, deps: [{ token: i1.CurrencyService }], target: i0.ɵɵFactoryTarget.Pipe });
71
+ CurrencyCNYPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: CurrencyCNYPipe, name: "cny" });
72
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: CurrencyCNYPipe, decorators: [{
73
+ type: Pipe,
74
+ args: [{ name: 'cny' }]
75
+ }], ctorParameters: function () { return [{ type: i1.CurrencyService }]; } });
76
+
77
+ const PIPES = [CurrencyMegaPipe, CurrencyPricePipe, CurrencyCNYPipe];
78
+ class CurrencyPipeModule {
79
+ }
80
+ CurrencyPipeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: CurrencyPipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
81
+ CurrencyPipeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: CurrencyPipeModule, declarations: [CurrencyMegaPipe, CurrencyPricePipe, CurrencyCNYPipe], exports: [CurrencyMegaPipe, CurrencyPricePipe, CurrencyCNYPipe] });
82
+ CurrencyPipeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: CurrencyPipeModule });
83
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: CurrencyPipeModule, decorators: [{
84
+ type: NgModule,
85
+ args: [{
86
+ declarations: PIPES,
87
+ exports: PIPES
88
+ }]
89
+ }] });
90
+
91
+ /**
92
+ * Generated bundle index. Do not edit.
93
+ */
94
+
95
+ export { CurrencyCNYPipe, CurrencyMegaPipe, CurrencyPipeModule, CurrencyPricePipe };
96
+ //# sourceMappingURL=pipe-currency.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipe-currency.mjs","sources":["../../../../packages/util/pipes/currency/mega.pipe.ts","../../../../packages/util/pipes/currency/price.pipe.ts","../../../../packages/util/pipes/currency/cny.pipe.ts","../../../../packages/util/pipes/currency/module.ts","../../../../packages/util/pipes/currency/pipe-currency.ts"],"sourcesContent":["import { Inject, LOCALE_ID, Pipe, PipeTransform } from '@angular/core';\n\nimport { CurrencyMegaOptions, CurrencyService } from '@yelon/util/format';\n\n@Pipe({ name: 'mega' })\nexport class CurrencyMegaPipe implements PipeTransform {\n private isCN = false;\n constructor(private srv: CurrencyService, @Inject(LOCALE_ID) locale: string) {\n this.isCN = locale.startsWith('zh');\n }\n\n /**\n * Large number format filter\n *\n * 大数据格式化\n */\n transform(value: number | string, options?: CurrencyMegaOptions): string {\n const res = this.srv.mega(value, options);\n return res.value + (this.isCN ? res.unitI18n : res.unit);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { CurrencyFormatOptions, CurrencyService } from '@yelon/util/format';\n\n@Pipe({ name: 'price' })\nexport class CurrencyPricePipe implements PipeTransform {\n constructor(private srv: CurrencyService) {}\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 transform(value: number | string, options?: CurrencyFormatOptions): string {\n return this.srv.format(value, options);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { CurrencyCNYOptions, CurrencyService } from '@yelon/util/format';\n\n@Pipe({ name: 'cny' })\nexport class CurrencyCNYPipe implements PipeTransform {\n constructor(private srv: CurrencyService) {}\n\n /**\n * Converted into RMB notation.\n *\n * 转化成人民币表示法\n */\n transform(value: number | string, options?: CurrencyCNYOptions): string {\n return this.srv.cny(value, options);\n }\n}\n","import { NgModule } from '@angular/core';\n\nimport { CurrencyCNYPipe } from './cny.pipe';\nimport { CurrencyMegaPipe } from './mega.pipe';\nimport { CurrencyPricePipe } from './price.pipe';\n\nconst PIPES = [CurrencyMegaPipe, CurrencyPricePipe, CurrencyCNYPipe];\n\n@NgModule({\n declarations: PIPES,\n exports: PIPES\n})\nexport class CurrencyPipeModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAKa,gBAAgB;IAE3B,YAAoB,GAAoB,EAAqB,MAAc;QAAvD,QAAG,GAAH,GAAG,CAAiB;QADhC,SAAI,GAAG,KAAK,CAAC;QAEnB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;KACrC;;;;;;IAOD,SAAS,CAAC,KAAsB,EAAE,OAA6B;QAC7D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC1C,OAAO,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,QAAQ,GAAG,GAA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