@vrojs/element-plus 0.0.30 → 0.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,11 +30,12 @@ export interface VroElSchemaFormFieldPropsMap {
30
30
  }
31
31
  export type VroElSchemaFormFieldType = keyof VroElSchemaFormFieldPropsMap;
32
32
  export type VroElSchemaFormRawComponent = Raw<object>;
33
+ export type VroElSchemaFormSlotString = `slot-${string}`;
33
34
  export interface VroElSchemaFormSchemaFieldBase<TProps = Record<string, any>> {
34
35
  /**
35
36
  * 字段渲染组件,支持内置注册名、外部注册名或组件对象。
36
37
  */
37
- is?: VroElSchemaFormFieldType | VroElSchemaFormRawComponent;
38
+ is?: VroElSchemaFormFieldType | VroElSchemaFormRawComponent | VroElSchemaFormSlotString;
38
39
  /**
39
40
  * 表单项标签文本。
40
41
  */
@@ -115,7 +116,7 @@ export type VroElSchemaFormMappedSchemaField = {
115
116
  };
116
117
  }[VroElSchemaFormFieldType];
117
118
  export type VroElSchemaFormCustomSchemaField = VroElSchemaFormSchemaFieldBase & {
118
- is?: VroElSchemaFormRawComponent;
119
+ is?: VroElSchemaFormRawComponent | VroElSchemaFormSlotString;
119
120
  };
120
121
  export type VroElSchemaFormSchemaField = VroElSchemaFormMappedSchemaField | VroElSchemaFormCustomSchemaField;
121
122
  export type VroElSchemaFormSchemaBase = Record<string, VroElSchemaFormSchemaFieldBase>;
@@ -4,7 +4,7 @@ import { VroElSchemaFormInstance } from '.';
4
4
  import { VroElSchemaFormSchema, VroElSchemaFormSchemaFieldBase } from './types';
5
5
  export interface UseVroElSchemaFormOptions extends Omit<UseAsyncTaskOptions<any>, 'initialValue' | 'initialParams'> {
6
6
  source?: Record<string, any>;
7
- instanceRef?: Ref<VroElSchemaFormInstance | undefined>;
7
+ instanceRef?: Ref<VroElSchemaFormInstance | undefined> | string;
8
8
  }
