|
158 | 158 | return this;
|
159 | 159 | };
|
160 | 160 |
|
161 |
| - /** |
162 |
| - * @class JQueryUIGridStackDragDropPlugin |
163 |
| - * jQuery UI implementation of drag'n'drop gridstack plugin. |
164 |
| - */ |
165 |
| - function JQueryUIGridStackDragDropPlugin(grid) { |
166 |
| - GridStackDragDropPlugin.call(this, grid); |
167 |
| - } |
168 |
| - |
169 |
| - GridStackDragDropPlugin.registerPlugin(JQueryUIGridStackDragDropPlugin); |
170 |
| - |
171 |
| - JQueryUIGridStackDragDropPlugin.prototype = Object.create(GridStackDragDropPlugin.prototype); |
172 |
| - JQueryUIGridStackDragDropPlugin.prototype.constructor = JQueryUIGridStackDragDropPlugin; |
173 |
| - |
174 |
| - JQueryUIGridStackDragDropPlugin.prototype.resizable = function(el, opts) { |
175 |
| - el = $(el); |
176 |
| - if (opts === 'disable' || opts === 'enable') { |
177 |
| - el.resizable(opts); |
178 |
| - } else { |
179 |
| - el.resizable(_.extend({}, this.grid.opts.resizable, { |
180 |
| - start: opts.start || function() {}, |
181 |
| - stop: opts.stop || function() {}, |
182 |
| - resize: opts.resize || function() {} |
183 |
| - })); |
184 |
| - } |
185 |
| - return this; |
186 |
| - }; |
187 |
| - |
188 |
| - JQueryUIGridStackDragDropPlugin.prototype.draggable = function(el, opts) { |
189 |
| - el = $(el); |
190 |
| - if (opts === 'disable' || opts === 'enable') { |
191 |
| - el.draggable(opts); |
192 |
| - } else { |
193 |
| - el.draggable(_.extend({}, this.grid.opts.draggable, { |
194 |
| - containment: this.grid.opts.isNested ? this.grid.container.parent() : null, |
195 |
| - start: opts.start || function() {}, |
196 |
| - stop: opts.stop || function() {}, |
197 |
| - drag: opts.drag || function() {} |
198 |
| - })); |
199 |
| - } |
200 |
| - return this; |
201 |
| - }; |
202 |
| - |
203 |
| - JQueryUIGridStackDragDropPlugin.prototype.droppable = function(el, opts) { |
204 |
| - el = $(el); |
205 |
| - if (opts === 'disable' || opts === 'enable') { |
206 |
| - el.droppable(opts); |
207 |
| - } else { |
208 |
| - el.droppable({ |
209 |
| - accept: opts.accept |
210 |
| - }); |
211 |
| - } |
212 |
| - return this; |
213 |
| - }; |
214 |
| - |
215 |
| - JQueryUIGridStackDragDropPlugin.prototype.isDroppable = function(el, opts) { |
216 |
| - el = $(el); |
217 |
| - return Boolean(el.data('droppable')); |
218 |
| - }; |
219 |
| - |
220 |
| - JQueryUIGridStackDragDropPlugin.prototype.on = function(el, eventName, callback) { |
221 |
| - $(el).on(eventName, callback); |
222 |
| - return this; |
223 |
| - }; |
224 | 161 |
|
225 | 162 | var idSeq = 0;
|
226 | 163 |
|
|
676 | 613 | if (this.opts.ddPlugin === false) {
|
677 | 614 | this.opts.ddPlugin = GridStackDragDropPlugin;
|
678 | 615 | } else if (this.opts.ddPlugin === null) {
|
679 |
| - this.opts.ddPlugin = _.first(GridStackDragDropPlugin.registeredPlugins); |
| 616 | + this.opts.ddPlugin = _.first(GridStackDragDropPlugin.registeredPlugins) || GridStackDragDropPlugin; |
680 | 617 | }
|
681 | 618 |
|
682 | 619 | this.dd = new this.opts.ddPlugin(this);
|
|
1189 | 1126 | node._beforeDragX = node.x;
|
1190 | 1127 | node._beforeDragY = node.y;
|
1191 | 1128 |
|
1192 |
| - el.resizable('option', 'minWidth', cellWidth * (node.minWidth || 1)); |
1193 |
| - el.resizable('option', 'minHeight', strictCellHeight * (node.minHeight || 1)); |
| 1129 | + self.dd.resizable(el, 'option', 'minWidth', cellWidth * (node.minWidth || 1)); |
| 1130 | + self.dd.resizable(el, 'option', 'minHeight', strictCellHeight * (node.minHeight || 1)); |
1194 | 1131 |
|
1195 | 1132 | if (event.type == 'resizestart') {
|
1196 | 1133 | o.find('.grid-stack-item').trigger('resizestart');
|
|
1398 | 1335 |
|
1399 | 1336 | node.noResize = !(val || false);
|
1400 | 1337 | if (node.noResize || self._isOneColumnMode()) {
|
1401 |
| - el.resizable('disable'); |
| 1338 | + self.dd.resizable(el, 'disable'); |
1402 | 1339 | } else {
|
1403 |
| - el.resizable('enable'); |
| 1340 | + self.dd.resizable(el, 'enable'); |
1404 | 1341 | }
|
1405 | 1342 | });
|
1406 | 1343 | return this;
|
|
0 commit comments