nmce-func 1.2.0 → 1.3.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 +24 -24
- package/_func/addressFunc.d.ts +31 -31
- package/_func/authentication.service.d.ts +27 -27
- package/_func/currencyFunc.d.ts +20 -20
- package/_func/dateFunc.d.ts +121 -121
- package/_func/htmlPrintFunc.d.ts +18 -18
- package/_func/index.d.ts +10 -10
- package/_func/javascriptFunc.d.ts +10 -9
- package/_func/jsonFunc.d.ts +31 -31
- package/_func/stringAusFunc.d.ts +40 -40
- package/_func/stringFunc.d.ts +41 -41
- package/_func/uuidFunc.d.ts +7 -7
- package/{esm2020 → esm2022}/_func/addressFunc.mjs +49 -49
- package/esm2022/_func/authentication.service.mjs +48 -0
- package/esm2022/_func/currencyFunc.mjs +72 -0
- package/{esm2020 → esm2022}/_func/dateFunc.mjs +316 -316
- package/{esm2020 → esm2022}/_func/htmlPrintFunc.mjs +45 -45
- package/{esm2020 → esm2022}/_func/index.mjs +11 -11
- package/esm2022/_func/javascriptFunc.mjs +21 -0
- package/{esm2020 → esm2022}/_func/jsonFunc.mjs +67 -67
- package/esm2022/_func/stringAusFunc.mjs +200 -0
- package/{esm2020 → esm2022}/_func/stringFunc.mjs +93 -93
- package/{esm2020 → esm2022}/_func/uuidFunc.mjs +17 -17
- package/{esm2020 → esm2022}/nmce-func.mjs +4 -4
- package/{esm2020 → esm2022}/public-api.mjs +5 -5
- package/{fesm2020 → fesm2022}/nmce-func.mjs +907 -900
- package/fesm2022/nmce-func.mjs.map +1 -0
- package/index.d.ts +5 -5
- package/package.json +5 -11
- package/public-api.d.ts +1 -1
- package/esm2020/_func/authentication.service.mjs +0 -45
- package/esm2020/_func/currencyFunc.mjs +0 -72
- package/esm2020/_func/javascriptFunc.mjs +0 -17
- package/esm2020/_func/stringAusFunc.mjs +0 -200
- package/fesm2015/nmce-func.mjs +0 -933
- package/fesm2015/nmce-func.mjs.map +0 -1
- package/fesm2020/nmce-func.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
# NmceFunc
|
|
2
|
-
|
|
3
|
-
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.5.
|
|
4
|
-
|
|
5
|
-
## Code scaffolding
|
|
6
|
-
|
|
7
|
-
Run `ng generate component component-name --project nmce-func` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project nmce-func`.
|
|
8
|
-
> Note: Don't forget to add `--project nmce-func` or else it will be added to the default project in your `angular.json` file.
|
|
9
|
-
|
|
10
|
-
## Build
|
|
11
|
-
|
|
12
|
-
Run `ng build nmce-func` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
13
|
-
|
|
14
|
-
## Publishing
|
|
15
|
-
|
|
16
|
-
After building your library with `ng build nmce-func`, go to the dist folder `cd dist/nmce-func` and run `npm publish`.
|
|
17
|
-
|
|
18
|
-
## Running unit tests
|
|
19
|
-
|
|
20
|
-
Run `ng test nmce-func` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
21
|
-
|
|
22
|
-
## Further help
|
|
23
|
-
|
|
24
|
-
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
|
1
|
+
# NmceFunc
|
|
2
|
+
|
|
3
|
+
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.5.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Run `ng generate component component-name --project nmce-func` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project nmce-func`.
|
|
8
|
+
> Note: Don't forget to add `--project nmce-func` or else it will be added to the default project in your `angular.json` file.
|
|
9
|
+
|
|
10
|
+
## Build
|
|
11
|
+
|
|
12
|
+
Run `ng build nmce-func` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
13
|
+
|
|
14
|
+
## Publishing
|
|
15
|
+
|
|
16
|
+
After building your library with `ng build nmce-func`, go to the dist folder `cd dist/nmce-func` and run `npm publish`.
|
|
17
|
+
|
|
18
|
+
## Running unit tests
|
|
19
|
+
|
|
20
|
+
Run `ng test nmce-func` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
21
|
+
|
|
22
|
+
## Further help
|
|
23
|
+
|
|
24
|
+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
package/_func/addressFunc.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
export declare class AddressFunc {
|
|
2
|
-
/**
|
|
3
|
-
* Compose to one line separated by comma
|
|
4
|
-
* @param st1
|
|
5
|
-
* @param st2
|
|
6
|
-
* @param city
|
|
7
|
-
* @param state
|
|
8
|
-
* @param postcode
|
|
9
|
-
*/
|
|
10
|
-
static composeOneLineAddress(st1: string | undefined, st2: string | undefined, city: string | undefined, state: string | undefined, postcode: string | undefined): string;
|
|
11
|
-
/**
|
|
12
|
-
* Compose to multiple separated by \n
|
|
13
|
-
* @param st1
|
|
14
|
-
* @param st2
|
|
15
|
-
* @param city
|
|
16
|
-
* @param state
|
|
17
|
-
* @param postcode
|
|
18
|
-
*/
|
|
19
|
-
static composeMultiLineAddress(st1: string | undefined, st2: string | undefined, city: string | undefined, state: string | undefined, postcode: string | undefined): string;
|
|
20
|
-
/**
|
|
21
|
-
* Compose with separator
|
|
22
|
-
* @param st1
|
|
23
|
-
* @param st2
|
|
24
|
-
* @param city
|
|
25
|
-
* @param state
|
|
26
|
-
* @param postcode
|
|
27
|
-
* @param sep
|
|
28
|
-
*/
|
|
29
|
-
static composeAddress(st1: string | undefined, st2: string | undefined, city: string | undefined, state: string | undefined, postcode: string | undefined, sep: string | undefined): string;
|
|
30
|
-
static composeGoogleMapsAuUrl(st1: string | undefined, st2: string | undefined, city: string | undefined, state: string | undefined, country: string | undefined): string;
|
|
31
|
-
}
|
|
1
|
+
export declare class AddressFunc {
|
|
2
|
+
/**
|
|
3
|
+
* Compose to one line separated by comma
|
|
4
|
+
* @param st1
|
|
5
|
+
* @param st2
|
|
6
|
+
* @param city
|
|
7
|
+
* @param state
|
|
8
|
+
* @param postcode
|
|
9
|
+
*/
|
|
10
|
+
static composeOneLineAddress(st1: string | undefined, st2: string | undefined, city: string | undefined, state: string | undefined, postcode: string | undefined): string;
|
|
11
|
+
/**
|
|
12
|
+
* Compose to multiple separated by \n
|
|
13
|
+
* @param st1
|
|
14
|
+
* @param st2
|
|
15
|
+
* @param city
|
|
16
|
+
* @param state
|
|
17
|
+
* @param postcode
|
|
18
|
+
*/
|
|
19
|
+
static composeMultiLineAddress(st1: string | undefined, st2: string | undefined, city: string | undefined, state: string | undefined, postcode: string | undefined): string;
|
|
20
|
+
/**
|
|
21
|
+
* Compose with separator
|
|
22
|
+
* @param st1
|
|
23
|
+
* @param st2
|
|
24
|
+
* @param city
|
|
25
|
+
* @param state
|
|
26
|
+
* @param postcode
|
|
27
|
+
* @param sep
|
|
28
|
+
*/
|
|
29
|
+
static composeAddress(st1: string | undefined, st2: string | undefined, city: string | undefined, state: string | undefined, postcode: string | undefined, sep: string | undefined): string;
|
|
30
|
+
static composeGoogleMapsAuUrl(st1: string | undefined, st2: string | undefined, city: string | undefined, state: string | undefined, country: string | undefined): string;
|
|
31
|
+
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { HttpClient } from '@angular/common/http';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
/**
|
|
4
|
-
* Login and saving tokens in sessionStorage.
|
|
5
|
-
* App needs to provide constant 'auth.tokenUrl'.
|
|
6
|
-
*/
|
|
7
|
-
export declare class AuthenticationService {
|
|
8
|
-
private authUri;
|
|
9
|
-
private http;
|
|
10
|
-
username?: string;
|
|
11
|
-
constructor(authUri: string, http: HttpClient);
|
|
12
|
-
/**
|
|
13
|
-
* Login and save tokens to sessionStorage then return an observable.
|
|
14
|
-
* @param username
|
|
15
|
-
* @param password
|
|
16
|
-
*/
|
|
17
|
-
login(username: string, password: string, headers?: any): import("rxjs").Observable<{
|
|
18
|
-
access_token: string;
|
|
19
|
-
expires: string;
|
|
20
|
-
expires_in: number;
|
|
21
|
-
issued: string;
|
|
22
|
-
token_type: string;
|
|
23
|
-
username: string;
|
|
24
|
-
}>;
|
|
25
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AuthenticationService, never>;
|
|
26
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<AuthenticationService>;
|
|
27
|
-
}
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Login and saving tokens in sessionStorage.
|
|
5
|
+
* App needs to provide constant 'auth.tokenUrl'.
|
|
6
|
+
*/
|
|
7
|
+
export declare class AuthenticationService {
|
|
8
|
+
private authUri;
|
|
9
|
+
private http;
|
|
10
|
+
username?: string;
|
|
11
|
+
constructor(authUri: string, http: HttpClient);
|
|
12
|
+
/**
|
|
13
|
+
* Login and save tokens to sessionStorage then return an observable.
|
|
14
|
+
* @param username
|
|
15
|
+
* @param password
|
|
16
|
+
*/
|
|
17
|
+
login(username: string, password: string, headers?: any): import("rxjs").Observable<{
|
|
18
|
+
access_token: string;
|
|
19
|
+
expires: string;
|
|
20
|
+
expires_in: number;
|
|
21
|
+
issued: string;
|
|
22
|
+
token_type: string;
|
|
23
|
+
username: string;
|
|
24
|
+
}>;
|
|
25
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AuthenticationService, never>;
|
|
26
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AuthenticationService>;
|
|
27
|
+
}
|
package/_func/currencyFunc.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Currency calculations. Undefined input of number is considered zero, just like null.
|
|
3
|
-
*/
|
|
4
|
-
export declare class CurrencyFunc {
|
|
5
|
-
private static DECIMAL_SEPARATOR;
|
|
6
|
-
private static THOUSANDS_SEPARATOR;
|
|
7
|
-
private static PADDING;
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* @param num
|
|
11
|
-
* @param decimalPlaces default 0
|
|
12
|
-
*/
|
|
13
|
-
static bankerRound(num: number | null | undefined, decimalPlaces?: number): number;
|
|
14
|
-
static bankerRoundTo5cents(num: number | null | undefined): number;
|
|
15
|
-
static ceilTo5cents(num: number | null | undefined): number;
|
|
16
|
-
static transformCurrency(value: number | string | undefined, fractionSize?: number): string;
|
|
17
|
-
static parseCurrency(value: string | undefined, fractionSize?: number): string;
|
|
18
|
-
static pad(num: number | null | undefined, size: number): string;
|
|
19
|
-
static sum(ns: (number | null | undefined)[]): number;
|
|
20
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Currency calculations. Undefined input of number is considered zero, just like null.
|
|
3
|
+
*/
|
|
4
|
+
export declare class CurrencyFunc {
|
|
5
|
+
private static DECIMAL_SEPARATOR;
|
|
6
|
+
private static THOUSANDS_SEPARATOR;
|
|
7
|
+
private static PADDING;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param num
|
|
11
|
+
* @param decimalPlaces default 0
|
|
12
|
+
*/
|
|
13
|
+
static bankerRound(num: number | null | undefined, decimalPlaces?: number): number;
|
|
14
|
+
static bankerRoundTo5cents(num: number | null | undefined): number;
|
|
15
|
+
static ceilTo5cents(num: number | null | undefined): number;
|
|
16
|
+
static transformCurrency(value: number | string | undefined, fractionSize?: number): string;
|
|
17
|
+
static parseCurrency(value: string | undefined, fractionSize?: number): string;
|
|
18
|
+
static pad(num: number | null | undefined, size: number): string;
|
|
19
|
+
static sum(ns: (number | null | undefined)[]): number;
|
|
20
|
+
}
|
package/_func/dateFunc.d.ts
CHANGED
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
import moment from 'moment';
|
|
2
|
-
export declare class DateFunc {
|
|
3
|
-
/**
|
|
4
|
-
* Transform UTC DateTime to local date without H, M and S. For example, the month day of 2018-01-23T22:00:00Z is 24 in Australia.
|
|
5
|
-
* @param dtUtc
|
|
6
|
-
* @param offsetMinutes if not defined, it will be new Date().getTimezoneOffset(). //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset
|
|
7
|
-
*/
|
|
8
|
-
static dateTimeUtcToLocalDateNumber(dtUtc: Date | null | undefined): number;
|
|
9
|
-
/**
|
|
10
|
-
* Date only. However, the date may still be in UTC.
|
|
11
|
-
* @param dtUtc
|
|
12
|
-
*/
|
|
13
|
-
static dateTimeUtcToLocalDate(dtUtc: Date | null | undefined): Date;
|
|
14
|
-
static localISODateString(dtUtc: Date | null | undefined): string;
|
|
15
|
-
/**
|
|
16
|
-
* locate date ONLY (no time) to UTC date.
|
|
17
|
-
* @param dt if dt contain time info, it will become dt.setHours(0, 0, 0, 0)
|
|
18
|
-
*/
|
|
19
|
-
static localDateToUtc(d: Date | number | null | undefined | string): Date;
|
|
20
|
-
static getTimezoneOffset(): number;
|
|
21
|
-
/**
|
|
22
|
-
* Transform UTC DateTime to local dateTime.
|
|
23
|
-
* @param dtUtc
|
|
24
|
-
* @param offsetMinutes if not defined, it will be new Date().getTimezoneOffset(). //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset
|
|
25
|
-
*/
|
|
26
|
-
static dateTimeUtcToLocalDateTime(dtUtc: Date | null | undefined): Date;
|
|
27
|
-
static dateTimeUtcToLocaMoment(dtUtc: Date | null | undefined): moment.Moment;
|
|
28
|
-
static getEndOfWeek(dt: Date | null | undefined | number): Date;
|
|
29
|
-
static getStartOfWeek(dt: Date | null | undefined | number): Date;
|
|
30
|
-
static getEndOfMonth(dt: Date | null | undefined | number): Date;
|
|
31
|
-
static getStartOfMonth(dt: Date | null | undefined | number): Date;
|
|
32
|
-
static getDaysBetweenDates(dt1: Date | null | undefined, dt2: Date | null | undefined): number;
|
|
33
|
-
static getEndOfDate(dt: Date | null | undefined): Date;
|
|
34
|
-
static getStartOfDate(dt: Date | null | undefined): Date;
|
|
35
|
-
static getEndOfToday(): Date;
|
|
36
|
-
static getStartOfToday(): Date;
|
|
37
|
-
static addDays(dt: Date | null | undefined, days?: number): Date;
|
|
38
|
-
static subtractDays(dt: Date | null | undefined, days?: number): Date;
|
|
39
|
-
/**
|
|
40
|
-
* Start of today
|
|
41
|
-
*/
|
|
42
|
-
static get today(): Date;
|
|
43
|
-
static get now(): Date;
|
|
44
|
-
static getNext5MinuteMark(): Date;
|
|
45
|
-
static getYMD(d: Date): string;
|
|
46
|
-
static getDMYWithSlash(d: Date): string;
|
|
47
|
-
static getDMYHmWithSlash(d: Date): string;
|
|
48
|
-
static getMcpTime(dt: Date | null | undefined): string;
|
|
49
|
-
/**
|
|
50
|
-
* In 24 hour format
|
|
51
|
-
* @param dtUtc
|
|
52
|
-
*/
|
|
53
|
-
static getLocalDMYHmWithSlash(dtUtc: Date | null | undefined): string;
|
|
54
|
-
/**
|
|
55
|
-
* Offset minutes comparing with today
|
|
56
|
-
*/
|
|
57
|
-
static getOffsetMinutes(dtUtc: Date | null | undefined | number): number;
|
|
58
|
-
static getDaysBetween(d1?: Date | number | null | undefined, d2?: Date | number | null | undefined): number;
|
|
59
|
-
/**
|
|
60
|
-
* Get hour of the date. If Date is not defined, the hour will be current hour.
|
|
61
|
-
* @param dtUtc
|
|
62
|
-
*/
|
|
63
|
-
static getHour(dtUtc: Date | null | undefined | number): number;
|
|
64
|
-
static getMinute(dtUtc: Date | null | undefined | number): number;
|
|
65
|
-
static composeDateTime(dt: Date | null | undefined, h?: number, minute?: number): Date;
|
|
66
|
-
static olderThan24Hours(d: Date | null | undefined): boolean;
|
|
67
|
-
static olderThan24HoursUtc(dtUtc: Date | null | undefined): boolean;
|
|
68
|
-
static olderThanHours(d: Date, hours: number): boolean;
|
|
69
|
-
static olderThanHoursUtc(dtUtc: Date | null | undefined, hours: number): boolean;
|
|
70
|
-
static olderThanMinutes(d: Date, minutes: number): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* It could be 11PM yesterday, and 1 AM today. Actually based on local today.
|
|
73
|
-
*/
|
|
74
|
-
static olderThan1Day(dtUtc: Date | null | undefined): boolean;
|
|
75
|
-
static getHourAge(d: Date): number;
|
|
76
|
-
static getHourAgeUtc(dtUtc: Date | null | undefined): number;
|
|
77
|
-
/**
|
|
78
|
-
* Compare utc date with utc now.
|
|
79
|
-
* @param dtUtc
|
|
80
|
-
*/
|
|
81
|
-
static getDayAgeUtc(dtUtc: Date | null | undefined): number;
|
|
82
|
-
/**
|
|
83
|
-
* How many years from now.
|
|
84
|
-
* @param d
|
|
85
|
-
* @returns
|
|
86
|
-
*/
|
|
87
|
-
static getAge(d: Date): number;
|
|
88
|
-
/**
|
|
89
|
-
* Year of date.
|
|
90
|
-
* @param d
|
|
91
|
-
* @returns
|
|
92
|
-
*/
|
|
93
|
-
static getYear(d: Date): number;
|
|
94
|
-
static getUtcNow(): Date;
|
|
95
|
-
static addMinutes(d: Date, m: number): Date;
|
|
96
|
-
static addMonth(d: Date, m: number): Date;
|
|
97
|
-
static getDuration(d1: Date, d2: Date): moment.Duration;
|
|
98
|
-
/**
|
|
99
|
-
* Convert minutes from midnight to HH:mm text
|
|
100
|
-
* @param mins
|
|
101
|
-
*/
|
|
102
|
-
static getHMFromMins(mins: number): string;
|
|
103
|
-
static getMinutesSinceMidnight(d: Date | null | undefined): number;
|
|
104
|
-
static getMinutesBetween(start: Date | null | undefined, end: Date | null | undefined): number;
|
|
105
|
-
/**
|
|
106
|
-
* Parse json string with date serialized into string, and get proper date object back
|
|
107
|
-
* @param s
|
|
108
|
-
*/
|
|
109
|
-
static dateSafeJsonParse(s: string): any;
|
|
110
|
-
private static dateReviver;
|
|
111
|
-
private static isSerializedDate;
|
|
112
|
-
private static isString;
|
|
113
|
-
static dateSafeParse(s: string | Date): Date;
|
|
114
|
-
static composeDateWithMinutes(d: Date, minute: number): Date;
|
|
115
|
-
/**
|
|
116
|
-
* Safe compare since date data may be considered as string rather than date.
|
|
117
|
-
* @param d1
|
|
118
|
-
* @param d2
|
|
119
|
-
*/
|
|
120
|
-
static compare(d1: Date | undefined, d2: Date | undefined): number;
|
|
121
|
-
}
|
|
1
|
+
import moment from 'moment';
|
|
2
|
+
export declare class DateFunc {
|
|
3
|
+
/**
|
|
4
|
+
* Transform UTC DateTime to local date without H, M and S. For example, the month day of 2018-01-23T22:00:00Z is 24 in Australia.
|
|
5
|
+
* @param dtUtc
|
|
6
|
+
* @param offsetMinutes if not defined, it will be new Date().getTimezoneOffset(). //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset
|
|
7
|
+
*/
|
|
8
|
+
static dateTimeUtcToLocalDateNumber(dtUtc: Date | null | undefined): number;
|
|
9
|
+
/**
|
|
10
|
+
* Date only. However, the date may still be in UTC.
|
|
11
|
+
* @param dtUtc
|
|
12
|
+
*/
|
|
13
|
+
static dateTimeUtcToLocalDate(dtUtc: Date | null | undefined): Date;
|
|
14
|
+
static localISODateString(dtUtc: Date | null | undefined): string;
|
|
15
|
+
/**
|
|
16
|
+
* locate date ONLY (no time) to UTC date.
|
|
17
|
+
* @param dt if dt contain time info, it will become dt.setHours(0, 0, 0, 0)
|
|
18
|
+
*/
|
|
19
|
+
static localDateToUtc(d: Date | number | null | undefined | string): Date;
|
|
20
|
+
static getTimezoneOffset(): number;
|
|
21
|
+
/**
|
|
22
|
+
* Transform UTC DateTime to local dateTime.
|
|
23
|
+
* @param dtUtc
|
|
24
|
+
* @param offsetMinutes if not defined, it will be new Date().getTimezoneOffset(). //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset
|
|
25
|
+
*/
|
|
26
|
+
static dateTimeUtcToLocalDateTime(dtUtc: Date | null | undefined): Date;
|
|
27
|
+
static dateTimeUtcToLocaMoment(dtUtc: Date | null | undefined): moment.Moment;
|
|
28
|
+
static getEndOfWeek(dt: Date | null | undefined | number): Date;
|
|
29
|
+
static getStartOfWeek(dt: Date | null | undefined | number): Date;
|
|
30
|
+
static getEndOfMonth(dt: Date | null | undefined | number): Date;
|
|
31
|
+
static getStartOfMonth(dt: Date | null | undefined | number): Date;
|
|
32
|
+
static getDaysBetweenDates(dt1: Date | null | undefined, dt2: Date | null | undefined): number;
|
|
33
|
+
static getEndOfDate(dt: Date | null | undefined): Date;
|
|
34
|
+
static getStartOfDate(dt: Date | null | undefined): Date;
|
|
35
|
+
static getEndOfToday(): Date;
|
|
36
|
+
static getStartOfToday(): Date;
|
|
37
|
+
static addDays(dt: Date | null | undefined, days?: number): Date;
|
|
38
|
+
static subtractDays(dt: Date | null | undefined, days?: number): Date;
|
|
39
|
+
/**
|
|
40
|
+
* Start of today
|
|
41
|
+
*/
|
|
42
|
+
static get today(): Date;
|
|
43
|
+
static get now(): Date;
|
|
44
|
+
static getNext5MinuteMark(): Date;
|
|
45
|
+
static getYMD(d: Date): string;
|
|
46
|
+
static getDMYWithSlash(d: Date): string;
|
|
47
|
+
static getDMYHmWithSlash(d: Date): string;
|
|
48
|
+
static getMcpTime(dt: Date | null | undefined): string;
|
|
49
|
+
/**
|
|
50
|
+
* In 24 hour format
|
|
51
|
+
* @param dtUtc
|
|
52
|
+
*/
|
|
53
|
+
static getLocalDMYHmWithSlash(dtUtc: Date | null | undefined): string;
|
|
54
|
+
/**
|
|
55
|
+
* Offset minutes comparing with today
|
|
56
|
+
*/
|
|
57
|
+
static getOffsetMinutes(dtUtc: Date | null | undefined | number): number;
|
|
58
|
+
static getDaysBetween(d1?: Date | number | null | undefined, d2?: Date | number | null | undefined): number;
|
|
59
|
+
/**
|
|
60
|
+
* Get hour of the date. If Date is not defined, the hour will be current hour.
|
|
61
|
+
* @param dtUtc
|
|
62
|
+
*/
|
|
63
|
+
static getHour(dtUtc: Date | null | undefined | number): number;
|
|
64
|
+
static getMinute(dtUtc: Date | null | undefined | number): number;
|
|
65
|
+
static composeDateTime(dt: Date | null | undefined, h?: number, minute?: number): Date;
|
|
66
|
+
static olderThan24Hours(d: Date | null | undefined): boolean;
|
|
67
|
+
static olderThan24HoursUtc(dtUtc: Date | null | undefined): boolean;
|
|
68
|
+
static olderThanHours(d: Date, hours: number): boolean;
|
|
69
|
+
static olderThanHoursUtc(dtUtc: Date | null | undefined, hours: number): boolean;
|
|
70
|
+
static olderThanMinutes(d: Date, minutes: number): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* It could be 11PM yesterday, and 1 AM today. Actually based on local today.
|
|
73
|
+
*/
|
|
74
|
+
static olderThan1Day(dtUtc: Date | null | undefined): boolean;
|
|
75
|
+
static getHourAge(d: Date): number;
|
|
76
|
+
static getHourAgeUtc(dtUtc: Date | null | undefined): number;
|
|
77
|
+
/**
|
|
78
|
+
* Compare utc date with utc now.
|
|
79
|
+
* @param dtUtc
|
|
80
|
+
*/
|
|
81
|
+
static getDayAgeUtc(dtUtc: Date | null | undefined): number;
|
|
82
|
+
/**
|
|
83
|
+
* How many years from now.
|
|
84
|
+
* @param d
|
|
85
|
+
* @returns
|
|
86
|
+
*/
|
|
87
|
+
static getAge(d: Date): number;
|
|
88
|
+
/**
|
|
89
|
+
* Year of date.
|
|
90
|
+
* @param d
|
|
91
|
+
* @returns
|
|
92
|
+
*/
|
|
93
|
+
static getYear(d: Date): number;
|
|
94
|
+
static getUtcNow(): Date;
|
|
95
|
+
static addMinutes(d: Date, m: number): Date;
|
|
96
|
+
static addMonth(d: Date, m: number): Date;
|
|
97
|
+
static getDuration(d1: Date, d2: Date): moment.Duration;
|
|
98
|
+
/**
|
|
99
|
+
* Convert minutes from midnight to HH:mm text
|
|
100
|
+
* @param mins
|
|
101
|
+
*/
|
|
102
|
+
static getHMFromMins(mins: number): string;
|
|
103
|
+
static getMinutesSinceMidnight(d: Date | null | undefined): number;
|
|
104
|
+
static getMinutesBetween(start: Date | null | undefined, end: Date | null | undefined): number;
|
|
105
|
+
/**
|
|
106
|
+
* Parse json string with date serialized into string, and get proper date object back
|
|
107
|
+
* @param s
|
|
108
|
+
*/
|
|
109
|
+
static dateSafeJsonParse(s: string): any;
|
|
110
|
+
private static dateReviver;
|
|
111
|
+
private static isSerializedDate;
|
|
112
|
+
private static isString;
|
|
113
|
+
static dateSafeParse(s: string | Date): Date;
|
|
114
|
+
static composeDateWithMinutes(d: Date, minute: number): Date;
|
|
115
|
+
/**
|
|
116
|
+
* Safe compare since date data may be considered as string rather than date.
|
|
117
|
+
* @param d1
|
|
118
|
+
* @param d2
|
|
119
|
+
*/
|
|
120
|
+
static compare(d1: Date | undefined, d2: Date | undefined): number;
|
|
121
|
+
}
|
package/_func/htmlPrintFunc.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export declare class HtmlPrintFunc {
|
|
2
|
-
/**
|
|
3
|
-
* Print with CSS for internal reports
|
|
4
|
-
* @param htmlTags
|
|
5
|
-
* @param cssUrl
|
|
6
|
-
*/
|
|
7
|
-
static printWithCSS(htmlTags: string, cssUrl: string): boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Print for external documents.
|
|
10
|
-
* @param htmlTags
|
|
11
|
-
*/
|
|
12
|
-
static print(htmlTags: string): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Print image url through html img.
|
|
15
|
-
* @param url
|
|
16
|
-
*/
|
|
17
|
-
static printImage(url: string): void;
|
|
18
|
-
}
|
|
1
|
+
export declare class HtmlPrintFunc {
|
|
2
|
+
/**
|
|
3
|
+
* Print with CSS for internal reports
|
|
4
|
+
* @param htmlTags
|
|
5
|
+
* @param cssUrl
|
|
6
|
+
*/
|
|
7
|
+
static printWithCSS(htmlTags: string, cssUrl: string): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Print for external documents.
|
|
10
|
+
* @param htmlTags
|
|
11
|
+
*/
|
|
12
|
+
static print(htmlTags: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Print image url through html img.
|
|
15
|
+
* @param url
|
|
16
|
+
*/
|
|
17
|
+
static printImage(url: string): void;
|
|
18
|
+
}
|
package/_func/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from './addressFunc';
|
|
2
|
-
export * from './authentication.service';
|
|
3
|
-
export * from './currencyFunc';
|
|
4
|
-
export * from './dateFunc';
|
|
5
|
-
export * from './htmlPrintFunc';
|
|
6
|
-
export * from './javascriptFunc';
|
|
7
|
-
export * from './jsonFunc';
|
|
8
|
-
export * from './stringAusFunc';
|
|
9
|
-
export * from './stringFunc';
|
|
10
|
-
export * from './uuidFunc';
|
|
1
|
+
export * from './addressFunc';
|
|
2
|
+
export * from './authentication.service';
|
|
3
|
+
export * from './currencyFunc';
|
|
4
|
+
export * from './dateFunc';
|
|
5
|
+
export * from './htmlPrintFunc';
|
|
6
|
+
export * from './javascriptFunc';
|
|
7
|
+
export * from './jsonFunc';
|
|
8
|
+
export * from './stringAusFunc';
|
|
9
|
+
export * from './stringFunc';
|
|
10
|
+
export * from './uuidFunc';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export declare class JavaScriptFunc {
|
|
2
|
-
/**
|
|
3
|
-
* Some business functions depend on external JavaScript libraries. Lazy loading of respective business modules is good,
|
|
4
|
-
* and this function supports lazy loading of JS libraries.
|
|
5
|
-
* @param scriptUrl
|
|
6
|
-
* @
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
export declare class JavaScriptFunc {
|
|
2
|
+
/**
|
|
3
|
+
* Some business functions depend on external JavaScript libraries. Lazy loading of respective business modules is good,
|
|
4
|
+
* and this function supports lazy loading of JS libraries.
|
|
5
|
+
* @param scriptUrl
|
|
6
|
+
* @param type things like module.
|
|
7
|
+
* @returns Promise for subsequent JS function calls.
|
|
8
|
+
*/
|
|
9
|
+
static loadExternalScript(scriptUrl: string, type?: string): Promise<unknown>;
|
|
10
|
+
}
|
package/_func/jsonFunc.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Basic JSON functions
|
|
3
|
-
*/
|
|
4
|
-
export declare class JsonFunc {
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* @param array Group by a property of array element.
|
|
8
|
-
* @param propertyName
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
static groupBy<T>(array: Array<T>, propertyName: string): any;
|
|
12
|
-
/**
|
|
13
|
-
* Group by a date property. The key is always of string type and representing milliseconds.
|
|
14
|
-
* The client should convert the string to number.
|
|
15
|
-
* Angular date pipe could actually consume such string without explicitly converting to number.
|
|
16
|
-
* @param array
|
|
17
|
-
* @param propertyName
|
|
18
|
-
*/
|
|
19
|
-
static groupByDate<T>(array: Array<T>, propertyName: string): any;
|
|
20
|
-
/**
|
|
21
|
-
* Remove null or empty fields including those in nested objects.
|
|
22
|
-
* This is useful for reducing payload of AJAX serialization.
|
|
23
|
-
* @param obj
|
|
24
|
-
*/
|
|
25
|
-
static removeNullOrEmptyFields(obj: any): void;
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @param obj Remove null fields of object at only the 1st level.
|
|
29
|
-
*/
|
|
30
|
-
static removeNullFields(obj: any): void;
|
|
31
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Basic JSON functions
|
|
3
|
+
*/
|
|
4
|
+
export declare class JsonFunc {
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param array Group by a property of array element.
|
|
8
|
+
* @param propertyName
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
static groupBy<T>(array: Array<T>, propertyName: string): any;
|
|
12
|
+
/**
|
|
13
|
+
* Group by a date property. The key is always of string type and representing milliseconds.
|
|
14
|
+
* The client should convert the string to number.
|
|
15
|
+
* Angular date pipe could actually consume such string without explicitly converting to number.
|
|
16
|
+
* @param array
|
|
17
|
+
* @param propertyName
|
|
18
|
+
*/
|
|
19
|
+
static groupByDate<T>(array: Array<T>, propertyName: string): any;
|
|
20
|
+
/**
|
|
21
|
+
* Remove null or empty fields including those in nested objects.
|
|
22
|
+
* This is useful for reducing payload of AJAX serialization.
|
|
23
|
+
* @param obj
|
|
24
|
+
*/
|
|
25
|
+
static removeNullOrEmptyFields(obj: any): void;
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param obj Remove null fields of object at only the 1st level.
|
|
29
|
+
*/
|
|
30
|
+
static removeNullFields(obj: any): void;
|
|
31
|
+
}
|