Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

gridstack.jQueryUI.js 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /** gridstack.js 0.6.4 - JQuery UI Drag&Drop plugin @preserve */
  2. /**
  3. * https://gridstackjs.com/
  4. * (c) 2014-2020 Alain Dumesny, Dylan Weiss, Pavel Reznikov
  5. * gridstack.js may be freely distributed under the MIT license.
  6. */
  7. (function(factory) {
  8. if (typeof define === 'function' && define.amd) {
  9. define(['jquery', 'gridstack', 'exports'], factory);
  10. } else if (typeof exports !== 'undefined') {
  11. try { jQuery = require('jquery'); } catch (e) {}
  12. try { gridstack = require('gridstack'); } catch (e) {}
  13. factory(jQuery, gridstack.GridStackUI, exports);
  14. } else {
  15. factory(jQuery, GridStackUI, window);
  16. }
  17. })(function($, GridStackUI, scope) {
  18. /**
  19. * @class JQueryUIGridStackDragDropPlugin
  20. * jQuery UI implementation of drag'n'drop gridstack plugin.
  21. */
  22. function JQueryUIGridStackDragDropPlugin(grid) {
  23. GridStackUI.GridStackDragDropPlugin.call(this, grid);
  24. }
  25. GridStackUI.GridStackDragDropPlugin.registerPlugin(JQueryUIGridStackDragDropPlugin);
  26. JQueryUIGridStackDragDropPlugin.prototype = Object.create(GridStackUI.GridStackDragDropPlugin.prototype);
  27. JQueryUIGridStackDragDropPlugin.prototype.constructor = JQueryUIGridStackDragDropPlugin;
  28. JQueryUIGridStackDragDropPlugin.prototype.resizable = function(el, opts) {
  29. el = $(el);
  30. if (opts === 'disable' || opts === 'enable') {
  31. el.resizable(opts);
  32. } else if (opts === 'option') {
  33. var key = arguments[2];
  34. var value = arguments[3];
  35. el.resizable(opts, key, value);
  36. } else {
  37. var handles = el.data('gs-resize-handles') ? el.data('gs-resize-handles') :
  38. this.grid.opts.resizable.handles;
  39. el.resizable($.extend({}, this.grid.opts.resizable, {
  40. handles: handles
  41. }, {
  42. start: opts.start || function() {},
  43. stop: opts.stop || function() {},
  44. resize: opts.resize || function() {}
  45. }));
  46. }
  47. return this;
  48. };
  49. JQueryUIGridStackDragDropPlugin.prototype.draggable = function(el, opts) {
  50. el = $(el);
  51. if (opts === 'disable' || opts === 'enable') {
  52. el.draggable(opts);
  53. } else {
  54. el.draggable($.extend({}, this.grid.opts.draggable, {
  55. containment: (this.grid.opts.isNested && !this.grid.opts.dragOut) ?
  56. this.grid.container.parent() :
  57. (this.grid.opts.draggable.containment || null),
  58. start: opts.start || function() {},
  59. stop: opts.stop || function() {},
  60. drag: opts.drag || function() {}
  61. }));
  62. }
  63. return this;
  64. };
  65. JQueryUIGridStackDragDropPlugin.prototype.droppable = function(el, opts) {
  66. el = $(el);
  67. el.droppable(opts);
  68. return this;
  69. };
  70. JQueryUIGridStackDragDropPlugin.prototype.isDroppable = function(el, opts) {
  71. el = $(el);
  72. return Boolean(el.data('droppable'));
  73. };
  74. JQueryUIGridStackDragDropPlugin.prototype.on = function(el, eventName, callback) {
  75. $(el).on(eventName, callback);
  76. return this;
  77. };
  78. scope.JQueryUIGridStackDragDropPlugin = JQueryUIGridStackDragDropPlugin;
  79. return JQueryUIGridStackDragDropPlugin;
  80. });