@yelon/util 12.0.19 → 13.0.0-beta.1
Sign up to get free protection for your applications and to get access to all the features.
- package/{date-time/yelon-util-date-time.d.ts → array/array.d.ts} +1 -0
- package/array/array.service.d.ts +3 -0
- package/array/package.json +6 -7
- package/browser/browser.d.ts +1 -0
- package/browser/cookie.service.d.ts +3 -0
- package/browser/copy.d.ts +1 -1
- package/browser/package.json +5 -6
- package/browser/scroll.service.d.ts +3 -0
- package/config/config.d.ts +5 -0
- package/config/config.service.d.ts +3 -0
- package/config/package.json +6 -7
- package/date-time/date-time.d.ts +5 -0
- package/date-time/package.json +6 -7
- package/decorator/decorator.d.ts +5 -0
- package/decorator/package.json +6 -7
- package/{esm2015/array/array-type.service.js → esm2020/array/array-type.service.mjs} +0 -0
- package/esm2020/array/array.mjs +5 -0
- package/esm2020/array/array.service.mjs +278 -0
- package/{esm2015/array/index.js → esm2020/array/index.mjs} +0 -0
- package/{esm2015/browser/browser.js → esm2020/browser/browser.mjs} +0 -0
- package/esm2020/browser/cookie.service.mjs +103 -0
- package/esm2020/browser/copy.mjs +9 -0
- package/{esm2015/browser/index.js → esm2020/browser/index.mjs} +0 -0
- package/{esm2015/browser/is-empty.js → esm2020/browser/is-empty.mjs} +0 -0
- package/esm2020/browser/scroll.service.mjs +88 -0
- package/{esm2015/browser/style.js → esm2020/browser/style.mjs} +2 -2
- package/{esm2015/config/abc/date-picker.type.js → esm2020/config/abc/date-picker.type.mjs} +0 -0
- package/{esm2015/config/abc/error-collect.type.js → esm2020/config/abc/error-collect.type.mjs} +0 -0
- package/{esm2015/config/abc/image.type.js → esm2020/config/abc/image.type.mjs} +0 -0
- package/{esm2015/config/abc/index.js → esm2020/config/abc/index.mjs} +0 -0
- package/{esm2015/config/abc/loading.type.js → esm2020/config/abc/loading.type.mjs} +0 -0
- package/{esm2015/config/abc/lodop.type.js → esm2020/config/abc/lodop.type.mjs} +0 -0
- package/{esm2015/config/abc/media.type.js → esm2020/config/abc/media.type.mjs} +0 -0
- package/{esm2015/config/abc/onboarding.type.js → esm2020/config/abc/onboarding.type.mjs} +0 -0
- package/{esm2015/config/abc/page-header.type.js → esm2020/config/abc/page-header.type.mjs} +0 -0
- package/{esm2015/config/abc/pdf.type.js → esm2020/config/abc/pdf.type.mjs} +0 -0
- package/{esm2015/config/abc/qr.type.js → esm2020/config/abc/qr.type.mjs} +0 -0
- package/{esm2015/config/abc/se.type.js → esm2020/config/abc/se.type.mjs} +0 -0
- package/{esm2015/config/abc/sg.type.js → esm2020/config/abc/sg.type.mjs} +0 -0
- package/{esm2015/config/abc/st.type.js → esm2020/config/abc/st.type.mjs} +0 -0
- package/{esm2015/config/abc/sv.type.js → esm2020/config/abc/sv.type.mjs} +0 -0
- package/{esm2015/config/abc/xlsx.type.js → esm2020/config/abc/xlsx.type.mjs} +0 -0
- package/{esm2015/config/abc/zip.type.js → esm2020/config/abc/zip.type.mjs} +0 -0
- package/{esm2015/config/acl/acl.type.js → esm2020/config/acl/acl.type.mjs} +0 -0
- package/{esm2015/config/auth/auth.type.js → esm2020/config/auth/auth.type.mjs} +0 -0
- package/{esm2015/config/bis/bis.type.js → esm2020/config/bis/bis.type.mjs} +0 -0
- package/{esm2015/config/cache/cache.type.js → esm2020/config/cache/cache.type.mjs} +0 -0
- package/{esm2015/config/chart/chart.type.js → esm2020/config/chart/chart.type.mjs} +0 -0
- 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} +0 -0
- package/{esm2015/config/index.js → esm2020/config/index.mjs} +0 -0
- package/{esm2015/config/mock/mock.type.js → esm2020/config/mock/mock.type.mjs} +0 -0
- package/{esm2015/config/sf/sf.type.js → esm2020/config/sf/sf.type.mjs} +0 -0
- package/{esm2015/config/stomp/stomp.type.js → esm2020/config/stomp/stomp.type.mjs} +0 -0
- package/{esm2015/config/theme/http.type.js → esm2020/config/theme/http.type.mjs} +0 -0
- package/{esm2015/config/theme/i18n.type.js → esm2020/config/theme/i18n.type.mjs} +0 -0
- package/{esm2015/config/theme/index.js → esm2020/config/theme/index.mjs} +0 -0
- package/{esm2015/config/theme/responsive.type.js → esm2020/config/theme/responsive.type.mjs} +0 -0
- package/{esm2015/config/util/array.type.js → esm2020/config/util/array.type.mjs} +0 -0
- package/{esm2015/config/util/currency.type.js → esm2020/config/util/currency.type.mjs} +0 -0
- package/esm2020/date-time/date-time.mjs +5 -0
- package/{esm2015/date-time/index.js → esm2020/date-time/index.mjs} +0 -0
- package/esm2020/date-time/picker.mjs +116 -0
- package/{esm2015/date-time/time.js → esm2020/date-time/time.mjs} +6 -2
- package/esm2020/decorator/convert.mjs +58 -0
- package/esm2020/decorator/decorator.mjs +5 -0
- package/{esm2015/decorator/index.js → esm2020/decorator/index.mjs} +0 -0
- package/esm2020/decorator/zone-outside.mjs +57 -0
- package/esm2020/form/form.mjs +5 -0
- package/{esm2015/form/index.js → esm2020/form/index.mjs} +0 -0
- package/{esm2015/form/match-control.js → esm2020/form/match-control.mjs} +0 -0
- package/{esm2015/form/validators.js → esm2020/form/validators.mjs} +0 -0
- package/esm2020/format/currency.service.mjs +238 -0
- package/{esm2015/format/currency.types.js → esm2020/format/currency.types.mjs} +0 -0
- package/esm2020/format/format.mjs +5 -0
- package/{esm2015/format/index.js → esm2020/format/index.mjs} +0 -0
- package/esm2020/format/string.mjs +85 -0
- package/{esm2015/format/validate.js → esm2020/format/validate.mjs} +0 -0
- package/{esm2015/index.js → esm2020/index.mjs} +0 -0
- package/{esm2015/math/in-range.js → esm2020/math/in-range.mjs} +0 -0
- package/{esm2015/math/index.js → esm2020/math/index.mjs} +0 -0
- package/esm2020/math/math.mjs +5 -0
- package/{esm2015/math/round.js → esm2020/math/round.mjs} +0 -0
- package/{esm2015/other/assert.js → esm2020/other/assert.mjs} +0 -0
- package/{esm2015/other/deep.js → esm2020/other/deep.mjs} +0 -0
- package/{esm2015/other/index.js → esm2020/other/index.mjs} +0 -0
- package/esm2020/other/lazy.service.mjs +119 -0
- package/{esm2015/other/logger.js → esm2020/other/logger.mjs} +0 -0
- package/esm2020/other/other.mjs +5 -0
- package/{esm2015/other/resize.js → esm2020/other/resize.mjs} +0 -0
- package/{esm2015/other/url.js → esm2020/other/url.mjs} +0 -0
- package/esm2020/pipes/currency/cny.pipe.mjs +23 -0
- package/{esm2015/pipes/currency/index.js → esm2020/pipes/currency/index.mjs} +2 -1
- 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} +0 -0
- package/esm2020/pipes/filter/module.mjs +17 -0
- package/{esm2015/other/yelon-util-other.js → esm2020/pipes/filter/pipe-filter.mjs} +1 -1
- package/{esm2015/pipes/format/index.js → esm2020/pipes/format/index.mjs} +0 -0
- 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} +1 -1
- package/{esm2015/pipes/index.js → esm2020/pipes/index.mjs} +0 -0
- package/esm2020/pipes/pipes.mjs +5 -0
- package/{esm2015/token/index.js → esm2020/token/index.mjs} +0 -0
- package/{esm2015/token/page-visibility.js → esm2020/token/page-visibility.mjs} +0 -0
- package/esm2020/token/token.mjs +5 -0
- package/{esm2015/token/window.js → esm2020/token/window.mjs} +0 -0
- package/{esm2015/yelon-util.js → esm2020/yelon-util.mjs} +0 -0
- package/fesm2015/{yelon-util-array.js → array.mjs} +8 -10
- package/fesm2015/array.mjs.map +1 -0
- package/fesm2015/{browser.js → browser.mjs} +28 -42
- package/fesm2015/browser.mjs.map +1 -0
- package/fesm2015/{yelon-util-config.js → config.mjs} +14 -8
- package/fesm2015/config.mjs.map +1 -0
- package/fesm2015/{yelon-util-date-time.js → date-time.mjs} +1 -1
- package/fesm2015/date-time.mjs.map +1 -0
- package/fesm2015/{yelon-util-decorator.js → decorator.mjs} +8 -4
- package/fesm2015/decorator.mjs.map +1 -0
- package/fesm2015/{yelon-util-form.js → form.mjs} +1 -1
- package/fesm2015/form.mjs.map +1 -0
- package/fesm2015/{yelon-util-format.js → format.mjs} +18 -14
- package/fesm2015/format.mjs.map +1 -0
- package/fesm2015/{yelon-util-math.js → math.mjs} +1 -1
- package/fesm2015/math.mjs.map +1 -0
- package/fesm2015/{yelon-util-other.js → other.mjs} +12 -9
- 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} +1 -1
- package/fesm2015/pipes.mjs.map +1 -0
- package/fesm2015/{yelon-util-token.js → token.mjs} +1 -1
- package/fesm2015/token.mjs.map +1 -0
- package/fesm2015/{yelon-util.js → yelon-util.mjs} +1 -1
- 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/fesm2020/other.mjs.map +1 -0
- 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} +1 -0
- package/form/package.json +6 -7
- package/format/currency.service.d.ts +3 -0
- package/format/format.d.ts +5 -0
- package/format/package.json +6 -7
- package/{config/yelon-util-config.d.ts → math/math.d.ts} +1 -0
- package/math/package.json +6 -7
- package/other/lazy.service.d.ts +3 -0
- package/{decorator/yelon-util-decorator.d.ts → other/other.d.ts} +1 -0
- package/other/package.json +6 -7
- package/package.json +132 -8
- package/pipes/currency/cny.pipe.d.ts +3 -0
- package/pipes/currency/index.d.ts +1 -0
- package/pipes/currency/mega.pipe.d.ts +3 -0
- package/pipes/currency/module.d.ts +7 -0
- package/pipes/currency/package.json +6 -7
- package/pipes/currency/pipe-currency.d.ts +5 -0
- package/pipes/currency/price.pipe.d.ts +3 -0
- package/pipes/filter/filter.pipe.d.ts +3 -0
- package/pipes/filter/module.d.ts +5 -0
- package/pipes/filter/package.json +6 -7
- package/pipes/filter/pipe-filter.d.ts +5 -0
- package/pipes/format/mask.pipe.d.ts +3 -0
- package/pipes/format/module.d.ts +5 -0
- package/pipes/format/package.json +6 -7
- package/pipes/format/pipe-format.d.ts +5 -0
- package/pipes/package.json +6 -7
- package/pipes/pipes.d.ts +5 -0
- package/token/package.json +6 -7
- package/token/token.d.ts +5 -0
- package/yelon-util.d.ts +1 -0
- 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 -733
- 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/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-other.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
@@ -1,641 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license ng-yunzai(devcui@outlook.com) v12.0.19
|
3
|
-
* (c) 2020 devcui https://github.com/hbyunzai/yelon/
|
4
|
-
* License: MIT
|
5
|
-
*/
|
6
|
-
(function (global, factory) {
|
7
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@yelon/util/config'), require('ng-zorro-antd/core/tree')) :
|
8
|
-
typeof define === 'function' && define.amd ? define('@yelon/util/array', ['exports', '@angular/core', '@yelon/util/config', 'ng-zorro-antd/core/tree'], factory) :
|
9
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.yelon = global.yelon || {}, global.yelon.util = global.yelon.util || {}, global.yelon.util.array = {}), global.ng.core, global.yelon.util.config, global.tree));
|
10
|
-
})(this, (function (exports, i0, i1, tree) { 'use strict';
|
11
|
-
|
12
|
-
function _interopNamespace(e) {
|
13
|
-
if (e && e.__esModule) return e;
|
14
|
-
var n = Object.create(null);
|
15
|
-
if (e) {
|
16
|
-
Object.keys(e).forEach(function (k) {
|
17
|
-
if (k !== 'default') {
|
18
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
19
|
-
Object.defineProperty(n, k, d.get ? d : {
|
20
|
-
enumerable: true,
|
21
|
-
get: function () { return e[k]; }
|
22
|
-
});
|
23
|
-
}
|
24
|
-
});
|
25
|
-
}
|
26
|
-
n["default"] = e;
|
27
|
-
return Object.freeze(n);
|
28
|
-
}
|
29
|
-
|
30
|
-
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
31
|
-
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
32
|
-
|
33
|
-
/*! *****************************************************************************
|
34
|
-
Copyright (c) Microsoft Corporation.
|
35
|
-
|
36
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
37
|
-
purpose with or without fee is hereby granted.
|
38
|
-
|
39
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
40
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
41
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
42
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
43
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
44
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
45
|
-
PERFORMANCE OF THIS SOFTWARE.
|
46
|
-
***************************************************************************** */
|
47
|
-
/* global Reflect, Promise */
|
48
|
-
var extendStatics = function (d, b) {
|
49
|
-
extendStatics = Object.setPrototypeOf ||
|
50
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
51
|
-
function (d, b) { for (var p in b)
|
52
|
-
if (Object.prototype.hasOwnProperty.call(b, p))
|
53
|
-
d[p] = b[p]; };
|
54
|
-
return extendStatics(d, b);
|
55
|
-
};
|
56
|
-
function __extends(d, b) {
|
57
|
-
if (typeof b !== "function" && b !== null)
|
58
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
59
|
-
extendStatics(d, b);
|
60
|
-
function __() { this.constructor = d; }
|
61
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
62
|
-
}
|
63
|
-
var __assign = function () {
|
64
|
-
__assign = Object.assign || function __assign(t) {
|
65
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
66
|
-
s = arguments[i];
|
67
|
-
for (var p in s)
|
68
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
69
|
-
t[p] = s[p];
|
70
|
-
}
|
71
|
-
return t;
|
72
|
-
};
|
73
|
-
return __assign.apply(this, arguments);
|
74
|
-
};
|
75
|
-
function __rest(s, e) {
|
76
|
-
var t = {};
|
77
|
-
for (var p in s)
|
78
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
79
|
-
t[p] = s[p];
|
80
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
81
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
82
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
83
|
-
t[p[i]] = s[p[i]];
|
84
|
-
}
|
85
|
-
return t;
|
86
|
-
}
|
87
|
-
function __decorate(decorators, target, key, desc) {
|
88
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
89
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
90
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
91
|
-
else
|
92
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
93
|
-
if (d = decorators[i])
|
94
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
95
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
96
|
-
}
|
97
|
-
function __param(paramIndex, decorator) {
|
98
|
-
return function (target, key) { decorator(target, key, paramIndex); };
|
99
|
-
}
|
100
|
-
function __metadata(metadataKey, metadataValue) {
|
101
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
102
|
-
return Reflect.metadata(metadataKey, metadataValue);
|
103
|
-
}
|
104
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
105
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
106
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
107
|
-
function fulfilled(value) { try {
|
108
|
-
step(generator.next(value));
|
109
|
-
}
|
110
|
-
catch (e) {
|
111
|
-
reject(e);
|
112
|
-
} }
|
113
|
-
function rejected(value) { try {
|
114
|
-
step(generator["throw"](value));
|
115
|
-
}
|
116
|
-
catch (e) {
|
117
|
-
reject(e);
|
118
|
-
} }
|
119
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
120
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
121
|
-
});
|
122
|
-
}
|
123
|
-
function __generator(thisArg, body) {
|
124
|
-
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
125
|
-
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
126
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
127
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
128
|
-
function step(op) {
|
129
|
-
if (f)
|
130
|
-
throw new TypeError("Generator is already executing.");
|
131
|
-
while (_)
|
132
|
-
try {
|
133
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
134
|
-
return t;
|
135
|
-
if (y = 0, t)
|
136
|
-
op = [op[0] & 2, t.value];
|
137
|
-
switch (op[0]) {
|
138
|
-
case 0:
|
139
|
-
case 1:
|
140
|
-
t = op;
|
141
|
-
break;
|
142
|
-
case 4:
|
143
|
-
_.label++;
|
144
|
-
return { value: op[1], done: false };
|
145
|
-
case 5:
|
146
|
-
_.label++;
|
147
|
-
y = op[1];
|
148
|
-
op = [0];
|
149
|
-
continue;
|
150
|
-
case 7:
|
151
|
-
op = _.ops.pop();
|
152
|
-
_.trys.pop();
|
153
|
-
continue;
|
154
|
-
default:
|
155
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
156
|
-
_ = 0;
|
157
|
-
continue;
|
158
|
-
}
|
159
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
160
|
-
_.label = op[1];
|
161
|
-
break;
|
162
|
-
}
|
163
|
-
if (op[0] === 6 && _.label < t[1]) {
|
164
|
-
_.label = t[1];
|
165
|
-
t = op;
|
166
|
-
break;
|
167
|
-
}
|
168
|
-
if (t && _.label < t[2]) {
|
169
|
-
_.label = t[2];
|
170
|
-
_.ops.push(op);
|
171
|
-
break;
|
172
|
-
}
|
173
|
-
if (t[2])
|
174
|
-
_.ops.pop();
|
175
|
-
_.trys.pop();
|
176
|
-
continue;
|
177
|
-
}
|
178
|
-
op = body.call(thisArg, _);
|
179
|
-
}
|
180
|
-
catch (e) {
|
181
|
-
op = [6, e];
|
182
|
-
y = 0;
|
183
|
-
}
|
184
|
-
finally {
|
185
|
-
f = t = 0;
|
186
|
-
}
|
187
|
-
if (op[0] & 5)
|
188
|
-
throw op[1];
|
189
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
190
|
-
}
|
191
|
-
}
|
192
|
-
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
193
|
-
if (k2 === undefined)
|
194
|
-
k2 = k;
|
195
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
196
|
-
}) : (function (o, m, k, k2) {
|
197
|
-
if (k2 === undefined)
|
198
|
-
k2 = k;
|
199
|
-
o[k2] = m[k];
|
200
|
-
});
|
201
|
-
function __exportStar(m, o) {
|
202
|
-
for (var p in m)
|
203
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
204
|
-
__createBinding(o, m, p);
|
205
|
-
}
|
206
|
-
function __values(o) {
|
207
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
208
|
-
if (m)
|
209
|
-
return m.call(o);
|
210
|
-
if (o && typeof o.length === "number")
|
211
|
-
return {
|
212
|
-
next: function () {
|
213
|
-
if (o && i >= o.length)
|
214
|
-
o = void 0;
|
215
|
-
return { value: o && o[i++], done: !o };
|
216
|
-
}
|
217
|
-
};
|
218
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
219
|
-
}
|
220
|
-
function __read(o, n) {
|
221
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
222
|
-
if (!m)
|
223
|
-
return o;
|
224
|
-
var i = m.call(o), r, ar = [], e;
|
225
|
-
try {
|
226
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
227
|
-
ar.push(r.value);
|
228
|
-
}
|
229
|
-
catch (error) {
|
230
|
-
e = { error: error };
|
231
|
-
}
|
232
|
-
finally {
|
233
|
-
try {
|
234
|
-
if (r && !r.done && (m = i["return"]))
|
235
|
-
m.call(i);
|
236
|
-
}
|
237
|
-
finally {
|
238
|
-
if (e)
|
239
|
-
throw e.error;
|
240
|
-
}
|
241
|
-
}
|
242
|
-
return ar;
|
243
|
-
}
|
244
|
-
/** @deprecated */
|
245
|
-
function __spread() {
|
246
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
247
|
-
ar = ar.concat(__read(arguments[i]));
|
248
|
-
return ar;
|
249
|
-
}
|
250
|
-
/** @deprecated */
|
251
|
-
function __spreadArrays() {
|
252
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
253
|
-
s += arguments[i].length;
|
254
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
255
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
256
|
-
r[k] = a[j];
|
257
|
-
return r;
|
258
|
-
}
|
259
|
-
function __spreadArray(to, from, pack) {
|
260
|
-
if (pack || arguments.length === 2)
|
261
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
262
|
-
if (ar || !(i in from)) {
|
263
|
-
if (!ar)
|
264
|
-
ar = Array.prototype.slice.call(from, 0, i);
|
265
|
-
ar[i] = from[i];
|
266
|
-
}
|
267
|
-
}
|
268
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
269
|
-
}
|
270
|
-
function __await(v) {
|
271
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
272
|
-
}
|
273
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
274
|
-
if (!Symbol.asyncIterator)
|
275
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
276
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
277
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
278
|
-
function verb(n) { if (g[n])
|
279
|
-
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
280
|
-
function resume(n, v) { try {
|
281
|
-
step(g[n](v));
|
282
|
-
}
|
283
|
-
catch (e) {
|
284
|
-
settle(q[0][3], e);
|
285
|
-
} }
|
286
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
287
|
-
function fulfill(value) { resume("next", value); }
|
288
|
-
function reject(value) { resume("throw", value); }
|
289
|
-
function settle(f, v) { if (f(v), q.shift(), q.length)
|
290
|
-
resume(q[0][0], q[0][1]); }
|
291
|
-
}
|
292
|
-
function __asyncDelegator(o) {
|
293
|
-
var i, p;
|
294
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
295
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
296
|
-
}
|
297
|
-
function __asyncValues(o) {
|
298
|
-
if (!Symbol.asyncIterator)
|
299
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
300
|
-
var m = o[Symbol.asyncIterator], i;
|
301
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
302
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
303
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
304
|
-
}
|
305
|
-
function __makeTemplateObject(cooked, raw) {
|
306
|
-
if (Object.defineProperty) {
|
307
|
-
Object.defineProperty(cooked, "raw", { value: raw });
|
308
|
-
}
|
309
|
-
else {
|
310
|
-
cooked.raw = raw;
|
311
|
-
}
|
312
|
-
return cooked;
|
313
|
-
}
|
314
|
-
;
|
315
|
-
var __setModuleDefault = Object.create ? (function (o, v) {
|
316
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
317
|
-
}) : function (o, v) {
|
318
|
-
o["default"] = v;
|
319
|
-
};
|
320
|
-
function __importStar(mod) {
|
321
|
-
if (mod && mod.__esModule)
|
322
|
-
return mod;
|
323
|
-
var result = {};
|
324
|
-
if (mod != null)
|
325
|
-
for (var k in mod)
|
326
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
327
|
-
__createBinding(result, mod, k);
|
328
|
-
__setModuleDefault(result, mod);
|
329
|
-
return result;
|
330
|
-
}
|
331
|
-
function __importDefault(mod) {
|
332
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
333
|
-
}
|
334
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
335
|
-
if (kind === "a" && !f)
|
336
|
-
throw new TypeError("Private accessor was defined without a getter");
|
337
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
338
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
339
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
340
|
-
}
|
341
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
342
|
-
if (kind === "m")
|
343
|
-
throw new TypeError("Private method is not writable");
|
344
|
-
if (kind === "a" && !f)
|
345
|
-
throw new TypeError("Private accessor was defined without a setter");
|
346
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
347
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
348
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
349
|
-
}
|
350
|
-
|
351
|
-
var ArrayService = /** @class */ (function () {
|
352
|
-
function ArrayService(cog) {
|
353
|
-
this.c = cog.merge('utilArray', {
|
354
|
-
deepMapName: 'deep',
|
355
|
-
parentMapName: 'parent',
|
356
|
-
idMapName: 'id',
|
357
|
-
parentIdMapName: 'parent_id',
|
358
|
-
childrenMapName: 'children',
|
359
|
-
titleMapName: 'title',
|
360
|
-
checkedMapname: 'checked',
|
361
|
-
selectedMapname: 'selected',
|
362
|
-
expandedMapname: 'expanded',
|
363
|
-
disabledMapname: 'disabled'
|
364
|
-
});
|
365
|
-
}
|
366
|
-
/**
|
367
|
-
* Convert tree structure to array structure
|
368
|
-
*
|
369
|
-
* 将树结构转换成数组结构
|
370
|
-
*/
|
371
|
-
ArrayService.prototype.treeToArr = function (tree, options) {
|
372
|
-
var opt = Object.assign({ deepMapName: this.c.deepMapName, parentMapName: this.c.parentMapName, childrenMapName: this.c.childrenMapName, clearChildren: true, cb: null }, options);
|
373
|
-
var result = [];
|
374
|
-
var inFn = function (list, parent, deep) {
|
375
|
-
var e_1, _a;
|
376
|
-
if (deep === void 0) { deep = 0; }
|
377
|
-
try {
|
378
|
-
for (var list_1 = __values(list), list_1_1 = list_1.next(); !list_1_1.done; list_1_1 = list_1.next()) {
|
379
|
-
var i = list_1_1.value;
|
380
|
-
i[opt.deepMapName] = deep;
|
381
|
-
i[opt.parentMapName] = parent;
|
382
|
-
if (opt.cb) {
|
383
|
-
opt.cb(i, parent, deep);
|
384
|
-
}
|
385
|
-
result.push(i);
|
386
|
-
var children = i[opt.childrenMapName];
|
387
|
-
if (children != null && Array.isArray(children) && children.length > 0) {
|
388
|
-
inFn(children, i, deep + 1);
|
389
|
-
}
|
390
|
-
if (opt.clearChildren) {
|
391
|
-
delete i[opt.childrenMapName];
|
392
|
-
}
|
393
|
-
}
|
394
|
-
}
|
395
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
396
|
-
finally {
|
397
|
-
try {
|
398
|
-
if (list_1_1 && !list_1_1.done && (_a = list_1.return)) _a.call(list_1);
|
399
|
-
}
|
400
|
-
finally { if (e_1) throw e_1.error; }
|
401
|
-
}
|
402
|
-
};
|
403
|
-
inFn(tree, null);
|
404
|
-
return result;
|
405
|
-
};
|
406
|
-
/**
|
407
|
-
* Convert array structure to tree structure
|
408
|
-
*
|
409
|
-
* 数组转换成树数据
|
410
|
-
*/
|
411
|
-
ArrayService.prototype.arrToTree = function (arr, options) {
|
412
|
-
var e_2, _a;
|
413
|
-
if (!Array.isArray(arr) || arr.length === 0) {
|
414
|
-
return [];
|
415
|
-
}
|
416
|
-
var opt = Object.assign({ idMapName: this.c.idMapName, parentIdMapName: this.c.parentIdMapName, childrenMapName: this.c.childrenMapName, cb: null }, options);
|
417
|
-
var tree = [];
|
418
|
-
var childrenOf = {};
|
419
|
-
var rootPid = opt.rootParentIdValue;
|
420
|
-
var arrType = arr;
|
421
|
-
if (!rootPid) {
|
422
|
-
var pids = arrType.map(function (i) { return i[opt.parentIdMapName]; });
|
423
|
-
var emptyPid = pids.findIndex(function (w) { return w == null; });
|
424
|
-
rootPid = emptyPid !== -1 ? pids[emptyPid] : pids.sort()[0];
|
425
|
-
}
|
426
|
-
try {
|
427
|
-
for (var arrType_1 = __values(arrType), arrType_1_1 = arrType_1.next(); !arrType_1_1.done; arrType_1_1 = arrType_1.next()) {
|
428
|
-
var item = arrType_1_1.value;
|
429
|
-
var id = item[opt.idMapName];
|
430
|
-
var pid = item[opt.parentIdMapName];
|
431
|
-
childrenOf[id] = childrenOf[id] || [];
|
432
|
-
item[opt.childrenMapName] = childrenOf[id];
|
433
|
-
if (opt.cb) {
|
434
|
-
opt.cb(item);
|
435
|
-
}
|
436
|
-
if (pid !== rootPid) {
|
437
|
-
childrenOf[pid] = childrenOf[pid] || [];
|
438
|
-
childrenOf[pid].push(item);
|
439
|
-
}
|
440
|
-
else {
|
441
|
-
tree.push(item);
|
442
|
-
}
|
443
|
-
}
|
444
|
-
}
|
445
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
446
|
-
finally {
|
447
|
-
try {
|
448
|
-
if (arrType_1_1 && !arrType_1_1.done && (_a = arrType_1.return)) _a.call(arrType_1);
|
449
|
-
}
|
450
|
-
finally { if (e_2) throw e_2.error; }
|
451
|
-
}
|
452
|
-
return tree;
|
453
|
-
};
|
454
|
-
/**
|
455
|
-
* 数组转换成 `nz-tree` 数据源,通过 `options` 转化项名,也可以使用 `options.cb` 更高级决定数据项
|
456
|
-
*/
|
457
|
-
ArrayService.prototype.arrToTreeNode = function (arr, options) {
|
458
|
-
var opt = Object.assign({ idMapName: this.c.idMapName, parentIdMapName: this.c.parentIdMapName, titleMapName: this.c.titleMapName, isLeafMapName: 'isLeaf', checkedMapname: this.c.checkedMapname, selectedMapname: this.c.selectedMapname, expandedMapname: this.c.expandedMapname, disabledMapname: this.c.disabledMapname, cb: null }, options);
|
459
|
-
var tree$1 = this.arrToTree(arr, {
|
460
|
-
idMapName: opt.idMapName,
|
461
|
-
parentIdMapName: opt.parentIdMapName,
|
462
|
-
childrenMapName: 'children'
|
463
|
-
});
|
464
|
-
this.visitTree(tree$1, function (item, parent, deep) {
|
465
|
-
item.key = item[opt.idMapName];
|
466
|
-
item.title = item[opt.titleMapName];
|
467
|
-
item.checked = item[opt.checkedMapname];
|
468
|
-
item.selected = item[opt.selectedMapname];
|
469
|
-
item.expanded = item[opt.expandedMapname];
|
470
|
-
item.disabled = item[opt.disabledMapname];
|
471
|
-
if (item[opt.isLeafMapName] == null) {
|
472
|
-
item.isLeaf = item.children.length === 0;
|
473
|
-
}
|
474
|
-
else {
|
475
|
-
item.isLeaf = item[opt.isLeafMapName];
|
476
|
-
}
|
477
|
-
if (opt.cb) {
|
478
|
-
opt.cb(item, parent, deep);
|
479
|
-
}
|
480
|
-
});
|
481
|
-
return tree$1.map(function (node) { return new tree.NzTreeNode(node); });
|
482
|
-
};
|
483
|
-
/**
|
484
|
-
* 递归访问整个树
|
485
|
-
*/
|
486
|
-
ArrayService.prototype.visitTree = function (tree, cb, options) {
|
487
|
-
options = Object.assign({ childrenMapName: this.c.childrenMapName }, options);
|
488
|
-
var inFn = function (data, parent, deep) {
|
489
|
-
var e_3, _a;
|
490
|
-
try {
|
491
|
-
for (var data_1 = __values(data), data_1_1 = data_1.next(); !data_1_1.done; data_1_1 = data_1.next()) {
|
492
|
-
var item = data_1_1.value;
|
493
|
-
cb(item, parent, deep);
|
494
|
-
var childrenVal = item[options.childrenMapName];
|
495
|
-
if (Array.isArray(childrenVal) && childrenVal.length > 0) {
|
496
|
-
inFn(childrenVal, item, deep + 1);
|
497
|
-
}
|
498
|
-
}
|
499
|
-
}
|
500
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
501
|
-
finally {
|
502
|
-
try {
|
503
|
-
if (data_1_1 && !data_1_1.done && (_a = data_1.return)) _a.call(data_1);
|
504
|
-
}
|
505
|
-
finally { if (e_3) throw e_3.error; }
|
506
|
-
}
|
507
|
-
};
|
508
|
-
inFn(tree, null, 1);
|
509
|
-
};
|
510
|
-
/**
|
511
|
-
* Return the value of the first tree value in the tree where predicate is true, and `undefined` otherwise
|
512
|
-
*
|
513
|
-
* 根据条件返回树的第一个值,否则返回 `undefined`
|
514
|
-
*/
|
515
|
-
ArrayService.prototype.findTree = function (tree, predicate, options) {
|
516
|
-
var res;
|
517
|
-
this.visitTree(tree, function (item) {
|
518
|
-
if (res === undefined && predicate(item)) {
|
519
|
-
res = item;
|
520
|
-
}
|
521
|
-
}, options);
|
522
|
-
return res;
|
523
|
-
};
|
524
|
-
/**
|
525
|
-
* 获取所有已经选中的 `key` 值
|
526
|
-
*/
|
527
|
-
ArrayService.prototype.getKeysByTreeNode = function (tree, options) {
|
528
|
-
var opt = Object.assign({ includeHalfChecked: true }, options);
|
529
|
-
var keys = [];
|
530
|
-
this.visitTree(tree, function (item, parent, deep) {
|
531
|
-
if (item.isChecked || (opt.includeHalfChecked && item.isHalfChecked)) {
|
532
|
-
keys.push(opt.cb ? opt.cb(item, parent, deep) : opt.keyMapName ? item.origin[opt.keyMapName] : item.key);
|
533
|
-
}
|
534
|
-
});
|
535
|
-
return keys;
|
536
|
-
};
|
537
|
-
ArrayService.prototype.baseFlat = function (array, depth, result) {
|
538
|
-
if (result === void 0) { result = []; }
|
539
|
-
var index = -1;
|
540
|
-
while (++index < array.length) {
|
541
|
-
var value = array[index];
|
542
|
-
if (depth > 0 && Array.isArray(value)) {
|
543
|
-
if (depth > 1) {
|
544
|
-
this.baseFlat(value, depth - 1, result);
|
545
|
-
}
|
546
|
-
else {
|
547
|
-
var pushIndex = -1;
|
548
|
-
var offset = result.length;
|
549
|
-
while (++pushIndex < value.length) {
|
550
|
-
result[offset + pushIndex] = value[pushIndex];
|
551
|
-
}
|
552
|
-
}
|
553
|
-
}
|
554
|
-
else {
|
555
|
-
result[result.length] = value;
|
556
|
-
}
|
557
|
-
}
|
558
|
-
return result;
|
559
|
-
};
|
560
|
-
/**
|
561
|
-
* Recursively flattens array
|
562
|
-
*
|
563
|
-
* 递归扁平数组
|
564
|
-
* ```ts
|
565
|
-
* srv.flat([1, [2, 3, [4, 5, [6]]]]) => [1,2,3,4,5,6]
|
566
|
-
* srv.flat([1, [2, 3, [4, 5, [6]]]], 1) => [1,2,3,[4, 5, [6]]]
|
567
|
-
* ```
|
568
|
-
*/
|
569
|
-
ArrayService.prototype.flat = function (array, depth) {
|
570
|
-
if (depth === void 0) { depth = 1 / 0; }
|
571
|
-
return Array.isArray(array) ? this.baseFlat(array, depth) : array;
|
572
|
-
};
|
573
|
-
/**
|
574
|
-
* Group the array
|
575
|
-
*
|
576
|
-
* 对数组进行分组
|
577
|
-
* ```ts
|
578
|
-
* srv.groupBy([6.1, 4.2, 6.3], Math.floor) => {"4":[4.2],"6":[6.1,6.3]}
|
579
|
-
* srv.groupBy(['one', 'two', 'three'], v => v.length) => {"3":["one","two"],"5":["three"]}
|
580
|
-
* ```
|
581
|
-
*/
|
582
|
-
ArrayService.prototype.groupBy = function (array, iteratee) {
|
583
|
-
if (!Array.isArray(array)) {
|
584
|
-
return {};
|
585
|
-
}
|
586
|
-
return array.reduce(function (result, value) {
|
587
|
-
var key = iteratee(value);
|
588
|
-
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
589
|
-
result[key].push(value);
|
590
|
-
}
|
591
|
-
else {
|
592
|
-
result[key] = [value];
|
593
|
-
}
|
594
|
-
return result;
|
595
|
-
}, {});
|
596
|
-
};
|
597
|
-
/**
|
598
|
-
* Creates a duplicate-free version of an array
|
599
|
-
*
|
600
|
-
* 创建去重后的数组
|
601
|
-
* ```ts
|
602
|
-
* uniq([1, 2, 2, 3, 1]) => [1,2,3]
|
603
|
-
* uniq([{ a: 1 }, { a: 1 }, { a: 2 }], 'a') => [{"a":1},{"a":2}]
|
604
|
-
* uniq([{ a: 1 }, { a: 1 }, { a: 2 }], i => (i.a === 1 ? 'a' : 'b')) => [{"a":1},{"a":2}]
|
605
|
-
* ```
|
606
|
-
*/
|
607
|
-
ArrayService.prototype.uniq = function (array, predicate) {
|
608
|
-
return Array.from(array
|
609
|
-
.reduce(function (map, value) {
|
610
|
-
var key = predicate
|
611
|
-
? typeof predicate === 'string'
|
612
|
-
? value[predicate]
|
613
|
-
: predicate(value)
|
614
|
-
: value;
|
615
|
-
if (!map.has(key)) {
|
616
|
-
map.set(key, value);
|
617
|
-
}
|
618
|
-
return map;
|
619
|
-
}, new Map())
|
620
|
-
.values());
|
621
|
-
};
|
622
|
-
return ArrayService;
|
623
|
-
}());
|
624
|
-
ArrayService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function ArrayService_Factory() { return new ArrayService(i0__namespace.ɵɵinject(i1__namespace.YunzaiConfigService)); }, token: ArrayService, providedIn: "root" });
|
625
|
-
ArrayService.decorators = [
|
626
|
-
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
627
|
-
];
|
628
|
-
ArrayService.ctorParameters = function () { return [
|
629
|
-
{ type: i1.YunzaiConfigService }
|
630
|
-
]; };
|
631
|
-
|
632
|
-
/**
|
633
|
-
* Generated bundle index. Do not edit.
|
634
|
-
*/
|
635
|
-
|
636
|
-
exports.ArrayService = ArrayService;
|
637
|
-
|
638
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
639
|
-
|
640
|
-
}));
|
641
|
-
//# sourceMappingURL=yelon-util-array.umd.js.map
|