@yelon/util 17.3.2 → 18.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +27 -27
  3. package/array/array-type.service.d.ts +68 -68
  4. package/array/array.service.d.ts +78 -78
  5. package/array/index.d.ts +2 -2
  6. package/browser/cookie.service.d.ts +64 -64
  7. package/browser/copy.d.ts +6 -6
  8. package/browser/index.d.ts +5 -5
  9. package/browser/is-empty.d.ts +6 -6
  10. package/browser/scroll.service.d.ts +34 -34
  11. package/browser/style.d.ts +21 -21
  12. package/config/abc/cell.type.d.ts +118 -118
  13. package/config/abc/date-picker.type.d.ts +52 -52
  14. package/config/abc/error-collect.type.d.ts +10 -10
  15. package/config/abc/exception.type.d.ts +9 -9
  16. package/config/abc/image.type.d.ts +15 -15
  17. package/config/abc/index.d.ts +17 -18
  18. package/config/abc/loading.type.d.ts +31 -31
  19. package/config/abc/lodop.type.d.ts +33 -33
  20. package/config/abc/media.type.d.ts +11 -11
  21. package/config/abc/onboarding.type.d.ts +4 -4
  22. package/config/abc/page-header.type.d.ts +39 -39
  23. package/config/abc/pdf.type.d.ts +35 -35
  24. package/config/abc/se.type.d.ts +32 -32
  25. package/config/abc/sg.type.d.ts +10 -10
  26. package/config/abc/st.type.d.ts +465 -465
  27. package/config/abc/sv.type.d.ts +14 -14
  28. package/config/abc/xlsx.type.d.ts +12 -12
  29. package/config/abc/zip.type.d.ts +10 -10
  30. package/config/acl/acl.type.d.ts +32 -32
  31. package/config/auth/auth.type.d.ts +51 -51
  32. package/config/bis/bis.type.d.ts +11 -11
  33. package/config/cache/cache.type.d.ts +66 -66
  34. package/config/chart/chart.type.d.ts +33 -33
  35. package/config/config.service.d.ts +13 -13
  36. package/config/config.types.d.ts +51 -52
  37. package/config/index.d.ts +14 -14
  38. package/config/mock/mock.type.d.ts +14 -14
  39. package/config/sf/sf.type.d.ts +133 -133
  40. package/config/socket/socket.type.d.ts +4 -4
  41. package/config/theme/http.type.d.ts +15 -15
  42. package/config/theme/i18n.type.d.ts +14 -14
  43. package/config/theme/index.d.ts +3 -3
  44. package/config/theme/pipe.type.d.ts +3 -3
  45. package/config/theme/responsive.type.d.ts +12 -12
  46. package/config/util/array.type.d.ts +22 -22
  47. package/config/util/currency.type.d.ts +39 -39
  48. package/date-time/index.d.ts +2 -2
  49. package/date-time/picker.d.ts +68 -68
  50. package/date-time/time.d.ts +39 -39
  51. package/decorator/convert.d.ts +32 -32
  52. package/decorator/index.d.ts +2 -2
  53. package/decorator/zone-outside.d.ts +35 -35
  54. package/esm2022/array/array-type.service.mjs +1 -1
  55. package/esm2022/array/array.mjs +4 -4
  56. package/esm2022/array/array.service.mjs +277 -277
  57. package/esm2022/array/index.mjs +2 -2
  58. package/esm2022/browser/browser.mjs +4 -4
  59. package/esm2022/browser/cookie.service.mjs +99 -99
  60. package/esm2022/browser/copy.mjs +27 -27
  61. package/esm2022/browser/index.mjs +5 -5
  62. package/esm2022/browser/is-empty.mjs +18 -18
  63. package/esm2022/browser/scroll.service.mjs +84 -84
  64. package/esm2022/browser/style.mjs +37 -37
  65. package/esm2022/config/abc/cell.type.mjs +1 -1
  66. package/esm2022/config/abc/date-picker.type.mjs +1 -1
  67. package/esm2022/config/abc/error-collect.type.mjs +1 -1
  68. package/esm2022/config/abc/exception.type.mjs +1 -1
  69. package/esm2022/config/abc/image.type.mjs +1 -1
  70. package/esm2022/config/abc/index.mjs +18 -19
  71. package/esm2022/config/abc/loading.type.mjs +1 -1
  72. package/esm2022/config/abc/lodop.type.mjs +1 -1
  73. package/esm2022/config/abc/media.type.mjs +1 -1
  74. package/esm2022/config/abc/onboarding.type.mjs +1 -1
  75. package/esm2022/config/abc/page-header.type.mjs +1 -1
  76. package/esm2022/config/abc/pdf.type.mjs +1 -1
  77. package/esm2022/config/abc/se.type.mjs +1 -1
  78. package/esm2022/config/abc/sg.type.mjs +1 -1
  79. package/esm2022/config/abc/st.type.mjs +1 -1
  80. package/esm2022/config/abc/sv.type.mjs +2 -2
  81. package/esm2022/config/abc/xlsx.type.mjs +1 -1
  82. package/esm2022/config/abc/zip.type.mjs +1 -1
  83. package/esm2022/config/acl/acl.type.mjs +1 -1
  84. package/esm2022/config/auth/auth.type.mjs +1 -1
  85. package/esm2022/config/bis/bis.type.mjs +1 -1
  86. package/esm2022/config/cache/cache.type.mjs +1 -1
  87. package/esm2022/config/chart/chart.type.mjs +1 -1
  88. package/esm2022/config/config.mjs +4 -4
  89. package/esm2022/config/config.service.mjs +37 -37
  90. package/esm2022/config/config.types.mjs +12 -12
  91. package/esm2022/config/index.mjs +14 -14
  92. package/esm2022/config/mock/mock.type.mjs +1 -1
  93. package/esm2022/config/sf/sf.type.mjs +1 -1
  94. package/esm2022/config/socket/socket.type.mjs +1 -1
  95. package/esm2022/config/theme/http.type.mjs +1 -1
  96. package/esm2022/config/theme/i18n.type.mjs +1 -1
  97. package/esm2022/config/theme/index.mjs +3 -3
  98. package/esm2022/config/theme/pipe.type.mjs +1 -1
  99. package/esm2022/config/theme/responsive.type.mjs +1 -1
  100. package/esm2022/config/util/array.type.mjs +1 -1
  101. package/esm2022/config/util/currency.type.mjs +1 -1
  102. package/esm2022/date-time/date-time.mjs +4 -4
  103. package/esm2022/date-time/index.mjs +2 -2
  104. package/esm2022/date-time/picker.mjs +115 -115
  105. package/esm2022/date-time/time.mjs +100 -100
  106. package/esm2022/decorator/convert.mjs +65 -65
  107. package/esm2022/decorator/decorator.mjs +4 -4
  108. package/esm2022/decorator/index.mjs +2 -2
  109. package/esm2022/decorator/zone-outside.mjs +56 -56
  110. package/esm2022/form/form.mjs +4 -4
  111. package/esm2022/form/index.mjs +2 -2
  112. package/esm2022/form/match-control.mjs +29 -29
  113. package/esm2022/form/validators.mjs +80 -80
  114. package/esm2022/format/currency.service.mjs +232 -232
  115. package/esm2022/format/currency.types.mjs +7 -7
  116. package/esm2022/format/format.mjs +4 -4
  117. package/esm2022/format/index.mjs +4 -4
  118. package/esm2022/format/string.mjs +84 -84
  119. package/esm2022/format/validate.mjs +93 -93
  120. package/esm2022/index.mjs +13 -13
  121. package/esm2022/math/in-range.mjs +24 -24
  122. package/esm2022/math/index.mjs +2 -2
  123. package/esm2022/math/math.mjs +4 -4
  124. package/esm2022/math/round.mjs +52 -52
  125. package/esm2022/mcache/index.mjs +1 -1
  126. package/esm2022/mcache/localStorageUtils.mjs +58 -58
  127. package/esm2022/mcache/mcache.mjs +4 -4
  128. package/esm2022/mtypes/authority.type.mjs +1 -1
  129. package/esm2022/mtypes/header-menu.type.mjs +1 -1
  130. package/esm2022/mtypes/index.mjs +9 -9
  131. package/esm2022/mtypes/menu.type.mjs +1 -1
  132. package/esm2022/mtypes/mtypes.mjs +4 -4
  133. package/esm2022/mtypes/nav.types.mjs +8 -8
  134. package/esm2022/mtypes/page.mjs +41 -41
  135. package/esm2022/mtypes/project-info.types.mjs +1 -1
  136. package/esm2022/mtypes/response.mjs +1 -1
  137. package/esm2022/mtypes/role.type.mjs +1 -1
  138. package/esm2022/mtypes/user.types.mjs +1 -1
  139. package/esm2022/other/assert.mjs +66 -66
  140. package/esm2022/other/deep.mjs +77 -77
  141. package/esm2022/other/favicon.mjs +28 -28
  142. package/esm2022/other/index.mjs +7 -7
  143. package/esm2022/other/lazy.service.mjs +128 -128
  144. package/esm2022/other/logger.mjs +32 -32
  145. package/esm2022/other/other.mjs +4 -4
  146. package/esm2022/other/path-to-regexp.service.mjs +238 -238
  147. package/esm2022/other/resize.mjs +3 -3
  148. package/esm2022/pipes/currency/cny.pipe.mjs +22 -22
  149. package/esm2022/pipes/currency/index.mjs +4 -4
  150. package/esm2022/pipes/currency/mega.pipe.mjs +24 -24
  151. package/esm2022/pipes/currency/module.mjs +18 -18
  152. package/esm2022/pipes/currency/pipe-currency.mjs +4 -4
  153. package/esm2022/pipes/currency/price.pipe.mjs +26 -26
  154. package/esm2022/pipes/filter/filter.pipe.mjs +19 -19
  155. package/esm2022/pipes/filter/index.mjs +2 -2
  156. package/esm2022/pipes/filter/module.mjs +16 -16
  157. package/esm2022/pipes/filter/pipe-filter.mjs +4 -4
  158. package/esm2022/pipes/format/index.mjs +2 -2
  159. package/esm2022/pipes/format/mask.pipe.mjs +33 -33
  160. package/esm2022/pipes/format/module.mjs +16 -16
  161. package/esm2022/pipes/format/pipe-format.mjs +4 -4
  162. package/esm2022/pipes/index.mjs +3 -3
  163. package/esm2022/pipes/pipes.mjs +4 -4
  164. package/esm2022/token/index.mjs +2 -2
  165. package/esm2022/token/page-visibility.mjs +14 -14
  166. package/esm2022/token/token.mjs +4 -4
  167. package/esm2022/token/window.mjs +16 -16
  168. package/esm2022/yelon-util.mjs +4 -4
  169. package/fesm2022/array.mjs +285 -285
  170. package/fesm2022/browser.mjs +273 -273
  171. package/fesm2022/config.mjs +58 -58
  172. package/fesm2022/config.mjs.map +1 -1
  173. package/fesm2022/date-time.mjs +223 -223
  174. package/fesm2022/decorator.mjs +129 -129
  175. package/fesm2022/form.mjs +118 -118
  176. package/fesm2022/format.mjs +426 -426
  177. package/fesm2022/math.mjs +85 -85
  178. package/fesm2022/mcache.mjs +65 -65
  179. package/fesm2022/mtypes.mjs +57 -57
  180. package/fesm2022/other.mjs +583 -583
  181. package/fesm2022/pipe-currency.mjs +90 -90
  182. package/fesm2022/pipe-filter.mjs +41 -41
  183. package/fesm2022/pipe-format.mjs +55 -55
  184. package/fesm2022/pipes.mjs +8 -8
  185. package/fesm2022/token.mjs +37 -37
  186. package/fesm2022/yelon-util.mjs +18 -18
  187. package/form/index.d.ts +2 -2
  188. package/form/match-control.d.ts +15 -15
  189. package/form/validators.d.ts +62 -62
  190. package/format/currency.service.d.ts +38 -38
  191. package/format/currency.types.d.ts +82 -82
  192. package/format/index.d.ts +4 -4
  193. package/format/string.d.ts +44 -44
  194. package/format/validate.d.ts +72 -72
  195. package/index.d.ts +13 -13
  196. package/math/in-range.d.ts +14 -14
  197. package/math/index.d.ts +2 -2
  198. package/math/round.d.ts +33 -33
  199. package/mcache/index.d.ts +1 -1
  200. package/mcache/localStorageUtils.d.ts +18 -18
  201. package/mtypes/authority.type.d.ts +3 -3
  202. package/mtypes/header-menu.type.d.ts +13 -13
  203. package/mtypes/index.d.ts +9 -9
  204. package/mtypes/menu.type.d.ts +41 -41
  205. package/mtypes/nav.types.d.ts +29 -29
  206. package/mtypes/page.d.ts +47 -47
  207. package/mtypes/project-info.types.d.ts +22 -22
  208. package/mtypes/response.d.ts +7 -7
  209. package/mtypes/role.type.d.ts +10 -10
  210. package/mtypes/user.types.d.ts +22 -22
  211. package/other/assert.d.ts +36 -36
  212. package/other/deep.d.ts +35 -35
  213. package/other/favicon.d.ts +2 -2
  214. package/other/index.d.ts +7 -7
  215. package/other/lazy.service.d.ts +47 -47
  216. package/other/logger.d.ts +5 -5
  217. package/other/path-to-regexp.service.d.ts +27 -27
  218. package/other/resize.d.ts +1 -1
  219. package/package.json +135 -135
  220. package/pipes/currency/cny.pipe.d.ts +14 -14
  221. package/pipes/currency/index.d.ts +4 -4
  222. package/pipes/currency/mega.pipe.d.ts +15 -15
  223. package/pipes/currency/module.d.ts +9 -9
  224. package/pipes/currency/price.pipe.d.ts +18 -18
  225. package/pipes/filter/filter.pipe.d.ts +13 -13
  226. package/pipes/filter/index.d.ts +2 -2
  227. package/pipes/filter/module.d.ts +7 -7
  228. package/pipes/format/index.d.ts +2 -2
  229. package/pipes/format/mask.pipe.d.ts +27 -27
  230. package/pipes/format/module.d.ts +7 -7
  231. package/pipes/index.d.ts +3 -3
  232. package/token/index.d.ts +2 -2
  233. package/token/page-visibility.d.ts +8 -8
  234. package/token/window.d.ts +7 -7
  235. package/config/abc/qr.type.d.ts +0 -25
  236. package/esm2022/config/abc/qr.type.mjs +0 -2
