@yelon/util 17.3.1 → 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 +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 { EnvironmentProviders, InjectionToken, makeEnvironmentProviders } from '@angular/core';\n\nimport {\n YunzaiCellConfig,\n YunzaiDateRangePickerConfig,\n YunzaiErrorCollectConfig,\n YunzaiExceptionType,\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 { YunzaiSocketConfig } from './socket/socket.type';\nimport { YunzaiThemeHttpClientConfig, YunzaiThemeResponsiveConfig, YunzaiThemeI18nConfig } from './theme/index';\nimport { YunzaiThemePipeConfig } from './theme/pipe.type';\nimport { YunzaiUtilArrayConfig } from './util/array.type';\nimport { YunzaiUtilCurrencyConfig } from './util/currency.type';\n\nexport interface YunzaiConfig {\n bis?: YunzaiBusinessConfig;\n socket?: YunzaiSocketConfig;\n dataRange?: YunzaiDateRangePickerConfig;\n exception?: YunzaiExceptionType;\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 cell?: YunzaiCellConfig;\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 themePipe?: YunzaiThemePipeConfig;\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\nexport function provideYunzaiConfig(config: YunzaiConfig): EnvironmentProviders {\n return makeEnvironmentProviders([{ provide: YUNZAI_CONFIG, useValue: config }]);\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Inject, Injectable, Optional } from '@angular/core';\n\nimport { deepMergeKey } from '@yelon/util/other';\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\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 as any, this.merge(componentName, defaultValues));\n }\n\n attachKey<T extends YunzaiConfigKey>(componentThis: unknown, componentName: T, key: string): void {\n Object.assign(componentThis as any, 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,CAAA;AAa1B;;MC2DY,aAAa,GAAG,IAAI,cAAc,CAAe,eAAe,EAAE;AAC7E,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,qBAAqB;AAC/B,CAAA,EAAE;SAEa,qBAAqB,GAAA;AACnC,IAAA,OAAO,EAAE,CAAC;AACZ,CAAC;AAEK,SAAU,mBAAmB,CAAC,MAAoB,EAAA;AACtD,IAAA,OAAO,wBAAwB,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AAClF;;ACnFA;MASa,mBAAmB,CAAA;AAG9B,IAAA,WAAA,CAA+C,aAA4B,EAAA;AACzE,QAAA,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,aAAa,EAAE,CAAC;KACpC;IAED,GAAG,CAA4B,aAAgB,EAAE,GAAY,EAAA;AAC3D,QAAA,MAAM,GAAG,IAAK,IAAI,CAAC,MAAM,CAAC,aAAa,CAAgC,IAAI,EAAE,CAAc,CAAC;AAC5F,QAAA,OAAO,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC;KACxC;AAED,IAAA,KAAK,CAA4B,aAAgB,EAAE,GAAG,aAAqC,EAAA;AACzF,QAAA,OAAO,YAAY,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,aAAa,EAAE,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;KAC1E;AAED,IAAA,MAAM,CAA4B,aAAsB,EAAE,aAAgB,EAAE,aAA8B,EAAA;AACxG,QAAA,MAAM,CAAC,MAAM,CAAC,aAAoB,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC;KAC/E;AAED,IAAA,SAAS,CAA4B,aAAsB,EAAE,aAAgB,EAAE,GAAW,EAAA;AACxF,QAAA,MAAM,CAAC,MAAM,CAAC,aAAoB,EAAE,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC;KACnE;IAED,GAAG,CAA4B,aAAgB,EAAE,KAAsB,EAAA;AACrE,QAAA,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC;KAC1E;AA1BU,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,kBAGE,aAAa,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;AAHlC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,cADN,MAAM,EAAA,CAAA,CAAA,EAAA;;2FACnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAD/B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;;0BAInB,QAAQ;;0BAAI,MAAM;2BAAC,aAAa,CAAA;;;ACZ/C;;AAEG;;;;"}
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 { EnvironmentProviders, InjectionToken, makeEnvironmentProviders } from '@angular/core';\n\nimport {\n YunzaiCellConfig,\n YunzaiDateRangePickerConfig,\n YunzaiErrorCollectConfig,\n YunzaiExceptionType,\n YunzaiImageConfig,\n YunzaiLoadingConfig,\n YunzaiLodopConfig,\n YunzaiMediaConfig,\n YunzaiOnboardingConfig,\n YunzaiPageHeaderConfig,\n YunzaiPdfConfig,\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 { YunzaiSocketConfig } from './socket/socket.type';\nimport { YunzaiThemeHttpClientConfig, YunzaiThemeResponsiveConfig, YunzaiThemeI18nConfig } from './theme/index';\nimport { YunzaiThemePipeConfig } from './theme/pipe.type';\nimport { YunzaiUtilArrayConfig } from './util/array.type';\nimport { YunzaiUtilCurrencyConfig } from './util/currency.type';\n\nexport interface YunzaiConfig {\n bis?: YunzaiBusinessConfig;\n socket?: YunzaiSocketConfig;\n dataRange?: YunzaiDateRangePickerConfig;\n exception?: YunzaiExceptionType;\n errorCollect?: YunzaiErrorCollectConfig;\n image?: YunzaiImageConfig;\n loading?: YunzaiLoadingConfig;\n onboarding?: YunzaiOnboardingConfig;\n lodop?: YunzaiLodopConfig;\n pageHeader?: YunzaiPageHeaderConfig;\n se?: YunzaiSEConfig;\n sg?: YunzaiSGConfig;\n sv?: YunzaiSVConfig;\n st?: YunzaiSTConfig;\n sf?: YunzaiSFConfig;\n cell?: YunzaiCellConfig;\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 themePipe?: YunzaiThemePipeConfig;\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\nexport function provideYunzaiConfig(config: YunzaiConfig): EnvironmentProviders {\n return makeEnvironmentProviders([{ provide: YUNZAI_CONFIG, useValue: config }]);\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Inject, Injectable, Optional } from '@angular/core';\n\nimport { deepMergeKey } from '@yelon/util/other';\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\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 as any, this.merge(componentName, defaultValues));\n }\n\n attachKey<T extends YunzaiConfigKey>(componentThis: unknown, componentName: T, key: string): void {\n Object.assign(componentThis as any, 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,CAAA;AAa1B;;MCyDY,aAAa,GAAG,IAAI,cAAc,CAAe,eAAe,EAAE;AAC7E,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,qBAAqB;AAC/B,CAAA,EAAE;SAEa,qBAAqB,GAAA;AACnC,IAAA,OAAO,EAAE,CAAC;AACZ,CAAC;AAEK,SAAU,mBAAmB,CAAC,MAAoB,EAAA;AACtD,IAAA,OAAO,wBAAwB,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AAClF;;ACjFA;MASa,mBAAmB,CAAA;AAG9B,IAAA,WAAA,CAA+C,aAA4B,EAAA;AACzE,QAAA,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,aAAa,EAAE,CAAC;KACpC;IAED,GAAG,CAA4B,aAAgB,EAAE,GAAY,EAAA;AAC3D,QAAA,MAAM,GAAG,IAAK,IAAI,CAAC,MAAM,CAAC,aAAa,CAAgC,IAAI,EAAE,CAAc,CAAC;AAC5F,QAAA,OAAO,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC;KACxC;AAED,IAAA,KAAK,CAA4B,aAAgB,EAAE,GAAG,aAAqC,EAAA;AACzF,QAAA,OAAO,YAAY,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,aAAa,EAAE,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;KAC1E;AAED,IAAA,MAAM,CAA4B,aAAsB,EAAE,aAAgB,EAAE,aAA8B,EAAA;AACxG,QAAA,MAAM,CAAC,MAAM,CAAC,aAAoB,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC;KAC/E;AAED,IAAA,SAAS,CAA4B,aAAsB,EAAE,aAAgB,EAAE,GAAW,EAAA;AACxF,QAAA,MAAM,CAAC,MAAM,CAAC,aAAoB,EAAE,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC;KACnE;IAED,GAAG,CAA4B,aAAgB,EAAE,KAAsB,EAAA;AACrE,QAAA,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC;KAC1E;AA1BU,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,kBAGE,aAAa,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;AAHlC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,cADN,MAAM,EAAA,CAAA,CAAA,EAAA;;2FACnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAD/B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;;0BAInB,QAAQ;;0BAAI,MAAM;2BAAC,aAAa,CAAA;;;ACZ/C;;AAEG;;;;"}
@@ -1,223 +1,223 @@
1
- import { parse, addDays, startOfYear, subYears, endOfYear, startOfMonth, subMonths, endOfMonth, startOfWeek, subWeeks, endOfWeek, startOfDay, endOfDay, parseISO, formatDistanceToNow, format, differenceInCalendarDays, addSeconds } from 'date-fns';
2
-
3
- /**
4
- * Get the time range, return `[ Date, Date]` for the start and end dates
5
- *
6
- * 获取时间范围
7
- *
8
- * @param type 类型,带 `-` 表示过去一个时间,若指定 `number` 表示天数
9
- * @param time 开始时间
10
- * @param ignoreMaxTime 忽略追加结束日期的最大时间值
11
- */
12
- function getTimeDistance(type, time, options) {
13
- time = time
14
- ? typeof time === 'string'
15
- ? parse(time, 'yyyy-MM-dd HH:mm:ss', new Date())
16
- : new Date(time)
17
- : new Date();
18
- const opt = { weekStartsOn: 1 };
19
- let res;
20
- switch (type) {
21
- case 'today':
22
- res = [time, time];
23
- break;
24
- case '-today':
25
- res = [addDays(time, -1), time];
26
- break;
27
- case 'yesterday':
28
- res = [addDays(time, -1), addDays(time, -1)];
29
- break;
30
- case 'week':
31
- res = [startOfWeek(time, opt), endOfWeek(time, opt)];
32
- break;
33
- case '-week':
34
- res = [startOfWeek(subWeeks(time, 1), opt), endOfWeek(subWeeks(time, 1), opt)];
35
- break;
36
- case 'month':
37
- res = [startOfMonth(time), endOfMonth(time)];
38
- break;
39
- case '-month':
40
- res = [startOfMonth(subMonths(time, 1)), endOfMonth(subMonths(time, 1))];
41
- break;
42
- case 'year':
43
- res = [startOfYear(time), endOfYear(time)];
44
- break;
45
- case '-year':
46
- res = [startOfYear(subYears(time, 1)), endOfYear(subYears(time, 1))];
47
- break;
48
- default:
49
- res = type > 0 ? [time, addDays(time, type)] : [addDays(time, type), time];
50
- break;
51
- }
52
- return options?.ignoreMaxTime ? res : fixEndTimeOfRange(res);
53
- }
54
- /**
55
- * fix time is the most, big value
56
- */
57
- function fixEndTimeOfRange(dates) {
58
- return [startOfDay(dates[0]), endOfDay(dates[1])];
59
- }
60
- /**
61
- * Convert to `Date` format
62
- *
63
- * @param value When is a number, it's treated as a timestamp; If it's seconds, you need to provide the `options.timestampSecond` parameter.
64
- */
65
- function toDate(value, options) {
66
- const { formatString, defaultValue, timestampSecond } = {
67
- formatString: 'yyyy-MM-dd HH:mm:ss',
68
- defaultValue: new Date(NaN),
69
- timestampSecond: false,
70
- ...(typeof options === 'string' ? { formatString: options } : options)
71
- };
72
- if (value == null) {
73
- return defaultValue;
74
- }
75
- if (value instanceof Date) {
76
- return value;
77
- }
78
- if (typeof value === 'number' || (typeof value === 'string' && /^[0-9]+$/.test(value))) {
79
- const valueNumber = +value;
80
- return new Date(timestampSecond ? valueNumber * 1000 : valueNumber);
81
- }
82
- let tryDate = parseISO(value);
83
- if (isNaN(tryDate)) {
84
- tryDate = parse(value, formatString, new Date());
85
- }
86
- return isNaN(tryDate) ? defaultValue : tryDate;
87
- }
88
- /**
89
- * Format date, supports `Date, number, string` types
90
- *
91
- * @param value When is a number, it is treated as a timestamp (Support seconds and milliseconds timestamp).
92
- * @param formatString Please refer to [date-fnd format](https://date-fns.org/v2.30.0/docs/format) for string format
93
- * @param dateLocale Recommended to be consistent with NG-ZORRO by using `inject(NZ_DATE_LOCALE)`
94
- */
95
- function formatDate(value, formatString, dateLocale) {
96
- value = toDate(value);
97
- if (isNaN(value))
98
- return '';
99
- const langOpt = { locale: dateLocale };
100
- return formatString === 'fn' ? formatDistanceToNow(value, langOpt) : format(value, formatString, langOpt);
101
- }
102
-
103
- // TODO: timezone process
104
- class DateTimePickerUtil {
105
- /**
106
- * Current local time
107
- *
108
- * 当前本地时间
109
- */
110
- get now() {
111
- return new Date();
112
- }
113
- /**
114
- * Current local date (not including time part)
115
- *
116
- * 当前本地日期(不包含时间部分)
117
- */
118
- get date() {
119
- return this.removeTime(this.now);
120
- }
121
- /**
122
- * Remove the time part of the date
123
- *
124
- * 移除日期的时间部分
125
- */
126
- removeTime(d) {
127
- return new Date(d.toDateString());
128
- }
129
- /**
130
- * Format date-time
131
- *
132
- * 格式化日期
133
- */
134
- format(d, formatString = 'yyyy-MM-dd HH:mm:ss') {
135
- return format(d, formatString);
136
- }
137
- genTick(count) {
138
- return new Array(count).fill(0).map((_, idx) => idx);
139
- }
140
- /**
141
- * Calculate the number of days between two dates, `0` means the same day
142
- *
143
- * 计算两个日期相差天数,`0` 表示同一天
144
- */
145
- getDiffDays(dateLeft, dateRight) {
146
- return differenceInCalendarDays(dateLeft, typeof dateRight === 'number' ? addDays(this.date, dateRight) : dateRight || this.date);
147
- }
148
- /**
149
- * Disabled Before date (Default: today), Generally serves `nzDisabledDate`
150
- *
151
- * 禁用之前日期(默认:今天),一般服务于 `nzDisabledDate`
152
- */
153
- disabledBeforeDate(options) {
154
- return (d) => this.getDiffDays(d, options?.offsetDays) < 0;
155
- }
156
- /**
157
- * Disabled After date (Default: today), Generally serves `nzDisabledDate`
158
- *
159
- * 禁用之后日期(默认:今天),一般服务于 `nzDisabledDate`
160
- */
161
- disabledAfterDate(options) {
162
- return (d) => this.getDiffDays(d, options?.offsetDays) > 0;
163
- }
164
- baseDisabledTime(type, offsetSeconds) {
165
- const tick24 = this.genTick(24);
166
- const tick60 = this.genTick(60);
167
- return (current) => {
168
- const cur = current;
169
- if (cur == null) {
170
- return {};
171
- }
172
- const now = addSeconds(this.now, offsetSeconds || 0);
173
- const nowHours = now.getHours();
174
- const nowMinutes = now.getMinutes();
175
- const curHours = cur.getHours();
176
- const isToday = this.getDiffDays(this.removeTime(cur)) === 0;
177
- return {
178
- nzDisabledHours: () => {
179
- if (!isToday)
180
- return [];
181
- return type === 'before' ? tick24.slice(0, nowHours) : tick24.slice(nowHours + 1);
182
- },
183
- nzDisabledMinutes: () => {
184
- if (isToday && curHours === nowHours) {
185
- return type === 'before' ? tick60.slice(0, nowMinutes) : tick60.slice(nowMinutes + 1);
186
- }
187
- return [];
188
- },
189
- nzDisabledSeconds: () => {
190
- if (isToday && curHours === nowHours && cur.getMinutes() === nowMinutes) {
191
- const nowSeconds = now.getSeconds();
192
- return type === 'before' ? tick60.slice(0, nowSeconds) : tick60.slice(nowSeconds + 1);
193
- }
194
- return [];
195
- }
196
- };
197
- };
198
- }
199
- /**
200
- * Disabled Before time (Default: now), Generally serves `nzDisabledTime`
201
- *
202
- * 禁用之前时间(默认:现在),一般服务于 `nzDisabledTime`
203
- */
204
- disabledBeforeTime(options) {
205
- return this.baseDisabledTime('before', options?.offsetSeconds);
206
- }
207
- /**
208
- * Disabled After time (Default: now), Generally serves `nzDisabledTime`
209
- *
210
- * 禁用之后时间(默认:现在),一般服务于 `nzDisabledTime`
211
- */
212
- disabledAfterTime(options) {
213
- return this.baseDisabledTime('after', options?.offsetSeconds);
214
- }
215
- }
216
- const dateTimePickerUtil = new DateTimePickerUtil();
217
-
218
- /**
219
- * Generated bundle index. Do not edit.
220
- */
221
-
222
- export { DateTimePickerUtil, dateTimePickerUtil, fixEndTimeOfRange, formatDate, getTimeDistance, toDate };
223
- //# sourceMappingURL=date-time.mjs.map
1
+ import { parse, addDays, startOfYear, subYears, endOfYear, startOfMonth, subMonths, endOfMonth, startOfWeek, subWeeks, endOfWeek, startOfDay, endOfDay, parseISO, formatDistanceToNow, format, differenceInCalendarDays, addSeconds } from 'date-fns';
2
+
3
+ /**
4
+ * Get the time range, return `[ Date, Date]` for the start and end dates
5
+ *
6
+ * 获取时间范围
7
+ *
8
+ * @param type 类型,带 `-` 表示过去一个时间,若指定 `number` 表示天数
9
+ * @param time 开始时间
10
+ * @param ignoreMaxTime 忽略追加结束日期的最大时间值
11
+ */
12
+ function getTimeDistance(type, time, options) {
13
+ time = time
14
+ ? typeof time === 'string'
15
+ ? parse(time, 'yyyy-MM-dd HH:mm:ss', new Date())
16
+ : new Date(time)
17
+ : new Date();
18
+ const opt = { weekStartsOn: 1 };
19
+ let res;
20
+ switch (type) {
21
+ case 'today':
22
+ res = [time, time];
23
+ break;
24
+ case '-today':
25
+ res = [addDays(time, -1), time];
26
+ break;
27
+ case 'yesterday':
28
+ res = [addDays(time, -1), addDays(time, -1)];
29
+ break;
30
+ case 'week':
31
+ res = [startOfWeek(time, opt), endOfWeek(time, opt)];
32
+ break;
33
+ case '-week':
34
+ res = [startOfWeek(subWeeks(time, 1), opt), endOfWeek(subWeeks(time, 1), opt)];
35
+ break;
36
+ case 'month':
37
+ res = [startOfMonth(time), endOfMonth(time)];
38
+ break;
39
+ case '-month':
40
+ res = [startOfMonth(subMonths(time, 1)), endOfMonth(subMonths(time, 1))];
41
+ break;
42
+ case 'year':
43
+ res = [startOfYear(time), endOfYear(time)];
44
+ break;
45
+ case '-year':
46
+ res = [startOfYear(subYears(time, 1)), endOfYear(subYears(time, 1))];
47
+ break;
48
+ default:
49
+ res = type > 0 ? [time, addDays(time, type)] : [addDays(time, type), time];
50
+ break;
51
+ }
52
+ return options?.ignoreMaxTime ? res : fixEndTimeOfRange(res);
53
+ }
54
+ /**
55
+ * fix time is the most, big value
56
+ */
57
+ function fixEndTimeOfRange(dates) {
58
+ return [startOfDay(dates[0]), endOfDay(dates[1])];
59
+ }
60
+ /**
61
+ * Convert to `Date` format
62
+ *
63
+ * @param value When is a number, it's treated as a timestamp; If it's seconds, you need to provide the `options.timestampSecond` parameter.
64
+ */
65
+ function toDate(value, options) {
66
+ const { formatString, defaultValue, timestampSecond } = {
67
+ formatString: 'yyyy-MM-dd HH:mm:ss',
68
+ defaultValue: new Date(NaN),
69
+ timestampSecond: false,
70
+ ...(typeof options === 'string' ? { formatString: options } : options)
71
+ };
72
+ if (value == null) {
73
+ return defaultValue;
74
+ }
75
+ if (value instanceof Date) {
76
+ return value;
77
+ }
78
+ if (typeof value === 'number' || (typeof value === 'string' && /^[0-9]+$/.test(value))) {
79
+ const valueNumber = +value;
80
+ return new Date(timestampSecond ? valueNumber * 1000 : valueNumber);
81
+ }
82
+ let tryDate = parseISO(value);
83
+ if (isNaN(tryDate)) {
84
+ tryDate = parse(value, formatString, new Date());
85
+ }
86
+ return isNaN(tryDate) ? defaultValue : tryDate;
87
+ }
88
+ /**
89
+ * Format date, supports `Date, number, string` types
90
+ *
91
+ * @param value When is a number, it is treated as a timestamp (Support seconds and milliseconds timestamp).
92
+ * @param formatString Please refer to [date-fnd format](https://date-fns.org/v2.30.0/docs/format) for string format
93
+ * @param dateLocale Recommended to be consistent with NG-ZORRO by using `inject(NZ_DATE_LOCALE)`
94
+ */
95
+ function formatDate(value, formatString, dateLocale) {
96
+ value = toDate(value);
97
+ if (isNaN(value))
98
+ return '';
99
+ const langOpt = { locale: dateLocale };
100
+ return formatString === 'fn' ? formatDistanceToNow(value, langOpt) : format(value, formatString, langOpt);
101
+ }
102
+
103
+ // TODO: timezone process
104
+ class DateTimePickerUtil {
105
+ /**
106
+ * Current local time
107
+ *
108
+ * 当前本地时间
109
+ */
110
+ get now() {
111
+ return new Date();
112
+ }
113
+ /**
114
+ * Current local date (not including time part)
115
+ *
116
+ * 当前本地日期(不包含时间部分)
117
+ */
118
+ get date() {
119
+ return this.removeTime(this.now);
120
+ }
121
+ /**
122
+ * Remove the time part of the date
123
+ *
124
+ * 移除日期的时间部分
125
+ */
126
+ removeTime(d) {
127
+ return new Date(d.toDateString());
128
+ }
129
+ /**
130
+ * Format date-time
131
+ *
132
+ * 格式化日期
133
+ */
134
+ format(d, formatString = 'yyyy-MM-dd HH:mm:ss') {
135
+ return format(d, formatString);
136
+ }
137
+ genTick(count) {
138
+ return new Array(count).fill(0).map((_, idx) => idx);
139
+ }
140
+ /**
141
+ * Calculate the number of days between two dates, `0` means the same day
142
+ *
143
+ * 计算两个日期相差天数,`0` 表示同一天
144
+ */
145
+ getDiffDays(dateLeft, dateRight) {
146
+ return differenceInCalendarDays(dateLeft, typeof dateRight === 'number' ? addDays(this.date, dateRight) : dateRight || this.date);
147
+ }
148
+ /**
149
+ * Disabled Before date (Default: today), Generally serves `nzDisabledDate`
150
+ *
151
+ * 禁用之前日期(默认:今天),一般服务于 `nzDisabledDate`
152
+ */
153
+ disabledBeforeDate(options) {
154
+ return (d) => this.getDiffDays(d, options?.offsetDays) < 0;
155
+ }
156
+ /**
157
+ * Disabled After date (Default: today), Generally serves `nzDisabledDate`
158
+ *
159
+ * 禁用之后日期(默认:今天),一般服务于 `nzDisabledDate`
160
+ */
161
+ disabledAfterDate(options) {
162
+ return (d) => this.getDiffDays(d, options?.offsetDays) > 0;
163
+ }
164
+ baseDisabledTime(type, offsetSeconds) {
165
+ const tick24 = this.genTick(24);
166
+ const tick60 = this.genTick(60);
167
+ return (current) => {
168
+ const cur = current;
169
+ if (cur == null) {
170
+ return {};
171
+ }
172
+ const now = addSeconds(this.now, offsetSeconds || 0);
173
+ const nowHours = now.getHours();
174
+ const nowMinutes = now.getMinutes();
175
+ const curHours = cur.getHours();
176
+ const isToday = this.getDiffDays(this.removeTime(cur)) === 0;
177
+ return {
178
+ nzDisabledHours: () => {
179
+ if (!isToday)
180
+ return [];
181
+ return type === 'before' ? tick24.slice(0, nowHours) : tick24.slice(nowHours + 1);
182
+ },
183
+ nzDisabledMinutes: () => {
184
+ if (isToday && curHours === nowHours) {
185
+ return type === 'before' ? tick60.slice(0, nowMinutes) : tick60.slice(nowMinutes + 1);
186
+ }
187
+ return [];
188
+ },
189
+ nzDisabledSeconds: () => {
190
+ if (isToday && curHours === nowHours && cur.getMinutes() === nowMinutes) {
191
+ const nowSeconds = now.getSeconds();
192
+ return type === 'before' ? tick60.slice(0, nowSeconds) : tick60.slice(nowSeconds + 1);
193
+ }
194
+ return [];
195
+ }
196
+ };
197
+ };
198
+ }
199
+ /**
200
+ * Disabled Before time (Default: now), Generally serves `nzDisabledTime`
201
+ *
202
+ * 禁用之前时间(默认:现在),一般服务于 `nzDisabledTime`
203
+ */
204
+ disabledBeforeTime(options) {
205
+ return this.baseDisabledTime('before', options?.offsetSeconds);
206
+ }
207
+ /**
208
+ * Disabled After time (Default: now), Generally serves `nzDisabledTime`
209
+ *
210
+ * 禁用之后时间(默认:现在),一般服务于 `nzDisabledTime`
211
+ */
212
+ disabledAfterTime(options) {
213
+ return this.baseDisabledTime('after', options?.offsetSeconds);
214
+ }
215
+ }
216
+ const dateTimePickerUtil = new DateTimePickerUtil();
217
+
218
+ /**
219
+ * Generated bundle index. Do not edit.
220
+ */
221
+
222
+ export { DateTimePickerUtil, dateTimePickerUtil, fixEndTimeOfRange, formatDate, getTimeDistance, toDate };
223
+ //# sourceMappingURL=date-time.mjs.map