@yelon/util 12.0.10 → 12.0.11
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 +655 -655
- 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 +431 -431
- 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 +35 -35
- 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 +283 -283
- 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 +6 -6
- 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,104 +1,104 @@
|
|
1
|
-
import { Platform } from '@angular/cdk/platform';
|
2
|
-
import { DOCUMENT } from '@angular/common';
|
3
|
-
import { Inject, Injectable } from '@angular/core';
|
4
|
-
import * as i0 from "@angular/core";
|
5
|
-
import * as i1 from "@angular/common";
|
6
|
-
import * as i2 from "@angular/cdk/platform";
|
7
|
-
/**
|
8
|
-
* A set of simple Cookie manipulation classes.
|
9
|
-
*
|
10
|
-
* 一组简单的 Cookie 操作类。
|
11
|
-
*/
|
12
|
-
export class CookieService {
|
13
|
-
constructor(_doc, platform) {
|
14
|
-
this._doc = _doc;
|
15
|
-
this.platform = platform;
|
16
|
-
}
|
17
|
-
get doc() {
|
18
|
-
return this._doc || document;
|
19
|
-
}
|
20
|
-
/**
|
21
|
-
* Original cookie value
|
22
|
-
*
|
23
|
-
* 原始Cookie值
|
24
|
-
*/
|
25
|
-
get cookie() {
|
26
|
-
return this.platform.isBrowser ? this.doc.cookie : '';
|
27
|
-
}
|
28
|
-
/**
|
29
|
-
* Get all cookie key-value pairs
|
30
|
-
*
|
31
|
-
* 获取所有Cookie键值对
|
32
|
-
*/
|
33
|
-
getAll() {
|
34
|
-
const ret = {};
|
35
|
-
const arr = this.cookie.split('; ');
|
36
|
-
for (let i = 0; i < arr.length; i++) {
|
37
|
-
const cookie = arr[i];
|
38
|
-
const index = cookie.indexOf('=');
|
39
|
-
if (index > 0) {
|
40
|
-
const name = decodeURIComponent(cookie.substring(0, index));
|
41
|
-
if (ret[name] == null) {
|
42
|
-
ret[name] = decodeURIComponent(cookie.substring(index + 1));
|
43
|
-
}
|
44
|
-
}
|
45
|
-
}
|
46
|
-
return ret;
|
47
|
-
}
|
48
|
-
/**
|
49
|
-
* Get the value of given cookie `key`
|
50
|
-
*
|
51
|
-
* 获取指定 `key` 的值
|
52
|
-
*/
|
53
|
-
get(key) {
|
54
|
-
return this.getAll()[key];
|
55
|
-
}
|
56
|
-
/**
|
57
|
-
* Sets a value for given cookie key
|
58
|
-
*
|
59
|
-
* 设置指定 Cookie 键的值
|
60
|
-
*/
|
61
|
-
put(key, value, options) {
|
62
|
-
if (!this.platform.isBrowser) {
|
63
|
-
return;
|
64
|
-
}
|
65
|
-
const opt = Object.assign({ path: '/' }, options);
|
66
|
-
if (typeof opt.expires === 'number') {
|
67
|
-
opt.expires = new Date(+new Date() + opt.expires * 1e3);
|
68
|
-
}
|
69
|
-
if (typeof opt.expires !== 'string') {
|
70
|
-
opt.expires = opt.expires ? opt.expires.toUTCString() : '';
|
71
|
-
}
|
72
|
-
const optStr = opt;
|
73
|
-
const attributes = Object.keys(optStr)
|
74
|
-
.filter(k => optStr[k] && optStr[k] !== true)
|
75
|
-
.map(k => `${k}=${optStr[k].split(';')[0]}`)
|
76
|
-
.join(';');
|
77
|
-
this.doc.cookie = `${encodeURIComponent(String(key))}=${encodeURIComponent(String(value))}${attributes ? `; ${attributes}` : ''}`;
|
78
|
-
}
|
79
|
-
/**
|
80
|
-
* Remove given cookie
|
81
|
-
*
|
82
|
-
* 移除指定 Cookie
|
83
|
-
*/
|
84
|
-
remove(key, options) {
|
85
|
-
this.put(key, undefined, options);
|
86
|
-
}
|
87
|
-
/**
|
88
|
-
* Remove all cookies
|
89
|
-
*
|
90
|
-
* 移除所有 Cookies
|
91
|
-
*/
|
92
|
-
removeAll() {
|
93
|
-
this.doc.cookie = '';
|
94
|
-
}
|
95
|
-
}
|
96
|
-
CookieService.ɵprov = i0.ɵɵdefineInjectable({ factory: function CookieService_Factory() { return new CookieService(i0.ɵɵinject(i1.DOCUMENT), i0.ɵɵinject(i2.Platform)); }, token: CookieService, providedIn: "root" });
|
97
|
-
CookieService.decorators = [
|
98
|
-
{ type: Injectable, args: [{ providedIn: 'root' },] }
|
99
|
-
];
|
100
|
-
CookieService.ctorParameters = () => [
|
101
|
-
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
|
102
|
-
{ type: Platform }
|
103
|
-
];
|
1
|
+
import { Platform } from '@angular/cdk/platform';
|
2
|
+
import { DOCUMENT } from '@angular/common';
|
3
|
+
import { Inject, Injectable } from '@angular/core';
|
4
|
+
import * as i0 from "@angular/core";
|
5
|
+
import * as i1 from "@angular/common";
|
6
|
+
import * as i2 from "@angular/cdk/platform";
|
7
|
+
/**
|
8
|
+
* A set of simple Cookie manipulation classes.
|
9
|
+
*
|
10
|
+
* 一组简单的 Cookie 操作类。
|
11
|
+
*/
|
12
|
+
export class CookieService {
|
13
|
+
constructor(_doc, platform) {
|
14
|
+
this._doc = _doc;
|
15
|
+
this.platform = platform;
|
16
|
+
}
|
17
|
+
get doc() {
|
18
|
+
return this._doc || document;
|
19
|
+
}
|
20
|
+
/**
|
21
|
+
* Original cookie value
|
22
|
+
*
|
23
|
+
* 原始Cookie值
|
24
|
+
*/
|
25
|
+
get cookie() {
|
26
|
+
return this.platform.isBrowser ? this.doc.cookie : '';
|
27
|
+
}
|
28
|
+
/**
|
29
|
+
* Get all cookie key-value pairs
|
30
|
+
*
|
31
|
+
* 获取所有Cookie键值对
|
32
|
+
*/
|
33
|
+
getAll() {
|
34
|
+
const ret = {};
|
35
|
+
const arr = this.cookie.split('; ');
|
36
|
+
for (let i = 0; i < arr.length; i++) {
|
37
|
+
const cookie = arr[i];
|
38
|
+
const index = cookie.indexOf('=');
|
39
|
+
if (index > 0) {
|
40
|
+
const name = decodeURIComponent(cookie.substring(0, index));
|
41
|
+
if (ret[name] == null) {
|
42
|
+
ret[name] = decodeURIComponent(cookie.substring(index + 1));
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
return ret;
|
47
|
+
}
|
48
|
+
/**
|
49
|
+
* Get the value of given cookie `key`
|
50
|
+
*
|
51
|
+
* 获取指定 `key` 的值
|
52
|
+
*/
|
53
|
+
get(key) {
|
54
|
+
return this.getAll()[key];
|
55
|
+
}
|
56
|
+
/**
|
57
|
+
* Sets a value for given cookie key
|
58
|
+
*
|
59
|
+
* 设置指定 Cookie 键的值
|
60
|
+
*/
|
61
|
+
put(key, value, options) {
|
62
|
+
if (!this.platform.isBrowser) {
|
63
|
+
return;
|
64
|
+
}
|
65
|
+
const opt = Object.assign({ path: '/' }, options);
|
66
|
+
if (typeof opt.expires === 'number') {
|
67
|
+
opt.expires = new Date(+new Date() + opt.expires * 1e3);
|
68
|
+
}
|
69
|
+
if (typeof opt.expires !== 'string') {
|
70
|
+
opt.expires = opt.expires ? opt.expires.toUTCString() : '';
|
71
|
+
}
|
72
|
+
const optStr = opt;
|
73
|
+
const attributes = Object.keys(optStr)
|
74
|
+
.filter(k => optStr[k] && optStr[k] !== true)
|
75
|
+
.map(k => `${k}=${optStr[k].split(';')[0]}`)
|
76
|
+
.join(';');
|
77
|
+
this.doc.cookie = `${encodeURIComponent(String(key))}=${encodeURIComponent(String(value))}${attributes ? `; ${attributes}` : ''}`;
|
78
|
+
}
|
79
|
+
/**
|
80
|
+
* Remove given cookie
|
81
|
+
*
|
82
|
+
* 移除指定 Cookie
|
83
|
+
*/
|
84
|
+
remove(key, options) {
|
85
|
+
this.put(key, undefined, options);
|
86
|
+
}
|
87
|
+
/**
|
88
|
+
* Remove all cookies
|
89
|
+
*
|
90
|
+
* 移除所有 Cookies
|
91
|
+
*/
|
92
|
+
removeAll() {
|
93
|
+
this.doc.cookie = '';
|
94
|
+
}
|
95
|
+
}
|
96
|
+
CookieService.ɵprov = i0.ɵɵdefineInjectable({ factory: function CookieService_Factory() { return new CookieService(i0.ɵɵinject(i1.DOCUMENT), i0.ɵɵinject(i2.Platform)); }, token: CookieService, providedIn: "root" });
|
97
|
+
CookieService.decorators = [
|
98
|
+
{ type: Injectable, args: [{ providedIn: 'root' },] }
|
99
|
+
];
|
100
|
+
CookieService.ctorParameters = () => [
|
101
|
+
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
|
102
|
+
{ type: Platform }
|
103
|
+
];
|
104
104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SA9ICcnO1xuICB9XG59XG4iXX0=
|
package/esm2015/browser/copy.js
CHANGED
@@ -1,27 +1,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
|
-
document.execCommand('copy');
|
18
|
-
resolve(value);
|
19
|
-
}
|
20
|
-
finally {
|
21
|
-
if (copyTextArea && copyTextArea.parentNode) {
|
22
|
-
copyTextArea.parentNode.removeChild(copyTextArea);
|
23
|
-
}
|
24
|
-
}
|
25
|
-
});
|
26
|
-
}
|
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
|
+
document.execCommand('copy');
|
18
|
+
resolve(value);
|
19
|
+
}
|
20
|
+
finally {
|
21
|
+
if (copyTextArea && copyTextArea.parentNode) {
|
22
|
+
copyTextArea.parentNode.removeChild(copyTextArea);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
});
|
26
|
+
}
|
27
27
|
//# sourceMappingURL=data:application/json;base64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|
|
1
|
-
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaXMtZW1wdHkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2Jyb3dzZXIvaXMtZW1wdHkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7R0FJRztBQUNILE1BQU0sVUFBVSxPQUFPLENBQUMsT0FBb0I7SUFDMUMsTUFBTSxLQUFLLEdBQUcsT0FBTyxDQUFDLFVBQVUsQ0FBQztJQUNqQyxLQUFLLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLEdBQUcsS0FBSyxDQUFDLE1BQU0sRUFBRSxDQUFDLEVBQUUsRUFBRTtRQUNyQyxNQUFNLElBQUksR0FBRyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQzNCLElBQUksSUFBSSxDQUFDLFFBQVEsS0FBSyxDQUFDLElBQUssSUFBb0IsQ0FBQyxTQUFTLENB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1N0cmluZygpLnRyaW0oKS5sZW5ndGggIT09IDApIHtcbiAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9XG4gIH1cbiAgcmV0dXJuIHRydWU7XG59XG4iXX0=
|
@@ -1,89 +1,89 @@
|
|
1
|
-
import { Platform } from '@angular/cdk/platform';
|
2
|
-
import { DOCUMENT } from '@angular/common';
|
3
|
-
import { Inject, Injectable } from '@angular/core';
|
4
|
-
import * as i0 from "@angular/core";
|
5
|
-
import * as i1 from "@angular/common";
|
6
|
-
import * as i2 from "@angular/cdk/platform";
|
7
|
-
export class ScrollService {
|
8
|
-
constructor(_doc, platform) {
|
9
|
-
this._doc = _doc;
|
10
|
-
this.platform = platform;
|
11
|
-
}
|
12
|
-
_getDoc() {
|
13
|
-
return this._doc || document;
|
14
|
-
}
|
15
|
-
_getWin() {
|
16
|
-
const doc = this._getDoc();
|
17
|
-
return doc.defaultView || window;
|
18
|
-
}
|
19
|
-
/**
|
20
|
-
* 获取滚动条位置
|
21
|
-
*
|
22
|
-
* @param element 指定元素,默认 `window`
|
23
|
-
*/
|
24
|
-
getScrollPosition(element) {
|
25
|
-
if (!this.platform.isBrowser) {
|
26
|
-
return [0, 0];
|
27
|
-
}
|
28
|
-
const win = this._getWin();
|
29
|
-
if (element && element !== win) {
|
30
|
-
return [element.scrollLeft, element.scrollTop];
|
31
|
-
}
|
32
|
-
else {
|
33
|
-
return [win.pageXOffset, win.pageYOffset];
|
34
|
-
}
|
35
|
-
}
|
36
|
-
/**
|
37
|
-
* 设置滚动条位置
|
38
|
-
*
|
39
|
-
* @param element 指定元素
|
40
|
-
*/
|
41
|
-
scrollToPosition(element, position) {
|
42
|
-
if (!this.platform.isBrowser) {
|
43
|
-
return;
|
44
|
-
}
|
45
|
-
(element || this._getWin()).scrollTo(position[0], position[1]);
|
46
|
-
}
|
47
|
-
/**
|
48
|
-
* 设置滚动条至指定元素
|
49
|
-
*
|
50
|
-
* @param element 指定元素,默认 `document.body`
|
51
|
-
* @param topOffset 偏移值,默认 `0`
|
52
|
-
*/
|
53
|
-
scrollToElement(element, topOffset = 0) {
|
54
|
-
if (!this.platform.isBrowser) {
|
55
|
-
return;
|
56
|
-
}
|
57
|
-
if (!element) {
|
58
|
-
element = this._getDoc().body;
|
59
|
-
}
|
60
|
-
element.scrollIntoView();
|
61
|
-
const win = this._getWin();
|
62
|
-
if (win && win.scrollBy) {
|
63
|
-
win.scrollBy(0, element.getBoundingClientRect().top - topOffset);
|
64
|
-
if (win.pageYOffset < 20) {
|
65
|
-
win.scrollBy(0, -win.pageYOffset);
|
66
|
-
}
|
67
|
-
}
|
68
|
-
}
|
69
|
-
/**
|
70
|
-
* 滚动至顶部
|
71
|
-
*
|
72
|
-
* @param topOffset 偏移值,默认 `0`
|
73
|
-
*/
|
74
|
-
scrollToTop(topOffset = 0) {
|
75
|
-
if (!this.platform.isBrowser) {
|
76
|
-
return;
|
77
|
-
}
|
78
|
-
this.scrollToElement(this._getDoc().body, topOffset);
|
79
|
-
}
|
80
|
-
}
|
81
|
-
ScrollService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ScrollService_Factory() { return new ScrollService(i0.ɵɵinject(i1.DOCUMENT), i0.ɵɵinject(i2.Platform)); }, token: ScrollService, providedIn: "root" });
|
82
|
-
ScrollService.decorators = [
|
83
|
-
{ type: Injectable, args: [{ providedIn: 'root' },] }
|
84
|
-
];
|
85
|
-
ScrollService.ctorParameters = () => [
|
86
|
-
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
|
87
|
-
{ type: Platform }
|
88
|
-
];
|
1
|
+
import { Platform } from '@angular/cdk/platform';
|
2
|
+
import { DOCUMENT } from '@angular/common';
|
3
|
+
import { Inject, Injectable } from '@angular/core';
|
4
|
+
import * as i0 from "@angular/core";
|
5
|
+
import * as i1 from "@angular/common";
|
6
|
+
import * as i2 from "@angular/cdk/platform";
|
7
|
+
export class ScrollService {
|
8
|
+
constructor(_doc, platform) {
|
9
|
+
this._doc = _doc;
|
10
|
+
this.platform = platform;
|
11
|
+
}
|
12
|
+
_getDoc() {
|
13
|
+
return this._doc || document;
|
14
|
+
}
|
15
|
+
_getWin() {
|
16
|
+
const doc = this._getDoc();
|
17
|
+
return doc.defaultView || window;
|
18
|
+
}
|
19
|
+
/**
|
20
|
+
* 获取滚动条位置
|
21
|
+
*
|
22
|
+
* @param element 指定元素,默认 `window`
|
23
|
+
*/
|
24
|
+
getScrollPosition(element) {
|
25
|
+
if (!this.platform.isBrowser) {
|
26
|
+
return [0, 0];
|
27
|
+
}
|
28
|
+
const win = this._getWin();
|
29
|
+
if (element && element !== win) {
|
30
|
+
return [element.scrollLeft, element.scrollTop];
|
31
|
+
}
|
32
|
+
else {
|
33
|
+
return [win.pageXOffset, win.pageYOffset];
|
34
|
+
}
|
35
|
+
}
|
36
|
+
/**
|
37
|
+
* 设置滚动条位置
|
38
|
+
*
|
39
|
+
* @param element 指定元素
|
40
|
+
*/
|
41
|
+
scrollToPosition(element, position) {
|
42
|
+
if (!this.platform.isBrowser) {
|
43
|
+
return;
|
44
|
+
}
|
45
|
+
(element || this._getWin()).scrollTo(position[0], position[1]);
|
46
|
+
}
|
47
|
+
/**
|
48
|
+
* 设置滚动条至指定元素
|
49
|
+
*
|
50
|
+
* @param element 指定元素,默认 `document.body`
|
51
|
+
* @param topOffset 偏移值,默认 `0`
|
52
|
+
*/
|
53
|
+
scrollToElement(element, topOffset = 0) {
|
54
|
+
if (!this.platform.isBrowser) {
|
55
|
+
return;
|
56
|
+
}
|
57
|
+
if (!element) {
|
58
|
+
element = this._getDoc().body;
|
59
|
+
}
|
60
|
+
element.scrollIntoView();
|
61
|
+
const win = this._getWin();
|
62
|
+
if (win && win.scrollBy) {
|
63
|
+
win.scrollBy(0, element.getBoundingClientRect().top - topOffset);
|
64
|
+
if (win.pageYOffset < 20) {
|
65
|
+
win.scrollBy(0, -win.pageYOffset);
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
/**
|
70
|
+
* 滚动至顶部
|
71
|
+
*
|
72
|
+
* @param topOffset 偏移值,默认 `0`
|
73
|
+
*/
|
74
|
+
scrollToTop(topOffset = 0) {
|
75
|
+
if (!this.platform.isBrowser) {
|
76
|
+
return;
|
77
|
+
}
|
78
|
+
this.scrollToElement(this._getDoc().body, topOffset);
|
79
|
+
}
|
80
|
+
}
|
81
|
+
ScrollService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ScrollService_Factory() { return new ScrollService(i0.ɵɵinject(i1.DOCUMENT), i0.ɵɵinject(i2.Platform)); }, token: ScrollService, providedIn: "root" });
|
82
|
+
ScrollService.decorators = [
|
83
|
+
{ type: Injectable, args: [{ providedIn: 'root' },] }
|
84
|
+
];
|
85
|
+
ScrollService.ctorParameters = () => [
|
86
|
+
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
|
87
|
+
{ type: Platform }
|
88
|
+
];
|
89
89
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Nyb2xsLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2Jyb3dzZXIvc2Nyb2xsLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ2pELE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUMzQyxPQUFPLEVBQUUsTUFBTSxFQUFFLFVBQVUsRUFBRSxNQUFNLGVBQWUsQ0FBQzs7OztBQUtuRCxNQUFNLE9BQU8sYUFBYTtJQVV4QixZQUFzQyxJQUFlLEVBQVUsUUFBa0I7UUFBM0MsU0FBSSxHQUFKLElBQUksQ0FBVztRQUFVLGFBQVEsR0FBUixRQUFRLENBQVU7SUFBRyxDQUFDO0lBVDdFLE9BQU87UUFDYixPQUFPLEl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XG4gICAgaWYgKCFlbGVtZW50KSB7XG4gICAgICBlbGVtZW50ID0gdGhpcy5fZ2V0RG9jKCkuYm9keTtcbiAgICB9XG5cbiAgICBlbGVtZW50LnNjcm9sbEludG9WaWV3KCk7XG5cbiAgICBjb25zdCB3aW4gPSB0aGlzLl9nZXRXaW4oKTtcbiAgICBpZiAod2luICYmIHdpbi5zY3JvbGxCeSkge1xuICAgICAgd2luLnNjcm9sbEJ5KDAsIGVsZW1lbnQhLmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpLnRvcCAtIHRvcE9mZnNldCk7XG5cbiAgICAgIGlmICh3aW4ucGFnZVlPZmZzZXQgPCAyMCkge1xuICAgICAgICB3aW4uc2Nyb2xsQnkoMCwgLXdpbi5wYWdlWU9mZnNldCk7XG4gICAgICB9XG4gICAgfVxuICB9XG5cbiAgLyoqXG4gICAqIOa7muWKqOiHs+mhtumDqFxuICAgKlxuICAgKiBAcGFyYW0gdG9wT2Zmc2V0IOWBj+enu+WAvO+8jOm7mOiupCBgMGBcbiAgICovXG4gIHNjcm9sbFRvVG9wKHRvcE9mZnNldDogbnVtYmVyID0gMCk6IHZvaWQge1xuICAgIGlmICghdGhpcy5wbGF0Zm9ybS5pc0Jyb3dzZXIpIHtcbiAgICAgIHJldHVybjtcbiAgICB9XG4gICAgdGhpcy5zY3JvbGxUb0VsZW1lbnQodGhpcy5fZ2V0RG9jKCkuYm9keSwgdG9wT2Zmc2V0KTtcbiAgfVxufVxuIl19
|
package/esm2015/browser/style.js
CHANGED
@@ -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 = Object.assign({}, 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, class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sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGludGVyZmFjZSBZdW56YWlFcnJvckNvbGxlY3RDb25maWcge1xuICAvKipcbiAgICog55uR5ZCs6aKR546H77yM6buY6K6k77yaYDUwMGBcbiAgICovXG4gIGZyZXE/OiBudW1iZXI7XG4gIC8qKlxuICAgKiDpobbpg6jlgY/np7vlgLzvvIzpu5jorqTvvJpgMTQ1YFxuICAgKi9cbiAgb2Zmc2V0VG9wPzogbnVtYmVyO1xufVxuIl19
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export {};
|
1
|
+
export {};
|
2
2
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW1hZ2UudHlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3V0aWwvY29uZmlnL2FiYy9pbWFnZS50eXBlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBNb2RhbE9wdGlvbnMgfSBmcm9tICduZy16b3Jyby1hbnRkL21vZGFsJztcblxuZXhwb3J0IGludGVyZmFjZSBZdW56YWlJbWFnZUNvbmZpZyB7XG4gIC8qKlxuICAgKiDpu5jorqTlpKflsI/vvIzpu5jorqTlgLzvvJpgNjRg77yM5Y2V5L2N77yacHhcbiAgICovXG4gIHNpemU/OiBudW1iZXI7XG5cbiAgLyoqXG4gICAqIOmUmeivr+WbvueJh++8jOm7mOiupO+8mmAuL2Fzc2V0cy9pbWcvbG9nby5zdmdgXG4gICAqL1xuICBlcnJvcj86IHN0cmluZztcblxuICAvKipcbiAgICog6aKE6KeI5aSn5Zu+5a+56K+d5qGG5Y+C5pWwXG4gICAqL1xuICBwcmV2aWV3TW9kYWxPcHRpb25zPzogTW9kYWxPcHRpb25zO1xufVxuIl19
|