@alifd/field
Advanced tools
Comparing version 1.5.5 to 1.5.6
@@ -32,9 +32,9 @@ --- | ||
<Switch {...init('switch', { | ||
getValueFormatter: (value) => {return value === true? 1:0}, | ||
setValueFormatter: (value) => {return value===1? true: false} | ||
getValueFormatter: (value, ...args) => { return value === true? 1:0 }, | ||
setValueFormatter: (value, inputValues) => { return value===1? true: false } | ||
})}/> | ||
<br/><br/> | ||
<DatePicker {...init('time', { | ||
getValueFormatter: (value) => value.format('YYYY-MM-DD'), | ||
setValueFormatter: (value) => moment(value, 'YYYY-MM-DD') | ||
getValueFormatter: (value, ...args) => { return value.format('YYYY-MM-DD'); }, | ||
setValueFormatter: (value, inputValues) => { return moment(value, 'YYYY-MM-DD'); } | ||
})} /> | ||
@@ -41,0 +41,0 @@ <br/><br/> |
@@ -33,3 +33,4 @@ "use strict"; | ||
valueName: 'value', | ||
trigger: 'onChange' | ||
trigger: 'onChange', | ||
inputValues: [] | ||
}; | ||
@@ -182,3 +183,3 @@ | ||
ref: this._getCacheBind(name, "".concat(name, "__ref"), this._saveRef) | ||
}, valueName, setValueFormatter ? setValueFormatter(field.value) : field.value); | ||
}, valueName, setValueFormatter ? setValueFormatter(field.value, field.inputValues) : field.value); | ||
var rulesMap = {}; | ||
@@ -285,2 +286,3 @@ | ||
field.value = field.getValueFormatter ? field.getValueFormatter.apply(this, others) : (0, _utils.getValueFromEvent)(e); | ||
field.inputValues = others; | ||
@@ -1250,2 +1252,11 @@ if (this.options.parseName) { | ||
} | ||
}, { | ||
key: "get", | ||
value: function get(name) { | ||
if (name) { | ||
return this._get(name); | ||
} else { | ||
return this.fieldsMeta; | ||
} | ||
} | ||
}], [{ | ||
@@ -1252,0 +1263,0 @@ key: "create", |
{ | ||
"name": "@alifd/field", | ||
"version": "1.5.5", | ||
"version": "1.5.6", | ||
"description": "Fields can be used to manage data when it comes to form data manipulation and validation. After being associated with a component, the form data can be automatically written back, read, and verified.", | ||
@@ -88,3 +88,3 @@ "files": [ | ||
}, | ||
"homepage": "https://unpkg.com/@alifd/field@1.5.5/build/index.html", | ||
"homepage": "https://unpkg.com/@alifd/field@1.5.6/build/index.html", | ||
"bugs": "https://github.com/alibaba-fusion/field/issues", | ||
@@ -91,0 +91,0 @@ "publishConfig": { |
@@ -45,3 +45,4 @@ export type FieldOption = { | ||
id: string; | ||
value: T; | ||
value?: T; | ||
checked?: T; | ||
onChange(value: T): void; | ||
@@ -52,3 +53,4 @@ }; | ||
id: string; | ||
value: T; | ||
value?: T; | ||
checked?: T; | ||
onChange(value: T, extra: T2): void; | ||
@@ -214,3 +216,3 @@ }; | ||
*/ | ||
validateCallback(callback?: (errors: any[], values: ValidateResults) => void): void; | ||
validateCallback(callback?: (errors: any[], values: object) => void): void; | ||
@@ -224,3 +226,3 @@ /** | ||
names?: string[] | string, | ||
callback?: (errors: any[], values: ValidateResults) => void | ||
callback?: (errors: any[], values: object) => void | ||
): void; | ||
@@ -235,3 +237,3 @@ | ||
names?: string[] | string, | ||
callback?: (errors: any[], values: ValidateResults) => Promise<any> | ||
callback?: (errors: any[], values: object) => Promise<any> | ||
): Promise<ValidateResults>; | ||
@@ -238,0 +240,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
1741290
5104