0.0.5-1 • Published 7 years ago

lukana-schemater v0.0.5-1

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

Schemater

Input

<schemater-input [tableId]="'table'" [fieldsDefinition]="fieldsDefinition" [inputFields]="['field']" [initValues]="{}" (save)="onSave($event)" (onModelChange)="values=$event">
    <button class="btn btn-block btn-primary">Additional</button>
</schemater-input>
  • tableId - jeżeli tabela jest zdefiniowana w DatabaseData to można użyć tego pola
  • fieldsDefinition - można pominąć zdefiniowaną tabelę (tableId) i tutaj zdefiniować pola
  • inputFields - lista pól jakie się pojawią do wypełnienia w formularzu - jeżeli jest zdefiniowane fieldsDefinition to nie trzeba dawać listy - pojawią się wszystkie pola
  • initValues - początkowe wartości formularza - niekonieczne
  • (save) - funkcja wysyoływana po zapisaniu formularza
  • (onModelChange) - funkcja wywoływana po zmianie danych w formularzu

Search

Własne operacje do tabel

Przykładowa klasa componentu:

export class MojeOperacjeComponent extends SearcherTableOperationsComponent {

    constructor(protected searcherService: SearcherService,
                protected objectFactoryService: ObjectFactoryService) {
        super(searcherService, objectFactoryService);
    }

    ngOnInit() {
        super.ngOnInit();
    }

    showDetails() {
        super.showDetails();
    }
}

Klasa bazowa:

export class SearcherTableOperationsComponent implements OnInit {
    @Input()
    public item;
    protected objectService: ObjectService;
    protected tableId;

    constructor(protected searcherService: SearcherService,
                protected objectFactoryService: ObjectFactoryService) {
    }

    ngOnInit() {
        this.tableId = this.searcherService.tableId;
        this.objectService = this.objectFactoryService.getObjectService(this.tableId);
    }

    showDetails() {
        this.objectService.showDetails(this.item[this.searcherService.getPrimaryField().id]);
    }
}

item - element wiersza

<div class="btn-toolbar" role="toolbar">
    <div class="btn-group btn-group-sm" role="group">
        <button (click)="showDetails(item)" class="btn btn-sm btn-secondary" type="button"><i class="fa fa-eye"></i>
        </button>
    </div>
</div>

W konstruktorze klasy obiektu:

export class MojeService extends ObjectService {
    protected apiPath: string = 'moje';

    constructor() {
        super();

        this.setResultOperationsComponent(MojeOperacjeComponent);
    }
}
0.0.5-1

7 years ago

0.0.4-5

7 years ago

0.0.4-4

7 years ago

0.0.4-3

7 years ago

0.0.4-2

7 years ago

0.0.4-1

7 years ago

0.0.3-5

7 years ago

0.0.3-4

7 years ago

0.0.3-3

7 years ago

0.0.3-2

7 years ago

0.0.3-1

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

8 years ago