raise-common-lib 0.0.195 → 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 +74 -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 +65 -21
- package/esm5/lib/form/drawer-form/drawer-form.component.js +75 -22
- package/fesm2015/raise-common-lib.js +64 -20
- package/fesm2015/raise-common-lib.js.map +1 -1
- package/fesm5/raise-common-lib.js +74 -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
|
@@ -22282,19 +22282,21 @@ var DrawerFormComponent = /** @class */ (function () {
|
|
|
22282
22282
|
* @return {?}
|
|
22283
22283
|
*/
|
|
22284
22284
|
function (changes) {
|
|
22285
|
+
if (changes._sections) {
|
|
22286
|
+
this.sections = filterShowSection(changes._sections.currentValue);
|
|
22287
|
+
this.form = this.getFormProxy(this.formatForm(this.sections, __assign({}, this.form)));
|
|
22288
|
+
this.syncFormField();
|
|
22289
|
+
}
|
|
22285
22290
|
if (changes._form) {
|
|
22286
22291
|
if (!changes._form.currentValue[FORM_PROXY_TAG]) {
|
|
22287
|
-
this.form = this.getFormProxy(changes._form.currentValue);
|
|
22292
|
+
this.form = this.getFormProxy(this.formatForm(this.sections, changes._form.currentValue));
|
|
22293
|
+
this.syncFormField();
|
|
22288
22294
|
this.formChange.emit(this.form);
|
|
22289
22295
|
}
|
|
22290
22296
|
if (!changes._form.firstChange) {
|
|
22291
22297
|
this.checkFormChange(changes._form.previousValue, changes._form.currentValue);
|
|
22292
22298
|
}
|
|
22293
22299
|
}
|
|
22294
|
-
if (changes._sections) {
|
|
22295
|
-
this.sections = filterShowSection(changes._sections.currentValue);
|
|
22296
|
-
this.formatForm(this.sections);
|
|
22297
|
-
}
|
|
22298
22300
|
};
|
|
22299
22301
|
/**
|
|
22300
22302
|
* @return {?}
|
|
@@ -22399,6 +22401,29 @@ var DrawerFormComponent = /** @class */ (function () {
|
|
|
22399
22401
|
}));
|
|
22400
22402
|
}
|
|
22401
22403
|
};
|
|
22404
|
+
/**
|
|
22405
|
+
* @param {?} value
|
|
22406
|
+
* @param {?} compareValue
|
|
22407
|
+
* @return {?}
|
|
22408
|
+
*/
|
|
22409
|
+
DrawerFormComponent.prototype.equal = /**
|
|
22410
|
+
* @param {?} value
|
|
22411
|
+
* @param {?} compareValue
|
|
22412
|
+
* @return {?}
|
|
22413
|
+
*/
|
|
22414
|
+
function (value, compareValue) {
|
|
22415
|
+
// 只对数组进行特殊判断
|
|
22416
|
+
if (Array.isArray(value) && Array.isArray(compareValue)) {
|
|
22417
|
+
return (value.length === compareValue.length &&
|
|
22418
|
+
value.every((/**
|
|
22419
|
+
* @param {?} i
|
|
22420
|
+
* @param {?} index
|
|
22421
|
+
* @return {?}
|
|
22422
|
+
*/
|
|
22423
|
+
function (i, index) { return i === compareValue[index]; })));
|
|
22424
|
+
}
|
|
22425
|
+
return Object.is(value, compareValue);
|
|
22426
|
+
};
|
|
22402
22427
|
/**
|
|
22403
22428
|
* @param {?} previous
|
|
22404
22429
|
* @param {?} current
|
|
@@ -22417,7 +22442,7 @@ var DrawerFormComponent = /** @class */ (function () {
|
|
|
22417
22442
|
*/
|
|
22418
22443
|
function (_a) {
|
|
22419
22444
|
var _b = __read(_a, 2), key = _b[0], currentValue = _b[1];
|
|
22420
|
-
if (previous[key]
|
|
22445
|
+
if (!_this.equal(previous[key], currentValue)) {
|
|
22421
22446
|
/** @type {?} */
|
|
22422
22447
|
var field = _this.getField(key);
|
|
22423
22448
|
if (field) {
|
|
@@ -22446,16 +22471,43 @@ var DrawerFormComponent = /** @class */ (function () {
|
|
|
22446
22471
|
this.dateForm[field.formKey] = null;
|
|
22447
22472
|
}
|
|
22448
22473
|
};
|
|
22474
|
+
/**
|
|
22475
|
+
* @return {?}
|
|
22476
|
+
*/
|
|
22477
|
+
DrawerFormComponent.prototype.syncFormField = /**
|
|
22478
|
+
* @return {?}
|
|
22479
|
+
*/
|
|
22480
|
+
function () {
|
|
22481
|
+
var _this = this;
|
|
22482
|
+
this.sections.forEach((/**
|
|
22483
|
+
* @param {?} section
|
|
22484
|
+
* @return {?}
|
|
22485
|
+
*/
|
|
22486
|
+
function (section) {
|
|
22487
|
+
section.fields.forEach((/**
|
|
22488
|
+
* @param {?} field
|
|
22489
|
+
* @return {?}
|
|
22490
|
+
*/
|
|
22491
|
+
function (field) {
|
|
22492
|
+
switch (field.fieldFormType) {
|
|
22493
|
+
case "Datepicker":
|
|
22494
|
+
_this.syncFormToDateForm(field, _this.form[field.formKey]);
|
|
22495
|
+
break;
|
|
22496
|
+
}
|
|
22497
|
+
}));
|
|
22498
|
+
}));
|
|
22499
|
+
};
|
|
22449
22500
|
/**
|
|
22450
22501
|
* @param {?} sections
|
|
22502
|
+
* @param {?} form
|
|
22451
22503
|
* @return {?}
|
|
22452
22504
|
*/
|
|
22453
22505
|
DrawerFormComponent.prototype.formatForm = /**
|
|
22454
22506
|
* @param {?} sections
|
|
22507
|
+
* @param {?} form
|
|
22455
22508
|
* @return {?}
|
|
22456
22509
|
*/
|
|
22457
|
-
function (sections) {
|
|
22458
|
-
var _this = this;
|
|
22510
|
+
function (sections, form) {
|
|
22459
22511
|
sections.forEach((/**
|
|
22460
22512
|
* @param {?} section
|
|
22461
22513
|
* @return {?}
|
|
@@ -22470,30 +22522,28 @@ var DrawerFormComponent = /** @class */ (function () {
|
|
|
22470
22522
|
case "Text":
|
|
22471
22523
|
case "Email":
|
|
22472
22524
|
case "Textarea":
|
|
22473
|
-
if (
|
|
22474
|
-
|
|
22525
|
+
if (form[field.formKey] === undefined) {
|
|
22526
|
+
form[field.formKey] = "";
|
|
22475
22527
|
}
|
|
22476
22528
|
break;
|
|
22477
22529
|
case "Tags":
|
|
22478
22530
|
case "Checkbox":
|
|
22479
22531
|
case "MultiSelect":
|
|
22480
|
-
if (!Array.isArray(
|
|
22481
|
-
|
|
22532
|
+
if (!Array.isArray(form[field.formKey])) {
|
|
22533
|
+
form[field.formKey] = [];
|
|
22482
22534
|
}
|
|
22483
22535
|
break;
|
|
22484
22536
|
case "Switch":
|
|
22485
|
-
|
|
22486
|
-
break;
|
|
22487
|
-
case "Datepicker":
|
|
22488
|
-
_this.syncFormToDateForm(field, _this.form[field.formKey]);
|
|
22537
|
+
form[field.formKey] = !!form[field.formKey];
|
|
22489
22538
|
break;
|
|
22490
22539
|
default:
|
|
22491
|
-
if (
|
|
22492
|
-
|
|
22540
|
+
if (form[field.formKey] === undefined) {
|
|
22541
|
+
form[field.formKey] = null;
|
|
22493
22542
|
}
|
|
22494
22543
|
}
|
|
22495
22544
|
}));
|
|
22496
22545
|
}));
|
|
22546
|
+
return form;
|
|
22497
22547
|
};
|
|
22498
22548
|
/**
|
|
22499
22549
|
* @param {?} form
|
|
@@ -22505,7 +22555,7 @@ var DrawerFormComponent = /** @class */ (function () {
|
|
|
22505
22555
|
*/
|
|
22506
22556
|
function (form) {
|
|
22507
22557
|
var _this = this;
|
|
22508
|
-
//
|
|
22558
|
+
// 现在不支持嵌套 form 属性,只对浅层进行处理
|
|
22509
22559
|
/** @type {?} */
|
|
22510
22560
|
var proxyForm = new Proxy(form, {
|
|
22511
22561
|
set: (/**
|
|
@@ -22518,8 +22568,11 @@ var DrawerFormComponent = /** @class */ (function () {
|
|
|
22518
22568
|
target[prop] = value;
|
|
22519
22569
|
/** @type {?} */
|
|
22520
22570
|
var field = _this.getField(prop);
|
|
22521
|
-
if (field
|
|
22522
|
-
|
|
22571
|
+
if (field) {
|
|
22572
|
+
if (field.fieldFormType === "Datepicker") {
|
|
22573
|
+
_this.syncFormToDateForm(field, value);
|
|
22574
|
+
}
|
|
22575
|
+
_this.formItemValidator(field);
|
|
22523
22576
|
}
|
|
22524
22577
|
return true;
|
|
22525
22578
|
}),
|