Code Monkey home page Code Monkey logo

antd-mask-input's People

Contributors

antoniopresto avatar baael avatar dependabot[bot] avatar palindrom615 avatar rolimans avatar shahzaibmalik55 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

antd-mask-input's Issues

Date mask value breaks when deleting characters not in the end

  • I'm submitting a ...
    [*] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    It should be possible to edit only days or months without breaking the whole date

  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

imask has right behavior
Peek 2022-10-20 16-54

https://codesandbox.io/s/ecstatic-joliot-klo9pw?file=/src/App.js

How to make a currency mask

  • I'm submitting a ...
    [    ] bug report
    [    ] feature request
    [    ] question about the decisions made in the repository
    [ x ] question about how to use this project

  • Summary
    I'm trying to make a simple number mask to currency values.

<Space direction="vertical">
  <label>Entrada</label>
    <MaskedInput
      autoComplete="off"
      placeholder = "Entrada"
      mask={
        React.useMemo<MaskType>(() => [
          {
            mask: 'R$ num',
            lazy: true,
            blocks: {
              num: {
                mask: Number,
                thousandsSeparator: '.',
                padFractionalZeros: true
              }
            }
          }
        ], [])
      }
    />
</Space>

Video_1666694324

But that way only one digit appears and throws this warning on the console. What am I doing wrong?

  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

I am following this documentation: https://imask.js.org/

image

Thanks!

First digit onPaste is removed when corresponds to first digit of mask

  • I'm submitting a ...
    [x] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary

First digit onPaste is removed when corresponds to first digit of mask

  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

When my mask is "+855 000 000 00[0]", copy pasting a number that starts with "8" will remove that digit from the paste.

Copy paste "87100378" into field

Expectation:
"+855 871 003 78"

Actual Outcome:
"+855 710 037 8"

Underscores are making len rule fail

  • I'm submitting a ...
    [x] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    The mask prop places an underscore on unfilled positions of the mask. When the field is empty, you see them as the field's placeholder, but once you start to type, they'll become actual characters typed in the field. Like this, Antd's len rule fails. If I want to set a required size to ensure all the characters of the field (a phone) is filled up, these underscores will count as characters.

<Form.Item label="Phone">
  {getFieldDecorator('phone', {
    rules: [
      { required: true, message: 'Phone is mandatory' },
      { len: 15, message: 'Phone must contain all digits' },
    ],
  })(
    <MaskedInput
      mask="(11) 11111-1111"
      id="phone"
      name="phone"
      value={phone}
      onChange={e => setPhone(e.target.value)}
    />
  )}
</Form.Item>

but

Screenshot_2020-01-11_09-45-54

In theory, it should display the len error message, but due to the underscores taking place, it cannot be done. Any ideas? Perhaps an option to disable the underscores?

Correct use with mapPropsToFields and getFieldDecorator?

  • I'm submitting a ...
    [ ] bug report
    [x] feature request
    [ ] question about the decisions made in the repository
    [x] question about how to use this project

  • Summary

Is is possible to use this component with Form.getFieldDecorator()? As a drop-in replacement to <Input />, the value is getting overwritten with the following warning in the console:

Warning: getFieldDecorator will override value, so please don't set value directly and use setFieldsValue to set it.

Equivalent blazor port

I'm using antd blazor and would like to use this to format phone numbers, ssn as the user types is there a port for this library?

bug report: You may need an appropriate loader to handle this file type

added antd-mask-input into my application
facing this issue:

Node: 8.x
Webpacker : 3

/projects/node_modules/import-glob/index.js!/node_modules/antd-mask-input/build/module/lib/MaskedInput.js Unexpected token (100:53)
You may need an appropriate loader to handle this file type.
|             let eventHandlers = this._getEventHandlers();
|             let { placeholder = this.mask.emptyValue } = this.props;
|             let { placeholderChar, formatCharacters, ...cleanedProps } = this.props;
|             const props = { ...cleanedProps, ...eventHandlers, maxLength, placeholder };
|             delete props.value;
    at eval (4405:1)
    at Object.<anonymous> (vendor-044a8ee2351fcff75855.min.js:46083)

Internal value of the input doesn't get refreshed when a new value is received in props

  • I'm submitting a ...
    [x] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    Hi, I am using version 2.0.5 of antd-mask-input. In other cases it seems to work fine but when the component (MaskedInput) receives a new - changed value in the 'value' prop (from one it had been instantiated with before) after user already typed something in the field, the new value doesn't get updated in the component. The old value the user typed keeps being displayed in the input field though a different value has been passed in props already. imask package also logs a warning in the console: Element value was changed outside of mask. Syncronize mask using mask.updateValue() to work properly.
    I don't see that imask.current from antd-mask-input would be made accessible from outside of the package. Hopefully this problem can get resolved and antd-mask-input can work without having to call mask.updateValue() from outside of the package.
    Having read this problem description, can you think of something that could be wrong there?

Error when deleting characters in MaskedInput with dynamic mask

  • I'm submitting a ...
    [X] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    I was trying to use the dynamic mask, and kept getting an error when trying to delete characters in the input:
    imask.js:3527
    Error: Cannot read properties of undefined (reading '9') imask.js:3527
    So I cloned the repo and run the storybook. And the error is still there.

  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

  1. Running the storybook, go to Dynamic Mask
  2. Enter numbers, and then go with the arrows to the left
  3. Delete a character
  4. Notice there is an error in the console
    It also happens with RGB, which is using an array of masks

Do you know why it happens? Thanks for reading!

Not able to install for antd>3.0.0

  • I'm submitting a ...
    [x] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary

  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

How to display the default value?

<Form.Item className='form_item' name='ssn' rules={[ { required: true, message: 'Please input your US social security number', whitespace: true, }, { message: 'Only numbers must be entered', pattern: new RegExp(/^\d{3}-\d{2}-\d{4}$/), } ]} > <MaskedInput mask="000-00-0000" /> </Form.Item>

I got the value of this form item from api. But after replacing the with , the value are not showed.
Thank you.

MaskedInput Component not working on internet explorer 11.

The component works properly on chrome but on ie11 it causes an error.

"Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."

I'm not able to install version v.2.0.6

  • I'm submitting a ...
    [X] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    Version 2.0.6 does not build files in the node_modules folder but 2.0.5 has built files in node_modules

v2.0.5
image

v2.0.6
image

component is not rendering

  • I'm submitting a ...
    [x] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary

r.state._Input.setState is not a function

image

  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)
    node 14.17.0
    react: 17.02
    "react-scripts": "4.0.3"

Catch pattern error

I get Uncaught Error whet pattern is not Ok.
For example for pattern "+7".
Error message: pattern "+7" does not contain any editable characters.

How to catch it? to prevent Uncaught Error?

Incorrect initial value for the given mask

  • I'm submitting a ...
    [*] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    Here I am trying to use mask for the IP address. Where in each part there could be max 3 digits.
    Usage: <MaskedInput mask="111.111.111.111" value="192.16.1.5" />
    Expectation: The input box should render value "192.16_.1__.5__"
    Actual Outcome: And here is what gets rendered "192.16_.1_5.___"

When value is "0.0.0.0" this is what I get "0_0.0_0.."

Antd v5 support (broken styling)

  • I'm submitting a ...
    [x] bug report
    [x] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary

It seems that this library is broken with antd v5, it does not use the theming correctly from the ConfigProvider.
image

