mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[APPS-2108] break direct dependency on moment.js (#9032)
* break direct dependency on moment.js * [ci:force] preserve moment for cli tools * remove MatMomentDatetimeModule from content * share dialog fixes * revert testing module changes * remove incorrect date modules * fix html
This commit is contained in:
parent
abf369bc37
commit
7ebdce7875
@ -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,
|
||||
|
@ -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',
|
||||
|
@ -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": [
|
||||
|
@ -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)">
|
||||
</mat-slide-toggle>
|
||||
</div>
|
||||
|
@ -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();
|
||||
|
@ -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<string>;
|
||||
time: FormControl<Date>;
|
||||
}
|
||||
|
||||
@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<Date>): 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<SharedDialogFormProps>({
|
||||
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<boolean>();
|
||||
|
||||
constructor(
|
||||
@ -99,7 +97,7 @@ export class ShareDialogComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
get time(): AbstractControl {
|
||||
get time(): FormControl<Date> {
|
||||
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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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},
|
||||
|
@ -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": [
|
||||
|
@ -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<Moment> {
|
||||
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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
@ -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},
|
||||
|
@ -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"
|
||||
},
|
||||
|
@ -60,8 +60,8 @@ export class DateRangeWidgetComponent implements OnInit {
|
||||
constructor(private dateAdapter: DateAdapter<Date>) {}
|
||||
|
||||
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) {
|
||||
|
@ -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 },
|
||||
|
@ -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": [
|
||||
|
@ -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 { }
|
||||
|
@ -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;
|
||||
|
@ -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 { }
|
||||
|
@ -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 },
|
||||
|
@ -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",
|
||||
|
@ -54,8 +54,8 @@ export class DateEditorComponent implements OnInit {
|
||||
constructor(private dateAdapter: DateAdapter<Date>) {}
|
||||
|
||||
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;
|
||||
}
|
||||
|
34
package-lock.json
generated
34
package-lock.json
generated
@ -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": "*"
|
||||
}
|
||||
|
@ -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"
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user