-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Modify reset value * Add date input * Move rf-input logic to mixin
- Loading branch information
1 parent
a2c88d2
commit 498a44c
Showing
10 changed files
with
120 additions
and
58 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
import './rf-input-helpers' | ||
import './rf-base-input' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import riot from 'riot' | ||
import config from '../config' | ||
|
||
riot.mixin('rf-base-input', { | ||
init: function () { | ||
let tag = null | ||
let currentValue = null | ||
|
||
const makeData = () => { | ||
return { model: this.opts.model, formName: this.opts.formName } | ||
} | ||
|
||
this.on('mount', () => { | ||
const input = this.root.querySelector('[rf-input-elem]') | ||
if (!input) { | ||
throw new Error('element with attribute rf-input-elem not found in rf-input html') | ||
} | ||
tag = riot.mount(input, this.opts.model.tag, makeData())[0] | ||
}) | ||
|
||
this.on('update', () => { | ||
if (tag && this.opts.model.value !== currentValue) { | ||
currentValue = this.opts.model.value | ||
tag.update(makeData()) | ||
} | ||
}) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ describe('inputs', () => { | |
'tel', | ||
'number', | ||
'url', | ||
'date', | ||
'textarea' | ||
] | ||
|
||
|