It even starts to affect non <MakedInput /> components (these are supposed to be in dark mode:
image

Not working under React 15.x

I guess problem is when getting ref of input.

It's too hard to migrate project to react 16. Many other projects I think too.
Maybe it is possible to make MaskInput suitable for react 15? Please!

MaskedInput not highlighted in red when form validation failed

  • I'm submitting a ...
    [+] bug report

  • Summary
    I create MaskedInput with such mask:

const mask = useMemo( () => [ { mask: Number, scale: 2, thousandsSeparator: ' ', radix: '.', normalizeZeros: false, min: 0, max: 9999.99, }, ], [] );

And insert it in ant Form.Item with required prop.
When validation failed nothing happens with MaskedInput (borders not red, focus state not red etc).

I can provide status only manually, but I cant know about it (through props input status not provided).

antd version: 4.22.5
antd-mask-input version: 2.0.7

dynamic mask pattern and maxLength problem

  • I'm submitting a ...
    [x] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    First of all, thanks for the lib =)

Currently, the behavior of adding a maxLength prop to the field based on the mask length, breaks the possibility of having dynamic masks in the same input

Especially for Brazilian forms, we have some fields in which the length and mask might vary, and it makes it impossible to do something close to this, or like masking a common document input type that we use, which the length vary from 11 to 18 chars and the masks are completely different (999.999.99-99 and 99.999.999/9999-99)

  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

I think this is not the same as an optional character, but a completely different expected value and mask in the same field

We thought about the approach of using a select option so the user define the type of the document and we go from there, but this is actually a not expected behavior from a mask, so I'm calling it a bug, feel free to change it if you like ;)

Custom className prefix

  • I'm submitting a ...
    [ ] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [x] question about how to use this project

  • Summary

I have a custom prefixCls using the ConfigProvider component from antD, I have a way to overwrite the default class of the input ?

image

  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

Input props to lower case

  • I'm submitting a ...
    [ ] bug report
    [X] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary

image

There's any impact on using lowercase on the custom input props?

type error after compile

  • I'm submitting a ...

[x] bug report
[ ] feature request
[ ] question about the decisions made in the repository
[ ] question about how to use this project

  • Summary

this is _getEventHandlers method in MaskedInput.tsx:

// MaskedInput.tsx
// ...
  _keyPressPropName() {
    if (typeof navigator !== 'undefined') {
      return navigator.userAgent.match(/Android/i)
        ? 'onBeforeInput'
        : 'onKeyPress';
    }
    return 'onKeyPress';
  }

  _getEventHandlers() {
    return {
      onChange: this._onChange,
      onKeyDown: this._onKeyDown,
      onPaste: this._onPaste,
      [this._keyPressPropName()]: this._onKeyPress
    };
  }
// ...

...And the source is compiled as:

// compiled type signature file
// ...
    _keyPressPropName(): "onBeforeInput" | "onKeyPress";
    _getEventHandlers(): {
        [x: string]: (e: React.ChangeEvent<HTMLInputElement>) => void;
        onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
        onKeyDown: (e: any) => void;
        onPaste: (e: React.ClipboardEvent<any>) => void;
    };

Though _keyPressPropName is Union type, because of typescript issue that union type cannot be a key of object, _getEventHandlers is compiled with x key which is a string type.

This makes compile error Property 'onPaste' of type '(e: ClipboardEvent<any>) => void' is not assignable to string index type '(e: ChangeEvent<HTMLInputElement>) . this should be fixed by more explicit type declaration on method:

  _getEventHandlers(): {
    onChange: (TChangeEvent) => void;
    onKeyDown: (TChangeEvent) => void;
    onPaste: (TClipboardEvent) => void;
    onBeforeInput?: (TChangeEvent) => void;
    onKeyPress?: (TChangeEvent) => void;
  } {
    return {
      onChange: this._onChange,
      onKeyDown: this._onKeyDown,
      onPaste: this._onPaste,
      [this._keyPressPropName()]: this._onKeyPress
    };
  }

which is compiled liked this:

    _getEventHandlers(): {
        onChange: (TChangeEvent: any) => void;
        onKeyDown: (TChangeEvent: any) => void;
        onPaste: (TClipboardEvent: any) => void;
        onBeforeInput?: (TChangeEvent: any) => void;
        onKeyPress?: (TChangeEvent: any) => void;
    };
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

How to mask US phone numbers , keeping +1 as constant

  • I'm submitting a ...

[ ] question about how to use this project

  • Summary
    i want to keep input +1 by default
    mask used in input : mask="+\1 (111) 111-1111"
    error : Don't use octal: '\1'. Use '\u....' instead no-octal-escape
    if i escape wit \x1 it shows in input as +x1

  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

There is a bug using Uppercase letters on mask attribute

  • I'm submitting a ...
    [x] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

Summary
Good Result
image

Bad Result
image
Working only "aa" rule in mask attribute, because with "AA" set value "AA" and can't write something.

Before big "AA" worked successfully for Uppercase letters

Static characters not getting skipped on mobile

This is a bug report.

The static characters get skipped on a masked input field, on desktop, but not on the mobile browser.
For example, for the format 'DD-MM-YYYY', the masking pattern is '11-11-1111', and after entering 'DD', the cursor skips the '-' and automatically moves to the 'MM' part, on the desktop browser. But, on the mobile, the cursor doesn't skip the static '-', hence the input character is lost and confuses the user.

Failed to parse source map from /node_modules/antd-mask-input/src/lib/MaskedInput.tsx

  • I'm submitting a ...
    [* ] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary

WARNING in ./node_modules/antd-mask-input/build/module/lib/MaskedInput.js
Module Warning (from ./node_modules/react-scripts/node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/node_modules/antd-mask-input/src/lib/MaskedInput.tsx' file: Error: ENOENT: no such file or directory, open 'node_modules/antd-mask-input/src/lib/MaskedInput.tsx'

  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

Doesn't work for Mac address maskInput

  • I'm submitting a ...
    [X] bug report

  • Summary
    I want to create a simple mac address field with mask like this

                <MaskedInput type="text" mask="00:00:00:00:00:00" />

i can only fill the field with numbers no chars

WARNINGS after update react-scripts to v5

  • I'm submitting a ...
    [x] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    I'm getting some warns after update react-scipts from v4 to v5

  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

WARNING in ./node_modules/antd-mask-input/build/module/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\Workspace\harv-Harvest-frontend\node_modules\antd-mask-input\src\index.ts' file: Error: ENOENT: no such file or director
y, open 'C:\Workspace\harv-Harvest-frontend\node_modules\antd-mask-input\src\index.ts'
 @ ./src/components/CustomInput/customInput.js 5:0-42 350:37-48
 @ ./src/components/index.js 3:0-52 26:0-368
 @ ./src/NextApp.js 16:0-69 32:39-52 49:42-64
 @ ./src/index.js 5:0-32 16:7-14

WARNING in ./node_modules/antd-mask-input/build/module/lib/MaskedInput.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\Workspace\harv-Harvest-frontend\node_modules\antd-mask-input\src\lib\MaskedInput.tsx' file: Error: ENOENT: no such file 
or directory, open 'C:\Workspace\harv-Harvest-frontend\node_modules\antd-mask-input\src\lib\MaskedInput.tsx'
 @ ./node_modules/antd-mask-input/build/module/index.js 1:0-38 2:25-30 3:15-20
 @ ./src/components/CustomInput/customInput.js 5:0-42 350:37-48
 @ ./src/components/index.js 3:0-52 26:0-368
 @ ./src/NextApp.js 16:0-69 32:39-52 49:42-64
 @ ./src/index.js 5:0-32 16:7-14

WARNING in ./node_modules/antd-mask-input/build/module/lib/Pattern.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\Workspace\harv-Harvest-frontend\node_modules\antd-mask-input\src\lib\Pattern.ts' file: Error: ENOENT: no such file or di
rectory, open 'C:\Workspace\harv-Harvest-frontend\node_modules\antd-mask-input\src\lib\Pattern.ts'
 @ ./node_modules/antd-mask-input/build/module/lib/inputmask-core.js 5:0-36 54:25-32 393:20-27
 @ ./node_modules/antd-mask-input/build/module/lib/MaskedInput.js 11:0-41 217:27-36
 @ ./node_modules/antd-mask-input/build/module/index.js 1:0-38 2:25-30 3:15-20
 @ ./src/components/CustomInput/customInput.js 5:0-42 350:37-48
 @ ./src/components/index.js 3:0-52 26:0-368
 @ ./src/NextApp.js 16:0-69 32:39-52 49:42-64
 @ ./src/index.js 5:0-32 16:7-14

WARNING in ./node_modules/antd-mask-input/build/module/lib/helpers.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\Workspace\harv-Harvest-frontend\node_modules\antd-mask-input\src\lib\helpers.ts' file: Error: ENOENT: no such file or di
rectory, open 'C:\Workspace\harv-Harvest-frontend\node_modules\antd-mask-input\src\lib\helpers.ts'
 @ ./node_modules/antd-mask-input/build/module/lib/MaskedInput.js 12:0-71 63:10-16 77:17-23 240:34-46 245:6-18 304:38-50 309:38-50 315:36-48
 @ ./node_modules/antd-mask-input/build/module/index.js 1:0-38 2:25-30 3:15-20
 @ ./src/components/CustomInput/customInput.js 5:0-42 350:37-48
 @ ./src/components/index.js 3:0-52 26:0-368
 @ ./src/NextApp.js 16:0-69 32:39-52 49:42-64
 @ ./src/index.js 5:0-32 16:7-14

WARNING in ./node_modules/antd-mask-input/build/module/lib/inputmask-core.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\Workspace\harv-Harvest-frontend\node_modules\antd-mask-input\src\lib\inputmask-core.ts' file: Error: ENOENT: no such fil
e or directory, open 'C:\Workspace\harv-Harvest-frontend\node_modules\antd-mask-input\src\lib\inputmask-core.ts'
 @ ./node_modules/antd-mask-input/build/module/lib/MaskedInput.js 11:0-41 217:27-36
 @ ./node_modules/antd-mask-input/build/module/index.js 1:0-38 2:25-30 3:15-20
 @ ./src/components/CustomInput/customInput.js 5:0-42 350:37-48
 @ ./src/components/index.js 3:0-52 26:0-368
 @ ./src/NextApp.js 16:0-69 32:39-52 49:42-64
 @ ./src/index.js 5:0-32 16:7-14

Field blinks masked and then unmasked

  • I'm submitting a ...
    [X] bug report

  • Summary
    All the MaskedInput fields in a edit resource show it's values initially masked and then, less than a second later, turns into unmasked values. If I focus the field, it shows masked again and stays.
    This happens only after the second time I edit the record.

  • Other information

The code is as simple as this:

<Edit saveButtonProps={saveButtonProps}>
  <Form {...formProps}>
    <Form.Item
      label="Phone Number"
      name={["phoneNumber"]}
    >
      <MaskedInput mask="(00) 0 0000-0000" />
    </Form.Item>
 </Form>
</Edit>

I'm using @pankod/[email protected], @refinedev/[email protected], @refinedev/[email protected], [email protected], [email protected]

The Input returns incorrect value

  • I'm submitting a ...
    [ ] bug report
    [x] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    Actually:
    I set the mask "11111-111-1-1111-1111111"
    but I can get the value "1____-___-_-____-_______" if user inputs only one symbol "1"
    Expect:
    I expect that if I set a mask I will get a value that matches the mask and the change event to be generated only if the value matches the mask.

TypeError: this.state._Input.setState is not a function

  • I'm submitting a ...
    [x] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    When loading the <MaskedInput> component, the page instantly crashes and provides me the following information:

TypeError: this.state._Input.setState is not a function
    at MaskedInput.setInputValue (MaskedInput.tsx:288:23)
    at MaskedInput.componentDidMount (MaskedInput.tsx:55:10)
    at commitLifeCycles (react-dom.development.js:20663:24)
    at commitLayoutEffects (react-dom.development.js:23426:7)
    at HTMLUnknownElement.callCallback2 (react-dom.development.js:3945:14)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:16)
    at invokeGuardedCallback (react-dom.development.js:4056:31)
    at commitRootImpl (react-dom.development.js:23151:9)
    at unstable_runWithPriority (scheduler.development.js:468:12)
    at runWithPriority$1 (react-dom.development.js:11276:10)
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)
    I have been doing a lot of overdue infrastructure upgrades, I'm not certain which one broke this component. Some relevant ones might be:
  • [email protected] -> [email protected]
  • Upgraded to [email protected]
  • Upgraded to [email protected]

How to set mask to element or dynamic mask

  • I'm submitting a ...
    [ ] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [X] question about how to use this project

  • How to set mask to element or value

ex: el.SetMaskedInput("(11) 1111-1111"); or
when value before ? its a optional

Multiple Masks

  • I'm submitting a ...
    [x ] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

How to use with multiple masks? For example, I need to use the mask 000.000.000-00 and 00.000.000/0000-00, but when I have the value with first mask, is not possible to type more character, I type and nothing happened and the second mask is not applied.

Using dispatch not working too beacuse the same problem and I can't deal with the length of characters.

I would like that when it had the value 123.456.789-00 and I typed one more character, it would format with the second mask

image

Does not handle `readOnly` prop

  • I'm submitting a ...
    [x] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    Setting readOnly={true} should prevent changes to the field value, currently it is ignored.

How to mask IP Address

  • I'm submitting a ...
    [ ] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [*] question about how to use this project

  • Summary
    Can you share an example to mask the IP address. Like "111.111.111.111" where the each part could be at max a 3 digit number.

The onPast event does not work at all

  • I'm submitting a ...
    [ ] bug report
  • Summary

Hi, in my project I want to allow the user to enter in the field cell phone numbers that he copied and paste into the field but it is not possible at all, can anyone help me with this problem?

Thanks :)

Pass the maxLength prop to the wrapped input component

  • I'm submitting a ...
    [ ] bug report
    [x] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary

The maxLength prop should be passed to the wrapped <Input /> component if explicitly set. Currently it is being overridden with the length of the pattern string.

  • Other information

For example, a card CVV can be a 3 or 4 digit number. As they are usually only 3 digits it makes sense to show a pattern that matches this. However, the user should still be able to enter 4 digits.

<MaskedInput mask="111" maxLength={4} />

form.setFieldValue does not work

  • I'm submitting a ...
    [x] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    form.setFieldValue() does not trigger mask.updateValue(), which means value will be reset to the previously inputted by user as soon as rerender triggers. Warning
    Element value was changed outside of mask. Syncronize mask using mask.updateValue() to work properly. will be displayed in console, indicating that mask.updateValue is required.

  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

Consider following component. forceRerender is only for testing purposes to manually trigger component rerender.

import {Form} from "antd";
import {MaskedInput} from "antd-mask-input";
import {useState} from "react";

export function Dummy() {
  const [form] = Form.useForm()
  const [forceRerender, setForceRerender] = useState({})
  return (
    <div>
      <button onClick={() => {
        form.setFieldValue("test", "1234")
        /*
        None works:
        form.setFieldsValue({
          test: '1234'
        })
        form.setFields([{
          name: 'test',
          value: '1234'
        }])
         */
      }}>
        set
      </button>
      <button onClick={() => {
        setForceRerender({})
      }}>
        force rerender
      </button>
      <Form form={form}>
        <Form.Item
          name="test"
        >
          <MaskedInput
            mask={
              '00-00'
            }
          />
        </Form.Item>
      </Form>
    </div>
  )
}

Steps to reproduce:

  1. Type anything in input
  2. Press set button
  3. Press force rerender button

Expected outcome:
Input value is 1234 as that's what form contains

Actual outcome:
Input value is whatever user typed on step 1.

Package versions:
react: 17.0.2
antd: 4.23.5
antd-mask-input: 2.0.7

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.