@ethlete/core 3.1.0 → 3.3.0
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/esm2022/lib/components/structured-data/structured-data.component.mjs +3 -3
- package/esm2022/lib/directives/animatable/animatable.directive.mjs +3 -3
- package/esm2022/lib/directives/animated-lifecycle/animated-lifecycle.directive.mjs +3 -3
- package/esm2022/lib/directives/animated-overlay/animated-overlay.directive.mjs +3 -3
- package/esm2022/lib/directives/click-outside/click-outside.directive.mjs +3 -3
- package/esm2022/lib/directives/cursor-drag-scroll/cursor-drag-scroll.directive.mjs +3 -3
- package/esm2022/lib/directives/delayable/delayable.directive.mjs +3 -3
- package/esm2022/lib/directives/is-active-element/is-active-element.directive.mjs +3 -3
- package/esm2022/lib/directives/is-element/is-element.directive.mjs +3 -3
- package/esm2022/lib/directives/let/let.directive.mjs +3 -3
- package/esm2022/lib/directives/observe-content/observe-content.directive.mjs +3 -3
- package/esm2022/lib/directives/observe-resize/observe-resize.directive.mjs +3 -3
- package/esm2022/lib/directives/observe-scroll-state/observe-scroll-state.directive.mjs +3 -3
- package/esm2022/lib/directives/repeat/repeat.directive.mjs +3 -3
- package/esm2022/lib/directives/scroll-observer-first-element/scroll-observer-first-element.directive.mjs +3 -3
- package/esm2022/lib/directives/scroll-observer-ignore-target/scroll-observer-ignore-target.directive.mjs +3 -3
- package/esm2022/lib/directives/scroll-observer-last-element/scroll-observer-last-element.directive.mjs +3 -3
- package/esm2022/lib/directives/seo/seo.directive.mjs +3 -3
- package/esm2022/lib/pipes/normalize-game-result-type/normalize-game-result-type.pipe.mjs +3 -3
- package/esm2022/lib/pipes/normalize-match-participants/normalize-match-participants.pipe.mjs +3 -3
- package/esm2022/lib/pipes/normalize-match-score/normalize-match-score.pipe.mjs +3 -3
- package/esm2022/lib/pipes/normalize-match-state/normalize-match-state.pipe.mjs +3 -3
- package/esm2022/lib/pipes/normalize-match-type/normalize-match-type.pipe.mjs +3 -3
- package/esm2022/lib/pipes/to-array/to-array.pipe.mjs +3 -3
- package/esm2022/lib/services/click-observer.service.mjs +6 -6
- package/esm2022/lib/services/content-observer.service.mjs +6 -6
- package/esm2022/lib/services/focus-visible.service.mjs +3 -3
- package/esm2022/lib/services/resize-observer.service.mjs +6 -6
- package/esm2022/lib/services/router-state.service.mjs +3 -3
- package/esm2022/lib/services/viewport.service.mjs +3 -3
- package/esm2022/lib/types/public-api.mjs +2 -1
- package/esm2022/lib/types/value.types.mjs +2 -0
- package/esm2022/lib/utils/key-press-manager.utils.mjs +30 -0
- package/esm2022/lib/utils/public-api.mjs +3 -1
- package/esm2022/lib/utils/runtime-error.utils.mjs +9 -6
- package/esm2022/lib/utils/selection-model.utils.mjs +27 -19
- package/esm2022/lib/utils/value.utils.mjs +22 -0
- package/fesm2022/ethlete-core.mjs +186 -124
- package/fesm2022/ethlete-core.mjs.map +1 -1
- package/lib/types/public-api.d.ts +1 -0
- package/lib/types/value.types.d.ts +2 -0
- package/lib/utils/key-press-manager.utils.d.ts +9 -0
- package/lib/utils/public-api.d.ts +2 -0
- package/lib/utils/runtime-error.utils.d.ts +4 -2
- package/lib/utils/selection-model.utils.d.ts +27 -12
- package/lib/utils/value.utils.d.ts +4 -0
- package/package.json +5 -5
|
@@ -5,6 +5,7 @@ export * from './clone.util';
|
|
|
5
5
|
export * from './cookie.util';
|
|
6
6
|
export * from './destroy.utils';
|
|
7
7
|
export * from './equal.util';
|
|
8
|
+
export * from './key-press-manager.utils';
|
|
8
9
|
export * from './media-query-observable.util';
|
|
9
10
|
export * from './mutation-observable.util';
|
|
10
11
|
export * from './reactive-binding.util';
|
|
@@ -13,4 +14,5 @@ export * from './runtime-error.utils';
|
|
|
13
14
|
export * from './scrollable.utils';
|
|
14
15
|
export * from './selection-model.utils';
|
|
15
16
|
export * from './smart-block-scroll-strategy.utils';
|
|
17
|
+
export * from './value.utils';
|
|
16
18
|
export * from './viewport.util';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
export declare const RUNTIME_ERROR_NO_DATA = "__ET_NO_DATA__";
|
|
1
2
|
export declare class RuntimeError<T extends number> extends Error {
|
|
2
3
|
code: T;
|
|
4
|
+
devOnly: boolean;
|
|
3
5
|
data: unknown;
|
|
4
|
-
constructor(code: T, message: null | false | string, data?: unknown);
|
|
6
|
+
constructor(code: T, message: null | false | string, devOnly?: boolean, data?: unknown);
|
|
5
7
|
}
|
|
6
|
-
export declare function formatRuntimeError<T extends number>(code: T, message: null | false | string): string;
|
|
8
|
+
export declare function formatRuntimeError<T extends number>(code: T, message: null | false | string, devOnly: boolean): string;
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
type SelectionModelTypes = string | number | Record<string, unknown> | unknown;
|
|
1
|
+
export type SelectionModelTypes = string | number | Record<string, unknown> | unknown;
|
|
2
|
+
export type SelectionModelPropertyPath = string;
|
|
3
|
+
export type SelectionModelOptionValueFn<T extends SelectionModelTypes = any> = (option: T) => unknown;
|
|
4
|
+
/**
|
|
5
|
+
* You can use a property path or a function to get the value of an option. The function should be as **lightweight as possible** as it will be called **a lot**.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* // Property path
|
|
9
|
+
* "id" // option.id
|
|
10
|
+
* "user.name" // option.user.name
|
|
11
|
+
*
|
|
12
|
+
* // Function
|
|
13
|
+
* (option) => option.id // option.id
|
|
14
|
+
* (option) => option.user.name // option.user.name
|
|
15
|
+
*/
|
|
16
|
+
export type SelectionModelBinding<T extends SelectionModelTypes = any> = SelectionModelPropertyPath | SelectionModelOptionValueFn<T>;
|
|
2
17
|
export declare class SelectionModel<T extends SelectionModelTypes = unknown> {
|
|
3
18
|
get selection$(): import("rxjs").Observable<T[]>;
|
|
4
19
|
get selection(): T[];
|
|
@@ -6,14 +21,14 @@ export declare class SelectionModel<T extends SelectionModelTypes = unknown> {
|
|
|
6
21
|
get options$(): import("rxjs").Observable<T[]>;
|
|
7
22
|
get options(): T[];
|
|
8
23
|
private readonly _options$;
|
|
9
|
-
get valueBinding$(): import("rxjs").Observable<
|
|
10
|
-
get valueBinding():
|
|
24
|
+
get valueBinding$(): import("rxjs").Observable<SelectionModelBinding<T> | null>;
|
|
25
|
+
get valueBinding(): SelectionModelBinding<T> | null;
|
|
11
26
|
private readonly _valueBinding$;
|
|
12
|
-
get keyBinding$(): import("rxjs").Observable<
|
|
13
|
-
get keyBinding():
|
|
27
|
+
get keyBinding$(): import("rxjs").Observable<SelectionModelBinding<T> | null>;
|
|
28
|
+
get keyBinding(): SelectionModelBinding<T> | null;
|
|
14
29
|
private readonly _keyBinding$;
|
|
15
|
-
get labelBinding$(): import("rxjs").Observable<
|
|
16
|
-
get labelBinding():
|
|
30
|
+
get labelBinding$(): import("rxjs").Observable<SelectionModelBinding<T> | null>;
|
|
31
|
+
get labelBinding(): SelectionModelBinding<T> | null;
|
|
17
32
|
private readonly _labelBinding$;
|
|
18
33
|
get allowMultiple$(): import("rxjs").Observable<boolean>;
|
|
19
34
|
get allowMultiple(): boolean;
|
|
@@ -25,9 +40,9 @@ export declare class SelectionModel<T extends SelectionModelTypes = unknown> {
|
|
|
25
40
|
readonly filteredOptions$: import("rxjs").Observable<T[]>;
|
|
26
41
|
private readonly _optionsAndSelection$;
|
|
27
42
|
setSelection(selection: T | T[]): this;
|
|
28
|
-
setValueBinding(
|
|
29
|
-
setKeyBinding(
|
|
30
|
-
setLabelBinding(
|
|
43
|
+
setValueBinding(fnOrPropertyPath: SelectionModelBinding<T> | null): this;
|
|
44
|
+
setKeyBinding(fnOrPropertyPath: SelectionModelBinding<T> | null): this;
|
|
45
|
+
setLabelBinding(fnOrPropertyPath: SelectionModelBinding<T> | null): this;
|
|
31
46
|
setOptions(options: T[]): this;
|
|
32
47
|
setAllowMultiple(allowMultiple: boolean): this;
|
|
33
48
|
setFilter(filter: string | null): void;
|
|
@@ -42,7 +57,7 @@ export declare class SelectionModel<T extends SelectionModelTypes = unknown> {
|
|
|
42
57
|
getOptionByValue(value: unknown): T | undefined;
|
|
43
58
|
getOptionByLabel(label: string): T | undefined;
|
|
44
59
|
getOptionByKey(key: string): T | undefined;
|
|
45
|
-
getOption(value: unknown, propertyPath?:
|
|
60
|
+
getOption(value: unknown, propertyPath?: SelectionModelBinding<T> | null, options?: T[]): T | undefined;
|
|
46
61
|
getOptionByIndex(index: number, options?: T[]): T | null;
|
|
47
62
|
getOptionByOffset(offset: number, index: number, options?: T[], config?: {
|
|
48
63
|
loop?: boolean;
|
|
@@ -60,6 +75,7 @@ export declare class SelectionModel<T extends SelectionModelTypes = unknown> {
|
|
|
60
75
|
getLabel(option: T): unknown;
|
|
61
76
|
getValue(option: T): unknown;
|
|
62
77
|
getKey(option: T): unknown;
|
|
78
|
+
execFnOrGetOptionProperty(option: T, fnOrPropertyPath: SelectionModelBinding<T> | null): unknown;
|
|
63
79
|
getOptionProperty(option: T, propertyPath: string | null): unknown;
|
|
64
80
|
isSelected(option: T): boolean;
|
|
65
81
|
getFilteredOptions(filter?: string, options?: T[]): T[];
|
|
@@ -69,4 +85,3 @@ export declare class SelectionModel<T extends SelectionModelTypes = unknown> {
|
|
|
69
85
|
toggleSelectedOption(option: T): void;
|
|
70
86
|
toggleAllSelectedOptions(): void;
|
|
71
87
|
}
|
|
72
|
-
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Primitive } from '../types';
|
|
2
|
+
export declare const isPrimitiveArray: (value: unknown) => value is Primitive[];
|
|
3
|
+
export declare const isObjectArray: (value: unknown) => value is Record<string, unknown>[];
|
|
4
|
+
export declare const isEmptyArray: (value: unknown) => value is [];
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethlete/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"tslib": "^2.5.0"
|
|
6
6
|
},
|
|
7
7
|
"peerDependencies": {
|
|
8
8
|
"@angular/common": "^15.2.1 || ^16.0.0",
|
|
9
9
|
"@angular/core": "^15.2.1 || ^16.0.0",
|
|
10
|
-
"@angular/platform-browser": "16.2.
|
|
10
|
+
"@angular/platform-browser": "16.2.1",
|
|
11
11
|
"@ethlete/types": "1.4.0",
|
|
12
12
|
"rxjs": "7.8.1",
|
|
13
|
-
"@angular/cdk": "16.2.
|
|
13
|
+
"@angular/cdk": "16.2.1",
|
|
14
14
|
"@floating-ui/dom": "1.5.1",
|
|
15
|
-
"@angular/router": "16.2.
|
|
16
|
-
"@angular/forms": "16.2.
|
|
15
|
+
"@angular/router": "16.2.1",
|
|
16
|
+
"@angular/forms": "16.2.1"
|
|
17
17
|
},
|
|
18
18
|
"module": "fesm2022/ethlete-core.mjs",
|
|
19
19
|
"typings": "index.d.ts",
|