@ethlete/core 2.2.1 → 2.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.
@@ -6,7 +6,9 @@ export * from './destroy.utils';
6
6
  export * from './equal.util';
7
7
  export * from './media-query-observable.util';
8
8
  export * from './reactive-binding.util';
9
+ export * from './runtime-error.utils';
9
10
  export * from './rxjs.utils';
10
11
  export * from './scrollable.utils';
12
+ export * from './selection-model.utils';
11
13
  export * from './smart-block-scroll-strategy.utils';
12
14
  export * from './viewport.util';
@@ -0,0 +1,6 @@
1
+ export declare class RuntimeError<T extends number> extends Error {
2
+ code: T;
3
+ data: unknown;
4
+ constructor(code: T, message: null | false | string, data?: unknown);
5
+ }
6
+ export declare function formatRuntimeError<T extends number>(code: T, message: null | false | string): string;
@@ -0,0 +1,72 @@
1
+ type SelectionModelTypes = string | number | Record<string, unknown> | unknown;
2
+ export declare class SelectionModel<T extends SelectionModelTypes = unknown> {
3
+ get selection$(): import("rxjs").Observable<T[]>;
4
+ get selection(): T[];
5
+ private readonly _selection$;
6
+ get options$(): import("rxjs").Observable<T[]>;
7
+ get options(): T[];
8
+ private readonly _options$;
9
+ get valueBinding$(): import("rxjs").Observable<string | null>;
10
+ get valueBinding(): string | null;
11
+ private readonly _valueBinding$;
12
+ get keyBinding$(): import("rxjs").Observable<string | null>;
13
+ get keyBinding(): string | null;
14
+ private readonly _keyBinding$;
15
+ get labelBinding$(): import("rxjs").Observable<string | null>;
16
+ get labelBinding(): string | null;
17
+ private readonly _labelBinding$;
18
+ get allowMultiple$(): import("rxjs").Observable<boolean>;
19
+ get allowMultiple(): boolean;
20
+ private readonly _allowMultiple$;
21
+ get filter$(): import("rxjs").Observable<string>;
22
+ get filter(): string;
23
+ private readonly _filter$;
24
+ readonly value$: import("rxjs").Observable<unknown>;
25
+ readonly filteredOptions$: import("rxjs").Observable<T[]>;
26
+ private readonly _optionsAndSelection$;
27
+ setSelection(selection: T | T[]): this;
28
+ setValueBinding(propertyPath: string | null): this;
29
+ setKeyBinding(propertyPath: string | null): this;
30
+ setLabelBinding(propertyPath: string | null): this;
31
+ setOptions(options: T[]): this;
32
+ setAllowMultiple(allowMultiple: boolean): this;
33
+ setFilter(filter: string | null): void;
34
+ reset(): void;
35
+ getOptionByValue$(value: unknown): import("rxjs").Observable<T | undefined>;
36
+ getOptionByLabel$(label: string): import("rxjs").Observable<T | undefined>;
37
+ getOptionByKey$(key: string): import("rxjs").Observable<T | undefined>;
38
+ isSelected$(option: T): import("rxjs").Observable<boolean>;
39
+ getLabel$(option: T): import("rxjs").Observable<unknown>;
40
+ getValue$(option: T): import("rxjs").Observable<unknown>;
41
+ getKey$(option: T): import("rxjs").Observable<unknown>;
42
+ getOptionByValue(value: unknown): T | undefined;
43
+ getOptionByLabel(label: string): T | undefined;
44
+ getOptionByKey(key: string): T | undefined;
45
+ getOption(value: unknown, propertyPath?: string | null, options?: T[]): T | undefined;
46
+ getOptionByIndex(index: number, options?: T[]): T | null;
47
+ getOptionByOffset(offset: number, index: number, options?: T[], config?: {
48
+ loop?: boolean;
49
+ clamp?: boolean;
50
+ }): T | null;
51
+ getFirstOption(options?: T[]): T | null;
52
+ getLastOption(options?: T[]): T | null;
53
+ getOptionIndex(option: T, options?: T[]): number | null;
54
+ getNonMultipleSelectedOption(): T | null;
55
+ getNonMultipleSelectedOptionIndex(): number | null;
56
+ getNonMultipleOptionByOffsetFromSelected(offset: number, config?: {
57
+ loop?: boolean;
58
+ clamp?: boolean;
59
+ }): T | null;
60
+ getLabel(option: T): unknown;
61
+ getValue(option: T): unknown;
62
+ getKey(option: T): unknown;
63
+ getOptionProperty(option: T, propertyPath: string | null): unknown;
64
+ isSelected(option: T): boolean;
65
+ getFilteredOptions(filter?: string, options?: T[]): T[];
66
+ addSelectedOption(option: T): void;
67
+ removeSelectedOption(option: T): void;
68
+ clearSelectedOptions(): void;
69
+ toggleSelectedOption(option: T): void;
70
+ toggleAllSelectedOptions(): void;
71
+ }
72
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethlete/core",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "dependencies": {
5
5
  "tslib": "^2.5.0"
6
6
  },