9
9
  export type UseVroElSchemaFormSchema<TSchema extends VroElSchemaFormSchema> = {
10
10
  [K in keyof TSchema]: VroElSchemaFormSchemaFieldBase;
@@ -897,7 +897,449 @@ export declare function useVroElSchemaForm<D extends Record<string, any> = any,
897
897
  validateField: (key: string) => Promise<boolean | undefined>;
898
898
  }> & {} & import('vue').ComponentCustomProperties & {} & {
899
899
  $slots: Readonly<import('./types').VroElSchemaFormSlots> & import('./types').VroElSchemaFormSlots;
900
- }) | undefined>;
900
+ }) | undefined> | Readonly<import('vue').ShallowRef<({
901
+ $: import('vue').ComponentInternalInstance;
902
+ $data: {};
903
+ $props: Partial<{
904
+ schema: VroElSchemaFormSchema;
905
+ colProps: Partial<import('element-plus').ColProps>;
906
+ formItemProps: Partial<import('element-plus').FormItemProps>;
907
+ formProps: Partial<Omit<import('element-plus').FormProps, "rules" | "model">>;
908
+ rowProps: Partial<import('element-plus').RowProps>;
909
+ }> & Omit<{
910
+ readonly schema: VroElSchemaFormSchema;
911
+ readonly colProps: Partial<import('element-plus').ColProps>;
912
+ readonly formItemProps: Partial<import('element-plus').FormItemProps>;
913
+ readonly formProps: Partial<Omit<import('element-plus').FormProps, "rules" | "model">>;
914
+ readonly rowProps: Partial<import('element-plus').RowProps>;
915
+ readonly "onChange-field"?: ((payload: import('./types').VroElSchemaFormFieldEvent) => any) | undefined;
916
+ readonly "onInput-field"?: ((payload: import('./types').VroElSchemaFormFieldEvent) => any) | undefined;
917
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, "schema" | "colProps" | "formItemProps" | "formProps" | "rowProps">;
918
+ $attrs: {
919
+ [x: string]: unknown;
920
+ };
921
+ $refs: {
922
+ [x: string]: unknown;
923
+ } & {
924
+ formRef: ({
925
+ $: import('vue').ComponentInternalInstance;
926
+ $data: {};
927
+ $props: {
928
+ readonly model?: Record<string, any> | undefined;
929
+ readonly rules?: import('element-plus').FormRules | undefined;
930
+ readonly labelPosition?: "left" | "right" | "top" | undefined;
931
+ readonly requireAsteriskPosition?: "left" | "right" | undefined;
932
+ readonly labelWidth?: string | number | undefined;
933
+ readonly labelSuffix?: string | undefined;
934
+ readonly inline?: boolean | undefined;
935
+ readonly inlineMessage?: boolean | undefined;
936
+ readonly statusIcon?: boolean | undefined;
937
+ readonly showMessage?: boolean | undefined;
938
+ readonly validateOnRuleChange?: boolean | undefined;
939
+ readonly hideRequiredAsterisk?: boolean | undefined;
940
+ readonly scrollToError?: boolean | undefined;
941
+ readonly scrollIntoViewOptions?: (ScrollIntoViewOptions | boolean) | undefined;
942
+ readonly size?: import('element-plus').ComponentSize | undefined;
943
+ readonly disabled?: boolean | undefined;
944
+ readonly onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined | undefined;
945
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
946
+ $attrs: {
947
+ [x: string]: unknown;
948
+ };
949
+ $refs: {
950
+ [x: string]: unknown;
951
+ };
952
+ $slots: Readonly<{
953
+ [name: string]: import('vue').Slot<any> | undefined;
954
+ }>;
955
+ $root: import('vue').ComponentPublicInstance | null;
956
+ $parent: import('vue').ComponentPublicInstance | null;
957
+ $host: Element | null;
958
+ $emit: (event: "validate", prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => void;
959
+ $el: any;
960
+ $options: import('vue').ComponentOptionsBase<Readonly<import('element-plus').FormProps> & Readonly<{
961
+ onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined;
962
+ }>, {
963
+ validate: (callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
964
+ validateField: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>, callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
965
+ resetFields: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>) => void;
966
+ clearValidate: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>) => void;
967
+ scrollToField: (prop: import('element-plus').FormItemProp) => void;
968
+ getField: (prop: import('element-plus').FormItemProp) => import('element-plus').FormItemContext | undefined;
969
+ fields: import('vue').Reactive<import('element-plus').FormItemContext[]>;
970
+ setInitialValues: (initModel: Record<string, any>) => void;
971
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
972
+ validate: (prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => void;
973
+ }, string, {
974
+ labelWidth: string | number;
975
+ labelPosition: "left" | "right" | "top";
976
+ requireAsteriskPosition: "left" | "right";
977
+ labelSuffix: string;
978
+ showMessage: boolean;
979
+ validateOnRuleChange: boolean;
980
+ scrollIntoViewOptions: ScrollIntoViewOptions | boolean;
981
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
982
+ beforeCreate?: (() => void) | (() => void)[];
983
+ created?: (() => void) | (() => void)[];
984
+ beforeMount?: (() => void) | (() => void)[];
985
+ mounted?: (() => void) | (() => void)[];
986
+ beforeUpdate?: (() => void) | (() => void)[];
987
+ updated?: (() => void) | (() => void)[];
988
+ activated?: (() => void) | (() => void)[];
989
+ deactivated?: (() => void) | (() => void)[];
990
+ beforeDestroy?: (() => void) | (() => void)[];
991
+ beforeUnmount?: (() => void) | (() => void)[];
992
+ destroyed?: (() => void) | (() => void)[];
993
+ unmounted?: (() => void) | (() => void)[];
994
+ renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
995
+ renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
996
+ errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
997
+ };
998
+ $forceUpdate: () => void;
999
+ $nextTick: typeof import('vue').nextTick;
1000
+ $watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
1001
+ } & Readonly<{
1002
+ labelWidth: string | number;
1003
+ labelPosition: "left" | "right" | "top";
1004
+ requireAsteriskPosition: "left" | "right";
1005
+ labelSuffix: string;
1006
+ showMessage: boolean;
1007
+ validateOnRuleChange: boolean;
1008
+ scrollIntoViewOptions: ScrollIntoViewOptions | boolean;
1009
+ }> & Omit<Readonly<import('element-plus').FormProps> & Readonly<{
1010
+ onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined;
1011
+ }>, "labelWidth" | "labelPosition" | "requireAsteriskPosition" | "labelSuffix" | "showMessage" | "validateOnRuleChange" | "scrollIntoViewOptions" | "validate" | "validateField" | "resetFields" | "clearValidate" | "scrollToField" | "getField" | "fields" | "setInitialValues"> & import('vue').ShallowUnwrapRef<{
1012
+ validate: (callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
1013
+ validateField: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>, callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
1014
+ resetFields: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>) => void;
1015
+ clearValidate: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>) => void;
1016
+ scrollToField: (prop: import('element-plus').FormItemProp) => void;
1017
+ getField: (prop: import('element-plus').FormItemProp) => import('element-plus').FormItemContext | undefined;
1018
+ fields: import('vue').Reactive<import('element-plus').FormItemContext[]>;
1019
+ setInitialValues: (initModel: Record<string, any>) => void;
1020
+ }> & {} & import('vue').ComponentCustomProperties & {} & {
1021
+ $slots: {
1022
+ default?: (props: {}) => any;
1023
+ };
1024
+ }) | null;
1025
+ componentRefs: unknown;
1026
+ };
1027
+ $slots: Readonly<{
1028
+ [name: string]: import('vue').Slot<any> | undefined;
1029
+ }>;
1030
+ $root: import('vue').ComponentPublicInstance | null;
1031
+ $parent: import('vue').ComponentPublicInstance | null;
1032
+ $host: Element | null;
1033
+ $emit: ((event: "change-field", payload: import('./types').VroElSchemaFormFieldEvent) => void) & ((event: "input-field", payload: import('./types').VroElSchemaFormFieldEvent) => void);
1034
+ $el: any;
1035
+ $options: import('vue').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
1036
+ formProps: {
1037
+ type: import('vue').PropType<import('./types').VroElSchemaFormFormProps>;
1038
+ default: () => {};
1039
+ };
1040
+ rowProps: {
1041
+ type: import('vue').PropType<Partial<import('element-plus').RowProps>>;
1042
+ default: () => {};
1043
+ };
1044
+ colProps: {
1045
+ type: import('vue').PropType<Partial<import('element-plus').ColProps>>;
1046
+ default: () => {};
1047
+ };
1048
+ formItemProps: {
1049
+ type: import('vue').PropType<Partial<import('element-plus').FormItemProps>>;
1050
+ default: () => {};
1051
+ };
1052
+ schema: {
1053
+ type: import('vue').PropType<VroElSchemaFormSchema>;
1054
+ default: () => {};
1055
+ };
1056
+ }>> & Readonly<{
1057
+ "onChange-field"?: ((payload: import('./types').VroElSchemaFormFieldEvent) => any) | undefined;
1058
+ "onInput-field"?: ((payload: import('./types').VroElSchemaFormFieldEvent) => any) | undefined;
1059
+ }>, {
1060
+ elForm: {
1061
+ $: import('vue').ComponentInternalInstance;
1062
+ $data: {};
1063
+ $props: {
1064
+ readonly model?: Record<string, any> | undefined;
1065
+ readonly rules?: import('element-plus').FormRules | undefined;
1066
+ readonly labelPosition?: "left" | "right" | "top" | undefined;
1067
+ readonly requireAsteriskPosition?: "left" | "right" | undefined;
1068
+ readonly labelWidth?: string | number | undefined;
1069
+ readonly labelSuffix?: string | undefined;
1070
+ readonly inline?: boolean | undefined;
1071
+ readonly inlineMessage?: boolean | undefined;
1072
+ readonly statusIcon?: boolean | undefined;
1073
+ readonly showMessage?: boolean | undefined;
1074
+ readonly validateOnRuleChange?: boolean | undefined;
1075
+ readonly hideRequiredAsterisk?: boolean | undefined;
1076
+ readonly scrollToError?: boolean | undefined;
1077
+ readonly scrollIntoViewOptions?: (ScrollIntoViewOptions | boolean) | undefined;
1078
+ readonly size?: import('element-plus').ComponentSize | undefined;
1079
+ readonly disabled?: boolean | undefined;
1080
+ readonly onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined | undefined;
1081
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
1082
+ $attrs: {
1083
+ [x: string]: unknown;
1084
+ };
1085
+ $refs: {
1086
+ [x: string]: unknown;
1087
+ };
1088
+ $slots: Readonly<{
1089
+ [name: string]: import('vue').Slot<any> | undefined;
1090
+ }>;
1091
+ $root: import('vue').ComponentPublicInstance | null;
1092
+ $parent: import('vue').ComponentPublicInstance | null;
1093
+ $host: Element | null;
1094
+ $emit: (event: "validate", prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => void;
1095
+ $el: any;
1096
+ $options: import('vue').ComponentOptionsBase<Readonly<import('element-plus').FormProps> & Readonly<{
1097
+ onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined;
1098
+ }>, {
1099
+ validate: (callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
1100
+ validateField: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>, callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
1101
+ resetFields: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>) => void;
1102
+ clearValidate: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>) => void;
1103
+ scrollToField: (prop: import('element-plus').FormItemProp) => void;
1104
+ getField: (prop: import('element-plus').FormItemProp) => import('element-plus').FormItemContext | undefined;
1105
+ fields: import('vue').Reactive<import('element-plus').FormItemContext[]>;
1106
+ setInitialValues: (initModel: Record<string, any>) => void;
1107
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
1108
+ validate: (prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => void;
1109
+ }, string, {
1110
+ labelWidth: string | number;
1111
+ labelPosition: "left" | "right" | "top";
1112
+ requireAsteriskPosition: "left" | "right";
1113
+ labelSuffix: string;
1114
+ showMessage: boolean;
1115
+ validateOnRuleChange: boolean;
1116
+ scrollIntoViewOptions: ScrollIntoViewOptions | boolean;
1117
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
1118
+ beforeCreate?: (() => void) | (() => void)[];
1119
+ created?: (() => void) | (() => void)[];
1120
+ beforeMount?: (() => void) | (() => void)[];
1121
+ mounted?: (() => void) | (() => void)[];
1122
+ beforeUpdate?: (() => void) | (() => void)[];
1123
+ updated?: (() => void) | (() => void)[];
1124
+ activated?: (() => void) | (() => void)[];
1125
+ deactivated?: (() => void) | (() => void)[];
1126
+ beforeDestroy?: (() => void) | (() => void)[];
1127
+ beforeUnmount?: (() => void) | (() => void)[];
1128
+ destroyed?: (() => void) | (() => void)[];
1129
+ unmounted?: (() => void) | (() => void)[];
1130
+ renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
1131
+ renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
1132
+ errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
1133
+ };
1134
+ $forceUpdate: () => void;
1135
+ $nextTick: typeof import('vue').nextTick;
1136
+ $watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
1137
+ } & Readonly<{
1138
+ labelWidth: string | number;
1139
+ labelPosition: "left" | "right" | "top";
1140
+ requireAsteriskPosition: "left" | "right";
1141
+ labelSuffix: string;
1142
+ showMessage: boolean;
1143
+ validateOnRuleChange: boolean;
1144
+ scrollIntoViewOptions: ScrollIntoViewOptions | boolean;
1145
+ }> & Omit<Readonly<import('element-plus').FormProps> & Readonly<{
1146
+ onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined;
1147
+ }>, "labelWidth" | "labelPosition" | "requireAsteriskPosition" | "labelSuffix" | "showMessage" | "validateOnRuleChange" | "scrollIntoViewOptions" | "validate" | "validateField" | "resetFields" | "clearValidate" | "scrollToField" | "getField" | "fields" | "setInitialValues"> & import('vue').ShallowUnwrapRef<{
1148
+ validate: (callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
1149
+ validateField: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>, callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
1150
+ resetFields: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>) => void;
1151
+ clearValidate: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>) => void;
1152
+ scrollToField: (prop: import('element-plus').FormItemProp) => void;
1153
+ getField: (prop: import('element-plus').FormItemProp) => import('element-plus').FormItemContext | undefined;
1154
+ fields: import('vue').Reactive<import('element-plus').FormItemContext[]>;
1155
+ setInitialValues: (initModel: Record<string, any>) => void;
1156
+ }> & {} & import('vue').ComponentCustomProperties & {} & {
1157
+ $slots: {
1158
+ default?: (props: {}) => any;
1159
+ };
1160
+ };
1161
+ validate: () => Promise<void>;
1162
+ resetFields: () => void | undefined;
1163
+ trigger: (ctx: {
1164
+ confirm: (...args: any[]) => void;
1165
+ hide: (reason?: any) => void;
1166
+ block: () => void;
1167
+ }) => any;
1168
+ extractValues: () => Promise<Record<string, any>>;
1169
+ validateField: (key: string) => Promise<boolean | undefined>;
1170
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
1171
+ "change-field": (payload: import('./types').VroElSchemaFormFieldEvent) => any;
1172
+ "input-field": (payload: import('./types').VroElSchemaFormFieldEvent) => any;
1173
+ }, string, {
1174
+ schema: VroElSchemaFormSchema;
1175
+ colProps: Partial<import('element-plus').ColProps>;
1176
+ formItemProps: Partial<import('element-plus').FormItemProps>;
1177
+ formProps: Partial<Omit<import('element-plus').FormProps, "rules" | "model">>;
1178
+ rowProps: Partial<import('element-plus').RowProps>;
1179
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
1180
+ beforeCreate?: (() => void) | (() => void)[];
1181
+ created?: (() => void) | (() => void)[];
1182
+ beforeMount?: (() => void) | (() => void)[];
1183
+ mounted?: (() => void) | (() => void)[];
1184
+ beforeUpdate?: (() => void) | (() => void)[];
1185
+ updated?: (() => void) | (() => void)[];
1186
+ activated?: (() => void) | (() => void)[];
1187
+ deactivated?: (() => void) | (() => void)[];
1188
+ beforeDestroy?: (() => void) | (() => void)[];
1189
+ beforeUnmount?: (() => void) | (() => void)[];
1190
+ destroyed?: (() => void) | (() => void)[];
1191
+ unmounted?: (() => void) | (() => void)[];
1192
+ renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
1193
+ renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
1194
+ errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
1195
+ };
1196
+ $forceUpdate: () => void;
1197
+ $nextTick: typeof import('vue').nextTick;
1198
+ $watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
1199
+ } & Readonly<{
1200
+ schema: VroElSchemaFormSchema;
1201
+ colProps: Partial<import('element-plus').ColProps>;
1202
+ formItemProps: Partial<import('element-plus').FormItemProps>;
1203
+ formProps: Partial<Omit<import('element-plus').FormProps, "rules" | "model">>;
1204
+ rowProps: Partial<import('element-plus').RowProps>;
1205
+ }> & Omit<Readonly<import('vue').ExtractPropTypes<{
1206
+ formProps: {
1207
+ type: import('vue').PropType<import('./types').VroElSchemaFormFormProps>;
1208
+ default: () => {};
1209
+ };
1210
+ rowProps: {
1211
+ type: import('vue').PropType<Partial<import('element-plus').RowProps>>;
1212
+ default: () => {};
1213
+ };
1214
+ colProps: {
1215
+ type: import('vue').PropType<Partial<import('element-plus').ColProps>>;
1216
+ default: () => {};
1217
+ };
1218
+ formItemProps: {
1219
+ type: import('vue').PropType<Partial<import('element-plus').FormItemProps>>;
1220
+ default: () => {};
1221
+ };
1222
+ schema: {
1223
+ type: import('vue').PropType<VroElSchemaFormSchema>;
1224
+ default: () => {};
1225
+ };
1226
+ }>> & Readonly<{
1227
+ "onChange-field"?: ((payload: import('./types').VroElSchemaFormFieldEvent) => any) | undefined;
1228
+ "onInput-field"?: ((payload: import('./types').VroElSchemaFormFieldEvent) => any) | undefined;
1229
+ }>, "trigger" | "validate" | "validateField" | "resetFields" | ("schema" | "colProps" | "formItemProps" | "formProps" | "rowProps") | "elForm" | "extractValues"> & import('vue').ShallowUnwrapRef<{
1230
+ elForm: {
1231
+ $: import('vue').ComponentInternalInstance;
1232
+ $data: {};
1233
+ $props: {
1234
+ readonly model?: Record<string, any> | undefined;
1235
+ readonly rules?: import('element-plus').FormRules | undefined;
1236
+ readonly labelPosition?: "left" | "right" | "top" | undefined;
1237
+ readonly requireAsteriskPosition?: "left" | "right" | undefined;
1238
+ readonly labelWidth?: string | number | undefined;
1239
+ readonly labelSuffix?: string | undefined;
1240
+ readonly inline?: boolean | undefined;
1241
+ readonly inlineMessage?: boolean | undefined;
1242
+ readonly statusIcon?: boolean | undefined;
1243
+ readonly showMessage?: boolean | undefined;
1244
+ readonly validateOnRuleChange?: boolean | undefined;
1245
+ readonly hideRequiredAsterisk?: boolean | undefined;
1246
+ readonly scrollToError?: boolean | undefined;
1247
+ readonly scrollIntoViewOptions?: (ScrollIntoViewOptions | boolean) | undefined;
1248
+ readonly size?: import('element-plus').ComponentSize | undefined;
1249
+ readonly disabled?: boolean | undefined;
1250
+ readonly onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined | undefined;
1251
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
1252
+ $attrs: {
1253
+ [x: string]: unknown;
1254
+ };
1255
+ $refs: {
1256
+ [x: string]: unknown;
1257
+ };
1258
+ $slots: Readonly<{
1259
+ [name: string]: import('vue').Slot<any> | undefined;
1260
+ }>;
1261
+ $root: import('vue').ComponentPublicInstance | null;
1262
+ $parent: import('vue').ComponentPublicInstance | null;
1263
+ $host: Element | null;
1264
+ $emit: (event: "validate", prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => void;
1265
+ $el: any;
1266
+ $options: import('vue').ComponentOptionsBase<Readonly<import('element-plus').FormProps> & Readonly<{
1267
+ onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined;
1268
+ }>, {
1269
+ validate: (callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
1270
+ validateField: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>, callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
1271
+ resetFields: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>) => void;
1272
+ clearValidate: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>) => void;
1273
+ scrollToField: (prop: import('element-plus').FormItemProp) => void;
1274
+ getField: (prop: import('element-plus').FormItemProp) => import('element-plus').FormItemContext | undefined;
1275
+ fields: import('vue').Reactive<import('element-plus').FormItemContext[]>;
1276
+ setInitialValues: (initModel: Record<string, any>) => void;
1277
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
1278
+ validate: (prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => void;
1279
+ }, string, {
1280
+ labelWidth: string | number;
1281
+ labelPosition: "left" | "right" | "top";
1282
+ requireAsteriskPosition: "left" | "right";
1283
+ labelSuffix: string;
1284
+ showMessage: boolean;
1285
+ validateOnRuleChange: boolean;
1286
+ scrollIntoViewOptions: ScrollIntoViewOptions | boolean;
1287
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
1288
+ beforeCreate?: (() => void) | (() => void)[];
1289
+ created?: (() => void) | (() => void)[];
1290
+ beforeMount?: (() => void) | (() => void)[];
1291
+ mounted?: (() => void) | (() => void)[];
1292
+ beforeUpdate?: (() => void) | (() => void)[];
1293
+ updated?: (() => void) | (() => void)[];
1294
+ activated?: (() => void) | (() => void)[];
1295
+ deactivated?: (() => void) | (() => void)[];
1296
+ beforeDestroy?: (() => void) | (() => void)[];
1297
+ beforeUnmount?: (() => void) | (() => void)[];
1298
+ destroyed?: (() => void) | (() => void)[];
1299
+ unmounted?: (() => void) | (() => void)[];
1300
+ renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
1301
+ renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
1302
+ errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
1303
+ };
1304
+ $forceUpdate: () => void;
1305
+ $nextTick: typeof import('vue').nextTick;
1306
+ $watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
1307
+ } & Readonly<{
1308
+ labelWidth: string | number;
1309
+ labelPosition: "left" | "right" | "top";
1310
+ requireAsteriskPosition: "left" | "right";
1311
+ labelSuffix: string;
1312
+ showMessage: boolean;
1313
+ validateOnRuleChange: boolean;
1314
+ scrollIntoViewOptions: ScrollIntoViewOptions | boolean;
1315
+ }> & Omit<Readonly<import('element-plus').FormProps> & Readonly<{
1316
+ onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined;
1317
+ }>, "labelWidth" | "labelPosition" | "requireAsteriskPosition" | "labelSuffix" | "showMessage" | "validateOnRuleChange" | "scrollIntoViewOptions" | "validate" | "validateField" | "resetFields" | "clearValidate" | "scrollToField" | "getField" | "fields" | "setInitialValues"> & import('vue').ShallowUnwrapRef<{
1318
+ validate: (callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
1319
+ validateField: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>, callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
1320
+ resetFields: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>) => void;
1321
+ clearValidate: (props?: import('element-plus/es/utils/typescript.mjs').Arrayable<import('element-plus').FormItemProp>) => void;
1322
+ scrollToField: (prop: import('element-plus').FormItemProp) => void;
1323
+ getField: (prop: import('element-plus').FormItemProp) => import('element-plus').FormItemContext | undefined;
1324
+ fields: import('vue').Reactive<import('element-plus').FormItemContext[]>;
1325
+ setInitialValues: (initModel: Record<string, any>) => void;
1326
+ }> & {} & import('vue').ComponentCustomProperties & {} & {
1327
+ $slots: {
1328
+ default?: (props: {}) => any;
1329
+ };
1330
+ };
1331
+ validate: () => Promise<void>;
1332
+ resetFields: () => void | undefined;
1333
+ trigger: (ctx: {
1334
+ confirm: (...args: any[]) => void;
1335
+ hide: (reason?: any) => void;
1336
+ block: () => void;
1337
+ }) => any;
1338
+ extractValues: () => Promise<Record<string, any>>;
1339
+ validateField: (key: string) => Promise<boolean | undefined>;
1340
+ }> & {} & import('vue').ComponentCustomProperties & {} & {
1341
+ $slots: Readonly<import('./types').VroElSchemaFormSlots> & import('./types').VroElSchemaFormSlots;
1342
+ }) | null>>;
901
1343
  loading: Ref<boolean, boolean>;
902
1344
  trigger: () => Promise<void>;
903
1345
  };
@@ -1,11 +1,11 @@
1
1
  import d from "../node_modules/.pnpm/@ajuanjs_banana@0.0.3/node_modules/@ajuanjs/banana/dist/index.js";
2
- import { isFunction as p } from "@daysnap/utils";
2
+ import { isFunction as p, isString as g } from "@daysnap/utils";
3
3
  import { useAsyncTask as v } from "@vrojs/use";
4
- import { reactive as g, ref as y, onBeforeMount as h } from "vue";
5
- function V(r, n, i = {}) {
6
- const { instanceRef: s, source: a, ...c } = i, e = g(
7
- p(r) ? r() : r
8
- ), t = s ?? y(), { loading: u, trigger: f, error: m, data: l } = v(async () => {
4
+ import { reactive as h, useTemplateRef as y, onBeforeMount as F } from "vue";
5
+ function V(e, s, i = {}) {
6
+ const { instanceRef: r = "schemaFormRef", source: a, ...c } = i, o = h(
7
+ p(e) ? e() : e
8
+ ), t = g(r) ? y(r) : r, { loading: u, trigger: m, error: f, data: l } = v(async () => {
9
9
  if (!t.value)
10
10
  return;
11
11
  try {
@@ -13,18 +13,18 @@ function V(r, n, i = {}) {
13
13
  } catch {
14
14
  throw "";
15
15
  }
16
- const o = await t.value.extractValues();
17
- return await n?.(o), o;
16
+ const n = await t.value.extractValues();
17
+ return await s?.(n), n;
18
18
  }, c);
19
- return h(async () => {
20
- a && await d.assign(a, e);
19
+ return F(async () => {
20
+ a && await d.assign(a, o);
21
21
  }), {
22
22
  data: l,
23
- error: m,
24
- schema: e,
23
+ error: f,
24
+ schema: o,
25
25
  schemaFormRef: t,
26
26
  loading: u,
27
- trigger: f
27
+ trigger: m
28
28
  };
29
29
  }
30
30
  export {
@@ -1,121 +1,127 @@
1
- import { defineComponent as q, computed as C, ref as F, watchEffect as z, useTemplateRef as S, createBlock as P, openBlock as g, unref as m, mergeProps as u, withCtx as i, createVNode as I, createElementBlock as A, renderSlot as E, Fragment as G, renderList as _, createSlots as O, resolveDynamicComponent as H } from "vue";
1
+ import { defineComponent as q, computed as I, ref as P, watchEffect as z, useTemplateRef as O, createBlock as E, openBlock as g, unref as u, mergeProps as i, withCtx as m, createVNode as j, createElementBlock as A, renderSlot as F, Fragment as G, renderList as _, createSlots as B, resolveDynamicComponent as H } from "vue";
2
2
  import J from "../node_modules/.pnpm/@ajuanjs_banana@0.0.3/node_modules/@ajuanjs/banana/dist/index.js";
3
- import { isFunction as d, isString as Q, filterEmptyValue as W } from "@daysnap/utils";
4
- import { getSlotEntries as j } from "@vrojs/base";
3
+ import { isFunction as d, isString as $, filterEmptyValue as Q } from "@daysnap/utils";
4
+ import { getSlotEntries as D } from "@vrojs/base";
5
5
  import { ElForm as X, ElRow as Y, ElCol as Z, ElFormItem as k } from "element-plus";
6
6
  import { useLocale as ee } from "../locale/useLocale.js";
7
7
  import { datePickerValueFormat as re } from "../utils/datePickerValueFormat.js";
8
- import { defineVroElSchemaFormFieldTrigger as ae } from "./defineVroElSchemaFormFieldTrigger.js";
9
- import { vroElSchemaFormProps as oe } from "./types.js";
8
+ import { defineVroElSchemaFormFieldTrigger as oe } from "./defineVroElSchemaFormFieldTrigger.js";
9
+ import { vroElSchemaFormProps as ae } from "./types.js";
10
10
  import { vroElSchemaFormFieldManager as te } from "./vroElSchemaFormFieldManager.js";
11
- const ve = /* @__PURE__ */ q({
11
+ const he = /* @__PURE__ */ q({
12
12
  name: "VroElSchemaForm",
13
13
  __name: "vro-el-schema-form",
14
- props: oe,
14
+ props: ae,
15
15
  emits: ["change-field", "input-field"],
16
- setup(B, { expose: x, emit: D }) {
17
- const w = D, n = B, $ = C(() => ({
16
+ setup(x, { expose: y, emit: K }) {
17
+ const w = K, n = x, L = I(() => ({
18
18
  validateOnRuleChange: !1,
19
19
  ...n.formProps
20
- })), { locale: y } = ee(), V = F({}), b = F({}), v = F({});
20
+ })), { locale: M } = ee(), V = P({}), b = P({}), h = P({});
21
21
  z(() => {
22
22
  const { schema: e } = n;
23
- v.value = {};
23
+ h.value = {};
24
24
  const a = {}, r = {};
25
25
  Object.entries(e).forEach(([o, t]) => {
26
26
  let { hidden: s, value: c, rules: l, is: p } = t;
27
- d(s) && (s = s(c, t, e)), p || (s = !0), s || (r[o] = c, v.value[o] = t), d(l) && (l = l(c, t, e)), a[o] = l;
27
+ d(s) && (s = s(c, t, e)), p || (s = !0), s || (r[o] = c, h.value[o] = t), d(l) && (l = l(c, t, e)), a[o] = l;
28
28
  }), Object.assign(b.value, r), Object.assign(V.value, a);
29
29
  });
30
- const R = C(() => Object.entries(v.value).reduce((e, [a, r]) => {
30
+ const C = I(() => Object.entries(h.value).reduce((e, [a, r]) => {
31
31
  let { is: o, options: t, labelKey: s, valueKey: c } = r, l = { ...r.props };
32
- if (Q(o)) {
32
+ if ($(o)) {
33
33
  const p = te.get(o);
34
34
  if (p) {
35
- const N = y.value.el.schemaForm[o] ?? {};
35
+ const W = M.value.el.schemaForm[o] ?? {};
36
36
  o === "ElDatePicker" && (l.valueFormat = l.valueFormat ?? re[l.type ?? "date"]), l = Object.assign(
37
37
  {},
38
38
  p.props,
39
- N,
40
- W({ options: t, labelKey: s, valueKey: c }),
39
+ W,
40
+ Q({ options: t, labelKey: s, valueKey: c }),
41
41
  l
42
42
  ), l.disabled && (l.placeholder = "-", o === "ElDatePicker" && (l.startPlaceholder = "-", l.endPlaceholder = "-")), o = p.is;
43
43
  }
44
44
  }
45
45
  return e[a] = { is: o, props: l }, e;
46
- }, {})), K = async (e, a) => {
46
+ }, {})), R = async (e, a) => {
47
47
  w("change-field", { key: e, value: a }), await n.schema[e]?.onChange?.(a, n.schema[e], n.schema);
48
- }, L = async (e, a) => {
48
+ }, S = async (e, a) => {
49
49
  w("input-field", { key: e, value: a }), await n.schema[e]?.onInput?.(a, n.schema[e], n.schema);
50
- }, h = S("componentRefs"), f = S("formRef"), M = async () => {
51
- const e = h.value?.filter((a) => d(a.validate)) ?? [];
50
+ }, v = O("componentRefs"), f = O("formRef"), T = async () => {
51
+ const e = v.value?.filter((a) => d(a.validate)) ?? [];
52
52
  await Promise.all([f.value, ...e].map((a) => a?.validate()));
53
- }, T = async () => {
54
- const e = h.value?.filter((r) => d(r.extractValues)) ?? [], a = await Promise.all(
53
+ }, U = async () => {
54
+ const e = v.value?.filter((r) => d(r.extractValues)) ?? [], a = await Promise.all(
55
55
  e.map((r) => r.extractValues())
56
56
  );
57
57
  return a.push(await J.extract(n.schema)), a.filter(Boolean).reduce((r, o) => ({ ...r, ...o }), {});
58
- }, U = ae(async (e) => {
59
- const a = h.value?.filter((r) => d(r.trigger)) ?? [];
58
+ }, N = oe(async (e) => {
59
+ const a = v.value?.filter((r) => d(r.trigger)) ?? [];
60
60
  await Promise.all(a.map((r) => r.trigger(e)));
61
61
  });
62
- return x({
62
+ return y({
63
63
  get elForm() {
64
64
  return f.value;
65
65
  },
66
- validate: M,
66
+ validate: T,
67
67
  resetFields: () => f.value?.resetFields(),
68
- trigger: U,
69
- extractValues: T,
68
+ trigger: N,
69
+ extractValues: U,
70
70
  validateField: async (e) => f.value?.validateField(e)
71
- }), (e, a) => (g(), P(m(X), u($.value, {
71
+ }), (e, a) => (g(), E(u(X), i(L.value, {
72
72
  ref_key: "formRef",
73
73
  ref: f,
74
74
  class: "vro-el-schema-form",
75
75
  model: b.value,
76
76
  rules: V.value
77
77
  }), {
78
- default: i(() => [
79
- I(m(Y), u({ gutter: 16 }, e.rowProps), {
80
- default: i(() => [
81
- (g(!0), A(G, null, _(v.value, (r, o) => (g(), P(m(Z), u({ key: o }, { ref_for: !0 }, { ...e.colProps, ...r.colProps }), {
82
- default: i(() => [
83
- I(m(k), u({
78
+ default: m(() => [
79
+ j(u(Y), i({ gutter: 16 }, e.rowProps), {
80
+ default: m(() => [
81
+ (g(!0), A(G, null, _(h.value, (r, o) => (g(), E(u(Z), i({ key: o }, { ref_for: !0 }, { ...e.colProps, ...r.colProps }), {
82
+ default: m(() => [
83
+ j(u(k), i({
84
84
  label: r.label,
85
85
  prop: o
86
- }, { ref_for: !0 }, { ...e.formItemProps, ...r.formItemProps }), O({
87
- default: i(() => [
88
- (g(), P(H(R.value?.[o]?.is), u({
86
+ }, { ref_for: !0 }, { ...e.formItemProps, ...r.formItemProps }), B({
87
+ default: m(() => [
88
+ u($)(r.is) && r.is.startsWith("slot-") ? F(e.$slots, r.is, {
89
+ key: 0,
90
+ item: r,
91
+ onChange: (t) => R(o, t),
92
+ onInput: (t) => S(o, t)
93
+ }) : (g(), E(H(C.value?.[o]?.is), i({
94
+ key: 1,
89
95
  modelValue: r.value,
90
96
  "onUpdate:modelValue": (t) => r.value = t
91
- }, { ref_for: !0 }, R.value?.[o]?.props, {
97
+ }, { ref_for: !0 }, C.value?.[o]?.props, {
92
98
  ref_for: !0,
93
99
  ref_key: "componentRefs",
94
- ref: h,
95
- onChange: (t) => K(o, t),
96
- onInput: (t) => L(o, t)
97
- }), O({ _: 2 }, [
98
- _(m(j)(r.slots), ({ source: t, target: s }) => ({
100
+ ref: v,
101
+ onChange: (t) => R(o, t),
102
+ onInput: (t) => S(o, t)
103
+ }), B({ _: 2 }, [
104
+ _(u(D)(r.slots), ({ source: t, target: s }) => ({
99
105
  name: s,
100
- fn: i((c) => [
101
- E(e.$slots, t, u({ ref_for: !0 }, c ?? {}, { item: r }))
106
+ fn: m((c) => [
107
+ F(e.$slots, t, i({ ref_for: !0 }, c ?? {}, { item: r }))
102
108
  ])
103
109
  }))
104
110
  ]), 1040, ["modelValue", "onUpdate:modelValue", "onChange", "onInput"]))
105
111
  ]),
106
112
  _: 2
107
113
  }, [
108
- _(m(j)(r.itemSlots), ({ source: t, target: s }) => ({
114
+ _(u(D)(r.itemSlots), ({ source: t, target: s }) => ({
109
115
  name: s,
110
- fn: i((c) => [
111
- E(e.$slots, t, u({ ref_for: !0 }, c ?? {}, { item: r }))
116
+ fn: m((c) => [
117
+ F(e.$slots, t, i({ ref_for: !0 }, c ?? {}, { item: r }))
112
118
  ])
113
119
  }))
114
120
  ]), 1040, ["label", "prop"])
115
121
  ]),
116
122
  _: 2
117
123
  }, 1040))), 128)),
118
- E(e.$slots, "default")
124
+ F(e.$slots, "default")
119
125
  ]),
120
126
  _: 3
121
127
  }, 16)
@@ -125,5 +131,5 @@ const ve = /* @__PURE__ */ q({
125
131
  }
126
132
  });
127
133
  export {
128
- ve as default
134
+ he as default
129
135
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vrojs/element-plus",
3
- "version": "0.0.30",
3
+ "version": "0.0.31",
4
4
  "description": "vrojs ui",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",