Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(DatePicker): date show is wrong and setup script defineExpose #3324

Merged
merged 10 commits into from
Nov 23, 2023
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