import $ from 'jquery'; import Sortable from 'sortablejs'; let body = $('body'); class Template { constructor(container) { this.container = $(container); if (this.getName() === undefined) { this.container = this.container.closest('[data-grav-array-name]'); } } getName() { return this.container.data('grav-array-name') || ''; } getKeyPlaceholder() { return this.container.data('grav-array-keyname') || 'Key'; } getValuePlaceholder() { return this.container.data('grav-array-valuename') || 'Value'; } isValueOnly() { return this.container.find('[data-grav-array-mode="value_only"]:first').length || false; } isTextArea() { return this.container.data('grav-array-textarea') || false; } shouldBeDisabled() { // check for toggleables, if field is toggleable and it's not enabled, render disabled let toggle = this.container.closest('.form-field').find('[data-grav-field="toggleable"] input[type="checkbox"]'); return toggle.length && toggle.is(':not(:checked)'); } getNewRow() { let tpl = '';const value = this.isTextArea() ? `` : ``; if (this.isValueOnly()) { tpl += `