@blueking/bkui-form 0.0.42-beta.11 → 0.0.42-beta.13
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/adapter/vue2/common/FieldGroupWrap.d.ts +1 -0
- package/dist/bkui-form-es-min.js +6 -6
- package/dist/bkui-form-es.js +246 -220
- package/dist/bkui-form-es.js.map +1 -1
- package/dist/bkui-form-umd-min.js +6 -6
- package/dist/bkui-form-umd.js +246 -220
- package/dist/bkui-form-umd.js.map +1 -1
- package/dist/bkui-form.css +4 -1
- package/dist/controller/form-vue2.d.ts +5 -3
- package/dist/core/reaction.d.ts +2 -1
- package/dist/core/validator.d.ts +6 -5
- package/dist/core/widgetTree.d.ts +1 -2
- package/dist/types/bkui-form.d.ts +44 -4
- package/package.json +1 -1
package/dist/bkui-form.css
CHANGED
|
@@ -81,7 +81,10 @@
|
|
|
81
81
|
font-weight: 600;
|
|
82
82
|
color: #63656E;
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
.bk-schema-form .bk-schema-form-group .has-desc{
|
|
85
|
+
border-bottom: 1px dashed #979ba5;
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
}
|
|
85
88
|
.bk-schema-form .bk-schema-form-group .bk-schema-form-group-title.default {
|
|
86
89
|
display: inline-block;
|
|
87
90
|
margin-bottom: 10px;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { IFormOption } from '@/@types';
|
|
2
2
|
import Vue from 'vue';
|
|
3
3
|
import './form-vue2.css';
|
|
4
|
+
import { WidgetTree } from '@/core/widgetTree';
|
|
4
5
|
export default function createForm<T>(opts?: Partial<IFormOption<T>>): import("vue/types/vue").ExtendedVue<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, any>>, {
|
|
5
6
|
rootData: {};
|
|
6
7
|
formKey: string;
|
|
8
|
+
widgetTree: WidgetTree;
|
|
7
9
|
}, {
|
|
8
10
|
initFormData(): void;
|
|
9
11
|
emitFormValueChange(newValue: any, oldValue: any): void;
|
|
10
|
-
validateForm
|
|
11
|
-
validateFormItem
|
|
12
|
-
validate
|
|
12
|
+
validateForm(): boolean;
|
|
13
|
+
validateFormItem(path: string): import("@/@types").IValidateResult;
|
|
14
|
+
validate(): Promise<import("@/@types").IValidateResult[]>;
|
|
13
15
|
validateSchema: (schema: import("ajv").AnySchema) => Promise<unknown>;
|
|
14
16
|
}, unknown, {
|
|
15
17
|
value: any;
|
package/dist/core/reaction.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IReaction } from '../@types';
|
|
2
|
-
|
|
2
|
+
import { WidgetTree } from './widgetTree';
|
|
3
|
+
export declare const reactionRegister: (path: string, reactions: IReaction[] | undefined, widgetTree: WidgetTree) => void;
|
|
3
4
|
export declare const reactionUnRegister: (path: string) => void;
|
|
4
5
|
export declare const reactionDispatch: (path: string, typeName: string) => void;
|
package/dist/core/validator.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Ajv, { AnySchema } from 'ajv';
|
|
2
2
|
import { IRules, IValidateResult } from '@/@types';
|
|
3
|
+
import { WidgetTree } from './widgetTree';
|
|
3
4
|
export declare const ajv: Ajv;
|
|
4
5
|
export declare const DEFAULT_RULES: {
|
|
5
6
|
required: {
|
|
@@ -12,23 +13,23 @@ export declare const DEFAULT_RULES: {
|
|
|
12
13
|
* @param rules
|
|
13
14
|
*/
|
|
14
15
|
export declare const registryGlobalRules: (rules: IRules) => void;
|
|
15
|
-
export declare const setWidgetErrorTips: (path: string, isError: Boolean, errorMsg: any) => void;
|
|
16
|
+
export declare const setWidgetErrorTips: (path: string, isError: Boolean, errorMsg: any, widgetTree: WidgetTree) => void;
|
|
16
17
|
/**
|
|
17
18
|
* 校验单个表单项
|
|
18
19
|
* @param path 字段路径
|
|
19
20
|
*/
|
|
20
|
-
export declare const validateFormItem: (path: string) => IValidateResult;
|
|
21
|
+
export declare const validateFormItem: (path: string, widgetTree: WidgetTree) => IValidateResult;
|
|
21
22
|
/**
|
|
22
23
|
* 校验整个表单
|
|
23
24
|
*/
|
|
24
|
-
export declare const validateForm: () => boolean;
|
|
25
|
+
export declare const validateForm: (widgetTree: WidgetTree) => boolean;
|
|
25
26
|
/**
|
|
26
27
|
* 校验表单(抛出具体错误信息)
|
|
27
28
|
*/
|
|
28
|
-
export declare const validateFormWithResult: () => Promise<IValidateResult[]>;
|
|
29
|
+
export declare const validateFormWithResult: (widgetTree: WidgetTree) => Promise<IValidateResult[]>;
|
|
29
30
|
export declare const validateSchema: (schema: AnySchema) => Promise<unknown>;
|
|
30
31
|
/**
|
|
31
32
|
* 触发校验
|
|
32
33
|
* @param path 字段路径
|
|
33
34
|
*/
|
|
34
|
-
export declare const dispatchValidate: (path: string) => IValidateResult;
|
|
35
|
+
export declare const dispatchValidate: (path: string, widgetTree: WidgetTree) => IValidateResult;
|
|
@@ -36,5 +36,4 @@ export declare class WidgetTree {
|
|
|
36
36
|
addWidgetNode(path: string, instance: any, type: 'node' | 'group', index?: number): void;
|
|
37
37
|
removeWidgetNode(path: string, instance: any): void;
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
export default _default;
|
|
39
|
+
export {};
|
|
@@ -32,18 +32,58 @@ interface IValidateResult {
|
|
|
32
32
|
path: string
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
var css_248z = ".bk-schema-form .mr24 {\n margin-right: 24px;\n}\n\n.bk-schema-form .bk-form-item {\n margin-top: unset !important;\n}\n\n.bk-schema-form .bk-form-item .bk-form-content .group-text {\n background-color: #f2f4f8;\n height: 100%;\n}\n\n.bk-schema-form .bk-form-item .bk-select {\n background-color: #fff;\n}\n\n.bk-schema-form .bk-form-item .bk-select.is-disabled {\n background-color: #fafbfd;\n}\n\n.bk-schema-form .bk-schema-form-group.normal {\n padding: 24px;\n position: relative;\n}\n\n.bk-schema-form .bk-schema-form-group.card{\n background: #fff;\n padding: 0 24px 24px 24px;\n border-radius: 2px;\n}\n\n.bk-schema-form .bk-schema-form-group.hide-empty-row .bk-schema-form-group-content {\n row-gap: 0 !important;\n}\n\n.bk-schema-form .bk-schema-form-group.hide-empty-row .bk-schema-form-group-content .bk-form-item {\n margin-bottom: 20px;\n}\n\n.bk-schema-form-group--error{\n border-color: #f5222d !important;\n}\n\n.bk-schema-form-group__error-tips{\n position: relative;\n display: block;\n width: 10px;\n height: 10px;\n}\n\n.bk-schema-form-group__error-tips-popover {\n position: absolute;\n top: -5px;\n left: 0;\n z-index: 1;\n background: #fff;\n border: 1px solid #f5222d;\n color: #f5222d;\n font-size: 12px;\n margin-left: 10px;\n font-weight: normal;\n padding: 5px 10px;\n border-radius: 2px;\n max-height: 50px;\n overflow:hidden;\n}\n\n.bk-schema-form-group__error-tips-popover:hover {\n max-height: unset;\n}\n\n.bk-schema-form-group__error-tips-popover > p {\n padding: 0;\n margin: 0;\n white-space: nowrap;\n}\n\n.bk-schema-form .bk-schema-form-group .bk-schema-form-group-title {\n font-size: 14px;\n font-weight: 600;\n color: #63656E;\n}\n\n.bk-schema-form .bk-schema-form-group .bk-schema-form-group-title.default {\n display: inline-block;\n margin-bottom: 10px;\n}\n\n.bk-schema-form .bk-schema-form-group .bk-schema-form-group-title.normal {\n position: absolute;\n top: -1em;\n left: 10px;\n line-height: 2em;\n padding: 0 0.5em;\n background: #fff;\n}\n\n.bk-schema-form .bk-schema-form-group .bk-schema-form-group-title.card{\n display: flex;\n height: 50px;\n align-items: center;\n padding: 0 24px;\n margin: 0 -24px 8px -24px;\n}\n\n.bk-schema-form .bk-collapse.normal .bk-collapse-item .bk-collapse-item-header {\n height: 54px;\n padding: 0;\n}\n\n.bk-schema-form .bk-collapse.normal .bk-collapse-item .bk-collapse-item-content {\n background: #f5f7fa;\n padding: 0 34px 16px 34px;\n}\n\n.bk-schema-form .bk-schema-form-group-add {\n font-size: 14px;\n color: #3a84ff;\n cursor: pointer;\n display: flex;\n align-items: center;\n}\n\n.bk-schema-form .bk-schema-form-group-add.disabled {\n color: #c4c6cc;\n cursor: not-allowed;\n}\n\n.bk-schema-form .bk-schema-form-group-add.readonly {\n color: #c4c6cc;\n}\n\n.bk-schema-form .bk-schema-form-group-delete {\n position: absolute;\n cursor: pointer;\n color: #979bA5;\n}\n\n.bk-schema-form .bk-schema-form-group-delete.disabled {\n color: #c4c6cc;\n cursor: not-allowed;\n}\n\n.bk-schema-form .bk-schema-form-group-delete.readonly {\n color: #c4c6cc;\n}\n\n.bk-schema-form .bk-schema-form-group-delete:hover {\n color: #3a84ff;\n}\n\n.bk-schema-form-item__error-tips {\n color: #f5222d;\n font-size: 12px;\n margin-top: 5px;\n margin: 0;\n line-height: 1.5em;\n}\n\n.bk-schema-form-item--error input,\n.bk-schema-form-item--error .bk-textarea-wrapper,\n.bk-schema-form-item--error .bk-select {\n border: 1px solid #f5222d;\n}\n\n.bk-schema-form .bk-schema-form-group .bk-form-unit-input .bk-textarea-wrapper {\n min-height: 32px;\n}\n\n.bk-schema-form .bk-schema-form-group .bk-form-unit-input textarea {\n min-height: 30px;\n}\n\n.bk-schema-form .bk-schema-form-item-auto-height .bk-form-content {\n min-height: auto;\n line-height: 1;\n}\n\n.bk-schema-form .table-widget-actions .action-btn {\n margin-right: 8px;\n font-size: 14px;\n cursor: pointer;\n}\n.bk-schema-form .table-widget-actions .action-btn:hover {\n color: #3a84ff;\n}\n.bk-schema-form .is-disabled .action-btn {\n color: #dcdee5 !important;\n cursor: not-allowed;\n}\n.bk-schema-form .bk-table-fixed-right {\n height: 100% !important;\n border-bottom: 1px solid #dfe0e5;\n}";
|
|
35
|
+
var css_248z = ".bk-schema-form .mr24 {\n margin-right: 24px;\n}\n\n.bk-schema-form .bk-form-item {\n margin-top: unset !important;\n}\n\n.bk-schema-form .bk-form-item .bk-form-content .group-text {\n background-color: #f2f4f8;\n height: 100%;\n}\n\n.bk-schema-form .bk-form-item .bk-select {\n background-color: #fff;\n}\n\n.bk-schema-form .bk-form-item .bk-select.is-disabled {\n background-color: #fafbfd;\n}\n\n.bk-schema-form .bk-schema-form-group.normal {\n padding: 24px;\n position: relative;\n}\n\n.bk-schema-form .bk-schema-form-group.card{\n background: #fff;\n padding: 0 24px 24px 24px;\n border-radius: 2px;\n}\n\n.bk-schema-form .bk-schema-form-group.hide-empty-row .bk-schema-form-group-content {\n row-gap: 0 !important;\n}\n\n.bk-schema-form .bk-schema-form-group.hide-empty-row .bk-schema-form-group-content .bk-form-item {\n margin-bottom: 20px;\n}\n\n.bk-schema-form-group--error{\n border-color: #f5222d !important;\n}\n\n.bk-schema-form-group__error-tips{\n position: relative;\n display: block;\n width: 10px;\n height: 10px;\n}\n\n.bk-schema-form-group__error-tips-popover {\n position: absolute;\n top: -5px;\n left: 0;\n z-index: 1;\n background: #fff;\n border: 1px solid #f5222d;\n color: #f5222d;\n font-size: 12px;\n margin-left: 10px;\n font-weight: normal;\n padding: 5px 10px;\n border-radius: 2px;\n max-height: 50px;\n overflow:hidden;\n}\n\n.bk-schema-form-group__error-tips-popover:hover {\n max-height: unset;\n}\n\n.bk-schema-form-group__error-tips-popover > p {\n padding: 0;\n margin: 0;\n white-space: nowrap;\n}\n\n.bk-schema-form .bk-schema-form-group .bk-schema-form-group-title {\n font-size: 14px;\n font-weight: 600;\n color: #63656E;\n}\n.bk-schema-form .bk-schema-form-group .has-desc{\n border-bottom: 1px dashed #979ba5;\n cursor: pointer;\n}\n.bk-schema-form .bk-schema-form-group .bk-schema-form-group-title.default {\n display: inline-block;\n margin-bottom: 10px;\n}\n\n.bk-schema-form .bk-schema-form-group .bk-schema-form-group-title.normal {\n position: absolute;\n top: -1em;\n left: 10px;\n line-height: 2em;\n padding: 0 0.5em;\n background: #fff;\n}\n\n.bk-schema-form .bk-schema-form-group .bk-schema-form-group-title.card{\n display: flex;\n height: 50px;\n align-items: center;\n padding: 0 24px;\n margin: 0 -24px 8px -24px;\n}\n\n.bk-schema-form .bk-collapse.normal .bk-collapse-item .bk-collapse-item-header {\n height: 54px;\n padding: 0;\n}\n\n.bk-schema-form .bk-collapse.normal .bk-collapse-item .bk-collapse-item-content {\n background: #f5f7fa;\n padding: 0 34px 16px 34px;\n}\n\n.bk-schema-form .bk-schema-form-group-add {\n font-size: 14px;\n color: #3a84ff;\n cursor: pointer;\n display: flex;\n align-items: center;\n}\n\n.bk-schema-form .bk-schema-form-group-add.disabled {\n color: #c4c6cc;\n cursor: not-allowed;\n}\n\n.bk-schema-form .bk-schema-form-group-add.readonly {\n color: #c4c6cc;\n}\n\n.bk-schema-form .bk-schema-form-group-delete {\n position: absolute;\n cursor: pointer;\n color: #979bA5;\n}\n\n.bk-schema-form .bk-schema-form-group-delete.disabled {\n color: #c4c6cc;\n cursor: not-allowed;\n}\n\n.bk-schema-form .bk-schema-form-group-delete.readonly {\n color: #c4c6cc;\n}\n\n.bk-schema-form .bk-schema-form-group-delete:hover {\n color: #3a84ff;\n}\n\n.bk-schema-form-item__error-tips {\n color: #f5222d;\n font-size: 12px;\n margin-top: 5px;\n margin: 0;\n line-height: 1.5em;\n}\n\n.bk-schema-form-item--error input,\n.bk-schema-form-item--error .bk-textarea-wrapper,\n.bk-schema-form-item--error .bk-select {\n border: 1px solid #f5222d;\n}\n\n.bk-schema-form .bk-schema-form-group .bk-form-unit-input .bk-textarea-wrapper {\n min-height: 32px;\n}\n\n.bk-schema-form .bk-schema-form-group .bk-form-unit-input textarea {\n min-height: 30px;\n}\n\n.bk-schema-form .bk-schema-form-item-auto-height .bk-form-content {\n min-height: auto;\n line-height: 1;\n}\n\n.bk-schema-form .table-widget-actions .action-btn {\n margin-right: 8px;\n font-size: 14px;\n cursor: pointer;\n}\n.bk-schema-form .table-widget-actions .action-btn:hover {\n color: #3a84ff;\n}\n.bk-schema-form .is-disabled .action-btn {\n color: #dcdee5 !important;\n cursor: not-allowed;\n}\n.bk-schema-form .bk-table-fixed-right {\n height: 100% !important;\n border-bottom: 1px solid #dfe0e5;\n}";
|
|
36
36
|
styleInject(css_248z);
|
|
37
37
|
|
|
38
|
+
interface INodeConfig {
|
|
39
|
+
id: string;
|
|
40
|
+
type: 'node' | 'group';
|
|
41
|
+
index?: number;
|
|
42
|
+
instance: any;
|
|
43
|
+
parent: WidgetNode | null;
|
|
44
|
+
children: WidgetNode[];
|
|
45
|
+
}
|
|
46
|
+
declare class WidgetNode {
|
|
47
|
+
id: string;
|
|
48
|
+
instance: any;
|
|
49
|
+
parent: WidgetNode | null;
|
|
50
|
+
type: 'node' | 'group';
|
|
51
|
+
index?: number;
|
|
52
|
+
children: WidgetNode[];
|
|
53
|
+
constructor(config: INodeConfig);
|
|
54
|
+
get value(): any;
|
|
55
|
+
get isChildrenVisible(): any;
|
|
56
|
+
/**
|
|
57
|
+
* 获取 parents
|
|
58
|
+
*/
|
|
59
|
+
get parents(): any[];
|
|
60
|
+
get firstChild(): WidgetNode;
|
|
61
|
+
get lastChild(): WidgetNode;
|
|
62
|
+
getSibling(lastProp: string): WidgetNode | undefined;
|
|
63
|
+
getSiblings(): WidgetNode[];
|
|
64
|
+
/**
|
|
65
|
+
* 是否是叶子节点
|
|
66
|
+
*/
|
|
67
|
+
get isLeaf(): boolean;
|
|
68
|
+
appendChild(node: WidgetNode): WidgetNode[] | (WidgetNode & any[]);
|
|
69
|
+
removeChild(node: WidgetNode): WidgetNode[] | (WidgetNode & any[]);
|
|
70
|
+
}
|
|
71
|
+
declare class WidgetTree {
|
|
72
|
+
widgetMap: Record<string, WidgetNode>;
|
|
73
|
+
addWidgetNode(path: string, instance: any, type: 'node' | 'group', index?: number): void;
|
|
74
|
+
removeWidgetNode(path: string, instance: any): void;
|
|
75
|
+
}
|
|
76
|
+
|
|
38
77
|
declare function createForm<T>(opts?: Partial<IFormOption<T>>): vue_types_vue.ExtendedVue<Vue__default<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue__default<Record<string, any>, Record<string, any>, never, never, any>>, {
|
|
39
78
|
rootData: {};
|
|
40
79
|
formKey: string;
|
|
80
|
+
widgetTree: WidgetTree;
|
|
41
81
|
}, {
|
|
42
82
|
initFormData(): void;
|
|
43
83
|
emitFormValueChange(newValue: any, oldValue: any): void;
|
|
44
|
-
validateForm
|
|
45
|
-
validateFormItem
|
|
46
|
-
validate
|
|
84
|
+
validateForm(): boolean;
|
|
85
|
+
validateFormItem(path: string): IValidateResult;
|
|
86
|
+
validate(): Promise<IValidateResult[]>;
|
|
47
87
|
validateSchema: (schema: ajv.AnySchema) => Promise<unknown>;
|
|
48
88
|
}, unknown, {
|
|
49
89
|
value: any;
|
package/package.json
CHANGED