Skip to content

Commit 6c24321

Browse files
committed
build(build): build
1 parent 5452491 commit 6c24321

16 files changed

+598
-356
lines changed

packages/lib/vue2/vue2-form-element/dist/vueJsonSchemaForm.esm.js

Lines changed: 69 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ function mergeObjects(obj1, obj2) {
258258
// Recursively merge deeply nested objects.
259259
var preAcc = Object.assign({}, obj1); // Prevent mutation of source object.
260260

261+
if (!isObject(obj2)) return preAcc;
261262
return Object.keys(obj2).reduce(function (acc, key) {
262263
var left = obj1 ? obj1[key] : {};
263264
var right = obj2[key];
@@ -415,6 +416,8 @@ var genId = function genIdFn() {
415416
}(); // 空对象
416417

417418
function isEmptyObject(obj) {
419+
if (!obj) return true;
420+
418421
for (var key in obj) {
419422
if (Object.prototype.hasOwnProperty.call(obj, key)) {
420423
return false;
@@ -9250,27 +9253,27 @@ function computeDefaults(_schema, parentDefaults, rootSchema) {
92509253
});
92519254
} else if ('oneOf' in schema) {
92529255
var matchSchema = retrieveSchema(schema.oneOf[getMatchingOption(formData, schema.oneOf, rootSchema)], rootSchema, formData);
9253-
9254-
if (schema.properties && matchSchema.properties) {
9255-
// 对象 oneOf 需要合并原属性和 oneOf 属性
9256-
var mergeSchema = mergeObjects(schema, matchSchema);
9257-
delete mergeSchema.oneOf;
9258-
schema = mergeSchema;
9259-
} else {
9260-
schema = matchSchema;
9261-
}
9256+
schema = mergeObjects(schema, matchSchema);
9257+
delete schema.oneOf; // if (schema.properties && matchSchema.properties) {
9258+
// // 对象 oneOf 需要合并原属性和 oneOf 属性
9259+
// const mergeSchema = mergeObjects(schema, matchSchema);
9260+
// delete mergeSchema.oneOf;
9261+
// schema = mergeSchema;
9262+
// } else {
9263+
// schema = matchSchema;
9264+
// }
92629265
} else if ('anyOf' in schema) {
92639266
var _matchSchema = retrieveSchema(schema.anyOf[getMatchingOption(formData, schema.anyOf, rootSchema)], rootSchema, formData);
92649267

9265-
if (schema.properties && _matchSchema.properties) {
9266-
// 对象 anyOf 需要合并原属性和 anyOf 属性
9267-
var _mergeSchema = mergeObjects(schema, _matchSchema);
9268-
9269-
delete _mergeSchema.anyOf;
9270-
schema = _mergeSchema;
9271-
} else {
9272-
schema = _matchSchema;
9273-
}
9268+
schema = mergeObjects(schema, _matchSchema);
9269+
delete schema.anyOf; // if (schema.properties && matchSchema.properties) {
9270+
// // 对象 anyOf 需要合并原属性和 anyOf 属性
9271+
// const mergeSchema = mergeObjects(schema, matchSchema);
9272+
// delete mergeSchema.anyOf;
9273+
// schema = mergeSchema;
9274+
// } else {
9275+
// schema = matchSchema;
9276+
// }
92749277
} // Not defaults defined for this node, fallback to generic typed ones.
92759278

92769279

@@ -11435,42 +11438,41 @@ var SelectLinkageField = {
1143511438
_class4;
1143611439

1143711440
var curNodePath = this.$props.curNodePath;
11438-
var pathClassName = nodePath2ClassName(curNodePath); // object 需要保持原有属性,如果存在原有属性这里单独渲染
11441+
var pathClassName = nodePath2ClassName(curNodePath); // is object
1143911442

11440-
var originVNode = null;
11441-
var isTypeObject = this.schema.type === 'object' || this.schema.properties;
11443+
var isTypeObject = this.schema.type === 'object' || this.schema.properties; // 选择附加的节点
1144211444

11443-
if (isTypeObject && !isEmptyObject(this.schema.properties)) {
11444-
var _class2;
11445+
var childrenVNodeList = [this.getSelectBoxVNode()]; // 当前option内容
1144511446

11446-
var origSchema = Object.assign({}, this.schema);
11447-
delete origSchema[this.combiningType];
11448-
originVNode = h(SchemaField, {
11449-
key: "origin_".concat(this.combiningType),
11450-
class: (_class2 = {}, _defineProperty(_class2, "".concat(this.combiningType, "_originBox"), true), _defineProperty(_class2, "".concat(pathClassName, "-originBox"), true), _class2),
11451-
props: _objectSpread2(_objectSpread2({}, this.$props), {}, {
11452-
schema: origSchema // needValidFieldGroup: false // 单独校验,这里无需处理
11453-
11454-
})
11455-
});
11456-
} // 选择附加的节点
11457-
11458-
11459-
var childrenVNodeList = [this.getSelectBoxVNode()]; // 当前选中的 oneOf 附加的节点
11460-
11461-
var curSelectSchema = this.selectList[this.curSelectIndex];
11447+
var curSelectSchema = this.selectList[this.curSelectIndex]; // 当前选中节点合并schema
1146211448

1146311449
if (curSelectSchema) {
11464-
// 覆盖父级的属性
1146511450
var _this$schema = this.schema,
1146611451
_this$combiningType = this.combiningType,
1146711452
_ref3 = "".concat(this.combiningType, "Select");
1146811453
_this$schema.properties;
1146911454
_this$schema[_this$combiningType];
1147011455
_this$schema[_ref3];
11471-
var parentSchema = _objectWithoutProperties(_this$schema, ["properties", _this$combiningType, _ref3].map(_toPropertyKey));
11456+
var parentSchema = _objectWithoutProperties(_this$schema, ["properties", _this$combiningType, _ref3].map(_toPropertyKey)); // 合并父级schema
1147211457

11473-
curSelectSchema = Object.assign({}, parentSchema, curSelectSchema); // 当前节点的ui err配置,用来支持所有选项的统一配置
11458+
11459+
curSelectSchema = Object.assign({}, parentSchema, curSelectSchema);
11460+
} // object类型但没有附加属性
11461+
11462+
11463+
var isObjectEmptyAttachProperties = isTypeObject && isEmptyObject(curSelectSchema && curSelectSchema.properties); // 当前选中的 oneOf 附加节点 VNode
11464+
11465+
if (curSelectSchema && !isObjectEmptyAttachProperties) {
11466+
// 覆盖父级的属性
11467+
var _this$schema2 = this.schema,
11468+
_this$combiningType2 = this.combiningType,
11469+
_ref4 = "".concat(this.combiningType, "Select");
11470+
_this$schema2.properties;
11471+
_this$schema2[_this$combiningType2];
11472+
_this$schema2[_ref4];
11473+
var _parentSchema = _objectWithoutProperties(_this$schema2, ["properties", _this$combiningType2, _ref4].map(_toPropertyKey));
11474+
11475+
curSelectSchema = Object.assign({}, _parentSchema, curSelectSchema); // 当前节点的ui err配置,用来支持所有选项的统一配置
1147411476
// 取出 oneOf anyOf 同级配置,然后再合并到 当前选中的schema中
1147511477

1147611478
var userUiOptions = filterObject(getUiOptions({
@@ -11503,6 +11505,31 @@ var SelectLinkageField = {
1150311505

1150411506
})
1150511507
}));
11508+
} // object 需要保持原有属性,如果存在原有属性这里单独渲染
11509+
11510+
11511+
var originVNode = null;
11512+
11513+
if (isTypeObject && !isEmptyObject(this.schema.properties)) {
11514+
var _class2;
11515+
11516+
var _curSelectSchema = curSelectSchema;
11517+
_curSelectSchema.title;
11518+
_curSelectSchema.description;
11519+
_curSelectSchema.properties;
11520+
var optionSchema = _objectWithoutProperties(_curSelectSchema, ["title", "description", "properties"]); // object 原始项渲染也需要合并anyOf的内容
11521+
11522+
11523+
var origSchema = Object.assign({}, this.schema, optionSchema);
11524+
delete origSchema[this.combiningType];
11525+
originVNode = h(SchemaField, {
11526+
key: "origin_".concat(this.combiningType),
11527+
class: (_class2 = {}, _defineProperty(_class2, "".concat(this.combiningType, "_originBox"), true), _defineProperty(_class2, "".concat(pathClassName, "-originBox"), true), _class2),
11528+
props: _objectSpread2(_objectSpread2({}, this.$props), {}, {
11529+
schema: origSchema // needValidFieldGroup: false // 单独校验,这里无需处理
11530+
11531+
})
11532+
});
1150611533
} // oneOf 校验 VNode
1150711534

1150811535

packages/lib/vue2/vue2-form-element/dist/vueJsonSchemaForm.esm.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/lib/vue2/vue2-form-element/dist/vueJsonSchemaForm.umd.js

Lines changed: 69 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@
266266
// Recursively merge deeply nested objects.
267267
var preAcc = Object.assign({}, obj1); // Prevent mutation of source object.
268268

269+
if (!isObject(obj2)) return preAcc;
269270
return Object.keys(obj2).reduce(function (acc, key) {
270271
var left = obj1 ? obj1[key] : {};
271272
var right = obj2[key];
@@ -423,6 +424,8 @@
423424
}(); // 空对象
424425

425426
function isEmptyObject(obj) {
427+
if (!obj) return true;
428+
426429
for (var key in obj) {
427430
if (Object.prototype.hasOwnProperty.call(obj, key)) {
428431
return false;
@@ -9258,27 +9261,27 @@
92589261
});
92599262
} else if ('oneOf' in schema) {
92609263
var matchSchema = retrieveSchema(schema.oneOf[getMatchingOption(formData, schema.oneOf, rootSchema)], rootSchema, formData);
9261-
9262-
if (schema.properties && matchSchema.properties) {
9263-
// 对象 oneOf 需要合并原属性和 oneOf 属性
9264-
var mergeSchema = mergeObjects(schema, matchSchema);
9265-
delete mergeSchema.oneOf;
9266-
schema = mergeSchema;
9267-
} else {
9268-
schema = matchSchema;
9269-
}
9264+
schema = mergeObjects(schema, matchSchema);
9265+
delete schema.oneOf; // if (schema.properties && matchSchema.properties) {
9266+
// // 对象 oneOf 需要合并原属性和 oneOf 属性
9267+
// const mergeSchema = mergeObjects(schema, matchSchema);
9268+
// delete mergeSchema.oneOf;
9269+
// schema = mergeSchema;
9270+
// } else {
9271+
// schema = matchSchema;
9272+
// }
92709273
} else if ('anyOf' in schema) {
92719274
var _matchSchema = retrieveSchema(schema.anyOf[getMatchingOption(formData, schema.anyOf, rootSchema)], rootSchema, formData);
92729275

9273-
if (schema.properties && _matchSchema.properties) {
9274-
// 对象 anyOf 需要合并原属性和 anyOf 属性
9275-
var _mergeSchema = mergeObjects(schema, _matchSchema);
9276-
9277-
delete _mergeSchema.anyOf;
9278-
schema = _mergeSchema;
9279-
} else {
9280-
schema = _matchSchema;
9281-
}
9276+
schema = mergeObjects(schema, _matchSchema);
9277+
delete schema.anyOf; // if (schema.properties && matchSchema.properties) {
9278+
// // 对象 anyOf 需要合并原属性和 anyOf 属性
9279+
// const mergeSchema = mergeObjects(schema, matchSchema);
9280+
// delete mergeSchema.anyOf;
9281+
// schema = mergeSchema;
9282+
// } else {
9283+
// schema = matchSchema;
9284+
// }
92829285
} // Not defaults defined for this node, fallback to generic typed ones.
92839286

92849287

@@ -11443,42 +11446,41 @@
1144311446
_class4;
1144411447

1144511448
var curNodePath = this.$props.curNodePath;
11446-
var pathClassName = nodePath2ClassName(curNodePath); // object 需要保持原有属性,如果存在原有属性这里单独渲染
11449+
var pathClassName = nodePath2ClassName(curNodePath); // is object
1144711450

11448-
var originVNode = null;
11449-
var isTypeObject = this.schema.type === 'object' || this.schema.properties;
11451+
var isTypeObject = this.schema.type === 'object' || this.schema.properties; // 选择附加的节点
1145011452

11451-
if (isTypeObject && !isEmptyObject(this.schema.properties)) {
11452-
var _class2;
11453+
var childrenVNodeList = [this.getSelectBoxVNode()]; // 当前option内容
1145311454

11454-
var origSchema = Object.assign({}, this.schema);
11455-
delete origSchema[this.combiningType];
11456-
originVNode = h(SchemaField, {
11457-
key: "origin_".concat(this.combiningType),
11458-
class: (_class2 = {}, _defineProperty(_class2, "".concat(this.combiningType, "_originBox"), true), _defineProperty(_class2, "".concat(pathClassName, "-originBox"), true), _class2),
11459-
props: _objectSpread2(_objectSpread2({}, this.$props), {}, {
11460-
schema: origSchema // needValidFieldGroup: false // 单独校验,这里无需处理
11461-
11462-
})
11463-
});
11464-
} // 选择附加的节点
11465-
11466-
11467-
var childrenVNodeList = [this.getSelectBoxVNode()]; // 当前选中的 oneOf 附加的节点
11468-
11469-
var curSelectSchema = this.selectList[this.curSelectIndex];
11455+
var curSelectSchema = this.selectList[this.curSelectIndex]; // 当前选中节点合并schema
1147011456

1147111457
if (curSelectSchema) {
11472-
// 覆盖父级的属性
1147311458
var _this$schema = this.schema,
1147411459
_this$combiningType = this.combiningType,
1147511460
_ref3 = "".concat(this.combiningType, "Select");
1147611461
_this$schema.properties;
1147711462
_this$schema[_this$combiningType];
1147811463
_this$schema[_ref3];
11479-
var parentSchema = _objectWithoutProperties(_this$schema, ["properties", _this$combiningType, _ref3].map(_toPropertyKey));
11464+
var parentSchema = _objectWithoutProperties(_this$schema, ["properties", _this$combiningType, _ref3].map(_toPropertyKey)); // 合并父级schema
1148011465

11481-
curSelectSchema = Object.assign({}, parentSchema, curSelectSchema); // 当前节点的ui err配置,用来支持所有选项的统一配置
11466+
11467+
curSelectSchema = Object.assign({}, parentSchema, curSelectSchema);
11468+
} // object类型但没有附加属性
11469+
11470+
11471+
var isObjectEmptyAttachProperties = isTypeObject && isEmptyObject(curSelectSchema && curSelectSchema.properties); // 当前选中的 oneOf 附加节点 VNode
11472+
11473+
if (curSelectSchema && !isObjectEmptyAttachProperties) {
11474+
// 覆盖父级的属性
11475+
var _this$schema2 = this.schema,
11476+
_this$combiningType2 = this.combiningType,
11477+
_ref4 = "".concat(this.combiningType, "Select");
11478+
_this$schema2.properties;
11479+
_this$schema2[_this$combiningType2];
11480+
_this$schema2[_ref4];
11481+
var _parentSchema = _objectWithoutProperties(_this$schema2, ["properties", _this$combiningType2, _ref4].map(_toPropertyKey));
11482+
11483+
curSelectSchema = Object.assign({}, _parentSchema, curSelectSchema); // 当前节点的ui err配置,用来支持所有选项的统一配置
1148211484
// 取出 oneOf anyOf 同级配置,然后再合并到 当前选中的schema中
1148311485

1148411486
var userUiOptions = filterObject(getUiOptions({
@@ -11511,6 +11513,31 @@
1151111513

1151211514
})
1151311515
}));
11516+
} // object 需要保持原有属性,如果存在原有属性这里单独渲染
11517+
11518+
11519+
var originVNode = null;
11520+
11521+
if (isTypeObject && !isEmptyObject(this.schema.properties)) {
11522+
var _class2;
11523+
11524+
var _curSelectSchema = curSelectSchema;
11525+
_curSelectSchema.title;
11526+
_curSelectSchema.description;
11527+
_curSelectSchema.properties;
11528+
var optionSchema = _objectWithoutProperties(_curSelectSchema, ["title", "description", "properties"]); // object 原始项渲染也需要合并anyOf的内容
11529+
11530+
11531+
var origSchema = Object.assign({}, this.schema, optionSchema);
11532+
delete origSchema[this.combiningType];
11533+
originVNode = h(SchemaField, {
11534+
key: "origin_".concat(this.combiningType),
11535+
class: (_class2 = {}, _defineProperty(_class2, "".concat(this.combiningType, "_originBox"), true), _defineProperty(_class2, "".concat(pathClassName, "-originBox"), true), _class2),
11536+
props: _objectSpread2(_objectSpread2({}, this.$props), {}, {
11537+
schema: origSchema // needValidFieldGroup: false // 单独校验,这里无需处理
11538+
11539+
})
11540+
});
1151411541
} // oneOf 校验 VNode
1151511542

1151611543

0 commit comments

Comments
 (0)