@blueking/bkui-form 1.0.1-beta.2 → 1.0.1-beta.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/esm/adapter/common/FieldGroupWrap.tsx.js +199 -0
- package/esm/adapter/field/ArrayField.tsx.js +55 -0
- package/esm/adapter/field/BooleanField.tsx.js +41 -0
- package/esm/adapter/field/CompositionField.tsx.js +113 -0
- package/esm/adapter/field/FieldProps.ts.js +85 -0
- package/esm/adapter/field/NumberField.tsx.js +19 -0
- package/esm/adapter/field/ObjectField.tsx.js +58 -0
- package/esm/adapter/field/SchemaField.tsx.js +28 -0
- package/esm/adapter/field/StringField.tsx.js +4 -0
- package/esm/adapter/widget/ArrayWidget.ts.js +196 -0
- package/esm/adapter/widget/ButtonWidget.ts.js +76 -0
- package/esm/adapter/widget/CheckboxWidget.ts.js +101 -0
- package/esm/adapter/widget/CollapseGroupWidget.ts.js +140 -0
- package/esm/adapter/widget/ColorPickerWidget.ts.js +71 -0
- package/esm/adapter/widget/InputWidget.ts.js +79 -0
- package/esm/adapter/widget/KeyValueArrayWidget.tsx.js +156 -0
- package/esm/adapter/widget/RadioWidget.ts.js +98 -0
- package/esm/adapter/widget/SelectWidget.ts.js +98 -0
- package/esm/adapter/widget/SwitchWidget.ts.js +73 -0
- package/esm/adapter/widget/TabGroupWidget.ts.js +145 -0
- package/esm/adapter/widget/TableWidget.ts.js +205 -0
- package/esm/adapter/widget/Widget.ts.js +497 -0
- package/esm/assets/fonts/iconcool.eot +0 -0
- package/esm/assets/fonts/iconcool.ttf +0 -0
- package/esm/assets/fonts/iconcool.woff +0 -0
- package/esm/assets/style.css +43 -0
- package/esm/controller/form.css +164 -0
- package/esm/controller/form.tsx.js +159 -0
- package/esm/controller/props.ts.js +75 -0
- package/esm/core/events.ts.js +74 -0
- package/esm/core/expression.ts.js +67 -0
- package/esm/core/lang.ts.js +25 -0
- package/esm/core/layout.ts.js +149 -0
- package/esm/core/path.ts.js +60 -0
- package/esm/core/proxy.ts.js +10 -0
- package/esm/core/reaction.ts.js +116 -0
- package/esm/core/register.ts.js +74 -0
- package/esm/core/schema.ts.js +302 -0
- package/esm/core/validator.ts.js +248 -0
- package/esm/core/widgetTree.ts.js +163 -0
- package/esm/index.ts.js +6 -0
- package/esm/node_modules/@blueking/cli-service/dist/lib/path.js +35 -0
- package/esm/node_modules/@blueking/cli-service/dist/lib/util.js +233 -0
- package/esm/node_modules/@blueking/cli-service/dist/tools/rust/helper/path.js +172 -0
- package/esm/node_modules/ajv/dist/ajv.js +50 -0
- package/esm/node_modules/ajv/dist/compile/codegen/code.js +156 -0
- package/esm/node_modules/ajv/dist/compile/codegen/index.js +697 -0
- package/esm/node_modules/ajv/dist/compile/codegen/scope.js +143 -0
- package/esm/node_modules/ajv/dist/compile/errors.js +123 -0
- package/esm/node_modules/ajv/dist/compile/index.js +242 -0
- package/esm/node_modules/ajv/dist/compile/names.js +28 -0
- package/esm/node_modules/ajv/dist/compile/ref_error.js +12 -0
- package/esm/node_modules/ajv/dist/compile/resolve.js +155 -0
- package/esm/node_modules/ajv/dist/compile/rules.js +26 -0
- package/esm/node_modules/ajv/dist/compile/util.js +178 -0
- package/esm/node_modules/ajv/dist/compile/validate/applicability.js +19 -0
- package/esm/node_modules/ajv/dist/compile/validate/boolSchema.js +50 -0
- package/esm/node_modules/ajv/dist/compile/validate/dataType.js +203 -0
- package/esm/node_modules/ajv/dist/compile/validate/defaults.js +35 -0
- package/esm/node_modules/ajv/dist/compile/validate/index.js +520 -0
- package/esm/node_modules/ajv/dist/compile/validate/keyword.js +124 -0
- package/esm/node_modules/ajv/dist/compile/validate/subschema.js +81 -0
- package/esm/node_modules/ajv/dist/core.js +618 -0
- package/esm/node_modules/ajv/dist/refs/data.json +13 -0
- package/esm/node_modules/ajv/dist/refs/json-schema-draft-07.json +151 -0
- package/esm/node_modules/ajv/dist/runtime/equal.js +7 -0
- package/esm/node_modules/ajv/dist/runtime/ucs2length.js +24 -0
- package/esm/node_modules/ajv/dist/runtime/uri.js +6 -0
- package/esm/node_modules/ajv/dist/runtime/validation_error.js +11 -0
- package/esm/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +49 -0
- package/esm/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +106 -0
- package/esm/node_modules/ajv/dist/vocabularies/applicator/allOf.js +23 -0
- package/esm/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +12 -0
- package/esm/node_modules/ajv/dist/vocabularies/applicator/contains.js +95 -0
- package/esm/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +85 -0
- package/esm/node_modules/ajv/dist/vocabularies/applicator/if.js +66 -0
- package/esm/node_modules/ajv/dist/vocabularies/applicator/index.js +44 -0
- package/esm/node_modules/ajv/dist/vocabularies/applicator/items.js +52 -0
- package/esm/node_modules/ajv/dist/vocabularies/applicator/items2020.js +30 -0
- package/esm/node_modules/ajv/dist/vocabularies/applicator/not.js +26 -0
- package/esm/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +60 -0
- package/esm/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +75 -0
- package/esm/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +12 -0
- package/esm/node_modules/ajv/dist/vocabularies/applicator/properties.js +54 -0
- package/esm/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +38 -0
- package/esm/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +13 -0
- package/esm/node_modules/ajv/dist/vocabularies/code.js +131 -0
- package/esm/node_modules/ajv/dist/vocabularies/core/id.js +10 -0
- package/esm/node_modules/ajv/dist/vocabularies/core/index.js +16 -0
- package/esm/node_modules/ajv/dist/vocabularies/core/ref.js +122 -0
- package/esm/node_modules/ajv/dist/vocabularies/discriminator/index.js +104 -0
- package/esm/node_modules/ajv/dist/vocabularies/discriminator/types.js +9 -0
- package/esm/node_modules/ajv/dist/vocabularies/draft7.js +17 -0
- package/esm/node_modules/ajv/dist/vocabularies/format/format.js +92 -0
- package/esm/node_modules/ajv/dist/vocabularies/format/index.js +6 -0
- package/esm/node_modules/ajv/dist/vocabularies/metadata.js +18 -0
- package/esm/node_modules/ajv/dist/vocabularies/validation/const.js +25 -0
- package/esm/node_modules/ajv/dist/vocabularies/validation/enum.js +48 -0
- package/esm/node_modules/ajv/dist/vocabularies/validation/index.js +33 -0
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitItems.js +24 -0
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitLength.js +27 -0
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +27 -0
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +24 -0
- package/esm/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +26 -0
- package/esm/node_modules/ajv/dist/vocabularies/validation/pattern.js +24 -0
- package/esm/node_modules/ajv/dist/vocabularies/validation/required.js +79 -0
- package/esm/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +64 -0
- package/esm/node_modules/ajv-formats/dist/formats.js +173 -0
- package/esm/node_modules/ajv-formats/dist/index.js +37 -0
- package/esm/node_modules/ajv-formats/dist/limit.js +69 -0
- package/esm/node_modules/ajv-i18n/localize/zh/index.js +154 -0
- package/esm/node_modules/fast-deep-equal/index.js +46 -0
- package/esm/node_modules/fast-uri/index.js +303 -0
- package/esm/node_modules/fast-uri/lib/schemes.js +188 -0
- package/esm/node_modules/fast-uri/lib/scopedChars.js +30 -0
- package/esm/node_modules/fast-uri/lib/utils.js +244 -0
- package/esm/node_modules/json-schema-traverse/index.js +89 -0
- package/esm/node_modules/semver/classes/comparator.js +143 -0
- package/esm/node_modules/semver/classes/range.js +557 -0
- package/esm/node_modules/semver/classes/semver.js +333 -0
- package/esm/node_modules/semver/functions/clean.js +8 -0
- package/esm/node_modules/semver/functions/cmp.js +54 -0
- package/esm/node_modules/semver/functions/coerce.js +62 -0
- package/esm/node_modules/semver/functions/compare-build.js +9 -0
- package/esm/node_modules/semver/functions/compare-loose.js +5 -0
- package/esm/node_modules/semver/functions/compare.js +7 -0
- package/esm/node_modules/semver/functions/diff.js +60 -0
- package/esm/node_modules/semver/functions/eq.js +5 -0
- package/esm/node_modules/semver/functions/gt.js +5 -0
- package/esm/node_modules/semver/functions/gte.js +5 -0
- package/esm/node_modules/semver/functions/inc.js +21 -0
- package/esm/node_modules/semver/functions/lt.js +5 -0
- package/esm/node_modules/semver/functions/lte.js +5 -0
- package/esm/node_modules/semver/functions/major.js +5 -0
- package/esm/node_modules/semver/functions/minor.js +5 -0
- package/esm/node_modules/semver/functions/neq.js +5 -0
- package/esm/node_modules/semver/functions/parse.js +18 -0
- package/esm/node_modules/semver/functions/patch.js +5 -0
- package/esm/node_modules/semver/functions/prerelease.js +8 -0
- package/esm/node_modules/semver/functions/rcompare.js +5 -0
- package/esm/node_modules/semver/functions/rsort.js +5 -0
- package/esm/node_modules/semver/functions/satisfies.js +12 -0
- package/esm/node_modules/semver/functions/sort.js +5 -0
- package/esm/node_modules/semver/functions/valid.js +8 -0
- package/esm/node_modules/semver/index.js +91 -0
- package/esm/node_modules/semver/internal/constants.js +37 -0
- package/esm/node_modules/semver/internal/debug.js +11 -0
- package/esm/node_modules/semver/internal/identifiers.js +29 -0
- package/esm/node_modules/semver/internal/lrucache.js +42 -0
- package/esm/node_modules/semver/internal/parse-options.js +17 -0
- package/esm/node_modules/semver/internal/re.js +223 -0
- package/esm/node_modules/semver/ranges/gtr.js +6 -0
- package/esm/node_modules/semver/ranges/intersects.js +9 -0
- package/esm/node_modules/semver/ranges/ltr.js +6 -0
- package/esm/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/esm/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/esm/node_modules/semver/ranges/min-version.js +63 -0
- package/esm/node_modules/semver/ranges/outside.js +82 -0
- package/esm/node_modules/semver/ranges/simplify.js +49 -0
- package/esm/node_modules/semver/ranges/subset.js +249 -0
- package/esm/node_modules/semver/ranges/to-comparators.js +10 -0
- package/esm/node_modules/semver/ranges/valid.js +13 -0
- package/esm/util/fetch.ts.js +190 -0
- package/esm/util/index.ts.js +276 -0
- package/package.json +3 -3
- package/dist/main.css +0 -208
- package/dist/main.js +0 -17353
- /package/{dist/svg/iconcool.eb237688.svg → esm/assets/fonts/iconcool.svg} +0 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_define_property(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
function ownKeys(object, enumerableOnly) {
|
|
30
|
+
var keys = Object.keys(object);
|
|
31
|
+
if (Object.getOwnPropertySymbols) {
|
|
32
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
33
|
+
if (enumerableOnly) {
|
|
34
|
+
symbols = symbols.filter(function(sym) {
|
|
35
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
keys.push.apply(keys, symbols);
|
|
39
|
+
}
|
|
40
|
+
return keys;
|
|
41
|
+
}
|
|
42
|
+
function _object_spread_props(target, source) {
|
|
43
|
+
source = source != null ? source : {};
|
|
44
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
45
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
46
|
+
} else {
|
|
47
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
48
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return target;
|
|
52
|
+
}
|
|
53
|
+
function _object_without_properties(source, excluded) {
|
|
54
|
+
if (source == null) return {};
|
|
55
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
56
|
+
var key, i;
|
|
57
|
+
if (Object.getOwnPropertySymbols) {
|
|
58
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
59
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
60
|
+
key = sourceSymbolKeys[i];
|
|
61
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
62
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
63
|
+
target[key] = source[key];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return target;
|
|
67
|
+
}
|
|
68
|
+
function _object_without_properties_loose(source, excluded) {
|
|
69
|
+
if (source == null) return {};
|
|
70
|
+
var target = {};
|
|
71
|
+
var sourceKeys = Object.keys(source);
|
|
72
|
+
var key, i;
|
|
73
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
74
|
+
key = sourceKeys[i];
|
|
75
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
76
|
+
target[key] = source[key];
|
|
77
|
+
}
|
|
78
|
+
return target;
|
|
79
|
+
}
|
|
80
|
+
import Schema from '../../core/schema.ts.js';
|
|
81
|
+
import { defineComponent, h } from 'vue';
|
|
82
|
+
import props from '../field/FieldProps.ts.js';
|
|
83
|
+
import { mergeDeep } from '../../util/index.ts.js';
|
|
84
|
+
import SchemaField from '../field/SchemaField.tsx.js';
|
|
85
|
+
import Path from '../../core/path.ts.js';
|
|
86
|
+
import register from '../../core/register.ts.js';
|
|
87
|
+
import locale from '../../core/lang.ts.js';
|
|
88
|
+
// 默认数组控件
|
|
89
|
+
export default defineComponent({
|
|
90
|
+
name: 'ArrayWidget',
|
|
91
|
+
props: _object_spread_props(_object_spread({}, props), {
|
|
92
|
+
modelValue: {
|
|
93
|
+
type: Array,
|
|
94
|
+
default: ()=>[]
|
|
95
|
+
}
|
|
96
|
+
}),
|
|
97
|
+
mounted () {
|
|
98
|
+
this.handleFillItem();
|
|
99
|
+
},
|
|
100
|
+
methods: {
|
|
101
|
+
// 补全minItems项
|
|
102
|
+
handleFillItem () {
|
|
103
|
+
const { minItems = 0 } = this.schema;
|
|
104
|
+
const valueLen = this.modelValue ? this.modelValue.length : 0;
|
|
105
|
+
if (valueLen < minItems) {
|
|
106
|
+
const data = Schema.getSchemaDefaultValue(this.schema.items);
|
|
107
|
+
const remainData = new Array(minItems - valueLen).fill(data);
|
|
108
|
+
this.$emit('update:modelValue', {
|
|
109
|
+
path: this.path,
|
|
110
|
+
value: [
|
|
111
|
+
...this.modelValue || [],
|
|
112
|
+
...remainData
|
|
113
|
+
]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
// 添加item
|
|
118
|
+
handleAddItem () {
|
|
119
|
+
const data = Schema.getSchemaDefaultValue(this.schema.items);
|
|
120
|
+
const value = JSON.parse(JSON.stringify(this.modelValue || []));
|
|
121
|
+
value.push(data);
|
|
122
|
+
this.$emit('update:modelValue', {
|
|
123
|
+
path: this.path,
|
|
124
|
+
value
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
// 删除item
|
|
128
|
+
handleDeleteItem (path) {
|
|
129
|
+
const index = Number(Path.getPathLastProp(path));
|
|
130
|
+
const value = JSON.parse(JSON.stringify(this.modelValue || []));
|
|
131
|
+
value.splice(index, 1);
|
|
132
|
+
this.$emit('update:modelValue', {
|
|
133
|
+
path: this.path,
|
|
134
|
+
value
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
render () {
|
|
139
|
+
const self = this;
|
|
140
|
+
const arrVnodeList = (Array.isArray(this.modelValue) ? this.modelValue : []).map((_, index)=>{
|
|
141
|
+
const curPath = Path.getCurPath(this.path, index);
|
|
142
|
+
return h(SchemaField, _object_spread_props(_object_spread({}, this.$props, this.$attrs), {
|
|
143
|
+
key: `${curPath}-${this.modelValue.length}`,
|
|
144
|
+
schema: this.schema.items,
|
|
145
|
+
path: curPath,
|
|
146
|
+
layout: _object_spread_props(_object_spread({}, this.layout), {
|
|
147
|
+
item: {}
|
|
148
|
+
}),
|
|
149
|
+
removeable: true,
|
|
150
|
+
onRemove (path) {
|
|
151
|
+
self.handleDeleteItem(path);
|
|
152
|
+
}
|
|
153
|
+
}));
|
|
154
|
+
});
|
|
155
|
+
const _Schema_getGroupWrap = Schema.getGroupWrap(this.schema), { name } = _Schema_getGroupWrap, vnode = _object_without_properties(_Schema_getGroupWrap, [
|
|
156
|
+
"name"
|
|
157
|
+
]);
|
|
158
|
+
return h(name, mergeDeep(_object_spread_props(_object_spread({}, this.$props), {
|
|
159
|
+
layout: {},
|
|
160
|
+
showTitle: true,
|
|
161
|
+
style: _object_spread({}, this.layout.item || {}),
|
|
162
|
+
// 监听 FieldGroupWrap 的 update:modelValue 事件(用于重置默认值等功能)
|
|
163
|
+
'onUpdate:modelValue': (data)=>{
|
|
164
|
+
self.$emit('update:modelValue', data);
|
|
165
|
+
}
|
|
166
|
+
}), vnode), {
|
|
167
|
+
default: ()=>[
|
|
168
|
+
...arrVnodeList,
|
|
169
|
+
!this.readonly ? h(register.getBaseWidget('form-item'), {
|
|
170
|
+
labelWidth: 0,
|
|
171
|
+
class: {
|
|
172
|
+
'bk-schema-form-item-auto-height': true
|
|
173
|
+
}
|
|
174
|
+
}, {
|
|
175
|
+
default: ()=>[
|
|
176
|
+
h('span', {
|
|
177
|
+
class: [
|
|
178
|
+
'bk-schema-form-group-add'
|
|
179
|
+
],
|
|
180
|
+
onClick () {
|
|
181
|
+
self.handleAddItem();
|
|
182
|
+
}
|
|
183
|
+
}, [
|
|
184
|
+
h('i', {
|
|
185
|
+
class: [
|
|
186
|
+
'bk-form-icon icon-plus-circle-shape mr5'
|
|
187
|
+
]
|
|
188
|
+
}),
|
|
189
|
+
locale('add')
|
|
190
|
+
])
|
|
191
|
+
]
|
|
192
|
+
}) : undefined
|
|
193
|
+
]
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_define_property(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
function ownKeys(object, enumerableOnly) {
|
|
30
|
+
var keys = Object.keys(object);
|
|
31
|
+
if (Object.getOwnPropertySymbols) {
|
|
32
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
33
|
+
if (enumerableOnly) {
|
|
34
|
+
symbols = symbols.filter(function(sym) {
|
|
35
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
keys.push.apply(keys, symbols);
|
|
39
|
+
}
|
|
40
|
+
return keys;
|
|
41
|
+
}
|
|
42
|
+
function _object_spread_props(target, source) {
|
|
43
|
+
source = source != null ? source : {};
|
|
44
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
45
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
46
|
+
} else {
|
|
47
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
48
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return target;
|
|
52
|
+
}
|
|
53
|
+
import register from '../../core/register.ts.js';
|
|
54
|
+
import { defineComponent, h } from 'vue';
|
|
55
|
+
export default defineComponent({
|
|
56
|
+
name: 'ButtonWidget',
|
|
57
|
+
props: {
|
|
58
|
+
word: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: ''
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
methods: {
|
|
64
|
+
handleClick () {
|
|
65
|
+
this.$emit('click');
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
render () {
|
|
69
|
+
const self = this;
|
|
70
|
+
return h(register.getBaseWidget('button'), _object_spread_props(_object_spread({}, this.$attrs), {
|
|
71
|
+
onClick: self.handleClick()
|
|
72
|
+
}), {
|
|
73
|
+
default: ()=>this.word
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
});
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_define_property(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
function ownKeys(object, enumerableOnly) {
|
|
30
|
+
var keys = Object.keys(object);
|
|
31
|
+
if (Object.getOwnPropertySymbols) {
|
|
32
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
33
|
+
if (enumerableOnly) {
|
|
34
|
+
symbols = symbols.filter(function(sym) {
|
|
35
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
keys.push.apply(keys, symbols);
|
|
39
|
+
}
|
|
40
|
+
return keys;
|
|
41
|
+
}
|
|
42
|
+
function _object_spread_props(target, source) {
|
|
43
|
+
source = source != null ? source : {};
|
|
44
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
45
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
46
|
+
} else {
|
|
47
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
48
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return target;
|
|
52
|
+
}
|
|
53
|
+
import register from '../../core/register.ts.js';
|
|
54
|
+
import { defineComponent, h } from 'vue';
|
|
55
|
+
export default defineComponent({
|
|
56
|
+
name: 'CheckboxWidget',
|
|
57
|
+
props: {
|
|
58
|
+
datasource: {
|
|
59
|
+
type: Array,
|
|
60
|
+
default: ()=>[]
|
|
61
|
+
},
|
|
62
|
+
modelValue: {
|
|
63
|
+
type: [
|
|
64
|
+
Array,
|
|
65
|
+
Boolean
|
|
66
|
+
],
|
|
67
|
+
default: ()=>[]
|
|
68
|
+
},
|
|
69
|
+
// 单个checkbox时文案
|
|
70
|
+
label: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: ''
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
methods: {
|
|
76
|
+
handleChange (val) {
|
|
77
|
+
this.$emit('update:modelValue', val);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
render () {
|
|
81
|
+
return Array.isArray(this.modelValue) ? h(register.getBaseWidget('checkbox-group'), {
|
|
82
|
+
modelValue: this.modelValue,
|
|
83
|
+
onChange: this.handleChange
|
|
84
|
+
}, {
|
|
85
|
+
default: ()=>this.datasource.map((item)=>h(register.getBaseWidget('checkbox'), _object_spread_props(_object_spread({}, this.$attrs), {
|
|
86
|
+
key: item.value,
|
|
87
|
+
class: [
|
|
88
|
+
'mr24'
|
|
89
|
+
],
|
|
90
|
+
label: item.value
|
|
91
|
+
}), {
|
|
92
|
+
default: ()=>item.label
|
|
93
|
+
}))
|
|
94
|
+
}) : h(register.getBaseWidget('checkbox'), {
|
|
95
|
+
modelValue: this.modelValue,
|
|
96
|
+
onChange: this.handleChange
|
|
97
|
+
}, {
|
|
98
|
+
default: ()=>this.label
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
});
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_define_property(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
function ownKeys(object, enumerableOnly) {
|
|
30
|
+
var keys = Object.keys(object);
|
|
31
|
+
if (Object.getOwnPropertySymbols) {
|
|
32
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
33
|
+
if (enumerableOnly) {
|
|
34
|
+
symbols = symbols.filter(function(sym) {
|
|
35
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
keys.push.apply(keys, symbols);
|
|
39
|
+
}
|
|
40
|
+
return keys;
|
|
41
|
+
}
|
|
42
|
+
function _object_spread_props(target, source) {
|
|
43
|
+
source = source != null ? source : {};
|
|
44
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
45
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
46
|
+
} else {
|
|
47
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
48
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return target;
|
|
52
|
+
}
|
|
53
|
+
import Layout from '../../core/layout.ts.js';
|
|
54
|
+
import Path from '../../core/path.ts.js';
|
|
55
|
+
import register from '../../core/register.ts.js';
|
|
56
|
+
import Schema from '../../core/schema.ts.js';
|
|
57
|
+
import { orderProperties } from '../../util/index.ts.js';
|
|
58
|
+
import { defineComponent, h } from 'vue';
|
|
59
|
+
import FieldGroupWrap from '../common/FieldGroupWrap.tsx.js';
|
|
60
|
+
import props from '../field/FieldProps.ts.js';
|
|
61
|
+
import SchemaField from '../field/SchemaField.tsx.js';
|
|
62
|
+
export default defineComponent({
|
|
63
|
+
name: 'CollapseWidget',
|
|
64
|
+
props: _object_spread_props(_object_spread({}, props), {
|
|
65
|
+
type: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: 'default',
|
|
68
|
+
validator: (value)=>[
|
|
69
|
+
'default',
|
|
70
|
+
'normal',
|
|
71
|
+
'card'
|
|
72
|
+
].includes(value)
|
|
73
|
+
},
|
|
74
|
+
showTitle: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: false
|
|
77
|
+
},
|
|
78
|
+
border: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: false
|
|
81
|
+
},
|
|
82
|
+
defaultActiveName: {
|
|
83
|
+
type: Array,
|
|
84
|
+
default: ()=>[]
|
|
85
|
+
},
|
|
86
|
+
verifiable: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: false
|
|
89
|
+
}
|
|
90
|
+
}),
|
|
91
|
+
data () {
|
|
92
|
+
return {
|
|
93
|
+
activeName: this.defaultActiveName
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
render () {
|
|
97
|
+
var _this_schema;
|
|
98
|
+
const groupWrapProps = _object_spread_props(_object_spread({}, this.$props), {
|
|
99
|
+
layout: _object_spread_props(_object_spread({}, this.layout), {
|
|
100
|
+
container: {}
|
|
101
|
+
}),
|
|
102
|
+
title: this.schema.title
|
|
103
|
+
});
|
|
104
|
+
const properties = orderProperties(Object.keys(((_this_schema = this.schema) === null || _this_schema === void 0 ? void 0 : _this_schema.properties) || {}), this.schema['ui:order']);
|
|
105
|
+
const collapseItems = properties.map((key)=>{
|
|
106
|
+
var _this_schema_properties, _this_schema;
|
|
107
|
+
const schemaItem = (_this_schema = this.schema) === null || _this_schema === void 0 ? void 0 : (_this_schema_properties = _this_schema.properties) === null || _this_schema_properties === void 0 ? void 0 : _this_schema_properties[key];
|
|
108
|
+
const curPath = Path.getCurPath(this.path, key);
|
|
109
|
+
const lastProp = curPath.split('.').pop();
|
|
110
|
+
const layoutConfig = Layout.findLayoutByProp(lastProp, this.layout.group || []) || {};
|
|
111
|
+
return h(register.getBaseWidget('collapse-panel'), {
|
|
112
|
+
key,
|
|
113
|
+
name: key,
|
|
114
|
+
title: schemaItem.title
|
|
115
|
+
}, {
|
|
116
|
+
content: ()=>h(SchemaField, _object_spread_props(_object_spread({
|
|
117
|
+
key: curPath
|
|
118
|
+
}, this.$props, this.$attrs), {
|
|
119
|
+
schema: schemaItem,
|
|
120
|
+
required: Schema.isRequired(schemaItem, key),
|
|
121
|
+
path: curPath,
|
|
122
|
+
layout: layoutConfig,
|
|
123
|
+
removeable: false
|
|
124
|
+
}))
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
const self = this;
|
|
128
|
+
return h(FieldGroupWrap, _object_spread({}, groupWrapProps), {
|
|
129
|
+
default: ()=>h(register.getBaseWidget('collapse'), {
|
|
130
|
+
'use-card-theme': true,
|
|
131
|
+
modelValue: this.activeName,
|
|
132
|
+
'onUpdate:modelValue' (actives) {
|
|
133
|
+
self.activeName = actives;
|
|
134
|
+
}
|
|
135
|
+
}, {
|
|
136
|
+
default: ()=>collapseItems
|
|
137
|
+
})
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_define_property(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
function ownKeys(object, enumerableOnly) {
|
|
30
|
+
var keys = Object.keys(object);
|
|
31
|
+
if (Object.getOwnPropertySymbols) {
|
|
32
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
33
|
+
if (enumerableOnly) {
|
|
34
|
+
symbols = symbols.filter(function(sym) {
|
|
35
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
keys.push.apply(keys, symbols);
|
|
39
|
+
}
|
|
40
|
+
return keys;
|
|
41
|
+
}
|
|
42
|
+
function _object_spread_props(target, source) {
|
|
43
|
+
source = source != null ? source : {};
|
|
44
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
45
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
46
|
+
} else {
|
|
47
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
48
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return target;
|
|
52
|
+
}
|
|
53
|
+
import register from '../../core/register.ts.js';
|
|
54
|
+
import { defineComponent, h } from 'vue';
|
|
55
|
+
export default defineComponent({
|
|
56
|
+
name: 'ColorPicker',
|
|
57
|
+
props: {
|
|
58
|
+
modelValue: String
|
|
59
|
+
},
|
|
60
|
+
methods: {
|
|
61
|
+
handleChange (color) {
|
|
62
|
+
this.$emit('update:modelValue', color);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
render () {
|
|
66
|
+
return h(register.getBaseWidget('color-picker'), _object_spread_props(_object_spread({}, this.$attrs), {
|
|
67
|
+
modelValue: this.modelValue,
|
|
68
|
+
onChange: this.handleChange
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_define_property(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
import register from '../../core/register.ts.js';
|
|
30
|
+
import { defineComponent, h } from 'vue';
|
|
31
|
+
export default defineComponent({
|
|
32
|
+
name: 'InputWidget',
|
|
33
|
+
props: {
|
|
34
|
+
modelValue: [
|
|
35
|
+
String,
|
|
36
|
+
Number
|
|
37
|
+
],
|
|
38
|
+
unit: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: ''
|
|
41
|
+
},
|
|
42
|
+
maxRows: {
|
|
43
|
+
type: Number,
|
|
44
|
+
default: 0
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
computed: {
|
|
48
|
+
rows () {
|
|
49
|
+
const len = String(this.modelValue).split('\n').length;
|
|
50
|
+
return len <= this.maxRows ? len : this.maxRows;
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
methods: {
|
|
54
|
+
handleInput (v) {
|
|
55
|
+
if (this.$attrs.type === 'number') {
|
|
56
|
+
this.$emit('update:modelValue', isNaN(v) || v === '' ? v : Number(v));
|
|
57
|
+
} else {
|
|
58
|
+
this.$emit('update:modelValue', v);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
handleBlur (e) {
|
|
62
|
+
var _e_target;
|
|
63
|
+
const value = e === null || e === void 0 ? void 0 : (_e_target = e.target) === null || _e_target === void 0 ? void 0 : _e_target.value;
|
|
64
|
+
if (this.$attrs.type === 'number' && isNaN(value)) {
|
|
65
|
+
this.$emit('update:modelValue', this.$attrs.min || 0);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
render () {
|
|
70
|
+
return h(register.getBaseWidget('input'), _object_spread({
|
|
71
|
+
suffix: this.unit,
|
|
72
|
+
modelValue: this.modelValue,
|
|
73
|
+
rows: this.rows,
|
|
74
|
+
type: this.maxRows > 1 || Number(this.$attrs.rows) > 1 ? 'textarea' : 'text',
|
|
75
|
+
onInput: this.handleInput,
|
|
76
|
+
onBlur: this.handleBlur
|
|
77
|
+
}, this.$attrs));
|
|
78
|
+
}
|
|
79
|
+
});
|