diff --git a/nodes/widgets/locales/en-US/ui_form.json b/nodes/widgets/locales/en-US/ui_form.json index 16de15581..76baf3cc3 100644 --- a/nodes/widgets/locales/en-US/ui_form.json +++ b/nodes/widgets/locales/en-US/ui_form.json @@ -23,7 +23,6 @@ "switch": "Switch", "date": "Date", "time": "Time", - "element": "element", "buttons": "Buttons", "submit": "submit", "submitButtonText": "submit button text", @@ -35,4 +34,4 @@ "resetOnSubmit": "Reset the form when submitted" } } -} \ No newline at end of file +} diff --git a/nodes/widgets/ui_form.html b/nodes/widgets/ui_form.html index 98f58f0b4..19dfe43c1 100644 --- a/nodes/widgets/ui_form.html +++ b/nodes/widgets/ui_form.html @@ -88,114 +88,132 @@ // option.find(".node-input-option-key").width(newWidth); } - function generateOption (i, option) { - const container = $('
  • ', { style: 'margin:0; padding:8px 0px 0px; border-bottom:1px solid var(--red-ui-form-input-border-color, #ccc);' }) - const row = $('
    ').appendTo(container) - $('
    ', { style: 'padding-top:5px; padding-left:175px;' }).appendTo(container) - $('
    ', { style: 'padding-top:5px; padding-left:120px;' }).appendTo(container) + const supportedTypes = [ + { val: 'text', text: c_('label.text') }, + { val: 'multiline', text: c_('label.multiline') }, + { val: 'number', text: c_('label.number') }, + { val: 'email', text: c_('label.email') }, + { val: 'password', text: c_('label.password') }, + { val: 'checkbox', text: c_('label.checkbox') }, + { val: 'switch', text: c_('label.switch') }, + { val: 'date', text: c_('label.date') }, + { val: 'time', text: c_('label.time') } + ] - $('').appendTo(row) + // which input types don't need a 'require' option + const noReqd = ['checkbox', 'switch'] - // label field - $('', { class: 'node-input-option-label', type: 'text', style: 'margin-left:7px; width:20%;', placeholder: c_('label.egName'), value: option.label }).appendTo(row) + let formOptionsList = $('#node-input-option-container').css('min-height','150px') + .css('min-width','450px') + .editableList({ + header: $('
    ').css('margin-left','28px') + .css('margin-right','28px') + .css('padding-right','0px') + .append($.parseHTML("
    " + c_('label.label') + "
    " + + "
    " + + "
    " + c_('label.type') + "
    " + + "
    " + c_('label.required') + "
    " + + "
    " + c_('label.rows') + "
    ")), + addItem: function(container, i, option) { + let row = $('
    ').appendTo(container) - // key field - let keyClass = 'node-input-option-key' - if (!option.key) { keyClass = 'node-input-option-key input-error' } - const keyField = $('', { class: keyClass, type: 'text', style: 'margin-left:7px; width:20%;', placeholder: c_('label.egName2'), value: option.key }).appendTo(row) - keyField.keyup(function () { - if ($(this).val() && $(this).hasClass('input-error')) { - $(this).removeClass('input-error') - } else { - if (!$(this).val()) { - $(this).addClass('input-error') - } - } - }) - - // type field - const typeField = $('').appendTo('body'); - $(arr).each(function () { - let isSelected = false - if (option.type === this.val) { - isSelected = true - } - typeField.append($('