raise-common-lib 0.0.195 → 0.0.197
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/bundles/raise-common-lib.umd.js +75 -21
- package/bundles/raise-common-lib.umd.js.map +1 -1
- package/bundles/raise-common-lib.umd.min.js +1 -1
- package/bundles/raise-common-lib.umd.min.js.map +1 -1
- package/esm2015/lib/form/drawer-form/drawer-form.component.js +66 -21
- package/esm5/lib/form/drawer-form/drawer-form.component.js +76 -22
- package/fesm2015/raise-common-lib.js +65 -20
- package/fesm2015/raise-common-lib.js.map +1 -1
- package/fesm5/raise-common-lib.js +75 -21
- package/fesm5/raise-common-lib.js.map +1 -1
- package/lib/form/drawer-form/drawer-form.component.d.ts +3 -1
- package/package.json +1 -1
- package/raise-common-lib.metadata.json +1 -1
|
@@ -22474,19 +22474,22 @@
|
|
|
22474
22474
|
* @return {?}
|
|
22475
22475
|
*/
|
|
22476
22476
|
function (changes) {
|
|
22477
|
+
if (changes._sections) {
|
|
22478
|
+
this.sections = filterShowSection(changes._sections.currentValue);
|
|
22479
|
+
this.form = this.getFormProxy(this.formatForm(this.sections, __assign({}, this.form)));
|
|
22480
|
+
this.syncFormField();
|
|
22481
|
+
this.formChange.emit(this.form);
|
|
22482
|
+
}
|
|
22477
22483
|
if (changes._form) {
|
|
22478
22484
|
if (!changes._form.currentValue[FORM_PROXY_TAG]) {
|
|
22479
|
-
this.form = this.getFormProxy(changes._form.currentValue);
|
|
22485
|
+
this.form = this.getFormProxy(this.formatForm(this.sections, changes._form.currentValue));
|
|
22486
|
+
this.syncFormField();
|
|
22480
22487
|
this.formChange.emit(this.form);
|
|
22481
22488
|
}
|
|
22482
22489
|
if (!changes._form.firstChange) {
|
|
22483
22490
|
this.checkFormChange(changes._form.previousValue, changes._form.currentValue);
|
|
22484
22491
|
}
|
|
22485
22492
|
}
|
|
22486
|
-
if (changes._sections) {
|
|
22487
|
-
this.sections = filterShowSection(changes._sections.currentValue);
|
|
22488
|
-
this.formatForm(this.sections);
|
|
22489
|
-
}
|
|
22490
22493
|
};
|
|
22491
22494
|
/**
|
|
22492
22495
|
* @return {?}
|
|
@@ -22591,6 +22594,29 @@
|
|
|
22591
22594
|
}));
|
|
22592
22595
|
}
|
|
22593
22596
|
};
|
|
22597
|
+
/**
|
|
22598
|
+
* @param {?} value
|
|
22599
|
+
* @param {?} compareValue
|
|
22600
|
+
* @return {?}
|
|
22601
|
+
*/
|
|
22602
|
+
DrawerFormComponent.prototype.equal = /**
|
|
22603
|
+
* @param {?} value
|
|
22604
|
+
* @param {?} compareValue
|
|
22605
|
+
* @return {?}
|
|
22606
|
+
*/
|
|
22607
|
+
function (value, compareValue) {
|
|
22608
|
+
// 只对数组进行特殊判断
|
|
22609
|
+
if (Array.isArray(value) && Array.isArray(compareValue)) {
|
|
22610
|
+
return (value.length === compareValue.length &&
|
|
22611
|
+
value.every((/**
|
|
22612
|
+
* @param {?} i
|
|
22613
|
+
* @param {?} index
|
|
22614
|
+
* @return {?}
|
|
22615
|
+
*/
|
|
22616
|
+
function (i, index) { return i === compareValue[index]; })));
|
|
22617
|
+
}
|
|
22618
|
+
return Object.is(value, compareValue);
|
|
22619
|
+
};
|
|
22594
22620
|
/**
|
|
22595
22621
|
* @param {?} previous
|
|
22596
22622
|
* @param {?} current
|
|
@@ -22609,7 +22635,7 @@
|
|
|
22609
22635
|
*/
|
|
22610
22636
|
function (_a) {
|
|
22611
22637
|
var _b = __read(_a, 2), key = _b[0], currentValue = _b[1];
|
|
22612
|
-
if (previous[key]
|
|
22638
|
+
if (!_this.equal(previous[key], currentValue)) {
|
|
22613
22639
|
/** @type {?} */
|
|
22614
22640
|
var field = _this.getField(key);
|
|
22615
22641
|
if (field) {
|
|
@@ -22638,16 +22664,43 @@
|
|
|
22638
22664
|
this.dateForm[field.formKey] = null;
|
|
22639
22665
|
}
|
|
22640
22666
|
};
|
|
22667
|
+
/**
|
|
22668
|
+
* @return {?}
|
|
22669
|
+
*/
|
|
22670
|
+
DrawerFormComponent.prototype.syncFormField = /**
|
|
22671
|
+
* @return {?}
|
|
22672
|
+
*/
|
|
22673
|
+
function () {
|
|
22674
|
+
var _this = this;
|
|
22675
|
+
this.sections.forEach((/**
|
|
22676
|
+
* @param {?} section
|
|
22677
|
+
* @return {?}
|
|
22678
|
+
*/
|
|
22679
|
+
function (section) {
|
|
22680
|
+
section.fields.forEach((/**
|
|
22681
|
+
* @param {?} field
|
|
22682
|
+
* @return {?}
|
|
22683
|
+
*/
|
|
22684
|
+
function (field) {
|
|
22685
|
+
switch (field.fieldFormType) {
|
|
22686
|
+
case "Datepicker":
|
|
22687
|
+
_this.syncFormToDateForm(field, _this.form[field.formKey]);
|
|
22688
|
+
break;
|
|
22689
|
+
}
|
|
22690
|
+
}));
|
|
22691
|
+
}));
|
|
22692
|
+
};
|
|
22641
22693
|
/**
|
|
22642
22694
|
* @param {?} sections
|
|
22695
|
+
* @param {?} form
|
|
22643
22696
|
* @return {?}
|
|
22644
22697
|
*/
|
|
22645
22698
|
DrawerFormComponent.prototype.formatForm = /**
|
|
22646
22699
|
* @param {?} sections
|
|
22700
|
+
* @param {?} form
|
|
22647
22701
|
* @return {?}
|
|
22648
22702
|
*/
|
|
22649
|
-
function (sections) {
|
|
22650
|
-
var _this = this;
|
|
22703
|
+
function (sections, form) {
|
|
22651
22704
|
sections.forEach((/**
|
|
22652
22705
|
* @param {?} section
|
|
22653
22706
|
* @return {?}
|
|
@@ -22662,30 +22715,28 @@
|
|
|
22662
22715
|
case "Text":
|
|
22663
22716
|
case "Email":
|
|
22664
22717
|
case "Textarea":
|
|
22665
|
-
if (
|
|
22666
|
-
|
|
22718
|
+
if (form[field.formKey] === undefined) {
|
|
22719
|
+
form[field.formKey] = "";
|
|
22667
22720
|
}
|
|
22668
22721
|
break;
|
|
22669
22722
|
case "Tags":
|
|
22670
22723
|
case "Checkbox":
|
|
22671
22724
|
case "MultiSelect":
|
|
22672
|
-
if (!Array.isArray(
|
|
22673
|
-
|
|
22725
|
+
if (!Array.isArray(form[field.formKey])) {
|
|
22726
|
+
form[field.formKey] = [];
|
|
22674
22727
|
}
|
|
22675
22728
|
break;
|
|
22676
22729
|
case "Switch":
|
|
22677
|
-
|
|
22678
|
-
break;
|
|
22679
|
-
case "Datepicker":
|
|
22680
|
-
_this.syncFormToDateForm(field, _this.form[field.formKey]);
|
|
22730
|
+
form[field.formKey] = !!form[field.formKey];
|
|
22681
22731
|
break;
|
|
22682
22732
|
default:
|
|
22683
|
-
if (
|
|
22684
|
-
|
|
22733
|
+
if (form[field.formKey] === undefined) {
|
|
22734
|
+
form[field.formKey] = null;
|
|
22685
22735
|
}
|
|
22686
22736
|
}
|
|
22687
22737
|
}));
|
|
22688
22738
|
}));
|
|
22739
|
+
return form;
|
|
22689
22740
|
};
|
|
22690
22741
|
/**
|
|
22691
22742
|
* @param {?} form
|
|
@@ -22697,7 +22748,7 @@
|
|
|
22697
22748
|
*/
|
|
22698
22749
|
function (form) {
|
|
22699
22750
|
var _this = this;
|
|
22700
|
-
//
|
|
22751
|
+
// 现在不支持嵌套 form 属性,只对浅层进行处理
|
|
22701
22752
|
/** @type {?} */
|
|
22702
22753
|
var proxyForm = new Proxy(form, {
|
|
22703
22754
|
set: (/**
|
|
@@ -22710,8 +22761,11 @@
|
|
|
22710
22761
|
target[prop] = value;
|
|
22711
22762
|
/** @type {?} */
|
|
22712
22763
|
var field = _this.getField(prop);
|
|
22713
|
-
if (field
|
|
22714
|
-
|
|
22764
|
+
if (field) {
|
|
22765
|
+
if (field.fieldFormType === "Datepicker") {
|
|
22766
|
+
_this.syncFormToDateForm(field, value);
|
|
22767
|
+
}
|
|
22768
|
+
_this.formItemValidator(field);
|
|
22715
22769
|
}
|
|
22716
22770
|
return true;
|
|
22717
22771
|
}),
|