@yelon/util 15.2.0 → 15.2.2
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -21
- package/README.md +22 -22
- package/analysis/global-event.subject.d.ts +7 -0
- package/analysis/index.d.ts +1 -0
- package/array/array-type.service.d.ts +68 -68
- package/array/array.service.d.ts +78 -78
- package/array/index.d.ts +2 -2
- package/browser/cookie.service.d.ts +67 -67
- 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 +37 -37
- package/browser/style.d.ts +21 -21
- package/config/abc/date-picker.type.d.ts +52 -52
- package/config/abc/error-collect.type.d.ts +10 -10
- package/config/abc/exception.type.d.ts +9 -9
- package/config/abc/image.type.d.ts +15 -15
- package/config/abc/index.d.ts +17 -17
- 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 +465 -465
- 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 +13 -13
- package/config/config.types.d.ts +48 -48
- package/config/index.d.ts +14 -14
- package/config/mock/mock.type.d.ts +18 -18
- package/config/sf/sf.type.d.ts +133 -133
- package/config/socket/socket.type.d.ts +4 -4
- package/config/theme/http.type.d.ts +14 -14
- package/config/theme/i18n.type.d.ts +14 -14
- package/config/theme/index.d.ts +3 -3
- package/config/theme/responsive.type.d.ts +12 -12
- package/config/util/array.type.d.ts +22 -22
- package/config/util/currency.type.d.ts +39 -39
- package/date-time/index.d.ts +2 -2
- package/date-time/picker.d.ts +68 -68
- package/date-time/time.d.ts +29 -29
- package/decorator/convert.d.ts +24 -24
- package/decorator/index.d.ts +2 -2
- package/decorator/zone-outside.d.ts +35 -35
- package/esm2020/analysis/analysis.mjs +5 -0
- package/esm2020/analysis/global-event.subject.mjs +17 -0
- package/esm2020/analysis/index.mjs +2 -0
- package/esm2020/array/array-type.service.mjs +1 -1
- package/esm2020/array/array.mjs +4 -4
- package/esm2020/array/array.service.mjs +276 -276
- package/esm2020/array/index.mjs +2 -2
- package/esm2020/browser/browser.mjs +4 -4
- package/esm2020/browser/cookie.service.mjs +102 -102
- package/esm2020/browser/copy.mjs +27 -27
- package/esm2020/browser/index.mjs +5 -5
- package/esm2020/browser/is-empty.mjs +18 -18
- package/esm2020/browser/scroll.service.mjs +87 -87
- package/esm2020/browser/style.mjs +37 -37
- package/esm2020/config/abc/date-picker.type.mjs +1 -1
- package/esm2020/config/abc/error-collect.type.mjs +1 -1
- package/esm2020/config/abc/exception.type.mjs +1 -1
- package/esm2020/config/abc/image.type.mjs +1 -1
- package/esm2020/config/abc/index.mjs +17 -17
- package/esm2020/config/abc/loading.type.mjs +1 -1
- package/esm2020/config/abc/lodop.type.mjs +1 -1
- package/esm2020/config/abc/media.type.mjs +1 -1
- package/esm2020/config/abc/onboarding.type.mjs +1 -1
- package/esm2020/config/abc/page-header.type.mjs +1 -1
- package/esm2020/config/abc/pdf.type.mjs +1 -1
- package/esm2020/config/abc/qr.type.mjs +1 -1
- package/esm2020/config/abc/se.type.mjs +1 -1
- package/esm2020/config/abc/sg.type.mjs +1 -1
- package/esm2020/config/abc/st.type.mjs +1 -1
- package/esm2020/config/abc/sv.type.mjs +2 -2
- package/esm2020/config/abc/xlsx.type.mjs +1 -1
- package/esm2020/config/abc/zip.type.mjs +1 -1
- package/esm2020/config/acl/acl.type.mjs +1 -1
- package/esm2020/config/auth/auth.type.mjs +1 -1
- package/esm2020/config/bis/bis.type.mjs +1 -1
- package/esm2020/config/cache/cache.type.mjs +1 -1
- package/esm2020/config/chart/chart.type.mjs +1 -1
- package/esm2020/config/config.mjs +4 -4
- package/esm2020/config/config.service.mjs +36 -36
- package/esm2020/config/config.types.mjs +8 -8
- package/esm2020/config/index.mjs +14 -14
- package/esm2020/config/mock/mock.type.mjs +1 -1
- package/esm2020/config/sf/sf.type.mjs +1 -1
- package/esm2020/config/socket/socket.type.mjs +1 -1
- package/esm2020/config/theme/http.type.mjs +1 -1
- package/esm2020/config/theme/i18n.type.mjs +1 -1
- package/esm2020/config/theme/index.mjs +3 -3
- package/esm2020/config/theme/responsive.type.mjs +1 -1
- package/esm2020/config/util/array.type.mjs +1 -1
- package/esm2020/config/util/currency.type.mjs +1 -1
- package/esm2020/date-time/date-time.mjs +4 -4
- package/esm2020/date-time/index.mjs +2 -2
- package/esm2020/date-time/picker.mjs +115 -115
- package/esm2020/date-time/time.mjs +88 -88
- package/esm2020/decorator/convert.mjs +57 -57
- package/esm2020/decorator/decorator.mjs +4 -4
- package/esm2020/decorator/index.mjs +2 -2
- package/esm2020/decorator/zone-outside.mjs +56 -56
- package/esm2020/form/form.mjs +4 -4
- package/esm2020/form/index.mjs +2 -2
- package/esm2020/form/match-control.mjs +29 -29
- package/esm2020/form/validators.mjs +80 -80
- package/esm2020/format/currency.service.mjs +237 -237
- package/esm2020/format/currency.types.mjs +7 -7
- package/esm2020/format/format.mjs +4 -4
- package/esm2020/format/index.mjs +4 -4
- package/esm2020/format/string.mjs +84 -84
- package/esm2020/format/validate.mjs +93 -93
- package/esm2020/index.mjs +13 -12
- package/esm2020/math/in-range.mjs +24 -24
- package/esm2020/math/index.mjs +2 -2
- package/esm2020/math/math.mjs +4 -4
- package/esm2020/math/round.mjs +52 -52
- package/esm2020/other/assert.mjs +66 -66
- package/esm2020/other/deep.mjs +77 -77
- package/esm2020/other/favicon.mjs +28 -28
- package/esm2020/other/index.mjs +7 -7
- package/esm2020/other/lazy.service.mjs +131 -131
- package/esm2020/other/logger.mjs +32 -32
- package/esm2020/other/other.mjs +4 -4
- package/esm2020/other/path-to-regexp.service.mjs +238 -238
- package/esm2020/other/resize.mjs +3 -3
- package/esm2020/pipes/currency/cny.pipe.mjs +22 -22
- package/esm2020/pipes/currency/index.mjs +4 -4
- package/esm2020/pipes/currency/mega.pipe.mjs +28 -28
- package/esm2020/pipes/currency/module.mjs +18 -18
- package/esm2020/pipes/currency/pipe-currency.mjs +4 -4
- package/esm2020/pipes/currency/price.pipe.mjs +26 -26
- package/esm2020/pipes/filter/filter.pipe.mjs +18 -18
- package/esm2020/pipes/filter/index.mjs +2 -2
- package/esm2020/pipes/filter/module.mjs +16 -16
- package/esm2020/pipes/filter/pipe-filter.mjs +4 -4
- package/esm2020/pipes/format/index.mjs +2 -2
- package/esm2020/pipes/format/mask.pipe.mjs +33 -33
- package/esm2020/pipes/format/module.mjs +16 -16
- package/esm2020/pipes/format/pipe-format.mjs +4 -4
- package/esm2020/pipes/index.mjs +3 -3
- package/esm2020/pipes/pipes.mjs +4 -4
- package/esm2020/token/index.mjs +2 -2
- package/esm2020/token/page-visibility.mjs +14 -14
- package/esm2020/token/token.mjs +4 -4
- package/esm2020/token/window.mjs +16 -16
- package/esm2020/yelon-util.mjs +4 -4
- package/fesm2015/analysis.mjs +24 -0
- package/fesm2015/analysis.mjs.map +1 -0
- package/fesm2015/array.mjs +254 -254
- package/fesm2015/browser.mjs +283 -283
- package/fesm2015/config.mjs +56 -56
- package/fesm2015/date-time.mjs +207 -207
- package/fesm2015/decorator.mjs +121 -121
- package/fesm2015/form.mjs +118 -118
- package/fesm2015/format.mjs +413 -413
- package/fesm2015/math.mjs +85 -85
- package/fesm2015/other.mjs +589 -589
- package/fesm2015/pipe-currency.mjs +96 -96
- package/fesm2015/pipe-filter.mjs +40 -40
- package/fesm2015/pipe-format.mjs +55 -55
- package/fesm2015/pipes.mjs +8 -8
- package/fesm2015/token.mjs +37 -37
- package/fesm2015/yelon-util.mjs +17 -16
- package/fesm2015/yelon-util.mjs.map +1 -1
- package/fesm2020/analysis.mjs +24 -0
- package/fesm2020/analysis.mjs.map +1 -0
- package/fesm2020/array.mjs +284 -284
- package/fesm2020/browser.mjs +279 -279
- package/fesm2020/config.mjs +54 -54
- package/fesm2020/date-time.mjs +211 -211
- package/fesm2020/decorator.mjs +121 -121
- package/fesm2020/form.mjs +118 -118
- package/fesm2020/format.mjs +431 -431
- package/fesm2020/math.mjs +85 -85
- package/fesm2020/other.mjs +586 -586
- package/fesm2020/pipe-currency.mjs +94 -94
- package/fesm2020/pipe-filter.mjs +40 -40
- package/fesm2020/pipe-format.mjs +55 -55
- package/fesm2020/pipes.mjs +8 -8
- package/fesm2020/token.mjs +37 -37
- package/fesm2020/yelon-util.mjs +17 -16
- package/fesm2020/yelon-util.mjs.map +1 -1
- package/form/index.d.ts +2 -2
- package/form/match-control.d.ts +15 -15
- package/form/validators.d.ts +62 -62
- package/format/currency.service.d.ts +37 -37
- 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/index.d.ts +12 -11
- package/math/in-range.d.ts +14 -14
- package/math/index.d.ts +2 -2
- package/math/round.d.ts +33 -33
- package/other/assert.d.ts +36 -36
- package/other/deep.d.ts +35 -35
- package/other/favicon.d.ts +2 -2
- package/other/index.d.ts +7 -7
- package/other/lazy.service.d.ts +48 -48
- package/other/logger.d.ts +5 -5
- package/other/path-to-regexp.service.d.ts +26 -26
- package/other/resize.d.ts +1 -1
- package/package.json +165 -157
- package/pipes/currency/cny.pipe.d.ts +15 -15
- package/pipes/currency/index.d.ts +4 -4
- package/pipes/currency/mega.pipe.d.ts +16 -16
- package/pipes/currency/module.d.ts +9 -9
- package/pipes/currency/price.pipe.d.ts +19 -19
- package/pipes/filter/filter.pipe.d.ts +13 -13
- package/pipes/filter/index.d.ts +2 -2
- package/pipes/filter/module.d.ts +7 -7
- package/pipes/format/index.d.ts +2 -2
- package/pipes/format/mask.pipe.d.ts +27 -27
- package/pipes/format/module.d.ts +7 -7
- package/pipes/index.d.ts +3 -3
- package/token/index.d.ts +2 -2
- package/token/page-visibility.d.ts +8 -8
- package/token/window.d.ts +7 -7
@@ -1,239 +1,239 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
2
|
-
import { Injectable } from '@angular/core';
|
3
|
-
import * as i0 from "@angular/core";
|
4
|
-
export class PathToRegexpService {
|
5
|
-
constructor() {
|
6
|
-
this.DEFAULT_DELIMITER = '/';
|
7
|
-
this.PATH_REGEXP = new RegExp(['(\\\\.)', '(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?'].join('|'), 'g');
|
8
|
-
}
|
9
|
-
parse(str, options) {
|
10
|
-
const tokens = [];
|
11
|
-
let key = 0;
|
12
|
-
let index = 0;
|
13
|
-
let path = '';
|
14
|
-
const defaultDelimiter = (options && options.delimiter) || this.DEFAULT_DELIMITER;
|
15
|
-
const whitelist = (options && options.whitelist) || undefined;
|
16
|
-
let pathEscaped = false;
|
17
|
-
let res;
|
18
|
-
while ((res = this.PATH_REGEXP.exec(str)) !== null) {
|
19
|
-
const m = res[0];
|
20
|
-
const escaped = res[1];
|
21
|
-
const offset = res.index;
|
22
|
-
path += str.slice(index, offset);
|
23
|
-
index = offset + m.length;
|
24
|
-
// Ignore already escaped sequences.
|
25
|
-
if (escaped) {
|
26
|
-
path += escaped[1];
|
27
|
-
pathEscaped = true;
|
28
|
-
continue;
|
29
|
-
}
|
30
|
-
let prev = '';
|
31
|
-
const name = res[2];
|
32
|
-
const capture = res[3];
|
33
|
-
const group = res[4];
|
34
|
-
const modifier = res[5];
|
35
|
-
if (!pathEscaped && path.length) {
|
36
|
-
const k = path.length - 1;
|
37
|
-
const c = path[k];
|
38
|
-
const matches = whitelist ? whitelist.indexOf(c) > -1 : true;
|
39
|
-
if (matches) {
|
40
|
-
prev = c;
|
41
|
-
path = path.slice(0, k);
|
42
|
-
}
|
43
|
-
}
|
44
|
-
// Push the current path onto the tokens.
|
45
|
-
if (path) {
|
46
|
-
tokens.push(path);
|
47
|
-
path = '';
|
48
|
-
pathEscaped = false;
|
49
|
-
}
|
50
|
-
const repeat = modifier === '+' || modifier === '*';
|
51
|
-
const optional = modifier === '?' || modifier === '*';
|
52
|
-
const pattern = capture || group;
|
53
|
-
const delimiter = prev || defaultDelimiter;
|
54
|
-
tokens.push({
|
55
|
-
name: name || key++,
|
56
|
-
prefix: prev,
|
57
|
-
delimiter: delimiter,
|
58
|
-
optional: optional,
|
59
|
-
repeat: repeat,
|
60
|
-
pattern: pattern
|
61
|
-
? this.escapeGroup(pattern)
|
62
|
-
: `[^${this.escapeString(delimiter === defaultDelimiter ? delimiter : delimiter + defaultDelimiter)}]+?`
|
63
|
-
});
|
64
|
-
}
|
65
|
-
// Push any remaining characters.
|
66
|
-
if (path || index < str.length) {
|
67
|
-
tokens.push(path + str.substr(index));
|
68
|
-
}
|
69
|
-
return tokens;
|
70
|
-
}
|
71
|
-
compile(str, options) {
|
72
|
-
return this.tokensToFunction(this.parse(str, options), options);
|
73
|
-
}
|
74
|
-
tokensToFunction(tokens, options) {
|
75
|
-
const matches = new Array(tokens.length);
|
76
|
-
for (let i = 0; i < tokens.length; i++) {
|
77
|
-
if (typeof tokens[i] === 'object') {
|
78
|
-
matches[i] = new RegExp(`^(?:${tokens[i].pattern})$`, this.flags(options));
|
79
|
-
}
|
80
|
-
}
|
81
|
-
return function (data, options) {
|
82
|
-
let path = '';
|
83
|
-
const encode = (options && options.encode) || encodeURIComponent;
|
84
|
-
const validate = options ? options.validate !== false : true;
|
85
|
-
for (let i = 0; i < tokens.length; i++) {
|
86
|
-
const token = tokens[i];
|
87
|
-
if (typeof token === 'string') {
|
88
|
-
path += token;
|
89
|
-
continue;
|
90
|
-
}
|
91
|
-
const value = data ? data[token.name] : undefined;
|
92
|
-
let segment;
|
93
|
-
if (Array.isArray(value)) {
|
94
|
-
if (!token.repeat) {
|
95
|
-
throw new TypeError(`Expected "${token.name}" to not repeat, but got array`);
|
96
|
-
}
|
97
|
-
if (value.length === 0) {
|
98
|
-
if (token.optional) {
|
99
|
-
continue;
|
100
|
-
}
|
101
|
-
throw new TypeError(`Expected "${token.name}" to not be empty`);
|
102
|
-
}
|
103
|
-
for (let j = 0; j < value.length; j++) {
|
104
|
-
segment = encode(value[j], token);
|
105
|
-
if (validate && !matches[i].test(segment)) {
|
106
|
-
throw new TypeError(`Expected all "${token.name}" to match "${token.pattern}"`);
|
107
|
-
}
|
108
|
-
path += (j === 0 ? token.prefix : token.delimiter) + segment;
|
109
|
-
}
|
110
|
-
continue;
|
111
|
-
}
|
112
|
-
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
113
|
-
segment = encode(String(value), token);
|
114
|
-
if (validate && !matches[i].test(segment)) {
|
115
|
-
throw new TypeError(`Expected "${token.name}" to match "${token.pattern}", but got "${segment}"`);
|
116
|
-
}
|
117
|
-
path += token.prefix + segment;
|
118
|
-
continue;
|
119
|
-
}
|
120
|
-
if (token.optional) {
|
121
|
-
continue;
|
122
|
-
}
|
123
|
-
throw new TypeError(`Expected "${token.name}" to be ${token.repeat ? 'an array' : 'a string'}`);
|
124
|
-
}
|
125
|
-
return path;
|
126
|
-
};
|
127
|
-
}
|
128
|
-
escapeString(str) {
|
129
|
-
return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, '\\$1');
|
130
|
-
}
|
131
|
-
escapeGroup(group) {
|
132
|
-
return group.replace(/([=!:$/()])/g, '\\$1');
|
133
|
-
}
|
134
|
-
flags(options) {
|
135
|
-
return options && options.sensitive ? '' : 'i';
|
136
|
-
}
|
137
|
-
regexpToRegexp(path, keys) {
|
138
|
-
if (!keys) {
|
139
|
-
return path;
|
140
|
-
}
|
141
|
-
const groups = path.source.match(/\((?!\?)/g);
|
142
|
-
if (groups) {
|
143
|
-
for (let i = 0; i < groups.length; i++) {
|
144
|
-
keys.push({
|
145
|
-
name: i,
|
146
|
-
prefix: null,
|
147
|
-
delimiter: null,
|
148
|
-
optional: false,
|
149
|
-
repeat: false,
|
150
|
-
pattern: null
|
151
|
-
});
|
152
|
-
}
|
153
|
-
}
|
154
|
-
return path;
|
155
|
-
}
|
156
|
-
arrayToRegexp(path, keys, options) {
|
157
|
-
const parts = [];
|
158
|
-
for (let i = 0; i < path.length; i++) {
|
159
|
-
parts.push(this.pathToRegexp(path[i], keys, options).source);
|
160
|
-
}
|
161
|
-
return new RegExp(`(?:${parts.join('|')})`, this.flags(options));
|
162
|
-
}
|
163
|
-
stringToRegexp(path, keys, options) {
|
164
|
-
return this.tokensToRegExp(this.parse(path, options), keys, options);
|
165
|
-
}
|
166
|
-
tokensToRegExp(tokens, keys, options) {
|
167
|
-
options = options || {};
|
168
|
-
const strict = options.strict;
|
169
|
-
const start = options.start !== false;
|
170
|
-
const end = options.end !== false;
|
171
|
-
const delimiter = options.delimiter || this.DEFAULT_DELIMITER;
|
172
|
-
const endsWith = []
|
173
|
-
.concat(options.endsWith || [])
|
174
|
-
.map(this.escapeString)
|
175
|
-
.concat('$')
|
176
|
-
.join('|');
|
177
|
-
let route = start ? '^' : '';
|
178
|
-
for (let i = 0; i < tokens.length; i++) {
|
179
|
-
const token = tokens[i];
|
180
|
-
if (typeof token === 'string') {
|
181
|
-
route += this.escapeString(token);
|
182
|
-
}
|
183
|
-
else {
|
184
|
-
const capture = token.repeat
|
185
|
-
? `(?:${token.pattern})(?:${this.escapeString(token.delimiter)}(?:${token.pattern}))*`
|
186
|
-
: token.pattern;
|
187
|
-
if (keys) {
|
188
|
-
keys.push(token);
|
189
|
-
}
|
190
|
-
if (token.optional) {
|
191
|
-
if (!token.prefix) {
|
192
|
-
route += `(${capture})?`;
|
193
|
-
}
|
194
|
-
else {
|
195
|
-
route += `(?:${this.escapeString(token.prefix)}(${capture}))?`;
|
196
|
-
}
|
197
|
-
}
|
198
|
-
else {
|
199
|
-
route += `${this.escapeString(token.prefix)}(${capture})`;
|
200
|
-
}
|
201
|
-
}
|
202
|
-
}
|
203
|
-
if (end) {
|
204
|
-
if (!strict) {
|
205
|
-
route += `(?:${this.escapeString(delimiter)})?`;
|
206
|
-
}
|
207
|
-
route += endsWith === '$' ? '$' : `(?=${endsWith})`;
|
208
|
-
}
|
209
|
-
else {
|
210
|
-
const endToken = tokens[tokens.length - 1];
|
211
|
-
const isEndDelimited = typeof endToken === 'string' ? endToken[endToken.length - 1] === delimiter : endToken === undefined;
|
212
|
-
if (!strict) {
|
213
|
-
route += `(?:${this.escapeString(delimiter)}(?=${endsWith}))?`;
|
214
|
-
}
|
215
|
-
if (!isEndDelimited) {
|
216
|
-
route += `(?=${this.escapeString(delimiter)}|${endsWith})`;
|
217
|
-
}
|
218
|
-
}
|
219
|
-
return new RegExp(route, this.flags(options));
|
220
|
-
}
|
221
|
-
pathToRegexp(path, keys, options) {
|
222
|
-
if (path instanceof RegExp) {
|
223
|
-
return this.regexpToRegexp(path, keys);
|
224
|
-
}
|
225
|
-
if (Array.isArray(path)) {
|
226
|
-
return this.arrayToRegexp(/** @type {!Array} */ path, keys, options);
|
227
|
-
}
|
228
|
-
return this.stringToRegexp(/** @type {string} */ path, keys, options);
|
229
|
-
}
|
230
|
-
}
|
231
|
-
PathToRegexpService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
232
|
-
PathToRegexpService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.
|
233
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
234
|
-
type: Injectable,
|
235
|
-
args: [{
|
236
|
-
providedIn: 'root'
|
237
|
-
}]
|
238
|
-
}], ctorParameters: function () { return []; } });
|
1
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
2
|
+
import { Injectable } from '@angular/core';
|
3
|
+
import * as i0 from "@angular/core";
|
4
|
+
export class PathToRegexpService {
|
5
|
+
constructor() {
|
6
|
+
this.DEFAULT_DELIMITER = '/';
|
7
|
+
this.PATH_REGEXP = new RegExp(['(\\\\.)', '(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?'].join('|'), 'g');
|
8
|
+
}
|
9
|
+
parse(str, options) {
|
10
|
+
const tokens = [];
|
11
|
+
let key = 0;
|
12
|
+
let index = 0;
|
13
|
+
let path = '';
|
14
|
+
const defaultDelimiter = (options && options.delimiter) || this.DEFAULT_DELIMITER;
|
15
|
+
const whitelist = (options && options.whitelist) || undefined;
|
16
|
+
let pathEscaped = false;
|
17
|
+
let res;
|
18
|
+
while ((res = this.PATH_REGEXP.exec(str)) !== null) {
|
19
|
+
const m = res[0];
|
20
|
+
const escaped = res[1];
|
21
|
+
const offset = res.index;
|
22
|
+
path += str.slice(index, offset);
|
23
|
+
index = offset + m.length;
|
24
|
+
// Ignore already escaped sequences.
|
25
|
+
if (escaped) {
|
26
|
+
path += escaped[1];
|
27
|
+
pathEscaped = true;
|
28
|
+
continue;
|
29
|
+
}
|
30
|
+
let prev = '';
|
31
|
+
const name = res[2];
|
32
|
+
const capture = res[3];
|
33
|
+
const group = res[4];
|
34
|
+
const modifier = res[5];
|
35
|
+
if (!pathEscaped && path.length) {
|
36
|
+
const k = path.length - 1;
|
37
|
+
const c = path[k];
|
38
|
+
const matches = whitelist ? whitelist.indexOf(c) > -1 : true;
|
39
|
+
if (matches) {
|
40
|
+
prev = c;
|
41
|
+
path = path.slice(0, k);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
// Push the current path onto the tokens.
|
45
|
+
if (path) {
|
46
|
+
tokens.push(path);
|
47
|
+
path = '';
|
48
|
+
pathEscaped = false;
|
49
|
+
}
|
50
|
+
const repeat = modifier === '+' || modifier === '*';
|
51
|
+
const optional = modifier === '?' || modifier === '*';
|
52
|
+
const pattern = capture || group;
|
53
|
+
const delimiter = prev || defaultDelimiter;
|
54
|
+
tokens.push({
|
55
|
+
name: name || key++,
|
56
|
+
prefix: prev,
|
57
|
+
delimiter: delimiter,
|
58
|
+
optional: optional,
|
59
|
+
repeat: repeat,
|
60
|
+
pattern: pattern
|
61
|
+
? this.escapeGroup(pattern)
|
62
|
+
: `[^${this.escapeString(delimiter === defaultDelimiter ? delimiter : delimiter + defaultDelimiter)}]+?`
|
63
|
+
});
|
64
|
+
}
|
65
|
+
// Push any remaining characters.
|
66
|
+
if (path || index < str.length) {
|
67
|
+
tokens.push(path + str.substr(index));
|
68
|
+
}
|
69
|
+
return tokens;
|
70
|
+
}
|
71
|
+
compile(str, options) {
|
72
|
+
return this.tokensToFunction(this.parse(str, options), options);
|
73
|
+
}
|
74
|
+
tokensToFunction(tokens, options) {
|
75
|
+
const matches = new Array(tokens.length);
|
76
|
+
for (let i = 0; i < tokens.length; i++) {
|
77
|
+
if (typeof tokens[i] === 'object') {
|
78
|
+
matches[i] = new RegExp(`^(?:${tokens[i].pattern})$`, this.flags(options));
|
79
|
+
}
|
80
|
+
}
|
81
|
+
return function (data, options) {
|
82
|
+
let path = '';
|
83
|
+
const encode = (options && options.encode) || encodeURIComponent;
|
84
|
+
const validate = options ? options.validate !== false : true;
|
85
|
+
for (let i = 0; i < tokens.length; i++) {
|
86
|
+
const token = tokens[i];
|
87
|
+
if (typeof token === 'string') {
|
88
|
+
path += token;
|
89
|
+
continue;
|
90
|
+
}
|
91
|
+
const value = data ? data[token.name] : undefined;
|
92
|
+
let segment;
|
93
|
+
if (Array.isArray(value)) {
|
94
|
+
if (!token.repeat) {
|
95
|
+
throw new TypeError(`Expected "${token.name}" to not repeat, but got array`);
|
96
|
+
}
|
97
|
+
if (value.length === 0) {
|
98
|
+
if (token.optional) {
|
99
|
+
continue;
|
100
|
+
}
|
101
|
+
throw new TypeError(`Expected "${token.name}" to not be empty`);
|
102
|
+
}
|
103
|
+
for (let j = 0; j < value.length; j++) {
|
104
|
+
segment = encode(value[j], token);
|
105
|
+
if (validate && !matches[i].test(segment)) {
|
106
|
+
throw new TypeError(`Expected all "${token.name}" to match "${token.pattern}"`);
|
107
|
+
}
|
108
|
+
path += (j === 0 ? token.prefix : token.delimiter) + segment;
|
109
|
+
}
|
110
|
+
continue;
|
111
|
+
}
|
112
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
113
|
+
segment = encode(String(value), token);
|
114
|
+
if (validate && !matches[i].test(segment)) {
|
115
|
+
throw new TypeError(`Expected "${token.name}" to match "${token.pattern}", but got "${segment}"`);
|
116
|
+
}
|
117
|
+
path += token.prefix + segment;
|
118
|
+
continue;
|
119
|
+
}
|
120
|
+
if (token.optional) {
|
121
|
+
continue;
|
122
|
+
}
|
123
|
+
throw new TypeError(`Expected "${token.name}" to be ${token.repeat ? 'an array' : 'a string'}`);
|
124
|
+
}
|
125
|
+
return path;
|
126
|
+
};
|
127
|
+
}
|
128
|
+
escapeString(str) {
|
129
|
+
return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, '\\$1');
|
130
|
+
}
|
131
|
+
escapeGroup(group) {
|
132
|
+
return group.replace(/([=!:$/()])/g, '\\$1');
|
133
|
+
}
|
134
|
+
flags(options) {
|
135
|
+
return options && options.sensitive ? '' : 'i';
|
136
|
+
}
|
137
|
+
regexpToRegexp(path, keys) {
|
138
|
+
if (!keys) {
|
139
|
+
return path;
|
140
|
+
}
|
141
|
+
const groups = path.source.match(/\((?!\?)/g);
|
142
|
+
if (groups) {
|
143
|
+
for (let i = 0; i < groups.length; i++) {
|
144
|
+
keys.push({
|
145
|
+
name: i,
|
146
|
+
prefix: null,
|
147
|
+
delimiter: null,
|
148
|
+
optional: false,
|
149
|
+
repeat: false,
|
150
|
+
pattern: null
|
151
|
+
});
|
152
|
+
}
|
153
|
+
}
|
154
|
+
return path;
|
155
|
+
}
|
156
|
+
arrayToRegexp(path, keys, options) {
|
157
|
+
const parts = [];
|
158
|
+
for (let i = 0; i < path.length; i++) {
|
159
|
+
parts.push(this.pathToRegexp(path[i], keys, options).source);
|
160
|
+
}
|
161
|
+
return new RegExp(`(?:${parts.join('|')})`, this.flags(options));
|
162
|
+
}
|
163
|
+
stringToRegexp(path, keys, options) {
|
164
|
+
return this.tokensToRegExp(this.parse(path, options), keys, options);
|
165
|
+
}
|
166
|
+
tokensToRegExp(tokens, keys, options) {
|
167
|
+
options = options || {};
|
168
|
+
const strict = options.strict;
|
169
|
+
const start = options.start !== false;
|
170
|
+
const end = options.end !== false;
|
171
|
+
const delimiter = options.delimiter || this.DEFAULT_DELIMITER;
|
172
|
+
const endsWith = []
|
173
|
+
.concat(options.endsWith || [])
|
174
|
+
.map(this.escapeString)
|
175
|
+
.concat('$')
|
176
|
+
.join('|');
|
177
|
+
let route = start ? '^' : '';
|
178
|
+
for (let i = 0; i < tokens.length; i++) {
|
179
|
+
const token = tokens[i];
|
180
|
+
if (typeof token === 'string') {
|
181
|
+
route += this.escapeString(token);
|
182
|
+
}
|
183
|
+
else {
|
184
|
+
const capture = token.repeat
|
185
|
+
? `(?:${token.pattern})(?:${this.escapeString(token.delimiter)}(?:${token.pattern}))*`
|
186
|
+
: token.pattern;
|
187
|
+
if (keys) {
|
188
|
+
keys.push(token);
|
189
|
+
}
|
190
|
+
if (token.optional) {
|
191
|
+
if (!token.prefix) {
|
192
|
+
route += `(${capture})?`;
|
193
|
+
}
|
194
|
+
else {
|
195
|
+
route += `(?:${this.escapeString(token.prefix)}(${capture}))?`;
|
196
|
+
}
|
197
|
+
}
|
198
|
+
else {
|
199
|
+
route += `${this.escapeString(token.prefix)}(${capture})`;
|
200
|
+
}
|
201
|
+
}
|
202
|
+
}
|
203
|
+
if (end) {
|
204
|
+
if (!strict) {
|
205
|
+
route += `(?:${this.escapeString(delimiter)})?`;
|
206
|
+
}
|
207
|
+
route += endsWith === '$' ? '$' : `(?=${endsWith})`;
|
208
|
+
}
|
209
|
+
else {
|
210
|
+
const endToken = tokens[tokens.length - 1];
|
211
|
+
const isEndDelimited = typeof endToken === 'string' ? endToken[endToken.length - 1] === delimiter : endToken === undefined;
|
212
|
+
if (!strict) {
|
213
|
+
route += `(?:${this.escapeString(delimiter)}(?=${endsWith}))?`;
|
214
|
+
}
|
215
|
+
if (!isEndDelimited) {
|
216
|
+
route += `(?=${this.escapeString(delimiter)}|${endsWith})`;
|
217
|
+
}
|
218
|
+
}
|
219
|
+
return new RegExp(route, this.flags(options));
|
220
|
+
}
|
221
|
+
pathToRegexp(path, keys, options) {
|
222
|
+
if (path instanceof RegExp) {
|
223
|
+
return this.regexpToRegexp(path, keys);
|
224
|
+
}
|
225
|
+
if (Array.isArray(path)) {
|
226
|
+
return this.arrayToRegexp(/** @type {!Array} */ path, keys, options);
|
227
|
+
}
|
228
|
+
return this.stringToRegexp(/** @type {string} */ path, keys, options);
|
229
|
+
}
|
230
|
+
}
|
231
|
+
PathToRegexpService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PathToRegexpService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
232
|
+
PathToRegexpService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PathToRegexpService, providedIn: 'root' });
|
233
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PathToRegexpService, decorators: [{
|
234
|
+
type: Injectable,
|
235
|
+
args: [{
|
236
|
+
providedIn: 'root'
|
237
|
+
}]
|
238
|
+
}], ctorParameters: function () { return []; } });
|
239
239
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGF0aC10by1yZWdleHAuc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3V0aWwvb3RoZXIvcGF0aC10by1yZWdleHAuc2VydmljZS50cyJdLCJuYW1lcyI6W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export const resizeWindow = () => {
|
2
|
-
window.dispatchEvent(new Event('resize'));
|
3
|
-
};
|
1
|
+
export const resizeWindow = () => {
|
2
|
+
window.dispatchEvent(new Event('resize'));
|
3
|
+
};
|
4
4
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVzaXplLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvdXRpbC9vdGhlci9yZXNpemUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxDQUFDLE1BQU0sWUFBWSxHQUFHLEdBQVMsRUFBRTtJQUNyQyxNQUFNLENBQUMsYUFBYSxDQUFDLElBQUksS0FBSyxDQUFDLFFBQVEsQ0FBQyxDQUFDLENBQUM7QUFDNUMsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNvbnN0IHJlc2l6ZVdpbmRvdyA9ICgpOiB2b2lkID0+IHtcbiAgd2luZG93LmRpc3BhdGNoRXZlbnQobmV3IEV2ZW50KCdyZXNpemUnKSk7XG59O1xuIl19
|
@@ -1,23 +1,23 @@
|
|
1
|
-
import { Pipe } from '@angular/core';
|
2
|
-
import * as i0 from "@angular/core";
|
3
|
-
import * as i1 from "@yelon/util/format";
|
4
|
-
export class CurrencyCNYPipe {
|
5
|
-
constructor(srv) {
|
6
|
-
this.srv = srv;
|
7
|
-
}
|
8
|
-
/**
|
9
|
-
* Converted into RMB notation.
|
10
|
-
*
|
11
|
-
* 转化成人民币表示法
|
12
|
-
*/
|
13
|
-
transform(value, options) {
|
14
|
-
return this.srv.cny(value, options);
|
15
|
-
}
|
16
|
-
}
|
17
|
-
CurrencyCNYPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
18
|
-
CurrencyCNYPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.
|
19
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
20
|
-
type: Pipe,
|
21
|
-
args: [{ name: 'cny' }]
|
22
|
-
}], ctorParameters: function () { return [{ type: i1.CurrencyService }]; } });
|
1
|
+
import { Pipe } from '@angular/core';
|
2
|
+
import * as i0 from "@angular/core";
|
3
|
+
import * as i1 from "@yelon/util/format";
|
4
|
+
export class CurrencyCNYPipe {
|
5
|
+
constructor(srv) {
|
6
|
+
this.srv = srv;
|
7
|
+
}
|
8
|
+
/**
|
9
|
+
* Converted into RMB notation.
|
10
|
+
*
|
11
|
+
* 转化成人民币表示法
|
12
|
+
*/
|
13
|
+
transform(value, options) {
|
14
|
+
return this.srv.cny(value, options);
|
15
|
+
}
|
16
|
+
}
|
17
|
+
CurrencyCNYPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CurrencyCNYPipe, deps: [{ token: i1.CurrencyService }], target: i0.ɵɵFactoryTarget.Pipe });
|
18
|
+
CurrencyCNYPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: CurrencyCNYPipe, name: "cny" });
|
19
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CurrencyCNYPipe, decorators: [{
|
20
|
+
type: Pipe,
|
21
|
+
args: [{ name: 'cny' }]
|
22
|
+
}], ctorParameters: function () { return [{ type: i1.CurrencyService }]; } });
|
23
23
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY255LnBpcGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL3BpcGVzL2N1cnJlbmN5L2NueS5waXBlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxJQUFJLEVBQWl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X0=
|
@@ -1,5 +1,5 @@
|
|
1
|
-
export * from './mega.pipe';
|
2
|
-
export * from './price.pipe';
|
3
|
-
export * from './module';
|
4
|
-
export * from './cny.pipe';
|
1
|
+
export * from './mega.pipe';
|
2
|
+
export * from './price.pipe';
|
3
|
+
export * from './module';
|
4
|
+
export * from './cny.pipe';
|
5
5
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL3BpcGVzL2N1cnJlbmN5L2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsYUFBYSxDQUFDO0FBQzVCLGNBQWMsY0FBYyxDQUFDO0FBQzdCLGNBQWMsVUFBVSxDQUFDO0FBQ3pCLGNBQWMsWUFBWSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9tZWdhLnBpcGUnO1xuZXhwb3J0ICogZnJvbSAnLi9wcmljZS5waXBlJztcbmV4cG9ydCAqIGZyb20gJy4vbW9kdWxlJztcbmV4cG9ydCAqIGZyb20gJy4vY255LnBpcGUnO1xuIl19
|