9.0.11 • Published 12 days ago

@exmg/exmg-form-drawer v9.0.11

Weekly downloads
83
License
MIT
Repository
github
Last release
12 days ago

<exmg-form-drawer> Published on npm

This package provides dialog drawer functionality.

Components included:

  1. exmg-drawer - basic component
  2. exmg-form-drawer - form drawer

Install

npm install @exmg/exmg-form-drawer

Before start ensure that you have installed web-animation-js. It is required by @polymer/paper-dialog.

npm install web-animation-js

Load this script in index.html

<!-- Ensure Web Animations polyfill is loaded -->
<script src="../node_modules/web-animations-js/web-animations-next-lite.min.js"></script>

Some dependencies @exmg/exmg-paper-combobox use @apply to apply css mixins. This require to load script in index.html

<script src="../node_modules/@webcomponents/shadycss/apply-shim.min.js"></script>

Components

\

It is basic component that probably should not be used directly. It serves only as drawer without form functionality, so it is content agnostic. You can pass any dom markup as children of this component.

\

Wraps around exmg-drawer.

Provides form functionality to drawer:

  • submit and cancel buttons
  • title
  • material styling

API

Slots

NameDescription
defaultForm elements within drawer

Properties/Attributes

NameTypeDefaultDescription
openedbooleanNonewhether or not drawer is visible
no-cancel-on-outside-clickbooleanNonewhether or not clicking outside drawer should close drawer
submit-btn-titlestringNonetitle of submit button. Default "Submit"
cancel-btn-titlestringNonetitle of cancel button. Default "Cancel"
keep-opened-on-submit-successbooleanNonewhether or not drawer should be hidden after successful form submission
reset-form-on-submit-successbooleanNonewhether or not drawer form should be reset after successful form submission

Events

NameDescription
exmg-drawer-opened-changedwhen drawer shown/hidden

CSS Custom Properties

NameDescription
--exmg-drawer-colorset the height of slot container - handy when wanting to control max-height of form.
--exmg-drawer-bg-colorset the padding right for the form internal element.
--mdc-theme-primaryNone
--mdc-theme-on-surfaceNone
--mdc-theme-surfaceNone
--exmg-form-drawer-header-separator-colorColor of header seperator of form
--exmg-drawer-max-widthMax width of drawer

Notes about drawer form

All dom markup passed as children into exmg-form-drawer will be wrapped into exmg-form underhood.

To properly handle form submission, you should call done() or error() on form instance after receiving submit event from exmg-form-drawer. Please read https://github.com/ExmgElements/exmg-form docs for more info.

Usage

Form drawer

<exmg-form-drawer
  ?opened="${this.opened}"
  ?keep-opened-on-submit-success="${this.keepOpenedOnSubmitSuccess}"
  ?reset-form-on-submit-success="${this.resetFormOnSubmitSuccess}"
  ?no-cancel-on-outside-click="${this.noCancelOnOutsideClick}"
  @exmg-drawer-opened-changed="${this.handleOpenedChanged}"
  submit-btn-title="Create"
  @submit="${this.onSubmit}"
  @cancel="${this.onCancel}"
>
  <span slot="title">New event</span>
  <exmg-paper-combobox label="Type" name="type" selected="0" always-float-label>
    <paper-item>Trivia</paper-item>
    <paper-item>Other</paper-item>
  </exmg-paper-combobox>
  <paper-input name="question" label="Question" value="Who's Dylan Hartigan's favorite artist?" required></paper-input>
  <paper-input name="answer_a" label="Answer A" value="Beyoncé"></paper-input>
  <paper-input name="answer_b" label="Answer B" value="Eminem"></paper-input>
  <paper-input name="answer_c" label="Answer C" value="Ariana Grande"></paper-input>
  <br />
  <exmg-button unelevated> + Add answer </exmg-button>
</exmg-form-drawer>

Additional references

9.0.11

12 days ago

9.0.10

12 days ago

9.0.9

24 days ago

9.0.8

1 month ago

9.0.7

1 month ago

9.0.6

2 months ago

9.0.5

2 months ago

9.0.4

2 months ago

9.0.3

2 months ago

9.0.1

3 months ago

8.1.40

5 months ago

8.1.37

7 months ago

8.1.36

10 months ago

8.1.39

6 months ago

8.1.38

7 months ago

8.1.31

11 months ago

8.1.33

11 months ago

8.1.32

11 months ago

8.1.35

11 months ago

8.1.29

2 years ago

8.1.28

2 years ago

8.1.20

2 years ago

8.1.22

2 years ago

8.1.24

2 years ago

8.1.23

2 years ago

8.1.25

2 years ago

8.1.27

2 years ago

8.1.17

2 years ago

8.1.0

3 years ago

8.0.1

3 years ago

8.0.3

3 years ago

8.0.2

3 years ago

8.0.0

3 years ago

3.0.4

3 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

4 years ago

2.1.14

4 years ago

2.1.13

4 years ago

2.1.12

4 years ago

2.1.11

4 years ago

2.1.10

4 years ago

2.1.9

4 years ago

2.1.8

4 years ago

2.1.7

4 years ago

2.1.6

4 years ago

2.1.4

4 years ago

2.1.5

4 years ago

2.1.2

4 years ago

2.1.3

4 years ago

2.1.1

4 years ago

2.1.0

5 years ago

2.0.6

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago