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