carriera-intern-components 0.0.994 → 0.0.996

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.
@@ -1,4 +1,4 @@
1
- import { AfterViewInit, ElementRef } from '@angular/core';
1
+ import { AfterViewInit, ElementRef, OnInit } from '@angular/core';
2
2
  import { ControlValueAccessor, NgControl } from '@angular/forms';
3
3
  import { PasswordDirective } from './directives/password.directive';
4
4
  import { NumberFormatDirective } from './directives/number-format.directive';
@@ -9,7 +9,7 @@ import * as i0 from "@angular/core";
9
9
  /**
10
10
  * This component is a generic input component that can be used to create various types of inputs.
11
11
  */
12
- export declare class InputComponent implements ControlValueAccessor, AfterViewInit {
12
+ export declare class InputComponent implements ControlValueAccessor, AfterViewInit, OnInit {
13
13
  ngControl: NgControl | null;
14
14
  inputRef: ElementRef<HTMLInputElement>;
15
15
  containerRef: ElementRef<HTMLInputElement>;
@@ -54,7 +54,7 @@ export declare class InputComponent implements ControlValueAccessor, AfterViewIn
54
54
  - `reveal`: For password inputs, the number of characters to reveal from the end.
55
55
  - `icon`: Name of an icon to display (e.g., `'cai-email'`).
56
56
  - `iconColor`: Color of the displayed icon (e.g., `'#FF0000'`).
57
- - `dropdown`: If `true`, the input is associated with a dropdown menu, can also have `'dispatch'`, `'ftl-dispatch'`, `'broker'`, `'contact'`, `'shipper'`, `'dispatcher'`, `'truck'`, `'trailer'`, `'bank'` or `'label'` variants.
57
+ - `dropdown`: If `true`, the input is associated with a dropdown menu, can also have `'dispatch'`, `'ftl-dispatch'`, `'broker'`, `'contact'`, `'shipper'`, `'dispatcher'`, `'truck'`, `'trailer'`, `'bank'`, `'label'`, or `'subcontent'` variants.
58
58
  - `options`: An array of options for the dropdown can be of type `DropdownOption[]` | `LabelOption[]` | `DispatchBoard[]` | `Broker[]` | `DepartmentContactsPair[]` | `Shipper[]` | `Bank[]` | `Dispatcher[]`.
59
59
  - `labelColors`: An array of label colors for the label picker.
60
60
  - `search`: Enables search within the dropdown.
@@ -80,6 +80,7 @@ export declare class InputComponent implements ControlValueAccessor, AfterViewIn
80
80
  - `removable`: If `true`, displays `cai-delete` icon over clear button.
81
81
  - `autofocus`: If `true`, the input will be focused when the component is initialized.
82
82
  - `canOpenModal`: If `true`, the input can open a modal for adding new options.
83
+ - `customErrors`: An array of custom error messages to be displayed in the input.
83
84
  */
84
85
  config: import("@angular/core").InputSignal<CaiInputConfig>;
85
86
  /**
@@ -90,6 +91,10 @@ export declare class InputComponent implements ControlValueAccessor, AfterViewIn
90
91
  * Input property to hold the label colors for the label picker.
91
92
  */
92
93
  labelColors: import("@angular/core").InputSignal<LabelColor[] | undefined>;
94
+ /**
95
+ * Preselected dropdown option
96
+ */
97
+ preselectedUnit: import("@angular/core").InputSignal<string | null>;
93
98
  /**
94
99
  * Internal signal to track the disabled state of the input.
95
100
  */
@@ -157,6 +162,7 @@ export declare class InputComponent implements ControlValueAccessor, AfterViewIn
157
162
  * @param ngControl - Optional NgControl instance for form integration.
158
163
  */
159
164
  constructor(ngControl: NgControl | null);
165
+ ngOnInit(): void;
160
166
  ngAfterViewInit(): void;
161
167
  /**
162
168
  * Handles the native 'input' event from the HTMLInputElement.
@@ -175,6 +181,12 @@ export declare class InputComponent implements ControlValueAccessor, AfterViewIn
175
181
  onRealValueChange(event: CustomEvent): void;
176
182
  onChange: (_: any) => void;
177
183
  onTouched: () => void;
184
+ /**
185
+ * Dispatches the onChange event with the provided value.
186
+ * This method wraps the onChange call to provide a centralized way to handle value changes.
187
+ * @param value - The value to pass to onChange
188
+ */
189
+ dispatchOnChange(value: any): void;
178
190
  registerOnChange(fn: any): void;
179
191
  registerOnTouched(fn: any): void;
180
192
  setDisabledState(isDisabled: boolean): void;
@@ -239,7 +251,7 @@ export declare class InputComponent implements ControlValueAccessor, AfterViewIn
239
251
  * @param option - The selected option.
240
252
  * @param event - The MouseEvent that initiated the selection action.
241
253
  */
242
- handleOption(option: DropdownOptions): void;
254
+ handleOption(option: DropdownOptions, event?: MouseEvent): void;
243
255
  /**
244
256
  * Adds a new option to the dropdown.
245
257
  * @param option - The option to add.
@@ -268,5 +280,5 @@ export declare class InputComponent implements ControlValueAccessor, AfterViewIn
268
280
  castAsTruckOption(value: unknown): TruckType | null;
269
281
  castAsTrailerOption(value: unknown): TrailerType | null;
270
282
  static ɵfac: i0.ɵɵFactoryDeclaration<InputComponent, [{ optional: true; self: true; }]>;
271
- static ɵcmp: i0.ɵɵComponentDeclaration<InputComponent, "cai-input", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; "config": { "alias": "config"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "labelColors": { "alias": "labelColors"; "required": false; "isSignal": true; }; }, { "onOptionAdded": "onOptionAdded"; "onAdd": "onAdd"; "onSelectionChange": "onSelectionChange"; "onClear": "onClear"; }, never, never, true, never>;
283
+ static ɵcmp: i0.ɵɵComponentDeclaration<InputComponent, "cai-input", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; "config": { "alias": "config"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "labelColors": { "alias": "labelColors"; "required": false; "isSignal": true; }; "preselectedUnit": { "alias": "preselectedUnit"; "required": false; "isSignal": true; }; }, { "onOptionAdded": "onOptionAdded"; "onAdd": "onAdd"; "onSelectionChange": "onSelectionChange"; "onClear": "onClear"; }, never, never, true, never>;
272
284
  }
@@ -33,8 +33,13 @@ export interface CaiInputConfig {
33
33
  optionLabel?: string;
34
34
  removable?: boolean;
35
35
  autofocus?: boolean;
36
+ customErrors?: CustomError[];
36
37
  }
37
- export declare const DropdownTypes: readonly ["dispatch", "ftl-dispatch", "label", "broker", "contact", "shipper", "bank", "dispatcher", "truck", "trailer"];
38
+ export type CustomError = {
39
+ name: string;
40
+ message: string | null;
41
+ };
42
+ export declare const DropdownTypes: readonly ["dispatch", "ftl-dispatch", "label", "broker", "contact", "shipper", "bank", "dispatcher", "truck", "trailer", "subcontent"];
38
43
  export type DropdownType = (typeof DropdownTypes)[number];
39
44
  export type DropdownArrays = DropdownOption[] | LabelOption[] | Broker[] | DispatchBoard[] | DepartmentContactsPair[] | Shipper[] | Dispatch[] | Bank[] | Dispatcher[] | TruckOption[] | TrailerOption[];
40
45
  export type DropdownOptions = DropdownOption | LabelOption | Broker | Contact | Shipper | Dispatch | Bank | Dispatcher | TruckOption | TrailerOption;
@@ -1,10 +1,11 @@
1
1
  import { PipeTransform } from '@angular/core';
2
2
  import { ValidationErrors } from '@angular/forms';
3
- import { NumberFormatPipe } from './number-format.pipe';
3
+ import { NumberFormatPipe } from '../../../pipes/number-format.pipe';
4
+ import { CustomError } from '../models/input.model';
4
5
  import * as i0 from "@angular/core";
5
6
  export declare class ErrorMessagePipe implements PipeTransform {
6
7
  numberFormatPipe: NumberFormatPipe;
7
- transform(errors: ValidationErrors | null | undefined): string[];
8
+ transform(errors: ValidationErrors | null | undefined, customErrors?: CustomError[]): string[];
8
9
  static ɵfac: i0.ɵɵFactoryDeclaration<ErrorMessagePipe, never>;
9
10
  static ɵpipe: i0.ɵɵPipeDeclaration<ErrorMessagePipe, "errorMessage", true>;
10
11
  }