@yelon/util 18.3.0 → 19.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/browser/cookie.service.d.ts +1 -3
- package/browser/style.d.ts +1 -3
- package/config/abc/date-picker.type.d.ts +2 -5
- package/config/abc/exception.type.d.ts +5 -7
- package/config/abc/loading.type.d.ts +1 -3
- package/config/abc/media.type.d.ts +1 -2
- package/config/abc/st.type.d.ts +11 -18
- package/config/acl/acl.type.d.ts +1 -2
- package/config/chart/chart.type.d.ts +1 -4
- package/config/config.service.d.ts +5 -4
- package/config/sf/sf.type.d.ts +3 -6
- package/config/theme/responsive.type.d.ts +8 -10
- package/date-time/time.d.ts +1 -2
- package/decorator/convert.d.ts +2 -3
- package/fesm2022/array.mjs +4 -4
- package/fesm2022/array.mjs.map +1 -1
- package/fesm2022/browser.mjs +13 -16
- package/fesm2022/browser.mjs.map +1 -1
- package/fesm2022/config.mjs +33 -18
- package/fesm2022/config.mjs.map +1 -1
- package/fesm2022/date-time.mjs +1 -1
- package/fesm2022/date-time.mjs.map +1 -1
- package/fesm2022/decorator.mjs.map +1 -1
- package/fesm2022/format.mjs +9 -7
- package/fesm2022/format.mjs.map +1 -1
- package/fesm2022/mcache.mjs.map +1 -1
- package/fesm2022/mtypes.mjs +4 -5
- package/fesm2022/mtypes.mjs.map +1 -1
- package/fesm2022/other.mjs +17 -21
- package/fesm2022/other.mjs.map +1 -1
- package/fesm2022/pipe-currency.mjs +20 -26
- package/fesm2022/pipe-currency.mjs.map +1 -1
- package/fesm2022/pipe-filter.mjs +8 -8
- package/fesm2022/pipe-filter.mjs.map +1 -1
- package/fesm2022/pipe-format.mjs +8 -8
- package/fesm2022/pipe-format.mjs.map +1 -1
- package/format/string.d.ts +3 -6
- package/mtypes/header-menu.type.d.ts +2 -3
- package/mtypes/menu.type.d.ts +5 -6
- package/mtypes/page.d.ts +1 -2
- package/other/deep.d.ts +4 -7
- package/other/lazy.service.d.ts +2 -5
- package/other/logger.d.ts +3 -4
- package/other/path-to-regexp.service.d.ts +11 -12
- package/package.json +8 -42
- package/pipes/filter/filter.pipe.d.ts +1 -2
- package/esm2022/array/array-type.service.mjs +0 -2
- package/esm2022/array/array.mjs +0 -5
- package/esm2022/array/array.service.mjs +0 -278
- package/esm2022/array/index.mjs +0 -3
- package/esm2022/browser/browser.mjs +0 -5
- package/esm2022/browser/cookie.service.mjs +0 -100
- package/esm2022/browser/copy.mjs +0 -28
- package/esm2022/browser/index.mjs +0 -6
- package/esm2022/browser/is-empty.mjs +0 -19
- package/esm2022/browser/scroll.service.mjs +0 -85
- package/esm2022/browser/style.mjs +0 -38
- package/esm2022/config/abc/cell.type.mjs +0 -2
- package/esm2022/config/abc/date-picker.type.mjs +0 -2
- package/esm2022/config/abc/error-collect.type.mjs +0 -2
- package/esm2022/config/abc/exception.type.mjs +0 -2
- package/esm2022/config/abc/image.type.mjs +0 -2
- package/esm2022/config/abc/index.mjs +0 -18
- package/esm2022/config/abc/loading.type.mjs +0 -2
- package/esm2022/config/abc/lodop.type.mjs +0 -2
- package/esm2022/config/abc/media.type.mjs +0 -2
- package/esm2022/config/abc/onboarding.type.mjs +0 -2
- package/esm2022/config/abc/page-header.type.mjs +0 -2
- package/esm2022/config/abc/pdf.type.mjs +0 -2
- package/esm2022/config/abc/se.type.mjs +0 -2
- package/esm2022/config/abc/sg.type.mjs +0 -2
- package/esm2022/config/abc/st.type.mjs +0 -2
- package/esm2022/config/abc/sv.type.mjs +0 -3
- package/esm2022/config/abc/xlsx.type.mjs +0 -2
- package/esm2022/config/abc/zip.type.mjs +0 -2
- package/esm2022/config/acl/acl.type.mjs +0 -2
- package/esm2022/config/auth/auth.type.mjs +0 -2
- package/esm2022/config/bis/bis.type.mjs +0 -2
- package/esm2022/config/cache/cache.type.mjs +0 -2
- package/esm2022/config/chart/chart.type.mjs +0 -2
- package/esm2022/config/config.mjs +0 -5
- package/esm2022/config/config.service.mjs +0 -38
- package/esm2022/config/config.types.mjs +0 -12
- package/esm2022/config/index.mjs +0 -15
- package/esm2022/config/mock/mock.type.mjs +0 -2
- package/esm2022/config/sf/sf.type.mjs +0 -2
- package/esm2022/config/socket/socket.type.mjs +0 -2
- package/esm2022/config/theme/http.type.mjs +0 -2
- package/esm2022/config/theme/i18n.type.mjs +0 -2
- package/esm2022/config/theme/index.mjs +0 -5
- package/esm2022/config/theme/pipe.type.mjs +0 -2
- package/esm2022/config/theme/responsive.type.mjs +0 -2
- package/esm2022/config/util/array.type.mjs +0 -2
- package/esm2022/config/util/currency.type.mjs +0 -2
- package/esm2022/date-time/date-time.mjs +0 -5
- package/esm2022/date-time/index.mjs +0 -3
- package/esm2022/date-time/picker.mjs +0 -116
- package/esm2022/date-time/time.mjs +0 -103
- package/esm2022/decorator/convert.mjs +0 -66
- package/esm2022/decorator/decorator.mjs +0 -5
- package/esm2022/decorator/index.mjs +0 -3
- package/esm2022/decorator/zone-outside.mjs +0 -57
- package/esm2022/form/form.mjs +0 -5
- package/esm2022/form/index.mjs +0 -3
- package/esm2022/form/match-control.mjs +0 -30
- package/esm2022/form/validators.mjs +0 -81
- package/esm2022/format/currency.service.mjs +0 -233
- package/esm2022/format/currency.types.mjs +0 -8
- package/esm2022/format/format.mjs +0 -5
- package/esm2022/format/index.mjs +0 -5
- package/esm2022/format/string.mjs +0 -85
- package/esm2022/format/validate.mjs +0 -94
- package/esm2022/index.mjs +0 -14
- package/esm2022/math/in-range.mjs +0 -25
- package/esm2022/math/index.mjs +0 -3
- package/esm2022/math/math.mjs +0 -5
- package/esm2022/math/round.mjs +0 -53
- package/esm2022/mcache/index.mjs +0 -2
- package/esm2022/mcache/localStorageUtils.mjs +0 -60
- package/esm2022/mcache/mcache.mjs +0 -5
- package/esm2022/mtypes/authority.type.mjs +0 -2
- package/esm2022/mtypes/header-menu.type.mjs +0 -2
- package/esm2022/mtypes/index.mjs +0 -10
- package/esm2022/mtypes/menu.type.mjs +0 -2
- package/esm2022/mtypes/mtypes.mjs +0 -5
- package/esm2022/mtypes/nav.types.mjs +0 -9
- package/esm2022/mtypes/page.mjs +0 -42
- package/esm2022/mtypes/project-info.types.mjs +0 -2
- package/esm2022/mtypes/response.mjs +0 -2
- package/esm2022/mtypes/role.type.mjs +0 -2
- package/esm2022/mtypes/user.types.mjs +0 -2
- package/esm2022/other/assert.mjs +0 -67
- package/esm2022/other/deep.mjs +0 -78
- package/esm2022/other/favicon.mjs +0 -29
- package/esm2022/other/index.mjs +0 -8
- package/esm2022/other/lazy.service.mjs +0 -129
- package/esm2022/other/logger.mjs +0 -33
- package/esm2022/other/other.mjs +0 -5
- package/esm2022/other/path-to-regexp.service.mjs +0 -239
- package/esm2022/other/resize.mjs +0 -4
- package/esm2022/pipes/currency/cny.pipe.mjs +0 -23
- package/esm2022/pipes/currency/index.mjs +0 -5
- package/esm2022/pipes/currency/mega.pipe.mjs +0 -25
- package/esm2022/pipes/currency/module.mjs +0 -19
- package/esm2022/pipes/currency/pipe-currency.mjs +0 -5
- package/esm2022/pipes/currency/price.pipe.mjs +0 -27
- package/esm2022/pipes/filter/filter.pipe.mjs +0 -20
- package/esm2022/pipes/filter/index.mjs +0 -3
- package/esm2022/pipes/filter/module.mjs +0 -17
- package/esm2022/pipes/filter/pipe-filter.mjs +0 -5
- package/esm2022/pipes/format/index.mjs +0 -3
- package/esm2022/pipes/format/mask.pipe.mjs +0 -34
- package/esm2022/pipes/format/module.mjs +0 -17
- package/esm2022/pipes/format/pipe-format.mjs +0 -5
- package/esm2022/pipes/index.mjs +0 -4
- package/esm2022/pipes/pipes.mjs +0 -5
- package/esm2022/token/index.mjs +0 -3
- package/esm2022/token/page-visibility.mjs +0 -15
- package/esm2022/token/token.mjs +0 -5
- package/esm2022/token/window.mjs +0 -17
- package/esm2022/yelon-util.mjs +0 -5
package/esm2022/config/index.mjs
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
export * from './abc/index';
|
2
|
-
export * from './acl/acl.type';
|
3
|
-
export * from './auth/auth.type';
|
4
|
-
export * from './cache/cache.type';
|
5
|
-
export * from './chart/chart.type';
|
6
|
-
export * from './util/array.type';
|
7
|
-
export * from './util/currency.type';
|
8
|
-
export * from './theme/index';
|
9
|
-
export * from './mock/mock.type';
|
10
|
-
export * from './sf/sf.type';
|
11
|
-
export * from './config.types';
|
12
|
-
export * from './config.service';
|
13
|
-
export * from './bis/bis.type';
|
14
|
-
export * from './socket/socket.type';
|
15
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2NvbmZpZy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGFBQWEsQ0FBQztBQUM1QixjQUFjLGdCQUFnQixDQUFDO0FBQy9CLGNBQWMsa0JBQWtCLENBQUM7QUFDakMsY0FBYyxvQkFBb0IsQ0FBQztBQUNuQyxjQUFjLG9CQUFvQixDQUFDO0FBQ25DLGNBQWMsbUJBQW1CLENBQUM7QUFDbEMsY0FBYyxzQkFBc0IsQ0FBQztBQUNyQyxjQUFjLGVBQWUsQ0FBQztBQUM5QixjQUFjLGtCQUFrQixDQUFDO0FBQ2pDLGNBQWMsY0FBYyxDQUFDO0FBRTdCLGNBQWMsZ0JBQWdCLENBQUM7QUFDL0IsY0FBYyxrQkFBa0IsQ0FBQztBQUNqQyxjQUFjLGdCQUFnQixDQUFDO0FBQy9CLGNBQWMsc0JBQXNCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2FiYy9pbmRleCc7XG5leHBvcnQgKiBmcm9tICcuL2FjbC9hY2wudHlwZSc7XG5leHBvcnQgKiBmcm9tICcuL2F1dGgvYXV0aC50eXBlJztcbmV4cG9ydCAqIGZyb20gJy4vY2FjaGUvY2FjaGUudHlwZSc7XG5leHBv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iA5L2/55SoIGAxOTcwLTAxLTAxYFxuICAgKi9cbiAgdWlUaW1lTnVtYmVyRm9ybWF0Pzogc3RyaW5nO1xuICAvKipcbiAgICog5oyH5a6aIGBmb3JtYXQ6ICdlbWFpbCdgIOeahOm7mOiupEVtYWls5ZCO57yA77yM6buY6K6k77yaYFsncXEuY29tJywgJzE2My5jb20nLCAnZ21haWwuY29tJywgJzEyNi5jb20nLCAnYWxpeXVuLmNvbSddYFxuICAgKi9cbiAgdWlFbWFpbFN1ZmZpeGVzPzogc3RyaW5nW107XG4gIC8qKlxuICAgKiBXaGV0aGVyIHRvIGRlbGF5IHJlbmRlcmluZywgc2hvdWxkIGJlIG1hbnVhbGx5IGNhbGwgYHJlZnJlc2hTY2hlbWEoKWBcbiAgICpcbiAgICog5piv5ZCm5bu26L+f5riy5p+T77yM6ZyA6KaB5omL5Yqo6LCD55SoIGByZWZyZXNoU2NoZW1hKClgXG4gICAqL1xuICBkZWxheT86IGJvb2xlYW47XG59XG4iXX0=
|
@@ -1,2 +0,0 @@
|
|
1
|
-
export {};
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic29ja2V0LnR5cGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2NvbmZpZy9zb2NrZXQvc29ja2V0LnR5cGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFJ4U3RvbXBDb25maWcgfSBmcm9tICdAc3RvbXAvcngtc3RvbXAnO1xuXG5leHBvcnQgaW50ZXJmYWNlIFl1bnphaVNvY2tldENvbmZpZyBleHRlbmRzIFJ4U3RvbXBDb25maWcge1xuICBiYXNlVXJsOiBzdHJpbmc7XG59XG4iXX0=
|
@@ -1,2 +0,0 @@
|
|
1
|
-
export {};
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaHR0cC50eXBlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvdXRpbC9jb25maWcvdGhlbWUvaHR0cC50eXBlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgaW50ZXJmYWNlIFl1bnphaVRoZW1lSHR0cENsaWVudENvbmZpZyB7XG4gIC8qKlxuICAgKiDnqbrlgLzlpITnkIbvvIzpu5jorqTvvJpgaW5jbHVkZWBcbiAgICogLSBpbmNsdWRl77ya5YyF5ZCrXG4gICAqIC0gaWdub3Jl77ya5b+955WlXG4gICAqL1xuICBudWxsVmFsdWVIYW5kbGluZz86ICdpbmNsdWRlJyB8ICdpZ25vcmUnO1xuICAvKipcbiAgICog5pe26Ze05YC85aSE55CG77yM6buY6K6k77yaYHRpbWVzdGFtcGBcbiAgICogLSB0aW1lc3RhbXDvvJrml7bpl7TmiLPmr6vnp5LnuqdcbiAgICogLSB0aW1lc3RhbXBTZWNvbmTvvJrml7bpl7TmiLPnp5LnuqdcbiAgICogLSBpZ25vcmXvvJrlv73nlaXlpITnkIbvvIzkv53mjIHljp/lp4vnirbmgIFcbiAgICovXG4gIGRhdGVWYWx1ZUhhbmRsaW5nPzogJ3RpbWVzdGFtcCcgfCAndGltZXN0YW1wU2Vjb25kJyB8ICdpZ25vcmUnO1xufVxuIl19
|
@@ -1,2 +0,0 @@
|
|
1
|
-
export {};
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaTE4bi50eXBlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvdXRpbC9jb25maWcvdGhlbWUvaTE4bi50eXBlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgaW50ZXJmYWNlIFl1bnphaVRoZW1lSTE4bkNvbmZpZyB7XG4gIC8qKlxuICAgKiBPdmVycmlkZXMgdGhlIGRlZmF1bHQgaW50ZXJwb2xhdGlvbiBzdGFydCBhbmQgZW5kIGRlbGltaXRlcnMgKHt7IGFuZCB9fSkuXG4gICAqXG4gICAqIOaUueWGmem7mOiupOeahOaPkuWAvOihqOi+vuW8j+i1t+atouWIhueVjOespu+8iHt7IOWSjCB9fe+8ieOAglxuICAgKi9cbiAgaW50ZXJwb2xhdGlvbj86IFtzdHJpbmcsIHN0cmluZ107XG5cbiAgLyoqXG4gICAqIEludGVybmF0aW9uYWxpemF0aW9uIGNvZGUgVVJMIGd1YXJkIHBhcmFtZXRlciBuYW1lLCBkZWZhdWx0OiBgaTE4bmBcbiAgICpcbiAgICog5Zu96ZmF5YyW5Luj56CBIFVSTCDlrojljavlj4LmlbDlkI3vvIzpu5jorqTvvJpgaTE4bmBcbiAgICovXG4gIHBhcmFtTmFtZU9mVXJsR3VhcmQ/OiBzdHJpbmc7XG59XG4iXX0=
|
@@ -1,5 +0,0 @@
|
|
1
|
-
export * from './http.type';
|
2
|
-
export * from './responsive.type';
|
3
|
-
export * from './i18n.type';
|
4
|
-
export * from './pipe.type';
|
5
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2NvbmZpZy90aGVtZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGFBQWEsQ0FBQztBQUM1QixjQUFjLG1CQUFtQixDQUFDO0FBQ2xDLGNBQWMsYUFBYSxDQUFDO0FBQzVCLGNBQWMsYUFBYSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9odHRwLnR5cGUnO1xuZXhwb3J0ICogZnJvbSAnLi9yZXNwb25zaXZlLnR5cGUnO1xuZXhwb3J0ICogZnJvbSAnLi9pMThuLnR5cGUnO1xuZXhwb3J0ICogZnJvbSAnLi9waXBlLnR5cGUnO1xuIl19
|
@@ -1,2 +0,0 @@
|
|
1
|
-
export {};
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGlwZS50eXBlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvdXRpbC9jb25maWcvdGhlbWUvcGlwZS50eXBlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgaW50ZXJmYWNlIFl1bnphaVRoZW1lUGlwZUNvbmZpZyB7XG4gIGRhdGVGb3JtYXQ/OiBzdHJpbmc7XG4gIGRhdGVGb3JtYXRDdXN0b20/OiBZdW56YWlUaGVtZVBpcGVEYXRlRm9ybWF0Q3VzdG9tO1xufVxuXG5leHBvcnQgdHlwZSBZdW56YWlUaGVtZVBpcGVEYXRlRm9ybWF0Q3VzdG9tID0gKFxuICB2YWx1ZTogRGF0ZSxcbiAgZm9ybWF0U3RyaW5nPzogc3RyaW5nIHwgbnVsbCxcbiAgb3B0aW9ucz86IHsgbG9jYWxlPzogTG9jYWxlIH1cbikgPT4gc3RyaW5nO1xuIl19
|
@@ -1,2 +0,0 @@
|
|
1
|
-
export {};
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVzcG9uc2l2ZS50eXBlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvdXRpbC9jb25maWcvdGhlbWUvcmVzcG9uc2l2ZS50eXBlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgaW50ZXJmYWNlIFl1bnphaVRoZW1lUmVzcG9uc2l2ZUNvbmZpZyB7XG4gIHJ1bGVzOiB7XG4gICAgW2tleTogbnVtYmVyXToge1xuICAgICAgeHM6IG51bWJlcjtcbiAgICAgIHNtPzogbnVtYmVyO1xuICAgICAgbWQ/OiBudW1iZXI7XG4gICAgICBsZz86IG51bWJlcjtcbiAgICAgIHhsPzogbnVtYmVyO1xuICAgICAgeHhsPzogbnVtYmVyO1xuICAgIH07XG4gIH07XG59XG4iXX0=
|
@@ -1,2 +0,0 @@
|
|
1
|
-
export {};
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXJyYXkudHlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3V0aWwvY29uZmlnL3V0aWwvYXJyYXkudHlwZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGludGVyZmFjZSBZdW56YWlVdGlsQXJyYXlDb25maWcge1xuICAvKiog5rex5bqm6aG55ZCN77yM6buY6K6k77yaYCdkZWVwJ2AgKi9cbiAgZGVlcE1hcE5hbWU/OiBzdHJpbmc7XG4gIC8qKiDmiYHlubPlkI7mlbDnu4TnmoTniLbmlbDmja7pobnlkI3vvIzpu5jorqTvvJpgJ3BhcmVudCdgICovXG4gIHBhcmVudE1hcE5hbWU/OiBzdHJpbmc7XG4gIC8qKiDnvJblj7fpobnlkI3vvIzpu5jorqTvvJpgJ2lkJ2AgKi9cbiAgaWRNYXBOYW1lPzogc3RyaW5nO1xuICAvKiog54i257yW5Y+36aG55ZCN77yM6buY6K6k77yaYCdwYXJlbnRfaWQnYCAqL1xuICBwYXJlbnRJZE1hcE5hbWU/OiBzdHJpbmc7XG4gIC8qKiDmupDmlbDmja7lrZDpobnlkI3vvIzpu5jorqTvvJpgJ2NoaWxkcmVuJ2AgKi9cbiAgY2hpbGRyZW5NYXBOYW1lPzogc3RyaW5nO1xuICAvKiog5qCH6aKY6aG55ZCN77yM6buY6K6k77yaYCd0aXRsZSdgICovXG4gIHRpdGxlTWFwTmFtZT86IHN0cmluZztcbiAgLyoqIOiKgueCuSBDaGVja2JveCDmmK/lkKbpgInkuK3pobnlkI3vvIzpu5jorqTvvJpgJ2NoZWNrZWQnYCAqL1xuICBjaGVja2VkTWFwbmFtZT86IHN0cmluZztcbiAgLyoqIOiKgueCueacrOi6q+aYr+WQpumAieS4remhueWQje+8jOm7mOiupO+8mmAnc2VsZWN0ZWQnYCAqL1xuICBzZWxlY3RlZE1hcG5hbWU/OiBzdHJpbmc7XG4gIC8qKiDoioLngrnmmK/lkKblsZXlvIAo5Y+25a2Q6IqC54K55peg5pWIKemhueWQje+8jOm7mOiupO+8mmAnZXhwYW5kZWQnYCAqL1xuICBleHBhbmRlZE1hcG5hbWU/OiBzdHJpbmc7XG4gIC8qKiDorr7nva7mmK/lkKbnpoHnlKjoioLngrko5LiN5Y+v6L+b6KGM5Lu75L2V5pON5L2cKemhueWQje+8jOm7mOiupO+8mmAnZGlzYWJsZWQnYCAqL1xuICBkaXNhYmxlZE1hcG5hbWU/OiBzdHJpbmc7XG59XG4iXX0=
|
@@ -1,2 +0,0 @@
|
|
1
|
-
export {};
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VycmVuY3kudHlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3V0aWwvY29uZmlnL3V0aWwvY3VycmVuY3kudHlwZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGludGVyZmFjZSB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czovL2FuZ3VsYXIuY24vYXBpL2NvbW1vbi9DdXJyZW5jeVBpcGUpXG4gICAqL1xuICBuZ0N1cnJlbmN5Pzoge1xuICAgIGRpc3BsYXk6ICdjb2RlJyB8ICdzeW1ib2wnIHwgJ3N5bWJvbC1uYXJyb3cnO1xuICAgIGN1cnJlbmN5Q29kZT86IHN0cmluZztcbiAgICBkaWdpdHNJbmZvPzogc3RyaW5nO1xuICAgIGxvY2FsZT86IHN0cmluZztcbiAgfTtcbn1cbiJdfQ==
|
@@ -1,5 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Generated bundle index. Do not edit.
|
3
|
-
*/
|
4
|
-
export * from './index';
|
5
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0ZS10aW1lLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvdXRpbC9kYXRlLXRpbWUvZGF0ZS10aW1lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuIl19
|
@@ -1,3 +0,0 @@
|
|
1
|
-
export * from './time';
|
2
|
-
export * from './picker';
|
3
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2RhdGUtdGltZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLFFBQVEsQ0FBQztBQUN2QixjQUFjLFVBQVUsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vdGltZSc7XG5leHBvcnQgKiBmcm9tICcuL3BpY2tlcic7XG4iXX0=
|
@@ -1,116 +0,0 @@
|
|
1
|
-
import { addDays, addSeconds, differenceInCalendarDays, format } from 'date-fns';
|
2
|
-
// TODO: timezone process
|
3
|
-
export class DateTimePickerUtil {
|
4
|
-
/**
|
5
|
-
* Current local time
|
6
|
-
*
|
7
|
-
* 当前本地时间
|
8
|
-
*/
|
9
|
-
get now() {
|
10
|
-
return new Date();
|
11
|
-
}
|
12
|
-
/**
|
13
|
-
* Current local date (not including time part)
|
14
|
-
*
|
15
|
-
* 当前本地日期(不包含时间部分)
|
16
|
-
*/
|
17
|
-
get date() {
|
18
|
-
return this.removeTime(this.now);
|
19
|
-
}
|
20
|
-
/**
|
21
|
-
* Remove the time part of the date
|
22
|
-
*
|
23
|
-
* 移除日期的时间部分
|
24
|
-
*/
|
25
|
-
removeTime(d) {
|
26
|
-
return new Date(d.toDateString());
|
27
|
-
}
|
28
|
-
/**
|
29
|
-
* Format date-time
|
30
|
-
*
|
31
|
-
* 格式化日期
|
32
|
-
*/
|
33
|
-
format(d, formatString = 'yyyy-MM-dd HH:mm:ss') {
|
34
|
-
return format(d, formatString);
|
35
|
-
}
|
36
|
-
genTick(count) {
|
37
|
-
return new Array(count).fill(0).map((_, idx) => idx);
|
38
|
-
}
|
39
|
-
/**
|
40
|
-
* Calculate the number of days between two dates, `0` means the same day
|
41
|
-
*
|
42
|
-
* 计算两个日期相差天数,`0` 表示同一天
|
43
|
-
*/
|
44
|
-
getDiffDays(dateLeft, dateRight) {
|
45
|
-
return differenceInCalendarDays(dateLeft, typeof dateRight === 'number' ? addDays(this.date, dateRight) : dateRight || this.date);
|
46
|
-
}
|
47
|
-
/**
|
48
|
-
* Disabled Before date (Default: today), Generally serves `nzDisabledDate`
|
49
|
-
*
|
50
|
-
* 禁用之前日期(默认:今天),一般服务于 `nzDisabledDate`
|
51
|
-
*/
|
52
|
-
disabledBeforeDate(options) {
|
53
|
-
return (d) => this.getDiffDays(d, options?.offsetDays) < 0;
|
54
|
-
}
|
55
|
-
/**
|
56
|
-
* Disabled After date (Default: today), Generally serves `nzDisabledDate`
|
57
|
-
*
|
58
|
-
* 禁用之后日期(默认:今天),一般服务于 `nzDisabledDate`
|
59
|
-
*/
|
60
|
-
disabledAfterDate(options) {
|
61
|
-
return (d) => this.getDiffDays(d, options?.offsetDays) > 0;
|
62
|
-
}
|
63
|
-
baseDisabledTime(type, offsetSeconds) {
|
64
|
-
const tick24 = this.genTick(24);
|
65
|
-
const tick60 = this.genTick(60);
|
66
|
-
return (current) => {
|
67
|
-
const cur = current;
|
68
|
-
if (cur == null) {
|
69
|
-
return {};
|
70
|
-
}
|
71
|
-
const now = addSeconds(this.now, offsetSeconds || 0);
|
72
|
-
const nowHours = now.getHours();
|
73
|
-
const nowMinutes = now.getMinutes();
|
74
|
-
const curHours = cur.getHours();
|
75
|
-
const isToday = this.getDiffDays(this.removeTime(cur)) === 0;
|
76
|
-
return {
|
77
|
-
nzDisabledHours: () => {
|
78
|
-
if (!isToday)
|
79
|
-
return [];
|
80
|
-
return type === 'before' ? tick24.slice(0, nowHours) : tick24.slice(nowHours + 1);
|
81
|
-
},
|
82
|
-
nzDisabledMinutes: () => {
|
83
|
-
if (isToday && curHours === nowHours) {
|
84
|
-
return type === 'before' ? tick60.slice(0, nowMinutes) : tick60.slice(nowMinutes + 1);
|
85
|
-
}
|
86
|
-
return [];
|
87
|
-
},
|
88
|
-
nzDisabledSeconds: () => {
|
89
|
-
if (isToday && curHours === nowHours && cur.getMinutes() === nowMinutes) {
|
90
|
-
const nowSeconds = now.getSeconds();
|
91
|
-
return type === 'before' ? tick60.slice(0, nowSeconds) : tick60.slice(nowSeconds + 1);
|
92
|
-
}
|
93
|
-
return [];
|
94
|
-
}
|
95
|
-
};
|
96
|
-
};
|
97
|
-
}
|
98
|
-
/**
|
99
|
-
* Disabled Before time (Default: now), Generally serves `nzDisabledTime`
|
100
|
-
*
|
101
|
-
* 禁用之前时间(默认:现在),一般服务于 `nzDisabledTime`
|
102
|
-
*/
|
103
|
-
disabledBeforeTime(options) {
|
104
|
-
return this.baseDisabledTime('before', options?.offsetSeconds);
|
105
|
-
}
|
106
|
-
/**
|
107
|
-
* Disabled After time (Default: now), Generally serves `nzDisabledTime`
|
108
|
-
*
|
109
|
-
* 禁用之后时间(默认:现在),一般服务于 `nzDisabledTime`
|
110
|
-
*/
|
111
|
-
disabledAfterTime(options) {
|
112
|
-
return this.baseDisabledTime('after', options?.offsetSeconds);
|
113
|
-
}
|
114
|
-
}
|
115
|
-
export const dateTimePickerUtil = new DateTimePickerUtil();
|
116
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGlja2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvdXRpbC9kYXRlLXRpbWUvcGlja2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxPQUFPLEVBQUUsVUFBVSxFQUFFLHdCQUF3QixFQUFFLE1BQU0sRUFBRSxNQUFNLFVBQVUsQ0FBQztBQUtqRix5QkFBeUI7QUFDekIsTUFBTSxPQUFPLGtCQUFrQjtJQUM3Qjs7OztPQUlHO0lBQ0gsSUFBSSxHQUFHO1FBQ0wsT0FBTyxJQUFJLElBQUksRUFBRSxDQUFDO0lBQ3BCLENBQUM7SUFDRDs7OztPQUlHO0lBQ0gsSUFBSSxJQUFJO1FBQ04sT0FBTyxJQUFJLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQztJQUNuQyxDQUFDO0lBQ0Q7Ozs7T0FJRztJQUNILFVBQVUsQ0FBQyxDQUFPO1FBQ2hCLE9BQU8sSUFBSSxJQUFJLENBQUMsQ0FBQyxDQUFDLFlBQVksRUFBRSxDQ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IG5vdyksIEdlbmVyYWxseSBzZXJ2ZXMgYG56RGlzYWJsZWRUaW1lYFxuICAgKlxuICAgKiDnpoHnlKjkuYvlkI7ml7bpl7TvvIjpu5jorqTvvJrnjrDlnKjvvInvvIzkuIDoiKzmnI3liqHkuo4gYG56RGlzYWJsZWRUaW1lYFxuICAgKi9cbiAgZGlzYWJsZWRBZnRlclRpbWUob3B0aW9ucz86IHsgb2Zmc2V0U2Vjb25kcz86IG51bWJlciB9KTogRGlzYWJsZWRUaW1lRm4ge1xuICAgIHJldHVybiB0aGlzLmJhc2VEaXNhYmxlZFRpbWUoJ2FmdGVyJywgb3B0aW9ucz8ub2Zmc2V0U2Vjb25kcyk7XG4gIH1cbn1cblxuZXhwb3J0IGNvbnN0IGRhdGVUaW1lUGlja2VyVXRpbCA9IG5ldyBEYXRlVGltZVBpY2tlclV0aWwoKTtcbiJdfQ==
|
@@ -1,103 +0,0 @@
|
|
1
|
-
import { addDays, endOfDay, endOfMonth, endOfWeek, endOfYear, parse, parseISO, startOfDay, startOfMonth, startOfWeek, startOfYear, subMonths, subWeeks, subYears, format, formatDistanceToNow } from 'date-fns';
|
2
|
-
/**
|
3
|
-
* Get the time range, return `[ Date, Date]` for the start and end dates
|
4
|
-
*
|
5
|
-
* 获取时间范围
|
6
|
-
*
|
7
|
-
* @param type 类型,带 `-` 表示过去一个时间,若指定 `number` 表示天数
|
8
|
-
* @param time 开始时间
|
9
|
-
* @param ignoreMaxTime 忽略追加结束日期的最大时间值
|
10
|
-
*/
|
11
|
-
export function getTimeDistance(type, time, options) {
|
12
|
-
time = time
|
13
|
-
? typeof time === 'string'
|
14
|
-
? parse(time, 'yyyy-MM-dd HH:mm:ss', new Date())
|
15
|
-
: new Date(time)
|
16
|
-
: new Date();
|
17
|
-
const opt = { weekStartsOn: 1 };
|
18
|
-
let res;
|
19
|
-
switch (type) {
|
20
|
-
case 'today':
|
21
|
-
res = [time, time];
|
22
|
-
break;
|
23
|
-
case '-today':
|
24
|
-
res = [addDays(time, -1), time];
|
25
|
-
break;
|
26
|
-
case 'yesterday':
|
27
|
-
res = [addDays(time, -1), addDays(time, -1)];
|
28
|
-
break;
|
29
|
-
case 'week':
|
30
|
-
res = [startOfWeek(time, opt), endOfWeek(time, opt)];
|
31
|
-
break;
|
32
|
-
case '-week':
|
33
|
-
res = [startOfWeek(subWeeks(time, 1), opt), endOfWeek(subWeeks(time, 1), opt)];
|
34
|
-
break;
|
35
|
-
case 'month':
|
36
|
-
res = [startOfMonth(time), endOfMonth(time)];
|
37
|
-
break;
|
38
|
-
case '-month':
|
39
|
-
res = [startOfMonth(subMonths(time, 1)), endOfMonth(subMonths(time, 1))];
|
40
|
-
break;
|
41
|
-
case 'year':
|
42
|
-
res = [startOfYear(time), endOfYear(time)];
|
43
|
-
break;
|
44
|
-
case '-year':
|
45
|
-
res = [startOfYear(subYears(time, 1)), endOfYear(subYears(time, 1))];
|
46
|
-
break;
|
47
|
-
default:
|
48
|
-
res = type > 0 ? [time, addDays(time, type)] : [addDays(time, type), time];
|
49
|
-
break;
|
50
|
-
}
|
51
|
-
return options?.ignoreMaxTime ? res : fixEndTimeOfRange(res);
|
52
|
-
}
|
53
|
-
/**
|
54
|
-
* fix time is the most, big value
|
55
|
-
*/
|
56
|
-
export function fixEndTimeOfRange(dates) {
|
57
|
-
return [startOfDay(dates[0]), endOfDay(dates[1])];
|
58
|
-
}
|
59
|
-
/**
|
60
|
-
* Convert to `Date` format
|
61
|
-
*
|
62
|
-
* @param value When is a number, it's treated as a timestamp; If it's seconds, you need to provide the `options.timestampSecond` parameter.
|
63
|
-
*/
|
64
|
-
export function toDate(value, options) {
|
65
|
-
const { formatString, defaultValue, timestampSecond } = {
|
66
|
-
formatString: 'yyyy-MM-dd HH:mm:ss',
|
67
|
-
defaultValue: new Date(NaN),
|
68
|
-
timestampSecond: false,
|
69
|
-
...(typeof options === 'string' ? { formatString: options } : options)
|
70
|
-
};
|
71
|
-
if (value == null) {
|
72
|
-
return defaultValue;
|
73
|
-
}
|
74
|
-
if (value instanceof Date) {
|
75
|
-
return value;
|
76
|
-
}
|
77
|
-
if (typeof value === 'number' || (typeof value === 'string' && /^[0-9]+$/.test(value))) {
|
78
|
-
const valueNumber = +value;
|
79
|
-
return new Date(timestampSecond ? valueNumber * 1000 : valueNumber);
|
80
|
-
}
|
81
|
-
let tryDate = parseISO(value);
|
82
|
-
if (isNaN(tryDate)) {
|
83
|
-
tryDate = parse(value, formatString, new Date());
|
84
|
-
}
|
85
|
-
return isNaN(tryDate) ? defaultValue : tryDate;
|
86
|
-
}
|
87
|
-
/**
|
88
|
-
* Format date, supports `Date, number, string` types
|
89
|
-
*
|
90
|
-
* @param value When is a number, it is treated as a timestamp (Support seconds and milliseconds timestamp).
|
91
|
-
* @param formatString Please refer to [date-fnd format](https://date-fns.org/v2.30.0/docs/format) for string format
|
92
|
-
* @param dateLocale Recommended to be consistent with NG-ZORRO by using `inject(NZ_DATE_LOCALE)`
|
93
|
-
*/
|
94
|
-
export function formatDate(value, formatString, options) {
|
95
|
-
value = toDate(value);
|
96
|
-
if (isNaN(value))
|
97
|
-
return '';
|
98
|
-
const langOpt = { locale: options?.locale };
|
99
|
-
return formatString === 'fn'
|
100
|
-
? formatDistanceToNow(value, langOpt)
|
101
|
-
: (options?.customFormat ?? format)(value, formatString, langOpt);
|
102
|
-
}
|
103
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGltZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3V0aWwvZGF0ZS10aW1lL3RpbWUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUNMLE9BQU8sRUFDUCxRQUFRLEVBQ1IsVUFBVSxFQUNWLFNBQVMsRUFDVCxTQUFTLEVBQ1QsS0FBSyxFQUNMLFFBQVEsRUFDUixVQUFVLEVBQ1YsWUFBWSxFQUN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19
|
@@ -1,66 +0,0 @@
|
|
1
|
-
import { warn } from '@yelon/util/other';
|
2
|
-
function propDecoratorFactory(name, fallback, defaultValue) {
|
3
|
-
function propDecorator(target, propName, originalDescriptor) {
|
4
|
-
const privatePropName = `$$__${propName}`;
|
5
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
6
|
-
if (Object.prototype.hasOwnProperty.call(target, privatePropName)) {
|
7
|
-
warn(`The prop "${privatePropName}" is already exist, it will be overrided by ${name} decorator.`);
|
8
|
-
}
|
9
|
-
}
|
10
|
-
Object.defineProperty(target, privatePropName, {
|
11
|
-
configurable: true,
|
12
|
-
writable: true
|
13
|
-
});
|
14
|
-
return {
|
15
|
-
get() {
|
16
|
-
return originalDescriptor && originalDescriptor.get
|
17
|
-
? originalDescriptor.get.bind(this)()
|
18
|
-
: this[privatePropName];
|
19
|
-
},
|
20
|
-
set(value) {
|
21
|
-
if (originalDescriptor && originalDescriptor.set) {
|
22
|
-
originalDescriptor.set.bind(this)(fallback(value, defaultValue));
|
23
|
-
}
|
24
|
-
this[privatePropName] = fallback(value, defaultValue);
|
25
|
-
}
|
26
|
-
};
|
27
|
-
}
|
28
|
-
return propDecorator;
|
29
|
-
}
|
30
|
-
export function toBoolean(value, defaultValue = false) {
|
31
|
-
return value == null ? defaultValue : `${value}` !== 'false';
|
32
|
-
}
|
33
|
-
/**
|
34
|
-
* @deprecated Recommended to use the built-in `transform` and `static ngAcceptInputType_` can be removed
|
35
|
-
* - Use `@Input({ transform: booleanAttribute })` instead of `@InputBoolean()`
|
36
|
-
* - Use `@Input({ transform: (v: unknown) => (v == null ? null : booleanAttribute(v)) })` instead of `@InputBoolean(null)`
|
37
|
-
*
|
38
|
-
* Input decorator that handle a prop to do get/set automatically with toBoolean
|
39
|
-
*
|
40
|
-
* ```ts
|
41
|
-
* {AT}Input() {AT}InputBoolean() visible: boolean = false;
|
42
|
-
* {AT}Input() {AT}InputBoolean(null) visible: boolean = false;
|
43
|
-
* ```
|
44
|
-
*/
|
45
|
-
export function InputBoolean(defaultValue = false) {
|
46
|
-
return propDecoratorFactory('InputBoolean', toBoolean, defaultValue);
|
47
|
-
}
|
48
|
-
export function toNumber(value, fallbackValue = 0) {
|
49
|
-
return !isNaN(parseFloat(value)) && !isNaN(Number(value)) ? Number(value) : fallbackValue;
|
50
|
-
}
|
51
|
-
/**
|
52
|
-
* @deprecated Recommended to use the built-in `transform` and `static ngAcceptInputType_` can be removed
|
53
|
-
* - Use `@Input({ transform: numberAttribute })` instead of `@InputNumber()`
|
54
|
-
* - Use `@Input({ transform: (v: unknown) => (v == null ? null : numberAttribute(v)) })` instead of `@InputNumber(null)`
|
55
|
-
*
|
56
|
-
* Input decorator that handle a prop to do get/set automatically with toNumber
|
57
|
-
*
|
58
|
-
* ```ts
|
59
|
-
* {AT}Input() {AT}InputNumber() visible: number = 1;
|
60
|
-
* {AT}Input() {AT}InputNumber(null) visible: number = 2;
|
61
|
-
* ```
|
62
|
-
*/
|
63
|
-
export function InputNumber(defaultValue = 0) {
|
64
|
-
return propDecoratorFactory('InputNumber', toNumber, defaultValue);
|
65
|
-
}
|
66
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udmVydC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3V0aWwvZGVjb3JhdG9yL2NvbnZlcnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLElBQUksRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBTXpDLFNBQVMsb0JBQW9CLENBQzNCLElBQVksRUFDWixRQUFzQyxFQUN0QyxZQUF1QjtJQUV2QixTQUFTLGFBQWEsQ0FDcEIsTUFBaUIsRUFDakIsUUFBZ0IsRUFDaEIsa0JBQXVEO1FBRXZELE1BQU0sZUFBZSxHQUFHLE9BQU8sUUFBUSxFQUFFLENBQUM7UUFF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ZhbHVlKTtcbn1cbiJdfQ==
|
@@ -1,5 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Generated bundle index. Do not edit.
|
3
|
-
*/
|
4
|
-
export * from './index';
|
5
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVjb3JhdG9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvdXRpbC9kZWNvcmF0b3IvZGVjb3JhdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuIl19
|
@@ -1,3 +0,0 @@
|
|
1
|
-
export * from './convert';
|
2
|
-
export * from './zone-outside';
|
3
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2RlY29yYXRvci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLFdBQVcsQ0FBQztBQUMxQixjQUFjLGdCQUFnQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9jb252ZXJ0JztcbmV4cG9ydCAqIGZyb20gJy4vem9uZS1vdXRzaWRlJztcbiJdfQ==
|
@@ -1,57 +0,0 @@
|
|
1
|
-
import { warn } from '@yelon/util/other';
|
2
|
-
function makeFn(type, options) {
|
3
|
-
return (_, __, descriptor) => {
|
4
|
-
const source = descriptor.value;
|
5
|
-
descriptor.value = function (...data) {
|
6
|
-
const that = this;
|
7
|
-
const ngZone = that[options?.ngZoneName || 'ngZone'];
|
8
|
-
if (!ngZone) {
|
9
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
10
|
-
warn(`ZoneOutside: Decorator should have 'ngZone' property with 'NgZone' class.`);
|
11
|
-
}
|
12
|
-
return source.call(this, ...data);
|
13
|
-
}
|
14
|
-
let res;
|
15
|
-
ngZone[type](() => {
|
16
|
-
res = source.call(this, ...data);
|
17
|
-
});
|
18
|
-
return res;
|
19
|
-
};
|
20
|
-
return descriptor;
|
21
|
-
};
|
22
|
-
}
|
23
|
-
/**
|
24
|
-
* The decoration method runs in `runOutsideAngular`
|
25
|
-
*
|
26
|
-
* 装饰方法运行在 `runOutsideAngular` 内
|
27
|
-
*
|
28
|
-
* ```ts
|
29
|
-
* class MockClass {
|
30
|
-
* readonly ngZone = inject(NgZone);
|
31
|
-
*
|
32
|
-
* {AT}ZoneOutside()
|
33
|
-
* runOutsideAngular(): void {}
|
34
|
-
* }
|
35
|
-
* ```
|
36
|
-
*/
|
37
|
-
export function ZoneOutside(options) {
|
38
|
-
return makeFn('runOutsideAngular', options);
|
39
|
-
}
|
40
|
-
/**
|
41
|
-
* The decoration method runs in `run`
|
42
|
-
*
|
43
|
-
* 装饰方法运行在 `run` 内
|
44
|
-
*
|
45
|
-
* ```ts
|
46
|
-
* class MockClass {
|
47
|
-
* readonly ngZone = inject(NgZone);
|
48
|
-
*
|
49
|
-
* {AT}ZoneRun()
|
50
|
-
* run(): void {}
|
51
|
-
* }
|
52
|
-
* ```
|
53
|
-
*/
|
54
|
-
export function ZoneRun(options) {
|
55
|
-
return makeFn('run', options);
|
56
|
-
}
|
57
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiem9uZS1vdXRzaWRlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvdXRpbC9kZWNvcmF0b3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oJ3J1bk91dHNpZGVBbmd1bGFyJywgb3B0aW9ucyk7XG59XG5cbi8qKlxuICogVGhlIGRlY29yYXRpb24gbWV0aG9kIHJ1bnMgaW4gYHJ1bmBcbiAqXG4gKiDoo4XppbDmlrnms5Xov5DooYzlnKggYHJ1bmAg5YaFXG4gKlxuICogYGBgdHNcbiAqIGNsYXNzIE1vY2tDbGFzcyB7XG4gKiAgcmVhZG9ubHkgbmdab25lID0gaW5qZWN0KE5nWm9uZSk7XG4gKlxuICogIHtBVH1ab25lUnVuKClcbiAqICBydW4oKTogdm9pZCB7fVxuICogfVxuICogYGBgXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiBab25lUnVuKG9wdGlvbnM/OiBab25lT3B0aW9ucyk6IERlY29yYXRvclR5cGUge1xuICByZXR1cm4gbWFrZUZuKCdydW4nLCBvcHRpb25zKTtcbn1cbiJdfQ==
|
package/esm2022/form/form.mjs
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Generated bundle index. Do not edit.
|
3
|
-
*/
|
4
|
-
export * from './index';
|
5
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9ybS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3V0aWwvZm9ybS9mb3JtLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuIl19
|
package/esm2022/form/index.mjs
DELETED
@@ -1,3 +0,0 @@
|
|
1
|
-
export * from './validators';
|
2
|
-
export * from './match-control';
|
3
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2Zvcm0vaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxjQUFjLENBQUM7QUFDN0IsY0FBYyxpQkFBaUIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vdmFsaWRhdG9ycyc7XG5leHBvcnQgKiBmcm9tICcuL21hdGNoLWNvbnRyb2wnO1xuIl19
|
@@ -1,30 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Match two control values
|
3
|
-
*
|
4
|
-
* 匹配两个控件值
|
5
|
-
* ```ts
|
6
|
-
* this.form = new FormGroup({
|
7
|
-
* pwd: new FormControl(''),
|
8
|
-
* repwd: new FormControl(''),
|
9
|
-
* }, {
|
10
|
-
* validators: MatchControl('pwd', 'repwd'),
|
11
|
-
* });
|
12
|
-
* ```
|
13
|
-
*/
|
14
|
-
export function MatchControl(controlName, matchingControlName) {
|
15
|
-
return (formGroup) => {
|
16
|
-
const control = formGroup.get(controlName);
|
17
|
-
const matchingControl = formGroup.get(matchingControlName);
|
18
|
-
if (matchingControl.errors && !matchingControl.errors.matchControl) {
|
19
|
-
return null;
|
20
|
-
}
|
21
|
-
if (control.value !== matchingControl.value) {
|
22
|
-
matchingControl.setErrors({ matchControl: true });
|
23
|
-
}
|
24
|
-
else {
|
25
|
-
matchingControl.setErrors(null);
|
26
|
-
}
|
27
|
-
return null;
|
28
|
-
};
|
29
|
-
}
|
30
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWF0Y2gtY29udHJvbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3V0aWwvZm9ybS9tYXRjaC1jb250cm9sL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