Skip to content

How should the public API be? We want your feedback #58

@tonivj5

Description

@tonivj5

With the last PR (#57), the public API is going to change and it would be good opinions and way of to do this.

At the moment, the public API is something like this:
All events return an ExternalEvent (exported as InlineEvent) ->

{ 
  event?: Event, 
  state: { value: any, empty: boolean,  editing: boolean, disabled: boolean } // it's an InlineState
}

An state is the state of input when this one changed (the new state), for example: if I click an input, its state will change from editing: false to editing: true, and if I type 'a', its state will change from value: '' to value: 'a'. These states are in hot, until I do click on save, this changes will not reflect in the model (ngModel) and I will receive it using the events ((onChange)="todoSomething($event)", etc.).

  • Events bindable
    • onSave
    • onEdit
    • onCancel
    • onError // This one returns an InlineError | InlineError[] -> { type: string, message: string }
    • onChange
    • onKeyPress
    • onEnter
    • onEscape
    • onFocus
    • onBlur
  • Public methods (API) (with these methods you can change the state of input)
    • save( { event: Event, state: InlineState }: ExternalEvent )
    • saveAndClose( { event: Event, state: InlineState }: ExternalEvent )
    • edit( { editing: boolean, doFocus: boolean } )
    • cancel( { event: Event, state: InlineState }: ExternalEvent )
    • getHotState(): InlineState // This returns state from input (no saved)

Are the methods user friendly? is this the correct approach? Please, give us your feedback 👍

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions