Fix cleave.js (Cleave is a class, not a function) (#23046)

* Fix cleave.js (Cleave is a class, not a function)

See examples at https://github.com/nosir/cleave.js

* Add whitespace
This commit is contained in:
Rudolph Gottesheim 2018-01-19 19:12:29 +01:00 committed by Wesley Wigham
parent 5e86d4b159
commit 09bc77ae3d
2 changed files with 20 additions and 2 deletions

View File

@ -3,7 +3,12 @@ import Cleave = require("cleave.js");
import CleaveReact = require("cleave.js/react");
const Example1 = () => {
Cleave("#my-input", { phone: true });
const cleave = new Cleave("#my-input", { phone: true });
cleave.setPhoneRegionCode("AT");
cleave.setRawValue("foo");
const foo: string = cleave.getFormattedValue();
const bar: string = cleave.getRawValue();
cleave.destroy();
};
const ExampleReact1 = (props: any) => {

View File

@ -6,5 +6,18 @@
import { CleaveOptions } from './options';
declare function Cleave(selector: string, options: CleaveOptions): void;
declare class Cleave {
constructor(selector: string, options: CleaveOptions);
getRawValue(): string;
setRawValue(value: string): void;
getFormattedValue(): string;
destroy(): void;
setPhoneRegionCode(regionCode: string): void;
}
export = Cleave;