(fieldName, fieldSchema, mimeType)
| 807 | } |
| 808 | |
| 809 | formDataParamAsObjectTemplate(fieldName, fieldSchema, mimeType) { |
| 810 | // This template is used when form-data param should be send as a object (application/json, application/xml) |
| 811 | const formdataPartSchema = schemaInObjectNotation(fieldSchema, {}); |
| 812 | const formdataPartExample = generateExample( |
| 813 | fieldSchema, |
| 814 | 'json', |
| 815 | standardizeExample(fieldSchema.examples), |
| 816 | standardizeExample(fieldSchema.example), |
| 817 | this.callback === 'true' || this.webhook === 'true' ? true : false, // eslint-disable-line no-unneeded-ternary |
| 818 | this.callback === 'true' || this.webhook === 'true' ? false : true, // eslint-disable-line no-unneeded-ternary |
| 819 | 'text', |
| 820 | false, |
| 821 | ); |
| 822 | |
| 823 | return html` |
| 824 | <div part="tab-panel" class="tab-panel row" style="min-height:220px; border-left: 6px solid var(--light-border-color); align-items: stretch;"> |
| 825 | <div style="width:24px; background-color:var(--light-border-color)"> |
| 826 | <div class="row" style="flex-direction:row-reverse; width:160px; height:24px; transform:rotate(270deg) translateX(-160px); transform-origin:top left; display:block;" @click="${(e) => { |
| 827 | if (e.target.classList.contains('v-tab-btn')) { |
| 828 | const { tab } = e.target.dataset; |
| 829 | if (tab) { |
| 830 | const tabPanelEl = e.target.closest('.tab-panel'); |
| 831 | const selectedTabBtnEl = tabPanelEl.querySelector(`.v-tab-btn[data-tab="${tab}"]`); |
| 832 | const otherTabBtnEl = [...tabPanelEl.querySelectorAll(`.v-tab-btn:not([data-tab="${tab}"])`)]; |
| 833 | const selectedTabContentEl = tabPanelEl.querySelector(`.tab-content[data-tab="${tab}"]`); |
| 834 | const otherTabContentEl = [...tabPanelEl.querySelectorAll(`.tab-content:not([data-tab="${tab}"])`)]; |
| 835 | selectedTabBtnEl.classList.add('active'); |
| 836 | selectedTabContentEl.style.display = 'block'; |
| 837 | otherTabBtnEl.forEach((el) => { el.classList.remove('active'); }); |
| 838 | otherTabContentEl.forEach((el) => { el.style.display = 'none'; }); |
| 839 | } |
| 840 | } |
| 841 | if (e.target.tagName.toLowerCase() === 'button') { this.activeSchemaTab = e.target.dataset.tab; } |
| 842 | }}"> |
| 843 | <button class="v-tab-btn ${this.activeSchemaTab === 'example' ? 'active' : ''}" data-tab = 'example'>EXAMPLE</button> |
| 844 | <button class="v-tab-btn ${this.activeSchemaTab !== 'example' ? 'active' : ''}" data-tab = 'schema'>SCHEMA</button> |
| 845 | </div> |
| 846 | </div> |
| 847 | ${html` |
| 848 | <div class="tab-content col" data-tab = 'example' style="display:${this.activeSchemaTab === 'example' ? 'block' : 'none'}; padding-left:5px; width:100%"> |
| 849 | <textarea |
| 850 | class = "textarea" |
| 851 | part = "textarea textarea-param" |
| 852 | style = "width:100%; border:none; resize:vertical;" |
| 853 | data-array = "false" |
| 854 | data-ptype = "${mimeType.includes('form-urlencode') ? 'form-urlencode' : 'form-data'}" |
| 855 | data-pname = "${fieldName}" |
| 856 | data-example = "${formdataPartExample[0]?.exampleValue || ''}" |
| 857 | .textContent = "${this.fillRequestFieldsWithExample === 'true' ? formdataPartExample[0].exampleValue : ''}" |
| 858 | spellcheck = "false" |
| 859 | ></textarea> |
| 860 | </div>` |
| 861 | } |
| 862 | ${html` |
| 863 | <div class="tab-content col" data-tab = 'schema' style="display:${this.activeSchemaTab !== 'example' ? 'block' : 'none'}; padding-left:5px; width:100%;"> |
| 864 | <schema-tree |
| 865 | .data = "${formdataPartSchema}" |
| 866 | schema-expand-level = "${this.schemaExpandLevel}" |
nothing calls this directly
no test coverage detected