|
29 | 29 | return wrapper; |
30 | 30 | }; |
31 | 31 |
|
32 | | - var obsoleteOpts = function(oldName, newName) { |
33 | | - console.warn('gridstack.js: Option `' + oldName + '` is deprecated as of v0.2.5 and has been replaced with `' + |
34 | | - newName + '`. It will be **completely** removed in v1.0.'); |
| 32 | + var obsoleteOpts = function(opts, oldName, newName) { |
| 33 | + if (opts[oldName] !== undefined) { |
| 34 | + opts[newName] = opts[oldName]; |
| 35 | + console.warn('gridstack.js: Option `' + oldName + '` is deprecated as of v0.2.5 and has been replaced with `' + |
| 36 | + newName + '`. It will be **completely** removed in v1.0.'); |
| 37 | + } |
35 | 38 | }; |
36 | 39 |
|
37 | 40 | var Utils = { |
|
660 | 663 | this.container = $(el); |
661 | 664 |
|
662 | 665 | /*eslint-disable camelcase */ |
663 | | - if (opts.handle_class !== undefined) { |
664 | | - opts.handleClass = opts.handle_class; |
665 | | - obsoleteOpts('handle_class', 'handleClass'); |
666 | | - } |
667 | | - if (opts.item_class !== undefined) { |
668 | | - opts.itemClass = opts.item_class; |
669 | | - obsoleteOpts('item_class', 'itemClass'); |
670 | | - } |
671 | | - if (opts.placeholder_class !== undefined) { |
672 | | - opts.placeholderClass = opts.placeholder_class; |
673 | | - obsoleteOpts('placeholder_class', 'placeholderClass'); |
674 | | - } |
675 | | - if (opts.placeholder_text !== undefined) { |
676 | | - opts.placeholderText = opts.placeholder_text; |
677 | | - obsoleteOpts('placeholder_text', 'placeholderText'); |
678 | | - } |
679 | | - if (opts.cell_height !== undefined) { |
680 | | - opts.cellHeight = opts.cell_height; |
681 | | - obsoleteOpts('cell_height', 'cellHeight'); |
682 | | - } |
683 | | - if (opts.vertical_margin !== undefined) { |
684 | | - opts.verticalMargin = opts.vertical_margin; |
685 | | - obsoleteOpts('vertical_margin', 'verticalMargin'); |
686 | | - } |
687 | | - if (opts.min_width !== undefined) { |
688 | | - opts.minWidth = opts.min_width; |
689 | | - obsoleteOpts('min_width', 'minWidth'); |
690 | | - } |
691 | | - if (opts.static_grid !== undefined) { |
692 | | - opts.staticGrid = opts.static_grid; |
693 | | - obsoleteOpts('static_grid', 'staticGrid'); |
694 | | - } |
695 | | - if (opts.is_nested !== undefined) { |
696 | | - opts.isNested = opts.is_nested; |
697 | | - obsoleteOpts('is_nested', 'isNested'); |
698 | | - } |
699 | | - if (opts.always_show_resize_handle !== undefined) { |
700 | | - opts.alwaysShowResizeHandle = opts.always_show_resize_handle; |
701 | | - obsoleteOpts('always_show_resize_handle', 'alwaysShowResizeHandle'); |
702 | | - } |
703 | | - if (opts.width !== undefined) { |
704 | | - opts.columns = opts.width; |
705 | | - obsoleteOpts('width', 'columns'); |
706 | | - } |
707 | | - if (opts.height !== undefined) { |
708 | | - opts.maxRows = opts.height; |
709 | | - obsoleteOpts('height', 'maxRows'); |
710 | | - } |
| 666 | + obsoleteOpts(opts, 'handle_class', 'handleClass'); |
| 667 | + obsoleteOpts(opts, 'item_class', 'itemClass'); |
| 668 | + obsoleteOpts(opts, 'placeholder_class', 'placeholderClass'); |
| 669 | + obsoleteOpts(opts, 'placeholder_text', 'placeholderText'); |
| 670 | + obsoleteOpts(opts, 'cell_height', 'cellHeight'); |
| 671 | + obsoleteOpts(opts, 'vertical_margin', 'verticalMargin'); |
| 672 | + obsoleteOpts(opts, 'min_width', 'minWidth'); |
| 673 | + obsoleteOpts(opts, 'static_grid', 'staticGrid'); |
| 674 | + obsoleteOpts(opts, 'is_nested', 'isNested'); |
| 675 | + obsoleteOpts(opts, 'always_show_resize_handle', 'alwaysShowResizeHandle'); |
| 676 | + obsoleteOpts(opts, 'width', 'columns'); |
| 677 | + obsoleteOpts(opts, 'height', 'maxRows'); |
711 | 678 | /*eslint-enable camelcase */ |
712 | 679 |
|
713 | 680 | opts.itemClass = opts.itemClass || 'grid-stack-item'; |
|
0 commit comments