@unipin/angular-applet 21.3.0 → 21.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unipin/angular-applet",
3
- "version": "21.3.0",
3
+ "version": "21.3.1",
4
4
  "peerDependencies": {
5
5
  "@angular/cdk": "21.x.x",
6
6
  "@angular/common": "21.x.x",
@@ -1,12 +1,66 @@
1
+ import { FormGroup, ValidatorFn, NgControl, AbstractControl, NgForm, FormGroupDirective, ControlValueAccessor } from '@angular/forms';
1
2
  import * as _angular_core from '@angular/core';
2
3
  import { Signal, DoCheck, Injector, Renderer2, ElementRef, WritableSignal, InputSignal, ModelSignal, OutputEmitterRef, OnInit, OnDestroy } from '@angular/core';
3
4
  import { ClassValue } from 'clsx';
4
- import { NgControl, AbstractControl, NgForm, FormGroupDirective, ControlValueAccessor, FormGroup, ValidatorFn } from '@angular/forms';
5
5
  import { Subscription, Observable, Subject } from 'rxjs';
6
6
  import { Country, Currency } from '@unipin/graphql-schema';
7
7
  import { CountryService, CurrencyService, RateGroupCodeService } from '@unipin/angular-applet/common';
8
8
  import { SingleDate, RangeDate } from '@unipin/angular-applet/calendar';
9
9
 
10
+ type TimeValue = {
11
+ hour: number;
12
+ minute: number;
13
+ };
14
+
15
+ declare function setValidator(form: FormGroup, keys: string[], validators: ValidatorFn | ValidatorFn[]): void;
16
+
17
+ declare function toggleFormControls(form: FormGroup, keys: string[], mode: 'enable' | 'disable'): void;
18
+
19
+ /**
20
+ * Range validator for number and date values.
21
+ * @param {string} fromKey - The "from" control name
22
+ * @param {string} toKey - The "to" control name
23
+ * @returns {ValidatorFn} Throw error message when fromKey is greater than toKey
24
+ *
25
+ * Usage:
26
+ * this.form = new FormGroup({
27
+ * agingFrom: new FormControl(),
28
+ * agingTo: new FormControl(),
29
+ * }, { validators: rangeValidator('agingFrom', 'agingTo') });
30
+ */
31
+ declare function validRangeValidator(fromKey: string, toKey: string): ValidatorFn;
32
+
33
+ /**
34
+ * Validator that requires all specified form controls to have the same value.
35
+ *
36
+ * @param {string[]} controlNames - The names of the controls that must match
37
+ * @param {string} [message] - Optional custom error message
38
+ * @returns {ValidatorFn} A validator function producing an `isEqual` error if values do not match
39
+ *
40
+ * @example
41
+ * this.form = new FormGroup({
42
+ * password: new FormControl(''),
43
+ * confirmPassword: new FormControl(''),
44
+ * }, { validators: isEqualValidator(['password', 'confirmPassword']) });
45
+ */
46
+ declare function isEqualValidator(controlNames: string[], message?: string): ValidatorFn;
47
+
48
+ /**
49
+ * Validator that requires all specified form controls to have different values.
50
+ *
51
+ * @param {string[]} controlNames - The names of the controls that must all be unique
52
+ * @param {string} [message] - Optional custom error message
53
+ * @returns {ValidatorFn} A validator function producing an `isNotEqual` error if duplicate values exist
54
+ *
55
+ * @example
56
+ * this.form = new FormGroup({
57
+ * primaryEmail: new FormControl(''),
58
+ * secondaryEmail: new FormControl(''),
59
+ * backupEmail: new FormControl(''),
60
+ * }, { validators: isNotEqualValidator(['primaryEmail', 'secondaryEmail', 'backupEmail']) });
61
+ */
62
+ declare function isNotEqualValidator(controlNames: string[], message?: string): ValidatorFn;
63
+
10
64
  declare abstract class UpFieldControl {
11
65
  abstract readonly error: Signal<string>;
12
66
  abstract readonly ngControl: NgControl | AbstractControl | null;
@@ -435,11 +489,6 @@ declare class UpDateRangePickerComponent extends UpFieldControlComponent impleme
435
489
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<UpDateRangePickerComponent, "up-date-range-picker", never, { "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "minDate": { "alias": "minDate"; "required": false; "isSignal": true; }; "maxDate": { "alias": "maxDate"; "required": false; "isSignal": true; }; "inlineClass": { "alias": "class"; "required": false; "isSignal": true; }; "dateFormat": { "alias": "format"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
436
490
  }
437
491
 
438
- type TimeValue = {
439
- hour: number;
440
- minute: number;
441
- };
442
-
443
492
  declare class UpTimeComponent {
444
493
  readonly hoursScroll: _angular_core.Signal<ElementRef<HTMLDivElement> | undefined>;
445
494
  readonly minutesScroll: _angular_core.Signal<ElementRef<HTMLDivElement> | undefined>;
@@ -551,53 +600,5 @@ declare class UpImagePickerComponent extends UpFieldControlComponent implements
551
600
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<UpImagePickerComponent, "up-image-picker", never, { "ratio": { "alias": "ratio"; "required": false; "isSignal": true; }; "imgSrc": { "alias": "src"; "required": false; "isSignal": true; }; "inlineClass": { "alias": "class"; "required": false; "isSignal": true; }; }, { "imgSrc": "srcChange"; "changed": "changed"; }, never, never, true, never>;
552
601
  }
553
602
 
554
- declare function setValidator(form: FormGroup, keys: string[], validators: ValidatorFn | ValidatorFn[]): void;
555
-
556
- declare function toggleFormControls(form: FormGroup, keys: string[], mode: 'enable' | 'disable'): void;
557
-
558
- /**
559
- * Range validator for number and date values.
560
- * @param {string} fromKey - The "from" control name
561
- * @param {string} toKey - The "to" control name
562
- * @returns {ValidatorFn} Throw error message when fromKey is greater than toKey
563
- *
564
- * Usage:
565
- * this.form = new FormGroup({
566
- * agingFrom: new FormControl(),
567
- * agingTo: new FormControl(),
568
- * }, { validators: rangeValidator('agingFrom', 'agingTo') });
569
- */
570
- declare function validRangeValidator(fromKey: string, toKey: string): ValidatorFn;
571
-
572
- /**
573
- * Validator that requires all specified form controls to have the same value.
574
- *
575
- * @param {string[]} controlNames - The names of the controls that must match
576
- * @param {string} [message] - Optional custom error message
577
- * @returns {ValidatorFn} A validator function producing an `isEqual` error if values do not match
578
- *
579
- * @example
580
- * this.form = new FormGroup({
581
- * password: new FormControl(''),
582
- * confirmPassword: new FormControl(''),
583
- * }, { validators: isEqualValidator(['password', 'confirmPassword']) });
584
- */
585
- declare function isEqualValidator(controlNames: string[], message?: string): ValidatorFn;
586
-
587
- /**
588
- * Validator that requires all specified form controls to have different values.
589
- *
590
- * @param {string[]} controlNames - The names of the controls that must all be unique
591
- * @param {string} [message] - Optional custom error message
592
- * @returns {ValidatorFn} A validator function producing an `isNotEqual` error if duplicate values exist
593
- *
594
- * @example
595
- * this.form = new FormGroup({
596
- * primaryEmail: new FormControl(''),
597
- * secondaryEmail: new FormControl(''),
598
- * backupEmail: new FormControl(''),
599
- * }, { validators: isNotEqualValidator(['primaryEmail', 'secondaryEmail', 'backupEmail']) });
600
- */
601
- declare function isNotEqualValidator(controlNames: string[], message?: string): ValidatorFn;
602
-
603
603
  export { UpCheckboxDirective, UpCountrySelectComponent, UpCurrencySelectComponent, UpDateRangePickerComponent, UpDatepickerComponent, UpFieldControl, UpFieldControlComponent, UpFormFieldComponent, UpImagePickerComponent, UpInputDirective, UpNumberDirective, UpOptionComponent, UpPasswordComponent, UpRadioDirective, UpRateGroupCodeSelectComponent, UpSearchableSelectComponent, UpSelectComponent, UpSwitchComponent, UpTimeComponent, UpTimepickerComponent, isEqualValidator, isNotEqualValidator, setValidator, toggleFormControls, validRangeValidator };
604
+ export type { TimeValue };