@ethlete/cdk 4.37.2 → 4.38.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.
@@ -0,0 +1,10 @@
1
+ import { DecoratedInputBase } from '../../../../utils';
2
+ import { ColorInputDirective } from '../../directives/color-input';
3
+ import * as i0 from "@angular/core";
4
+ import * as i1 from "../../directives/color-input/color-input.directive";
5
+ import * as i2 from "../../../../directives/input/input.directive";
6
+ export declare class ColorInputComponent extends DecoratedInputBase {
7
+ protected readonly colorInput: ColorInputDirective;
8
+ static ɵfac: i0.ɵɵFactoryDeclaration<ColorInputComponent, never>;
9
+ static ɵcmp: i0.ɵɵComponentDeclaration<ColorInputComponent, "et-color-input", never, {}, {}, never, ["[etInputPrefix]", "[etInputSuffix]"], true, [{ directive: typeof i1.ColorInputDirective; inputs: {}; outputs: {}; }, { directive: typeof i2.InputDirective; inputs: { "autocomplete": "autocomplete"; "placeholder": "placeholder"; }; outputs: {}; }]>;
10
+ }
@@ -0,0 +1 @@
1
+ export * from './color-input.component';
@@ -0,0 +1,13 @@
1
+ import { InjectionToken, OnInit } from '@angular/core';
2
+ import { InputDirective } from '../../../../directives/input';
3
+ import * as i0 from "@angular/core";
4
+ export declare const COLOR_INPUT_TOKEN: InjectionToken<ColorInputDirective>;
5
+ export declare class ColorInputDirective implements OnInit {
6
+ private readonly _destroy$;
7
+ readonly input: InputDirective<string | null, HTMLElement>;
8
+ ngOnInit(): void;
9
+ _onInputInteraction(event: Event): void;
10
+ _controlTouched(): void;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<ColorInputDirective, never>;
12
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ColorInputDirective, never, ["etColorInput"], {}, {}, never, never, true, never>;
13
+ }
@@ -0,0 +1 @@
1
+ export * from './color-input.directive';
@@ -3,6 +3,7 @@ import { IfInputFilledDirective } from '../../directives/if-input-filled';
3
3
  import { InputPrefixDirective } from '../../directives/input-prefix';
4
4
  import { InputSuffixDirective } from '../../directives/input-suffix';
5
5
  import { LabelComponent } from '../label/components/label';
6
+ import { ColorInputComponent } from './components/color-input';
6
7
  import { DateInputComponent } from './components/date-input';
7
8
  import { DateTimeInputComponent } from './components/date-time-input';
8
9
  import { EmailInputComponent } from './components/email-input';
@@ -19,4 +20,4 @@ import { IfSupportsShowPickerDirective } from './directives/if-supports-show-pic
19
20
  import { ShowPickerTriggerDirective } from './directives/show-picker-trigger';
20
21
  import { PasswordInputToggleComponent } from './partials/password-input-toggle';
21
22
  import { SearchInputClearComponent } from './partials/search-input-clear';
22
- export declare const InputImports: readonly [typeof InputFieldComponent, typeof NumberInputComponent, typeof SearchInputComponent, typeof PasswordInputComponent, typeof PasswordInputToggleComponent, typeof TextInputComponent, typeof TextareaInputComponent, typeof TelInputComponent, typeof InputPrefixDirective, typeof InputSuffixDirective, typeof IfInputFilledDirective, typeof ShowPickerTriggerDirective, typeof IfInputEmptyDirective, typeof SearchInputClearComponent, typeof EmailInputComponent, typeof LabelComponent, typeof DateInputComponent, typeof DateTimeInputComponent, typeof TimeInputComponent, typeof IfSupportsShowPickerDirective, typeof AutosizeTextareaDirective];
23
+ export declare const InputImports: readonly [typeof InputFieldComponent, typeof NumberInputComponent, typeof SearchInputComponent, typeof PasswordInputComponent, typeof PasswordInputToggleComponent, typeof TextInputComponent, typeof TextareaInputComponent, typeof TelInputComponent, typeof InputPrefixDirective, typeof InputSuffixDirective, typeof IfInputFilledDirective, typeof ShowPickerTriggerDirective, typeof IfInputEmptyDirective, typeof SearchInputClearComponent, typeof EmailInputComponent, typeof LabelComponent, typeof DateInputComponent, typeof DateTimeInputComponent, typeof TimeInputComponent, typeof IfSupportsShowPickerDirective, typeof AutosizeTextareaDirective, typeof ColorInputComponent];
@@ -0,0 +1,47 @@
1
+ import { Signal } from '@angular/core';
2
+ import { AbstractControl } from '@angular/forms';
3
+ export interface FormChangesTrackerRef<T> {
4
+ /**
5
+ * Set the default form value to the current form value.
6
+ * Useful when the form value changes.
7
+ *
8
+ * (e.g. when a http request was needed to fill the remaining form fields to their default values)
9
+ */
10
+ refreshDefaultFormValue: () => void;
11
+ /**
12
+ * Restore the default form value to the form.
13
+ */
14
+ restoreDefaultFormValue: () => void;
15
+ /**
16
+ * Checks if the form has changes compared to the default form value.
17
+ * @returns `true` if the form has changes.
18
+ */
19
+ hasChanges: Signal<boolean>;
20
+ /**
21
+ * The default form value to compare the current form value to
22
+ */
23
+ defaultFormValue: Signal<T>;
24
+ }
25
+ export type CreateFormChangesTrackerConfig<T extends AbstractControl> = {
26
+ /**
27
+ * The form to check for changes
28
+ */
29
+ form: T;
30
+ /**
31
+ * The default value to compare the current form value to
32
+ *
33
+ * @default form.getRawValue()
34
+ */
35
+ defaultValue?: ReturnType<T['getRawValue']>;
36
+ /**
37
+ * A custom compare function to compare the current form value to the default value.
38
+ * By default, a deep comparison will be used.
39
+ *
40
+ * @default (currentValue, defaultValue) => equal(currentValue, defaultValue)
41
+ */
42
+ compareFn?: (currentValue: ReturnType<T['getRawValue']>, defaultValue: ReturnType<T['getRawValue']>) => boolean;
43
+ };
44
+ /**
45
+ * A utility function to enhance form usage by providing methods to manage form state and detect changes.
46
+ */
47
+ export declare const createFormChangesTracker: <T extends AbstractControl>(config: CreateFormChangesTrackerConfig<T>) => FormChangesTrackerRef<ReturnType<T["getRawValue"]>>;
@@ -1,3 +1,4 @@
1
1
  export * from './decorated-form-field.base';
2
2
  export * from './decorated-input.base';
3
+ export * from './form-changes-tracker.util';
3
4
  export * from './input.base';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethlete/cdk",
3
- "version": "4.37.2",
3
+ "version": "4.38.1",
4
4
  "exports": {
5
5
  ".": {
6
6
  "css": "./src/lib/styles/index.css",