@veltra/utils 1.3.1 → 1.3.3
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.
- package/dist/dom/class-name.d.ts +0 -1
- package/dist/dom/style.d.ts +0 -1
- package/dist/helper/make-bem.d.ts +2 -1
- package/dist/helper/vue.d.ts +0 -1
- package/dist/index.d.ts +1 -0
- package/dist/types/component-common.d.ts +1 -1
- package/dist/types/form-context.d.ts +13 -7
- package/dist/types/helper.d.ts +2 -3
- package/package.json +2 -2
package/dist/dom/class-name.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BEMFactory } from "../helper/make-bem.js";
|
|
2
2
|
import { CLS_PREFIX } from "../shared/constants.js";
|
|
3
|
-
|
|
4
3
|
//#region src/dom/class-name.d.ts
|
|
5
4
|
declare const bem: BEMFactory<typeof CLS_PREFIX>;
|
|
6
5
|
declare function addClass(el: HTMLElement, className: string | string[]): void;
|
package/dist/dom/style.d.ts
CHANGED
package/dist/helper/vue.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -15,4 +15,5 @@ import { middleProxy } from "./reactive/proxy.js";
|
|
|
15
15
|
import { DeconstructValue, DefineEvent, Index, Null, RenderReturn, Undef } from "./types/helper.js";
|
|
16
16
|
import { BreakpointName, ColorType, ComponentProps, ComponentSize, FormComponentProps, PresetRule, PropsWithServerQuery, ValidateRule } from "./types/component-common.js";
|
|
17
17
|
import { FormContextModel, FormContextProps, FormFieldItem, injectFormContext, provideFormContext } from "./types/form-context.js";
|
|
18
|
+
import "./types/index.js";
|
|
18
19
|
export { AnimeConfig, BEM, BEMFactory, BreakpointName, CLS_PREFIX, ColorType, ComponentProps, ComponentSize, DeconstructValue, DefineEvent, ExpandTransition, ExpandTransitionOptions, FORM_EMPTY_CONTENT, FormComponentProps, FormContextModel, FormContextProps, FormFieldItem, Index, NAME_SPACE, Null, PresetRule, PropsWithServerQuery, RenderReturn, Tween, TweenConfig, Undef, ValidateRule, addClass, bem, createIncrease, createToggle, extractNormalVNodes, fieldKey, getHighlightChunks, getNearestScrollParent, getScrollParents, injectFormContext, isComment, isFragment, isTemplate, isTextNode, makeBEM, middleProxy, nextFrame, provideFormContext, removeClass, removeStyles, scrollIntoContainerView, setStyles, shallowComputed, withUnit, zIndex };
|
|
@@ -35,7 +35,7 @@ interface FormComponentProps extends ComponentProps {
|
|
|
35
35
|
/** 在表单控件内时的提示 */
|
|
36
36
|
tips?: string;
|
|
37
37
|
/** 所占列的大小 */
|
|
38
|
-
span?: number | 'full' | ({ [key in BreakpointName]?: 'full' | number } & {
|
|
38
|
+
span?: number | 'full' | ({ [key in BreakpointName]?: 'full' | number; } & {
|
|
39
39
|
default: number | 'full';
|
|
40
40
|
});
|
|
41
41
|
/** 表单标签文字 */
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ComponentSize } from "./component-common.js";
|
|
2
|
-
|
|
3
2
|
//#region src/types/form-context.d.ts
|
|
4
3
|
interface FormContextModel {
|
|
5
4
|
errors: Map<any, string[] | undefined>;
|
|
@@ -29,16 +28,23 @@ interface FormFieldItem {
|
|
|
29
28
|
clearValidate?: () => void;
|
|
30
29
|
}
|
|
31
30
|
type DIContext = {
|
|
32
|
-
/** 表单属性 */
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
/** 表单属性 */
|
|
32
|
+
formProps: FormPropsLike;
|
|
33
|
+
/** 注册表单字段 */
|
|
34
|
+
registerField: (field: string, item: FormFieldItem) => void;
|
|
35
|
+
/** 注销表单字段 */
|
|
36
|
+
unregisterField: (field: string) => void;
|
|
37
|
+
/** 校验指定字段,未传 keys 时校验全部已注册字段 */
|
|
38
|
+
validateFields?: (keys?: string[]) => Promise<boolean>;
|
|
39
|
+
/** 是否需要校验 */
|
|
40
|
+
shouldValidate?: () => boolean;
|
|
41
|
+
/** 处理字段值变化 */
|
|
37
42
|
handleFieldChange: (field: string, value: any) => void;
|
|
38
43
|
};
|
|
39
44
|
declare function provideFormContext(context: DIContext): void;
|
|
40
45
|
declare function injectFormContext(): {
|
|
41
|
-
/** 是否在表单中 */
|
|
46
|
+
/** 是否在表单中 */
|
|
47
|
+
inForm: boolean;
|
|
42
48
|
} & Partial<DIContext>;
|
|
43
49
|
//#endregion
|
|
44
50
|
export { FormContextModel, FormContextProps, FormFieldItem, injectFormContext, provideFormContext };
|
package/dist/types/helper.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { VNode } from "vue";
|
|
2
|
-
|
|
3
2
|
//#region src/types/helper.d.ts
|
|
4
3
|
type Null<T> = null | T;
|
|
5
4
|
type Undef<T> = undefined | T;
|
|
@@ -10,9 +9,9 @@ interface DefineEvent<T = HTMLElement> extends Omit<Event, 'target'> {
|
|
|
10
9
|
/** 解构VueExpose中被引用的实例 */
|
|
11
10
|
type DeconstructValue<E extends Record<string, any>> = { [K in keyof E]: E[K] extends {
|
|
12
11
|
value: infer V;
|
|
13
|
-
} ? V : E[K] };
|
|
12
|
+
} ? V : E[K]; };
|
|
14
13
|
/** 索引类型 */
|
|
15
|
-
type Index<Keys extends string, Val> = { [key in Keys]?: Val };
|
|
14
|
+
type Index<Keys extends string, Val> = { [key in Keys]?: Val; };
|
|
16
15
|
/**
|
|
17
16
|
* 渲染函数返回内容
|
|
18
17
|
*/
|
package/package.json
CHANGED