Skip to content

Commit aa5fc31

Browse files
author
Edward Xiao
committed
- Enable autoComplete.
1 parent f47689e commit aa5fc31

File tree

7 files changed

+20
-9
lines changed

7 files changed

+20
-9
lines changed

lib/components/Textbox.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ var TYPE = 'textbox';
8282
var VALIDATE_OPTION_TYPE_LIST = ['string', 'number'];
8383
var DEFAULT_MAX_LENGTH = 524288; // Default value is 524288
8484

85+
var DEFAULT_AUTO_COMPLETE = 'on'; // Default value is on
86+
8587
var getDefaultValidationOption = function getDefaultValidationOption(obj) {
8688
var reg = obj.reg,
8789
min = obj.min,
@@ -461,6 +463,7 @@ function (_React$Component) {
461463
value = _ref4.value,
462464
disabled = _ref4.disabled,
463465
maxLength = _ref4.maxLength,
466+
autoComplete = _ref4.autoComplete,
464467
placeholder = _ref4.placeholder,
465468
classNameWrapper = _ref4.classNameWrapper,
466469
classNameContainer = _ref4.classNameContainer,
@@ -508,6 +511,7 @@ function (_React$Component) {
508511
type: type,
509512
value: value,
510513
disabled: disabled,
514+
autoComplete: autoComplete,
511515
maxLength: Number(maxLength),
512516
onBlur: this.onBlur,
513517
onKeyUp: this.onKeyUp,
@@ -543,6 +547,7 @@ _defineProperty(Index, "defaultProps", {
543547
value: '',
544548
disabled: false,
545549
validate: false,
550+
autoComplete: DEFAULT_AUTO_COMPLETE,
546551
maxLength: DEFAULT_MAX_LENGTH,
547552
placeholder: '',
548553
classNameInput: '',

lib/react-inputs-validation.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/react-inputs-validation.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/react-inputs-validation.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/react-inputs-validation.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-inputs-validation",
3-
"version": "2.1.3",
3+
"version": "2.1.4",
44
"description": "a react inputs validation component",
55
"main": "index.js",
66
"repository": {

src/js/Inputs/Textbox.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import reactInputsValidationCss from './react-inputs-validation.css';
77
const TYPE = 'textbox';
88
const VALIDATE_OPTION_TYPE_LIST = ['string', 'number'];
99
const DEFAULT_MAX_LENGTH = 524288; // Default value is 524288
10+
const DEFAULT_AUTO_COMPLETE = 'on'; // Default value is on
1011
interface DefaultValidationOption {
1112
locale?: string;
1213
reg?: string;
@@ -69,6 +70,7 @@ interface Props {
6970
value?: string;
7071
disabled?: boolean;
7172
validate?: boolean;
73+
autoComplete?: string;
7274
maxLength?: string | number;
7375
placeholder?: string;
7476
classNameInput?: string;
@@ -93,6 +95,7 @@ interface DefaultProps {
9395
value: string | number;
9496
disabled: boolean;
9597
validate: boolean;
98+
autoComplete: string;
9699
maxLength: string | number;
97100
placeholder: string;
98101
classNameInput: string;
@@ -124,6 +127,7 @@ class Index extends React.Component<Props, State> {
124127
value: '',
125128
disabled: false,
126129
validate: false,
130+
autoComplete: DEFAULT_AUTO_COMPLETE,
127131
maxLength: DEFAULT_MAX_LENGTH,
128132
placeholder: '',
129133
classNameInput: '',
@@ -385,6 +389,7 @@ class Index extends React.Component<Props, State> {
385389
value,
386390
disabled,
387391
maxLength,
392+
autoComplete,
388393
placeholder,
389394
classNameWrapper,
390395
classNameContainer,
@@ -430,6 +435,7 @@ class Index extends React.Component<Props, State> {
430435
type={type}
431436
value={value}
432437
disabled={disabled}
438+
autoComplete={autoComplete}
433439
maxLength={Number(maxLength)}
434440
onBlur={this.onBlur}
435441
onKeyUp={this.onKeyUp}

0 commit comments

Comments
 (0)