Skip to content

Commit

Permalink
up docs, fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
uNmAnNeR committed Dec 25, 2023
1 parent 7387353 commit b7dcc5c
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 19 deletions.
32 changes: 15 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (7.0.7.2)
activesupport (6.1.7.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
addressable (2.8.4)
zeitwerk (~> 2.3)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
base64 (0.2.0)
coffee-script (2.4.1)
coffee-script-source
execjs
Expand All @@ -23,14 +25,13 @@ GEM
ethon (0.16.0)
ffi (>= 1.15.0)
eventmachine (1.2.7)
eventmachine (1.2.7-x64-mingw32)
execjs (2.8.1)
faraday (2.7.10)
execjs (2.9.1)
faraday (2.8.1)
base64
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.2)
ffi (1.15.5)
ffi (1.15.5-x64-mingw32)
ffi (1.16.3)
forwardable-extended (2.6.0)
gemoji (3.0.1)
github-pages (228)
Expand Down Expand Up @@ -207,28 +208,26 @@ GEM
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.3.6)
mini_portile2 (2.8.2)
mini_portile2 (2.8.5)
minima (2.5.1)
jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
minitest (5.19.0)
minitest (5.20.0)
nokogiri (1.13.10)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
nokogiri (1.13.10-x64-mingw32)
racc (~> 1.4)
octokit (4.25.1)
faraday (>= 1, < 3)
sawyer (~> 0.9)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (4.0.7)
racc (1.7.1)
racc (1.7.3)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.5)
rexml (3.2.6)
rouge (3.26.0)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
Expand All @@ -245,19 +244,18 @@ GEM
unf (~> 0.1.4)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
typhoeus (1.4.0)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
unf_ext (0.0.8.2-x64-mingw32)
unf_ext (0.0.9.1)
unicode-display_width (1.8.0)
zeitwerk (2.6.12)

PLATFORMS
ruby
x64-mingw32

DEPENDENCIES
github-pages
Expand Down
62 changes: 61 additions & 1 deletion docs/guide.html
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,41 @@ <h4 id="autofix" class="section-h"><a href="#autofix">Autofix Mode</a></h4>
</div>
</div>

<h4 id="repeat" class="section-h"><a href="#repeat">Repeat block (since 7.3.0)</a></h4>
<div class="form-item">
<label>Repeat pattern block:</label>
<div class="input-select">
<input id="repeat-mask" type="text" value="">
<select id="select-repeat">
<option value="Infinity">Repeat: Infinity</option>
<option value="3">Repeat: 3</option>
<option value="[2, 4]">Repeat: [2, 4]</option>
</select>
</div>

<div class="toggle-panel">
<label for="repeat-mask-source">source</label>
<input id="repeat-mask-source" type="checkbox">
<div class="toggle-panel-content">
{% highlight javascript %}
IMask(
document.getElementById('repeat-mask'),
{
mask: 'r',
lazy: false,
blocks: {
r: {
repeat: <SELECT>,
mask: '0',
}
},
}
)
{% endhighlight %}
</div>
</div>
</div>


<h3 id="masked-enum" class="section-h"><a href="#enum">Enum Mask</a></h3>
<p>Enum mask extends <a href="#masked-pattern">Pattern</a> mask and can be used to restrict input within characters enum.</p>
Expand Down Expand Up @@ -1547,7 +1582,6 @@ <h3 id="treeshaking" class="section-h"><a href="#treeshaking">Treeshaking <kbd>s
autofix: false
}
);

var selectAutofix = document.getElementById('select-autofix');
selectAutofix.addEventListener('change', function (e) {
var val = e.target.value;
Expand All @@ -1558,6 +1592,32 @@ <h3 id="treeshaking" class="section-h"><a href="#treeshaking">Treeshaking <kbd>s
});
});

var repeatMask = IMask(
document.getElementById('repeat-mask'),
{
mask: 'r',
lazy: false,
blocks: {
r: {
repeat: Infinity,
mask: '0',
}
},
}
);
var selectRepeat = document.getElementById('select-repeat');
selectRepeat.addEventListener('change', function (e) {
var val = e.target.value;
repeatMask.updateOptions({
blocks: {
r: {
autofix: eval(val),
mask: '0',
}
},
});
});

var lazyMask = IMask(
document.getElementById('pattern-lazy-mask'),
{
Expand Down
2 changes: 1 addition & 1 deletion packages/imask/src/controls/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class InputMask<Opts extends FactoryArg=Record<string, unknown>> {

/** Updates options with deep equal check, recreates {@link Masked} model if mask type changes */
updateOptions(opts: UpdateOpts<Opts>) {
const { mask, ...restOpts } = opts;
const { mask, ...restOpts } = opts as any; // TODO types, yes, mask is optional

const updateMask = !this.maskEquals(mask);
const updateOpts = this.masked.optionsIsChanged(restOpts);
Expand Down

0 comments on commit b7dcc5c

Please sign in to comment.