Skip to content

Commit

Permalink
Merge pull request #45 from reside-ic/mrc-4011
Browse files Browse the repository at this point in the history
mrc-4011 Add step prop to number input
  • Loading branch information
EmmaLRussell authored Feb 27, 2023
2 parents 0c537c7 + 22b0f59 commit 4fc9021
Show file tree
Hide file tree
Showing 16 changed files with 1,298 additions and 94 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: test
on:
push:
branches:
- 'main'
pull_request: ~
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 12.x
- run: npm install -g codecov
- run: npm ci
- run: npm run-script build
- run: npm test
- run: codecov -f coverage/*.json
2 changes: 0 additions & 2 deletions .travis.yml

This file was deleted.

15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# vue-dynamic-form

[![Build Status](https://travis-ci.com/reside-ic/vue-dynamic-form.svg?branch=master)](https://travis-ci.com/reside-ic/vue-dynamic-form)
![Build Status](https://github.com/reside-ic/vue-dynamic-form/actions/workflows/test.yml/badge.svg?branch=mrc-4011)

Vue component for generating a form dynamically from metadata.

Expand Down Expand Up @@ -137,6 +137,15 @@ const myFormMeta = {
required: true,
transform: "$/100"
}]
},
{
label: "Decimal parameter",
controls: [{
name: "dec_param",
type: "number",
required: true,
step: 0.1
}]
}
]
}
Expand All @@ -146,6 +155,10 @@ const myFormMeta = {
</script>
```
Note that the `step` value on number controls may be any valid value for HTML `input` elements of type `number`. However,
in read-only mode the form displays numbers according to the default local `Intl.NumberFormat`, typically to three decimal places
so will round any values with greater precision.
On user submission the form emits a `submit` event with a payload that contains the form data as JSON. In this example,
the payload would be of the form:
```
Expand Down
2 changes: 1 addition & 1 deletion dist/js/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/vue-dynamic-form.min.js

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ <h2 class="mt-4">Read-only form</h2>
type: "number",
required: true
}]
},
{
label: "Decimal parameter",
controls: [{
name: "dec_param",
type: "number",
required: true,
step: 0.1
}]
}
]
}
Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = {
},
"coverageDirectory": "./coverage/",
"collectCoverage": true,
"coverageProvider": "v8",
"coveragePathIgnorePatterns": [
"/node_modules/"
]
Expand Down
Loading

0 comments on commit 4fc9021

Please sign in to comment.