@blueking/bkui-form 1.0.1-beta.3 → 1.0.1-beta.4
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/common/FieldGroupWrap.d.ts +209 -0
- package/dist/adapter/field/ArrayField.d.ts +147 -0
- package/dist/adapter/field/BooleanField.d.ts +145 -0
- package/dist/adapter/field/CompositionField.d.ts +151 -0
- package/dist/adapter/field/FieldProps.d.ts +70 -0
- package/dist/adapter/field/NumberField.d.ts +145 -0
- package/dist/adapter/field/ObjectField.d.ts +147 -0
- package/dist/adapter/field/SchemaField.d.ts +145 -0
- package/dist/adapter/field/StringField.d.ts +4 -0
- package/dist/adapter/widget/ArrayWidget.d.ts +154 -0
- package/dist/adapter/widget/ButtonWidget.d.ts +16 -0
- package/dist/adapter/widget/CheckboxWidget.d.ts +34 -0
- package/dist/adapter/widget/CollapseGroupWidget.d.ts +196 -0
- package/dist/adapter/widget/ColorPickerWidget.d.ts +8 -0
- package/dist/adapter/widget/InputWidget.d.ts +30 -0
- package/dist/adapter/widget/KeyValueArrayWidget.d.ts +157 -0
- package/dist/adapter/widget/RadioWidget.d.ts +37 -0
- package/dist/adapter/widget/SelectWidget.d.ts +37 -0
- package/dist/adapter/widget/SwitchWidget.d.ts +10 -0
- package/dist/adapter/widget/TabGroupWidget.d.ts +187 -0
- package/dist/adapter/widget/TableWidget.d.ts +154 -0
- package/dist/adapter/widget/Widget.d.ts +182 -0
- package/dist/controller/form.d.ts +141 -0
- package/dist/controller/props.d.ts +62 -0
- package/dist/core/events.d.ts +10 -0
- package/dist/core/expression.d.ts +13 -0
- package/dist/core/form.d.ts +5 -0
- package/dist/core/lang.d.ts +1 -0
- package/dist/core/layout.d.ts +20 -0
- package/dist/core/lifecycle.d.ts +0 -0
- package/dist/core/path.d.ts +9 -0
- package/dist/core/proxy.d.ts +3 -0
- package/dist/core/reaction.d.ts +5 -0
- package/dist/core/register.d.ts +19 -0
- package/dist/core/schema.d.ts +26 -0
- package/dist/core/validator.d.ts +35 -0
- package/dist/core/widgetTree.d.ts +40 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.es.js +7443 -0
- package/dist/index.umd.js +12 -0
- package/dist/style.css +1 -0
- package/dist/util/fetch.d.ts +10 -0
- package/dist/util/index.d.ts +23 -0
- package/package.json +24 -12
- package/esm/adapter/common/FieldGroupWrap.tsx.js +0 -199
- package/esm/adapter/field/ArrayField.tsx.js +0 -55
- package/esm/adapter/field/BooleanField.tsx.js +0 -41
- package/esm/adapter/field/CompositionField.tsx.js +0 -113
- package/esm/adapter/field/FieldProps.ts.js +0 -85
- package/esm/adapter/field/NumberField.tsx.js +0 -19
- package/esm/adapter/field/ObjectField.tsx.js +0 -58
- package/esm/adapter/field/SchemaField.tsx.js +0 -28
- package/esm/adapter/field/StringField.tsx.js +0 -4
- package/esm/adapter/widget/ArrayWidget.ts.js +0 -196
- package/esm/adapter/widget/ButtonWidget.ts.js +0 -76
- package/esm/adapter/widget/CheckboxWidget.ts.js +0 -101
- package/esm/adapter/widget/CollapseGroupWidget.ts.js +0 -140
- package/esm/adapter/widget/ColorPickerWidget.ts.js +0 -71
- package/esm/adapter/widget/InputWidget.ts.js +0 -79
- package/esm/adapter/widget/KeyValueArrayWidget.tsx.js +0 -156
- package/esm/adapter/widget/RadioWidget.ts.js +0 -98
- package/esm/adapter/widget/SelectWidget.ts.js +0 -98
- package/esm/adapter/widget/SwitchWidget.ts.js +0 -73
- package/esm/adapter/widget/TabGroupWidget.ts.js +0 -145
- package/esm/adapter/widget/TableWidget.ts.js +0 -205
- package/esm/adapter/widget/Widget.ts.js +0 -497
- package/esm/assets/fonts/iconcool.eot +0 -0
- package/esm/assets/fonts/iconcool.svg +0 -53
- package/esm/assets/fonts/iconcool.ttf +0 -0
- package/esm/assets/fonts/iconcool.woff +0 -0
- package/esm/assets/style.css +0 -43
- package/esm/controller/form.css +0 -164
- package/esm/controller/form.tsx.js +0 -159
- package/esm/controller/props.ts.js +0 -75
- package/esm/core/events.ts.js +0 -74
- package/esm/core/expression.ts.js +0 -67
- package/esm/core/lang.ts.js +0 -25
- package/esm/core/layout.ts.js +0 -149
- package/esm/core/path.ts.js +0 -60
- package/esm/core/proxy.ts.js +0 -10
- package/esm/core/reaction.ts.js +0 -116
- package/esm/core/register.ts.js +0 -74
- package/esm/core/schema.ts.js +0 -302
- package/esm/core/validator.ts.js +0 -248
- package/esm/core/widgetTree.ts.js +0 -163
- package/esm/index.ts.js +0 -6
- package/esm/node_modules/@blueking/cli-service/dist/lib/path.js +0 -35
- package/esm/node_modules/@blueking/cli-service/dist/lib/util.js +0 -233
- package/esm/node_modules/@blueking/cli-service/dist/tools/rust/helper/path.js +0 -172
- package/esm/node_modules/ajv/dist/ajv.js +0 -50
- package/esm/node_modules/ajv/dist/compile/codegen/code.js +0 -156
- package/esm/node_modules/ajv/dist/compile/codegen/index.js +0 -697
- package/esm/node_modules/ajv/dist/compile/codegen/scope.js +0 -143
- package/esm/node_modules/ajv/dist/compile/errors.js +0 -123
- package/esm/node_modules/ajv/dist/compile/index.js +0 -242
- package/esm/node_modules/ajv/dist/compile/names.js +0 -28
- package/esm/node_modules/ajv/dist/compile/ref_error.js +0 -12
- package/esm/node_modules/ajv/dist/compile/resolve.js +0 -155
- package/esm/node_modules/ajv/dist/compile/rules.js +0 -26
- package/esm/node_modules/ajv/dist/compile/util.js +0 -178
- package/esm/node_modules/ajv/dist/compile/validate/applicability.js +0 -19
- package/esm/node_modules/ajv/dist/compile/validate/boolSchema.js +0 -50
- package/esm/node_modules/ajv/dist/compile/validate/dataType.js +0 -203
- package/esm/node_modules/ajv/dist/compile/validate/defaults.js +0 -35
- package/esm/node_modules/ajv/dist/compile/validate/index.js +0 -520
- package/esm/node_modules/ajv/dist/compile/validate/keyword.js +0 -124
- package/esm/node_modules/ajv/dist/compile/validate/subschema.js +0 -81
- package/esm/node_modules/ajv/dist/core.js +0 -618
- package/esm/node_modules/ajv/dist/refs/data.json +0 -13
- package/esm/node_modules/ajv/dist/refs/json-schema-draft-07.json +0 -151
- package/esm/node_modules/ajv/dist/runtime/equal.js +0 -7
- package/esm/node_modules/ajv/dist/runtime/ucs2length.js +0 -24
- package/esm/node_modules/ajv/dist/runtime/uri.js +0 -6
- package/esm/node_modules/ajv/dist/runtime/validation_error.js +0 -11
- package/esm/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +0 -49
- package/esm/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +0 -106
- package/esm/node_modules/ajv/dist/vocabularies/applicator/allOf.js +0 -23
- package/esm/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +0 -12
- package/esm/node_modules/ajv/dist/vocabularies/applicator/contains.js +0 -95
- package/esm/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +0 -85
- package/esm/node_modules/ajv/dist/vocabularies/applicator/if.js +0 -66
- package/esm/node_modules/ajv/dist/vocabularies/applicator/index.js +0 -44
- package/esm/node_modules/ajv/dist/vocabularies/applicator/items.js +0 -52
- package/esm/node_modules/ajv/dist/vocabularies/applicator/items2020.js +0 -30
- package/esm/node_modules/ajv/dist/vocabularies/applicator/not.js +0 -26
- package/esm/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +0 -60
- package/esm/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +0 -75
- package/esm/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +0 -12
- package/esm/node_modules/ajv/dist/vocabularies/applicator/properties.js +0 -54
- package/esm/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +0 -38
- package/esm/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +0 -13
- package/esm/node_modules/ajv/dist/vocabularies/code.js +0 -131
- package/esm/node_modules/ajv/dist/vocabularies/core/id.js +0 -10
- package/esm/node_modules/ajv/dist/vocabularies/core/index.js +0 -16
- package/esm/node_modules/ajv/dist/vocabularies/core/ref.js +0 -122
- package/esm/node_modules/ajv/dist/vocabularies/discriminator/index.js +0 -104
- package/esm/node_modules/ajv/dist/vocabularies/discriminator/types.js +0 -9
- package/esm/node_modules/ajv/dist/vocabularies/draft7.js +0 -17
- package/esm/node_modules/ajv/dist/vocabularies/format/format.js +0 -92
- package/esm/node_modules/ajv/dist/vocabularies/format/index.js +0 -6
- package/esm/node_modules/ajv/dist/vocabularies/metadata.js +0 -18
- package/esm/node_modules/ajv/dist/vocabularies/validation/const.js +0 -25
- package/esm/node_modules/ajv/dist/vocabularies/validation/enum.js +0 -48
- package/esm/node_modules/ajv/dist/vocabularies/validation/index.js +0 -33
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitItems.js +0 -24
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitLength.js +0 -27
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +0 -27
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +0 -24
- package/esm/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +0 -26
- package/esm/node_modules/ajv/dist/vocabularies/validation/pattern.js +0 -24
- package/esm/node_modules/ajv/dist/vocabularies/validation/required.js +0 -79
- package/esm/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +0 -64
- package/esm/node_modules/ajv-formats/dist/formats.js +0 -173
- package/esm/node_modules/ajv-formats/dist/index.js +0 -37
- package/esm/node_modules/ajv-formats/dist/limit.js +0 -69
- package/esm/node_modules/ajv-i18n/localize/zh/index.js +0 -154
- package/esm/node_modules/fast-deep-equal/index.js +0 -46
- package/esm/node_modules/fast-uri/index.js +0 -303
- package/esm/node_modules/fast-uri/lib/schemes.js +0 -188
- package/esm/node_modules/fast-uri/lib/scopedChars.js +0 -30
- package/esm/node_modules/fast-uri/lib/utils.js +0 -244
- package/esm/node_modules/json-schema-traverse/index.js +0 -89
- package/esm/node_modules/semver/classes/comparator.js +0 -143
- package/esm/node_modules/semver/classes/range.js +0 -557
- package/esm/node_modules/semver/classes/semver.js +0 -333
- package/esm/node_modules/semver/functions/clean.js +0 -8
- package/esm/node_modules/semver/functions/cmp.js +0 -54
- package/esm/node_modules/semver/functions/coerce.js +0 -62
- package/esm/node_modules/semver/functions/compare-build.js +0 -9
- package/esm/node_modules/semver/functions/compare-loose.js +0 -5
- package/esm/node_modules/semver/functions/compare.js +0 -7
- package/esm/node_modules/semver/functions/diff.js +0 -60
- package/esm/node_modules/semver/functions/eq.js +0 -5
- package/esm/node_modules/semver/functions/gt.js +0 -5
- package/esm/node_modules/semver/functions/gte.js +0 -5
- package/esm/node_modules/semver/functions/inc.js +0 -21
- package/esm/node_modules/semver/functions/lt.js +0 -5
- package/esm/node_modules/semver/functions/lte.js +0 -5
- package/esm/node_modules/semver/functions/major.js +0 -5
- package/esm/node_modules/semver/functions/minor.js +0 -5
- package/esm/node_modules/semver/functions/neq.js +0 -5
- package/esm/node_modules/semver/functions/parse.js +0 -18
- package/esm/node_modules/semver/functions/patch.js +0 -5
- package/esm/node_modules/semver/functions/prerelease.js +0 -8
- package/esm/node_modules/semver/functions/rcompare.js +0 -5
- package/esm/node_modules/semver/functions/rsort.js +0 -5
- package/esm/node_modules/semver/functions/satisfies.js +0 -12
- package/esm/node_modules/semver/functions/sort.js +0 -5
- package/esm/node_modules/semver/functions/valid.js +0 -8
- package/esm/node_modules/semver/index.js +0 -91
- package/esm/node_modules/semver/internal/constants.js +0 -37
- package/esm/node_modules/semver/internal/debug.js +0 -11
- package/esm/node_modules/semver/internal/identifiers.js +0 -29
- package/esm/node_modules/semver/internal/lrucache.js +0 -42
- package/esm/node_modules/semver/internal/parse-options.js +0 -17
- package/esm/node_modules/semver/internal/re.js +0 -223
- package/esm/node_modules/semver/ranges/gtr.js +0 -6
- package/esm/node_modules/semver/ranges/intersects.js +0 -9
- package/esm/node_modules/semver/ranges/ltr.js +0 -6
- package/esm/node_modules/semver/ranges/max-satisfying.js +0 -27
- package/esm/node_modules/semver/ranges/min-satisfying.js +0 -26
- package/esm/node_modules/semver/ranges/min-version.js +0 -63
- package/esm/node_modules/semver/ranges/outside.js +0 -82
- package/esm/node_modules/semver/ranges/simplify.js +0 -49
- package/esm/node_modules/semver/ranges/subset.js +0 -249
- package/esm/node_modules/semver/ranges/to-comparators.js +0 -10
- package/esm/node_modules/semver/ranges/valid.js +0 -13
- package/esm/util/fetch.ts.js +0 -190
- package/esm/util/index.ts.js +0 -276
package/package.json
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0.1-beta.
|
|
3
|
-
"main": "esm/index.ts.js",
|
|
2
|
+
"version": "1.0.1-beta.4",
|
|
4
3
|
"name": "@blueking/bkui-form",
|
|
4
|
+
"main": "dist/index.umd.js",
|
|
5
|
+
"module": "dist/index.es.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.es.js",
|
|
10
|
+
"require": "./dist/index.umd.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"./dist/style.css": "./dist/style.css"
|
|
14
|
+
},
|
|
5
15
|
"scripts": {
|
|
6
|
-
"build": "
|
|
7
|
-
"
|
|
8
|
-
"
|
|
16
|
+
"build": "vite build",
|
|
17
|
+
"dev": "vite",
|
|
18
|
+
"preview": "vite preview",
|
|
9
19
|
"playground": "node ./playground/server.js",
|
|
10
20
|
"test": "jest",
|
|
11
21
|
"coverage": "jest --coverage",
|
|
12
|
-
"build:tsc-esm": "tsc --emitDeclarationOnly -d --outDir /dist/esm/",
|
|
13
|
-
"build:tsc-umd": "tsc --emitDeclarationOnly -d --outDir /dist/umd/",
|
|
14
22
|
"docs:dev": "vitepress dev docs-vitepress",
|
|
15
23
|
"docs:build": "vitepress build docs-vitepress",
|
|
16
24
|
"docs:preview": "vitepress preview docs-vitepress"
|
|
17
25
|
},
|
|
18
26
|
"files": [
|
|
19
|
-
"
|
|
27
|
+
"dist/"
|
|
20
28
|
],
|
|
21
29
|
"keywords": [],
|
|
22
30
|
"author": "",
|
|
@@ -24,23 +32,27 @@
|
|
|
24
32
|
"description": "",
|
|
25
33
|
"devDependencies": {
|
|
26
34
|
"@babel/preset-typescript": "^7.23.3",
|
|
27
|
-
"@blueking/babel-preset-bk": "^2.1.0-beta.10",
|
|
28
|
-
"@blueking/cli-service": "0.1.0-beta.31",
|
|
29
|
-
"@blueking/eslint-config-bk": "2.1.0-beta.6",
|
|
30
35
|
"@types/jest": "^27.0.3",
|
|
31
36
|
"@types/json-schema": "^7.0.9",
|
|
32
37
|
"@types/node": "^20.10.1",
|
|
38
|
+
"@vitejs/plugin-vue": "^5.0.0",
|
|
39
|
+
"@vitejs/plugin-vue-jsx": "^3.1.0",
|
|
33
40
|
"bkui-vue": "^2.0.2-beta.62",
|
|
34
41
|
"fs-extra": "^11.2.0",
|
|
35
|
-
"gulp": "^4.0.2",
|
|
36
42
|
"jest": "^27.4.4",
|
|
37
43
|
"koa": "^2.7.0",
|
|
38
44
|
"koa-static": "^5.0.0",
|
|
39
45
|
"ts-jest": "^27.1.1",
|
|
40
46
|
"typescript": "^4.4.3",
|
|
47
|
+
"vite": "^5.0.0",
|
|
48
|
+
"vite-plugin-dts": "^3.7.0",
|
|
41
49
|
"vitepress": "^1.3.4",
|
|
42
50
|
"vue": "^3.3.9"
|
|
43
51
|
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"bkui-vue": ">=2.0.0",
|
|
54
|
+
"vue": ">=3.0.0"
|
|
55
|
+
},
|
|
44
56
|
"dependencies": {
|
|
45
57
|
"ajv": "^8.11.0",
|
|
46
58
|
"ajv-formats": "^2.1.1",
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { createVNode as _createVNode } from "vue";
|
|
2
|
-
import widgetTree from '../../core/widgetTree.ts.js';
|
|
3
|
-
import { h, defineComponent, withDirectives } from 'vue';
|
|
4
|
-
import props from '../field/FieldProps.ts.js';
|
|
5
|
-
import Schema from '../../core/schema.ts.js';
|
|
6
|
-
import { deepEquals } from '../../util/index.ts.js';
|
|
7
|
-
import { bkTooltips } from 'bkui-vue';
|
|
8
|
-
export default defineComponent({
|
|
9
|
-
name: 'FieldGroupWrap',
|
|
10
|
-
props: Object.assign(Object.assign({}, props), {
|
|
11
|
-
// 组类型
|
|
12
|
-
type: {
|
|
13
|
-
type: String,
|
|
14
|
-
default: 'default',
|
|
15
|
-
validator: (value)=>[
|
|
16
|
-
'default',
|
|
17
|
-
'normal',
|
|
18
|
-
'card'
|
|
19
|
-
].includes(value)
|
|
20
|
-
},
|
|
21
|
-
// 是否显示组title
|
|
22
|
-
showTitle: {
|
|
23
|
-
type: Boolean,
|
|
24
|
-
default: false
|
|
25
|
-
},
|
|
26
|
-
// 是否显示border
|
|
27
|
-
border: {
|
|
28
|
-
type: Boolean,
|
|
29
|
-
default: false
|
|
30
|
-
},
|
|
31
|
-
verifiable: {
|
|
32
|
-
type: Boolean,
|
|
33
|
-
default: false
|
|
34
|
-
},
|
|
35
|
-
hideEmptyRow: {
|
|
36
|
-
type: Boolean,
|
|
37
|
-
default: false
|
|
38
|
-
},
|
|
39
|
-
showResetDefault: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
default: false
|
|
42
|
-
}
|
|
43
|
-
}),
|
|
44
|
-
data () {
|
|
45
|
-
return {
|
|
46
|
-
groupErrorTips: {},
|
|
47
|
-
state: {
|
|
48
|
-
// 组类型目前只支持visible
|
|
49
|
-
visible: true
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
computed: {
|
|
54
|
-
// 兼容以前数据结构
|
|
55
|
-
value () {
|
|
56
|
-
return this.modelValue;
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
created () {
|
|
60
|
-
// 注册widget TreeNode
|
|
61
|
-
widgetTree.addWidgetNode(this.path, this, 'group');
|
|
62
|
-
},
|
|
63
|
-
mounted () {
|
|
64
|
-
// 更新样式
|
|
65
|
-
this.$forceUpdate();
|
|
66
|
-
},
|
|
67
|
-
beforeUnmount () {
|
|
68
|
-
widgetTree.removeWidgetNode(this.path, this);
|
|
69
|
-
},
|
|
70
|
-
methods: {
|
|
71
|
-
setState (key, value) {
|
|
72
|
-
if (Reflect.has(this.state, key)) {
|
|
73
|
-
this.state[key] = value;
|
|
74
|
-
} else {
|
|
75
|
-
console.warn(`Group unsupported ${key} state, please check`);
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
setGroupErrorTips (widgetPath, errorTips) {
|
|
79
|
-
this.groupErrorTips[widgetPath] = errorTips;
|
|
80
|
-
},
|
|
81
|
-
removeGroupErrorTips (widgetPath) {
|
|
82
|
-
delete this.groupErrorTips[widgetPath];
|
|
83
|
-
},
|
|
84
|
-
clearGroupErrorTips () {
|
|
85
|
-
this.groupErrorTips = {};
|
|
86
|
-
},
|
|
87
|
-
// 获取 schema 中定义的默认值
|
|
88
|
-
getDefaultValue () {
|
|
89
|
-
return Schema.getSchemaDefaultValue(this.schema);
|
|
90
|
-
},
|
|
91
|
-
// 恢复默认值
|
|
92
|
-
resetToDefault () {
|
|
93
|
-
const defaultValue = this.getDefaultValue();
|
|
94
|
-
this.$emit('update:modelValue', {
|
|
95
|
-
path: this.path,
|
|
96
|
-
value: defaultValue
|
|
97
|
-
});
|
|
98
|
-
},
|
|
99
|
-
// 判断当前值是否与默认值相同
|
|
100
|
-
isDefaultValue () {
|
|
101
|
-
const defaultValue = this.getDefaultValue();
|
|
102
|
-
return deepEquals(this.modelValue, defaultValue);
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
render () {
|
|
106
|
-
var _a, _b, _c, _d, _e, _f;
|
|
107
|
-
const schemaFormStyle = Object.assign({
|
|
108
|
-
position: 'relative',
|
|
109
|
-
border: this.border ? '1px solid #dcdee5' : 'none',
|
|
110
|
-
display: !this.state.visible ? 'none' : ''
|
|
111
|
-
}, ((_a = this.layout) === null || _a === void 0 ? void 0 : _a.item) || {});
|
|
112
|
-
const groupContentStyle = Object.assign({}, ((_b = this.layout) === null || _b === void 0 ? void 0 : _b.container) || {
|
|
113
|
-
display: 'grid',
|
|
114
|
-
gridGap: '24px' // 未设置layout的布局组的默认样式
|
|
115
|
-
});
|
|
116
|
-
const self = this;
|
|
117
|
-
const renderDelete = ()=>h('span', {
|
|
118
|
-
class: [
|
|
119
|
-
'bk-schema-form-group-delete'
|
|
120
|
-
],
|
|
121
|
-
onClick () {
|
|
122
|
-
self.$emit('remove', self.path);
|
|
123
|
-
}
|
|
124
|
-
}, [
|
|
125
|
-
h('i', {
|
|
126
|
-
class: [
|
|
127
|
-
'bk-form-icon icon-close3-shape'
|
|
128
|
-
]
|
|
129
|
-
})
|
|
130
|
-
]);
|
|
131
|
-
const title = ((_c = this.schema) === null || _c === void 0 ? void 0 : _c.title) || ((_d = this.layout) === null || _d === void 0 ? void 0 : _d.prop);
|
|
132
|
-
const groupErrorTipsContent = Object.keys(this.groupErrorTips).map((widgetPath)=>_createVNode("p", null, [
|
|
133
|
-
this.groupErrorTips[widgetPath]
|
|
134
|
-
]));
|
|
135
|
-
const hasError = JSON.stringify(this.groupErrorTips) !== '{}';
|
|
136
|
-
// 渲染恢复默认值按钮
|
|
137
|
-
const renderResetDefault = ()=>{
|
|
138
|
-
// 不显示恢复默认值按钮,或者当前值已经是默认值
|
|
139
|
-
if (!this.showResetDefault || this.isDefaultValue() || this.readonly || this.disabled) {
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
return withDirectives(h('span', {
|
|
143
|
-
class: [
|
|
144
|
-
'bk-schema-form-reset-default',
|
|
145
|
-
'bk-form-icon icon-reset'
|
|
146
|
-
],
|
|
147
|
-
onClick: ()=>{
|
|
148
|
-
self.resetToDefault();
|
|
149
|
-
}
|
|
150
|
-
}), [
|
|
151
|
-
[
|
|
152
|
-
bkTooltips,
|
|
153
|
-
{
|
|
154
|
-
content: '恢复默认值'
|
|
155
|
-
}
|
|
156
|
-
]
|
|
157
|
-
]);
|
|
158
|
-
};
|
|
159
|
-
return _createVNode("div", {
|
|
160
|
-
"class": [
|
|
161
|
-
'bk-schema-form-group',
|
|
162
|
-
this.type,
|
|
163
|
-
{
|
|
164
|
-
'hide-empty-row': this.hideEmptyRow
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
'bk-schema-form-group--error': hasError
|
|
168
|
-
}
|
|
169
|
-
],
|
|
170
|
-
"style": schemaFormStyle
|
|
171
|
-
}, [
|
|
172
|
-
title && this.showTitle ? _createVNode("span", {
|
|
173
|
-
"class": [
|
|
174
|
-
'bk-schema-form-group-title',
|
|
175
|
-
this.type
|
|
176
|
-
]
|
|
177
|
-
}, [
|
|
178
|
-
title,
|
|
179
|
-
renderResetDefault(),
|
|
180
|
-
hasError ? _createVNode("span", {
|
|
181
|
-
"class": "bk-schema-form-group__error-tips"
|
|
182
|
-
}, [
|
|
183
|
-
_createVNode("span", {
|
|
184
|
-
"class": "bk-schema-form-group__error-tips-popover"
|
|
185
|
-
}, [
|
|
186
|
-
groupErrorTipsContent
|
|
187
|
-
])
|
|
188
|
-
]) : null
|
|
189
|
-
]) : null,
|
|
190
|
-
_createVNode("div", {
|
|
191
|
-
"style": groupContentStyle,
|
|
192
|
-
"class": "bk-schema-form-group-content"
|
|
193
|
-
}, [
|
|
194
|
-
(_f = (_e = this.$slots) === null || _e === void 0 ? void 0 : _e.default) === null || _f === void 0 ? void 0 : _f.call(_e)
|
|
195
|
-
]),
|
|
196
|
-
this.removeable && renderDelete()
|
|
197
|
-
]);
|
|
198
|
-
}
|
|
199
|
-
});
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
var __rest = this && this.__rest || function(s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
4
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for(var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++){
|
|
5
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
6
|
-
}
|
|
7
|
-
return t;
|
|
8
|
-
};
|
|
9
|
-
import Schema from '../../core/schema.ts.js';
|
|
10
|
-
import { defineComponent, h } from 'vue';
|
|
11
|
-
import props from './FieldProps.ts.js';
|
|
12
|
-
import Widget from '../widget/Widget.ts.js';
|
|
13
|
-
import SchemaField from './SchemaField.tsx.js';
|
|
14
|
-
import Path from '../../core/path.ts.js';
|
|
15
|
-
import { mergeDeep } from '../../util/index.ts.js';
|
|
16
|
-
import ArrayWidget from '../widget/ArrayWidget.ts.js';
|
|
17
|
-
export default defineComponent({
|
|
18
|
-
name: 'ArrayField',
|
|
19
|
-
props,
|
|
20
|
-
render () {
|
|
21
|
-
const { schema, path } = this.$props;
|
|
22
|
-
if (Schema.isMultiSelect(schema) || Schema.isCustomArrayWidget(schema)) {
|
|
23
|
-
// 多选类型 或 自定义数组类型(伪数组类型(只有一个FormItem,但是值为数组,值一般由自定义Widget控件决定))
|
|
24
|
-
return h(Widget, Object.assign(Object.assign(Object.assign({}, this.$props), this.$attrs), {
|
|
25
|
-
key: path,
|
|
26
|
-
schema: mergeDeep({
|
|
27
|
-
'ui:component': {
|
|
28
|
-
multiple: true
|
|
29
|
-
}
|
|
30
|
-
}, this.$props.schema)
|
|
31
|
-
}), this.$slots);
|
|
32
|
-
}
|
|
33
|
-
// 元组类型
|
|
34
|
-
if (Schema.isTupleArray(schema)) {
|
|
35
|
-
const _a = Schema.getGroupWrap(schema), { name } = _a, vnode = __rest(_a, [
|
|
36
|
-
"name"
|
|
37
|
-
]);
|
|
38
|
-
const tupleVnodeList = schema.items.map((item, index)=>h(SchemaField, Object.assign(Object.assign(Object.assign({}, this.$props), this.$attrs), {
|
|
39
|
-
key: Path.getCurPath(path, index),
|
|
40
|
-
schema: item,
|
|
41
|
-
path: Path.getCurPath(path, index)
|
|
42
|
-
}), this.$slots));
|
|
43
|
-
return h(name, mergeDeep(Object.assign(Object.assign({}, this.$props), {
|
|
44
|
-
path,
|
|
45
|
-
showTitle: true
|
|
46
|
-
}), vnode), {
|
|
47
|
-
default: ()=>[
|
|
48
|
-
...tupleVnodeList
|
|
49
|
-
]
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
// 一般数组类型
|
|
53
|
-
return h(ArrayWidget, Object.assign(Object.assign({}, this.$attrs), this.$props), this.$slots);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h } from 'vue';
|
|
2
|
-
import props from './FieldProps.ts.js';
|
|
3
|
-
import Widget from '../widget/Widget.ts.js';
|
|
4
|
-
import { mergeDeep } from '../../util/index.ts.js';
|
|
5
|
-
export default defineComponent({
|
|
6
|
-
name: 'BooleanField',
|
|
7
|
-
props,
|
|
8
|
-
render () {
|
|
9
|
-
var _a;
|
|
10
|
-
const { name } = this.$props.schema['ui:component'] || {};
|
|
11
|
-
let widgetProps = {};
|
|
12
|
-
if ([
|
|
13
|
-
'radio',
|
|
14
|
-
'select'
|
|
15
|
-
].includes(name)) {
|
|
16
|
-
// radioGroup、select类型需要默认数据源
|
|
17
|
-
widgetProps = {
|
|
18
|
-
datasource: [
|
|
19
|
-
{
|
|
20
|
-
label: 'False',
|
|
21
|
-
value: false
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
label: 'True',
|
|
25
|
-
value: true
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
};
|
|
29
|
-
} else if (name === 'checkbox') {
|
|
30
|
-
// boolean 类型checkbox
|
|
31
|
-
widgetProps = {
|
|
32
|
-
label: (_a = this.$props.schema) === null || _a === void 0 ? void 0 : _a.title
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
return h(Widget, Object.assign(Object.assign(Object.assign({}, this.$props), this.$attrs), {
|
|
36
|
-
schema: mergeDeep({
|
|
37
|
-
'ui:component': Object.assign({}, widgetProps)
|
|
38
|
-
}, this.$props.schema)
|
|
39
|
-
}), this.$slots);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
var __rest = this && this.__rest || function(s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
4
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for(var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++){
|
|
5
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
6
|
-
}
|
|
7
|
-
return t;
|
|
8
|
-
};
|
|
9
|
-
import Path from '../../core/path.ts.js';
|
|
10
|
-
import register from '../../core/register.ts.js';
|
|
11
|
-
import Schema from '../../core/schema.ts.js';
|
|
12
|
-
import { isObj, mergeDeep } from '../../util/index.ts.js';
|
|
13
|
-
import { defineComponent, h } from 'vue';
|
|
14
|
-
import props from './FieldProps.ts.js';
|
|
15
|
-
import SchemaField from './SchemaField.tsx.js';
|
|
16
|
-
import Widget from '../widget/Widget.ts.js';
|
|
17
|
-
import { ajv } from '../../core/validator.ts.js';
|
|
18
|
-
export default defineComponent({
|
|
19
|
-
name: 'CompositionField',
|
|
20
|
-
props: Object.assign({}, props),
|
|
21
|
-
data () {
|
|
22
|
-
return {
|
|
23
|
-
activeIndex: -1
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
computed: {
|
|
27
|
-
composition () {
|
|
28
|
-
var _a, _b;
|
|
29
|
-
if ((_a = this.schema.anyOf) === null || _a === void 0 ? void 0 : _a.length) {
|
|
30
|
-
return 'anyOf';
|
|
31
|
-
}
|
|
32
|
-
if ((_b = this.schema.oneOf) === null || _b === void 0 ? void 0 : _b.length) {
|
|
33
|
-
return 'oneOf';
|
|
34
|
-
}
|
|
35
|
-
return '';
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
created () {
|
|
39
|
-
// 初始化默认 composition 选项
|
|
40
|
-
const compositionList = this.schema[this.composition] || [];
|
|
41
|
-
// 没有required选项时回显不成功
|
|
42
|
-
const index = compositionList.findIndex((item)=>ajv.validate(item, this.modelValue));
|
|
43
|
-
this.activeIndex = index > -1 ? index : 0;
|
|
44
|
-
},
|
|
45
|
-
render () {
|
|
46
|
-
const compositionList = this.schema[this.composition] || [];
|
|
47
|
-
const schemaList = compositionList.map((item)=>{
|
|
48
|
-
const data = mergeDeep({}, this.schema, item);
|
|
49
|
-
delete data[this.composition];
|
|
50
|
-
return data;
|
|
51
|
-
});
|
|
52
|
-
const _a = Schema.getUiProps(`ui:${this.composition}`, this.schema), { name: com = 'radio' } = _a, // 默认用radio组件
|
|
53
|
-
vnodeData = __rest(_a, [
|
|
54
|
-
"name"
|
|
55
|
-
]);
|
|
56
|
-
const isConst = typeof this.schema.type !== 'object' && schemaList.every((item)=>item.const);
|
|
57
|
-
if (isConst) {
|
|
58
|
-
// 全是常量
|
|
59
|
-
return h(Widget, Object.assign(Object.assign({}, this.$props), this.$attrs), this.$slots);
|
|
60
|
-
}
|
|
61
|
-
const compositionVnodeData = __rest(Schema.getUiProps('ui:composition', this.schema), []);
|
|
62
|
-
return h(register.getComponent('group'), mergeDeep(Object.assign(Object.assign({}, this.$props), {
|
|
63
|
-
rootData: this.rootData,
|
|
64
|
-
schema: this.schema,
|
|
65
|
-
modelValue: Path.getPathVal(this.rootData, this.path),
|
|
66
|
-
path: this.path,
|
|
67
|
-
onRemove () {
|
|
68
|
-
this.$emit('remove', this.path);
|
|
69
|
-
}
|
|
70
|
-
}), compositionVnodeData), {
|
|
71
|
-
default: ()=>[
|
|
72
|
-
// anyOf component
|
|
73
|
-
h(register.getBaseWidget('form-item'), {
|
|
74
|
-
label: vnodeData === null || vnodeData === void 0 ? void 0 : vnodeData.title
|
|
75
|
-
}, {
|
|
76
|
-
default: ()=>h(register.getComponent(com), mergeDeep({
|
|
77
|
-
modelValue: this.activeIndex,
|
|
78
|
-
datasource: schemaList.map((item, index)=>({
|
|
79
|
-
label: item.title || '',
|
|
80
|
-
value: index
|
|
81
|
-
})),
|
|
82
|
-
clearable: false,
|
|
83
|
-
'onUpdate:modelValue': (index)=>{
|
|
84
|
-
this.activeIndex = index;
|
|
85
|
-
// 删除其他 composition 字段
|
|
86
|
-
if (isObj(this.modelValue)) {
|
|
87
|
-
const newValue = JSON.parse(JSON.stringify(this.modelValue));
|
|
88
|
-
const props = compositionList.filter((_, index)=>index !== this.activeIndex).reduce((pre, item)=>{
|
|
89
|
-
const { properties = {} } = item;
|
|
90
|
-
pre.push(...Object.keys(properties));
|
|
91
|
-
return pre;
|
|
92
|
-
}, []);
|
|
93
|
-
props.forEach((prop)=>{
|
|
94
|
-
delete newValue[prop];
|
|
95
|
-
});
|
|
96
|
-
this.$emit('update:modelValue', {
|
|
97
|
-
path: this.path,
|
|
98
|
-
value: newValue
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}, vnodeData || {}))
|
|
103
|
-
}),
|
|
104
|
-
// schema
|
|
105
|
-
h(SchemaField, Object.assign(Object.assign(Object.assign({}, this.$props), this.$attrs), {
|
|
106
|
-
key: this.activeIndex,
|
|
107
|
-
removeable: false,
|
|
108
|
-
schema: schemaList[this.activeIndex]
|
|
109
|
-
}), this.$slots)
|
|
110
|
-
]
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
});
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import request from '../../util/fetch.ts.js';
|
|
2
|
-
export default {
|
|
3
|
-
// 当前项shema
|
|
4
|
-
schema: {
|
|
5
|
-
type: Object,
|
|
6
|
-
default: ()=>({})
|
|
7
|
-
},
|
|
8
|
-
// 当前路径(唯一标识)
|
|
9
|
-
path: {
|
|
10
|
-
type: String,
|
|
11
|
-
default: ''
|
|
12
|
-
},
|
|
13
|
-
// 是否必须字段
|
|
14
|
-
required: {
|
|
15
|
-
type: Boolean,
|
|
16
|
-
default: false
|
|
17
|
-
},
|
|
18
|
-
// 全量数据(只读)
|
|
19
|
-
rootData: {
|
|
20
|
-
type: Object,
|
|
21
|
-
default: ()=>({})
|
|
22
|
-
},
|
|
23
|
-
// 当前值
|
|
24
|
-
modelValue: {
|
|
25
|
-
type: [
|
|
26
|
-
String,
|
|
27
|
-
Number,
|
|
28
|
-
Array,
|
|
29
|
-
Object,
|
|
30
|
-
Boolean
|
|
31
|
-
]
|
|
32
|
-
},
|
|
33
|
-
// 布局配置
|
|
34
|
-
layout: {
|
|
35
|
-
type: Object,
|
|
36
|
-
default: ()=>({})
|
|
37
|
-
},
|
|
38
|
-
// 当前全局变量上下文
|
|
39
|
-
context: {
|
|
40
|
-
type: Object,
|
|
41
|
-
default: ()=>({})
|
|
42
|
-
},
|
|
43
|
-
// 当前项是否可移除
|
|
44
|
-
removeable: {
|
|
45
|
-
type: Boolean,
|
|
46
|
-
default: false
|
|
47
|
-
},
|
|
48
|
-
// http请求适配器
|
|
49
|
-
httpAdapter: {
|
|
50
|
-
type: Object,
|
|
51
|
-
default: ()=>({
|
|
52
|
-
request,
|
|
53
|
-
responseParse: (res)=>res
|
|
54
|
-
})
|
|
55
|
-
},
|
|
56
|
-
visible: {
|
|
57
|
-
type: Boolean,
|
|
58
|
-
default: true
|
|
59
|
-
},
|
|
60
|
-
error: {
|
|
61
|
-
type: Boolean,
|
|
62
|
-
default: false
|
|
63
|
-
},
|
|
64
|
-
disabled: {
|
|
65
|
-
type: Boolean,
|
|
66
|
-
default: false
|
|
67
|
-
},
|
|
68
|
-
readonly: {
|
|
69
|
-
type: Boolean,
|
|
70
|
-
default: false
|
|
71
|
-
},
|
|
72
|
-
readonlyMode: {
|
|
73
|
-
type: String,
|
|
74
|
-
default: 'value',
|
|
75
|
-
validator: (value)=>[
|
|
76
|
-
'value',
|
|
77
|
-
'custom'
|
|
78
|
-
].includes(value)
|
|
79
|
-
},
|
|
80
|
-
// 全局配置:是否显示恢复默认值按钮
|
|
81
|
-
showResetDefault: {
|
|
82
|
-
type: Boolean,
|
|
83
|
-
default: false
|
|
84
|
-
}
|
|
85
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { mergeDeep } from '../../util/index.ts.js';
|
|
2
|
-
import { defineComponent, h } from 'vue';
|
|
3
|
-
import props from './FieldProps.ts.js';
|
|
4
|
-
import StringField from './StringField.tsx.js';
|
|
5
|
-
export default defineComponent({
|
|
6
|
-
name: 'NumberField',
|
|
7
|
-
props,
|
|
8
|
-
render () {
|
|
9
|
-
var _a;
|
|
10
|
-
return h(StringField, Object.assign(Object.assign(Object.assign({}, this.$props), this.$attrs), {
|
|
11
|
-
schema: mergeDeep({
|
|
12
|
-
'ui:component': {
|
|
13
|
-
type: 'number',
|
|
14
|
-
min: ((_a = this.$props.schema) === null || _a === void 0 ? void 0 : _a.type) === 'integer' ? 0 : -Infinity
|
|
15
|
-
}
|
|
16
|
-
}, this.$props.schema)
|
|
17
|
-
}), this.$slots);
|
|
18
|
-
}
|
|
19
|
-
});
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
var __rest = this && this.__rest || function(s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
4
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for(var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++){
|
|
5
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
6
|
-
}
|
|
7
|
-
return t;
|
|
8
|
-
};
|
|
9
|
-
import { defineComponent, h } from 'vue';
|
|
10
|
-
import props from './FieldProps.ts.js';
|
|
11
|
-
import SchemaField from './SchemaField.tsx.js';
|
|
12
|
-
import Schema from '../../core/schema.ts.js';
|
|
13
|
-
import Path from '../../core/path.ts.js';
|
|
14
|
-
import Layout from '../../core/layout.ts.js';
|
|
15
|
-
import { mergeDeep, orderProperties } from '../../util/index.ts.js';
|
|
16
|
-
import Widget from '../widget/Widget.ts.js';
|
|
17
|
-
export default defineComponent({
|
|
18
|
-
name: 'ObjectField',
|
|
19
|
-
props,
|
|
20
|
-
render () {
|
|
21
|
-
const { schema, path, layout, rootData } = this.$props;
|
|
22
|
-
const properties = orderProperties(Object.keys(schema.properties || {}), schema['ui:order']);
|
|
23
|
-
let vNodeList = [];
|
|
24
|
-
if (properties.length) {
|
|
25
|
-
vNodeList = properties.map((name)=>{
|
|
26
|
-
var _a;
|
|
27
|
-
const curPath = Path.getCurPath(path, name);
|
|
28
|
-
const lastProp = curPath.split('.').pop();
|
|
29
|
-
const layoutConfig = Layout.findLayoutByProp(lastProp, layout.group || []) || {};
|
|
30
|
-
return h(SchemaField, Object.assign(Object.assign(Object.assign({}, this.$props), this.$attrs), {
|
|
31
|
-
key: curPath,
|
|
32
|
-
modelValue: Path.getPathVal(rootData, curPath),
|
|
33
|
-
schema: (_a = schema.properties) === null || _a === void 0 ? void 0 : _a[name],
|
|
34
|
-
required: Schema.isRequired(schema, name),
|
|
35
|
-
path: curPath,
|
|
36
|
-
layout: layoutConfig,
|
|
37
|
-
removeable: false
|
|
38
|
-
}), this.$slots);
|
|
39
|
-
});
|
|
40
|
-
} else if (Schema.getUiComponent(schema)) {
|
|
41
|
-
// 如果object属性没有配置 Properties,但是有ui:component属性,那个直接渲染对应的组件
|
|
42
|
-
vNodeList = [
|
|
43
|
-
h(Widget, Object.assign(Object.assign({}, this.$props), this.$attrs), this.$slots)
|
|
44
|
-
];
|
|
45
|
-
}
|
|
46
|
-
const _a = Schema.getGroupWrap(schema), { name } = _a, vnodeData = __rest(_a, [
|
|
47
|
-
"name"
|
|
48
|
-
]);
|
|
49
|
-
return h(name, mergeDeep(Object.assign(Object.assign(Object.assign({}, this.$props), this.$attrs), {
|
|
50
|
-
modelValue: Path.getPathVal(rootData, path),
|
|
51
|
-
path
|
|
52
|
-
}), vnodeData), {
|
|
53
|
-
default: ()=>[
|
|
54
|
-
...vNodeList
|
|
55
|
-
]
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
var __rest = this && this.__rest || function(s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
4
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for(var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++){
|
|
5
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
6
|
-
}
|
|
7
|
-
return t;
|
|
8
|
-
};
|
|
9
|
-
import { h, defineComponent } from 'vue';
|
|
10
|
-
import Schema from '../../core/schema.ts.js';
|
|
11
|
-
import props from './FieldProps.ts.js';
|
|
12
|
-
import Path from '../../core/path.ts.js';
|
|
13
|
-
export default defineComponent({
|
|
14
|
-
name: 'SchemaField',
|
|
15
|
-
props,
|
|
16
|
-
render () {
|
|
17
|
-
const { schema, rootData, path } = this.$props;
|
|
18
|
-
const resolveSchema = Schema.resolveSchema(schema);
|
|
19
|
-
if (!Object.keys(schema).length) return null;
|
|
20
|
-
const _a = Schema.getSchemaField(resolveSchema), { name } = _a, fieldProps = __rest(_a, [
|
|
21
|
-
"name"
|
|
22
|
-
]);
|
|
23
|
-
return name ? h(name, Object.assign(Object.assign(Object.assign(Object.assign({}, this.$attrs), this.$props), fieldProps), {
|
|
24
|
-
modelValue: Path.getPathVal(rootData, path),
|
|
25
|
-
schema: resolveSchema
|
|
26
|
-
}), this.$slots) : null;
|
|
27
|
-
}
|
|
28
|
-
});
|