lukana-schemater

0.0.5-1 • Public • Published

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);
    }
}

Readme

Keywords

none

Package Sidebar

Install

npm i lukana-schemater

Weekly Downloads

2

Version

0.0.5-1

License

MIT

Last publish

Collaborators

  • piernik