@yelon/util 15.2.0 → 15.2.1
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/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/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 +11 -11
- 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/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 +16 -16
- 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 +16 -16
- 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 +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/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 +157 -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,103 +1,103 @@
|
|
1
|
-
import { DOCUMENT } from '@angular/common';
|
2
|
-
import { Inject, Injectable } from '@angular/core';
|
3
|
-
import * as i0 from "@angular/core";
|
4
|
-
import * as i1 from "@angular/cdk/platform";
|
5
|
-
/**
|
6
|
-
* A set of simple Cookie manipulation classes.
|
7
|
-
*
|
8
|
-
* 一组简单的 Cookie 操作类。
|
9
|
-
*/
|
10
|
-
export class CookieService {
|
11
|
-
get doc() {
|
12
|
-
return this._doc || document;
|
13
|
-
}
|
14
|
-
/**
|
15
|
-
* Original cookie value
|
16
|
-
*
|
17
|
-
* 原始Cookie值
|
18
|
-
*/
|
19
|
-
get cookie() {
|
20
|
-
return this.platform.isBrowser ? this.doc.cookie : '';
|
21
|
-
}
|
22
|
-
constructor(_doc, platform) {
|
23
|
-
this._doc = _doc;
|
24
|
-
this.platform = platform;
|
25
|
-
}
|
26
|
-
/**
|
27
|
-
* Get all cookie key-value pairs
|
28
|
-
*
|
29
|
-
* 获取所有Cookie键值对
|
30
|
-
*/
|
31
|
-
getAll() {
|
32
|
-
const ret = {};
|
33
|
-
const arr = this.cookie.split('; ');
|
34
|
-
for (let i = 0; i < arr.length; i++) {
|
35
|
-
const cookie = arr[i];
|
36
|
-
const index = cookie.indexOf('=');
|
37
|
-
if (index > 0) {
|
38
|
-
const name = decodeURIComponent(cookie.substring(0, index));
|
39
|
-
if (ret[name] == null) {
|
40
|
-
ret[name] = decodeURIComponent(cookie.substring(index + 1));
|
41
|
-
}
|
42
|
-
}
|
43
|
-
}
|
44
|
-
return ret;
|
45
|
-
}
|
46
|
-
/**
|
47
|
-
* Get the value of given cookie `key`
|
48
|
-
*
|
49
|
-
* 获取指定 `key` 的值
|
50
|
-
*/
|
51
|
-
get(key) {
|
52
|
-
return this.getAll()[key];
|
53
|
-
}
|
54
|
-
/**
|
55
|
-
* Sets a value for given cookie key
|
56
|
-
*
|
57
|
-
* 设置指定 Cookie 键的值
|
58
|
-
*/
|
59
|
-
put(key, value, options) {
|
60
|
-
if (!this.platform.isBrowser) {
|
61
|
-
return;
|
62
|
-
}
|
63
|
-
const opt = { path: '/', ...options };
|
64
|
-
if (typeof opt.expires === 'number') {
|
65
|
-
opt.expires = new Date(+new Date() + opt.expires * 1e3);
|
66
|
-
}
|
67
|
-
if (typeof opt.expires !== 'string') {
|
68
|
-
opt.expires = opt.expires ? opt.expires.toUTCString() : '';
|
69
|
-
}
|
70
|
-
const optStr = opt;
|
71
|
-
const attributes = Object.keys(optStr)
|
72
|
-
.filter(k => optStr[k] && optStr[k] !== true)
|
73
|
-
.map(k => `${k}=${optStr[k].split(';')[0]}`)
|
74
|
-
.join(';');
|
75
|
-
this.doc.cookie = `${encodeURIComponent(String(key))}=${encodeURIComponent(String(value))}${attributes ? `; ${attributes}` : ''}`;
|
76
|
-
}
|
77
|
-
/**
|
78
|
-
* Remove given cookie
|
79
|
-
*
|
80
|
-
* 移除指定 Cookie
|
81
|
-
*/
|
82
|
-
remove(key, options) {
|
83
|
-
this.put(key, '', options);
|
84
|
-
}
|
85
|
-
/**
|
86
|
-
* Remove all cookies
|
87
|
-
*
|
88
|
-
* 移除所有 Cookies
|
89
|
-
*/
|
90
|
-
removeAll() {
|
91
|
-
this.doc.cookie = '';
|
92
|
-
}
|
93
|
-
}
|
94
|
-
CookieService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
95
|
-
CookieService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.
|
96
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
97
|
-
type: Injectable,
|
98
|
-
args: [{ providedIn: 'root' }]
|
99
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
100
|
-
type: Inject,
|
101
|
-
args: [DOCUMENT]
|
102
|
-
}] }, { type: i1.Platform }]; } });
|
1
|
+
import { DOCUMENT } from '@angular/common';
|
2
|
+
import { Inject, Injectable } from '@angular/core';
|
3
|
+
import * as i0 from "@angular/core";
|
4
|
+
import * as i1 from "@angular/cdk/platform";
|
5
|
+
/**
|
6
|
+
* A set of simple Cookie manipulation classes.
|
7
|
+
*
|
8
|
+
* 一组简单的 Cookie 操作类。
|
9
|
+
*/
|
10
|
+
export class CookieService {
|
11
|
+
get doc() {
|
12
|
+
return this._doc || document;
|
13
|
+
}
|
14
|
+
/**
|
15
|
+
* Original cookie value
|
16
|
+
*
|
17
|
+
* 原始Cookie值
|
18
|
+
*/
|
19
|
+
get cookie() {
|
20
|
+
return this.platform.isBrowser ? this.doc.cookie : '';
|
21
|
+
}
|
22
|
+
constructor(_doc, platform) {
|
23
|
+
this._doc = _doc;
|
24
|
+
this.platform = platform;
|
25
|
+
}
|
26
|
+
/**
|
27
|
+
* Get all cookie key-value pairs
|
28
|
+
*
|
29
|
+
* 获取所有Cookie键值对
|
30
|
+
*/
|
31
|
+
getAll() {
|
32
|
+
const ret = {};
|
33
|
+
const arr = this.cookie.split('; ');
|
34
|
+
for (let i = 0; i < arr.length; i++) {
|
35
|
+
const cookie = arr[i];
|
36
|
+
const index = cookie.indexOf('=');
|
37
|
+
if (index > 0) {
|
38
|
+
const name = decodeURIComponent(cookie.substring(0, index));
|
39
|
+
if (ret[name] == null) {
|
40
|
+
ret[name] = decodeURIComponent(cookie.substring(index + 1));
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
return ret;
|
45
|
+
}
|
46
|
+
/**
|
47
|
+
* Get the value of given cookie `key`
|
48
|
+
*
|
49
|
+
* 获取指定 `key` 的值
|
50
|
+
*/
|
51
|
+
get(key) {
|
52
|
+
return this.getAll()[key];
|
53
|
+
}
|
54
|
+
/**
|
55
|
+
* Sets a value for given cookie key
|
56
|
+
*
|
57
|
+
* 设置指定 Cookie 键的值
|
58
|
+
*/
|
59
|
+
put(key, value, options) {
|
60
|
+
if (!this.platform.isBrowser) {
|
61
|
+
return;
|
62
|
+
}
|
63
|
+
const opt = { path: '/', ...options };
|
64
|
+
if (typeof opt.expires === 'number') {
|
65
|
+
opt.expires = new Date(+new Date() + opt.expires * 1e3);
|
66
|
+
}
|
67
|
+
if (typeof opt.expires !== 'string') {
|
68
|
+
opt.expires = opt.expires ? opt.expires.toUTCString() : '';
|
69
|
+
}
|
70
|
+
const optStr = opt;
|
71
|
+
const attributes = Object.keys(optStr)
|
72
|
+
.filter(k => optStr[k] && optStr[k] !== true)
|
73
|
+
.map(k => `${k}=${optStr[k].split(';')[0]}`)
|
74
|
+
.join(';');
|
75
|
+
this.doc.cookie = `${encodeURIComponent(String(key))}=${encodeURIComponent(String(value))}${attributes ? `; ${attributes}` : ''}`;
|
76
|
+
}
|
77
|
+
/**
|
78
|
+
* Remove given cookie
|
79
|
+
*
|
80
|
+
* 移除指定 Cookie
|
81
|
+
*/
|
82
|
+
remove(key, options) {
|
83
|
+
this.put(key, '', options);
|
84
|
+
}
|
85
|
+
/**
|
86
|
+
* Remove all cookies
|
87
|
+
*
|
88
|
+
* 移除所有 Cookies
|
89
|
+
*/
|
90
|
+
removeAll() {
|
91
|
+
this.doc.cookie = '';
|
92
|
+
}
|
93
|
+
}
|
94
|
+
CookieService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CookieService, deps: [{ token: DOCUMENT }, { token: i1.Platform }], target: i0.ɵɵFactoryTarget.Injectable });
|
95
|
+
CookieService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CookieService, providedIn: 'root' });
|
96
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CookieService, decorators: [{
|
97
|
+
type: Injectable,
|
98
|
+
args: [{ providedIn: 'root' }]
|
99
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
100
|
+
type: Inject,
|
101
|
+
args: [DOCUMENT]
|
102
|
+
}] }, { type: i1.Platform }]; } });
|
103
103
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29va2llLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9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VRDU3RyaW5nKCkgOiAnJztcbiAgICB9XG4gICAgY29uc3Qgb3B0U3RyOiB7IFtrZXk6IHN0cmluZ106IHN0cmluZyB8IGJvb2xlYW4gfSA9IG9wdCBhcyBOelNhZmVBbnk7XG4gICAgY29uc3QgYXR0cmlidXRlcyA9IE9iamVjdC5rZXlzKG9wdFN0cilcbiAgICAgIC5maWx0ZXIoayA9PiBvcHRTdHJba10gJiYgb3B0U3RyW2tdICE9PSB0cnVlKVxuICAgICAgLm1hcChrID0+IGAke2t9PSR7KG9wdFN0cltrXSBhcyBzdHJpbmcpLnNwbGl0KCc7JylbMF19YClcbiAgICAgIC5qb2luKCc7Jyk7XG4gICAgdGhpcy5kb2MuY29va2llID0gYCR7ZW5jb2RlVVJJQ29tcG9uZW50KFN0cmluZyhrZXkpKX09JHtlbmNvZGVVUklDb21wb25lbnQoU3RyaW5nKHZhbHVlKSl9JHtcbiAgICAgIGF0dHJpYnV0ZXMgPyBgOyAke2F0dHJpYnV0ZXN9YCA6ICcnXG4gICAgfWA7XG4gIH1cblxuICAvKipcbiAgICogUmVtb3ZlIGdpdmVuIGNvb2tpZVxuICAgKlxuICAgKiDnp7vpmaTmjIflrpogQ29va2llXG4gICAqL1xuICByZW1vdmUoa2V5OiBzdHJpbmcsIG9wdGlvbnM/OiBDb29raWVPcHRpb25zKTogdm9pZCB7XG4gICAgdGhpcy5wdXQoa2V5LCAnJywgb3B0aW9ucyk7XG4gIH1cblxuICAvKipcbiAgICogUmVtb3ZlIGFsbCBjb29raWVzXG4gICAqXG4gICAqIOenu+mZpOaJgOaciSBDb29raWVzXG4gICAqL1xuICByZW1vdmVBbGwoKTogdm9pZCB7XG4gICAgdGhpcy5kb2MuY29va2llID0gJyc7XG4gIH1cbn1cbiJdfQ==
|
package/esm2020/browser/copy.mjs
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
/**
|
2
|
-
* Copy text to clipboard
|
3
|
-
*
|
4
|
-
* 复制字符串文档至剪贴板
|
5
|
-
*/
|
6
|
-
export function copy(value) {
|
7
|
-
return new Promise((resolve) => {
|
8
|
-
let copyTextArea = null;
|
9
|
-
try {
|
10
|
-
copyTextArea = document.createElement('textarea');
|
11
|
-
copyTextArea.style.height = '0px';
|
12
|
-
copyTextArea.style.opacity = '0';
|
13
|
-
copyTextArea.style.width = '0px';
|
14
|
-
document.body.appendChild(copyTextArea);
|
15
|
-
copyTextArea.value = value;
|
16
|
-
copyTextArea.select();
|
17
|
-
// eslint-disable-next-line deprecation/deprecation
|
18
|
-
document.execCommand('copy');
|
19
|
-
resolve(value);
|
20
|
-
}
|
21
|
-
finally {
|
22
|
-
if (copyTextArea && copyTextArea.parentNode) {
|
23
|
-
copyTextArea.parentNode.removeChild(copyTextArea);
|
24
|
-
}
|
25
|
-
}
|
26
|
-
});
|
27
|
-
}
|
1
|
+
/**
|
2
|
+
* Copy text to clipboard
|
3
|
+
*
|
4
|
+
* 复制字符串文档至剪贴板
|
5
|
+
*/
|
6
|
+
export function copy(value) {
|
7
|
+
return new Promise((resolve) => {
|
8
|
+
let copyTextArea = null;
|
9
|
+
try {
|
10
|
+
copyTextArea = document.createElement('textarea');
|
11
|
+
copyTextArea.style.height = '0px';
|
12
|
+
copyTextArea.style.opacity = '0';
|
13
|
+
copyTextArea.style.width = '0px';
|
14
|
+
document.body.appendChild(copyTextArea);
|
15
|
+
copyTextArea.value = value;
|
16
|
+
copyTextArea.select();
|
17
|
+
// eslint-disable-next-line deprecation/deprecation
|
18
|
+
document.execCommand('copy');
|
19
|
+
resolve(value);
|
20
|
+
}
|
21
|
+
finally {
|
22
|
+
if (copyTextArea && copyTextArea.parentNode) {
|
23
|
+
copyTextArea.parentNode.removeChild(copyTextArea);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
});
|
27
|
+
}
|
28
28
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29weS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL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|
-
export * from './cookie.service';
|
2
|
-
export * from './copy';
|
3
|
-
export * from './is-empty';
|
4
|
-
export * from './scroll.service';
|
5
|
-
export * from './style';
|
1
|
+
export * from './cookie.service';
|
2
|
+
export * from './copy';
|
3
|
+
export * from './is-empty';
|
4
|
+
export * from './scroll.service';
|
5
|
+
export * from './style';
|
6
6
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2Jyb3dzZXIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxrQkFBa0IsQ0FBQztBQUNqQyxjQUFjLFFBQVEsQ0FBQztBQUN2QixjQUFjLFlBQVksQ0FBQztBQUMzQixjQUFjLGtCQUFrQixDQUFDO0FBQ2pDLGNBQWMsU0FBUyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9jb29raWUuc2VydmljZSc7XG5leHBvcnQgKiBmcm9tICcuL2NvcHknO1xuZXhwb3J0ICogZnJvbSAnLi9pcy1lbXB0eSc7XG5leHBvcnQgKiBmcm9tICcuL3Njcm9sbC5zZXJ2aWNlJztcbmV4cG9ydCAqIGZyb20gJy4vc3R5bGUnO1xuIl19
|
@@ -1,19 +1,19 @@
|
|
1
|
-
/**
|
2
|
-
* Used to verify `<ng-content></ng-content>` is empty, useful for custom components.
|
3
|
-
*
|
4
|
-
* 用于校验 `<ng-content></ng-content>` 是否为空,自定义组件时蛮有用。
|
5
|
-
*/
|
6
|
-
export function isEmpty(element) {
|
7
|
-
const nodes = element.childNodes;
|
8
|
-
for (let i = 0; i < nodes.length; i++) {
|
9
|
-
const node = nodes.item(i);
|
10
|
-
if (node.nodeType === 1 && node.outerHTML.toString().trim().length !== 0) {
|
11
|
-
return false;
|
12
|
-
}
|
13
|
-
else if (node.nodeType === 3 && node.textContent.toString().trim().length !== 0) {
|
14
|
-
return false;
|
15
|
-
}
|
16
|
-
}
|
17
|
-
return true;
|
18
|
-
}
|
1
|
+
/**
|
2
|
+
* Used to verify `<ng-content></ng-content>` is empty, useful for custom components.
|
3
|
+
*
|
4
|
+
* 用于校验 `<ng-content></ng-content>` 是否为空,自定义组件时蛮有用。
|
5
|
+
*/
|
6
|
+
export function isEmpty(element) {
|
7
|
+
const nodes = element.childNodes;
|
8
|
+
for (let i = 0; i < nodes.length; i++) {
|
9
|
+
const node = nodes.item(i);
|
10
|
+
if (node.nodeType === 1 && node.outerHTML.toString().trim().length !== 0) {
|
11
|
+
return false;
|
12
|
+
}
|
13
|
+
else if (node.nodeType === 3 && node.textContent.toString().trim().length !== 0) {
|
14
|
+
return false;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
return true;
|
18
|
+
}
|
19
19
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaXMtZW1wdHkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2Jyb3dzZXIvaXMtZW1wdHkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7R0FJRztBQUNILE1BQU0sVUFBVSxPQUFPLENBQUMsT0FBb0I7SUFDMUMsTUFBTSxLQUFLLEdBQUcsT0FBTyxDQUFDLFVBQVUsQ0FBQztJQUNqQyxLQUFLLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLEdBQUcsS0FBSyxDQUFDLE1BQU0sRUFBRSxDQUFDLEVBQUUsRUFBRTtRQUNyQyxNQUFNLElBQUksR0FBRyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQzNCLElBQUksSUFBSSxDQUFDLFFBQVEsS0FBSyxDQUFDLElBQUssSUFBb0IsQ0FBQyxTQUFTLENBQUMsUU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ZygpLnRyaW0oKS5sZW5ndGggIT09IDApIHtcbiAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9XG4gIH1cbiAgcmV0dXJuIHRydWU7XG59XG4iXX0=
|
@@ -1,88 +1,88 @@
|
|
1
|
-
import { DOCUMENT } from '@angular/common';
|
2
|
-
import { Inject, Injectable } from '@angular/core';
|
3
|
-
import * as i0 from "@angular/core";
|
4
|
-
import * as i1 from "@angular/cdk/platform";
|
5
|
-
export class ScrollService {
|
6
|
-
_getDoc() {
|
7
|
-
return this._doc || document;
|
8
|
-
}
|
9
|
-
_getWin() {
|
10
|
-
const doc = this._getDoc();
|
11
|
-
return doc.defaultView || window;
|
12
|
-
}
|
13
|
-
constructor(_doc, platform) {
|
14
|
-
this._doc = _doc;
|
15
|
-
this.platform = platform;
|
16
|
-
}
|
17
|
-
/**
|
18
|
-
* 获取滚动条位置
|
19
|
-
*
|
20
|
-
* @param element 指定元素,默认 `window`
|
21
|
-
*/
|
22
|
-
getScrollPosition(element) {
|
23
|
-
if (!this.platform.isBrowser) {
|
24
|
-
return [0, 0];
|
25
|
-
}
|
26
|
-
const win = this._getWin();
|
27
|
-
if (element && element !== win) {
|
28
|
-
return [element.scrollLeft, element.scrollTop];
|
29
|
-
}
|
30
|
-
else {
|
31
|
-
return [win.scrollX, win.scrollY];
|
32
|
-
}
|
33
|
-
}
|
34
|
-
/**
|
35
|
-
* 设置滚动条位置
|
36
|
-
*
|
37
|
-
* @param element 指定元素
|
38
|
-
*/
|
39
|
-
scrollToPosition(element, position) {
|
40
|
-
if (!this.platform.isBrowser) {
|
41
|
-
return;
|
42
|
-
}
|
43
|
-
(element || this._getWin()).scrollTo(position[0], position[1]);
|
44
|
-
}
|
45
|
-
/**
|
46
|
-
* 设置滚动条至指定元素
|
47
|
-
*
|
48
|
-
* @param element 指定元素,默认 `document.body`
|
49
|
-
* @param topOffset 偏移值,默认 `0`
|
50
|
-
*/
|
51
|
-
scrollToElement(element, topOffset = 0) {
|
52
|
-
if (!this.platform.isBrowser) {
|
53
|
-
return;
|
54
|
-
}
|
55
|
-
if (!element) {
|
56
|
-
element = this._getDoc().body;
|
57
|
-
}
|
58
|
-
element.scrollIntoView();
|
59
|
-
const win = this._getWin();
|
60
|
-
if (win && win.scrollBy) {
|
61
|
-
win.scrollBy(0, element.getBoundingClientRect().top - topOffset);
|
62
|
-
if (win.scrollY < 20) {
|
63
|
-
win.scrollBy(0, -win.scrollY);
|
64
|
-
}
|
65
|
-
}
|
66
|
-
}
|
67
|
-
/**
|
68
|
-
* 滚动至顶部
|
69
|
-
*
|
70
|
-
* @param topOffset 偏移值,默认 `0`
|
71
|
-
*/
|
72
|
-
scrollToTop(topOffset = 0) {
|
73
|
-
if (!this.platform.isBrowser) {
|
74
|
-
return;
|
75
|
-
}
|
76
|
-
this.scrollToElement(this._getDoc().body, topOffset);
|
77
|
-
}
|
78
|
-
}
|
79
|
-
ScrollService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
80
|
-
ScrollService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.
|
81
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
82
|
-
type: Injectable,
|
83
|
-
args: [{ providedIn: 'root' }]
|
84
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
85
|
-
type: Inject,
|
86
|
-
args: [DOCUMENT]
|
87
|
-
}] }, { type: i1.Platform }]; } });
|
1
|
+
import { DOCUMENT } from '@angular/common';
|
2
|
+
import { Inject, Injectable } from '@angular/core';
|
3
|
+
import * as i0 from "@angular/core";
|
4
|
+
import * as i1 from "@angular/cdk/platform";
|
5
|
+
export class ScrollService {
|
6
|
+
_getDoc() {
|
7
|
+
return this._doc || document;
|
8
|
+
}
|
9
|
+
_getWin() {
|
10
|
+
const doc = this._getDoc();
|
11
|
+
return doc.defaultView || window;
|
12
|
+
}
|
13
|
+
constructor(_doc, platform) {
|
14
|
+
this._doc = _doc;
|
15
|
+
this.platform = platform;
|
16
|
+
}
|
17
|
+
/**
|
18
|
+
* 获取滚动条位置
|
19
|
+
*
|
20
|
+
* @param element 指定元素,默认 `window`
|
21
|
+
*/
|
22
|
+
getScrollPosition(element) {
|
23
|
+
if (!this.platform.isBrowser) {
|
24
|
+
return [0, 0];
|
25
|
+
}
|
26
|
+
const win = this._getWin();
|
27
|
+
if (element && element !== win) {
|
28
|
+
return [element.scrollLeft, element.scrollTop];
|
29
|
+
}
|
30
|
+
else {
|
31
|
+
return [win.scrollX, win.scrollY];
|
32
|
+
}
|
33
|
+
}
|
34
|
+
/**
|
35
|
+
* 设置滚动条位置
|
36
|
+
*
|
37
|
+
* @param element 指定元素
|
38
|
+
*/
|
39
|
+
scrollToPosition(element, position) {
|
40
|
+
if (!this.platform.isBrowser) {
|
41
|
+
return;
|
42
|
+
}
|
43
|
+
(element || this._getWin()).scrollTo(position[0], position[1]);
|
44
|
+
}
|
45
|
+
/**
|
46
|
+
* 设置滚动条至指定元素
|
47
|
+
*
|
48
|
+
* @param element 指定元素,默认 `document.body`
|
49
|
+
* @param topOffset 偏移值,默认 `0`
|
50
|
+
*/
|
51
|
+
scrollToElement(element, topOffset = 0) {
|
52
|
+
if (!this.platform.isBrowser) {
|
53
|
+
return;
|
54
|
+
}
|
55
|
+
if (!element) {
|
56
|
+
element = this._getDoc().body;
|
57
|
+
}
|
58
|
+
element.scrollIntoView();
|
59
|
+
const win = this._getWin();
|
60
|
+
if (win && win.scrollBy) {
|
61
|
+
win.scrollBy(0, element.getBoundingClientRect().top - topOffset);
|
62
|
+
if (win.scrollY < 20) {
|
63
|
+
win.scrollBy(0, -win.scrollY);
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
/**
|
68
|
+
* 滚动至顶部
|
69
|
+
*
|
70
|
+
* @param topOffset 偏移值,默认 `0`
|
71
|
+
*/
|
72
|
+
scrollToTop(topOffset = 0) {
|
73
|
+
if (!this.platform.isBrowser) {
|
74
|
+
return;
|
75
|
+
}
|
76
|
+
this.scrollToElement(this._getDoc().body, topOffset);
|
77
|
+
}
|
78
|
+
}
|
79
|
+
ScrollService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScrollService, deps: [{ token: DOCUMENT }, { token: i1.Platform }], target: i0.ɵɵFactoryTarget.Injectable });
|
80
|
+
ScrollService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScrollService, providedIn: 'root' });
|
81
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScrollService, decorators: [{
|
82
|
+
type: Injectable,
|
83
|
+
args: [{ providedIn: 'root' }]
|
84
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
85
|
+
type: Inject,
|
86
|
+
args: [DOCUMENT]
|
87
|
+
}] }, { type: i1.Platform }]; } });
|
88
88
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Nyb2xsLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2Jyb3dzZXIvc2Nyb2xsLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQzNDLE9BQU8sRUFBRSxNQUFNLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDOzs7QUFLbkQsTUFBTSxPQUFPLGFBQWE7SUFDaEIsT0FBTztRQUNiLE9BQU8sSUFBSSxDQUFDLElBQUksSUFBSSxRQUFRLENBQUM7SUFDL0IsQ0FBQztJQUVPLE9BQU87UUFDYixNQUFNLEdBQUcsR0FBRyxJQUFJLENBQUMsT0FBTyxFQUFFLENBQUM7UUFDM0I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V0dXJuO1xuICAgIH1cbiAgICBpZiAoIWVsZW1lbnQpIHtcbiAgICAgIGVsZW1lbnQgPSB0aGlzLl9nZXREb2MoKS5ib2R5O1xuICAgIH1cblxuICAgIGVsZW1lbnQuc2Nyb2xsSW50b1ZpZXcoKTtcblxuICAgIGNvbnN0IHdpbiA9IHRoaXMuX2dldFdpbigpO1xuICAgIGlmICh3aW4gJiYgd2luLnNjcm9sbEJ5KSB7XG4gICAgICB3aW4uc2Nyb2xsQnkoMCwgZWxlbWVudCEuZ2V0Qm91bmRpbmdDbGllbnRSZWN0KCkudG9wIC0gdG9wT2Zmc2V0KTtcblxuICAgICAgaWYgKHdpbi5zY3JvbGxZIDwgMjApIHtcbiAgICAgICAgd2luLnNjcm9sbEJ5KDAsIC13aW4uc2Nyb2xsWSk7XG4gICAgICB9XG4gICAgfVxuICB9XG5cbiAgLyoqXG4gICAqIOa7muWKqOiHs+mhtumDqFxuICAgKlxuICAgKiBAcGFyYW0gdG9wT2Zmc2V0IOWBj+enu+WAvO+8jOm7mOiupCBgMGBcbiAgICovXG4gIHNjcm9sbFRvVG9wKHRvcE9mZnNldDogbnVtYmVyID0gMCk6IHZvaWQge1xuICAgIGlmICghdGhpcy5wbGF0Zm9ybS5pc0Jyb3dzZXIpIHtcbiAgICAgIHJldHVybjtcbiAgICB9XG4gICAgdGhpcy5zY3JvbGxUb0VsZW1lbnQodGhpcy5fZ2V0RG9jKCkuYm9keSwgdG9wT2Zmc2V0KTtcbiAgfVxufVxuIl19
|
@@ -1,38 +1,38 @@
|
|
1
|
-
function removeClass(el, classMap, renderer) {
|
2
|
-
Object.keys(classMap).forEach(key => renderer.removeClass(el, key));
|
3
|
-
}
|
4
|
-
function addClass(el, classMap, renderer) {
|
5
|
-
for (const i in classMap) {
|
6
|
-
if (classMap[i]) {
|
7
|
-
renderer.addClass(el, i);
|
8
|
-
}
|
9
|
-
}
|
10
|
-
}
|
11
|
-
/**
|
12
|
-
* Update host component style `class`
|
13
|
-
*
|
14
|
-
* 更新宿主组件样式 `class`
|
15
|
-
*
|
16
|
-
* ```ts
|
17
|
-
* updateHostClass(
|
18
|
-
* this.el.nativeElement,
|
19
|
-
* this.renderer,
|
20
|
-
* {
|
21
|
-
* [ 'classname' ]: true,
|
22
|
-
* [ 'classname' ]: this.type === '1',
|
23
|
-
* [ this.cls ]: true,
|
24
|
-
* [ `a-${this.cls}` ]: true
|
25
|
-
* })
|
26
|
-
* ```
|
27
|
-
*/
|
28
|
-
export function updateHostClass(el, renderer, classMap, preClean = false) {
|
29
|
-
if (preClean === true) {
|
30
|
-
renderer.removeAttribute(el, 'class');
|
31
|
-
}
|
32
|
-
else {
|
33
|
-
removeClass(el, classMap, renderer);
|
34
|
-
}
|
35
|
-
classMap = { ...classMap };
|
36
|
-
addClass(el, classMap, renderer);
|
37
|
-
}
|
1
|
+
function removeClass(el, classMap, renderer) {
|
2
|
+
Object.keys(classMap).forEach(key => renderer.removeClass(el, key));
|
3
|
+
}
|
4
|
+
function addClass(el, classMap, renderer) {
|
5
|
+
for (const i in classMap) {
|
6
|
+
if (classMap[i]) {
|
7
|
+
renderer.addClass(el, i);
|
8
|
+
}
|
9
|
+
}
|
10
|
+
}
|
11
|
+
/**
|
12
|
+
* Update host component style `class`
|
13
|
+
*
|
14
|
+
* 更新宿主组件样式 `class`
|
15
|
+
*
|
16
|
+
* ```ts
|
17
|
+
* updateHostClass(
|
18
|
+
* this.el.nativeElement,
|
19
|
+
* this.renderer,
|
20
|
+
* {
|
21
|
+
* [ 'classname' ]: true,
|
22
|
+
* [ 'classname' ]: this.type === '1',
|
23
|
+
* [ this.cls ]: true,
|
24
|
+
* [ `a-${this.cls}` ]: true
|
25
|
+
* })
|
26
|
+
* ```
|
27
|
+
*/
|
28
|
+
export function updateHostClass(el, renderer, classMap, preClean = false) {
|
29
|
+
if (preClean === true) {
|
30
|
+
renderer.removeAttribute(el, 'class');
|
31
|
+
}
|
32
|
+
else {
|
33
|
+
removeClass(el, classMap, renderer);
|
34
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wZSB7IERpc2FibGVkVGltZUZuLCBOekRhdGVNb2RlLCBQcmVzZXRSYW5nZXMsIFN1cHBvcnRUaW1lT3B0aW9ucyB9IGZyb20gJ25nLXpvcnJvLWFudGQvZGF0ZS1waWNrZXInO1xuXG5leHBvcnQgaW50ZXJmYWNlIFl1bnphaURhdGVSYW5nZVBpY2tlckNvbmZpZyB7XG4gIC8qKlxuICAgKiDpu5jorqTvvJpgeXl5eS1NTS1kZGBcbiAgICovXG4gIG56Rm9ybWF0Pzogc3RyaW5nO1xuICBuekNsYXNzTmFtZT86IHN0cmluZztcbiAgbnpTaXplPzogc3RyaW5nO1xuICBuelN0eWxlPzogc3RyaW5nO1xuICAvKipcbiAgICog6buY6K6k77yaYHRydWVgXG4gICAqL1xuICBuekFsbG93Q2xlYXI/OiBib29sZWFuO1xuICAvKipcbiAgICog6buY6K6k77yaYGZhbHNlYFxuICAgKi9cbiAgbnpBdXRvRm9jdXM/OiBib29sZWFuO1xuICBuekRpc2FibGVkRGF0ZT86IChkOiBEYXRlKSA9PiBib29sZWFuO1xuICBuekRpc2FibGVkVGltZT86IERpc2FibGVkVGltZUZuO1xuICAvKipcbiAgICog6buY6K6k77yaYHsgcG9zaXRpb246ICdyZWxhdGl2ZScgfWBcbiAgICovXG4gIG56UG9wdXBTdHlsZT86IHsgW2tsYXNzOiBzdHJpbmddOiB1bmtub3duIH07XG4gIG56RHJvcGRvd25DbGFzc05hbWU/OiBzdHJpbmc7XG4gIG56UmVuZGVyRXh0cmFGb290ZXI/OiBzdHJpbmc7XG4gIG56U2hvd1RpbWU/OiBTdXBwb3J0VGltZU9wdGlvbnMgfCBib29sZWFuO1xuICAvKipcbiAgICog6buY6K6k77yaYHRydWVgXG4gICAqL1xuICBuelNob3dUb2RheT86IGJvb2xlYW47XG4gIG56TW9kZT86IE56RGF0ZU1vZGUgfCBOekRhdGVNb2RlW107XG4gIG56UmFuZ2VzPzogUHJlc2V0UmFuZ2VzO1xuICBzaG9ydGN1dHM/OiBZ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BpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGludGVyZmFjZSBZdW56YWlFcnJvckNvbGxlY3RDb25maWcge1xuICAvKipcbiAgICog55uR5ZCs6aKR546H77yM6buY6K6k77yaYDUwMGBcbiAgICovXG4gIGZyZXE/OiBudW1iZXI7XG4gIC8qKlxuICAgKiDpobbpg6jlgY/np7vlgLzvvIzpu5jorqTvvJpgMTQ1YFxuICAgKi9cbiAgb2Zmc2V0VG9wPzogbnVtYmVyO1xufVxuIl19
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export {};
|
1
|
+
export {};
|
2
2
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXhjZXB0aW9uLnR5cGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2NvbmZpZy9hYmMvZXhjZXB0aW9uLnR5cGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBpbnRlcmZhY2UgWXVuemFpRXhjZXB0aW9uVHlwZSB7XG4gIHR5cGVEaWN0PzogeyBba2V5OiBudW1iZXIgfCBzdHJpbmddOiB7IGltZzogc3RyaW5nOyB0aXRsZTogc3RyaW5nOyBkZXNjPzogc3RyaW5nIH0gfTtcbn1cbiJdfQ==
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export {};
|
1
|
+
export {};
|
2
2
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW1hZ2UudHlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3V0aWwvY29uZmlnL2FiYy9pbWFnZS50eXBlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI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