Skip to content

Commit 4bd9e82

Browse files
committed
build: build lib
1 parent be915ad commit 4bd9e82

File tree

4 files changed

+57
-33
lines changed

4 files changed

+57
-33
lines changed

packages/lib/dist/vueJsonSchemaForm.esm.js

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ function localizeZh(errors) {
266266
}
267267
}
268268

269-
/**
270-
* Created by Liu.Jun on 2020/4/30 11:22.
269+
/**
270+
* Created by Liu.Jun on 2020/4/30 11:22.
271271
*/
272272
var i18n = {
273273
$$currentLocalizeFn: localizeZh,
@@ -9359,6 +9359,7 @@ var ObjectField = {
93599359
slot: 'default'
93609360
}, [].concat(_toConsumableArray(propertiesVNodeList), [// 插入一个Widget,校验 object组 - minProperties. maxProperties. oneOf 等需要外层校验的数据
93619361
needValidFieldGroup ? h(Widget, {
9362+
key: 'validateWidget-object',
93629363
class: {
93639364
validateWidget: true,
93649365
'validateWidget-object': true
@@ -9820,7 +9821,7 @@ var UploadWidget = {
98209821
var value;
98219822

98229823
var geUrl = function geUrl(fileItem) {
9823-
return fileItem && (fileItem.url || _this.responseFileUrl(fileItem.response)) || '';
9824+
return fileItem && (fileItem.response && _this.responseFileUrl(fileItem.response) || fileItem.url) || '';
98249825
};
98259826

98269827
if (this.isArrayValue) {
@@ -9850,6 +9851,11 @@ var UploadWidget = {
98509851
if (_this2.$message) {
98519852
_this2.$message.warning('超出文件上传数');
98529853
}
9854+
},
9855+
'on-error': function onError() {
9856+
if (_this2.$message) {
9857+
_this2.$message.error('文件上传失败');
9858+
}
98539859
}
98549860
}, attrs), {}, {
98559861
'on-remove': function onRemove(file, fileList) {
@@ -9875,7 +9881,7 @@ var UploadWidget = {
98759881
if (slots && slots.default) {
98769882
childVNode.push(h('template', {
98779883
slot: 'default'
9878-
}, [slots.default]));
9884+
}, [typeof slots.default === 'function' ? slots.default(h) : slots.default]));
98799885
} else {
98809886
childVNode.push(h('el-button', {
98819887
props: {
@@ -9887,7 +9893,7 @@ var UploadWidget = {
98879893
if (slots && slots.tip) {
98889894
childVNode.push(h('template', {
98899895
slot: 'tip'
9890-
}, [slots.tip]));
9896+
}, [typeof slots.tip === 'function' ? slots.tip(h) : slots.tip]));
98919897
}
98929898

98939899
return h('el-upload', data, childVNode);
@@ -9938,6 +9944,7 @@ var WIDGET_MAP = {
99389944

99399945
},
99409946
formats: {
9947+
color: 'el-color-picker',
99419948
time: TimePickerWidget$1,
99429949
// 20:20:39+00:00
99439950
date: DatePickerWidget$1,
@@ -9976,7 +9983,7 @@ var StringField = {
99769983
};
99779984
}); // 存在枚举数据列表 传入 enumOptions
99789985

9979-
if (enumOptions) {
9986+
if (enumOptions && !widgetConfig.uiProps.enumOptions) {
99809987
widgetConfig.uiProps.enumOptions = enumOptions;
99819988
}
99829989

@@ -10037,7 +10044,7 @@ var BooleanField = {
1003710044
widget: WIDGET_MAP.types.boolean
1003810045
};
1003910046
});
10040-
widgetConfig.uiProps.enumOptions = enumOptions;
10047+
widgetConfig.uiProps.enumOptions = widgetConfig.uiProps.enumOptions || enumOptions;
1004110048
return h(Widget, _objectSpread2(_objectSpread2({}, context.data), {}, {
1004210049
props: _objectSpread2(_objectSpread2({}, context.props), widgetConfig)
1004310050
}));
@@ -10557,7 +10564,7 @@ var ArrayFieldMultiSelect = {
1055710564

1055810565
widgetConfig.uiProps.multiple = true;
1055910566

10560-
if (enumOptions) {
10567+
if (enumOptions && !widgetConfig.uiProps.enumOptions) {
1056110568
widgetConfig.uiProps.enumOptions = enumOptions;
1056210569
}
1056310570

@@ -10911,6 +10918,7 @@ var ArrayField = {
1091110918
}
1091210919
}), // 插入一个Widget,校验 array - maxItems. minItems. uniqueItems 等items外的属性校验
1091310920
this.needValidFieldGroup ? h(Widget, {
10921+
key: 'validateWidget-array',
1091410922
class: {
1091510923
validateWidget: true,
1091610924
'validateWidget-array': true
@@ -11133,6 +11141,7 @@ var SelectLinkageField = {
1113311141

1113411142

1113511143
childrenVNodeList.push(h(Widget, {
11144+
key: "validateWidget-".concat(this.combiningType),
1113611145
class: _defineProperty({
1113711146
validateWidget: true
1113811147
}, "validateWidget-".concat(this.combiningType), true),
@@ -11187,8 +11196,8 @@ var OneOfField = {
1118711196
}
1118811197
};
1118911198

11190-
/**
11191-
* Created by Liu.Jun on 2020/4/20 9:55 下午.
11199+
/**
11200+
* Created by Liu.Jun on 2020/4/20 9:55 下午.
1119211201
*/
1119311202

1119411203
var FIELDS_MAPS = {
@@ -11650,8 +11659,8 @@ var formUtils = /*#__PURE__*/Object.freeze({
1165011659
optionsList: optionsList
1165111660
});
1165211661

11653-
/**
11654-
* Created by Liu.Jun on 2020/4/16 10:47 下午.
11662+
/**
11663+
* Created by Liu.Jun on 2020/4/16 10:47 下午.
1165511664
*/
1165611665
var vueProps$1 = {
1165711666
formFooter: {
@@ -11915,9 +11924,12 @@ var JsonSchemaForm = {
1191511924
self.$emit('on-cancel');
1191611925
},
1191711926
onSubmit: function onSubmit() {
11918-
self.$refs.genEditForm.validate().then(function () {
11919-
// console.log(self.$refs.genEditForm);
11920-
self.$emit('on-submit', self.formData);
11927+
self.$refs.genEditForm.validate(function (isValid, resData) {
11928+
if (isValid) {
11929+
return self.$emit('on-submit', self.formData);
11930+
}
11931+
11932+
return self.$emit('on-validation-failed', resData);
1192111933
});
1192211934
}
1192311935
}

packages/lib/dist/vueJsonSchemaForm.esm.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/lib/dist/vueJsonSchemaForm.umd.js

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,8 @@
272272
}
273273
}
274274

275-
/**
276-
* Created by Liu.Jun on 2020/4/30 11:22.
275+
/**
276+
* Created by Liu.Jun on 2020/4/30 11:22.
277277
*/
278278
var i18n = {
279279
$$currentLocalizeFn: localizeZh,
@@ -9365,6 +9365,7 @@
93659365
slot: 'default'
93669366
}, [].concat(_toConsumableArray(propertiesVNodeList), [// 插入一个Widget,校验 object组 - minProperties. maxProperties. oneOf 等需要外层校验的数据
93679367
needValidFieldGroup ? h(Widget, {
9368+
key: 'validateWidget-object',
93689369
class: {
93699370
validateWidget: true,
93709371
'validateWidget-object': true
@@ -9826,7 +9827,7 @@
98269827
var value;
98279828

98289829
var geUrl = function geUrl(fileItem) {
9829-
return fileItem && (fileItem.url || _this.responseFileUrl(fileItem.response)) || '';
9830+
return fileItem && (fileItem.response && _this.responseFileUrl(fileItem.response) || fileItem.url) || '';
98309831
};
98319832

98329833
if (this.isArrayValue) {
@@ -9856,6 +9857,11 @@
98569857
if (_this2.$message) {
98579858
_this2.$message.warning('超出文件上传数');
98589859
}
9860+
},
9861+
'on-error': function onError() {
9862+
if (_this2.$message) {
9863+
_this2.$message.error('文件上传失败');
9864+
}
98599865
}
98609866
}, attrs), {}, {
98619867
'on-remove': function onRemove(file, fileList) {
@@ -9881,7 +9887,7 @@
98819887
if (slots && slots.default) {
98829888
childVNode.push(h('template', {
98839889
slot: 'default'
9884-
}, [slots.default]));
9890+
}, [typeof slots.default === 'function' ? slots.default(h) : slots.default]));
98859891
} else {
98869892
childVNode.push(h('el-button', {
98879893
props: {
@@ -9893,7 +9899,7 @@
98939899
if (slots && slots.tip) {
98949900
childVNode.push(h('template', {
98959901
slot: 'tip'
9896-
}, [slots.tip]));
9902+
}, [typeof slots.tip === 'function' ? slots.tip(h) : slots.tip]));
98979903
}
98989904

98999905
return h('el-upload', data, childVNode);
@@ -9944,6 +9950,7 @@
99449950

99459951
},
99469952
formats: {
9953+
color: 'el-color-picker',
99479954
time: TimePickerWidget$1,
99489955
// 20:20:39+00:00
99499956
date: DatePickerWidget$1,
@@ -9982,7 +9989,7 @@
99829989
};
99839990
}); // 存在枚举数据列表 传入 enumOptions
99849991

9985-
if (enumOptions) {
9992+
if (enumOptions && !widgetConfig.uiProps.enumOptions) {
99869993
widgetConfig.uiProps.enumOptions = enumOptions;
99879994
}
99889995

@@ -10043,7 +10050,7 @@
1004310050
widget: WIDGET_MAP.types.boolean
1004410051
};
1004510052
});
10046-
widgetConfig.uiProps.enumOptions = enumOptions;
10053+
widgetConfig.uiProps.enumOptions = widgetConfig.uiProps.enumOptions || enumOptions;
1004710054
return h(Widget, _objectSpread2(_objectSpread2({}, context.data), {}, {
1004810055
props: _objectSpread2(_objectSpread2({}, context.props), widgetConfig)
1004910056
}));
@@ -10563,7 +10570,7 @@
1056310570

1056410571
widgetConfig.uiProps.multiple = true;
1056510572

10566-
if (enumOptions) {
10573+
if (enumOptions && !widgetConfig.uiProps.enumOptions) {
1056710574
widgetConfig.uiProps.enumOptions = enumOptions;
1056810575
}
1056910576

@@ -10917,6 +10924,7 @@
1091710924
}
1091810925
}), // 插入一个Widget,校验 array - maxItems. minItems. uniqueItems 等items外的属性校验
1091910926
this.needValidFieldGroup ? h(Widget, {
10927+
key: 'validateWidget-array',
1092010928
class: {
1092110929
validateWidget: true,
1092210930
'validateWidget-array': true
@@ -11139,6 +11147,7 @@
1113911147

1114011148

1114111149
childrenVNodeList.push(h(Widget, {
11150+
key: "validateWidget-".concat(this.combiningType),
1114211151
class: _defineProperty({
1114311152
validateWidget: true
1114411153
}, "validateWidget-".concat(this.combiningType), true),
@@ -11193,8 +11202,8 @@
1119311202
}
1119411203
};
1119511204

11196-
/**
11197-
* Created by Liu.Jun on 2020/4/20 9:55 下午.
11205+
/**
11206+
* Created by Liu.Jun on 2020/4/20 9:55 下午.
1119811207
*/
1119911208

1120011209
var FIELDS_MAPS = {
@@ -11656,8 +11665,8 @@
1165611665
optionsList: optionsList
1165711666
});
1165811667

11659-
/**
11660-
* Created by Liu.Jun on 2020/4/16 10:47 下午.
11668+
/**
11669+
* Created by Liu.Jun on 2020/4/16 10:47 下午.
1166111670
*/
1166211671
var vueProps$1 = {
1166311672
formFooter: {
@@ -11921,9 +11930,12 @@
1192111930
self.$emit('on-cancel');
1192211931
},
1192311932
onSubmit: function onSubmit() {
11924-
self.$refs.genEditForm.validate().then(function () {
11925-
// console.log(self.$refs.genEditForm);
11926-
self.$emit('on-submit', self.formData);
11933+
self.$refs.genEditForm.validate(function (isValid, resData) {
11934+
if (isValid) {
11935+
return self.$emit('on-submit', self.formData);
11936+
}
11937+
11938+
return self.$emit('on-validation-failed', resData);
1192711939
});
1192811940
}
1192911941
}

0 commit comments

Comments
 (0)