|
23 | 23 | document.head.appendChild(style);
|
24 | 24 |
|
25 | 25 | return style.sheet;
|
| 26 | + }, |
| 27 | + |
| 28 | + toBool: function (v) { |
| 29 | + if (typeof v == 'boolean') |
| 30 | + return v; |
| 31 | + if (typeof v == 'string') { |
| 32 | + v = v.toLowerCase(); |
| 33 | + return !(v == '' || v == 'no' || v == 'false' || v == '0'); |
| 34 | + } |
| 35 | + return Boolean(v); |
26 | 36 | }
|
27 | 37 | };
|
28 | 38 |
|
|
423 | 433 | min_width: el.attr('data-gs-min-width'),
|
424 | 434 | max_height: el.attr('data-gs-max-height') || 100,
|
425 | 435 | min_height: el.attr('data-gs-min-height'),
|
426 |
| - auto_position: el.attr('data-gs-auto-position'), |
427 |
| - no_resize: el.attr('data-gs-no-resize'), |
428 |
| - no_move: el.attr('data-gs-no-move'), |
429 |
| - locked: el.attr('data-gs-locked'), |
| 436 | + auto_position: Utils.toBool(el.attr('data-gs-auto-position')), |
| 437 | + no_resize: Utils.toBool(el.attr('data-gs-no-resize')), |
| 438 | + no_move: Utils.toBool(el.attr('data-gs-no-move')), |
| 439 | + locked: Utils.toBool(el.attr('data-gs-locked')), |
430 | 440 | el: el
|
431 | 441 | });
|
432 | 442 | el.data('_gridstack_node', node);
|
|
532 | 542 | if (typeof y != 'undefined') el.attr('data-gs-y', y);
|
533 | 543 | if (typeof width != 'undefined') el.attr('data-gs-width', width);
|
534 | 544 | if (typeof height != 'undefined') el.attr('data-gs-height', height);
|
535 |
| - if (typeof auto_position != 'undefined') el.attr('data-gs-auto-position', auto_position); |
| 545 | + if (typeof auto_position != 'undefined') el.attr('data-gs-auto-position', auto_position ? 'yes' : null); |
536 | 546 | this.container.append(el);
|
537 | 547 | this._prepare_element(el);
|
538 | 548 | this._update_container_height();
|
|
0 commit comments