ngx-kit 1.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/README.md +2 -0
- package/fesm2022/ngx-input-angle-selector.mjs +338 -0
- package/fesm2022/ngx-input-angle-selector.mjs.map +1 -0
- package/fesm2022/ngx-input-box-shadow.mjs +422 -0
- package/fesm2022/ngx-input-box-shadow.mjs.map +1 -0
- package/fesm2022/ngx-input-color-picker.mjs +1348 -0
- package/fesm2022/ngx-input-color-picker.mjs.map +1 -0
- package/fesm2022/ngx-input-gradient-picker.mjs +607 -0
- package/fesm2022/ngx-input-gradient-picker.mjs.map +1 -0
- package/fesm2022/ngx-input-shared.mjs +915 -0
- package/fesm2022/ngx-input-shared.mjs.map +1 -0
- package/fesm2022/ngx-input.mjs +8 -0
- package/fesm2022/ngx-input.mjs.map +1 -0
- package/package.json +58 -0
- package/types/ngx-input-angle-selector.d.ts +79 -0
- package/types/ngx-input-box-shadow.d.ts +104 -0
- package/types/ngx-input-color-picker.d.ts +244 -0
- package/types/ngx-input-gradient-picker.d.ts +86 -0
- package/types/ngx-input-shared.d.ts +227 -0
- package/types/ngx-input.d.ts +3 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { OnInit, OnDestroy, EventEmitter, ChangeDetectorRef, AfterViewInit, ElementRef, Renderer2, ViewContainerRef } from '@angular/core';
|
|
3
|
+
import { ControlValueAccessor, Validator, AbstractControl, ValidationErrors } from '@angular/forms';
|
|
4
|
+
import { BrowserService, RangeSliderComponent, DialogService } from 'ngx-input/shared';
|
|
5
|
+
|
|
6
|
+
interface GradientStop {
|
|
7
|
+
id: string;
|
|
8
|
+
value: number;
|
|
9
|
+
color: string;
|
|
10
|
+
}
|
|
11
|
+
type GradientType = 'linear' | 'radial';
|
|
12
|
+
|
|
13
|
+
declare class NgxInputGradientComponent implements OnInit, OnDestroy, ControlValueAccessor, Validator {
|
|
14
|
+
private cd;
|
|
15
|
+
browserService: BrowserService;
|
|
16
|
+
theme: 'light' | 'dark';
|
|
17
|
+
set setTheme(val: 'light' | 'dark' | 'auto');
|
|
18
|
+
change: EventEmitter<string>;
|
|
19
|
+
defaultGradients: string[];
|
|
20
|
+
resultGradient: string;
|
|
21
|
+
baseBg: string;
|
|
22
|
+
rangeValues: GradientStop[];
|
|
23
|
+
type: GradientType;
|
|
24
|
+
rotation: number;
|
|
25
|
+
selectedIndex: number;
|
|
26
|
+
isDisabled: boolean;
|
|
27
|
+
_onChange: (value: string) => void;
|
|
28
|
+
_onTouched: () => void;
|
|
29
|
+
_onValidateChange: () => void;
|
|
30
|
+
rangeSlider?: RangeSliderComponent;
|
|
31
|
+
constructor(cd: ChangeDetectorRef);
|
|
32
|
+
ngOnInit(): void;
|
|
33
|
+
ngOnDestroy(): void;
|
|
34
|
+
registerOnChange(fn: any): void;
|
|
35
|
+
registerOnTouched(fn: any): void;
|
|
36
|
+
setDisabledState(disabled: boolean): void;
|
|
37
|
+
registerOnValidatorChange(fn: () => void): void;
|
|
38
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
39
|
+
writeValue(value: any): void;
|
|
40
|
+
private generateId;
|
|
41
|
+
stopPropagation(ev: Event): void;
|
|
42
|
+
remove(): void;
|
|
43
|
+
generateGradient(ev?: string): void;
|
|
44
|
+
updateRangeSlider(): void;
|
|
45
|
+
emitChange(): void;
|
|
46
|
+
setDefaultGradients(): void;
|
|
47
|
+
onSelectDefault(item: string, i: number): void;
|
|
48
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxInputGradientComponent, never>;
|
|
49
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NgxInputGradientComponent, "ngx-input-gradient", never, { "setTheme": { "alias": "theme"; "required": false; }; }, { "change": "change"; }, never, never, true, never>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
declare class NgxInputGradient implements AfterViewInit, OnDestroy, ControlValueAccessor, Validator {
|
|
53
|
+
private el;
|
|
54
|
+
private renderer;
|
|
55
|
+
private viewContainerRef;
|
|
56
|
+
private dialogService;
|
|
57
|
+
setInputBackground: boolean;
|
|
58
|
+
theme: 'light' | 'dark' | 'auto';
|
|
59
|
+
private _targetInput?;
|
|
60
|
+
set ngxInputColor(el: HTMLInputElement | ElementRef<HTMLInputElement> | null | undefined | '');
|
|
61
|
+
change: EventEmitter<string>;
|
|
62
|
+
private boundInputHandler;
|
|
63
|
+
private isHostInput;
|
|
64
|
+
private pickerRef?;
|
|
65
|
+
value: string;
|
|
66
|
+
_onChange: (value: string) => void;
|
|
67
|
+
_onTouched: () => void;
|
|
68
|
+
_onValidateChange: () => void;
|
|
69
|
+
constructor(el: ElementRef<HTMLInputElement>, renderer: Renderer2, viewContainerRef: ViewContainerRef, dialogService: DialogService);
|
|
70
|
+
onClick(ev: Event): void;
|
|
71
|
+
ngAfterViewInit(): void;
|
|
72
|
+
registerOnChange(fn: any): void;
|
|
73
|
+
registerOnTouched(fn: any): void;
|
|
74
|
+
setDisabledState(disabled: boolean): void;
|
|
75
|
+
registerOnValidatorChange(fn: () => void): void;
|
|
76
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
77
|
+
ngOnDestroy(): void;
|
|
78
|
+
writeValue(val: any): void;
|
|
79
|
+
toggleColorPicker(): void;
|
|
80
|
+
destroyPicker(): void;
|
|
81
|
+
private emitChange;
|
|
82
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxInputGradient, never>;
|
|
83
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgxInputGradient, "[ngxInputGradient]", never, { "setInputBackground": { "alias": "setInputBackground"; "required": false; }; "theme": { "alias": "theme"; "required": false; }; "ngxInputColor": { "alias": "ngxInputColor"; "required": false; }; }, { "change": "change"; }, never, never, true, never>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export { NgxInputGradient, NgxInputGradientComponent };
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { OnInit, EventEmitter, ElementRef, ChangeDetectorRef, ComponentRef, Type, ViewContainerRef, OnDestroy } from '@angular/core';
|
|
3
|
+
import { ControlValueAccessor, Validator, AbstractControl, ValidationErrors, FormControl } from '@angular/forms';
|
|
4
|
+
|
|
5
|
+
interface IValue {
|
|
6
|
+
id?: string;
|
|
7
|
+
value: number;
|
|
8
|
+
}
|
|
9
|
+
declare class ValueModel {
|
|
10
|
+
id: string;
|
|
11
|
+
value: number;
|
|
12
|
+
x?: number;
|
|
13
|
+
thumb?: HTMLElement;
|
|
14
|
+
color?: string;
|
|
15
|
+
}
|
|
16
|
+
declare class RangeSliderComponent implements OnInit, ControlValueAccessor, Validator {
|
|
17
|
+
private changeDetectorRef;
|
|
18
|
+
/**
|
|
19
|
+
* The step value for the slider
|
|
20
|
+
*/
|
|
21
|
+
step: number;
|
|
22
|
+
/**
|
|
23
|
+
* The minimum value for the slider
|
|
24
|
+
*/
|
|
25
|
+
min: number;
|
|
26
|
+
/**
|
|
27
|
+
* The maximum value for the slider
|
|
28
|
+
*/
|
|
29
|
+
max: number;
|
|
30
|
+
/**
|
|
31
|
+
* The background color of the slider
|
|
32
|
+
* - can use css like `background: linear-gradient(to right, red, blue);`
|
|
33
|
+
* - or a solid color like `background: red;`
|
|
34
|
+
*/
|
|
35
|
+
background?: string;
|
|
36
|
+
/**
|
|
37
|
+
* If true, the background will be transparent
|
|
38
|
+
*/
|
|
39
|
+
isBgTransparent: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* If true, clicking on the slider will add a new range at that position
|
|
42
|
+
*/
|
|
43
|
+
addNewRangeOnClick: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The current value of the slider
|
|
46
|
+
*/
|
|
47
|
+
change: EventEmitter<IValue[]>;
|
|
48
|
+
selectedIndex?: number;
|
|
49
|
+
selectedIndexChange: EventEmitter<number>;
|
|
50
|
+
private isDragging;
|
|
51
|
+
slider: ElementRef<HTMLDivElement>;
|
|
52
|
+
thumb?: ElementRef<HTMLDivElement>;
|
|
53
|
+
values: ValueModel[];
|
|
54
|
+
isDisabled: boolean;
|
|
55
|
+
_onChange: (value: IValue[]) => void;
|
|
56
|
+
_onTouched: () => void;
|
|
57
|
+
_validatorOnChange: () => void;
|
|
58
|
+
private sliderRect?;
|
|
59
|
+
private thumbRect?;
|
|
60
|
+
constructor(changeDetectorRef: ChangeDetectorRef);
|
|
61
|
+
ngOnInit(): void;
|
|
62
|
+
private generateId;
|
|
63
|
+
writeValue(items?: IValue[]): void;
|
|
64
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
65
|
+
registerOnValidatorChange?(fn: () => void): void;
|
|
66
|
+
registerOnChange(fn: any): void;
|
|
67
|
+
registerOnTouched(fn: any): void;
|
|
68
|
+
setDisabledState?(disabled: boolean): void;
|
|
69
|
+
private updateRects;
|
|
70
|
+
onDrag(ev: MouseEvent | TouchEvent): void;
|
|
71
|
+
onResize(): void;
|
|
72
|
+
dragStart(ev: MouseEvent | TouchEvent, index: number): void;
|
|
73
|
+
addnewRangeOnSliderClick(event: MouseEvent | TouchEvent): void;
|
|
74
|
+
private updateThumbPosition;
|
|
75
|
+
updateAllThumbPositions(): void;
|
|
76
|
+
setValueByPosition(thumb: ValueModel, thumbRec: DOMRect, sliderRec: DOMRect): void;
|
|
77
|
+
onDragEnd(ev: MouseEvent | TouchEvent): void;
|
|
78
|
+
valueChanged(): void;
|
|
79
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RangeSliderComponent, never>;
|
|
80
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<RangeSliderComponent, "range-slider", never, { "step": { "alias": "step"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "background": { "alias": "background"; "required": false; }; "isBgTransparent": { "alias": "isBgTransparent"; "required": false; }; "addNewRangeOnClick": { "alias": "addNewRangeOnClick"; "required": false; }; "selectedIndex": { "alias": "selectedIndex"; "required": false; }; }, { "change": "change"; "selectedIndexChange": "selectedIndexChange"; }, never, ["*"], true, never>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface IPosition {
|
|
84
|
+
x: number;
|
|
85
|
+
y: number;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
declare class SaturationComponent implements ControlValueAccessor {
|
|
89
|
+
width?: number;
|
|
90
|
+
height?: number;
|
|
91
|
+
color: string;
|
|
92
|
+
step: number;
|
|
93
|
+
min: IPosition;
|
|
94
|
+
max: {
|
|
95
|
+
x: number;
|
|
96
|
+
y: number;
|
|
97
|
+
};
|
|
98
|
+
change: EventEmitter<IPosition>;
|
|
99
|
+
isDragging: boolean;
|
|
100
|
+
saturation: ElementRef<HTMLDivElement>;
|
|
101
|
+
thumb: ElementRef<HTMLDivElement>;
|
|
102
|
+
x: number;
|
|
103
|
+
y: number;
|
|
104
|
+
myControl: FormControl<IPosition | null>;
|
|
105
|
+
isDisabled: boolean;
|
|
106
|
+
_onChange: (value: any) => void;
|
|
107
|
+
_onTouched: () => void;
|
|
108
|
+
_validatorOnChange: () => void;
|
|
109
|
+
private saturationRect?;
|
|
110
|
+
private thumbRect?;
|
|
111
|
+
constructor();
|
|
112
|
+
private updateRects;
|
|
113
|
+
writeValue(val?: IPosition | null): void;
|
|
114
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
115
|
+
registerOnValidatorChange?(fn: () => void): void;
|
|
116
|
+
registerOnChange(fn: any): void;
|
|
117
|
+
registerOnTouched(fn: any): void;
|
|
118
|
+
setDisabledState?(disabled: boolean): void;
|
|
119
|
+
dragStart(ev: MouseEvent | TouchEvent): void;
|
|
120
|
+
onResize(): void;
|
|
121
|
+
onDrag(ev: MouseEvent | TouchEvent): void;
|
|
122
|
+
private updatePosition;
|
|
123
|
+
onDragEnd(ev: MouseEvent | TouchEvent): void;
|
|
124
|
+
setValueByPosition(thumbRec: DOMRect, saturationRec: DOMRect): void;
|
|
125
|
+
valueChanged(value: IPosition): void;
|
|
126
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SaturationComponent, never>;
|
|
127
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SaturationComponent, "saturation", never, { "width": { "alias": "width"; "required": false; }; "height": { "alias": "height"; "required": false; }; "color": { "alias": "color"; "required": false; }; "step": { "alias": "step"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; }, { "change": "change"; }, never, never, true, never>;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
declare class SliderComponent implements OnInit, ControlValueAccessor, Validator {
|
|
131
|
+
step: number;
|
|
132
|
+
min: number;
|
|
133
|
+
max: number;
|
|
134
|
+
background?: string;
|
|
135
|
+
isBgTransparent: boolean;
|
|
136
|
+
change: EventEmitter<number>;
|
|
137
|
+
isDragging: boolean;
|
|
138
|
+
slider: ElementRef<HTMLDivElement>;
|
|
139
|
+
thumb: ElementRef<HTMLDivElement>;
|
|
140
|
+
x: number;
|
|
141
|
+
myControl: FormControl<number | null>;
|
|
142
|
+
isDisabled: boolean;
|
|
143
|
+
_onChange: (value: any) => void;
|
|
144
|
+
_onTouched: () => void;
|
|
145
|
+
_validatorOnChange: () => void;
|
|
146
|
+
private sliderRect?;
|
|
147
|
+
private thumbRect?;
|
|
148
|
+
constructor();
|
|
149
|
+
ngOnInit(): void;
|
|
150
|
+
private updateRects;
|
|
151
|
+
writeValue(val?: number | string | null): void;
|
|
152
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
153
|
+
registerOnValidatorChange?(fn: () => void): void;
|
|
154
|
+
registerOnChange(fn: any): void;
|
|
155
|
+
registerOnTouched(fn: any): void;
|
|
156
|
+
setDisabledState?(disabled: boolean): void;
|
|
157
|
+
dragStart(ev: MouseEvent | TouchEvent): void;
|
|
158
|
+
onDrag(ev: MouseEvent | TouchEvent): void;
|
|
159
|
+
onResize(): void;
|
|
160
|
+
private updatePosition;
|
|
161
|
+
setValueByPosition(thumbRec: DOMRect, sliderRec: DOMRect): void;
|
|
162
|
+
onDragEnd(ev: MouseEvent | TouchEvent): void;
|
|
163
|
+
valueChanged(value: number): void;
|
|
164
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SliderComponent, never>;
|
|
165
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SliderComponent, "slider", never, { "step": { "alias": "step"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "background": { "alias": "background"; "required": false; }; "isBgTransparent": { "alias": "isBgTransparent"; "required": false; }; }, { "change": "change"; }, never, ["*"], true, never>;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
declare function getOffsetPosition(evt: MouseEvent | TouchEvent, parent: HTMLElement): {
|
|
169
|
+
x: number;
|
|
170
|
+
y: number;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
declare class BrowserService {
|
|
174
|
+
private platformId;
|
|
175
|
+
constructor(platformId: object);
|
|
176
|
+
get isBrowser(): boolean;
|
|
177
|
+
get prefersDarkMode(): boolean;
|
|
178
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BrowserService, never>;
|
|
179
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<BrowserService>;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
declare class DialogOverlayRef<T> {
|
|
183
|
+
readonly componentRef: ComponentRef<T>;
|
|
184
|
+
private readonly dialogEl;
|
|
185
|
+
private readonly teardownFn;
|
|
186
|
+
constructor(componentRef: ComponentRef<T>, dialogEl: HTMLDialogElement, teardownFn: () => void);
|
|
187
|
+
close(): void;
|
|
188
|
+
get nativeElement(): HTMLElement;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
interface DialogOptions<T> {
|
|
192
|
+
anchor: HTMLElement;
|
|
193
|
+
component: Type<T>;
|
|
194
|
+
viewContainerRef: ViewContainerRef;
|
|
195
|
+
configure?: (instance: T, ref: DialogOverlayRef<T>) => void;
|
|
196
|
+
margin?: number;
|
|
197
|
+
placement?: 'auto' | 'top' | 'bottom';
|
|
198
|
+
alignment?: 'start' | 'center' | 'end';
|
|
199
|
+
closeOnBackdropClick?: boolean;
|
|
200
|
+
onClosed?: () => void;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
declare class DialogService implements OnDestroy {
|
|
204
|
+
private openDialogs;
|
|
205
|
+
private idCounter;
|
|
206
|
+
private globalKeyDownAdded;
|
|
207
|
+
private globalResizeAdded;
|
|
208
|
+
private globalClickAdded;
|
|
209
|
+
private globalKeyDownListener;
|
|
210
|
+
private globalResizeListener;
|
|
211
|
+
private globalClickListener;
|
|
212
|
+
private doc;
|
|
213
|
+
constructor();
|
|
214
|
+
ngOnDestroy(): void;
|
|
215
|
+
handleGlobalListeners(): void;
|
|
216
|
+
open<T>(options: DialogOptions<T>): DialogOverlayRef<T>;
|
|
217
|
+
private repositionAll;
|
|
218
|
+
private positionDialog;
|
|
219
|
+
private getLastDialog;
|
|
220
|
+
closeAll(): void;
|
|
221
|
+
handleClickOnBackdrop(event: PointerEvent): void;
|
|
222
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DialogService, never>;
|
|
223
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DialogService>;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export { BrowserService, DialogOverlayRef, DialogService, RangeSliderComponent, SaturationComponent, SliderComponent, ValueModel, getOffsetPosition };
|
|
227
|
+
export type { DialogOptions, IPosition, IValue };
|