ember-gridstack icon indicating copy to clipboard operation
ember-gridstack copied to clipboard

Update list of GridStack actions

Open kevinhinterlong opened this issue 5 years ago • 6 comments

Discussion from https://github.com/yahoo/ember-gridstack/commit/065d92d20c3dd1aa97d23dfec9d7bd37d144274e#r37636891

check the events - there is more including gsResizeStop which is better than regular.

Here is a list of events

kevinhinterlong avatar Mar 04 '20 17:03 kevinhinterlong

@adumesny Does GridStack have a list of these events anywhere in the code or should we just update our own list?

kevinhinterlong avatar Mar 04 '20 17:03 kevinhinterlong

there is a type (which is enforced with Typescript version) but not an array of them.

type GridStackEvent = 'added' | 'change' | 'disable' | 'dragstart' | 'dragstop' | 'dropped' | 'enable' | 'removed' | 'resize' | 'resizestart' | 'gsresizestop' | string;

I added string (anything) as you can combine them into a space separated list (not sure how to do enforce that type option) as of 1.1.0 (which jquery supported). I update the demos to use it.

https://github.com/gridstack/gridstack.js/blob/develop/src/gridstack.d.ts

Note: master is unfortunately not always latest published... I try to keep it up when releasing but develop is it.

adumesny avatar Mar 04 '20 18:03 adumesny

but maybe I should expose an array of them for others to use ? I don't expect those to change often. column might be a new one later (no easy way of knowing when oneColumnMode triggers for example).

adumesny avatar Mar 04 '20 18:03 adumesny

I don't expect those to change often.

This is what I assumed, so maybe we'll just update this repo's list of events and have to be more careful in the future updates.

Or if you do add a list of events we could use that and you could add them as an assert to runtime typecheck on the space separated list

kevinhinterlong avatar Mar 04 '20 18:03 kevinhinterlong

@adumesny out of curiosity, from a gridstack client perspective, is there a need for both resizestop & gsresizestop?

jkusa avatar Mar 04 '20 19:03 jkusa

https://github.com/gridstack/gridstack.js/tree/develop/doc#gsresizestopevent-ui Note: this is a custom event name that is guaranteed to be called after the jqueryui resizestop event where we update data-gs-width and data-gs-height. You could instead use the change event which has the latest node sizing.

so only if you care about those fields being set. Personally I use the node values...

adumesny avatar Mar 04 '20 22:03 adumesny