This package has been deprecated

Author message:

This element is deprecated. Use @advanced-rest-client/body-editor instead.

@advanced-rest-client/files-payload-editor

3.1.0 • Public • Published

Published on NPM

Build Status

Published on webcomponents.org

files-payload-editor

<files-payload-editor> A request body editor to add files as a payload. With this element the user can select single file that will be used in the request body.

The element can be used in forms when iron-form is used. It contains validation methods to validate user input.

Usage

Installation

npm install --save @advanced-rest-client/files-payload-editor

In an html file

<html>
  <head>
    <script type="module">
      import '@advanced-rest-client/files-payload-editor/files-payload-editor.js';
    </script>
  </head>
  <body>
    <files-payload-editor></files-payload-editor>
    <script>
    {
      document.querySelector('files-payload-editor').onchange = (e) => {
        console.log(e.target.value); // or e.detail.value
      };
    }
    </script>
  </body>
</html>

In a LitElement template

import { LitElement, html } from 'lit-element';
import '@advanced-rest-client/files-payload-editor/files-payload-editor.js';

class SampleElement extends LitElement {
  render() {
    return html`
    <files-payload-editor @value-changed="${this._fileChanged}"></files-payload-editor>
    `;
  }

  _fileChanged(e) {
    this.body = e.detail.value;
  }
}
customElements.define('sample-element', SampleElement);

Development

git clone https://github.com/advanced-rest-client/files-payload-editor
cd files-payload-editor
npm install

Running the demo locally

npm start

Running the tests

npm test

Package Sidebar

Install

npm i @advanced-rest-client/files-payload-editor

Weekly Downloads

720

Version

3.1.0

License

Apache-2.0

Unpacked Size

56.8 kB

Total Files

9

Last publish

Collaborators

  • carowright
  • jarrodek
  • twoplustwoone
  • lbauret