@@ -1,116 +1,116 @@
1
- import { addDays, addSeconds, differenceInCalendarDays, format } from 'date-fns';
2
- // TODO: timezone process
3
- export class DateTimePickerUtil {
4
- /**
5
- * Current local time
6
- *
7
- * 当前本地时间
8
- */
9
- get now() {
10
- return new Date();
11
- }
12
- /**
13
- * Current local date (not including time part)
14
- *
15
- * 当前本地日期(不包含时间部分)
16
- */
17
- get date() {
18
- return this.removeTime(this.now);
19
- }
20
- /**
21
- * Remove the time part of the date
22
- *
23
- * 移除日期的时间部分
24
- */
25
- removeTime(d) {
26
- return new Date(d.toDateString());
27
- }
28
- /**
29
- * Format date-time
30
- *
31
- * 格式化日期
32
- */
33
- format(d, formatString = 'yyyy-MM-dd HH:mm:ss') {
34
- return format(d, formatString);
35
- }
36
- genTick(count) {
37
- return new Array(count).fill(0).map((_, idx) => idx);
38
- }
39
- /**
40
- * Calculate the number of days between two dates, `0` means the same day
41
- *
42
- * 计算两个日期相差天数,`0` 表示同一天
43
- */
44
- getDiffDays(dateLeft, dateRight) {
45
- return differenceInCalendarDays(dateLeft, typeof dateRight === 'number' ? addDays(this.date, dateRight) : dateRight || this.date);
46
- }
47
- /**
48
- * Disabled Before date (Default: today), Generally serves `nzDisabledDate`
49
- *
50
- * 禁用之前日期(默认:今天),一般服务于 `nzDisabledDate`
51
- */
52
- disabledBeforeDate(options) {
53
- return (d) => this.getDiffDays(d, options?.offsetDays) < 0;
54
- }
55
- /**
56
- * Disabled After date (Default: today), Generally serves `nzDisabledDate`
57
- *
58
- * 禁用之后日期(默认:今天),一般服务于 `nzDisabledDate`
59
- */
60
- disabledAfterDate(options) {
61
- return (d) => this.getDiffDays(d, options?.offsetDays) > 0;
62
- }
63
- baseDisabledTime(type, offsetSeconds) {
64
- const tick24 = this.genTick(24);
65
- const tick60 = this.genTick(60);
66
- return (current) => {
67
- const cur = current;
68
- if (cur == null) {
69
- return {};
70
- }
71
- const now = addSeconds(this.now, offsetSeconds || 0);
72
- const nowHours = now.getHours();
73
- const nowMinutes = now.getMinutes();
74
- const curHours = cur.getHours();
75
- const isToday = this.getDiffDays(this.removeTime(cur)) === 0;
76
- return {
77
- nzDisabledHours: () => {
78
- if (!isToday)
79
- return [];
80
- return type === 'before' ? tick24.slice(0, nowHours) : tick24.slice(nowHours + 1);
81
- },
82
- nzDisabledMinutes: () => {
83
- if (isToday && curHours === nowHours) {
84
- return type === 'before' ? tick60.slice(0, nowMinutes) : tick60.slice(nowMinutes + 1);
85
- }
86
- return [];
87
- },
88
- nzDisabledSeconds: () => {
89
- if (isToday && curHours === nowHours && cur.getMinutes() === nowMinutes) {
90
- const nowSeconds = now.getSeconds();
91
- return type === 'before' ? tick60.slice(0, nowSeconds) : tick60.slice(nowSeconds + 1);
92
- }
93
- return [];
94
- }
95
- };
96
- };
97
- }
98
- /**
99
- * Disabled Before time (Default: now), Generally serves `nzDisabledTime`
100
- *
101
- * 禁用之前时间(默认:现在),一般服务于 `nzDisabledTime`
102
- */
103
- disabledBeforeTime(options) {
104
- return this.baseDisabledTime('before', options?.offsetSeconds);
105
- }
106
- /**
107
- * Disabled After time (Default: now), Generally serves `nzDisabledTime`
108
- *
109
- * 禁用之后时间(默认:现在),一般服务于 `nzDisabledTime`
110
- */
111
- disabledAfterTime(options) {
112
- return this.baseDisabledTime('after', options?.offsetSeconds);
113
- }
114
- }
115
- export const dateTimePickerUtil = new DateTimePickerUtil();
1
+ import { addDays, addSeconds, differenceInCalendarDays, format } from 'date-fns';
2
+ // TODO: timezone process
3
+ export class DateTimePickerUtil {
4
+ /**
5
+ * Current local time
6
+ *
7
+ * 当前本地时间
8
+ */
9
+ get now() {
10
+ return new Date();
11
+ }
12
+ /**
13
+ * Current local date (not including time part)
14
+ *
15
+ * 当前本地日期(不包含时间部分)
16
+ */
17
+ get date() {
18
+ return this.removeTime(this.now);
19
+ }
20
+ /**
21
+ * Remove the time part of the date
22
+ *
23
+ * 移除日期的时间部分
24
+ */
25
+ removeTime(d) {
26
+ return new Date(d.toDateString());
27
+ }
28
+ /**
29
+ * Format date-time
30
+ *
31
+ * 格式化日期
32
+ */
33
+ format(d, formatString = 'yyyy-MM-dd HH:mm:ss') {
34
+ return format(d, formatString);
35
+ }
36
+ genTick(count) {
37
+ return new Array(count).fill(0).map((_, idx) => idx);
38
+ }
39
+ /**
40
+ * Calculate the number of days between two dates, `0` means the same day
41
+ *
42
+ * 计算两个日期相差天数,`0` 表示同一天
43
+ */
44
+ getDiffDays(dateLeft, dateRight) {
45
+ return differenceInCalendarDays(dateLeft, typeof dateRight === 'number' ? addDays(this.date, dateRight) : dateRight || this.date);
46
+ }
47
+ /**
48
+ * Disabled Before date (Default: today), Generally serves `nzDisabledDate`
49
+ *
50
+ * 禁用之前日期(默认:今天),一般服务于 `nzDisabledDate`
51
+ */
52
+ disabledBeforeDate(options) {
53
+ return (d) => this.getDiffDays(d, options?.offsetDays) < 0;
54
+ }
55
+ /**
56
+ * Disabled After date (Default: today), Generally serves `nzDisabledDate`
57
+ *
58
+ * 禁用之后日期(默认:今天),一般服务于 `nzDisabledDate`
59
+ */
60
+ disabledAfterDate(options) {
61
+ return (d) => this.getDiffDays(d, options?.offsetDays) > 0;
62
+ }
63
+ baseDisabledTime(type, offsetSeconds) {
64
+ const tick24 = this.genTick(24);
65
+ const tick60 = this.genTick(60);
66
+ return (current) => {
67
+ const cur = current;
68
+ if (cur == null) {
69
+ return {};
70
+ }
71
+ const now = addSeconds(this.now, offsetSeconds || 0);
72
+ const nowHours = now.getHours();
73
+ const nowMinutes = now.getMinutes();
74
+ const curHours = cur.getHours();
75
+ const isToday = this.getDiffDays(this.removeTime(cur)) === 0;
76
+ return {
77
+ nzDisabledHours: () => {
78
+ if (!isToday)
79
+ return [];
80
+ return type === 'before' ? tick24.slice(0, nowHours) : tick24.slice(nowHours + 1);
81
+ },
82
+ nzDisabledMinutes: () => {
83
+ if (isToday && curHours === nowHours) {
84
+ return type === 'before' ? tick60.slice(0, nowMinutes) : tick60.slice(nowMinutes + 1);
85
+ }
86
+ return [];
87
+ },
88
+ nzDisabledSeconds: () => {
89
+ if (isToday && curHours === nowHours && cur.getMinutes() === nowMinutes) {
90
+ const nowSeconds = now.getSeconds();
91
+ return type === 'before' ? tick60.slice(0, nowSeconds) : tick60.slice(nowSeconds + 1);
92
+ }
93
+ return [];
94
+ }
95
+ };
96
+ };
97
+ }
98
+ /**
99
+ * Disabled Before time (Default: now), Generally serves `nzDisabledTime`
100
+ *
101
+ * 禁用之前时间(默认:现在),一般服务于 `nzDisabledTime`
102
+ */
103
+ disabledBeforeTime(options) {
104
+ return this.baseDisabledTime('before', options?.offsetSeconds);
105
+ }
106
+ /**
107
+ * Disabled After time (Default: now), Generally serves `nzDisabledTime`
108
+ *
109
+ * 禁用之后时间(默认:现在),一般服务于 `nzDisabledTime`
110
+ */
111
+ disabledAfterTime(options) {
112
+ return this.baseDisabledTime('after', options?.offsetSeconds);
113
+ }
114
+ }
115
+ export const dateTimePickerUtil = new DateTimePickerUtil();
116
116
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGlja2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvdXRpbC9kYXRlLXRpbWUvcGlja2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxPQUFPLEVBQUUsVUFBVSxFQUFFLHdCQUF3QixFQUFFLE1BQU0sRUFBRSxNQUFNLFVBQVUsQ0FBQztBQUtqRix5QkFBeUI7QUFDekIsTUFBTSxPQUFPLGtCQUFrQjtJQUM3Qjs7OztPQUlHO0lBQ0gsSUFBSSxHQUFHO1FBQ0wsT0FBTyxJQUFJLElBQUksRUFBRSxDQUFDO0lBQ3BCLENBQUM7SUFDRDs7OztPQUlHO0lBQ0gsSUFBSSxJQUFJO1FBQ04sT0FBTyxJQUFJLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQztJQUNuQyxDQUFDO0lBQ0Q7Ozs7T0FJRztJQUNILFVBQVUsQ0FBQyxDQUFPO1FBQ2hCLE9BQU8sSUFBSSxJQUFJLENBQUMsQ0FBQyxDQUFDLFlBQVksRUFBRSxDQUFDLENBQUM7SUFDcEMsQ0FBQztJQUNEOzs7O09BSUc7SUFD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RUaW1lYFxuICAgKlxuICAgKiDnpoHnlKjkuYvlkI7ml7bpl7TvvIjpu5jorqTvvJrnjrDlnKjvvInvvIzkuIDoiKzmnI3liqHkuo4gYG56RGlzYWJsZWRUaW1lYFxuICAgKi9cbiAgZGlzYWJsZWRBZnRlclRpbWUob3B0aW9ucz86IHsgb2Zmc2V0U2Vjb25kcz86IG51bWJlciB9KTogRGlzYWJsZWRUaW1lRm4ge1xuICAgIHJldHVybiB0aGlzLmJhc2VEaXNhYmxlZFRpbWUoJ2FmdGVyJywgb3B0aW9ucz8ub2Zmc2V0U2Vjb25kcyk7XG4gIH1cbn1cblxuZXhwb3J0IGNvbnN0IGRhdGVUaW1lUGlja2VyVXRpbCA9IG5ldyBEYXRlVGltZVBpY2tlclV0aWwoKTtcbiJdfQ==
@@ -1,101 +1,101 @@
1
- import { addDays, endOfDay, endOfMonth, endOfWeek, endOfYear, parse, parseISO, startOfDay, startOfMonth, startOfWeek, startOfYear, subMonths, subWeeks, subYears, format, formatDistanceToNow } from 'date-fns';
2
- /**
3
- * Get the time range, return `[ Date, Date]` for the start and end dates
4
- *
5
- * 获取时间范围
6
- *
7
- * @param type 类型,带 `-` 表示过去一个时间,若指定 `number` 表示天数
8
- * @param time 开始时间
9
- * @param ignoreMaxTime 忽略追加结束日期的最大时间值
10
- */
11
- export function getTimeDistance(type, time, options) {
12
- time = time
13
- ? typeof time === 'string'
14
- ? parse(time, 'yyyy-MM-dd HH:mm:ss', new Date())
15
- : new Date(time)
16
- : new Date();
17
- const opt = { weekStartsOn: 1 };
18
- let res;
19
- switch (type) {
20
- case 'today':
21
- res = [time, time];
22
- break;
23
- case '-today':
24
- res = [addDays(time, -1), time];
25
- break;
26
- case 'yesterday':
27
- res = [addDays(time, -1), addDays(time, -1)];
28
- break;
29
- case 'week':
30
- res = [startOfWeek(time, opt), endOfWeek(time, opt)];
31
- break;
32
- case '-week':
33
- res = [startOfWeek(subWeeks(time, 1), opt), endOfWeek(subWeeks(time, 1), opt)];
34
- break;
35
- case 'month':
36
- res = [startOfMonth(time), endOfMonth(time)];
37
- break;
38
- case '-month':
39
- res = [startOfMonth(subMonths(time, 1)), endOfMonth(subMonths(time, 1))];
40
- break;
41
- case 'year':
42
- res = [startOfYear(time), endOfYear(time)];
43
- break;
44
- case '-year':
45
- res = [startOfYear(subYears(time, 1)), endOfYear(subYears(time, 1))];
46
- break;
47
- default:
48
- res = type > 0 ? [time, addDays(time, type)] : [addDays(time, type), time];
49
- break;
50
- }
51
- return options?.ignoreMaxTime ? res : fixEndTimeOfRange(res);
52
- }
53
- /**
54
- * fix time is the most, big value
55
- */
56
- export function fixEndTimeOfRange(dates) {
57
- return [startOfDay(dates[0]), endOfDay(dates[1])];
58
- }
59
- /**
60
- * Convert to `Date` format
61
- *
62
- * @param value When is a number, it's treated as a timestamp; If it's seconds, you need to provide the `options.timestampSecond` parameter.
63
- */
64
- export function toDate(value, options) {
65
- const { formatString, defaultValue, timestampSecond } = {
66
- formatString: 'yyyy-MM-dd HH:mm:ss',
67
- defaultValue: new Date(NaN),
68
- timestampSecond: false,
69
- ...(typeof options === 'string' ? { formatString: options } : options)
70
- };
71
- if (value == null) {
72
- return defaultValue;
73
- }
74
- if (value instanceof Date) {
75
- return value;
76
- }
77
- if (typeof value === 'number' || (typeof value === 'string' && /^[0-9]+$/.test(value))) {
78
- const valueNumber = +value;
79
- return new Date(timestampSecond ? valueNumber * 1000 : valueNumber);
80
- }
81
- let tryDate = parseISO(value);
82
- if (isNaN(tryDate)) {
83
- tryDate = parse(value, formatString, new Date());
84
- }
85
- return isNaN(tryDate) ? defaultValue : tryDate;
86
- }
87
- /**
88
- * Format date, supports `Date, number, string` types
89
- *
90
- * @param value When is a number, it is treated as a timestamp (Support seconds and milliseconds timestamp).
91
- * @param formatString Please refer to [date-fnd format](https://date-fns.org/v2.30.0/docs/format) for string format
92
- * @param dateLocale Recommended to be consistent with NG-ZORRO by using `inject(NZ_DATE_LOCALE)`
93
- */
94
- export function formatDate(value, formatString, dateLocale) {
95
- value = toDate(value);
96
- if (isNaN(value))
97
- return '';
98
- const langOpt = { locale: dateLocale };
99
- return formatString === 'fn' ? formatDistanceToNow(value, langOpt) : format(value, formatString, langOpt);
100
- }
1
+ import { addDays, endOfDay, endOfMonth, endOfWeek, endOfYear, parse, parseISO, startOfDay, startOfMonth, startOfWeek, startOfYear, subMonths, subWeeks, subYears, format, formatDistanceToNow } from 'date-fns';
2
+ /**
3
+ * Get the time range, return `[ Date, Date]` for the start and end dates
4
+ *
5
+ * 获取时间范围
6
+ *
7
+ * @param type 类型,带 `-` 表示过去一个时间,若指定 `number` 表示天数
8
+ * @param time 开始时间
9
+ * @param ignoreMaxTime 忽略追加结束日期的最大时间值
10
+ */
11
+ export function getTimeDistance(type, time, options) {
12
+ time = time
13
+ ? typeof time === 'string'
14
+ ? parse(time, 'yyyy-MM-dd HH:mm:ss', new Date())
15
+ : new Date(time)
16
+ : new Date();
17
+ const opt = { weekStartsOn: 1 };
18
+ let res;
19
+ switch (type) {
20
+ case 'today':
21
+ res = [time, time];
22
+ break;
23
+ case '-today':
24
+ res = [addDays(time, -1), time];
25
+ break;
26
+ case 'yesterday':
27
+ res = [addDays(time, -1), addDays(time, -1)];
28
+ break;
29
+ case 'week':
30
+ res = [startOfWeek(time, opt), endOfWeek(time, opt)];
31
+ break;
32
+ case '-week':
33
+ res = [startOfWeek(subWeeks(time, 1), opt), endOfWeek(subWeeks(time, 1), opt)];
34
+ break;
35
+ case 'month':
36
+ res = [startOfMonth(time), endOfMonth(time)];
37
+ break;
38
+ case '-month':
39
+ res = [startOfMonth(subMonths(time, 1)), endOfMonth(subMonths(time, 1))];
40
+ break;
41
+ case 'year':
42
+ res = [startOfYear(time), endOfYear(time)];
43
+ break;
44
+ case '-year':
45
+ res = [startOfYear(subYears(time, 1)), endOfYear(subYears(time, 1))];
46
+ break;
47
+ default:
48
+ res = type > 0 ? [time, addDays(time, type)] : [addDays(time, type), time];
49
+ break;
50
+ }
51
+ return options?.ignoreMaxTime ? res : fixEndTimeOfRange(res);
52
+ }
53
+ /**
54
+ * fix time is the most, big value
55
+ */
56
+ export function fixEndTimeOfRange(dates) {
57
+ return [startOfDay(dates[0]), endOfDay(dates[1])];
58
+ }
59
+ /**
60
+ * Convert to `Date` format
61
+ *
62
+ * @param value When is a number, it's treated as a timestamp; If it's seconds, you need to provide the `options.timestampSecond` parameter.
63
+ */
64
+ export function toDate(value, options) {
65
+ const { formatString, defaultValue, timestampSecond } = {
66
+ formatString: 'yyyy-MM-dd HH:mm:ss',
67
+ defaultValue: new Date(NaN),
68
+ timestampSecond: false,
69
+ ...(typeof options === 'string' ? { formatString: options } : options)
70
+ };
71
+ if (value == null) {
72
+ return defaultValue;
73
+ }
74
+ if (value instanceof Date) {
75
+ return value;
76
+ }
77
+ if (typeof value === 'number' || (typeof value === 'string' && /^[0-9]+$/.test(value))) {
78
+ const valueNumber = +value;
79
+ return new Date(timestampSecond ? valueNumber * 1000 : valueNumber);
80
+ }
81
+ let tryDate = parseISO(value);
82
+ if (isNaN(tryDate)) {
83
+ tryDate = parse(value, formatString, new Date());
84
+ }
85
+ return isNaN(tryDate) ? defaultValue : tryDate;
86
+ }
87
+ /**
88
+ * Format date, supports `Date, number, string` types
89
+ *
90
+ * @param value When is a number, it is treated as a timestamp (Support seconds and milliseconds timestamp).
91
+ * @param formatString Please refer to [date-fnd format](https://date-fns.org/v2.30.0/docs/format) for string format
92
+ * @param dateLocale Recommended to be consistent with NG-ZORRO by using `inject(NZ_DATE_LOCALE)`
93
+ */
94
+ export function formatDate(value, formatString, dateLocale) {
95
+ value = toDate(value);
96
+ if (isNaN(value))
97
+ return '';
98
+ const langOpt = { locale: dateLocale };
99
+ return formatString === 'fn' ? formatDistanceToNow(value, langOpt) : format(value, formatString, langOpt);
100
+ }
101
101
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGltZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4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lcyA9IFthZGREYXlzKHRpbWUsIC0xKSwgdGltZV07XG4gICAgICBicmVhaztcbiAgICBjYXNlICd5ZXN0ZXJkYXknOlxuICAgICAgcmVzID0gW2FkZERheXModGltZSwgLTEpLCBhZGREYXlzKHRpbWUsIC0xKV07XG4gICAgICBicmVhaztcbiAgICBjYXNlICd3ZWVrJzpcbiAgICAgIHJlcyA9IFtzdGFydE9mV2Vlayh0aW1lLCBvcHQpLCBlbmRPZldlZWsodGltZSwgb3B0KV07XG4gICAgICBicmVhaztcbiAgICBjYXNlICctd2Vlayc6XG4gICAgICByZXMgPSBbc3RhcnRPZldlZWsoc3ViV2Vla3ModGltZSwgMSksIG9wdCksIGVuZE9mV2VlayhzdWJXZWVrcyh0aW1lLCAxKSwgb3B0KV07XG4gICAgICBicmVhaztcbiAgICBjYXNlICdtb250aCc6XG4gICAgICByZXMgPSBbc3RhcnRPZk1vbnRoKHRpbWUpLCBlbmRPZk1vbnRoKHRpbWUpXTtcbiAgICAgIGJyZWFrO1xuICAgIGNhc2UgJy1tb250aCc6XG4gICAgICByZXMgPSBbc3RhcnRPZk1vbnRoKHN1Yk1vbnRocyh0aW1lLCAxKSksIGVuZE9mTW9udGgoc3ViTW9udGhzKHRpbWUsIDEpKV07XG4gICAgICBicmVhaztcbiAgICBjYXNlICd5ZWFyJzpcbiAgICAgIHJlcyA9IFtzdGFydE9mWWVhcih0aW1lKSwgZW5kT2ZZZWFyKHRpbWUpXTtcbiAgICAgIGJyZWFrO1xuICAgIGNhc2UgJy15ZWFyJzpcbiAgICAgIHJlcyA9IFtzdGFydE9mWWVhcihzdWJZZWFycyh0aW1lLCAxKSksIGVuZE9mWWVhcihzdWJZZWFycyh0aW1lLCAxKSldO1xuICAgICAgYnJlYWs7XG4gICAgZGVmYXVsdDpcbiAgICAgIHJlcyA9IHR5cGUgPiAwID8gW3RpbWUsIGFkZERheXModGltZSwgdHlwZSldIDogW2FkZERheXModGltZSwgdHlwZSksIHRpbWVdO1xuICAgICAgY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Value) {
3
- function propDecorator(target, propName, originalDescriptor) {
4
- const privatePropName = `$$__${propName}`;
5
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
6
- if (Object.prototype.hasOwnProperty.call(target, privatePropName)) {
7
- warn(`The prop "${privatePropName}" is already exist, it will be overrided by ${name} decorator.`);
8
- }
9
- }
10
- Object.defineProperty(target, privatePropName, {
11
- configurable: true,
12
- writable: true
13
- });
14
- return {
15
- get() {
16
- return originalDescriptor && originalDescriptor.get
17
- ? originalDescriptor.get.bind(this)()
18
- : this[privatePropName];
19
- },
20
- set(value) {
21
- if (originalDescriptor && originalDescriptor.set) {
22
- originalDescriptor.set.bind(this)(fallback(value, defaultValue));
23
- }
24
- this[privatePropName] = fallback(value, defaultValue);
25
- }
26
- };
27
- }
28
- return propDecorator;
29
- }
30
- export function toBoolean(value, defaultValue = false) {
31
- return value == null ? defaultValue : `${value}` !== 'false';
32
- }
33
- /**
34
- * @deprecated Recommended to use the built-in `transform` and `static ngAcceptInputType_` can be removed
35
- * - Use `@Input({ transform: booleanAttribute })` instead of `@InputBoolean()`
36
- * - Use `@Input({ transform: (v: unknown) => (v == null ? null : booleanAttribute(v)) })` instead of `@InputBoolean(null)`
37
- *
38
- * Input decorator that handle a prop to do get/set automatically with toBoolean
39
- *
40
- * ```ts
41
- * {AT}Input() {AT}InputBoolean() visible: boolean = false;
42
- * {AT}Input() {AT}InputBoolean(null) visible: boolean = false;
43
- * ```
44
- */
45
- export function InputBoolean(defaultValue = false) {
46
- return propDecoratorFactory('InputBoolean', toBoolean, defaultValue);
47
- }
48
- export function toNumber(value, fallbackValue = 0) {
49
- return !isNaN(parseFloat(value)) && !isNaN(Number(value)) ? Number(value) : fallbackValue;
50
- }
51
- /**
52
- * @deprecated Recommended to use the built-in `transform` and `static ngAcceptInputType_` can be removed
53
- * - Use `@Input({ transform: numberAttribute })` instead of `@InputNumber()`
54
- * - Use `@Input({ transform: (v: unknown) => (v == null ? null : numberAttribute(v)) })` instead of `@InputNumber(null)`
55
- *
56
- * Input decorator that handle a prop to do get/set automatically with toNumber
57
- *
58
- * ```ts
59
- * {AT}Input() {AT}InputNumber() visible: number = 1;
60
- * {AT}Input() {AT}InputNumber(null) visible: number = 2;
61
- * ```
62
- */
63
- export function InputNumber(defaultValue = 0) {
64
- return propDecoratorFactory('InputNumber', toNumber, defaultValue);
65
- }
1
+ import { warn } from '@yelon/util/other';
2
+ function propDecoratorFactory(name, fallback, defaultValue) {
3
+ function propDecorator(target, propName, originalDescriptor) {
4
+ const privatePropName = `$$__${propName}`;
5
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
6
+ if (Object.prototype.hasOwnProperty.call(target, privatePropName)) {
7
+ warn(`The prop "${privatePropName}" is already exist, it will be overrided by ${name} decorator.`);
8
+ }
9
+ }
10
+ Object.defineProperty(target, privatePropName, {
11
+ configurable: true,
12
+ writable: true
13
+ });
14
+ return {
15
+ get() {
16
+ return originalDescriptor && originalDescriptor.get
17
+ ? originalDescriptor.get.bind(this)()
18
+ : this[privatePropName];
19
+ },
20
+ set(value) {
21
+ if (originalDescriptor && originalDescriptor.set) {
22
+ originalDescriptor.set.bind(this)(fallback(value, defaultValue));
23
+ }
24
+ this[privatePropName] = fallback(value, defaultValue);
25
+ }
26
+ };
27
+ }
28
+ return propDecorator;
29
+ }
30
+ export function toBoolean(value, defaultValue = false) {
31
+ return value == null ? defaultValue : `${value}` !== 'false';
32
+ }
33
+ /**
34
+ * @deprecated Recommended to use the built-in `transform` and `static ngAcceptInputType_` can be removed
35
+ * - Use `@Input({ transform: booleanAttribute })` instead of `@InputBoolean()`
36
+ * - Use `@Input({ transform: (v: unknown) => (v == null ? null : booleanAttribute(v)) })` instead of `@InputBoolean(null)`
37
+ *
38
+ * Input decorator that handle a prop to do get/set automatically with toBoolean
39
+ *
40
+ * ```ts
41
+ * {AT}Input() {AT}InputBoolean() visible: boolean = false;
42
+ * {AT}Input() {AT}InputBoolean(null) visible: boolean = false;
43
+ * ```
44
+ */
45
+ export function InputBoolean(defaultValue = false) {
46
+ return propDecoratorFactory('InputBoolean', toBoolean, defaultValue);
47
+ }
48
+ export function toNumber(value, fallbackValue = 0) {
49
+ return !isNaN(parseFloat(value)) && !isNaN(Number(value)) ? Number(value) : fallbackValue;
50
+ }
51
+ /**
52
+ * @deprecated Recommended to use the built-in `transform` and `static ngAcceptInputType_` can be removed
53
+ * - Use `@Input({ transform: numberAttribute })` instead of `@InputNumber()`
54
+ * - Use `@Input({ transform: (v: unknown) => (v == null ? null : numberAttribute(v)) })` instead of `@InputNumber(null)`
55
+ *
56
+ * Input decorator that handle a prop to do get/set automatically with toNumber
57
+ *
58
+ * ```ts
59
+ * {AT}Input() {AT}InputNumber() visible: number = 1;
60
+ * {AT}Input() {AT}InputNumber(null) visible: number = 2;
61
+ * ```
62
+ */
63
+ export function InputNumber(defaultValue = 0) {
64
+ return propDecoratorFactory('InputNumber', toNumber, defaultValue);
65
+ }
66
66
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udmVydC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3V0aWwvZGVjb3JhdG9yL2NvbnZlcnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLElBQUksRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBTXpDLFNBQVMsb0JBQW9CLENBQzNCLElBQVksRUFDWixRQUFzQyxFQUN0QyxZQUF1QjtJQUV2QixTQUFTLGFBQWEsQ0FDcEIsTUFBaUIsRUFDakIsUUFBZ0IsRUFDaEIsa0JBQXVEO1FBRXZELE1BQU0sZUFBZSxHQUFHLE9BQU8sUUFBUSxFQUFFLENBQUM7UUFFMUMsSUFBSSxPQUFPLFNBQVMsS0FBSyxXQUFXLElBQUksU0FBUyxFQUFFLENBQUM7WUFDbEQsSUFBSSxNQUFNLENBQUMsU0FBUyxDQUFDLG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OdW1iZXIodmFsdWUpKSA/IE51bWJlcih2YWx1ZSkgOiBmYWxsYmFja1ZhbHVlO1xufVxuXG4vKipcbiAqIEBkZXByZWNhdGVkIFJlY29tbWVuZGVkIHRvIHVzZSB0aGUgYnVpbHQtaW4gYHRyYW5zZm9ybWAgYW5kIGBzdGF0aWMgbmdBY2NlcHRJbnB1dFR5cGVfYCBjYW4gYmUgcmVtb3ZlZFxuICogLSBVc2UgYEBJbnB1dCh7IHRyYW5zZm9ybTogbnVtYmVyQXR0cmlidXRlIH0pYCBpbnN0ZWFkIG9mIGBASW5wdXROdW1iZXIoKWBcbiAqIC0gVXNlIGBASW5wdXQoeyB0cmFuc2Zvcm06ICh2OiB1bmtub3duKSA9PiAodiA9PSBudWxsID8gbnVsbCA6IG51bWJlckF0dHJpYnV0ZSh2KSkgfSlgIGluc3RlYWQgb2YgYEBJbnB1dE51bWJlcihudWxsKWBcbiAqXG4gKiBJbnB1dCBkZWNvcmF0b3IgdGhhdCBoYW5kbGUgYSBwcm9wIHRvIGRvIGdldC9zZXQgYXV0b21hdGljYWxseSB3aXRoIHRvTnVtYmVyXG4gKlxuICogYGBgdHNcbiAqIHtBVH1JbnB1dCgpIHtBVH1JbnB1dE51bWJlcigpIHZpc2libGU6IG51bWJlciA9IDE7XG4gKiB7QVR9SW5wdXQoKSB7QVR9SW5wdXROdW1iZXIobnVsbCkgdmlzaWJsZTogbnVtYmVyID0gMjtcbiAqIGBgYFxuICovXG5leHBvcnQgZnVuY3Rpb24gSW5wdXROdW1iZXIoZGVmYXVsdFZhbHVlOiBudW1iZXIgfCBudWxsID0gMCk6IE56U2FmZUFueSB7XG4gIHJldHVybiBwcm9wRGVjb3JhdG9yRmFjdG9yeSgnSW5wdXROdW1iZXInLCB0b051bWJlciwgZGVmYXVsdFZhbHVlKTtcbn1cbiJdfQ==
@@ -1,5 +1,5 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- export * from './index';
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './index';
5
5
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVjb3JhdG9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvdXRpbC9kZWNvcmF0b3IvZGVjb3JhdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuIl19
@@ -1,3 +1,3 @@
1
- export * from './convert';
2
- export * from './zone-outside';
1
+ export * from './convert';
2
+ export * from './zone-outside';
3
3
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2RlY29yYXRvci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLFdBQVcsQ0FBQztBQUMxQixjQUFjLGdCQUFnQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9jb252ZXJ0JztcbmV4cG9ydCAqIGZyb20gJy4vem9uZS1vdXRzaWRlJztcbiJdfQ==