Giter VIP home page Giter VIP logo

aurelia-inputmask's People

Contributors

airboss001 avatar dependabot[bot] avatar maximbalaganskiy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

airboss001

aurelia-inputmask's Issues

Multiple masks on same form only first works.

Found another issue.
When I have multiple masks on an dialog I am masking it appears that only the first one is being initialized and used correctly.

If I remove the other inputs and test them one by one they work correctly so seems there is something being used statically/globally in the attribute versus per input instance.

Looking to see if I can figure it out.

Options being set permanently on the optionsStore level

The optionsStore which holds global options is being populated with options passed in through the custom attribute binding. It seems to be because the inputmask library extends both the mask and the options into a singular object, which then traverses all the way back upward and into the optionsStore.

You can reproduce it with the following (this example using the materialize bridge, but can be done with a normal input too):

<md-input type="tel" placeholder="____" inputmask="mask: [9999]; value.bind:PhoneExtension; options.bind: { jitMasking: false }"></md-input>

This ends up creating a singular object that looks something like

{
  alias: '[9999]',
  jitMasking: false
}

...which will permanently set that alias and jitMasking for all subsequent inputmasks.

I have a solution for the problem and I can submit a PR if needed. Simply, create a copy of the options passed in to the Inputmask constructor and it will break the reference back to optionsStore.

IE11 DispatchEvent issue

There is a compatibility issue with IE11 when the change event is fired. It causes a "Object doesn't support this action" exception.

See: https://stackoverflow.com/questions/27176983/dispatchevent-not-working-in-ie11

File: inputmask.attribute.ts

Current code:

this.input.dispatchEvent(new Event("change"));

Suggested Fix:

// ie compatibility
var event;
if (typeof(Event) === 'function') {
     event = new Event("change");
}
else {
     event = document.createEvent('Event');
     event.initEvent('change', true, true);
}
// end ie compatibility

this.input.dispatchEvent(event);

The change appears to resolve the issue in my case. I'm not sure if the parameters for bubble and cancelable match the project paradigm or not.

Unhandled rejection TypeError: Cannot read property 'nodeName' of null

Getting the noted error in inputmask-attribute on the line indicated by -->
Is it expecting an additional element?

valueChanged() {
		if (!this.input) {
			return;
		}
		if (this.ignoreChange) {
			this.ignoreChange = false;
			return;
		}
		if (this.input.value !== this.value) {
			this.input.value = this.value;
		}
		const label = this.input.nextElementSibling as HTMLLabelElement;
-->		if (label.nodeName === "LABEL") {
			label.classList.add(this.value ? "active" : "inactive");
		}
	}

Here is an example of how I am using it:

<div class="textareasize">
          <input inputmode="numeric" pattern="^[0-9]*$" class="smalltextinput" value.bind="radial"
            inputmask data-inputmask-regex="^\d{3,3}$"> [ex: 030, 281]
</div>

inputmask_1.default is not a constructor

Hi, thank you for your work!
I am trying to use this plugin but I am getting an error on console.
All I did was install it using npm according to the docs, configure the plugin on my main.ts and use it on an input like this:

<input type="text" class="form-control" value.bind="myValue" inputmask="999.999.999-99" />

The error is:

Uncaught TypeError: inputmask_1.default is not a constructor
    at InputmaskCustomAttribute.createInstance (inputmask-attribute.ts:70)
    at InputmaskCustomAttribute.attached (inputmask-attribute.ts:62)
    at Controller.attached (aurelia-templating.js:3799)
    at View.attached (aurelia-templating.js:1812)
    at ViewSlot.attached (aurelia-templating.js:2170)
    at View.attached (aurelia-templating.js:1817)
    at ViewSlot.attached (aurelia-templating.js:2170)
    at View.attached (aurelia-templating.js:1817)
    at ViewSlot.attached (aurelia-templating.js:2170)
    at View.attached (aurelia-templating.js:1817)
    at ViewSlot.add (aurelia-templating.js:1975)
    at If._show (if-core.js:66)
    at If._update (if.js:104)
    at If.conditionChanged (if.js:90)
    at BehaviorPropertyObserver.selfSubscriber (aurelia-templating.js:4009)
    at BehaviorPropertyObserver.call (aurelia-templating.js:3870)

Did I miss something?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.