@yelon/util 12.0.17 → 13.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -21
- package/array/array-type.service.d.ts +68 -68
- package/{date-time/yelon-util-date-time.d.ts → array/array.d.ts} +5 -4
- package/array/array.service.d.ts +78 -75
- package/array/index.d.ts +2 -2
- package/array/package.json +6 -7
- package/browser/browser.d.ts +5 -4
- package/browser/cookie.service.d.ts +67 -64
- package/browser/copy.d.ts +6 -6
- package/browser/index.d.ts +5 -5
- package/browser/is-empty.d.ts +6 -6
- package/browser/package.json +5 -6
- package/browser/scroll.service.d.ts +37 -34
- package/browser/style.d.ts +21 -21
- package/config/abc/date-picker.type.d.ts +52 -52
- package/config/abc/error-collect.type.d.ts +10 -10
- package/config/abc/image.type.d.ts +15 -15
- package/config/abc/index.d.ts +16 -16
- package/config/abc/loading.type.d.ts +31 -31
- package/config/abc/lodop.type.d.ts +33 -33
- package/config/abc/media.type.d.ts +11 -11
- package/config/abc/onboarding.type.d.ts +4 -4
- package/config/abc/page-header.type.d.ts +39 -39
- package/config/abc/pdf.type.d.ts +35 -35
- package/config/abc/qr.type.d.ts +25 -25
- package/config/abc/se.type.d.ts +32 -32
- package/config/abc/sg.type.d.ts +10 -10
- package/config/abc/st.type.d.ts +427 -427
- package/config/abc/sv.type.d.ts +14 -14
- package/config/abc/xlsx.type.d.ts +12 -12
- package/config/abc/zip.type.d.ts +10 -10
- package/config/acl/acl.type.d.ts +32 -32
- package/config/auth/auth.type.d.ts +55 -55
- package/config/bis/bis.type.d.ts +7 -7
- package/config/cache/cache.type.d.ts +40 -40
- package/config/chart/chart.type.d.ts +33 -33
- package/config/config.d.ts +5 -0
- package/config/config.service.d.ts +13 -10
- package/config/config.types.d.ts +49 -49
- package/config/index.d.ts +14 -14
- package/config/mock/mock.type.d.ts +18 -18
- package/config/package.json +6 -7
- package/config/sf/sf.type.d.ts +127 -127
- package/config/stomp/stomp.type.d.ts +2 -2
- package/config/theme/http.type.d.ts +14 -14
- package/config/theme/i18n.type.d.ts +8 -8
- package/config/theme/index.d.ts +3 -3
- package/config/theme/responsive.type.d.ts +12 -12
- package/config/util/array.type.d.ts +22 -22
- package/config/util/currency.type.d.ts +39 -39
- package/date-time/date-time.d.ts +5 -0
- package/date-time/index.d.ts +2 -2
- package/date-time/package.json +6 -7
- package/date-time/picker.d.ts +68 -68
- package/date-time/time.d.ts +26 -26
- package/decorator/convert.d.ts +24 -24
- package/decorator/decorator.d.ts +5 -0
- package/decorator/index.d.ts +2 -2
- package/decorator/package.json +6 -7
- package/decorator/zone-outside.d.ts +35 -35
- package/{esm2015/array/array-type.service.js → esm2020/array/array-type.service.mjs} +1 -1
- package/esm2020/array/array.mjs +5 -0
- package/esm2020/array/array.service.mjs +278 -0
- package/{esm2015/array/index.js → esm2020/array/index.mjs} +2 -2
- package/{esm2015/browser/browser.js → esm2020/browser/browser.mjs} +4 -4
- package/esm2020/browser/cookie.service.mjs +103 -0
- package/esm2020/browser/copy.mjs +9 -0
- package/{esm2015/browser/index.js → esm2020/browser/index.mjs} +5 -5
- package/{esm2015/browser/is-empty.js → esm2020/browser/is-empty.mjs} +18 -18
- package/esm2020/browser/scroll.service.mjs +88 -0
- package/{esm2015/browser/style.js → esm2020/browser/style.mjs} +38 -38
- package/{esm2015/config/abc/date-picker.type.js → esm2020/config/abc/date-picker.type.mjs} +1 -1
- package/{esm2015/config/abc/error-collect.type.js → esm2020/config/abc/error-collect.type.mjs} +1 -1
- package/{esm2015/config/abc/image.type.js → esm2020/config/abc/image.type.mjs} +1 -1
- package/{esm2015/config/abc/index.js → esm2020/config/abc/index.mjs} +16 -16
- package/{esm2015/config/abc/loading.type.js → esm2020/config/abc/loading.type.mjs} +1 -1
- package/{esm2015/config/abc/lodop.type.js → esm2020/config/abc/lodop.type.mjs} +1 -1
- package/{esm2015/config/abc/media.type.js → esm2020/config/abc/media.type.mjs} +1 -1
- package/{esm2015/config/abc/onboarding.type.js → esm2020/config/abc/onboarding.type.mjs} +1 -1
- package/{esm2015/config/abc/page-header.type.js → esm2020/config/abc/page-header.type.mjs} +1 -1
- package/esm2020/config/abc/pdf.type.mjs +2 -0
- package/esm2020/config/abc/qr.type.mjs +2 -0
- package/{esm2015/config/abc/se.type.js → esm2020/config/abc/se.type.mjs} +1 -1
- package/{esm2015/config/abc/sg.type.js → esm2020/config/abc/sg.type.mjs} +1 -1
- package/{esm2015/config/abc/st.type.js → esm2020/config/abc/st.type.mjs} +1 -1
- package/{esm2015/config/abc/sv.type.js → esm2020/config/abc/sv.type.mjs} +2 -2
- package/{esm2015/config/abc/xlsx.type.js → esm2020/config/abc/xlsx.type.mjs} +1 -1
- package/{esm2015/config/abc/zip.type.js → esm2020/config/abc/zip.type.mjs} +1 -1
- package/{esm2015/config/acl/acl.type.js → esm2020/config/acl/acl.type.mjs} +1 -1
- package/{esm2015/config/auth/auth.type.js → esm2020/config/auth/auth.type.mjs} +1 -1
- package/{esm2015/config/bis/bis.type.js → esm2020/config/bis/bis.type.mjs} +1 -1
- package/{esm2015/config/cache/cache.type.js → esm2020/config/cache/cache.type.mjs} +1 -1
- package/{esm2015/config/chart/chart.type.js → esm2020/config/chart/chart.type.mjs} +1 -1
- package/esm2020/config/config.mjs +5 -0
- package/esm2020/config/config.service.mjs +37 -0
- package/{esm2015/config/config.types.js → esm2020/config/config.types.mjs} +8 -8
- package/{esm2015/config/index.js → esm2020/config/index.mjs} +14 -14
- package/{esm2015/config/mock/mock.type.js → esm2020/config/mock/mock.type.mjs} +1 -1
- package/{esm2015/config/sf/sf.type.js → esm2020/config/sf/sf.type.mjs} +1 -1
- package/{esm2015/config/stomp/stomp.type.js → esm2020/config/stomp/stomp.type.mjs} +1 -1
- package/{esm2015/config/theme/http.type.js → esm2020/config/theme/http.type.mjs} +1 -1
- package/{esm2015/config/theme/i18n.type.js → esm2020/config/theme/i18n.type.mjs} +1 -1
- package/{esm2015/config/theme/index.js → esm2020/config/theme/index.mjs} +3 -3
- package/{esm2015/config/theme/responsive.type.js → esm2020/config/theme/responsive.type.mjs} +1 -1
- package/{esm2015/config/util/array.type.js → esm2020/config/util/array.type.mjs} +1 -1
- package/{esm2015/config/util/currency.type.js → esm2020/config/util/currency.type.mjs} +1 -1
- package/esm2020/date-time/date-time.mjs +5 -0
- package/{esm2015/date-time/index.js → esm2020/date-time/index.mjs} +2 -2
- package/esm2020/date-time/picker.mjs +116 -0
- package/{esm2015/date-time/time.js → esm2020/date-time/time.mjs} +88 -84
- package/esm2020/decorator/convert.mjs +58 -0
- package/esm2020/decorator/decorator.mjs +5 -0
- package/{esm2015/decorator/index.js → esm2020/decorator/index.mjs} +2 -2
- package/esm2020/decorator/zone-outside.mjs +57 -0
- package/esm2020/form/form.mjs +5 -0
- package/{esm2015/form/index.js → esm2020/form/index.mjs} +2 -2
- package/{esm2015/form/match-control.js → esm2020/form/match-control.mjs} +29 -29
- package/{esm2015/form/validators.js → esm2020/form/validators.mjs} +80 -80
- package/esm2020/format/currency.service.mjs +238 -0
- package/{esm2015/format/currency.types.js → esm2020/format/currency.types.mjs} +7 -7
- package/esm2020/format/format.mjs +5 -0
- package/{esm2015/format/index.js → esm2020/format/index.mjs} +4 -4
- package/esm2020/format/string.mjs +85 -0
- package/{esm2015/format/validate.js → esm2020/format/validate.mjs} +93 -93
- package/{esm2015/index.js → esm2020/index.mjs} +11 -11
- package/{esm2015/math/in-range.js → esm2020/math/in-range.mjs} +24 -24
- package/{esm2015/math/index.js → esm2020/math/index.mjs} +2 -2
- package/esm2020/math/math.mjs +5 -0
- package/{esm2015/math/round.js → esm2020/math/round.mjs} +52 -52
- package/{esm2015/other/assert.js → esm2020/other/assert.mjs} +66 -66
- package/{esm2015/other/deep.js → esm2020/other/deep.mjs} +75 -75
- package/{esm2015/other/index.js → esm2020/other/index.mjs} +7 -5
- package/esm2020/other/lazy.service.mjs +119 -0
- package/{esm2015/other/logger.js → esm2020/other/logger.mjs} +32 -32
- package/esm2020/other/other.mjs +5 -0
- package/esm2020/other/resize.mjs +4 -0
- package/esm2020/other/url.mjs +13 -0
- package/esm2020/pipes/currency/cny.pipe.mjs +23 -0
- package/{esm2015/pipes/currency/index.js → esm2020/pipes/currency/index.mjs} +5 -4
- package/esm2020/pipes/currency/mega.pipe.mjs +29 -0
- package/esm2020/pipes/currency/module.mjs +19 -0
- package/esm2020/pipes/currency/pipe-currency.mjs +5 -0
- package/esm2020/pipes/currency/price.pipe.mjs +27 -0
- package/esm2020/pipes/filter/filter.pipe.mjs +19 -0
- package/{esm2015/pipes/filter/index.js → esm2020/pipes/filter/index.mjs} +2 -2
- package/esm2020/pipes/filter/module.mjs +17 -0
- package/{esm2015/other/yelon-util-other.js → esm2020/pipes/filter/pipe-filter.mjs} +5 -5
- package/{esm2015/pipes/format/index.js → esm2020/pipes/format/index.mjs} +2 -2
- package/esm2020/pipes/format/mask.pipe.mjs +34 -0
- package/esm2020/pipes/format/module.mjs +17 -0
- package/{esm2015/array/yelon-util-array.js → esm2020/pipes/format/pipe-format.mjs} +5 -5
- package/{esm2015/pipes/index.js → esm2020/pipes/index.mjs} +3 -3
- package/esm2020/pipes/pipes.mjs +5 -0
- package/{esm2015/token/index.js → esm2020/token/index.mjs} +2 -2
- package/{esm2015/token/page-visibility.js → esm2020/token/page-visibility.mjs} +15 -15
- package/esm2020/token/token.mjs +5 -0
- package/{esm2015/token/window.js → esm2020/token/window.mjs} +16 -16
- package/{esm2015/yelon-util.js → esm2020/yelon-util.mjs} +4 -4
- package/fesm2015/{yelon-util-array.js → array.mjs} +247 -249
- package/fesm2015/array.mjs.map +1 -0
- package/fesm2015/{browser.js → browser.mjs} +249 -263
- package/fesm2015/browser.mjs.map +1 -0
- package/fesm2015/{yelon-util-config.js → config.mjs} +44 -38
- package/fesm2015/config.mjs.map +1 -0
- package/fesm2015/{yelon-util-date-time.js → date-time.mjs} +197 -197
- package/fesm2015/date-time.mjs.map +1 -0
- package/fesm2015/{yelon-util-decorator.js → decorator.mjs} +112 -108
- package/fesm2015/decorator.mjs.map +1 -0
- package/fesm2015/{yelon-util-form.js → form.mjs} +109 -109
- package/fesm2015/form.mjs.map +1 -0
- package/fesm2015/{yelon-util-format.js → format.mjs} +398 -394
- package/fesm2015/format.mjs.map +1 -0
- package/fesm2015/{yelon-util-math.js → math.mjs} +76 -76
- package/fesm2015/math.mjs.map +1 -0
- package/fesm2015/{yelon-util-other.js → other.mjs} +304 -284
- package/fesm2015/other.mjs.map +1 -0
- package/fesm2015/pipe-currency.mjs +96 -0
- package/fesm2015/pipe-currency.mjs.map +1 -0
- package/fesm2015/pipe-filter.mjs +40 -0
- package/fesm2015/pipe-filter.mjs.map +1 -0
- package/fesm2015/pipe-format.mjs +55 -0
- package/fesm2015/pipe-format.mjs.map +1 -0
- package/fesm2015/{yelon-util-pipes.js → pipes.mjs} +3 -3
- package/fesm2015/pipes.mjs.map +1 -0
- package/fesm2015/{yelon-util-token.js → token.mjs} +26 -26
- package/fesm2015/token.mjs.map +1 -0
- package/fesm2015/{yelon-util.js → yelon-util.mjs} +3 -3
- package/fesm2015/yelon-util.mjs.map +1 -0
- package/fesm2020/array.mjs +285 -0
- package/fesm2020/array.mjs.map +1 -0
- package/fesm2020/browser.mjs +260 -0
- package/fesm2020/browser.mjs.map +1 -0
- package/fesm2020/config.mjs +54 -0
- package/fesm2020/config.mjs.map +1 -0
- package/fesm2020/date-time.mjs +210 -0
- package/fesm2020/date-time.mjs.map +1 -0
- package/fesm2020/decorator.mjs +121 -0
- package/fesm2020/decorator.mjs.map +1 -0
- package/fesm2020/form.mjs +118 -0
- package/fesm2020/form.mjs.map +1 -0
- package/fesm2020/format.mjs +431 -0
- package/fesm2020/format.mjs.map +1 -0
- package/fesm2020/math.mjs +85 -0
- package/fesm2020/math.mjs.map +1 -0
- package/fesm2020/other.mjs +318 -0
- package/{fesm2015/yelon-util-other.js.map → fesm2020/other.mjs.map} +1 -1
- package/fesm2020/pipe-currency.mjs +94 -0
- package/fesm2020/pipe-currency.mjs.map +1 -0
- package/fesm2020/pipe-filter.mjs +40 -0
- package/fesm2020/pipe-filter.mjs.map +1 -0
- package/fesm2020/pipe-format.mjs +55 -0
- package/fesm2020/pipe-format.mjs.map +1 -0
- package/fesm2020/pipes.mjs +8 -0
- package/fesm2020/pipes.mjs.map +1 -0
- package/fesm2020/token.mjs +38 -0
- package/fesm2020/token.mjs.map +1 -0
- package/fesm2020/yelon-util.mjs +16 -0
- package/fesm2020/yelon-util.mjs.map +1 -0
- package/{array/yelon-util-array.d.ts → form/form.d.ts} +5 -4
- package/form/index.d.ts +2 -2
- package/form/match-control.d.ts +15 -15
- package/form/package.json +6 -7
- package/form/validators.d.ts +62 -62
- package/format/currency.service.d.ts +37 -34
- package/format/currency.types.d.ts +77 -77
- package/format/format.d.ts +5 -0
- package/format/index.d.ts +4 -4
- package/format/package.json +6 -7
- package/format/string.d.ts +44 -44
- package/format/validate.d.ts +72 -72
- package/index.d.ts +11 -11
- package/math/in-range.d.ts +14 -14
- package/math/index.d.ts +2 -2
- package/{config/yelon-util-config.d.ts → math/math.d.ts} +5 -4
- package/math/package.json +6 -7
- package/math/round.d.ts +33 -33
- package/other/assert.d.ts +36 -36
- package/other/deep.d.ts +33 -33
- package/other/index.d.ts +6 -4
- package/other/lazy.service.d.ts +25 -22
- package/other/logger.d.ts +5 -5
- package/{decorator/yelon-util-decorator.d.ts → other/other.d.ts} +5 -4
- package/other/package.json +6 -7
- package/other/resize.d.ts +1 -0
- package/other/url.d.ts +2 -0
- package/package.json +132 -8
- package/pipes/currency/cny.pipe.d.ts +15 -12
- package/pipes/currency/index.d.ts +4 -3
- package/pipes/currency/mega.pipe.d.ts +16 -13
- package/pipes/currency/module.d.ts +9 -2
- package/pipes/currency/package.json +6 -7
- package/pipes/currency/pipe-currency.d.ts +5 -0
- package/pipes/currency/price.pipe.d.ts +19 -16
- package/pipes/filter/filter.pipe.d.ts +13 -10
- package/pipes/filter/index.d.ts +2 -2
- package/pipes/filter/module.d.ts +7 -2
- package/pipes/filter/package.json +6 -7
- package/pipes/filter/pipe-filter.d.ts +5 -0
- package/pipes/format/index.d.ts +2 -2
- package/pipes/format/mask.pipe.d.ts +27 -24
- package/pipes/format/module.d.ts +7 -2
- package/pipes/format/package.json +6 -7
- package/pipes/format/pipe-format.d.ts +5 -0
- package/pipes/index.d.ts +3 -3
- package/pipes/package.json +6 -7
- package/pipes/pipes.d.ts +5 -0
- package/token/index.d.ts +2 -2
- package/token/package.json +6 -7
- package/token/page-visibility.d.ts +8 -8
- package/token/token.d.ts +5 -0
- package/token/window.d.ts +7 -7
- package/yelon-util.d.ts +5 -4
- package/array/yelon-util-array.metadata.json +0 -1
- package/browser/browser.metadata.json +0 -1
- package/bundles/browser.umd.js +0 -325
- package/bundles/browser.umd.js.map +0 -1
- package/bundles/yelon-util-array.umd.js +0 -641
- package/bundles/yelon-util-array.umd.js.map +0 -1
- package/bundles/yelon-util-config.umd.js +0 -411
- package/bundles/yelon-util-config.umd.js.map +0 -1
- package/bundles/yelon-util-date-time.umd.js +0 -238
- package/bundles/yelon-util-date-time.umd.js.map +0 -1
- package/bundles/yelon-util-decorator.umd.js +0 -462
- package/bundles/yelon-util-decorator.umd.js.map +0 -1
- package/bundles/yelon-util-form.umd.js +0 -135
- package/bundles/yelon-util-form.umd.js.map +0 -1
- package/bundles/yelon-util-format.umd.js +0 -785
- package/bundles/yelon-util-format.umd.js.map +0 -1
- package/bundles/yelon-util-math.umd.js +0 -104
- package/bundles/yelon-util-math.umd.js.map +0 -1
- package/bundles/yelon-util-other.umd.js +0 -714
- package/bundles/yelon-util-other.umd.js.map +0 -1
- package/bundles/yelon-util-pipes-currency.umd.js +0 -108
- package/bundles/yelon-util-pipes-currency.umd.js.map +0 -1
- package/bundles/yelon-util-pipes-filter.umd.js +0 -374
- package/bundles/yelon-util-pipes-filter.umd.js.map +0 -1
- package/bundles/yelon-util-pipes-format.umd.js +0 -66
- package/bundles/yelon-util-pipes-format.umd.js.map +0 -1
- package/bundles/yelon-util-pipes.umd.js +0 -38
- package/bundles/yelon-util-pipes.umd.js.map +0 -1
- package/bundles/yelon-util-token.umd.js +0 -49
- package/bundles/yelon-util-token.umd.js.map +0 -1
- package/bundles/yelon-util.umd.js +0 -86
- package/bundles/yelon-util.umd.js.map +0 -1
- package/config/yelon-util-config.metadata.json +0 -1
- package/date-time/yelon-util-date-time.metadata.json +0 -1
- package/decorator/yelon-util-decorator.metadata.json +0 -1
- package/esm2015/array/array.service.js +0 -250
- package/esm2015/browser/cookie.service.js +0 -104
- package/esm2015/browser/copy.js +0 -27
- package/esm2015/browser/scroll.service.js +0 -89
- package/esm2015/config/abc/pdf.type.js +0 -2
- package/esm2015/config/abc/qr.type.js +0 -2
- package/esm2015/config/config.service.js +0 -34
- package/esm2015/config/yelon-util-config.js +0 -5
- package/esm2015/date-time/picker.js +0 -116
- package/esm2015/date-time/yelon-util-date-time.js +0 -5
- package/esm2015/decorator/convert.js +0 -56
- package/esm2015/decorator/yelon-util-decorator.js +0 -5
- package/esm2015/decorator/zone-outside.js +0 -55
- package/esm2015/form/yelon-util-form.js +0 -5
- package/esm2015/format/currency.service.js +0 -225
- package/esm2015/format/string.js +0 -76
- package/esm2015/format/yelon-util-format.js +0 -5
- package/esm2015/math/yelon-util-math.js +0 -5
- package/esm2015/other/lazy.service.js +0 -118
- package/esm2015/pipes/currency/cny.pipe.js +0 -22
- package/esm2015/pipes/currency/mega.pipe.js +0 -26
- package/esm2015/pipes/currency/module.js +0 -14
- package/esm2015/pipes/currency/price.pipe.js +0 -26
- package/esm2015/pipes/currency/yelon-util-pipes-currency.js +0 -6
- package/esm2015/pipes/filter/filter.pipe.js +0 -15
- package/esm2015/pipes/filter/module.js +0 -12
- package/esm2015/pipes/filter/yelon-util-pipes-filter.js +0 -5
- package/esm2015/pipes/format/mask.pipe.js +0 -30
- package/esm2015/pipes/format/module.js +0 -12
- package/esm2015/pipes/format/yelon-util-pipes-format.js +0 -5
- package/esm2015/pipes/yelon-util-pipes.js +0 -5
- package/esm2015/token/yelon-util-token.js +0 -5
- package/fesm2015/browser.js.map +0 -1
- package/fesm2015/yelon-util-array.js.map +0 -1
- package/fesm2015/yelon-util-config.js.map +0 -1
- package/fesm2015/yelon-util-date-time.js.map +0 -1
- package/fesm2015/yelon-util-decorator.js.map +0 -1
- package/fesm2015/yelon-util-form.js.map +0 -1
- package/fesm2015/yelon-util-format.js.map +0 -1
- package/fesm2015/yelon-util-math.js.map +0 -1
- package/fesm2015/yelon-util-pipes-currency.js +0 -87
- package/fesm2015/yelon-util-pipes-currency.js.map +0 -1
- package/fesm2015/yelon-util-pipes-filter.js +0 -32
- package/fesm2015/yelon-util-pipes-filter.js.map +0 -1
- package/fesm2015/yelon-util-pipes-format.js +0 -47
- package/fesm2015/yelon-util-pipes-format.js.map +0 -1
- package/fesm2015/yelon-util-pipes.js.map +0 -1
- package/fesm2015/yelon-util-token.js.map +0 -1
- package/fesm2015/yelon-util.js.map +0 -1
- package/form/yelon-util-form.d.ts +0 -4
- package/form/yelon-util-form.metadata.json +0 -1
- package/format/yelon-util-format.d.ts +0 -4
- package/format/yelon-util-format.metadata.json +0 -1
- package/math/yelon-util-math.d.ts +0 -4
- package/math/yelon-util-math.metadata.json +0 -1
- package/other/yelon-util-other.d.ts +0 -4
- package/other/yelon-util-other.metadata.json +0 -1
- package/pipes/currency/yelon-util-pipes-currency.d.ts +0 -5
- package/pipes/currency/yelon-util-pipes-currency.metadata.json +0 -1
- package/pipes/filter/yelon-util-pipes-filter.d.ts +0 -4
- package/pipes/filter/yelon-util-pipes-filter.metadata.json +0 -1
- package/pipes/format/yelon-util-pipes-format.d.ts +0 -4
- package/pipes/format/yelon-util-pipes-format.metadata.json +0 -1
- package/pipes/yelon-util-pipes.d.ts +0 -4
- package/pipes/yelon-util-pipes.metadata.json +0 -1
- package/token/yelon-util-token.d.ts +0 -4
- package/token/yelon-util-token.metadata.json +0 -1
- package/yelon-util.metadata.json +0 -1
@@ -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.1.1", 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.1.1", ngImport: i0, type: CurrencyMegaPipe, name: "mega" });
|
23
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", 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.1.1", ngImport: i0, type: CurrencyPricePipe, deps: [{ token: i1.CurrencyService }], target: i0.ɵɵFactoryTarget.Pipe });
|
51
|
+
CurrencyPricePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: CurrencyPricePipe, name: "price" });
|
52
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", 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.1.1", ngImport: i0, type: CurrencyCNYPipe, deps: [{ token: i1.CurrencyService }], target: i0.ɵɵFactoryTarget.Pipe });
|
71
|
+
CurrencyCNYPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: CurrencyCNYPipe, name: "cny" });
|
72
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", 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.1.1", ngImport: i0, type: CurrencyPipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
81
|
+
CurrencyPipeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: CurrencyPipeModule, declarations: [CurrencyMegaPipe, CurrencyPricePipe, CurrencyCNYPipe], exports: [CurrencyMegaPipe, CurrencyPricePipe, CurrencyCNYPipe] });
|
82
|
+
CurrencyPipeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: CurrencyPipeModule });
|
83
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", 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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gHAAlB,kBAAkB,iBANhB,gBAAgB,EAAE,iBAAiB,EAAE,eAAe,aAApD,gBAAgB,EAAE,iBAAiB,EAAE,eAAe;gHAMtD,kBAAkB;2FAAlB,kBAAkB;kBAJ9B,QAAQ;mBAAC;oBACR,YAAY,EAAE,KAAK;oBACnB,OAAO,EAAE,KAAK;iBACf;;;ACXD;;;;;;"}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import * as i0 from '@angular/core';
|
2
|
+
import { Pipe, NgModule } from '@angular/core';
|
3
|
+
|
4
|
+
class FilterPipe {
|
5
|
+
/**
|
6
|
+
* Filter array
|
7
|
+
*
|
8
|
+
* 过滤数组
|
9
|
+
*/
|
10
|
+
transform(array, matcher, ...args) {
|
11
|
+
return array.filter(i => matcher(i, ...args));
|
12
|
+
}
|
13
|
+
}
|
14
|
+
FilterPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
15
|
+
FilterPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FilterPipe, name: "filter" });
|
16
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FilterPipe, decorators: [{
|
17
|
+
type: Pipe,
|
18
|
+
args: [{ name: 'filter' }]
|
19
|
+
}] });
|
20
|
+
|
21
|
+
const PIPES = [FilterPipe];
|
22
|
+
class FilterPipeModule {
|
23
|
+
}
|
24
|
+
FilterPipeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FilterPipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
25
|
+
FilterPipeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FilterPipeModule, declarations: [FilterPipe], exports: [FilterPipe] });
|
26
|
+
FilterPipeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FilterPipeModule });
|
27
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FilterPipeModule, decorators: [{
|
28
|
+
type: NgModule,
|
29
|
+
args: [{
|
30
|
+
declarations: PIPES,
|
31
|
+
exports: PIPES
|
32
|
+
}]
|
33
|
+
}] });
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Generated bundle index. Do not edit.
|
37
|
+
*/
|
38
|
+
|
39
|
+
export { FilterPipe, FilterPipeModule };
|
40
|
+
//# sourceMappingURL=pipe-filter.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pipe-filter.mjs","sources":["../../../../packages/util/pipes/filter/filter.pipe.ts","../../../../packages/util/pipes/filter/module.ts","../../../../packages/util/pipes/filter/pipe-filter.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\n\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\n@Pipe({ name: 'filter' })\nexport class FilterPipe implements PipeTransform {\n /**\n * Filter array\n *\n * 过滤数组\n */\n transform<T>(array: readonly T[], matcher: (item: T, ...args: NzSafeAny[]) => boolean, ...args: NzSafeAny[]): T[] {\n return array.filter(i => matcher(i, ...args));\n }\n}\n","import { NgModule } from '@angular/core';\n\nimport { FilterPipe } from './filter.pipe';\n\nconst PIPES = [FilterPipe];\n\n@NgModule({\n declarations: PIPES,\n exports: PIPES\n})\nexport class FilterPipeModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAKa,UAAU;;;;;;IAMrB,SAAS,CAAI,KAAmB,EAAE,OAAmD,EAAE,GAAG,IAAiB;QACzG,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;KAC/C;;uGARU,UAAU;qGAAV,UAAU;2FAAV,UAAU;kBADtB,IAAI;mBAAC,EAAE,IAAI,EAAE,QAAQ,EAAE;;;ACAxB,MAAM,KAAK,GAAG,CAAC,UAAU,CAAC,CAAC;MAMd,gBAAgB;;6GAAhB,gBAAgB;8GAAhB,gBAAgB,iBANd,UAAU,aAAV,UAAU;8GAMZ,gBAAgB;2FAAhB,gBAAgB;kBAJ5B,QAAQ;mBAAC;oBACR,YAAY,EAAE,KAAK;oBACnB,OAAO,EAAE,KAAK;iBACf;;;ACTD;;;;;;"}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import * as i0 from '@angular/core';
|
2
|
+
import { Pipe, NgModule } from '@angular/core';
|
3
|
+
import { formatMask } from '@yelon/util/format';
|
4
|
+
|
5
|
+
class FormatMaskPipe {
|
6
|
+
/**
|
7
|
+
* Format mask
|
8
|
+
*
|
9
|
+
* 格式化掩码
|
10
|
+
*
|
11
|
+
* | 字符 | 描述 |
|
12
|
+
* | --- | --- |
|
13
|
+
* | `0` | 任意数字,若该位置字符不符合,则默认为 `0` 填充 |
|
14
|
+
* | `9` | 任意数字 |
|
15
|
+
* | `#` | 任意字符 |
|
16
|
+
* | `U` | 转换大写 |
|
17
|
+
* | `L` | 转换小写 |
|
18
|
+
* | `*` | 转换为 `*` 字符 |
|
19
|
+
*
|
20
|
+
* ```ts
|
21
|
+
* formatMask('123', '(###)') => (123)
|
22
|
+
* formatMask('15900000000', '999****9999') => 159****0000
|
23
|
+
* ```
|
24
|
+
*/
|
25
|
+
transform(value, mask) {
|
26
|
+
return formatMask(value, mask);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
FormatMaskPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormatMaskPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
30
|
+
FormatMaskPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormatMaskPipe, name: "mask" });
|
31
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormatMaskPipe, decorators: [{
|
32
|
+
type: Pipe,
|
33
|
+
args: [{ name: 'mask' }]
|
34
|
+
}] });
|
35
|
+
|
36
|
+
const PIPES = [FormatMaskPipe];
|
37
|
+
class FormatPipeModule {
|
38
|
+
}
|
39
|
+
FormatPipeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormatPipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
40
|
+
FormatPipeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormatPipeModule, declarations: [FormatMaskPipe], exports: [FormatMaskPipe] });
|
41
|
+
FormatPipeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormatPipeModule });
|
42
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FormatPipeModule, decorators: [{
|
43
|
+
type: NgModule,
|
44
|
+
args: [{
|
45
|
+
declarations: PIPES,
|
46
|
+
exports: PIPES
|
47
|
+
}]
|
48
|
+
}] });
|
49
|
+
|
50
|
+
/**
|
51
|
+
* Generated bundle index. Do not edit.
|
52
|
+
*/
|
53
|
+
|
54
|
+
export { FormatMaskPipe, FormatPipeModule };
|
55
|
+
//# sourceMappingURL=pipe-format.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pipe-format.mjs","sources":["../../../../packages/util/pipes/format/mask.pipe.ts","../../../../packages/util/pipes/format/module.ts","../../../../packages/util/pipes/format/pipe-format.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\n\nimport { formatMask, FormatMaskOption } from '@yelon/util/format';\n\n@Pipe({ name: 'mask' })\nexport class FormatMaskPipe implements PipeTransform {\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 */\n transform(value: string, mask: string | FormatMaskOption): string {\n return formatMask(value, mask);\n }\n}\n","import { NgModule } from '@angular/core';\n\nimport { FormatMaskPipe } from './mask.pipe';\n\nconst PIPES = [FormatMaskPipe];\n\n@NgModule({\n declarations: PIPES,\n exports: PIPES\n})\nexport class FormatPipeModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAKa,cAAc;;;;;;;;;;;;;;;;;;;;IAoBzB,SAAS,CAAC,KAAa,EAAE,IAA+B;QACtD,OAAO,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;KAChC;;2GAtBU,cAAc;yGAAd,cAAc;2FAAd,cAAc;kBAD1B,IAAI;mBAAC,EAAE,IAAI,EAAE,MAAM,EAAE;;;ACAtB,MAAM,KAAK,GAAG,CAAC,cAAc,CAAC,CAAC;MAMlB,gBAAgB;;6GAAhB,gBAAgB;8GAAhB,gBAAgB,iBANd,cAAc,aAAd,cAAc;8GAMhB,gBAAgB;2FAAhB,gBAAgB;kBAJ5B,QAAQ;mBAAC;oBACR,YAAY,EAAE,KAAK;oBACnB,OAAO,EAAE,KAAK;iBACf;;;ACTD;;;;;;"}
|
@@ -2,7 +2,7 @@ export * from '@yelon/util/pipes/currency';
|
|
2
2
|
export * from '@yelon/util/pipes/format';
|
3
3
|
export * from '@yelon/util/pipes/filter';
|
4
4
|
|
5
|
-
/**
|
6
|
-
* Generated bundle index. Do not edit.
|
5
|
+
/**
|
6
|
+
* Generated bundle index. Do not edit.
|
7
7
|
*/
|
8
|
-
//# sourceMappingURL=
|
8
|
+
//# sourceMappingURL=pipes.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pipes.mjs","sources":["../../../../packages/util/pipes/pipes.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAAA;;"}
|
@@ -3,36 +3,36 @@ import { InjectionToken, inject } from '@angular/core';
|
|
3
3
|
import { fromEvent } from 'rxjs';
|
4
4
|
import { startWith, map, distinctUntilChanged, share } from 'rxjs/operators';
|
5
5
|
|
6
|
-
/**
|
7
|
-
* Access to global `window` object
|
8
|
-
*
|
9
|
-
* 访问全局 `window` 对象
|
10
|
-
*/
|
11
|
-
const WINDOW = new InjectionToken('WINDOW', {
|
12
|
-
factory: () => {
|
13
|
-
const { defaultView } = inject(DOCUMENT);
|
14
|
-
if (!defaultView) {
|
15
|
-
throw new Error('Window is not available');
|
16
|
-
}
|
17
|
-
return defaultView;
|
18
|
-
}
|
6
|
+
/**
|
7
|
+
* Access to global `window` object
|
8
|
+
*
|
9
|
+
* 访问全局 `window` 对象
|
10
|
+
*/
|
11
|
+
const WINDOW = new InjectionToken('WINDOW', {
|
12
|
+
factory: () => {
|
13
|
+
const { defaultView } = inject(DOCUMENT);
|
14
|
+
if (!defaultView) {
|
15
|
+
throw new Error('Window is not available');
|
16
|
+
}
|
17
|
+
return defaultView;
|
18
|
+
}
|
19
19
|
});
|
20
20
|
|
21
|
-
/**
|
22
|
-
* Use the `visibilitychange` event to monitor whether the browser tab is visible, which is generally used when the user leaves the browser tab to temp interrupt the backend to continue sending requests
|
23
|
-
*
|
24
|
-
* 通过 `visibilitychange` 事件来监听浏览器选项卡是否可见,一般用于当用户离开应用时暂时中断后端持续发送请求时
|
25
|
-
*/
|
26
|
-
const PAGE_VISIBILITY = new InjectionToken('PAGE_VISIBILITY`', {
|
27
|
-
factory: () => {
|
28
|
-
const doc = inject(DOCUMENT);
|
29
|
-
return fromEvent(doc, 'visibilitychange').pipe(startWith(0), map(() => !doc.hidden), distinctUntilChanged(), share());
|
30
|
-
}
|
21
|
+
/**
|
22
|
+
* Use the `visibilitychange` event to monitor whether the browser tab is visible, which is generally used when the user leaves the browser tab to temp interrupt the backend to continue sending requests
|
23
|
+
*
|
24
|
+
* 通过 `visibilitychange` 事件来监听浏览器选项卡是否可见,一般用于当用户离开应用时暂时中断后端持续发送请求时
|
25
|
+
*/
|
26
|
+
const PAGE_VISIBILITY = new InjectionToken('PAGE_VISIBILITY`', {
|
27
|
+
factory: () => {
|
28
|
+
const doc = inject(DOCUMENT);
|
29
|
+
return fromEvent(doc, 'visibilitychange').pipe(startWith(0), map(() => !doc.hidden), distinctUntilChanged(), share());
|
30
|
+
}
|
31
31
|
});
|
32
32
|
|
33
|
-
/**
|
34
|
-
* Generated bundle index. Do not edit.
|
33
|
+
/**
|
34
|
+
* Generated bundle index. Do not edit.
|
35
35
|
*/
|
36
36
|
|
37
37
|
export { PAGE_VISIBILITY, WINDOW };
|
38
|
-
//# sourceMappingURL=
|
38
|
+
//# sourceMappingURL=token.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"token.mjs","sources":["../../../../packages/util/token/window.ts","../../../../packages/util/token/page-visibility.ts","../../../../packages/util/token/token.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport { inject, InjectionToken } from '@angular/core';\n\n/**\n * Access to global `window` object\n *\n * 访问全局 `window` 对象\n */\nexport const WINDOW = new InjectionToken<Window>('WINDOW', {\n factory: () => {\n const { defaultView } = inject(DOCUMENT);\n if (!defaultView) {\n throw new Error('Window is not available');\n }\n return defaultView;\n }\n});\n","import { DOCUMENT } from '@angular/common';\nimport { inject, InjectionToken } from '@angular/core';\nimport { fromEvent, Observable } from 'rxjs';\nimport { distinctUntilChanged, map, share, startWith } from 'rxjs/operators';\n\n/**\n * Use the `visibilitychange` event to monitor whether the browser tab is visible, which is generally used when the user leaves the browser tab to temp interrupt the backend to continue sending requests\n *\n * 通过 `visibilitychange` 事件来监听浏览器选项卡是否可见,一般用于当用户离开应用时暂时中断后端持续发送请求时\n */\nexport const PAGE_VISIBILITY = new InjectionToken<Observable<boolean>>('PAGE_VISIBILITY`', {\n factory: () => {\n const doc = inject(DOCUMENT);\n return fromEvent(doc, 'visibilitychange').pipe(\n startWith(0),\n map(() => !doc.hidden),\n distinctUntilChanged(),\n share()\n );\n }\n});\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAGA;;;;;MAKa,MAAM,GAAG,IAAI,cAAc,CAAS,QAAQ,EAAE;IACzD,OAAO,EAAE;QACP,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QACzC,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;SAC5C;QACD,OAAO,WAAW,CAAC;KACpB;CACF;;ACXD;;;;;MAKa,eAAe,GAAG,IAAI,cAAc,CAAsB,kBAAkB,EAAE;IACzF,OAAO,EAAE;QACP,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC7B,OAAO,SAAS,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC,IAAI,CAC5C,SAAS,CAAC,CAAC,CAAC,EACZ,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EACtB,oBAAoB,EAAE,EACtB,KAAK,EAAE,CACR,CAAC;KACH;CACF;;ACpBD;;;;;;"}
|
@@ -10,7 +10,7 @@ export * from '@yelon/util/other';
|
|
10
10
|
export * from '@yelon/util/pipes';
|
11
11
|
export * from '@yelon/util/token';
|
12
12
|
|
13
|
-
/**
|
14
|
-
* Generated bundle index. Do not edit.
|
13
|
+
/**
|
14
|
+
* Generated bundle index. Do not edit.
|
15
15
|
*/
|
16
|
-
//# sourceMappingURL=yelon-util.
|
16
|
+
//# sourceMappingURL=yelon-util.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"yelon-util.mjs","sources":["../../../../packages/util/yelon-util.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;"}
|
@@ -0,0 +1,285 @@
|
|
1
|
+
import * as i0 from '@angular/core';
|
2
|
+
import { Injectable } from '@angular/core';
|
3
|
+
import { NzTreeNode } from 'ng-zorro-antd/core/tree';
|
4
|
+
import * as i1 from '@yelon/util/config';
|
5
|
+
|
6
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
7
|
+
class ArrayService {
|
8
|
+
constructor(cog) {
|
9
|
+
this.c = cog.merge('utilArray', {
|
10
|
+
deepMapName: 'deep',
|
11
|
+
parentMapName: 'parent',
|
12
|
+
idMapName: 'id',
|
13
|
+
parentIdMapName: 'parent_id',
|
14
|
+
childrenMapName: 'children',
|
15
|
+
titleMapName: 'title',
|
16
|
+
checkedMapname: 'checked',
|
17
|
+
selectedMapname: 'selected',
|
18
|
+
expandedMapname: 'expanded',
|
19
|
+
disabledMapname: 'disabled'
|
20
|
+
});
|
21
|
+
}
|
22
|
+
/**
|
23
|
+
* Convert tree structure to array structure
|
24
|
+
*
|
25
|
+
* 将树结构转换成数组结构
|
26
|
+
*/
|
27
|
+
treeToArr(tree, options) {
|
28
|
+
const opt = {
|
29
|
+
deepMapName: this.c.deepMapName,
|
30
|
+
parentMapName: this.c.parentMapName,
|
31
|
+
childrenMapName: this.c.childrenMapName,
|
32
|
+
clearChildren: true,
|
33
|
+
cb: null,
|
34
|
+
...options
|
35
|
+
};
|
36
|
+
const result = [];
|
37
|
+
const inFn = (list, parent, deep = 0) => {
|
38
|
+
for (const i of list) {
|
39
|
+
i[opt.deepMapName] = deep;
|
40
|
+
i[opt.parentMapName] = parent;
|
41
|
+
if (opt.cb) {
|
42
|
+
opt.cb(i, parent, deep);
|
43
|
+
}
|
44
|
+
result.push(i);
|
45
|
+
const children = i[opt.childrenMapName];
|
46
|
+
if (children != null && Array.isArray(children) && children.length > 0) {
|
47
|
+
inFn(children, i, deep + 1);
|
48
|
+
}
|
49
|
+
if (opt.clearChildren) {
|
50
|
+
delete i[opt.childrenMapName];
|
51
|
+
}
|
52
|
+
}
|
53
|
+
};
|
54
|
+
inFn(tree, null);
|
55
|
+
return result;
|
56
|
+
}
|
57
|
+
/**
|
58
|
+
* Convert array structure to tree structure
|
59
|
+
*
|
60
|
+
* 数组转换成树数据
|
61
|
+
*/
|
62
|
+
arrToTree(arr, options) {
|
63
|
+
if (!Array.isArray(arr) || arr.length === 0) {
|
64
|
+
return [];
|
65
|
+
}
|
66
|
+
const opt = {
|
67
|
+
idMapName: this.c.idMapName,
|
68
|
+
parentIdMapName: this.c.parentIdMapName,
|
69
|
+
childrenMapName: this.c.childrenMapName,
|
70
|
+
cb: null,
|
71
|
+
...options
|
72
|
+
};
|
73
|
+
const tree = [];
|
74
|
+
const childrenOf = {};
|
75
|
+
let rootPid = opt.rootParentIdValue;
|
76
|
+
const arrType = arr;
|
77
|
+
if (!rootPid) {
|
78
|
+
const pids = arrType.map(i => i[opt.parentIdMapName]);
|
79
|
+
const emptyPid = pids.findIndex(w => w == null);
|
80
|
+
rootPid = emptyPid !== -1 ? pids[emptyPid] : pids.sort()[0];
|
81
|
+
}
|
82
|
+
for (const item of arrType) {
|
83
|
+
const id = item[opt.idMapName];
|
84
|
+
const pid = item[opt.parentIdMapName];
|
85
|
+
childrenOf[id] = childrenOf[id] || [];
|
86
|
+
item[opt.childrenMapName] = childrenOf[id];
|
87
|
+
if (opt.cb) {
|
88
|
+
opt.cb(item);
|
89
|
+
}
|
90
|
+
if (pid !== rootPid) {
|
91
|
+
childrenOf[pid] = childrenOf[pid] || [];
|
92
|
+
childrenOf[pid].push(item);
|
93
|
+
}
|
94
|
+
else {
|
95
|
+
tree.push(item);
|
96
|
+
}
|
97
|
+
}
|
98
|
+
return tree;
|
99
|
+
}
|
100
|
+
/**
|
101
|
+
* 数组转换成 `nz-tree` 数据源,通过 `options` 转化项名,也可以使用 `options.cb` 更高级决定数据项
|
102
|
+
*/
|
103
|
+
arrToTreeNode(arr, options) {
|
104
|
+
const opt = {
|
105
|
+
idMapName: this.c.idMapName,
|
106
|
+
parentIdMapName: this.c.parentIdMapName,
|
107
|
+
titleMapName: this.c.titleMapName,
|
108
|
+
isLeafMapName: 'isLeaf',
|
109
|
+
checkedMapname: this.c.checkedMapname,
|
110
|
+
selectedMapname: this.c.selectedMapname,
|
111
|
+
expandedMapname: this.c.expandedMapname,
|
112
|
+
disabledMapname: this.c.disabledMapname,
|
113
|
+
cb: null,
|
114
|
+
...options
|
115
|
+
};
|
116
|
+
const tree = this.arrToTree(arr, {
|
117
|
+
idMapName: opt.idMapName,
|
118
|
+
parentIdMapName: opt.parentIdMapName,
|
119
|
+
childrenMapName: 'children'
|
120
|
+
});
|
121
|
+
this.visitTree(tree, (item, parent, deep) => {
|
122
|
+
item.key = item[opt.idMapName];
|
123
|
+
item.title = item[opt.titleMapName];
|
124
|
+
item.checked = item[opt.checkedMapname];
|
125
|
+
item.selected = item[opt.selectedMapname];
|
126
|
+
item.expanded = item[opt.expandedMapname];
|
127
|
+
item.disabled = item[opt.disabledMapname];
|
128
|
+
if (item[opt.isLeafMapName] == null) {
|
129
|
+
item.isLeaf = item.children.length === 0;
|
130
|
+
}
|
131
|
+
else {
|
132
|
+
item.isLeaf = item[opt.isLeafMapName];
|
133
|
+
}
|
134
|
+
if (opt.cb) {
|
135
|
+
opt.cb(item, parent, deep);
|
136
|
+
}
|
137
|
+
});
|
138
|
+
return tree.map(node => new NzTreeNode(node));
|
139
|
+
}
|
140
|
+
/**
|
141
|
+
* 递归访问整个树
|
142
|
+
*/
|
143
|
+
visitTree(tree, cb, options) {
|
144
|
+
options = {
|
145
|
+
childrenMapName: this.c.childrenMapName,
|
146
|
+
...options
|
147
|
+
};
|
148
|
+
const inFn = (data, parent, deep) => {
|
149
|
+
for (const item of data) {
|
150
|
+
cb(item, parent, deep);
|
151
|
+
const childrenVal = item[options.childrenMapName];
|
152
|
+
if (Array.isArray(childrenVal) && childrenVal.length > 0) {
|
153
|
+
inFn(childrenVal, item, deep + 1);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
};
|
157
|
+
inFn(tree, null, 1);
|
158
|
+
}
|
159
|
+
/**
|
160
|
+
* Return the value of the first tree value in the tree where predicate is true, and `undefined` otherwise
|
161
|
+
*
|
162
|
+
* 根据条件返回树的第一个值,否则返回 `undefined`
|
163
|
+
*/
|
164
|
+
findTree(tree, predicate, options) {
|
165
|
+
let res;
|
166
|
+
this.visitTree(tree, item => {
|
167
|
+
if (res === undefined && predicate(item)) {
|
168
|
+
res = item;
|
169
|
+
}
|
170
|
+
}, options);
|
171
|
+
return res;
|
172
|
+
}
|
173
|
+
/**
|
174
|
+
* 获取所有已经选中的 `key` 值
|
175
|
+
*/
|
176
|
+
getKeysByTreeNode(tree, options) {
|
177
|
+
const opt = {
|
178
|
+
includeHalfChecked: true,
|
179
|
+
...options
|
180
|
+
};
|
181
|
+
const keys = [];
|
182
|
+
this.visitTree(tree, (item, parent, deep) => {
|
183
|
+
if (item.isChecked || (opt.includeHalfChecked && item.isHalfChecked)) {
|
184
|
+
keys.push(opt.cb ? opt.cb(item, parent, deep) : opt.keyMapName ? item.origin[opt.keyMapName] : item.key);
|
185
|
+
}
|
186
|
+
});
|
187
|
+
return keys;
|
188
|
+
}
|
189
|
+
baseFlat(array, depth, result = []) {
|
190
|
+
let index = -1;
|
191
|
+
while (++index < array.length) {
|
192
|
+
const value = array[index];
|
193
|
+
if (depth > 0 && Array.isArray(value)) {
|
194
|
+
if (depth > 1) {
|
195
|
+
this.baseFlat(value, depth - 1, result);
|
196
|
+
}
|
197
|
+
else {
|
198
|
+
let pushIndex = -1;
|
199
|
+
const offset = result.length;
|
200
|
+
while (++pushIndex < value.length) {
|
201
|
+
result[offset + pushIndex] = value[pushIndex];
|
202
|
+
}
|
203
|
+
}
|
204
|
+
}
|
205
|
+
else {
|
206
|
+
result[result.length] = value;
|
207
|
+
}
|
208
|
+
}
|
209
|
+
return result;
|
210
|
+
}
|
211
|
+
/**
|
212
|
+
* Recursively flattens array
|
213
|
+
*
|
214
|
+
* 递归扁平数组
|
215
|
+
* ```ts
|
216
|
+
* srv.flat([1, [2, 3, [4, 5, [6]]]]) => [1,2,3,4,5,6]
|
217
|
+
* srv.flat([1, [2, 3, [4, 5, [6]]]], 1) => [1,2,3,[4, 5, [6]]]
|
218
|
+
* ```
|
219
|
+
*/
|
220
|
+
flat(array, depth = 1 / 0) {
|
221
|
+
return Array.isArray(array) ? this.baseFlat(array, depth) : array;
|
222
|
+
}
|
223
|
+
/**
|
224
|
+
* Group the array
|
225
|
+
*
|
226
|
+
* 对数组进行分组
|
227
|
+
* ```ts
|
228
|
+
* srv.groupBy([6.1, 4.2, 6.3], Math.floor) => {"4":[4.2],"6":[6.1,6.3]}
|
229
|
+
* srv.groupBy(['one', 'two', 'three'], v => v.length) => {"3":["one","two"],"5":["three"]}
|
230
|
+
* ```
|
231
|
+
*/
|
232
|
+
groupBy(array, iteratee) {
|
233
|
+
if (!Array.isArray(array)) {
|
234
|
+
return {};
|
235
|
+
}
|
236
|
+
return array.reduce((result, value) => {
|
237
|
+
const key = iteratee(value);
|
238
|
+
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
239
|
+
result[key].push(value);
|
240
|
+
}
|
241
|
+
else {
|
242
|
+
result[key] = [value];
|
243
|
+
}
|
244
|
+
return result;
|
245
|
+
}, {});
|
246
|
+
}
|
247
|
+
/**
|
248
|
+
* Creates a duplicate-free version of an array
|
249
|
+
*
|
250
|
+
* 创建去重后的数组
|
251
|
+
* ```ts
|
252
|
+
* uniq([1, 2, 2, 3, 1]) => [1,2,3]
|
253
|
+
* uniq([{ a: 1 }, { a: 1 }, { a: 2 }], 'a') => [{"a":1},{"a":2}]
|
254
|
+
* uniq([{ a: 1 }, { a: 1 }, { a: 2 }], i => (i.a === 1 ? 'a' : 'b')) => [{"a":1},{"a":2}]
|
255
|
+
* ```
|
256
|
+
*/
|
257
|
+
uniq(array, predicate) {
|
258
|
+
return Array.from(array
|
259
|
+
.reduce((map, value) => {
|
260
|
+
const key = predicate
|
261
|
+
? typeof predicate === 'string'
|
262
|
+
? value[predicate]
|
263
|
+
: predicate(value)
|
264
|
+
: value;
|
265
|
+
if (!map.has(key)) {
|
266
|
+
map.set(key, value);
|
267
|
+
}
|
268
|
+
return map;
|
269
|
+
}, new Map())
|
270
|
+
.values());
|
271
|
+
}
|
272
|
+
}
|
273
|
+
ArrayService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ArrayService, deps: [{ token: i1.YunzaiConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
|
274
|
+
ArrayService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ArrayService, providedIn: 'root' });
|
275
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ArrayService, decorators: [{
|
276
|
+
type: Injectable,
|
277
|
+
args: [{ providedIn: 'root' }]
|
278
|
+
}], ctorParameters: function () { return [{ type: i1.YunzaiConfigService }]; } });
|
279
|
+
|
280
|
+
/**
|
281
|
+
* Generated bundle index. Do not edit.
|
282
|
+
*/
|
283
|
+
|
284
|
+
export { ArrayService };
|
285
|
+
//# sourceMappingURL=array.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"array.mjs","sources":["../../../../packages/util/array/array.service.ts","../../../../packages/util/array/array.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Injectable } from '@angular/core';\n\nimport { YunzaiConfigService, YunzaiUtilArrayConfig } from '@yelon/util/config';\nimport { NzTreeNode } from 'ng-zorro-antd/core/tree';\n\nimport {\n ArrayServiceArrToTreeNodeOptions,\n ArrayServiceArrToTreeOptions,\n ArrayServiceGetKeysByTreeNodeOptions,\n ArrayServiceGroupByResult,\n ArrayServiceTreeToArrOptions\n} from './array-type.service';\n\n@Injectable({ providedIn: 'root' })\nexport class ArrayService {\n private c: YunzaiUtilArrayConfig;\n\n constructor(cog: YunzaiConfigService) {\n this.c = cog.merge('utilArray', {\n deepMapName: 'deep',\n parentMapName: 'parent',\n idMapName: 'id',\n parentIdMapName: 'parent_id',\n childrenMapName: 'children',\n titleMapName: 'title',\n checkedMapname: 'checked',\n selectedMapname: 'selected',\n expandedMapname: 'expanded',\n disabledMapname: 'disabled'\n })!;\n }\n\n /**\n * Convert tree structure to array structure\n *\n * 将树结构转换成数组结构\n */\n treeToArr<T extends object = any>(tree: readonly T[], options?: ArrayServiceTreeToArrOptions<T>): T[] {\n const opt = {\n deepMapName: this.c.deepMapName,\n parentMapName: this.c.parentMapName,\n childrenMapName: this.c.childrenMapName,\n clearChildren: true,\n cb: null,\n ...options\n } as ArrayServiceTreeToArrOptions;\n const result: Array<{ [key: string]: any }> = [];\n const inFn = (list: ReadonlyArray<{ [key: string]: any }>, parent: T | null, deep: number = 0): void => {\n for (const i of list) {\n i[opt.deepMapName!] = deep;\n i[opt.parentMapName!] = parent;\n if (opt.cb) {\n opt.cb(i, parent, deep);\n }\n result.push(i);\n const children = i[opt.childrenMapName!];\n if (children != null && Array.isArray(children) && children.length > 0) {\n inFn(children, i as T, deep + 1);\n }\n if (opt.clearChildren) {\n delete i[opt.childrenMapName!];\n }\n }\n };\n inFn(tree, null);\n return result as T[];\n }\n\n /**\n * Convert array structure to tree structure\n *\n * 数组转换成树数据\n */\n arrToTree<T extends object = any>(arr: readonly T[], options?: ArrayServiceArrToTreeOptions<T>): T[] {\n if (!Array.isArray(arr) || arr.length === 0) {\n return [];\n }\n\n const opt = {\n idMapName: this.c.idMapName,\n parentIdMapName: this.c.parentIdMapName,\n childrenMapName: this.c.childrenMapName,\n cb: null,\n ...options\n } as ArrayServiceArrToTreeOptions<T>;\n const tree: T[] = [];\n const childrenOf: { [key: string]: T[] } = {};\n let rootPid = opt.rootParentIdValue;\n const arrType = arr as ReadonlyArray<{ [key: string]: any }>;\n if (!rootPid) {\n const pids = arrType.map(i => i[opt.parentIdMapName!]);\n const emptyPid = pids.findIndex(w => w == null);\n rootPid = emptyPid !== -1 ? pids[emptyPid] : pids.sort()[0];\n }\n for (const item of arrType) {\n const id = item[opt.idMapName!];\n const pid = item[opt.parentIdMapName!];\n childrenOf[id] = childrenOf[id] || [];\n item[opt.childrenMapName!] = childrenOf[id];\n if (opt.cb) {\n opt.cb(item as T);\n }\n if (pid !== rootPid) {\n childrenOf[pid] = childrenOf[pid] || [];\n childrenOf[pid].push(item as T);\n } else {\n tree.push(item as T);\n }\n }\n return tree;\n }\n\n /**\n * 数组转换成 `nz-tree` 数据源,通过 `options` 转化项名,也可以使用 `options.cb` 更高级决定数据项\n */\n arrToTreeNode<T extends object = any>(arr: readonly T[], options?: ArrayServiceArrToTreeNodeOptions): NzTreeNode[] {\n const opt = {\n idMapName: this.c.idMapName,\n parentIdMapName: this.c.parentIdMapName,\n titleMapName: this.c.titleMapName,\n isLeafMapName: 'isLeaf',\n checkedMapname: this.c.checkedMapname,\n selectedMapname: this.c.selectedMapname,\n expandedMapname: this.c.expandedMapname,\n disabledMapname: this.c.disabledMapname,\n cb: null,\n ...options\n } as ArrayServiceArrToTreeNodeOptions<T>;\n const tree = this.arrToTree<T>(arr, {\n idMapName: opt.idMapName,\n parentIdMapName: opt.parentIdMapName,\n childrenMapName: 'children'\n });\n this.visitTree<T>(tree, (item: { [key: string]: any }, parent, deep) => {\n item.key = item[opt.idMapName!];\n item.title = item[opt.titleMapName!];\n item.checked = item[opt.checkedMapname!];\n item.selected = item[opt.selectedMapname!];\n item.expanded = item[opt.expandedMapname!];\n item.disabled = item[opt.disabledMapname!];\n if (item[opt.isLeafMapName!] == null) {\n item.isLeaf = item.children.length === 0;\n } else {\n item.isLeaf = item[opt.isLeafMapName!];\n }\n if (opt.cb) {\n opt.cb(item as any, parent, deep);\n }\n });\n return tree.map(node => new NzTreeNode(node as any));\n }\n\n /**\n * 递归访问整个树\n */\n visitTree<T extends object = any>(\n tree: readonly T[],\n cb: (item: T, parent: T | null, deep: number) => void,\n options?: {\n /** 子项名,默认:`'children'` */\n childrenMapName?: string;\n }\n ): void {\n options = {\n childrenMapName: this.c.childrenMapName,\n ...options\n };\n const inFn = (data: readonly T[], parent: T | null, deep: number): void => {\n for (const item of data) {\n cb(item, parent, deep);\n const childrenVal = (item as { [key: string]: any })[options!.childrenMapName!];\n if (Array.isArray(childrenVal) && childrenVal.length > 0) {\n inFn(childrenVal, item, deep + 1);\n }\n }\n };\n inFn(tree, null, 1);\n }\n\n /**\n * Return the value of the first tree value in the tree where predicate is true, and `undefined` otherwise\n *\n * 根据条件返回树的第一个值,否则返回 `undefined`\n */\n findTree<T extends object = any>(\n tree: readonly T[],\n predicate: (item: T) => boolean,\n options?: {\n /** 子项名,默认:`'children'` */\n childrenMapName?: string;\n }\n ): T | undefined {\n let res: T | undefined;\n this.visitTree<T>(\n tree,\n item => {\n if (res === undefined && predicate(item)) {\n res = item;\n }\n },\n options\n );\n return res;\n }\n\n /**\n * 获取所有已经选中的 `key` 值\n */\n getKeysByTreeNode(tree: NzTreeNode[], options?: ArrayServiceGetKeysByTreeNodeOptions): any[] {\n const opt = {\n includeHalfChecked: true,\n ...options\n } as ArrayServiceGetKeysByTreeNodeOptions;\n const keys: any[] = [];\n this.visitTree<NzTreeNode>(tree, (item, parent, deep) => {\n if (item.isChecked || (opt.includeHalfChecked && item.isHalfChecked)) {\n keys.push(opt.cb ? opt.cb(item, parent, deep) : opt.keyMapName ? item.origin[opt.keyMapName] : item.key);\n }\n });\n return keys;\n }\n private baseFlat(array: any[], depth: number, result: any[] = []): any[] {\n let index = -1;\n while (++index < array.length) {\n const value = array[index];\n if (depth > 0 && Array.isArray(value)) {\n if (depth > 1) {\n this.baseFlat(value, depth - 1, result);\n } else {\n let pushIndex = -1;\n const offset = result.length;\n\n while (++pushIndex < value.length) {\n result[offset + pushIndex] = value[pushIndex];\n }\n }\n } else {\n result[result.length] = value;\n }\n }\n return result;\n }\n /**\n * Recursively flattens array\n *\n * 递归扁平数组\n * ```ts\n * srv.flat([1, [2, 3, [4, 5, [6]]]]) => [1,2,3,4,5,6]\n * srv.flat([1, [2, 3, [4, 5, [6]]]], 1) => [1,2,3,[4, 5, [6]]]\n * ```\n */\n flat<T>(array: readonly T[], depth: number = 1 / 0): T[] {\n return Array.isArray(array) ? this.baseFlat(array as any[], depth) : (array as T[]);\n }\n /**\n * Group the array\n *\n * 对数组进行分组\n * ```ts\n * srv.groupBy([6.1, 4.2, 6.3], Math.floor) => {\"4\":[4.2],\"6\":[6.1,6.3]}\n * srv.groupBy(['one', 'two', 'three'], v => v.length) => {\"3\":[\"one\",\"two\"],\"5\":[\"three\"]}\n * ```\n */\n groupBy<T>(array: readonly T[], iteratee: (value: T) => string | number): ArrayServiceGroupByResult {\n if (!Array.isArray(array)) {\n return {};\n }\n return array.reduce((result, value) => {\n const key = iteratee(value);\n if (Object.prototype.hasOwnProperty.call(result, key)) {\n result[key].push(value);\n } else {\n result[key] = [value];\n }\n return result;\n }, {} as ArrayServiceGroupByResult);\n }\n /**\n * Creates a duplicate-free version of an array\n *\n * 创建去重后的数组\n * ```ts\n * uniq([1, 2, 2, 3, 1]) => [1,2,3]\n * uniq([{ a: 1 }, { a: 1 }, { a: 2 }], 'a') => [{\"a\":1},{\"a\":2}]\n * uniq([{ a: 1 }, { a: 1 }, { a: 2 }], i => (i.a === 1 ? 'a' : 'b')) => [{\"a\":1},{\"a\":2}]\n * ```\n */\n uniq<T>(array: readonly T[], predicate?: string | ((value: T) => string | number | boolean)): T[] {\n return Array.from(\n array\n .reduce((map, value) => {\n const key = predicate\n ? typeof predicate === 'string'\n ? (value as any)[predicate]\n : predicate!(value)\n : value;\n if (!map.has(key)) {\n map.set(key, value);\n }\n return map;\n }, new Map<string | number | boolean, T>())\n .values()\n );\n }\n}\n","/**\n * Gener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