@veltra/utils 1.2.19 → 1.2.20
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-context.js","names":[],"sources":["../../src/types/form-context.ts"],"sourcesContent":["import { type InjectionKey, inject, provide } from 'vue'\n\nimport type { ComponentSize } from './component-common'\n\nexport interface FormContextModel {\n errors: Map<any, string[] | undefined>\n fields: Record<string, { required?: unknown }>\n}\n\nexport interface FormContextProps {\n /** 表单列宽 */\n labelWidth?: string | number\n /** 表单尺寸 */\n size?: ComponentSize\n /** 是否禁用 */\n disabled?: boolean\n /** 是否只读 */\n readonly?: boolean\n /** 是否隐藏提示 */\n noTips?: boolean\n /** 表单数据 */\n model?: Record<string, any>\n}\n\ntype FormPropsLike = Partial<FormContextProps> & Record<string, any>\n\nexport interface FormFieldItem {\n validate: () => Promise<boolean>\n clearValidate?: () => void\n}\n\ntype DIContext = {\n /** 表单属性 */\n formProps: FormPropsLike\n /** 注册表单字段 */\n registerField: (field: string, item: FormFieldItem) => void\n /** 注销表单字段 */\n unregisterField: (field: string) => void\n /** 校验指定字段,未传 keys 时校验全部已注册字段 */\n validateFields?: (keys?: string[]) => Promise<boolean>\n /** 是否需要校验 */\n shouldValidate?: () => boolean\n /** 处理字段值变化 */\n handleFieldChange: (field: string, value: any) => void\n}\n\nconst FormComponentDIKey: InjectionKey<DIContext> = Symbol('FormComponentDIKey')\n\nexport function provideFormContext(context: DIContext): void {\n provide(FormComponentDIKey, context)\n}\n\nexport function injectFormContext(): {\n /** 是否在表单中 */\n inForm: boolean\n} & Partial<DIContext> {\n const context = inject(FormComponentDIKey, undefined) || {}\n return { inForm: !!context, ...context }\n}\n"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"form-context.js","names":[],"sources":["../../src/types/form-context.ts"],"sourcesContent":["import { type InjectionKey, inject, provide } from 'vue'\n\nimport type { ComponentSize } from './component-common'\n\nexport interface FormContextModel {\n errors: Map<any, string[] | undefined>\n fields: Record<string, { required?: unknown }>\n}\n\nexport interface FormContextProps {\n /** 表单列宽 */\n labelWidth?: string | number\n /** 表单项 label 位置 */\n labelPosition?: 'top' | 'left'\n /** 表单尺寸 */\n size?: ComponentSize\n /** 是否禁用 */\n disabled?: boolean\n /** 是否只读 */\n readonly?: boolean\n /** 是否隐藏提示 */\n noTips?: boolean\n /** 表单数据 */\n model?: Record<string, any>\n}\n\ntype FormPropsLike = Partial<FormContextProps> & Record<string, any>\n\nexport interface FormFieldItem {\n validate: () => Promise<boolean>\n clearValidate?: () => void\n}\n\ntype DIContext = {\n /** 表单属性 */\n formProps: FormPropsLike\n /** 注册表单字段 */\n registerField: (field: string, item: FormFieldItem) => void\n /** 注销表单字段 */\n unregisterField: (field: string) => void\n /** 校验指定字段,未传 keys 时校验全部已注册字段 */\n validateFields?: (keys?: string[]) => Promise<boolean>\n /** 是否需要校验 */\n shouldValidate?: () => boolean\n /** 处理字段值变化 */\n handleFieldChange: (field: string, value: any) => void\n}\n\nconst FormComponentDIKey: InjectionKey<DIContext> = Symbol('FormComponentDIKey')\n\nexport function provideFormContext(context: DIContext): void {\n provide(FormComponentDIKey, context)\n}\n\nexport function injectFormContext(): {\n /** 是否在表单中 */\n inForm: boolean\n} & Partial<DIContext> {\n const context = inject(FormComponentDIKey, undefined) || {}\n return { inForm: !!context, ...context }\n}\n"],"mappings":";;AAgDA,MAAM,qBAA8C,OAAO,oBAAoB;AAE/E,SAAgB,mBAAmB,SAA0B;CAC3D,QAAQ,oBAAoB,OAAO;AACrC;AAEA,SAAgB,oBAGO;CACrB,MAAM,UAAU,OAAO,oBAAoB,KAAA,CAAS,KAAK,CAAC;CAC1D,OAAO;EAAE,QAAQ,CAAC,CAAC;EAAS,GAAG;CAAQ;AACzC"}
|
package/package.json
CHANGED