@recursyve/ngx-material-components 19.0.0-beta.9 → 20.0.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/chip-list/index.d.ts +41 -0
- package/common/index.d.ts +24 -0
- package/dropzone/index.d.ts +125 -0
- package/fesm2022/recursyve-ngx-material-components-chip-list.mjs +157 -0
- package/fesm2022/recursyve-ngx-material-components-chip-list.mjs.map +1 -0
- package/fesm2022/recursyve-ngx-material-components-common.mjs +39 -0
- package/fesm2022/recursyve-ngx-material-components-common.mjs.map +1 -0
- package/fesm2022/recursyve-ngx-material-components-dropzone.mjs +354 -0
- package/fesm2022/recursyve-ngx-material-components-dropzone.mjs.map +1 -0
- package/fesm2022/recursyve-ngx-material-components-form-field-error.mjs +6 -6
- package/fesm2022/recursyve-ngx-material-components-form-field-error.mjs.map +1 -1
- package/fesm2022/recursyve-ngx-material-components-loading.mjs +10 -10
- package/fesm2022/recursyve-ngx-material-components-loading.mjs.map +1 -1
- package/fesm2022/recursyve-ngx-material-components-typeahead.mjs +109 -65
- package/fesm2022/recursyve-ngx-material-components-typeahead.mjs.map +1 -1
- package/form-field-error/index.d.ts +53 -5
- package/index.d.ts +3 -1
- package/loading/index.d.ts +31 -3
- package/package.json +15 -3
- package/typeahead/index.d.ts +212 -4
- package/form-field-error/constant.d.ts +0 -3
- package/form-field-error/error-transformer.d.ts +0 -13
- package/form-field-error/error-translater.d.ts +0 -1
- package/form-field-error/form-field-error.d.ts +0 -8
- package/form-field-error/form-field-error.directive.d.ts +0 -17
- package/form-field-error/options.d.ts +0 -9
- package/form-field-error/provider.d.ts +0 -3
- package/loading/constant.d.ts +0 -2
- package/loading/loading-spinner.d.ts +0 -9
- package/loading/loading.d.ts +0 -13
- package/loading/options.d.ts +0 -4
- package/loading/provider.d.ts +0 -3
- package/typeahead/async-typeahead.d.ts +0 -24
- package/typeahead/constants.d.ts +0 -2
- package/typeahead/provider.d.ts +0 -3
- package/typeahead/providers/async-typeahead.provider.d.ts +0 -11
- package/typeahead/providers/async-typeahead.service.d.ts +0 -39
- package/typeahead/providers/index.d.ts +0 -2
- package/typeahead/typeahead-base.d.ts +0 -110
- package/typeahead/typeahead.d.ts +0 -12
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { Injector, Signal, OnInit } from '@angular/core';
|
|
3
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
|
|
6
|
+
declare class NiceChipListItems<T> {
|
|
7
|
+
readonly removeChip: _angular_core.OutputEmitterRef<number>;
|
|
8
|
+
protected readonly injector: Injector;
|
|
9
|
+
items?: Signal<T[]>;
|
|
10
|
+
formatLabelFn?: (value: T) => string;
|
|
11
|
+
setItemsReactivity(items$: Observable<T[]>): void;
|
|
12
|
+
setFormatLabel(fn: (value: T) => string): void;
|
|
13
|
+
remove(index: number): void;
|
|
14
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NiceChipListItems<any>, never>;
|
|
15
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NiceChipListItems<any>, "nice-chip-list-items", never, {}, { "removeChip": "removeChip"; }, never, never, true, never>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare class NiceChipListDirective<T> implements ControlValueAccessor, OnInit {
|
|
19
|
+
readonly withItemList: _angular_core.InputSignal<NiceChipListItems<T>>;
|
|
20
|
+
readonly reloadOnSelected: _angular_core.InputSignal<boolean>;
|
|
21
|
+
readonly separatorKeyboardCodes: _angular_core.InputSignal<string[]>;
|
|
22
|
+
private readonly elementRef;
|
|
23
|
+
private readonly injector;
|
|
24
|
+
private readonly asyncTypeahead;
|
|
25
|
+
private readonly ngControl;
|
|
26
|
+
private readonly values;
|
|
27
|
+
private propagateChanges?;
|
|
28
|
+
constructor();
|
|
29
|
+
onKeyDown(event: KeyboardEvent): void;
|
|
30
|
+
ngOnInit(): void;
|
|
31
|
+
writeValue(obj: T[] | null): void;
|
|
32
|
+
registerOnChange(fn: (_: T[]) => void): void;
|
|
33
|
+
registerOnTouched(): void;
|
|
34
|
+
private setupAsyncTypeahead;
|
|
35
|
+
private addValue;
|
|
36
|
+
private updateTypeaheadSearchOptions;
|
|
37
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NiceChipListDirective<any>, never>;
|
|
38
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NiceChipListDirective<any>, "input[niceChipList], nice-async-typeahead[niceChipList]", never, { "withItemList": { "alias": "withItemList"; "required": true; "isSignal": true; }; "reloadOnSelected": { "alias": "reloadOnSelected"; "required": false; "isSignal": true; }; "separatorKeyboardCodes": { "alias": "separatorKeyboardCodes"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { NiceChipListDirective, NiceChipListItems };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { FactoryProvider, Provider, InjectionToken, PipeTransform } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
type NiceTranslater = (key: string, params?: Record<string, string>) => string;
|
|
5
|
+
|
|
6
|
+
type NiceTranslaterOptions = {
|
|
7
|
+
translater: Omit<FactoryProvider, "provide" | "multi"> & {
|
|
8
|
+
useFactory: (...args: any[]) => NiceTranslater;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
declare function provideNiceComponents(options: NiceTranslaterOptions): Provider[];
|
|
13
|
+
|
|
14
|
+
declare const NICE_COMPONENTS_TRANSLATER: InjectionToken<unknown>;
|
|
15
|
+
|
|
16
|
+
declare class NiceTranslatePipe implements PipeTransform {
|
|
17
|
+
private readonly translater;
|
|
18
|
+
transform(key: string, params?: Record<string, string>): string;
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NiceTranslatePipe, never>;
|
|
20
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<NiceTranslatePipe, "niceTranslate", true>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { NICE_COMPONENTS_TRANSLATER, NiceTranslatePipe, provideNiceComponents };
|
|
24
|
+
export type { NiceTranslater };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { EventEmitter, OnDestroy, ElementRef, Provider } from '@angular/core';
|
|
3
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
4
|
+
import { MatRippleLoader } from '@angular/material/core';
|
|
5
|
+
|
|
6
|
+
declare class NiceDropzoneDirective {
|
|
7
|
+
fileOver: boolean;
|
|
8
|
+
filesDropped: EventEmitter<FileList>;
|
|
9
|
+
files: _angular_core.OutputEmitterRef<void>;
|
|
10
|
+
onDragOver(event: DragEvent): void;
|
|
11
|
+
onDragLeave(event: DragEvent): void;
|
|
12
|
+
ondrop(event: DragEvent): void;
|
|
13
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NiceDropzoneDirective, never>;
|
|
14
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NiceDropzoneDirective, "[niceDropzone]", never, {}, { "filesDropped": "filesDropped"; "files": "files"; }, never, never, true, never>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type NiceDropzoneImageConfig = {
|
|
18
|
+
minSize?: {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
};
|
|
22
|
+
maxSize?: {
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
};
|
|
26
|
+
recommendedSize?: {
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
type NiceDropzoneFileSizeConfig = {
|
|
32
|
+
size: number;
|
|
33
|
+
unit: "B" | "KB" | "MB" | "GB";
|
|
34
|
+
};
|
|
35
|
+
type NiceDropzoneTranslationKeyConfig = {
|
|
36
|
+
upload: {
|
|
37
|
+
file: string;
|
|
38
|
+
files: string;
|
|
39
|
+
image: string;
|
|
40
|
+
images: string;
|
|
41
|
+
};
|
|
42
|
+
format: {
|
|
43
|
+
label: string;
|
|
44
|
+
};
|
|
45
|
+
ratio: {
|
|
46
|
+
label: string;
|
|
47
|
+
pixels: string;
|
|
48
|
+
};
|
|
49
|
+
size: {
|
|
50
|
+
label: string;
|
|
51
|
+
units: {
|
|
52
|
+
B: string;
|
|
53
|
+
KB: string;
|
|
54
|
+
MB: string;
|
|
55
|
+
GB: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
type NiceFileDimensions = {
|
|
61
|
+
width: number;
|
|
62
|
+
height: number;
|
|
63
|
+
ratio: number;
|
|
64
|
+
};
|
|
65
|
+
type NiceLocalFile = {
|
|
66
|
+
file: File;
|
|
67
|
+
name: string;
|
|
68
|
+
size?: number;
|
|
69
|
+
dimensions?: NiceFileDimensions;
|
|
70
|
+
};
|
|
71
|
+
type NiceRemoteFile = {
|
|
72
|
+
id: string | number;
|
|
73
|
+
name: string;
|
|
74
|
+
url: string;
|
|
75
|
+
size?: number;
|
|
76
|
+
};
|
|
77
|
+
type NiceSelectedFiles = NiceLocalFile | NiceRemoteFile;
|
|
78
|
+
declare function isLocalFile(file: NiceSelectedFiles): file is NiceLocalFile;
|
|
79
|
+
declare function isRemoteFile(file: NiceSelectedFiles): file is NiceRemoteFile;
|
|
80
|
+
|
|
81
|
+
declare const niceDropzoneModes: readonly ["image", "file", "all"];
|
|
82
|
+
type NiceDropzoneModes = (typeof niceDropzoneModes)[number];
|
|
83
|
+
declare class NiceDropzone implements OnDestroy, ControlValueAccessor {
|
|
84
|
+
readonly mode: _angular_core.InputSignal<"file" | "image" | "all">;
|
|
85
|
+
readonly multiple: _angular_core.InputSignalWithTransform<boolean, any>;
|
|
86
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, any>;
|
|
87
|
+
readonly accept: _angular_core.InputSignal<string[] | undefined>;
|
|
88
|
+
readonly config: _angular_core.InputSignal<NiceDropzoneImageConfig | undefined>;
|
|
89
|
+
readonly maxFileSize: _angular_core.InputSignal<NiceDropzoneFileSizeConfig | undefined>;
|
|
90
|
+
protected readonly _elementRef: _angular_core.Signal<ElementRef<any> | undefined>;
|
|
91
|
+
protected readonly _inputRef: _angular_core.Signal<ElementRef<HTMLInputElement> | undefined>;
|
|
92
|
+
/**
|
|
93
|
+
* Handles the lazy creation of the MatButton ripple.
|
|
94
|
+
* Used to improve the initial load time of large applications.
|
|
95
|
+
*/
|
|
96
|
+
protected readonly _rippleLoader: MatRippleLoader;
|
|
97
|
+
protected readonly _translationKeys: NiceDropzoneTranslationKeyConfig;
|
|
98
|
+
protected readonly files: _angular_core.WritableSignal<NiceSelectedFiles[]>;
|
|
99
|
+
protected _disabled: boolean;
|
|
100
|
+
private _onChange;
|
|
101
|
+
private _value;
|
|
102
|
+
constructor();
|
|
103
|
+
ngOnDestroy(): void;
|
|
104
|
+
writeValue(value: NiceSelectedFiles | NiceSelectedFiles[] | null): void;
|
|
105
|
+
registerOnChange(fn: (value: NiceSelectedFiles | NiceSelectedFiles[] | null) => void): void;
|
|
106
|
+
registerOnTouched(): void;
|
|
107
|
+
setDisabledState(disabled: boolean): void;
|
|
108
|
+
onFileChanged(event: Event): void;
|
|
109
|
+
onFilesDropped(fileList: FileList): Promise<void>;
|
|
110
|
+
onFileDelete(index: number): void;
|
|
111
|
+
protected propagateChanges(value: NiceSelectedFiles | NiceSelectedFiles[] | null): void;
|
|
112
|
+
protected getImageDimension(file: File): Promise<NiceFileDimensions>;
|
|
113
|
+
protected resetInput(): void;
|
|
114
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NiceDropzone, never>;
|
|
115
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NiceDropzone, "nice-dropzone", never, { "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "accept": { "alias": "accept"; "required": false; "isSignal": true; }; "config": { "alias": "config"; "required": false; "isSignal": true; }; "maxFileSize": { "alias": "maxFileSize"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
type NiceDropzoneOptions = {
|
|
119
|
+
translationKeys: NiceDropzoneTranslationKeyConfig;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
declare function provideDropzone(options?: NiceDropzoneOptions): Provider[];
|
|
123
|
+
|
|
124
|
+
export { NiceDropzone, NiceDropzoneDirective, isLocalFile, isRemoteFile, niceDropzoneModes, provideDropzone };
|
|
125
|
+
export type { NiceDropzoneFileSizeConfig, NiceDropzoneImageConfig, NiceDropzoneModes, NiceDropzoneOptions, NiceDropzoneTranslationKeyConfig, NiceFileDimensions, NiceLocalFile, NiceRemoteFile, NiceSelectedFiles };
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, inject, ElementRef, Injector, signal, effect, untracked, HostListener, Directive, Component, output, ChangeDetectionStrategy } from '@angular/core';
|
|
3
|
+
import { toObservable, toSignal } from '@angular/core/rxjs-interop';
|
|
4
|
+
import { NgControl } from '@angular/forms';
|
|
5
|
+
import { NiceAsyncTypeahead } from '@recursyve/ngx-material-components/typeahead';
|
|
6
|
+
import { MatChipSet, MatChipRemove, MatChipRow } from '@angular/material/chips';
|
|
7
|
+
|
|
8
|
+
class NiceChipListDirective {
|
|
9
|
+
withItemList = input.required(...(ngDevMode ? [{ debugName: "withItemList" }] : []));
|
|
10
|
+
reloadOnSelected = input(true, ...(ngDevMode ? [{ debugName: "reloadOnSelected" }] : []));
|
|
11
|
+
separatorKeyboardCodes = input(["Enter"], ...(ngDevMode ? [{ debugName: "separatorKeyboardCodes" }] : []));
|
|
12
|
+
elementRef = inject(ElementRef);
|
|
13
|
+
injector = inject(Injector);
|
|
14
|
+
asyncTypeahead = inject(NiceAsyncTypeahead, { optional: true });
|
|
15
|
+
ngControl = inject(NgControl, { optional: true });
|
|
16
|
+
values = signal([], ...(ngDevMode ? [{ debugName: "values" }] : []));
|
|
17
|
+
propagateChanges;
|
|
18
|
+
constructor() {
|
|
19
|
+
if (this.ngControl) {
|
|
20
|
+
this.ngControl.valueAccessor = this;
|
|
21
|
+
}
|
|
22
|
+
effect(() => {
|
|
23
|
+
const values = this.values();
|
|
24
|
+
untracked(() => this.updateTypeaheadSearchOptions(values));
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
onKeyDown(event) {
|
|
28
|
+
if (this.asyncTypeahead) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (!this.separatorKeyboardCodes().includes(event.code)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (!this.elementRef.nativeElement.validity.valid) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
this.addValue(this.elementRef.nativeElement.value);
|
|
38
|
+
this.elementRef.nativeElement.value = "";
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
}
|
|
41
|
+
ngOnInit() {
|
|
42
|
+
this.setupAsyncTypeahead();
|
|
43
|
+
const parentElement = this.elementRef.nativeElement.parentElement;
|
|
44
|
+
if (parentElement.classList.contains("mat-mdc-form-field-infix")) {
|
|
45
|
+
parentElement.style.alignItems = "flex-start";
|
|
46
|
+
parentElement.style.flexDirection = "column-reverse";
|
|
47
|
+
}
|
|
48
|
+
const withItemList = this.withItemList();
|
|
49
|
+
withItemList.setItemsReactivity(toObservable(this.values, { injector: this.injector }));
|
|
50
|
+
withItemList.removeChip.subscribe((index) => {
|
|
51
|
+
const values = [...this.values()];
|
|
52
|
+
values.splice(index, 1);
|
|
53
|
+
this.propagateChanges?.(values);
|
|
54
|
+
this.values.set(values);
|
|
55
|
+
});
|
|
56
|
+
if (this.asyncTypeahead) {
|
|
57
|
+
withItemList.setFormatLabel((item) => this.asyncTypeahead.formatLabel(item));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
writeValue(obj) {
|
|
61
|
+
if (!obj) {
|
|
62
|
+
this.values.set([]);
|
|
63
|
+
}
|
|
64
|
+
else if (Array.isArray(obj)) {
|
|
65
|
+
this.values.set([...obj]);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
registerOnChange(fn) {
|
|
69
|
+
this.propagateChanges = fn;
|
|
70
|
+
}
|
|
71
|
+
registerOnTouched() {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
setupAsyncTypeahead() {
|
|
75
|
+
if (!this.asyncTypeahead) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
this.asyncTypeahead.selected
|
|
79
|
+
.subscribe((value) => {
|
|
80
|
+
if (!value) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
this.addValue(value);
|
|
84
|
+
this.asyncTypeahead?.removeActiveValue();
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
addValue(value) {
|
|
88
|
+
const values = [...this.values()];
|
|
89
|
+
if (values.includes(value)) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
values.push(value);
|
|
93
|
+
this.propagateChanges?.(values);
|
|
94
|
+
this.values.set(values);
|
|
95
|
+
}
|
|
96
|
+
updateTypeaheadSearchOptions(ignore) {
|
|
97
|
+
if (!this.asyncTypeahead) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const searchOptions = this.asyncTypeahead.searchOptions();
|
|
101
|
+
this.asyncTypeahead.setSearchOptions({ ...(searchOptions ?? {}), ignore });
|
|
102
|
+
}
|
|
103
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: NiceChipListDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
104
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.1", type: NiceChipListDirective, isStandalone: true, selector: "input[niceChipList], nice-async-typeahead[niceChipList]", inputs: { withItemList: { classPropertyName: "withItemList", publicName: "withItemList", isSignal: true, isRequired: true, transformFunction: null }, reloadOnSelected: { classPropertyName: "reloadOnSelected", publicName: "reloadOnSelected", isSignal: true, isRequired: false, transformFunction: null }, separatorKeyboardCodes: { classPropertyName: "separatorKeyboardCodes", publicName: "separatorKeyboardCodes", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keydown": "onKeyDown($event)" } }, ngImport: i0 });
|
|
105
|
+
}
|
|
106
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: NiceChipListDirective, decorators: [{
|
|
107
|
+
type: Directive,
|
|
108
|
+
args: [{
|
|
109
|
+
selector: "input[niceChipList], nice-async-typeahead[niceChipList]"
|
|
110
|
+
}]
|
|
111
|
+
}], ctorParameters: () => [], propDecorators: { onKeyDown: [{
|
|
112
|
+
type: HostListener,
|
|
113
|
+
args: ["keydown", ["$event"]]
|
|
114
|
+
}] } });
|
|
115
|
+
|
|
116
|
+
class NiceChipListItemsClearIcon {
|
|
117
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: NiceChipListItemsClearIcon, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
118
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.2.1", type: NiceChipListItemsClearIcon, isStandalone: true, selector: "nice-chip-list-items-clear-icon", ngImport: i0, template: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n <path d=\"M12 0a12 12 0 1 0 12 12A12 12 0 0 0 12 0Zm5.49 16.07a1 1 0 0 1 -1.41 1.42l-3.9 -3.9a0.25 0.25 0 0 0 -0.36 0l-3.9 3.9a1 1 0 1 1 -1.41 -1.42l3.9 -3.89a0.25 0.25 0 0 0 0 -0.36l-3.9 -3.9a1 1 0 0 1 1.41 -1.41l3.9 3.9a0.25 0.25 0 0 0 0.36 0l3.9 -3.9a1 1 0 0 1 1.41 1.41l-3.9 3.9a0.25 0.25 0 0 0 0 0.36Z\" fill=\"currentColor\" stroke-width=\"1\"></path>\n</svg>\n" });
|
|
119
|
+
}
|
|
120
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: NiceChipListItemsClearIcon, decorators: [{
|
|
121
|
+
type: Component,
|
|
122
|
+
args: [{ selector: "nice-chip-list-items-clear-icon", template: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n <path d=\"M12 0a12 12 0 1 0 12 12A12 12 0 0 0 12 0Zm5.49 16.07a1 1 0 0 1 -1.41 1.42l-3.9 -3.9a0.25 0.25 0 0 0 -0.36 0l-3.9 3.9a1 1 0 1 1 -1.41 -1.42l3.9 -3.89a0.25 0.25 0 0 0 0 -0.36l-3.9 -3.9a1 1 0 0 1 1.41 -1.41l3.9 3.9a0.25 0.25 0 0 0 0.36 0l3.9 -3.9a1 1 0 0 1 1.41 1.41l-3.9 3.9a0.25 0.25 0 0 0 0 0.36Z\" fill=\"currentColor\" stroke-width=\"1\"></path>\n</svg>\n" }]
|
|
123
|
+
}] });
|
|
124
|
+
|
|
125
|
+
class NiceChipListItems {
|
|
126
|
+
removeChip = output();
|
|
127
|
+
injector = inject(Injector);
|
|
128
|
+
items;
|
|
129
|
+
formatLabelFn;
|
|
130
|
+
setItemsReactivity(items$) {
|
|
131
|
+
this.items = toSignal(items$, { injector: this.injector, initialValue: [] });
|
|
132
|
+
}
|
|
133
|
+
setFormatLabel(fn) {
|
|
134
|
+
this.formatLabelFn = fn;
|
|
135
|
+
}
|
|
136
|
+
remove(index) {
|
|
137
|
+
this.removeChip.emit(index);
|
|
138
|
+
}
|
|
139
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: NiceChipListItems, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
140
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.2.1", type: NiceChipListItems, isStandalone: true, selector: "nice-chip-list-items", outputs: { removeChip: "removeChip" }, ngImport: i0, template: "@if (items) {\n <mat-chip-set>\n @for (item of items(); track item) {\n <mat-chip-row [highlighted]=\"true\" (removed)=\"remove($index)\">\n @if (formatLabelFn) {\n {{ formatLabelFn(item) }}\n } @else {\n {{ item }}\n }\n\n <button matChipRemove>\n <nice-chip-list-items-clear-icon />\n </button>\n </mat-chip-row>\n }\n </mat-chip-set>\n}\n", styles: ["nice-chip-list-items-clear-icon{margin-top:-1px;width:16px;height:16px}\n"], dependencies: [{ kind: "component", type: MatChipSet, selector: "mat-chip-set", inputs: ["disabled", "role", "tabIndex"] }, { kind: "directive", type: MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }, { kind: "component", type: NiceChipListItemsClearIcon, selector: "nice-chip-list-items-clear-icon" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
141
|
+
}
|
|
142
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: NiceChipListItems, decorators: [{
|
|
143
|
+
type: Component,
|
|
144
|
+
args: [{ selector: "nice-chip-list-items", imports: [
|
|
145
|
+
MatChipSet,
|
|
146
|
+
MatChipRemove,
|
|
147
|
+
MatChipRow,
|
|
148
|
+
NiceChipListItemsClearIcon
|
|
149
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (items) {\n <mat-chip-set>\n @for (item of items(); track item) {\n <mat-chip-row [highlighted]=\"true\" (removed)=\"remove($index)\">\n @if (formatLabelFn) {\n {{ formatLabelFn(item) }}\n } @else {\n {{ item }}\n }\n\n <button matChipRemove>\n <nice-chip-list-items-clear-icon />\n </button>\n </mat-chip-row>\n }\n </mat-chip-set>\n}\n", styles: ["nice-chip-list-items-clear-icon{margin-top:-1px;width:16px;height:16px}\n"] }]
|
|
150
|
+
}] });
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Generated bundle index. Do not edit.
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
export { NiceChipListDirective, NiceChipListItems };
|
|
157
|
+
//# sourceMappingURL=recursyve-ngx-material-components-chip-list.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recursyve-ngx-material-components-chip-list.mjs","sources":["../../../src/material-components/chip-list/chip-list.ts","../../../src/material-components/chip-list/icons/clear/chip-list-items-clear-icon.ts","../../../src/material-components/chip-list/icons/clear/chip-list-items-clear-icon.svg","../../../src/material-components/chip-list/items/chip-list-items.ts","../../../src/material-components/chip-list/items/chip-list-items.html","../../../src/material-components/chip-list/recursyve-ngx-material-components-chip-list.ts"],"sourcesContent":["import {\n Directive,\n effect,\n ElementRef,\n HostListener,\n inject,\n Injector,\n input,\n OnInit,\n signal,\n untracked\n} from \"@angular/core\";\nimport { toObservable } from \"@angular/core/rxjs-interop\";\nimport { ControlValueAccessor, NgControl } from \"@angular/forms\";\nimport { NiceAsyncTypeahead } from \"@recursyve/ngx-material-components/typeahead\";\nimport { NiceChipListItems } from \"./items/chip-list-items\";\n\n@Directive({\n selector: \"input[niceChipList], nice-async-typeahead[niceChipList]\"\n})\nexport class NiceChipListDirective<T> implements ControlValueAccessor, OnInit {\n public readonly withItemList = input.required<NiceChipListItems<T>>();\n public readonly reloadOnSelected = input<boolean>(true);\n public readonly separatorKeyboardCodes = input<string[]>([\"Enter\"]);\n\n private readonly elementRef = inject(ElementRef);\n private readonly injector = inject(Injector);\n private readonly asyncTypeahead = inject<NiceAsyncTypeahead<T>>(NiceAsyncTypeahead, { optional: true });\n private readonly ngControl = inject<NgControl>(NgControl, { optional: true });\n\n private readonly values = signal<T[]>([]);\n\n private propagateChanges?: (_: T[]) => void;\n\n constructor() {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n\n effect(() => {\n const values = this.values();\n untracked(() => this.updateTypeaheadSearchOptions(values));\n });\n }\n\n @HostListener(\"keydown\", [\"$event\"])\n public onKeyDown(event: KeyboardEvent): void {\n if (this.asyncTypeahead) {\n return;\n }\n\n if (!this.separatorKeyboardCodes().includes(event.code)) {\n return;\n }\n\n if (!this.elementRef.nativeElement.validity.valid) {\n return;\n }\n\n this.addValue(this.elementRef.nativeElement.value);\n this.elementRef.nativeElement.value = \"\";\n event.preventDefault();\n }\n\n public ngOnInit(): void {\n this.setupAsyncTypeahead();\n\n const parentElement = this.elementRef.nativeElement.parentElement;\n if (parentElement.classList.contains(\"mat-mdc-form-field-infix\")) {\n parentElement.style.alignItems = \"flex-start\";\n parentElement.style.flexDirection = \"column-reverse\";\n }\n\n const withItemList = this.withItemList();\n withItemList.setItemsReactivity(toObservable(this.values, { injector: this.injector }));\n withItemList.removeChip.subscribe((index) => {\n const values = [...this.values()];\n values.splice(index, 1);\n\n this.propagateChanges?.(values);\n this.values.set(values);\n });\n\n if (this.asyncTypeahead) {\n withItemList.setFormatLabel((item) => this.asyncTypeahead!.formatLabel(item));\n }\n }\n\n public writeValue(obj: T[] | null): void {\n if (!obj) {\n this.values.set([]);\n } else if (Array.isArray(obj)) {\n this.values.set([...obj]);\n }\n }\n\n public registerOnChange(fn: (_: T[]) => void): void {\n this.propagateChanges = fn;\n }\n\n public registerOnTouched(): void {\n return;\n }\n\n private setupAsyncTypeahead(): void {\n if (!this.asyncTypeahead) {\n return;\n }\n\n this.asyncTypeahead.selected\n .subscribe((value) => {\n if (!value) {\n return;\n }\n\n this.addValue(value);\n this.asyncTypeahead?.removeActiveValue();\n });\n }\n\n private addValue(value: T): void {\n const values = [...this.values()];\n if (values.includes(value)) {\n return;\n }\n\n values.push(value);\n this.propagateChanges?.(values);\n this.values.set(values);\n }\n\n private updateTypeaheadSearchOptions(ignore: T[]): void {\n if (!this.asyncTypeahead) {\n return;\n }\n\n const searchOptions = this.asyncTypeahead.searchOptions();\n this.asyncTypeahead.setSearchOptions({ ...(searchOptions ?? {}), ignore });\n }\n}\n","import { Component } from \"@angular/core\";\n\n@Component({\n selector: \"nice-chip-list-items-clear-icon\",\n templateUrl: \"chip-list-items-clear-icon.svg\"\n})\nexport class NiceChipListItemsClearIcon {}\n","<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n <path d=\"M12 0a12 12 0 1 0 12 12A12 12 0 0 0 12 0Zm5.49 16.07a1 1 0 0 1 -1.41 1.42l-3.9 -3.9a0.25 0.25 0 0 0 -0.36 0l-3.9 3.9a1 1 0 1 1 -1.41 -1.42l3.9 -3.89a0.25 0.25 0 0 0 0 -0.36l-3.9 -3.9a1 1 0 0 1 1.41 -1.41l3.9 3.9a0.25 0.25 0 0 0 0.36 0l3.9 -3.9a1 1 0 0 1 1.41 1.41l-3.9 3.9a0.25 0.25 0 0 0 0 0.36Z\" fill=\"currentColor\" stroke-width=\"1\"></path>\n</svg>\n","import { ChangeDetectionStrategy, Component, inject, Injector, output, Signal } from \"@angular/core\";\nimport { toSignal } from \"@angular/core/rxjs-interop\";\nimport { MatChipRemove, MatChipRow, MatChipSet } from \"@angular/material/chips\";\nimport { Observable } from \"rxjs\";\nimport { NiceChipListItemsClearIcon } from \"../icons/clear/chip-list-items-clear-icon\";\n\n@Component({\n selector: \"nice-chip-list-items\",\n templateUrl: \"./chip-list-items.html\",\n styleUrls: [\"./chip-list-items.scss\"],\n imports: [\n MatChipSet,\n MatChipRemove,\n MatChipRow,\n NiceChipListItemsClearIcon\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class NiceChipListItems<T> {\n public readonly removeChip = output<number>();\n\n protected readonly injector = inject(Injector);\n\n public items?: Signal<T[]>;\n public formatLabelFn?: (value: T) => string;\n\n public setItemsReactivity(items$: Observable<T[]>): void {\n this.items = toSignal(items$, { injector: this.injector, initialValue: [] });\n }\n\n public setFormatLabel(fn: (value: T) => string): void {\n this.formatLabelFn = fn;\n }\n\n public remove(index: number): void {\n this.removeChip.emit(index);\n }\n}\n","@if (items) {\n <mat-chip-set>\n @for (item of items(); track item) {\n <mat-chip-row [highlighted]=\"true\" (removed)=\"remove($index)\">\n @if (formatLabelFn) {\n {{ formatLabelFn(item) }}\n } @else {\n {{ item }}\n }\n\n <button matChipRemove>\n <nice-chip-list-items-clear-icon />\n </button>\n </mat-chip-row>\n }\n </mat-chip-set>\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAoBa,qBAAqB,CAAA;AACd,IAAA,YAAY,GAAG,KAAK,CAAC,QAAQ,uDAAwB;AACrD,IAAA,gBAAgB,GAAG,KAAK,CAAU,IAAI,4DAAC;AACvC,IAAA,sBAAsB,GAAG,KAAK,CAAW,CAAC,OAAO,CAAC,kEAAC;AAElD,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAC/B,IAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IAC3B,cAAc,GAAG,MAAM,CAAwB,kBAAkB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACtF,SAAS,GAAG,MAAM,CAAY,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAE5D,IAAA,MAAM,GAAG,MAAM,CAAM,EAAE,kDAAC;AAEjC,IAAA,gBAAgB;AAExB,IAAA,WAAA,GAAA;AACI,QAAA,IAAI,IAAI,CAAC,SAAS,EAAE;AAChB,YAAA,IAAI,CAAC,SAAS,CAAC,aAAa,GAAG,IAAI;QACvC;QAEA,MAAM,CAAC,MAAK;AACR,YAAA,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE;YAC5B,SAAS,CAAC,MAAM,IAAI,CAAC,4BAA4B,CAAC,MAAM,CAAC,CAAC;AAC9D,QAAA,CAAC,CAAC;IACN;AAGO,IAAA,SAAS,CAAC,KAAoB,EAAA;AACjC,QAA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,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDNQ,UAAU,mGACV,aAAa,EAAA,QAAA,EAAA,iBAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACb,UAAU,EAAA,QAAA,EAAA,wEAAA,EAAA,MAAA,EAAA,CAAA,UAAA,CAAA,EAAA,OAAA,EAAA,CAAA,QAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACV,0BAA0B,EAAA,QAAA,EAAA,iCAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAIrB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAZ7B,SAAS;AACI,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,sBAAsB,EAAA,OAAA,EAGvB;wBACL,UAAU;wBACV,aAAa;wBACb,UAAU;wBACV;qBACH,EAAA,eAAA,EACgB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,qgBAAA,EAAA,MAAA,EAAA,CAAA,2EAAA,CAAA,EAAA;;;AEhBnD;;AAEG;;;;"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, Pipe } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
const NICE_COMPONENTS_TRANSLATER = new InjectionToken("nice_components_translater");
|
|
5
|
+
|
|
6
|
+
function provideNiceComponents(options) {
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
provide: NICE_COMPONENTS_TRANSLATER,
|
|
10
|
+
...options.translater
|
|
11
|
+
}
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
class NiceTranslatePipe {
|
|
16
|
+
translater = inject(NICE_COMPONENTS_TRANSLATER);
|
|
17
|
+
transform(key, params) {
|
|
18
|
+
return this.translater(key, params);
|
|
19
|
+
}
|
|
20
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: NiceTranslatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
21
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.2.1", ngImport: i0, type: NiceTranslatePipe, isStandalone: true, name: "niceTranslate" });
|
|
22
|
+
}
|
|
23
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: NiceTranslatePipe, decorators: [{
|
|
24
|
+
type: Pipe,
|
|
25
|
+
args: [{
|
|
26
|
+
name: "niceTranslate"
|
|
27
|
+
}]
|
|
28
|
+
}] });
|
|
29
|
+
|
|
30
|
+
/*
|
|
31
|
+
* Public API Surface of dropzone
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Generated bundle index. Do not edit.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
export { NICE_COMPONENTS_TRANSLATER, NiceTranslatePipe, provideNiceComponents };
|
|
39
|
+
//# sourceMappingURL=recursyve-ngx-material-components-common.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recursyve-ngx-material-components-common.mjs","sources":["../../../src/material-components/common/translater/constant.ts","../../../src/material-components/common/provider.ts","../../../src/material-components/common/translater/translate-pipe.ts","../../../src/material-components/common/index.ts","../../../src/material-components/common/recursyve-ngx-material-components-common.ts"],"sourcesContent":["import { InjectionToken } from \"@angular/core\";\n\nexport const NICE_COMPONENTS_TRANSLATER = new InjectionToken(\"nice_components_translater\");\n","import { Provider } from \"@angular/core\";\nimport { NICE_COMPONENTS_TRANSLATER } from \"./translater/constant\";\nimport { NiceTranslaterOptions } from \"./translater/options\";\n\nexport function provideNiceComponents(options: NiceTranslaterOptions): Provider[] {\n return [\n { \n provide: NICE_COMPONENTS_TRANSLATER,\n ...options.translater\n }\n ];\n}\n","import { inject, Pipe, PipeTransform } from \"@angular/core\";\nimport { NICE_COMPONENTS_TRANSLATER } from \"./constant\";\nimport { NiceTranslater } from \"./translater\";\n\n@Pipe({\n name: \"niceTranslate\"\n})\nexport class NiceTranslatePipe implements PipeTransform {\n private readonly translater = inject<NiceTranslater>(NICE_COMPONENTS_TRANSLATER);\n\n public transform(key: string, params?: Record<string, string>): string {\n return this.translater(key, params);\n }\n}\n","/*\n * Public API Surface of dropzone\n */\n\nexport * from \"./provider\";\nexport * from \"./translater/constant\";\nexport * from \"./translater/translate-pipe\";\nexport * from \"./translater/translater\";\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAEa,0BAA0B,GAAG,IAAI,cAAc,CAAC,4BAA4B;;ACEnF,SAAU,qBAAqB,CAAC,OAA8B,EAAA;IAChE,OAAO;AACH,QAAA;AACI,YAAA,OAAO,EAAE,0BAA0B;YACnC,GAAG,OAAO,CAAC;AACd;KACJ;AACL;;MCJa,iBAAiB,CAAA;AACT,IAAA,UAAU,GAAG,MAAM,CAAiB,0BAA0B,CAAC;IAEzE,SAAS,CAAC,GAAW,EAAE,MAA+B,EAAA;QACzD,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;IACvC;uGALS,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA;qGAAjB,iBAAiB,EAAA,YAAA,EAAA,IAAA,EAAA,IAAA,EAAA,eAAA,EAAA,CAAA;;2FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAH7B,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACF,oBAAA,IAAI,EAAE;AACT,iBAAA;;;ACND;;AAEG;;ACFH;;AAEG;;;;"}
|