diff --git a/angular.json b/angular.json index afc2366a54..1591263171 100644 --- a/angular.json +++ b/angular.json @@ -117,8 +117,7 @@ "scripts": [ "node_modules/pdfjs-dist/build/pdf.js", "node_modules/pdfjs-dist/web/pdf_viewer.js", - "node_modules/raphael/raphael.min.js", - "node_modules/moment/min/moment.min.js" + "node_modules/raphael/raphael.min.js" ], "vendorChunk": true, "extractLicenses": false, diff --git a/lib/content-services/karma.conf.js b/lib/content-services/karma.conf.js index 38be541c58..ef92f5fcf8 100644 --- a/lib/content-services/karma.conf.js +++ b/lib/content-services/karma.conf.js @@ -16,7 +16,6 @@ module.exports = function (config) { included: true, watched: false }, - {pattern: 'node_modules/moment/min/moment.min.js', included: true, watched: false}, {pattern: 'lib/content-services/src/lib/i18n/**/en.json', included: false, served: true, watched: false}, { pattern: 'lib/content-services/src/lib/assets/images/**/*.svg', diff --git a/lib/content-services/package.json b/lib/content-services/package.json index 1b73c87ed8..0b0b238dce 100644 --- a/lib/content-services/package.json +++ b/lib/content-services/package.json @@ -23,7 +23,6 @@ "@angular/router": ">=14.1.3", "@alfresco/js-api": ">=7.1.0-1437", "@ngx-translate/core": ">=14.0.0", - "moment": ">=2.22.2", "@alfresco/adf-core": ">=6.3.0" }, "keywords": [ diff --git a/lib/content-services/src/lib/content-node-share/content-node-share.dialog.html b/lib/content-services/src/lib/content-node-share/content-node-share.dialog.html index 3e20f17dd6..ba142b7403 100644 --- a/lib/content-services/src/lib/content-node-share/content-node-share.dialog.html +++ b/lib/content-services/src/lib/content-node-share/content-node-share.dialog.html @@ -23,7 +23,7 @@ color="primary" data-automation-id="adf-expire-toggle" aria-label="{{ 'SHARE.EXPIRES' | translate }}" - [checked]="time.value" + [checked]="!!time.value" (change)="onToggleExpirationDate($event)"> diff --git a/lib/content-services/src/lib/content-node-share/content-node-share.dialog.spec.ts b/lib/content-services/src/lib/content-node-share/content-node-share.dialog.spec.ts index a49f68c42e..9ccb780a28 100644 --- a/lib/content-services/src/lib/content-node-share/content-node-share.dialog.spec.ts +++ b/lib/content-services/src/lib/content-node-share/content-node-share.dialog.spec.ts @@ -27,9 +27,10 @@ import { ContentTestingModule } from '../testing/content.testing.module'; import { TranslateModule } from '@ngx-translate/core'; import { format, endOfDay } from 'date-fns'; import { By } from '@angular/platform-browser'; +import { NodeEntry } from '@alfresco/js-api'; describe('ShareDialogComponent', () => { - let node; + let node: NodeEntry; let matDialog: MatDialog; const notificationServiceMock = { openSnackMessage: jasmine.createSpy('openSnackMessage') @@ -42,6 +43,7 @@ describe('ShareDialogComponent', () => { let appConfigService: AppConfigService; const shareToggleId = '[data-automation-id="adf-share-toggle"]'; + const expireToggle = '[data-automation-id="adf-expire-toggle"]'; const getShareToggleLinkedClasses = (): DOMTokenList => fixture.nativeElement.querySelector(shareToggleId).classList; @@ -53,32 +55,26 @@ describe('ShareDialogComponent', () => { fixture.detectChanges(); }; - const clickExpireToggleButton = () => fixture.nativeElement.querySelector('mat-slide-toggle[data-automation-id="adf-expire-toggle"] label') - .dispatchEvent(new MouseEvent('click')); + const clickExpireToggleButton = () => fixture.nativeElement.querySelector(`${expireToggle} label`).dispatchEvent(new MouseEvent('click')); - const clickShareToggleButton = () => fixture.nativeElement.querySelector(`${shareToggleId} label`) - .dispatchEvent(new MouseEvent('click')); + const clickShareToggleButton = () => fixture.nativeElement.querySelector(`${shareToggleId} label`).dispatchEvent(new MouseEvent('click')); beforeEach(() => { TestBed.configureTestingModule({ - imports: [ - TranslateModule.forRoot(), - ContentTestingModule - ], + imports: [TranslateModule.forRoot(), ContentTestingModule], providers: [ - {provide: NotificationService, useValue: notificationServiceMock}, + { provide: NotificationService, useValue: notificationServiceMock }, { - provide: MatDialogRef, useValue: { - close: () => { - } + provide: MatDialogRef, + useValue: { + close: () => {} } }, - {provide: MAT_DIALOG_DATA, useValue: {}} + { provide: MAT_DIALOG_DATA, useValue: {} } ] }); fixture = TestBed.createComponent(ShareDialogComponent); component = fixture.componentInstance; - component.maxDebounceTime = 0; matDialog = TestBed.inject(MatDialog); sharedLinksApiService = TestBed.inject(SharedLinksApiService); @@ -89,8 +85,15 @@ describe('ShareDialogComponent', () => { node = { entry: { id: 'nodeId', + name: 'node1', + nodeType: 'cm:content', allowableOperations: ['update'], isFile: true, + isFolder: false, + modifiedAt: null, + modifiedByUser: null, + createdAt: null, + createdByUser: null, properties: {} } }; @@ -104,9 +107,7 @@ describe('ShareDialogComponent', () => { describe('Error Handling', () => { it('should emit a generic error when unshare fails', (done) => { - spyOn(sharedLinksApiService, 'deleteSharedLink').and.returnValue( - of(new Error(`{ "error": { "statusCode": 999 } }`)) - ); + spyOn(sharedLinksApiService, 'deleteSharedLink').and.returnValue(of(new Error(`{ "error": { "statusCode": 999 } }`))); const sub = sharedLinksApiService.error.subscribe((err) => { expect(err.statusCode).toBe(999); @@ -119,9 +120,7 @@ describe('ShareDialogComponent', () => { }); it('should emit permission error when unshare fails', (done) => { - spyOn(sharedLinksApiService, 'deleteSharedLink').and.returnValue( - of(new Error(`{ "error": { "statusCode": 403 } }`)) - ); + spyOn(sharedLinksApiService, 'deleteSharedLink').and.returnValue(of(new Error(`{ "error": { "statusCode": 403 } }`))); const sub = sharedLinksApiService.error.subscribe((err) => { expect(err.statusCode).toBe(403); @@ -135,10 +134,12 @@ describe('ShareDialogComponent', () => { }); it(`should toggle share action when property 'sharedId' does not exists`, () => { - spyOn(sharedLinksApiService, 'createSharedLinks').and.returnValue(of({ - entry: {id: 'sharedId', sharedId: 'sharedId'} - })); - spyOn(renditionService, 'getNodeRendition').and.returnValue(Promise.resolve({url: '', mimeType: ''})); + spyOn(sharedLinksApiService, 'createSharedLinks').and.returnValue( + of({ + entry: { id: 'sharedId', sharedId: 'sharedId' } + }) + ); + spyOn(renditionService, 'getNodeRendition').and.returnValue(Promise.resolve({ url: '', mimeType: '' })); component.data = { node, @@ -154,10 +155,12 @@ describe('ShareDialogComponent', () => { }); it(`should not toggle share action when file has 'sharedId' property`, async () => { - spyOn(sharedLinksApiService, 'createSharedLinks').and.returnValue(of({ - entry: {id: 'sharedId', sharedId: 'sharedId'} - })); - spyOn(renditionService, 'getNodeRendition').and.returnValue(Promise.resolve({url: '', mimeType: ''})); + spyOn(sharedLinksApiService, 'createSharedLinks').and.returnValue( + of({ + entry: { id: 'sharedId', sharedId: 'sharedId' } + }) + ); + spyOn(renditionService, 'getNodeRendition').and.returnValue(Promise.resolve({ url: '', mimeType: '' })); node.entry.properties['qshare:sharedId'] = 'sharedId'; @@ -177,7 +180,7 @@ describe('ShareDialogComponent', () => { }); it('should open a confirmation dialog when unshare button is triggered', () => { - spyOn(matDialog, 'open').and.returnValue({beforeClosed: () => of(false)} as any); + spyOn(matDialog, 'open').and.returnValue({ beforeClosed: () => of(false) } as any); spyOn(sharedLinksApiService, 'deleteSharedLink').and.callThrough(); node.entry.properties['qshare:sharedId'] = 'sharedId'; @@ -197,7 +200,7 @@ describe('ShareDialogComponent', () => { }); it('should unshare file when confirmation dialog returns true', fakeAsync(() => { - spyOn(matDialog, 'open').and.returnValue({beforeClosed: () => of(true)} as any); + spyOn(matDialog, 'open').and.returnValue({ beforeClosed: () => of(true) } as any); spyOn(sharedLinksApiService, 'deleteSharedLink').and.returnValue(of({})); node.entry.properties['qshare:sharedId'] = 'sharedId'; @@ -216,7 +219,7 @@ describe('ShareDialogComponent', () => { })); it('should not unshare file when confirmation dialog returns false', fakeAsync(() => { - spyOn(matDialog, 'open').and.returnValue({beforeClosed: () => of(false)} as any); + spyOn(matDialog, 'open').and.returnValue({ beforeClosed: () => of(false) } as any); spyOn(sharedLinksApiService, 'deleteSharedLink').and.callThrough(); node.entry.properties['qshare:sharedId'] = 'sharedId'; @@ -283,12 +286,10 @@ describe('ShareDialogComponent', () => { fixture.detectChanges(); await fixture.whenStable(); - expect(fixture.nativeElement.querySelector('.mat-slide-toggle[data-automation-id="adf-expire-toggle"]') - .classList).toContain('mat-disabled'); + expect(fixture.nativeElement.querySelector('.mat-slide-toggle[data-automation-id="adf-expire-toggle"]').classList).toContain('mat-disabled'); expect(fixture.nativeElement.querySelector('[data-automation-id="adf-slide-toggle-checked"]').style.display).toEqual('none'); }); - describe('datetimepicker type', () => { beforeEach(() => { spyOn(sharedLinksApiService, 'createSharedLinks').and.returnValue(of()); @@ -324,29 +325,6 @@ describe('ShareDialogComponent', () => { }); })); - it('should update node with input date and time when type is `datetime`', fakeAsync(() => { - const dateTimePickerType = 'datetime'; - const date = new Date('2525-01-01 13:00:00'); - spyOn(appConfigService, 'get').and.returnValue(dateTimePickerType); - - fixture.detectChanges(); - clickExpireToggleButton(); - - fixture.componentInstance.type = 'datetime'; - fixture.componentInstance.time.setValue(date); - component.onTimeChanged(); - fixture.detectChanges(); - tick(100); - - const expiryDate = format((new Date(date)), `yyyy-MM-dd'T'HH:mm:ss.SSSxx`); - - expect(sharedLinksApiService.deleteSharedLink).toHaveBeenCalled(); - expect(sharedLinksApiService.createSharedLinks).toHaveBeenCalledWith('nodeId', { - nodeId: 'nodeId', - expiresAt: expiryDate - }); - })); - it('should not update node when provided date is less than minDate', () => { fixture.detectChanges(); clickExpireToggleButton(); @@ -366,10 +344,14 @@ describe('ShareDialogComponent', () => { expect(component.form.controls['time'].value).toBeNull(); }); - it('should show an error if provided date is invalid', () => { + it('should show an error if provided date is invalid', async () => { fixture.detectChanges(); clickExpireToggleButton(); - fillInDatepickerInput('32'); + fillInDatepickerInput('incorrect'); + + fixture.detectChanges(); + await fixture.whenStable(); + const error = fixture.debugElement.query(By.css('[data-automation-id="adf-share-link-input-warning"]')); expect(error).toBeTruthy(); diff --git a/lib/content-services/src/lib/content-node-share/content-node-share.dialog.ts b/lib/content-services/src/lib/content-node-share/content-node-share.dialog.ts index d5c3f3338a..b0e369d7c9 100644 --- a/lib/content-services/src/lib/content-node-share/content-node-share.dialog.ts +++ b/lib/content-services/src/lib/content-node-share/content-node-share.dialog.ts @@ -18,17 +18,20 @@ import { Component, Inject, OnInit, ViewEncapsulation, ViewChild, OnDestroy } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog'; import { MatSlideToggleChange } from '@angular/material/slide-toggle'; -import { AbstractControl, FormControl, FormGroup, Validators } from '@angular/forms'; +import { FormControl, FormGroup, Validators } from '@angular/forms'; import { Subject } from 'rxjs'; import { ContentService } from '../common/services/content.service'; import { SharedLinksApiService } from './services/shared-links-api.service'; -import { SharedLinkBodyCreate, SharedLinkEntry } from '@alfresco/js-api'; +import { SharedLinkBodyCreate } from '@alfresco/js-api'; import { ConfirmDialogComponent } from '../dialogs/confirm.dialog'; import { ContentNodeShareSettings } from './content-node-share.settings'; import { RenditionService } from '../common/services/rendition.service'; import { format, add, endOfDay, isBefore } from 'date-fns'; -type DatePickerType = 'date' | 'time' | 'month' | 'datetime'; +interface SharedDialogFormProps { + sharedUrl: FormControl; + time: FormControl; +} @Component({ selector: 'adf-share-dialog', @@ -38,7 +41,7 @@ type DatePickerType = 'date' | 'time' | 'month' | 'datetime'; encapsulation: ViewEncapsulation.None }) export class ShareDialogComponent implements OnInit, OnDestroy { - private minDateValidator = (control: AbstractControl): any => + private minDateValidator = (control: FormControl): any => isBefore(endOfDay(new Date(control.value)), this.minDate) ? { invalidDate: true } : null; minDate = add(new Date(), { days: 1 }); @@ -48,20 +51,15 @@ export class ShareDialogComponent implements OnInit, OnDestroy { isFileShared = false; isDisabled = false; isLinkWithExpiryDate = false; - form: FormGroup = new FormGroup({ + form = new FormGroup({ sharedUrl: new FormControl(''), - time: new FormControl({ value: '', disabled: true }, [Validators.required, this.minDateValidator]) + time: new FormControl({ value: null, disabled: true }, [Validators.required, this.minDateValidator]) }); - type: DatePickerType = 'date'; - maxDebounceTime = 500; isExpiryDateToggleChecked: boolean; @ViewChild('slideToggleExpirationDate', { static: true }) slideToggleExpirationDate; - @ViewChild('datePickerInput', { static: true }) - datePickerInput; - private onDestroy$ = new Subject(); constructor( @@ -99,7 +97,7 @@ export class ShareDialogComponent implements OnInit, OnDestroy { } } - get time(): AbstractControl { + get time(): FormControl { return this.form.controls['time']; } @@ -177,7 +175,7 @@ export class ShareDialogComponent implements OnInit, OnDestroy { this.isDisabled = true; this.sharedLinksApiService.createSharedLinks(nodeId, sharedLinkWithExpirySettings).subscribe( - (sharedLink: SharedLinkEntry) => { + (sharedLink) => { if (sharedLink.entry) { this.sharedId = sharedLink.entry.id; if (this.data.node.entry.properties) { @@ -267,11 +265,7 @@ export class ShareDialogComponent implements OnInit, OnDestroy { private updateNode(date: Date) { let expiryDate: Date | string; if (date) { - if (this.type === 'date') { - expiryDate = format(endOfDay(new Date(date)), `yyyy-MM-dd'T'HH:mm:ss.SSSxx`); - } else { - expiryDate = format(new Date(date), `yyyy-MM-dd'T'HH:mm:ss.SSSxx`); - } + expiryDate = format(endOfDay(new Date(date)), `yyyy-MM-dd'T'HH:mm:ss.SSSxx`); } else { expiryDate = null; } diff --git a/lib/content-services/src/lib/dialogs/dialog.module.ts b/lib/content-services/src/lib/dialogs/dialog.module.ts index bab4670689..51495a8fff 100644 --- a/lib/content-services/src/lib/dialogs/dialog.module.ts +++ b/lib/content-services/src/lib/dialogs/dialog.module.ts @@ -25,7 +25,6 @@ import { FolderDialogComponent } from './folder.dialog'; import { NodeLockDialogComponent } from './node-lock.dialog'; import { ConfirmDialogComponent } from './confirm.dialog'; import { MatDatetimepickerModule } from '@mat-datetimepicker/core'; -import { MatMomentDatetimeModule } from '@mat-datetimepicker/moment'; import { LibraryDialogComponent } from './library/library.dialog'; import { ContentDirectiveModule } from '../directives'; import { DownloadZipDialogModule } from './download-zip/download-zip.dialog.module'; @@ -37,7 +36,6 @@ import { DownloadZipDialogModule } from './download-zip/download-zip.dialog.modu CoreModule, FormsModule, ReactiveFormsModule, - MatMomentDatetimeModule, MatDatetimepickerModule, ContentDirectiveModule, DownloadZipDialogModule diff --git a/lib/core/karma.conf.js b/lib/core/karma.conf.js index 14258dd8af..37bc290691 100644 --- a/lib/core/karma.conf.js +++ b/lib/core/karma.conf.js @@ -17,7 +17,6 @@ module.exports = function (config) { included: true, watched: false }, - {pattern: 'node_modules/moment/min/moment.min.js', included: true, watched: false}, {pattern: 'lib/core/src/lib/i18n/**/en.json', included: false, served: true, watched: false}, {pattern: 'lib/core/**/*.ts', included: false, served: true, watched: false}, {pattern: 'lib/core/src/lib/assets/**/*.svg', included: false, served: true, watched: false}, diff --git a/lib/core/package.json b/lib/core/package.json index 9f2a8d262a..9f36209396 100644 --- a/lib/core/package.json +++ b/lib/core/package.json @@ -31,15 +31,12 @@ "@angular/core": ">=14.1.3", "@angular/forms": ">=14.1.3", "@angular/material": ">=14.1.2", - "@angular/material-moment-adapter": ">=14.1.2", "@angular/router": ">=14.1.3", "@mat-datetimepicker/core": "^10.1.1", - "@mat-datetimepicker/moment": "^10.1.1", "@alfresco/js-api": ">=7.1.0-1437", "@alfresco/adf-extensions": ">=6.3.0", "@ngx-translate/core": ">=14.0.0", "minimatch-browser": ">=1.0.0", - "moment": ">=2.22.2", "pdfjs-dist": ">=3.3.122" }, "keywords": [ diff --git a/lib/core/src/lib/common/utils/moment-date-adapter.ts b/lib/core/src/lib/common/utils/moment-date-adapter.ts index aecdada5f0..c38d1f019c 100644 --- a/lib/core/src/lib/common/utils/moment-date-adapter.ts +++ b/lib/core/src/lib/common/utils/moment-date-adapter.ts @@ -17,9 +17,13 @@ import { Injectable } from '@angular/core'; import { DateAdapter } from '@angular/material/core'; -import moment, { isMoment, Moment } from 'moment'; import { UserPreferencesService, UserPreferenceValues } from '../services/user-preferences.service'; +// Stub for the moment.js integration. +// While this dependency is no longer used by the libraries, the moment adapter can still discover the moment.js linked to the application +declare let moment: any; +type Moment = any; + /** * @deprecated this class is deprecated and should not be used. * Consider using `AdfDateFnsAdapter` or `AdfDateTimeFnsAdapter` instead @@ -183,7 +187,7 @@ export class MomentDateAdapter extends DateAdapter { if (first == null) { // same if both null return second == null; - } else if (isMoment(first)) { + } else if (moment.isMoment(first)) { return first.isSame(second); } else { const isSame = super.sameDate(first, second); diff --git a/lib/core/src/lib/pipes/moment-date.pipe.ts b/lib/core/src/lib/pipes/moment-date.pipe.ts index 9a9522b55d..012c510349 100644 --- a/lib/core/src/lib/pipes/moment-date.pipe.ts +++ b/lib/core/src/lib/pipes/moment-date.pipe.ts @@ -16,14 +16,15 @@ */ import { Pipe, PipeTransform } from '@angular/core'; -import moment, { Moment } from 'moment'; + +declare let moment: any; /** * @deprecated this pipe is deprecated and should no longer be used */ @Pipe({ name: 'adfMomentDate' }) export class MomentDatePipe implements PipeTransform { - transform(value: moment.MomentInput, dateFormat: string): Moment { + transform(value: any, dateFormat: string): any { return moment(value, dateFormat); } } diff --git a/lib/core/src/lib/pipes/moment-datetime.pipe.ts b/lib/core/src/lib/pipes/moment-datetime.pipe.ts index 230775a670..4c2eba9b18 100644 --- a/lib/core/src/lib/pipes/moment-datetime.pipe.ts +++ b/lib/core/src/lib/pipes/moment-datetime.pipe.ts @@ -16,17 +16,14 @@ */ import { Pipe, PipeTransform } from '@angular/core'; -import moment, { Moment } from 'moment'; +declare let moment: any; /** * @deprecated this pipe is deprecated and should no longer be used */ @Pipe({ name: 'adfMomentDateTime' }) export class MomentDateTimePipe implements PipeTransform { - transform(value: moment.MomentInput, dateFormat: string): Moment { - return moment(value, dateFormat) - .add( - moment(value, dateFormat).utcOffset(), - 'minutes'); + transform(value: any, dateFormat: string): any { + return moment(value, dateFormat).add(moment(value, dateFormat).utcOffset(), 'minutes'); } } diff --git a/lib/insights/karma.conf.js b/lib/insights/karma.conf.js index bab28e7546..74a36697eb 100644 --- a/lib/insights/karma.conf.js +++ b/lib/insights/karma.conf.js @@ -30,7 +30,6 @@ module.exports = function (config) { watched: false }, - {pattern: 'node_modules/moment/min/moment.min.js', included: true, watched: false}, {pattern: 'lib/insights/src/lib/i18n/**/en.json', included: false, served: true, watched: false}, {pattern: 'lib/insights/**/*.ts', included: false, served: true, watched: false}, {pattern: 'lib/config/app.config.json', included: false, served: true, watched: false}, diff --git a/lib/insights/package.json b/lib/insights/package.json index 8b727803c6..2f967cd0db 100644 --- a/lib/insights/package.json +++ b/lib/insights/package.json @@ -19,7 +19,6 @@ "@alfresco/adf-core": ">=6.3.0", "@ngx-translate/core": ">=14.0.0", "chart.js": "^4.3.0", - "moment": ">=2.22.2", "ng2-charts": "^4.1.1", "raphael": ">=2.3.0" }, diff --git a/lib/insights/src/lib/analytics-process/components/widgets/date-range/date-range.widget.ts b/lib/insights/src/lib/analytics-process/components/widgets/date-range/date-range.widget.ts index 162c54b60d..fdde609f0a 100644 --- a/lib/insights/src/lib/analytics-process/components/widgets/date-range/date-range.widget.ts +++ b/lib/insights/src/lib/analytics-process/components/widgets/date-range/date-range.widget.ts @@ -60,8 +60,8 @@ export class DateRangeWidgetComponent implements OnInit { constructor(private dateAdapter: DateAdapter) {} ngOnInit() { - const momentDateAdapter = this.dateAdapter as AdfDateFnsAdapter; - momentDateAdapter.displayFormat = DISPLAY_FORMAT; + const dateAdapter = this.dateAdapter as AdfDateFnsAdapter; + dateAdapter.displayFormat = DISPLAY_FORMAT; if (this.field) { if (this.field.value?.startDate) { diff --git a/lib/process-services-cloud/karma.conf.js b/lib/process-services-cloud/karma.conf.js index 48ac3023c9..2c947d8695 100644 --- a/lib/process-services-cloud/karma.conf.js +++ b/lib/process-services-cloud/karma.conf.js @@ -17,7 +17,6 @@ module.exports = function (config) { }, { pattern: 'node_modules/chart.js/dist/Chart.js', included: true, watched: false }, { pattern: 'node_modules/raphael/raphael.min.js', included: true, watched: false }, - { pattern: 'node_modules/moment/min/moment.min.js', included: true, watched: false }, { pattern: 'lib/core/src/lib/i18n/**/en.json', included: false, served: true, watched: false }, { pattern: 'lib/process-services-cloud/src/lib/i18n/*.json', included: false, served: true, watched: false }, { pattern: 'lib/process-services-cloud/src/lib/mock/*.json', included: false, served: true, watched: false }, diff --git a/lib/process-services-cloud/package.json b/lib/process-services-cloud/package.json index 6d2b959bcd..5c23eb5259 100644 --- a/lib/process-services-cloud/package.json +++ b/lib/process-services-cloud/package.json @@ -31,7 +31,6 @@ "@angular/core": ">=14.1.3", "@angular/forms": ">=14.1.3", "@angular/material": ">=14.1.2", - "@angular/material-moment-adapter": ">=14.1.2", "@angular/platform-browser": ">=14.1.3", "@angular/platform-browser-dynamic": ">=14.1.3", "@angular/router": ">=14.1.3", @@ -41,7 +40,6 @@ "@apollo/client": "^3.7.2", "@ngx-translate/core": ">=14.0.0", "apollo-angular": "^4.0.1", - "moment": ">=2.22.2", "subscriptions-transport-ws": "^0.11.0" }, "keywords": [ diff --git a/lib/process-services-cloud/src/lib/process/process-filters/process-filters-cloud.module.ts b/lib/process-services-cloud/src/lib/process/process-filters/process-filters-cloud.module.ts index c54a2730e0..9d01723921 100644 --- a/lib/process-services-cloud/src/lib/process/process-filters/process-filters-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/process/process-filters/process-filters-cloud.module.ts @@ -20,12 +20,11 @@ import { CommonModule } from '@angular/common'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { ProcessFiltersCloudComponent } from './components/process-filters-cloud.component'; import { MaterialModule } from '../../material.module'; -import { CoreModule, MomentDateAdapter, MOMENT_DATE_FORMATS } from '@alfresco/adf-core'; +import { CoreModule } from '@alfresco/adf-core'; import { HttpClientModule } from '@angular/common/http'; import { EditProcessFilterCloudComponent } from './components/edit-process-filter-cloud.component'; import { ProcessFilterDialogCloudComponent } from './components/process-filter-dialog-cloud.component'; import { AppListCloudModule } from './../../app/app-list-cloud.module'; -import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core'; import { ProcessCommonModule } from '../../common/process-common.module'; import { PeopleCloudModule } from '../../people/people-cloud.module'; @@ -42,10 +41,6 @@ import { PeopleCloudModule } from '../../people/people-cloud.module'; PeopleCloudModule ], declarations: [ProcessFiltersCloudComponent, EditProcessFilterCloudComponent, ProcessFilterDialogCloudComponent], - exports: [ProcessFiltersCloudComponent, EditProcessFilterCloudComponent, ProcessFilterDialogCloudComponent], - providers: [ - { provide: DateAdapter, useClass: MomentDateAdapter }, - { provide: MAT_DATE_FORMATS, useValue: MOMENT_DATE_FORMATS } - ] + exports: [ProcessFiltersCloudComponent, EditProcessFilterCloudComponent, ProcessFilterDialogCloudComponent] }) export class ProcessFiltersCloudModule { } diff --git a/lib/process-services-cloud/src/lib/services/form-fields.interfaces.ts b/lib/process-services-cloud/src/lib/services/form-fields.interfaces.ts index 3969f01679..4c1246d984 100644 --- a/lib/process-services-cloud/src/lib/services/form-fields.interfaces.ts +++ b/lib/process-services-cloud/src/lib/services/form-fields.interfaces.ts @@ -15,8 +15,6 @@ * limitations under the License. */ -import { Moment } from 'moment'; - export interface FormContent { formRepresentation: FormRepresentation; } @@ -109,7 +107,7 @@ export interface VisibilityCondition { leftType: string; leftValue: string; operator: string; - rightValue: string | number | Date | Moment; + rightValue: string | number | Date; rightType: string; nextConditionOperator?: string; nextCondition?: VisibilityCondition; diff --git a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts index 8df5ce88a5..53522f2ad5 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts @@ -20,10 +20,9 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { CommonModule } from '@angular/common'; import { TaskFiltersCloudComponent } from './components/task-filters-cloud.component'; import { MaterialModule } from '../../material.module'; -import { CoreModule, MomentDateAdapter, MOMENT_DATE_FORMATS } from '@alfresco/adf-core'; +import { CoreModule } from '@alfresco/adf-core'; import { HttpClientModule } from '@angular/common/http'; import { AppListCloudModule } from './../../app/app-list-cloud.module'; -import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core'; import { ProcessCommonModule } from '../../common/process-common.module'; import { PeopleCloudModule } from '../../people/people-cloud.module'; import { EditServiceTaskFilterCloudComponent } from './components/edit-task-filters/edit-service-task-filter-cloud.component'; @@ -59,10 +58,6 @@ import { GroupCloudModule } from '../../group/group-cloud.module'; ServiceTaskFiltersCloudComponent, EditTaskFilterCloudComponent, EditServiceTaskFilterCloudComponent - ], - providers: [ - { provide: DateAdapter, useClass: MomentDateAdapter }, - { provide: MAT_DATE_FORMATS, useValue: MOMENT_DATE_FORMATS } ] }) export class TaskFiltersCloudModule { } diff --git a/lib/process-services/karma.conf.js b/lib/process-services/karma.conf.js index 638b99982d..c9a9b2d24a 100644 --- a/lib/process-services/karma.conf.js +++ b/lib/process-services/karma.conf.js @@ -17,7 +17,6 @@ module.exports = function (config) { }, { pattern: 'node_modules/chart.js/dist/Chart.js', included: true, watched: false }, { pattern: 'node_modules/raphael/raphael.min.js', included: true, watched: false }, - { pattern: 'node_modules/moment/min/moment.min.js', included: true, watched: false }, { pattern: 'lib/core/src/lib/i18n/**/en.json', included: false, served: true, watched: false }, { pattern: 'lib/content-services/src/lib/i18n/**/en.json', included: false, served: true, watched: false }, { pattern: 'lib/process-services/src/lib/i18n/**/en.json', included: false, served: true, watched: false }, diff --git a/lib/process-services/package.json b/lib/process-services/package.json index ae5fd3c81d..f9a89481de 100644 --- a/lib/process-services/package.json +++ b/lib/process-services/package.json @@ -24,8 +24,7 @@ "@alfresco/js-api": ">=7.1.0-1437", "@alfresco/adf-core": ">=6.3.0", "@alfresco/adf-content-services": ">=6.3.0", - "@ngx-translate/core": ">=14.0.0", - "moment": ">=2.22.2" + "@ngx-translate/core": ">=14.0.0" }, "keywords": [ "process-services", diff --git a/lib/process-services/src/lib/form/widgets/dynamic-table/editors/date/date.editor.ts b/lib/process-services/src/lib/form/widgets/dynamic-table/editors/date/date.editor.ts index 7a90741acf..80520bcdc3 100644 --- a/lib/process-services/src/lib/form/widgets/dynamic-table/editors/date/date.editor.ts +++ b/lib/process-services/src/lib/form/widgets/dynamic-table/editors/date/date.editor.ts @@ -54,8 +54,8 @@ export class DateEditorComponent implements OnInit { constructor(private dateAdapter: DateAdapter) {} ngOnInit() { - const momentDateAdapter = this.dateAdapter as AdfDateFnsAdapter; - momentDateAdapter.displayFormat = this.DATE_FORMAT; + const dateAdapter = this.dateAdapter as AdfDateFnsAdapter; + dateAdapter.displayFormat = this.DATE_FORMAT; this.value = this.table.getCellValue(this.row, this.column) as Date; } diff --git a/package-lock.json b/package-lock.json index 4fe05e4aaf..8e9066587c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,6 @@ "@angular/forms": "14.1.3", "@angular/material": "14.1.2", "@angular/material-date-fns-adapter": "^14.1.2", - "@angular/material-moment-adapter": "14.1.2", "@angular/platform-browser": "14.1.3", "@angular/platform-browser-dynamic": "14.1.3", "@angular/router": "14.1.3", @@ -30,7 +29,6 @@ "@editorjs/list": "1.8.0", "@editorjs/underline": "1.1.0", "@mat-datetimepicker/core": "^10.1.1", - "@mat-datetimepicker/moment": "^10.1.1", "@ngx-translate/core": "^14.0.0", "@storybook/core-server": "^6.5.16", "angular-oauth2-oidc": "^13.0.1", @@ -124,6 +122,7 @@ "lint-staged": "^13.2.0", "lite-server": "^2.6.1", "mini-css-extract-plugin": "^2.7.6", + "moment": "^2.29.4", "nconf": "^0.12.0", "ng-packagr": "14.0.3", "nx": "14.4.2", @@ -1434,18 +1433,6 @@ "date-fns": "^2.23.0" } }, - "node_modules/@angular/material-moment-adapter": { - "version": "14.1.2", - "license": "MIT", - "dependencies": { - "tslib": "^2.3.0" - }, - "peerDependencies": { - "@angular/core": "^14.0.0 || ^15.0.0", - "@angular/material": "14.1.2", - "moment": "^2.18.1" - } - }, "node_modules/@angular/platform-browser": { "version": "14.1.3", "license": "MIT", @@ -5480,21 +5467,6 @@ "@angular/material": "^14.0.4" } }, - "node_modules/@mat-datetimepicker/moment": { - "version": "10.1.1", - "license": "MIT", - "dependencies": { - "tslib": "^2.4.0" - }, - "peerDependencies": { - "@angular/cdk": "^14.0.4", - "@angular/common": "^14.0.5", - "@angular/core": "^14.0.5", - "@angular/material": "^14.0.4", - "@angular/material-moment-adapter": "^14.0.4", - "@mat-datetimepicker/core": "10.1.1" - } - }, "node_modules/@mdx-js/mdx": { "version": "1.6.22", "license": "MIT", @@ -40168,7 +40140,9 @@ }, "node_modules/moment": { "version": "2.29.4", - "license": "MIT", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", + "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==", + "dev": true, "engines": { "node": "*" } diff --git a/package.json b/package.json index 6c285f9c33..88258d6f09 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,6 @@ "@angular/forms": "14.1.3", "@angular/material": "14.1.2", "@angular/material-date-fns-adapter": "^14.1.2", - "@angular/material-moment-adapter": "14.1.2", "@angular/platform-browser": "14.1.3", "@angular/platform-browser-dynamic": "14.1.3", "@angular/router": "14.1.3", @@ -74,7 +73,6 @@ "@editorjs/list": "1.8.0", "@editorjs/underline": "1.1.0", "@mat-datetimepicker/core": "^10.1.1", - "@mat-datetimepicker/moment": "^10.1.1", "@ngx-translate/core": "^14.0.0", "@storybook/core-server": "^6.5.16", "angular-oauth2-oidc": "^13.0.1", @@ -168,6 +166,7 @@ "lint-staged": "^13.2.0", "lite-server": "^2.6.1", "mini-css-extract-plugin": "^2.7.6", + "moment": "^2.29.4", "nconf": "^0.12.0", "ng-packagr": "14.0.3", "nx": "14.4.2", @@ -227,4 +226,3 @@ "module": "./index.js", "typings": "./index.d.ts" } -