Explorar o código

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

* 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
zhang hai 1 ano
pai
achega
f62043b1fc

+ 1 - 1
src/components/Form/src/BasicForm.vue

@@ -294,7 +294,7 @@
   );
 
   defineExpose({
-    setProps,
+    ...formActionType,
   });
 
   onMounted(() => {

+ 24 - 1
src/components/Form/src/hooks/useFormEvents.ts

@@ -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);
@@ -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) {
@@ -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,

+ 4 - 0
src/components/Scrollbar/src/Scrollbar.vue

@@ -101,6 +101,10 @@
     },
   );
 
+  defineExpose({
+    wrap,
+  });
+
   onMounted(() => {
     if (props.native) return;
     nextTick(update);

+ 1 - 1
src/components/Table/src/BasicTable.vue

@@ -320,7 +320,7 @@
 
   emit('register', tableAction, formActions);
 
-  defineExpose({ tableAction });
+  defineExpose({ ...tableAction });
 </script>
 <style lang="less">
   @border-color: #cecece4d;

+ 1 - 1
src/locales/lang/zh-CN/antdLocale/DatePicker.json

@@ -1,6 +1,6 @@
 {
   "lang": {
-    "shortWeekDays": ["一", "二", "三", "四", "五", "六", "日"],
+    "shortWeekDays": ["日","一", "二", "三", "四", "五", "六"],
     "shortMonths": [
       "1月",
       "2月",