Skip to content

Commit b7dcc5c

Browse files
committed
up docs, fix tests
1 parent 7387353 commit b7dcc5c

File tree

3 files changed

+77
-19
lines changed

3 files changed

+77
-19
lines changed

Gemfile.lock

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
activesupport (7.0.7.2)
4+
activesupport (6.1.7.6)
55
concurrent-ruby (~> 1.0, >= 1.0.2)
66
i18n (>= 1.6, < 2)
77
minitest (>= 5.1)
88
tzinfo (~> 2.0)
9-
addressable (2.8.4)
9+
zeitwerk (~> 2.3)
10+
addressable (2.8.6)
1011
public_suffix (>= 2.0.2, < 6.0)
12+
base64 (0.2.0)
1113
coffee-script (2.4.1)
1214
coffee-script-source
1315
execjs
@@ -23,14 +25,13 @@ GEM
2325
ethon (0.16.0)
2426
ffi (>= 1.15.0)
2527
eventmachine (1.2.7)
26-
eventmachine (1.2.7-x64-mingw32)
27-
execjs (2.8.1)
28-
faraday (2.7.10)
28+
execjs (2.9.1)
29+
faraday (2.8.1)
30+
base64
2931
faraday-net_http (>= 2.0, < 3.1)
3032
ruby2_keywords (>= 0.0.4)
3133
faraday-net_http (3.0.2)
32-
ffi (1.15.5)
33-
ffi (1.15.5-x64-mingw32)
34+
ffi (1.16.3)
3435
forwardable-extended (2.6.0)
3536
gemoji (3.0.1)
3637
github-pages (228)
@@ -207,28 +208,26 @@ GEM
207208
rb-fsevent (~> 0.10, >= 0.10.3)
208209
rb-inotify (~> 0.9, >= 0.9.10)
209210
mercenary (0.3.6)
210-
mini_portile2 (2.8.2)
211+
mini_portile2 (2.8.5)
211212
minima (2.5.1)
212213
jekyll (>= 3.5, < 5.0)
213214
jekyll-feed (~> 0.9)
214215
jekyll-seo-tag (~> 2.1)
215-
minitest (5.19.0)
216+
minitest (5.20.0)
216217
nokogiri (1.13.10)
217218
mini_portile2 (~> 2.8.0)
218219
racc (~> 1.4)
219-
nokogiri (1.13.10-x64-mingw32)
220-
racc (~> 1.4)
221220
octokit (4.25.1)
222221
faraday (>= 1, < 3)
223222
sawyer (~> 0.9)
224223
pathutil (0.16.2)
225224
forwardable-extended (~> 2.6)
226225
public_suffix (4.0.7)
227-
racc (1.7.1)
226+
racc (1.7.3)
228227
rb-fsevent (0.11.2)
229228
rb-inotify (0.10.1)
230229
ffi (~> 1.0)
231-
rexml (3.2.5)
230+
rexml (3.2.6)
232231
rouge (3.26.0)
233232
ruby2_keywords (0.0.5)
234233
rubyzip (2.3.2)
@@ -245,19 +244,18 @@ GEM
245244
unf (~> 0.1.4)
246245
terminal-table (1.8.0)
247246
unicode-display_width (~> 1.1, >= 1.1.1)
248-
typhoeus (1.4.0)
247+
typhoeus (1.4.1)
249248
ethon (>= 0.9.0)
250249
tzinfo (2.0.6)
251250
concurrent-ruby (~> 1.0)
252251
unf (0.1.4)
253252
unf_ext
254-
unf_ext (0.0.8.2)
255-
unf_ext (0.0.8.2-x64-mingw32)
253+
unf_ext (0.0.9.1)
256254
unicode-display_width (1.8.0)
255+
zeitwerk (2.6.12)
257256

258257
PLATFORMS
259258
ruby
260-
x64-mingw32
261259

262260
DEPENDENCIES
263261
github-pages

docs/guide.html

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,41 @@ <h4 id="autofix" class="section-h"><a href="#autofix">Autofix Mode</a></h4>
781781
</div>
782782
</div>
783783

784+
<h4 id="repeat" class="section-h"><a href="#repeat">Repeat block (since 7.3.0)</a></h4>
785+
<div class="form-item">
786+
<label>Repeat pattern block:</label>
787+
<div class="input-select">
788+
<input id="repeat-mask" type="text" value="">
789+
<select id="select-repeat">
790+
<option value="Infinity">Repeat: Infinity</option>
791+
<option value="3">Repeat: 3</option>
792+
<option value="[2, 4]">Repeat: [2, 4]</option>
793+
</select>
794+
</div>
795+
796+
<div class="toggle-panel">
797+
<label for="repeat-mask-source">source</label>
798+
<input id="repeat-mask-source" type="checkbox">
799+
<div class="toggle-panel-content">
800+
{% highlight javascript %}
801+
IMask(
802+
document.getElementById('repeat-mask'),
803+
{
804+
mask: 'r',
805+
lazy: false,
806+
blocks: {
807+
r: {
808+
repeat: <SELECT>,
809+
mask: '0',
810+
}
811+
},
812+
}
813+
)
814+
{% endhighlight %}
815+
</div>
816+
</div>
817+
</div>
818+
784819

785820
<h3 id="masked-enum" class="section-h"><a href="#enum">Enum Mask</a></h3>
786821
<p>Enum mask extends <a href="#masked-pattern">Pattern</a> mask and can be used to restrict input within characters enum.</p>
@@ -1547,7 +1582,6 @@ <h3 id="treeshaking" class="section-h"><a href="#treeshaking">Treeshaking <kbd>s
15471582
autofix: false
15481583
}
15491584
);
1550-
15511585
var selectAutofix = document.getElementById('select-autofix');
15521586
selectAutofix.addEventListener('change', function (e) {
15531587
var val = e.target.value;
@@ -1558,6 +1592,32 @@ <h3 id="treeshaking" class="section-h"><a href="#treeshaking">Treeshaking <kbd>s
15581592
});
15591593
});
15601594

1595+
var repeatMask = IMask(
1596+
document.getElementById('repeat-mask'),
1597+
{
1598+
mask: 'r',
1599+
lazy: false,
1600+
blocks: {
1601+
r: {
1602+
repeat: Infinity,
1603+
mask: '0',
1604+
}
1605+
},
1606+
}
1607+
);
1608+
var selectRepeat = document.getElementById('select-repeat');
1609+
selectRepeat.addEventListener('change', function (e) {
1610+
var val = e.target.value;
1611+
repeatMask.updateOptions({
1612+
blocks: {
1613+
r: {
1614+
autofix: eval(val),
1615+
mask: '0',
1616+
}
1617+
},
1618+
});
1619+
});
1620+
15611621
var lazyMask = IMask(
15621622
document.getElementById('pattern-lazy-mask'),
15631623
{

packages/imask/src/controls/input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ class InputMask<Opts extends FactoryArg=Record<string, unknown>> {
242242

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

247247
const updateMask = !this.maskEquals(mask);
248248
const updateOpts = this.masked.optionsIsChanged(restOpts);

0 commit comments

Comments
 (0)