@unipin/angular-applet 18.0.4 → 18.1.5

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.
Files changed (23) hide show
  1. package/esm2022/lib/components/containers/applet-container/applet-container.component.mjs +3 -3
  2. package/esm2022/lib/components/forms/country-input/form-country-input.component.mjs +118 -0
  3. package/esm2022/lib/components/forms/currency-input/form-currency-input.component.mjs +33 -41
  4. package/esm2022/lib/components/forms/index.mjs +2 -1
  5. package/esm2022/lib/components/index.mjs +2 -2
  6. package/esm2022/lib/utils/contrast-color-generator/contrast-color-generator.util.mjs +16 -0
  7. package/esm2022/lib/utils/form-error-message/form-error-message.util.mjs +21 -0
  8. package/esm2022/lib/utils/format-capitalize/format-capitalize.util.mjs +18 -0
  9. package/esm2022/lib/utils/index.mjs +4 -2
  10. package/esm2022/public-api.mjs +3 -3
  11. package/fesm2022/unipin-angular-applet.mjs +178 -43
  12. package/fesm2022/unipin-angular-applet.mjs.map +1 -1
  13. package/lib/components/forms/country-input/form-country-input.component.d.ts +40 -0
  14. package/lib/components/forms/currency-input/form-currency-input.component.d.ts +19 -24
  15. package/lib/components/forms/index.d.ts +1 -0
  16. package/lib/components/index.d.ts +1 -1
  17. package/lib/utils/contrast-color-generator/contrast-color-generator.util.d.ts +4 -0
  18. package/lib/utils/format-capitalize/format-capitalize.util.d.ts +1 -0
  19. package/lib/utils/index.d.ts +3 -1
  20. package/package.json +1 -1
  21. package/public-api.d.ts +2 -2
  22. package/esm2022/lib/utils/form-error-message.util.mjs +0 -21
  23. /package/lib/utils/{form-error-message.util.d.ts → form-error-message/form-error-message.util.d.ts} +0 -0
@@ -0,0 +1,40 @@
1
+ import { ChangeDetectorRef, EventEmitter, OnInit, OnDestroy } from '@angular/core';
2
+ import { AbstractControl, ControlValueAccessor, ValidationErrors, Validator } from '@angular/forms';
3
+ import { Subscription } from 'rxjs';
4
+ import { Country } from '../../../../graphql/generated';
5
+ import { CountryService } from '../../../services';
6
+ import * as i0 from "@angular/core";
7
+ export declare class FormCountryInputComponent implements ControlValueAccessor, Validator, OnInit, OnDestroy {
8
+ placeholder: string;
9
+ protected readonly ch: ChangeDetectorRef;
10
+ protected readonly countryService: CountryService;
11
+ clearable: boolean;
12
+ required: boolean;
13
+ disabled: boolean;
14
+ onChange: EventEmitter<Country | undefined | null>;
15
+ items: {
16
+ label: string;
17
+ value: string;
18
+ data: Country;
19
+ }[];
20
+ isLoading: boolean;
21
+ isTouched: boolean;
22
+ value: any | null;
23
+ errorMsg: string;
24
+ protected formControl: AbstractControl;
25
+ protected changed: (_val: any) => void;
26
+ protected onTouched: () => void;
27
+ protected sub?: Subscription;
28
+ constructor(placeholder: string, ch: ChangeDetectorRef, countryService: CountryService);
29
+ ngOnInit(): void;
30
+ ngOnDestroy(): void;
31
+ registerOnChange(fn: any): void;
32
+ registerOnTouched(fn: any): void;
33
+ writeValue(val: any): void;
34
+ setDisabledState?(d: boolean): void;
35
+ validate(control: AbstractControl): ValidationErrors | null;
36
+ change(e?: any): void;
37
+ protected setIsLoading(b: boolean): void;
38
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormCountryInputComponent, [{ attribute: "placeholder"; }, null, null]>;
39
+ static ɵcmp: i0.ɵɵComponentDeclaration<FormCountryInputComponent, "up-country-input", never, { "clearable": { "alias": "clearable"; "required": false; }; "required": { "alias": "required"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "onChange": "onChange"; }, never, never, true, never>;
40
+ }
@@ -1,37 +1,29 @@
1
- import { ChangeDetectorRef, OnChanges, SimpleChanges, EventEmitter } from '@angular/core';
1
+ import { ChangeDetectorRef, EventEmitter, OnInit, OnDestroy } from '@angular/core';
2
2
  import { AbstractControl, ControlValueAccessor, ValidationErrors, Validator } from '@angular/forms';
3
- import { Observable, Subject } from 'rxjs';
3
+ import { Subscription } from 'rxjs';
4
+ import { Currency } from '../../../../graphql/generated';
4
5
  import { CurrencyService } from '../../../services';
5
6
  import * as i0 from "@angular/core";
6
- export declare class FormCurrencyInputComponent implements ControlValueAccessor, Validator, OnChanges {
7
+ export declare class FormCurrencyInputComponent implements ControlValueAccessor, Validator, OnInit, OnDestroy {
8
+ placeholder: string;
7
9
  numberPlaceholder: string;
8
10
  protected readonly ch: ChangeDetectorRef;
9
11
  protected readonly currencyService: CurrencyService;
10
12
  clearable: boolean;
11
13
  isInputNumber: boolean;
12
- label: 'Currency' | 'Country';
13
- initialItems: {
14
- label: string;
15
- value: string;
16
- magnifyValue: number;
17
- }[];
18
14
  numberValue: number | null;
19
15
  isNumberDisabled: boolean;
20
16
  required: boolean;
21
17
  disabled: boolean;
22
- bindLabel: string;
23
- bindValue: string;
24
18
  onChange: EventEmitter<{
25
- ccy: {
26
- label: string;
27
- value: string;
28
- magnifyValue: number;
29
- } | any;
19
+ selectedItem?: Currency;
30
20
  number: number | null;
31
21
  }>;
32
- readonly typeahead: Subject<string>;
33
- protected readonly query$: Observable<any[]>;
34
- items$: Observable<any[]>;
22
+ items: {
23
+ label: string;
24
+ value: string;
25
+ data: Currency;
26
+ }[];
35
27
  isLoading: boolean;
36
28
  isTouched: boolean;
37
29
  value: any | null;
@@ -40,8 +32,11 @@ export declare class FormCurrencyInputComponent implements ControlValueAccessor,
40
32
  protected decimalLimiter: number;
41
33
  protected changed: (_val: any) => void;
42
34
  protected onTouched: () => void;
43
- constructor(numberPlaceholder: string, ch: ChangeDetectorRef, currencyService: CurrencyService);
44
- ngOnChanges(changes: SimpleChanges): void;
35
+ protected sub?: Subscription;
36
+ protected selectedItem?: Currency;
37
+ constructor(placeholder: string, numberPlaceholder: string, ch: ChangeDetectorRef, currencyService: CurrencyService);
38
+ ngOnInit(): void;
39
+ ngOnDestroy(): void;
45
40
  registerOnChange(fn: any): void;
46
41
  registerOnTouched(fn: any): void;
47
42
  writeValue(val: any): void;
@@ -50,7 +45,7 @@ export declare class FormCurrencyInputComponent implements ControlValueAccessor,
50
45
  change(e?: any): void;
51
46
  numberInput({ value }: any): void;
52
47
  limitDecimal({ charCode, preventDefault, target: { value } }: any): void;
53
- protected queryFunc(keyword: string): Observable<any>;
54
- static ɵfac: i0.ɵɵFactoryDeclaration<FormCurrencyInputComponent, [{ attribute: "numberPlaceholder"; }, null, null]>;
55
- static ɵcmp: i0.ɵɵComponentDeclaration<FormCurrencyInputComponent, "up-currency-input", never, { "clearable": { "alias": "clearable"; "required": false; }; "isInputNumber": { "alias": "isInputNumber"; "required": false; }; "label": { "alias": "label"; "required": false; }; "initialItems": { "alias": "initialItems"; "required": false; }; "numberValue": { "alias": "numberValue"; "required": false; }; "isNumberDisabled": { "alias": "isNumberDisabled"; "required": false; }; "required": { "alias": "required"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "bindLabel": { "alias": "bindLabel"; "required": false; }; "bindValue": { "alias": "bindValue"; "required": false; }; }, { "onChange": "onChange"; }, never, never, true, never>;
48
+ protected setIsLoading(b: boolean): void;
49
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormCurrencyInputComponent, [{ attribute: "placeholder"; }, { attribute: "numberPlaceholder"; }, null, null]>;
50
+ static ɵcmp: i0.ɵɵComponentDeclaration<FormCurrencyInputComponent, "up-currency-input", never, { "clearable": { "alias": "clearable"; "required": false; }; "isInputNumber": { "alias": "isInputNumber"; "required": false; }; "numberValue": { "alias": "numberValue"; "required": false; }; "isNumberDisabled": { "alias": "isNumberDisabled"; "required": false; }; "required": { "alias": "required"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "onChange": "onChange"; }, never, never, true, never>;
56
51
  }
@@ -7,3 +7,4 @@ export { FormSelectComponent } from './select/form-select.component';
7
7
  export { FormTextareaComponent } from './textarea/form-textarea.component';
8
8
  export { FormImagePickerComponent } from './image-picker/form-image-picker.component';
9
9
  export { FormCurrencyInputComponent } from './currency-input/form-currency-input.component';
10
+ export { FormCountryInputComponent } from './country-input/form-country-input.component';
@@ -1,7 +1,7 @@
1
1
  export { ButtonGroupComponent, ButtonGroupConfig, ButtonLoadingComponent } from './buttons';
2
2
  export { AppletContainerComponent, ColumnContainerComponent, ColumnHeaderContainerComponent, ListContainerConfig, ListPaginationContainerComponent, ListSnapshotContainerComponent, ModalContainerComponent } from './containers';
3
3
  export { FilterComponent, FilterConfig, FilterField, FilterSearchEvent } from './filter';
4
- export { FormDateComponent, FormInputComponent, FormNumberComponent, FormPasswordComponent, FormSearchableSelectComponent, FormSelectComponent, FormTextareaComponent, FormImagePickerComponent, FormCurrencyInputComponent } from './forms';
4
+ export { FormDateComponent, FormInputComponent, FormNumberComponent, FormPasswordComponent, FormSearchableSelectComponent, FormSelectComponent, FormTextareaComponent, FormImagePickerComponent, FormCurrencyInputComponent, FormCountryInputComponent } from './forms';
5
5
  export { GridConfig, GridPaginationComponent, GridService, GridSnapshotComponent } from './grids';
6
6
  export { TabContentComponent, TabGroupComponent, TabsComponentModule } from './tabs';
7
7
  export { AuditListComponent, AuditDetailComponent } from './audit';
@@ -0,0 +1,4 @@
1
+ export declare function generateContrastColor(str: string): {
2
+ background: `#${string}`;
3
+ color: `#${string}`;
4
+ };
@@ -0,0 +1 @@
1
+ export declare function formatCapitalize(str: string | string[], eachWord?: boolean, separator?: string): string;
@@ -1 +1,3 @@
1
- export { getFormErrorMessage } from './form-error-message.util';
1
+ export { formatCapitalize } from './format-capitalize/format-capitalize.util';
2
+ export { getFormErrorMessage } from './form-error-message/form-error-message.util';
3
+ export { generateContrastColor } from './contrast-color-generator/contrast-color-generator.util';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unipin/angular-applet",
3
- "version": "18.0.4",
3
+ "version": "18.1.5",
4
4
  "sideEffects": false,
5
5
  "homepage": "https://backoffice.unipin.com/",
6
6
  "description": "Angular specific wrappers for UniPin applet",
package/public-api.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export { ButtonGroupConfig, ButtonGroupComponent, ButtonLoadingComponent, FormDateComponent, FormInputComponent, FormNumberComponent, FormPasswordComponent, FormSearchableSelectComponent, FormSelectComponent, FormTextareaComponent, FormImagePickerComponent, FormCurrencyInputComponent, FilterConfig, FilterField, FilterSearchEvent, FilterComponent, GridConfig, GridService, GridPaginationComponent, GridSnapshotComponent, AppletContainerComponent, ColumnContainerComponent, ColumnHeaderContainerComponent, ListContainerConfig, ListPaginationContainerComponent, ListSnapshotContainerComponent, ModalContainerComponent, TabGroupComponent, TabContentComponent, TabsComponentModule, AuditListComponent, AuditDetailComponent, ApprovalListComponent, ApprovalDetailComponent } from './lib/components';
1
+ export { ButtonGroupConfig, ButtonGroupComponent, ButtonLoadingComponent, FormDateComponent, FormInputComponent, FormNumberComponent, FormPasswordComponent, FormSearchableSelectComponent, FormSelectComponent, FormTextareaComponent, FormImagePickerComponent, FormCurrencyInputComponent, FormCountryInputComponent, FilterConfig, FilterField, FilterSearchEvent, FilterComponent, GridConfig, GridService, GridPaginationComponent, GridSnapshotComponent, AppletContainerComponent, ColumnContainerComponent, ColumnHeaderContainerComponent, ListContainerConfig, ListPaginationContainerComponent, ListSnapshotContainerComponent, ModalContainerComponent, TabGroupComponent, TabContentComponent, TabsComponentModule, AuditListComponent, AuditDetailComponent, ApprovalListComponent, ApprovalDetailComponent } from './lib/components';
2
2
  export { AuthGuard } from './lib/guards';
3
3
  export { HeaderInterceptor, RefreshTokenInterceptor } from './lib/interceptors';
4
4
  export { User } from './lib/interfaces';
5
5
  export { bootstrap, LoadingPage, UnauthorizedPage, PermissionDirective, PermissionGuard, PermissionService, PermissionModule } from './lib/modules';
6
6
  export { AuthResolver } from './lib/resolvers';
7
7
  export { AuthService, CurrencyService, CountryService, ProfileService } from './lib/services';
8
- export { getFormErrorMessage } from './lib/utils';
8
+ export { formatCapitalize, generateContrastColor, getFormErrorMessage, } from './lib/utils';
9
9
  export { GridApi, GridReadyEvent, ICellRendererParams, ValueFormatterParams, SelectionChangedEvent } from '@ag-grid-community/core';
10
10
  export { ICellRendererAngularComp } from '@ag-grid-community/angular';
@@ -1,21 +0,0 @@
1
- const errMessage = {
2
- email: (label) => `${label} is not a valid email`,
3
- required: (label) => `${label} is required`,
4
- minlength: (label, length) => `${label} must be at least ${length} characters`,
5
- maxlength: (label, length) => `${label} must not exceed ${length} characters`,
6
- max: (label, max) => `${label} value must be lower than ${max}`,
7
- min: (label, min) => `${label} value must be larger than ${min}`,
8
- };
9
- const extraParamKey = {
10
- minlength: 'requiredLength',
11
- maxlength: 'requiredLength',
12
- max: 'max',
13
- min: 'min'
14
- };
15
- export function getFormErrorMessage(err, label) {
16
- if (!err)
17
- return '';
18
- const key = Object.keys(err)[0];
19
- return errMessage[key](label ?? 'Column', err[key][extraParamKey[key]]);
20
- }
21
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9ybS1lcnJvci1tZXNzYWdlLnV0aWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy91bmlwaW4tYW5ndWxhci9zcmMvbGliL3V0aWxzL2Zvcm0tZXJyb3ItbWVzc2FnZS51dGlsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE1BQU0sVUFBVSxHQUF5RDtJQUN2RSxLQUFLLEVBQUUsQ0FBQyxLQUFhLEVBQUUsRUFBRSxDQUFDLEdBQUksS0FBTSx1QkFBdUI7SUFDM0QsUUFBUSxFQUFFLENBQUMsS0FBYSxFQUFFLEVBQUUsQ0FBQyxHQUFJLEtBQU0sY0FBYztJQUNyRCxTQUFTLEVBQUUsQ0FBQyxLQUFhLEVBQUUsTUFBZSxFQUFFLEVBQUUsQ0FBQyxHQUFJLEtBQU0scUJBQXNCLE1BQU8sYUFBYTtJQUNuRyxTQUFTLEVBQUUsQ0FBQyxLQUFhLEVBQUUsTUFBZSxFQUFFLEVBQUUsQ0FBQyxHQUFJLEtBQU0sb0JBQXFCLE1BQU8sYUFBYTtJQUNsRyxHQUFHLEVBQUUsQ0FBQyxLQUFhLEVBQUUsR0FBWSxFQUFFLE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