Skip to content

Commit

Permalink
fix(DatePicker): date show is wrong and setup script defineExpose (#3324
Browse files Browse the repository at this point in the history
)

* fix(useFormEvents): some function is lost in componentsProps

* fix(useFormEvents): some function is lost in componentsProps

* fix(useFormEvents): some function is lost in componentsProps

* fix(DatePicker): date show is wrong

* fix(useFormEvents): some function is lost in componentsProps

* fix(useFormEvents): some function is lost in componentsProps

* fix(useFormEvents): some function is lost in componentsProps

* fix(DatePicker): date show is wrong

* fix(DatePicker): date show is wrong
  • Loading branch information
zwtvip authored Nov 23, 2023
1 parent 0cfaa40 commit f62043b
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/Form/src/BasicForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
);
defineExpose({
setProps,
...formActionType,
});
onMounted(() => {
Expand Down
25 changes: 24 additions & 1 deletion src/components/Form/src/hooks/useFormEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ export function useFormEvents({
const { componentProps } = schema || {};
let _props = componentProps as any;
if (typeof componentProps === 'function') {
_props = _props({ formModel: unref(formModel), formActionType: unref(formElRef) });
_props = _props({
formModel: unref(formModel),
formActionType,
});
}

const constructValue = tryConstructArray(key, values) || tryConstructObject(key, values);
Expand Down Expand Up @@ -338,6 +341,10 @@ export function useFormEvents({
return handleFormValues(values);
}

async function setProps(formProps: Partial<FormProps>): Promise<void> {
await unref(formElRef)?.setProps(formProps);
}

async function validate(nameList?: NamePath[] | false | undefined) {
let _nameList: any;
if (nameList === undefined) {
Expand Down Expand Up @@ -380,6 +387,22 @@ export function useFormEvents({
}
}

const formActionType: Partial<FormActionType> = {
getFieldsValue,
setFieldsValue,
resetFields,
updateSchema,
resetSchema,
setProps,
removeSchemaByField,
appendSchemaByField,
clearValidate,
validateFields,
validate,
submit: handleSubmit,
scrollToField: scrollToField,
};

return {
handleSubmit,
clearValidate,
Expand Down
4 changes: 4 additions & 0 deletions src/components/Scrollbar/src/Scrollbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@
},
);
defineExpose({
wrap,
});
onMounted(() => {
if (props.native) return;
nextTick(update);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Table/src/BasicTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@
emit('register', tableAction, formActions);
defineExpose({ tableAction });
defineExpose({ ...tableAction });
</script>
<style lang="less">
@border-color: #cecece4d;
Expand Down
2 changes: 1 addition & 1 deletion src/locales/lang/zh-CN/antdLocale/DatePicker.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lang": {
"shortWeekDays": ["", "", "", "", "", "", ""],
"shortWeekDays": ["","", "", "", "", "", ""],
"shortMonths": [
"1月",
"2月",
Expand Down

0 comments on commit f62043b

Please sign in to comment.