Skip to content

Commit

Permalink
Fix date-fns related exports for Core lib (#10102)
Browse files Browse the repository at this point in the history
  • Loading branch information
DenysVuika authored Aug 20, 2024
1 parent 04e2b16 commit d56988b
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
5 changes: 2 additions & 3 deletions demo-shell/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { AppComponent } from './app.component';
import { appRoutes } from './app.routes';
import { MonacoEditorModule } from 'ngx-monaco-editor-v2';
import { ContentModule } from '@alfresco/adf-content-services';
import { InsightsModule } from '@alfresco/adf-insights';
import { ProcessModule } from '@alfresco/adf-process-services';
import { environment } from '../environments/environment';
import { ProcessServicesCloudModule } from '@alfresco/adf-process-services-cloud';
Expand All @@ -44,7 +43,6 @@ import { CoreAutomationService } from '../testing/automation.service';
TranslateModule.forRoot(),
CoreModule.forRoot(),
ContentModule.forRoot(),
InsightsModule.forRoot(),
ProcessModule.forRoot(),
ProcessServicesCloudModule.forRoot(),
ExtensionsModule.forRoot(),
Expand All @@ -54,7 +52,8 @@ import { CoreAutomationService } from '../testing/automation.service';
declarations: [AppComponent],
providers: [
{ provide: AppConfigService, useClass: DebugAppConfigService }, // not use this service in production
provideTranslations('app', 'resources')
provideTranslations('app', 'resources'),
provideTranslations('adf-insights', 'assets/adf-insights')
],
bootstrap: [AppComponent]
})
Expand Down
2 changes: 1 addition & 1 deletion lib/core/src/lib/common/utils/date-fns-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const ADF_DATE_FORMATS: MatDateFormats = {
}
};

@Injectable()
@Injectable({ providedIn: 'root' })
export class AdfDateFnsAdapter extends DateFnsAdapter {
private _displayFormat?: string = null;

Expand Down
2 changes: 1 addition & 1 deletion lib/core/src/lib/common/utils/datetime-fns-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function range<T>(length: number, valueFunction: (index: number) => T): T[] {
return valuesArray;
}

@Injectable()
@Injectable({ providedIn: 'root' })
export class AdfDateTimeFnsAdapter extends DatetimeAdapter<Date> {
private _displayFormat?: string = null;

Expand Down
4 changes: 0 additions & 4 deletions lib/core/src/lib/core.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ import { loadAppConfig } from './app-config/app-config.loader';
import { AppConfigService } from './app-config/app-config.service';
import { StorageService } from './common/services/storage.service';
import { AlfrescoApiLoaderService, createAlfrescoApiInstance } from './api-factories/alfresco-api-v2-loader.service';
import { AdfDateFnsAdapter } from './common/utils/date-fns-adapter';
import { MomentDateAdapter } from './common/utils/moment-date-adapter';
import { AdfDateTimeFnsAdapter } from './common/utils/datetime-fns-adapter';
import { AppConfigPipe, StoragePrefixFactory } from './app-config';
import { IconComponent } from './icon';
import { SortingPickerComponent } from './sorting-picker';
Expand Down Expand Up @@ -140,8 +138,6 @@ export class CoreModule {
TranslateStore,
TranslateService,
{ provide: TranslateLoader, useClass: TranslateLoaderService },
AdfDateFnsAdapter,
AdfDateTimeFnsAdapter,
MomentDateAdapter,
StoragePrefixFactory,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import { AdfDateFnsAdapter, DownloadService, ToolbarComponent, ToolbarTitleComponent } from '@alfresco/adf-core';
import { ADF_DATE_FORMATS, AdfDateFnsAdapter, DownloadService, ToolbarComponent, ToolbarTitleComponent } from '@alfresco/adf-core';
import {
AfterContentChecked,
Component,
Expand Down Expand Up @@ -46,6 +46,7 @@ import { MatMenuModule } from '@angular/material/menu';
import { WIDGET_DIRECTIVES } from './widgets';
import { MatButtonModule } from '@angular/material/button';
import { ButtonsMenuComponent } from './buttons-menu/buttons-menu.component';
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';

const FORMAT_DATE_ACTIVITI = 'YYYY-MM-DD';

Expand Down Expand Up @@ -124,6 +125,10 @@ export interface ReportFormValues {
MatButtonModule,
ButtonsMenuComponent
],
providers: [
{ provide: MAT_DATE_FORMATS, useValue: ADF_DATE_FORMATS },
{ provide: DateAdapter, useClass: AdfDateFnsAdapter }
],
templateUrl: './analytics-report-parameters.component.html',
styleUrls: ['./analytics-report-parameters.component.scss'],
encapsulation: ViewEncapsulation.None
Expand Down
1 change: 1 addition & 0 deletions lib/insights/src/lib/insights.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { provideTranslations } from '@alfresco/adf-core';
import { ANALYTICS_PROCESS_DIRECTIVES } from './analytics-process/public-api';
import { DIAGRAM_DIRECTIVES } from './diagram/public-api';

/** @deprecated This module is deprecated and will be removed in a future release. */
@NgModule({
imports: [...ANALYTICS_PROCESS_DIRECTIVES, ...DIAGRAM_DIRECTIVES],
exports: [...ANALYTICS_PROCESS_DIRECTIVES, ...DIAGRAM_DIRECTIVES]
Expand Down
7 changes: 3 additions & 4 deletions lib/insights/src/lib/testing/insights.testing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,24 @@
import { NgModule } from '@angular/core';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { TranslateModule } from '@ngx-translate/core';
import { InsightsModule } from '../insights.module';
import {
AlfrescoApiService,
AlfrescoApiServiceMock,
AppConfigService,
AppConfigServiceMock,
TranslationService,
TranslationMock,
CoreModule,
AuthModule
} from '@alfresco/adf-core';
import { HttpClientTestingModule } from '@angular/common/http/testing';

@NgModule({
imports: [AuthModule.forRoot({ useHash: true }), NoopAnimationsModule, TranslateModule.forRoot(), CoreModule.forRoot(), InsightsModule],
imports: [AuthModule.forRoot({ useHash: true }), NoopAnimationsModule, HttpClientTestingModule, TranslateModule.forRoot()],
providers: [
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
{ provide: AppConfigService, useClass: AppConfigServiceMock },
{ provide: TranslationService, useClass: TranslationMock }
],
exports: [NoopAnimationsModule, TranslateModule, CoreModule, InsightsModule]
exports: [NoopAnimationsModule, TranslateModule]
})
export class InsightsTestingModule {}

0 comments on commit d56988b

Please sign in to comment.