@blueking/bkui-form 0.0.29 → 0.0.30

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.
@@ -0,0 +1,160 @@
1
+ .bk-schema-form .mr24 {
2
+ margin-right: 24px;
3
+ }
4
+
5
+ .bk-schema-form .bk-form-item {
6
+ margin-top: unset !important;
7
+ }
8
+
9
+ .bk-schema-form .bk-form-item .bk-form-content .group-text {
10
+ background-color: #f2f4f8;
11
+ height: 100%;
12
+ }
13
+
14
+ .bk-schema-form .bk-form-item .bk-select {
15
+ background-color: #fff;
16
+ }
17
+
18
+ .bk-schema-form .bk-form-item .bk-select.is-disabled {
19
+ background-color: #fafbfd;
20
+ }
21
+
22
+ .bk-schema-form .bk-schema-form-group.normal {
23
+ padding: 24px;
24
+ position: relative;
25
+ }
26
+
27
+ .bk-schema-form .bk-schema-form-group.card{
28
+ background: #fff;
29
+ padding: 0 24px 24px 24px;
30
+ border-radius: 2px;
31
+ }
32
+
33
+ .bk-schema-form .bk-schema-form-group.hide-empty-row .bk-schema-form-group-content {
34
+ row-gap: 0 !important;
35
+ }
36
+
37
+ .bk-schema-form .bk-schema-form-group.hide-empty-row .bk-schema-form-group-content .bk-form-item {
38
+ margin-bottom: 20px;
39
+ }
40
+
41
+ .bk-schema-form-group--error{
42
+ border-color: #f5222d !important;
43
+ }
44
+
45
+ .bk-schema-form-group__error-tips{
46
+ position: relative;
47
+ display: block;
48
+ width: 10px;
49
+ height: 10px;
50
+ }
51
+
52
+ .bk-schema-form-group__error-tips-popover {
53
+ position: absolute;
54
+ top: -5px;
55
+ left: 0;
56
+ z-index: 1;
57
+ background: #fff;
58
+ border: 1px solid #f5222d;
59
+ color: #f5222d;
60
+ font-size: 12px;
61
+ margin-left: 10px;
62
+ font-weight: normal;
63
+ padding: 5px 10px;
64
+ border-radius: 2px;
65
+ max-height: 50px;
66
+ overflow:hidden;
67
+ }
68
+
69
+ .bk-schema-form-group__error-tips-popover:hover {
70
+ max-height: unset;
71
+ }
72
+
73
+ .bk-schema-form-group__error-tips-popover > p {
74
+ padding: 0;
75
+ margin: 0;
76
+ white-space: nowrap;
77
+ }
78
+
79
+ .bk-schema-form .bk-schema-form-group .bk-schema-form-group-title {
80
+ font-size: 14px;
81
+ font-weight: 600;
82
+ color: #63656E;
83
+ }
84
+
85
+ .bk-schema-form .bk-schema-form-group .bk-schema-form-group-title.default {
86
+ display: inline-block;
87
+ margin-bottom: 10px;
88
+ }
89
+
90
+ .bk-schema-form .bk-schema-form-group .bk-schema-form-group-title.normal {
91
+ position: absolute;
92
+ top: -1em;
93
+ left: 10px;
94
+ line-height: 2em;
95
+ padding: 0 0.5em;
96
+ background: #fff;
97
+ }
98
+
99
+ .bk-schema-form .bk-schema-form-group .bk-schema-form-group-title.card{
100
+ display: flex;
101
+ height: 50px;
102
+ align-items: center;
103
+ padding: 0 24px;
104
+ margin: 0 -24px 8px -24px;
105
+ }
106
+
107
+ .bk-schema-form .bk-collapse-item .bk-collapse-item-header {
108
+ height: 54px;
109
+ padding: 0;
110
+ }
111
+
112
+ .bk-schema-form .bk-collapse-item .bk-collapse-item-content {
113
+ background: #f5f7fa;
114
+ padding: 0 34px 16px 34px;
115
+ }
116
+
117
+ .bk-schema-form .bk-schema-form-group-add {
118
+ font-size: 14px;
119
+ color: #3a84ff;
120
+ cursor: pointer;
121
+ display: flex;
122
+ align-items: center;
123
+ }
124
+
125
+ .bk-schema-form .bk-schema-form-group-delete {
126
+ position: absolute;
127
+ cursor: pointer;
128
+ color: #979bA5;
129
+ }
130
+
131
+ .bk-schema-form .bk-schema-form-group-delete:hover {
132
+ color: #3a84ff;
133
+ }
134
+
135
+ .bk-schema-form-item__error-tips {
136
+ color: #f5222d;
137
+ font-size: 12px;
138
+ margin-top: 5px;
139
+ margin: 0;
140
+ line-height: 1.5em;
141
+ }
142
+
143
+ .bk-schema-form-item--error input,
144
+ .bk-schema-form-item--error .bk-textarea-wrapper,
145
+ .bk-schema-form-item--error .bk-select {
146
+ border: 1px solid #f5222d;
147
+ }
148
+
149
+ .bk-schema-form .bk-schema-form-group .bk-form-unit-input .bk-textarea-wrapper {
150
+ min-height: 32px;
151
+ }
152
+
153
+ .bk-schema-form .bk-schema-form-group .bk-form-unit-input textarea {
154
+ min-height: 30px;
155
+ }
156
+
157
+ .bk-schema-form .bk-schema-form-item-auto-height .bk-form-content {
158
+ min-height: auto;
159
+ line-height: 1;
160
+ }
@@ -0,0 +1,94 @@
1
+ import * as vue_types_vue from 'vue/types/vue';
2
+ import * as ajv from 'ajv';
3
+ import * as json_schema from 'json-schema';
4
+ import { JSONSchema6TypeName, JSONSchema7 } from 'json-schema';
5
+ import Vue, { VNodeData } from 'vue';
6
+ import styleInject from '../node_modules/style-inject/dist/style-inject.es.js';
7
+
8
+ type GlobalComponents = any;
9
+ interface IFormOption<T> {
10
+ // 组件命名空间,默认bk
11
+ namespace: string;
12
+ // Schema表单依赖的基础组件
13
+ baseWidgets?: {};
14
+ // 内置的自定义表单组件(包装特定逻辑后的别名)
15
+ components: {
16
+ [k in GlobalComponents]: T
17
+ };
18
+ // schema type对应的field类型
19
+ fields: {
20
+ [k in JSONSchema6TypeName | 'composition']: T;
21
+ }
22
+ }
23
+
24
+ interface IUIComponent extends VNodeData {
25
+ name: any;
26
+ }
27
+
28
+ interface IValidateResult {
29
+ result: boolean
30
+ message: string | undefined
31
+ path: string
32
+ }
33
+
34
+ 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-item .bk-collapse-item-header {\n height: 54px;\n padding: 0;\n}\n\n.bk-schema-form .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-delete {\n position: absolute;\n cursor: pointer;\n color: #979bA5;\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}";
35
+ styleInject(css_248z);
36
+
37
+ declare function createForm<T>(opts?: Partial<IFormOption<T>>): vue_types_vue.ExtendedVue<Vue, {
38
+ rootData: {};
39
+ formKey: string;
40
+ }, {
41
+ initFormData(): void;
42
+ emitFormValueChange(newValue: any, oldValue: any): void;
43
+ validateForm: () => boolean;
44
+ validateFormItem: (path: string) => IValidateResult;
45
+ validate: () => Promise<IValidateResult[]>;
46
+ validateSchema: (schema: ajv.AnySchema) => Promise<unknown>;
47
+ }, unknown, {
48
+ value: any;
49
+ rules: any;
50
+ schema: any;
51
+ width: string | number;
52
+ layout: any;
53
+ formType: string;
54
+ context: any;
55
+ httpAdapter: any;
56
+ readonly: boolean;
57
+ readonlyMode: any;
58
+ labelWidth: number;
59
+ }>;
60
+
61
+ declare class FormEvent {
62
+ callbacks: Record<string, Record<string, Array<Function>>>;
63
+ constructor();
64
+ on(path: string, type: string, cb: Function): this;
65
+ off(path: string, type: string, cb: Function): this;
66
+ once(path: string, type: string, cb: Function): this;
67
+ emit(path: string, type: string, ...arg: any[]): void;
68
+ }
69
+ declare const _default: FormEvent;
70
+
71
+ declare class Schema {
72
+ static rootSchema: JSONSchema7;
73
+ static resolveRef(): void;
74
+ static resolveDependencies(): void;
75
+ static resolveAdditionalProperties(): void;
76
+ static resolveSchema(schema: JSONSchema7): JSONSchema7;
77
+ static getSchemaDefaultValue(_schema: JSONSchema7): any;
78
+ static getSchemaType(schema: JSONSchema7): string;
79
+ static getUiProps(props: string, schema: JSONSchema7): Partial<IUIComponent>;
80
+ static getSchemaField(schema: JSONSchema7): Partial<IUIComponent>;
81
+ static isMultiSelect(schema: JSONSchema7): boolean;
82
+ static isTupleArray(schema: JSONSchema7): boolean;
83
+ static isCustomArrayWidget(schema: JSONSchema7): any;
84
+ static getGroupWrap(schema: JSONSchema7): Partial<IUIComponent>;
85
+ static getUiComponent(schema: JSONSchema7): Partial<IUIComponent>;
86
+ static getDefaultWidget(schema: JSONSchema7): string | object | null;
87
+ static isRequired(schema: JSONSchema7, name: string): boolean;
88
+ static getUiOptions(schema: JSONSchema7): any;
89
+ static getDependencies(schema: JSONSchema7, name: string): [string, string[] | json_schema.JSONSchema7Definition] | undefined;
90
+ static resolveDefaultDatasource(schema: JSONSchema7): any;
91
+ constructor(rootSchema: any);
92
+ }
93
+
94
+ export { Schema, createForm as default, _default as events };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.29",
2
+ "version": "0.0.30",
3
3
  "main": "dist/bkui-form-umd-min.js",
4
4
  "name": "@blueking/bkui-form",
5
5
  "scripts": {