How to use @alfresco/adf-core - 10 common examples

To help you get started, we’ve selected a few @alfresco/adf-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Alfresco / adf-examples / ADF_2.0.0 / upgrade-from-1-9-0 / app / components / activiti / activiti-demo.component.ts View on Github external
constructor(private elementRef: ElementRef,
                private route: ActivatedRoute,
                private router: Router,
                private taskListService: TaskListService,
                private apiService: AlfrescoApiService,
                formRenderingService: FormRenderingService,
                formService: FormService) {
        this.dataTasks = new ObjectDataTableAdapter();
        this.dataTasks.setSorting(new DataSorting('created', 'desc'));

        this.dataProcesses = new ObjectDataTableAdapter(
            [],
            [
                { type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true },
                { type: 'text', key: 'started', title: 'Started', cssClass: 'hidden', sortable: true }
            ]
        );
        this.dataProcesses.setSorting(new DataSorting('started', 'desc'));

        // Uncomment this line to replace all 'text' field editors with custom component
        // formRenderingService.setComponentTypeResolver('text', () => CustomEditorComponent, true);

        // Uncomment this line to map 'custom_stencil_01' to local editor component
        formRenderingService.setComponentTypeResolver('custom_stencil_01', () => CustomStencil01, true);
github Alfresco / alfresco-ng2-components / demo-shell / src / app / components / lazy-loading / lazy-loading.component.ts View on Github external
constructor(private auth: AuthenticationService) {
        this.data = new ObjectDataTableAdapter(
            // data
            [
              {id: 1, name: 'Name 1'},
              {id: 2, name: 'Name 2'}
            ],
            // schema
            [
              {
                type: 'text',
                key: 'id',
                title: 'Id',
                sortable: true
              },
              {
                type: 'text',
                key: 'name',
github Alfresco / alfresco-ng2-components / lib / process-services / src / lib / form / form.component.spec.ts View on Github external
it('should check visibility only if field with form provided', () => {

        formComponent.checkVisibility(null);
        expect(visibilityService.refreshVisibility).not.toHaveBeenCalled();

        let field = new FormFieldModel(null);
        formComponent.checkVisibility(field);
        expect(visibilityService.refreshVisibility).not.toHaveBeenCalled();

        field = new FormFieldModel(new FormModel());
        formComponent.checkVisibility(field);
        expect(visibilityService.refreshVisibility).toHaveBeenCalledWith(field.form);
    });
github Alfresco / alfresco-ng2-components / lib / process-services / src / lib / form / form.component.spec.ts View on Github external
it('should disable outcome buttons for invalid form', () => {
        const formModel = new FormModel();
        const field = new FormFieldModel(formModel, {
            type: 'text',
            value: null,
            required: true
        });

        const containerModel = new ContainerModel(field);
        formModel.fields.push(containerModel);
        formComponent.form = formModel;
        formModel.onFormFieldChanged(field);

        expect(formModel.isValid).toBeFalsy();

        const outcome = new FormOutcomeModel(new FormModel(), {
            id: FormComponent.CUSTOM_OUTCOME_ID,
            name: 'Custom'
github Alfresco / alfresco-ng2-components / lib / process-services / src / lib / form / form.component.spec.ts View on Github external
it('should save task form and raise corresponding event', () => {
        spyOn(formService, 'saveTaskForm').and.callFake(() => {
            return new Observable((observer) => {
                observer.next();
                observer.complete();
            });
        });

        let saved = false;
        let savedForm = null;
        formComponent.formSaved.subscribe((form) => {
            saved = true;
            savedForm = form;
        });

        const formModel = new FormModel({
            taskId: '123',
            fields: [
                { id: 'field1' },
                { id: 'field2' }
            ]
        });
        formComponent.form = formModel;
        formComponent.saveTaskForm();

        expect(formService.saveTaskForm).toHaveBeenCalledWith(formModel.taskId, formModel.values);
        expect(saved).toBeTruthy();
        expect(savedForm).toEqual(formModel);
    });
github Alfresco / alfresco-ng2-components / lib / process-services / src / lib / form / form.component.spec.ts View on Github external
it('should disable save outcome button when form is valid and readOnly', () => {
        const formModel = new FormModel();

        const field = new FormFieldModel(formModel, {
            type: 'text',
            value: 'text',
            required: true
        });

        const containerModel = new ContainerModel(field);
        formModel.fields.push(containerModel);
        formComponent.form = formModel;
        formModel.onFormFieldChanged(field);

        expect(formModel.isValid).toBeTruthy();

        const saveOutcome = new FormOutcomeModel(new FormModel(), {
            id: FormComponent.SAVE_OUTCOME_ID,
github Alfresco / alfresco-ng2-components / lib / process-services / src / lib / form / form.component.spec.ts View on Github external
it('should require loaded form when clicking outcome', () => {
        const formModel = new FormModel();
        const outcomeName = 'Custom Action';
        const outcome = new FormOutcomeModel(formModel, { id: 'custom1', name: outcomeName });

        formComponent.readOnly = false;
        formComponent.form = null;
        expect(formComponent.onOutcomeClicked(outcome)).toBeFalsy();
    });
github Alfresco / alfresco-ng2-components / lib / process-services / src / lib / task-list / components / start-task.component.ts View on Github external
ngOnInit() {
        if (this.name) {
            this.taskDetailsModel.name = this.name;
        }

        this.validateMaxTaskNameLength();

        this.field = new FormFieldModel(new FormModel(), { id: this.assigneeId, value: this.assigneeId, placeholder: 'Assignee' });

        this.userPreferencesService
            .select(UserPreferenceValues.Locale)
            .pipe(takeUntil(this.onDestroy$))
            .subscribe(locale => this.dateAdapter.setLocale(locale));

        this.loadFormsTask();
        this.buildForm();
    }
github Alfresco / alfresco-ng2-components / lib / process-services / src / lib / form / form.component.spec.ts View on Github external
it('should disable custom outcome buttons for readonly form', () => {
        const formModel = new FormModel();
        formModel.readOnly = true;
        formComponent.form = formModel;

        const outcome = new FormOutcomeModel(new FormModel(), {
            id: FormComponent.CUSTOM_OUTCOME_ID,
            name: 'Custom'
        });

        expect(formComponent.isOutcomeButtonEnabled(outcome)).toBeFalsy();
    });
github Alfresco / alfresco-ng2-components / lib / process-services / src / lib / form / form.component.spec.ts View on Github external
it('should show [custom-outcome] button with readOnly form and selected custom-outcome', () => {
        const formModel = new FormModel({ selectedOutcome: 'custom-outcome' });
        formModel.readOnly = true;
        formComponent.form = formModel;
        let outcome = new FormOutcomeModel(formModel, { id: '$customoutome', name: 'custom-outcome' });

        formComponent.showCompleteButton = true;
        formComponent.showSaveButton = true;
        expect(formComponent.isOutcomeButtonVisible(outcome, formComponent.form.readOnly)).toBeTruthy();

        outcome = new FormOutcomeModel(formModel, { id: '$customoutome2', name: 'custom-outcome2' });
        expect(formComponent.isOutcomeButtonVisible(outcome, formComponent.form.readOnly)).toBeFalsy();
    });