@yelon/util 12.0.17 → 12.0.18
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/array/array.service.d.ts +75 -75
- package/array/index.d.ts +2 -2
- package/array/yelon-util-array.d.ts +4 -4
- package/browser/browser.d.ts +4 -4
- package/browser/cookie.service.d.ts +64 -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/scroll.service.d.ts +34 -34
- package/browser/style.d.ts +21 -21
- package/bundles/browser.umd.js +275 -275
- package/bundles/yelon-util-array.umd.js +602 -602
- package/bundles/yelon-util-config.umd.js +366 -366
- package/bundles/yelon-util-date-time.umd.js +216 -216
- package/bundles/yelon-util-decorator.umd.js +437 -437
- package/bundles/yelon-util-form.umd.js +116 -116
- package/bundles/yelon-util-format.umd.js +726 -726
- package/bundles/yelon-util-math.umd.js +83 -83
- package/bundles/yelon-util-other.umd.js +652 -652
- package/bundles/yelon-util-pipes-currency.umd.js +83 -83
- package/bundles/yelon-util-pipes-filter.umd.js +353 -353
- package/bundles/yelon-util-pipes-format.umd.js +47 -47
- package/bundles/yelon-util-pipes.umd.js +7 -7
- package/bundles/yelon-util-token.umd.js +30 -30
- package/bundles/yelon-util.umd.js +7 -7
- 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.service.d.ts +10 -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/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/config/yelon-util-config.d.ts +4 -4
- package/date-time/index.d.ts +2 -2
- package/date-time/picker.d.ts +68 -68
- package/date-time/time.d.ts +26 -26
- package/date-time/yelon-util-date-time.d.ts +4 -4
- package/decorator/convert.d.ts +24 -24
- package/decorator/index.d.ts +2 -2
- package/decorator/yelon-util-decorator.d.ts +4 -4
- package/decorator/zone-outside.d.ts +35 -35
- package/esm2015/array/array-type.service.js +1 -1
- package/esm2015/array/array.service.js +249 -249
- package/esm2015/array/index.js +2 -2
- package/esm2015/array/yelon-util-array.js +4 -4
- package/esm2015/browser/browser.js +4 -4
- package/esm2015/browser/cookie.service.js +103 -103
- package/esm2015/browser/copy.js +26 -26
- package/esm2015/browser/index.js +5 -5
- package/esm2015/browser/is-empty.js +18 -18
- package/esm2015/browser/scroll.service.js +88 -88
- package/esm2015/browser/style.js +37 -37
- package/esm2015/config/abc/date-picker.type.js +1 -1
- package/esm2015/config/abc/error-collect.type.js +1 -1
- package/esm2015/config/abc/image.type.js +1 -1
- package/esm2015/config/abc/index.js +16 -16
- package/esm2015/config/abc/loading.type.js +1 -1
- package/esm2015/config/abc/lodop.type.js +1 -1
- package/esm2015/config/abc/media.type.js +1 -1
- package/esm2015/config/abc/onboarding.type.js +1 -1
- package/esm2015/config/abc/page-header.type.js +1 -1
- package/esm2015/config/abc/pdf.type.js +1 -1
- package/esm2015/config/abc/qr.type.js +1 -1
- package/esm2015/config/abc/se.type.js +1 -1
- package/esm2015/config/abc/sg.type.js +1 -1
- package/esm2015/config/abc/st.type.js +1 -1
- package/esm2015/config/abc/sv.type.js +2 -2
- package/esm2015/config/abc/xlsx.type.js +1 -1
- package/esm2015/config/abc/zip.type.js +1 -1
- package/esm2015/config/acl/acl.type.js +1 -1
- package/esm2015/config/auth/auth.type.js +1 -1
- package/esm2015/config/bis/bis.type.js +1 -1
- package/esm2015/config/cache/cache.type.js +1 -1
- package/esm2015/config/chart/chart.type.js +1 -1
- package/esm2015/config/config.service.js +33 -33
- package/esm2015/config/config.types.js +8 -8
- package/esm2015/config/index.js +14 -14
- package/esm2015/config/mock/mock.type.js +1 -1
- package/esm2015/config/sf/sf.type.js +1 -1
- package/esm2015/config/stomp/stomp.type.js +1 -1
- package/esm2015/config/theme/http.type.js +1 -1
- package/esm2015/config/theme/i18n.type.js +1 -1
- package/esm2015/config/theme/index.js +3 -3
- package/esm2015/config/theme/responsive.type.js +1 -1
- package/esm2015/config/util/array.type.js +1 -1
- package/esm2015/config/util/currency.type.js +1 -1
- package/esm2015/config/yelon-util-config.js +4 -4
- package/esm2015/date-time/index.js +2 -2
- package/esm2015/date-time/picker.js +115 -115
- package/esm2015/date-time/time.js +83 -83
- package/esm2015/date-time/yelon-util-date-time.js +4 -4
- package/esm2015/decorator/convert.js +55 -55
- package/esm2015/decorator/index.js +2 -2
- package/esm2015/decorator/yelon-util-decorator.js +4 -4
- package/esm2015/decorator/zone-outside.js +54 -54
- package/esm2015/form/index.js +2 -2
- package/esm2015/form/match-control.js +29 -29
- package/esm2015/form/validators.js +80 -80
- package/esm2015/form/yelon-util-form.js +4 -4
- package/esm2015/format/currency.service.js +224 -224
- package/esm2015/format/currency.types.js +7 -7
- package/esm2015/format/index.js +4 -4
- package/esm2015/format/string.js +75 -75
- package/esm2015/format/validate.js +93 -93
- package/esm2015/format/yelon-util-format.js +4 -4
- package/esm2015/index.js +11 -11
- package/esm2015/math/in-range.js +24 -24
- package/esm2015/math/index.js +2 -2
- package/esm2015/math/round.js +52 -52
- package/esm2015/math/yelon-util-math.js +4 -4
- package/esm2015/other/assert.js +66 -66
- package/esm2015/other/deep.js +75 -75
- package/esm2015/other/index.js +4 -4
- package/esm2015/other/lazy.service.js +117 -117
- package/esm2015/other/logger.js +32 -32
- package/esm2015/other/yelon-util-other.js +4 -4
- package/esm2015/pipes/currency/cny.pipe.js +21 -21
- package/esm2015/pipes/currency/index.js +3 -3
- package/esm2015/pipes/currency/mega.pipe.js +25 -25
- package/esm2015/pipes/currency/module.js +13 -13
- package/esm2015/pipes/currency/price.pipe.js +25 -25
- package/esm2015/pipes/currency/yelon-util-pipes-currency.js +5 -5
- package/esm2015/pipes/filter/filter.pipe.js +14 -14
- package/esm2015/pipes/filter/index.js +2 -2
- package/esm2015/pipes/filter/module.js +11 -11
- package/esm2015/pipes/filter/yelon-util-pipes-filter.js +4 -4
- package/esm2015/pipes/format/index.js +2 -2
- package/esm2015/pipes/format/mask.pipe.js +29 -29
- package/esm2015/pipes/format/module.js +11 -11
- package/esm2015/pipes/format/yelon-util-pipes-format.js +4 -4
- package/esm2015/pipes/index.js +3 -3
- package/esm2015/pipes/yelon-util-pipes.js +4 -4
- package/esm2015/token/index.js +2 -2
- package/esm2015/token/page-visibility.js +15 -15
- package/esm2015/token/window.js +16 -16
- package/esm2015/token/yelon-util-token.js +4 -4
- package/esm2015/yelon-util.js +4 -4
- package/fesm2015/browser.js +257 -257
- package/fesm2015/yelon-util-array.js +245 -245
- package/fesm2015/yelon-util-config.js +36 -36
- package/fesm2015/yelon-util-date-time.js +196 -196
- package/fesm2015/yelon-util-decorator.js +107 -107
- package/fesm2015/yelon-util-form.js +108 -108
- package/fesm2015/yelon-util-format.js +390 -390
- package/fesm2015/yelon-util-math.js +75 -75
- package/fesm2015/yelon-util-other.js +280 -280
- package/fesm2015/yelon-util-pipes-currency.js +72 -72
- package/fesm2015/yelon-util-pipes-filter.js +22 -22
- package/fesm2015/yelon-util-pipes-format.js +36 -36
- package/fesm2015/yelon-util-pipes.js +2 -2
- package/fesm2015/yelon-util-token.js +25 -25
- package/fesm2015/yelon-util.js +2 -2
- package/form/index.d.ts +2 -2
- package/form/match-control.d.ts +15 -15
- package/form/validators.d.ts +62 -62
- package/form/yelon-util-form.d.ts +4 -4
- package/format/currency.service.d.ts +34 -34
- package/format/currency.types.d.ts +77 -77
- package/format/index.d.ts +4 -4
- package/format/string.d.ts +44 -44
- package/format/validate.d.ts +72 -72
- package/format/yelon-util-format.d.ts +4 -4
- package/index.d.ts +11 -11
- package/math/in-range.d.ts +14 -14
- package/math/index.d.ts +2 -2
- package/math/round.d.ts +33 -33
- package/math/yelon-util-math.d.ts +4 -4
- package/other/assert.d.ts +36 -36
- package/other/deep.d.ts +33 -33
- package/other/index.d.ts +4 -4
- package/other/lazy.service.d.ts +22 -22
- package/other/logger.d.ts +5 -5
- package/other/yelon-util-other.d.ts +4 -4
- package/package.json +1 -1
- package/pipes/currency/cny.pipe.d.ts +12 -12
- package/pipes/currency/index.d.ts +3 -3
- package/pipes/currency/mega.pipe.d.ts +13 -13
- package/pipes/currency/module.d.ts +2 -2
- package/pipes/currency/price.pipe.d.ts +16 -16
- package/pipes/currency/yelon-util-pipes-currency.d.ts +5 -5
- package/pipes/filter/filter.pipe.d.ts +10 -10
- package/pipes/filter/index.d.ts +2 -2
- package/pipes/filter/module.d.ts +2 -2
- package/pipes/filter/yelon-util-pipes-filter.d.ts +4 -4
- package/pipes/format/index.d.ts +2 -2
- package/pipes/format/mask.pipe.d.ts +24 -24
- package/pipes/format/module.d.ts +2 -2
- package/pipes/format/yelon-util-pipes-format.d.ts +4 -4
- package/pipes/index.d.ts +3 -3
- package/pipes/yelon-util-pipes.d.ts +4 -4
- package/token/index.d.ts +2 -2
- package/token/page-visibility.d.ts +8 -8
- package/token/window.d.ts +7 -7
- package/token/yelon-util-token.d.ts +4 -4
- package/yelon-util.d.ts +4 -4
@@ -1,8 +1,8 @@
|
|
1
|
-
/**
|
2
|
-
* @license ng-yunzai(devcui@outlook.com) v12.0.
|
3
|
-
* (c) 2020 devcui https://github.com/hbyunzai/yelon/
|
4
|
-
* License: MIT
|
5
|
-
*/
|
1
|
+
/**
|
2
|
+
* @license ng-yunzai(devcui@outlook.com) v12.0.18
|
3
|
+
* (c) 2020 devcui https://github.com/hbyunzai/yelon/
|
4
|
+
* License: MIT
|
5
|
+
*/
|
6
6
|
(function (global, factory) {
|
7
7
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@yelon/util/config'), require('ng-zorro-antd/core/tree')) :
|
8
8
|
typeof define === 'function' && define.amd ? define('@yelon/util/array', ['exports', '@angular/core', '@yelon/util/config', 'ng-zorro-antd/core/tree'], factory) :
|
@@ -30,607 +30,607 @@
|
|
30
30
|
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
31
31
|
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
32
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;
|
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
349
|
}
|
350
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 }
|
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
630
|
]; };
|
631
631
|
|
632
|
-
/**
|
633
|
-
* Generated bundle index. Do not edit.
|
632
|
+
/**
|
633
|
+
* Generated bundle index. Do not edit.
|
634
634
|
*/
|
635
635
|
|
636
636
|
exports.ArrayService = ArrayService;
|