@alfresco/adf-core 8.4.0-17407900008 → 8.4.0-17433250431

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,23 +1,26 @@
1
1
  import { Emitters as JsApiEmitters, HttpClient as JsApiHttpClient } from '@alfresco/js-api';
2
2
  import { HttpClient } from '@angular/common/http';
3
3
  import { RequestOptions, SecurityOptions } from './interfaces';
4
- import ee, { Emitter } from 'event-emitter';
4
+ import { EventEmitter } from 'eventemitter3';
5
5
  import * as i0 from "@angular/core";
6
+ type EventEmitterInstance = InstanceType<typeof EventEmitter>;
7
+ type EventEmitterEvents = 'progress' | 'success' | 'error' | 'forbidden' | 'abort' | 'unauthorized' | string;
6
8
  export interface Emitters {
7
- readonly eventEmitter: Emitter;
8
- readonly apiClientEmitter: Emitter;
9
+ readonly eventEmitter: EventEmitterInstance;
10
+ readonly apiClientEmitter: EventEmitterInstance;
9
11
  }
10
- export declare class AdfHttpClient implements ee.Emitter, JsApiHttpClient {
12
+ export declare class AdfHttpClient implements JsApiHttpClient {
11
13
  private httpClient;
12
- on: ee.EmitterMethod;
13
- off: ee.EmitterMethod;
14
- once: ee.EmitterMethod;
14
+ private eventEmitter;
15
15
  _disableCsrf: boolean;
16
- emit: (type: string, ...args: any[]) => void;
17
16
  get disableCsrf(): boolean;
18
17
  set disableCsrf(disableCsrf: boolean);
19
18
  private defaultSecurityOptions;
20
19
  constructor(httpClient: HttpClient);
20
+ on(event: EventEmitterEvents, fn: (...args: any[]) => void, context?: any): this;
21
+ off(event: EventEmitterEvents, fn?: (...args: any[]) => void, context?: any): this;
22
+ once(event: EventEmitterEvents, fn: (...args: any[]) => void, context?: any): this;
23
+ emit(event: EventEmitterEvents, ...args: any[]): boolean;
21
24
  setDefaultSecurityOption(options: any): void;
22
25
  merge(...objects: any[]): any;
23
26
  request<T = any>(url: string, options?: RequestOptions, sc?: SecurityOptions, emitters?: JsApiEmitters): Promise<T>;
@@ -66,3 +69,4 @@ export declare class AdfHttpClient implements ee.Emitter, JsApiHttpClient {
66
69
  static ɵfac: i0.ɵɵFactoryDeclaration<AdfHttpClient, never>;
67
70
  static ɵprov: i0.ɵɵInjectableDeclaration<AdfHttpClient>;
68
71
  }
72
+ export {};
@@ -62,7 +62,6 @@ import * as i2$6 from '@angular/material/checkbox';
62
62
  import { MatCheckboxModule } from '@angular/material/checkbox';
63
63
  import * as i1$a from 'angular-oauth2-oidc';
64
64
  import { OAuthStorage, AuthConfig, OAuthService, OAuthErrorEvent, OAuthLogger, OAuthSuccessEvent, AUTH_CONFIG, provideOAuthClient } from 'angular-oauth2-oidc';
65
- import ee from 'event-emitter';
66
65
  import { Minimatch } from 'minimatch';
67
66
  import { JwksValidationHandler } from 'angular-oauth2-oidc-jwks';
68
67
  import { AuthenticationInterceptor, Authentication } from '@alfresco/adf-core/auth';
@@ -7231,7 +7230,6 @@ class BaseAuthenticationService {
7231
7230
  this.onError = new ReplaySubject(1);
7232
7231
  this.onLogin = new ReplaySubject(1);
7233
7232
  this.onLogout = new ReplaySubject(1);
7234
- ee(this);
7235
7233
  }
7236
7234
  /**
7237
7235
  * Adds the auth token to an HTTP header using the 'bearer' scheme.
@@ -21186,23 +21184,27 @@ class MinLengthFieldValidator {
21186
21184
  }
21187
21185
  }
21188
21186
  class MaxLengthFieldValidator {
21189
- constructor() {
21190
- this.supportedTypes = [FormFieldTypes.TEXT, FormFieldTypes.MULTILINE_TEXT];
21187
+ constructor(supportedTypes = [FormFieldTypes.TEXT, FormFieldTypes.MULTILINE_TEXT], maxLength) {
21188
+ this.supportedTypes = supportedTypes;
21189
+ this.maxLength = maxLength;
21191
21190
  }
21192
21191
  isSupported(field) {
21193
- return field && this.supportedTypes.indexOf(field.type) > -1 && field.maxLength > 0;
21192
+ return field && this.supportedTypes.indexOf(field.type) > -1 && this.getMaxLength(field) > 0;
21194
21193
  }
21195
21194
  validate(field) {
21196
21195
  if (this.isSupported(field) && field.value && field.isVisible) {
21197
- if (field.value.length <= field.maxLength) {
21196
+ if (field.value.toString().length <= this.getMaxLength(field)) {
21198
21197
  return true;
21199
21198
  }
21200
21199
  field.validationSummary.message = `FORM.FIELD.VALIDATOR.NO_LONGER_THAN`;
21201
- field.validationSummary.attributes.set('maxLength', field.maxLength.toLocaleString());
21200
+ field.validationSummary.attributes.set('maxLength', this.getMaxLength(field).toLocaleString());
21202
21201
  return false;
21203
21202
  }
21204
21203
  return true;
21205
21204
  }
21205
+ getMaxLength(field) {
21206
+ return this.maxLength ?? field.maxLength;
21207
+ }
21206
21208
  }
21207
21209
  class MinValueFieldValidator {
21208
21210
  constructor() {
@@ -21333,6 +21335,7 @@ const FORM_FIELD_VALIDATORS = [
21333
21335
  new NumberFieldValidator(),
21334
21336
  new MinLengthFieldValidator(),
21335
21337
  new MaxLengthFieldValidator(),
21338
+ new MaxLengthFieldValidator([FormFieldTypes.NUMBER], 10),
21336
21339
  new MinValueFieldValidator(),
21337
21340
  new MaxValueFieldValidator(),
21338
21341
  new RegExFieldValidator(),